:root {
  --bg: #0d0f12;
  --panel: #15181e;
  --panel2: #1c2027;
  --line: #303640;
  --text: #f3f4f6;
  --muted: #9aa3af;
  --red: #e04444;
  --red2: #ff5a4f;
  --amber: #e7b34a;
  --green: #6fcf97;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { touch-action: manipulation; overscroll-behavior: none; }
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
#app { width: 100%; height: 100%; display: grid; grid-template-rows: auto 1fr auto; background: radial-gradient(circle at 50% 0%, #1b1f27 0%, #0d0f12 44%); }
.topbar { padding: calc(10px + var(--safe-top)) 16px 10px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid #242933; background: rgba(12,14,18,.94); backdrop-filter: blur(12px); z-index: 5; }
.brand-block { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { width: 38px; height: 38px; border: 1px solid #4b525f; display: grid; place-items: center; font-weight: 900; letter-spacing: -.05em; background: linear-gradient(145deg, #20242b, #111318); box-shadow: inset 0 0 0 2px #0c0e11; }
.brand-title { font-weight: 900; font-size: 13px; letter-spacing: .09em; white-space: nowrap; }
.brand-subtitle { color: var(--muted); font-size: 10px; margin-top: 2px; }
.resources { display: flex; gap: 6px; min-width: 0; }
.resource { background: #171a20; border: 1px solid #303640; border-radius: 9px; min-width: 82px; padding: 8px 9px; display: flex; align-items: center; justify-content: center; gap: 6px; font-weight: 800; font-size: 13px; }
.resource.premium { border-color: #5a4c30; }
.ico { opacity: .88; }
#content { min-height: 0; overflow: auto; scrollbar-width: thin; }
.screen { display: none; min-height: 100%; padding: 18px clamp(12px, 2vw, 28px) 22px; }
.screen.active { display: block; }
.yard-shell { max-width: 1040px; height: 100%; min-height: 0; margin: 0 auto; display: grid; grid-template-rows: auto minmax(320px, 1fr) auto auto; gap: 12px; }
.yard-info-row { display: flex; justify-content: space-between; align-items: center; }
.eyebrow { color: #888f9a; font-size: 10px; letter-spacing: .17em; font-weight: 900; }
.income { font-size: 23px; font-weight: 900; margin-top: 2px; }
.boost-badge { padding: 8px 12px; border: 1px solid #745529; background: #2a2317; border-radius: 8px; color: #ffd377; font-size: 12px; font-weight: 900; }
.hidden { display: none !important; }
.game-stage { position: relative; min-height: 320px; border: 1px solid #2c313b; background: #11141a; border-radius: 14px; overflow: hidden; box-shadow: inset 0 0 30px rgba(0,0,0,.45); touch-action: none; }
#glCanvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; }
#glCanvas.dragging { cursor: grabbing; }
.robot-tooltip { position: absolute; pointer-events: none; z-index: 3; padding: 6px 8px; border-radius: 7px; background: rgba(8,10,13,.94); border: 1px solid #404754; font-size: 11px; transform: translate(-50%, -120%); white-space: nowrap; }
.action-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn { border: 1px solid #3a404b; color: var(--text); background: #1b1f26; border-radius: 10px; padding: 11px 14px; font-weight: 800; cursor: pointer; transition: transform .08s ease, border-color .15s ease, background .15s ease; }
.btn:hover { border-color: #606977; background: #222730; }
.btn:active { transform: translateY(1px) scale(.995); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: linear-gradient(#343a45,#272c34); border-color: #555e6b; }
.btn.accent { background: linear-gradient(#47221f,#321918); border-color: #7f3733; }
.btn.danger { background: #2b1719; border-color: #6c3034; color: #ffb3b8; }
.btn.big { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.btn.big small { color: #c2c8d0; font-weight: 700; }
.hint { text-align: center; color: #737c89; font-size: 11px; }
.bottom-nav { padding: 7px 10px calc(7px + var(--safe-bottom)); border-top: 1px solid #252a32; background: rgba(10,12,15,.97); display: grid; grid-template-columns: repeat(6,1fr); gap: 5px; z-index: 6; }
.nav-btn { appearance: none; border: 0; color: #7f8792; background: transparent; padding: 6px 3px; min-width: 0; border-radius: 9px; cursor: pointer; display: grid; gap: 1px; place-items: center; }
.nav-btn span { font-size: 17px; font-weight: 900; }
.nav-btn small { font-size: 9px; font-weight: 800; }
.nav-btn.active { color: white; background: #20242b; }
.panel-head { display: flex; justify-content: space-between; align-items: end; gap: 12px; max-width: 1100px; margin: 0 auto 18px; }
h2 { margin: 3px 0 0; font-size: 28px; }
.panel-note { color: var(--muted); font-size: 12px; text-align: right; max-width: 360px; }
.cards-grid { max-width: 1100px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fit,minmax(250px,1fr)); gap: 12px; }
.cards-grid.compact { grid-template-columns: repeat(auto-fit,minmax(230px,1fr)); }
.card { border: 1px solid #2e343d; background: linear-gradient(160deg,#1a1e24,#14171c); border-radius: 12px; padding: 15px; min-height: 128px; }
.card h3 { margin: 3px 0 7px; font-size: 17px; }
.card p { color: #9ba4b0; font-size: 12px; line-height: 1.45; margin: 0 0 13px; }
.card-topline { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.tag { padding: 4px 7px; border-radius: 999px; border: 1px solid #3d444f; font-size: 10px; color: #c3c9d1; }
.card-actions { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.card-actions .btn { flex: 1; }
.progress { height: 8px; background: #0e1014; border: 1px solid #292e36; border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg,#a54a43,#e76558); }
.section-title { max-width: 1100px; margin: 20px auto 10px; color: #b9c0ca; font-size: 13px; letter-spacing: .04em; }
.collection-grid { max-width: 1100px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fill,minmax(130px,1fr)); gap: 9px; }
.collection-item { border: 1px solid #303640; border-radius: 10px; background: #171a1f; min-height: 112px; padding: 12px; display: grid; align-content: space-between; }
.collection-item.locked { filter: grayscale(1); opacity: .38; }
.robot-mini { height: 48px; position: relative; }
.robot-mini .head { width: 34px; height: 24px; border: 2px solid currentColor; position: absolute; left: 50%; top: 8px; transform: translateX(-50%); border-radius: 6px 6px 4px 4px; }
.robot-mini .eye { width: 7px; height: 5px; background: currentColor; position: absolute; top: 18px; left: 50%; transform: translateX(-50%); }
.collection-name { font-size: 11px; font-weight: 900; }
.collection-meta { font-size: 9px; color: var(--muted); margin-top: 2px; }
.profile-card { max-width: 760px; margin: 8px auto 14px; border: 1px solid #343b45; border-radius: 14px; padding: 20px; background: linear-gradient(145deg,#1c2026,#13161a); display: flex; align-items: center; gap: 15px; }
.avatar { width: 66px; height: 66px; border-radius: 50%; object-fit: cover; border: 2px solid #4a525f; background: #242932; display: grid; place-items: center; font-size: 24px; font-weight: 900; overflow: hidden; }
.profile-title { font-size: 22px; font-weight: 900; }
.profile-sub { color: var(--muted); font-size: 12px; margin-top: 3px; }
.stats-grid { max-width: 760px; margin: 0 auto; display: grid; grid-template-columns: repeat(2,1fr); gap: 10px; }
.stat-card { border: 1px solid #2f353e; border-radius: 11px; background: #171a20; padding: 15px; }
.stat-card strong { display: block; font-size: 22px; }
.stat-card span { color: var(--muted); font-size: 11px; }
.settings-card, .about-card { max-width: 760px; margin: 0 auto 12px; border: 1px solid #303640; border-radius: 12px; background: #171a20; padding: 16px; }
.setting-line { display: grid; grid-template-columns: 1fr auto; gap: 20px; align-items: center; padding: 12px 0; border-bottom: 1px solid #262b33; font-size: 13px; }
.setting-line input[type="range"] { width: min(240px,45vw); }
.settings-card .btn { margin-top: 12px; width: 100%; }
.about-card { display: grid; gap: 3px; color: var(--muted); font-size: 11px; }
.about-card strong { color: var(--text); font-size: 13px; }
.modal-root { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 20px; background: rgba(0,0,0,.68); backdrop-filter: blur(6px); }
.modal-card { position: relative; width: min(480px,100%); background: #181c22; border: 1px solid #424955; border-radius: 14px; padding: 20px; box-shadow: 0 24px 80px rgba(0,0,0,.55); }
.modal-close { position: absolute; top: 8px; right: 9px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: #aeb5bf; font-size: 23px; cursor: pointer; }
.modal-card h3 { margin: 0 34px 8px 0; font-size: 22px; }
.modal-card p { color: var(--muted); line-height: 1.5; font-size: 13px; }
.modal-actions { display: flex; gap: 8px; margin-top: 14px; }
.modal-actions .btn { flex: 1; }
.toast-root { position: fixed; left: 50%; bottom: calc(80px + var(--safe-bottom)); z-index: 50; transform: translateX(-50%); display: grid; gap: 7px; width: min(420px,calc(100% - 24px)); pointer-events: none; }
.toast { background: rgba(24,28,34,.96); border: 1px solid #3c444f; border-radius: 9px; padding: 10px 12px; font-size: 12px; text-align: center; animation: toastIn .18s ease; }
.toast.good { border-color: #3e6b52; }
.toast.bad { border-color: #7a363a; }
@keyframes toastIn { from { transform: translateY(10px); opacity: 0; } }
@media (max-width: 720px) {
  .topbar { padding-left: 9px; padding-right: 9px; }
  .brand-mark { width: 31px; height: 31px; font-size: 12px; }
  .brand-title { font-size: 10px; }
  .brand-subtitle { font-size: 8px; }
  .resources { gap: 4px; }
  .resource { min-width: 0; padding: 7px 7px; font-size: 11px; }
  .screen { padding: 12px 8px 14px; }
  .yard-shell { grid-template-rows: auto minmax(300px,1fr) auto auto; gap: 8px; }
  .game-stage { min-height: 300px; }
  .action-row { grid-template-columns: 1fr; gap: 7px; }
  .btn.big { min-height: 47px; padding: 8px 11px; }
  .income { font-size: 19px; }
  .hint { font-size: 10px; }
  .bottom-nav { padding-left: 4px; padding-right: 4px; gap: 1px; }
  .nav-btn { padding-left: 1px; padding-right: 1px; }
  .nav-btn small { font-size: 8px; }
  .panel-head { align-items: start; }
  .panel-note { display: none; }
  h2 { font-size: 23px; }
  .collection-grid { grid-template-columns: repeat(3,1fr); }
}
@media (max-height: 620px) and (orientation: landscape) {
  .topbar { padding-top: 7px; padding-bottom: 7px; }
  .screen { padding-top: 7px; }
  .yard-shell { grid-template-rows: auto minmax(210px,1fr) auto; }
  .hint { display: none; }
  .game-stage { min-height: 210px; }
  .btn.big { min-height: 40px; }
  .bottom-nav { padding-top: 3px; padding-bottom: calc(3px + var(--safe-bottom)); }
  .nav-btn { grid-template-columns: auto auto; gap: 5px; }
}
.robot-label-layer { position:absolute; inset:0; pointer-events:none; z-index:2; }
.robot-label { position:absolute; transform:translate(-50%,-50%); text-align:center; text-shadow:0 1px 3px #000; font-weight:900; font-size:11px; color:#fff; line-height:1.08; }
.robot-label small { display:block; font-size:8px; color:#bbc2ca; font-weight:700; margin-top:2px; }
