:root {
  --bg: #070A0E; --surface: #10161D; --surface2: #18212B; --lime: #8BE02B; --lime-dark: #4E9A12; --lime-glow: rgba(139, 224, 43, 0.33);
  --text: #F2F6F8; --muted: #9AA8B4; --gold: #FFC928; --gem: #B45CFF; --danger: #FF5D6C;
  --font: "Roboto Condensed", "Arial Narrow", "HelveticaNeue-CondensedBold", "Avenir Next Condensed", "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 16px;
  overscroll-behavior: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }
body { position: fixed; top: 0; right: 0; bottom: 0; left: 0; overflow: hidden; touch-action: manipulation;
  background: radial-gradient(120% 70% at 50% 0%, rgba(46, 107, 14, 0.2), transparent 70%), radial-gradient(90% 60% at 90% 100%, rgba(66, 122, 18, 0.13), transparent 70%), var(--bg); }
button { font: inherit; color: inherit; touch-action: manipulation; }
#app { height: 100%; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.screen { display: none; height: 100%; flex-direction: column; }
.screen.active { display: flex; }
.muted { color: var(--muted); }
.center { text-align: center; }
.row { display: flex; align-items: center; }
.bold { font-weight: 700; }
.lime { color: var(--lime); } .gold { color: var(--gold); } .danger { color: var(--danger); }

/* buttons */
.btn { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 56px; padding: 8px 22px; border-radius: 30px; border: 1.5px solid #D9FF9E; cursor: pointer;
  background: linear-gradient(180deg, #B6F562, var(--lime) 55%, var(--lime-dark)); color: #0B1404; font-weight: 800; font-size: 21px; letter-spacing: 0.02em; text-transform: none; transition: transform 90ms; }
.btn:active { transform: scale(0.96); }
.btn.secondary { background: #121A22; border: 1.2px solid #5D6B78; color: var(--text); font-weight: 700; }
.btn.compact { min-height: 46px; font-size: 16px; padding: 8px 14px; }
.btn[disabled] { opacity: 0.4; cursor: default; }
.btn + .btn { margin-top: 10px; }

/* title */
#screen-title { padding: 28px 24px 22px; align-items: center; text-align: center; }
#screen-title h1 { margin: 0; font-size: 30px; font-weight: 800; line-height: 1.1; }
#logo { flex: 1; width: 100%; min-height: 160px; margin-top: 12px; }
.tagline { font-size: 17px; margin: 4px 0 2px; }
.italic { font-style: italic; font-weight: 800; }
.title-foot { font-size: 18px; margin-top: 14px; }
.hint-box { margin-top: 12px; font-size: 13px; line-height: 1.35; color: var(--muted); max-width: 340px; }
.hint-box b { color: var(--text); }
.chip-ok { display: inline-block; margin-top: 8px; padding: 3px 10px; border-radius: 12px; border: 1px solid var(--lime-glow); font-size: 12px; color: var(--lime); }

/* host bubble */
.host { display: flex; align-items: center; width: 100%; text-align: left; }
.host img { width: 68px; height: 68px; flex: none; }
.bubble { flex: 1; margin-left: 8px; padding: 9px 11px; border-radius: 14px; background: var(--surface2); border: 1.4px solid var(--hc, var(--lime-glow)); min-width: 0; }
.bubble .who { font-size: 12px; font-weight: 700; color: var(--hc, var(--lime)); }
.bubble .line { font-size: 14px; line-height: 1.25; }

/* header chips */
.top { display: flex; align-items: center; padding: 12px 16px 0; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px 4px 6px; border-radius: 20px; background: #0D1319; border: 1px solid rgba(255, 255, 255, 0.2); font-size: 15px; font-weight: 700; }
.chip img { width: 24px; height: 24px; }
.spacer { flex: 1; }
.iconbtn { width: 46px; height: 46px; border-radius: 50%; background: transparent; border: 0; padding: 7px; cursor: pointer; }
.iconbtn img { width: 100%; height: 100%; }

/* map */
.world-title { text-align: center; font-size: 26px; font-weight: 800; margin-top: 6px; }
.world-name { text-align: center; font-size: 15px; color: var(--muted); }
#map-host { padding: 6px 16px 0; }
.strip { display: flex; gap: 8px; padding: 8px 16px 0; }
.chipbtn { flex: 1; display: flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 12px; border-radius: 23px; background: transparent; border: 1.5px solid var(--lime); cursor: pointer; font-weight: 700; font-size: 17px; justify-content: center; }
.chipbtn img { width: 24px; height: 24px; }
#map-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; margin-top: 6px; position: relative; }
#map { position: relative; width: 100%; }
#map svg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
.band { position: absolute; left: 4px; right: 4px; border-radius: 30px; background: linear-gradient(180deg, rgba(48, 90, 26, 0.13), rgba(28, 53, 80, 0.1), rgba(48, 90, 26, 0.13)); }
.band span { position: absolute; left: 18px; bottom: 10px; font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: 0.04em; }
.node { position: absolute; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%; border: 2.5px solid rgba(255, 255, 255, 0.8); padding: 0; cursor: pointer;
  font-size: 22px; font-weight: 800; color: #fff; background: radial-gradient(circle at 35% 35%, #9FD4FF, #2E7BFF 55%, #123C8A); }
.node.tenth { border-color: var(--gold); }
.node.current { width: 60px; height: 60px; margin: -30px 0 0 -30px; color: #0B1404; font-size: 24px; background: radial-gradient(circle at 35% 35%, #D8FF9A, var(--lime) 55%, var(--lime-dark)); box-shadow: 0 0 0 9px rgba(139, 224, 43, 0.28); animation: pulse 1.6s ease-in-out infinite; }
.node.locked { background: radial-gradient(circle at 35% 35%, #6A7682, #3A444E 60%, #262E36); cursor: default; }
.node.locked img { width: 24px; height: 24px; opacity: 0.8; }
.node .st { position: absolute; left: 50%; top: 100%; transform: translateX(-50%); margin-top: 1px; display: flex; gap: 0; }
.node .st img { width: 17px; height: 17px; }
@keyframes pulse { 50% { box-shadow: 0 0 0 14px rgba(139, 224, 43, 0.12); } }
.reduced .node.current { animation: none; }

/* game */
#screen-game { padding: 10px 12px; }
.hud { display: flex; align-items: center; }
.pause { width: 50px; height: 50px; border-radius: 50%; background: #16202A; border: 1.5px solid var(--lime); flex: none; cursor: pointer; padding: 11px; }
.pause img { width: 100%; height: 100%; }
.movesbox { margin-left: 12px; padding: 2px 14px 4px; border-radius: 14px; background: #0F1A12; border: 1.5px solid var(--lime); text-align: center; flex: none; min-width: 78px; }
.movesbox .lab { font-size: 12px; color: var(--muted); }
.movesbox .val { font-size: 28px; font-weight: 800; line-height: 1.05; }
.movesbox .val.low { color: var(--danger); }
.scorebox { flex: 1; text-align: center; }
.scorebox .lab { font-size: 12px; color: var(--muted); }
.scorebox .val { font-size: 26px; font-weight: 800; line-height: 1.05; }
.scorebox .stars { display: flex; justify-content: center; margin-top: 1px; }
.scorebox .stars img { width: 20px; height: 20px; }
.titlebox { text-align: right; flex: none; }
.titlebox .t { font-size: 14px; font-weight: 800; color: var(--lime); }
.titlebox .m { font-size: 12px; color: var(--muted); }
.goals { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.goal { display: flex; align-items: center; gap: 4px; padding: 4px 10px 4px 8px; border-radius: 14px; background: #101820; border: 1.2px solid rgba(255, 255, 255, 0.2); font-size: 14px; font-weight: 700; }
.goal.met { border-color: var(--lime); }
.goal img { width: 24px; height: 24px; }
#board-wrap { flex: 1; min-height: 0; margin-top: 4px; position: relative; }
#board, #tray { width: 100%; height: 100%; display: block; touch-action: none; }
#tray-wrap { height: 96px; margin-top: 4px; }
.boosters { display: flex; gap: 10px; height: 72px; margin-top: 6px; padding: 0 2px; }
.booster { flex: 1; position: relative; border-radius: 16px; background: #121A22; border: 1.2px solid rgba(139, 224, 43, 0.33); cursor: pointer; padding: 14px; }
.booster.armed { background: #20361A; border-color: var(--lime); }
.booster img.ico { width: 100%; height: 100%; object-fit: contain; }
.booster .badge { position: absolute; right: 4px; bottom: 4px; min-width: 20px; height: 20px; border-radius: 10px; background: var(--lime); color: #0B1404; font-size: 12px; font-weight: 800; line-height: 20px; padding: 0 5px; }

/* overlays */
.scrim { position: fixed; top: 0; right: 0; bottom: 0; left: 0; background: rgba(0, 0, 0, 0.62); display: flex; align-items: center; justify-content: center;
  padding: calc(18px + env(safe-area-inset-top)) calc(18px + env(safe-area-inset-right)) calc(18px + env(safe-area-inset-bottom)) calc(18px + env(safe-area-inset-left)); z-index: 10; }
.card { background: var(--surface); border: 1.2px solid var(--lime-glow); border-radius: 18px; padding: 16px; width: 100%; max-width: 420px; max-height: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.card h2 { margin: 0; font-size: 26px; text-align: center; }
.card h2.lime { color: var(--lime); }
.card .sub { text-align: center; color: var(--muted); font-size: 15px; margin-top: 2px; }
.card p { margin: 8px 0; line-height: 1.3; }
.card .stars { display: flex; justify-content: center; gap: 4px; padding: 8px 0; }
.card .stars img { width: 34px; height: 34px; }
.card.win .stars img { width: 56px; height: 56px; }
.card.win .stars img:nth-child(2) { width: 70px; height: 70px; }
.card.win h2 { font-size: 30px; color: var(--gold); margin: 6px 0; }
.stars img.pop { animation: pop 300ms ease-out both; }
.stars img.pop:nth-child(2) { animation-delay: 200ms; } .stars img.pop:nth-child(3) { animation-delay: 400ms; }
@keyframes pop { from { transform: scale(0); } 60% { transform: scale(1.2); } to { transform: scale(1); } }
.reduced .stars img.pop { animation: none; }
.rewards { display: flex; justify-content: center; gap: 8px; margin: 6px 0; }
.card .gap { height: 10px; }
.toggle { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; font-size: 17px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.switch { width: 52px; height: 32px; border-radius: 16px; background: #34404C; position: relative; border: 0; cursor: pointer; flex: none; }
.switch::after { content: ""; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: left 120ms; }
.switch[aria-checked="true"] { background: var(--lime); }
.switch[aria-checked="true"]::after { left: 24px; }
.listrow { padding: 8px 10px; margin-top: 6px; border-radius: 14px; background: var(--surface2); border: 1.2px solid var(--lime-glow); }
.listrow.done { border-color: var(--gold); }
.listrow .n { font-size: 15px; font-weight: 700; }
.listrow .d { font-size: 12px; color: var(--muted); }
.pieces { letter-spacing: 4px; font-size: 16px; color: var(--gold); }
.tabs { display: flex; gap: 6px; margin: 8px 0; overflow-x: auto; }
.tab { flex: none; padding: 6px 12px; border-radius: 16px; background: transparent; border: 1.2px solid #5D6B78; cursor: pointer; font-size: 14px; }
.tab.on { border-color: var(--lime); color: var(--lime); font-weight: 700; }
#toast { position: fixed; left: 50%; bottom: calc(110px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: rgba(16, 22, 29, 0.96); border: 1px solid var(--lime-glow); border-radius: 18px; padding: 8px 16px; font-size: 15px; z-index: 20; display: none; max-width: 90%; text-align: center; }
.tiny { font-size: 12px; color: var(--muted); }

/* title screen quick actions and keyboard focus */
.title-actions { display: flex; gap: 10px; width: 100%; max-width: 340px; margin-top: 12px; }
.title-actions .btn { margin-top: 0; }
.btn:focus-visible, button:focus-visible, canvas:focus-visible { outline: 3px solid #D9FF9E; outline-offset: 2px; }
