/* 스네이크 군단 — mobile UI.
   One fixed look on purpose: dark tactical chrome (panels, chunky buttons, pills) around a light
   topographic battle map. Portrait first; on wide screens the game sits in a phone-sized frame. */
/* bundled fonts (SIL OFL, see fonts/OFL-*.txt): work offline in the app and the PWA */
@font-face { font-family: "Black Han Sans"; src: url("../fonts/BlackHanSans-Regular.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Black Ops One"; src: url("../fonts/BlackOpsOne-Regular.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; font-weight: 600; src: url("../fonts/IBMPlexMono-SemiBold.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "IBM Plex Sans KR"; font-weight: 400; src: url("../fonts/IBMPlexSansKR-Regular.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; font-weight: 100 700; font-stretch: 85% 100%; src: url("../fonts/IBMPlexSans-VF.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "SL Display"; src: url("../fonts/SLDisplay-ExtraBold.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "IBM Plex Sans KR"; font-weight: 600; src: url("../fonts/IBMPlexSansKR-SemiBold.woff2") format("woff2"); font-display: swap; }
:root {
  --bg: #0d1411; --bg-2: #111a16; --panel: #18231e; --panel-2: #1f2c26; --panel-3: #283830; --edge: #3a5045;
  --line: #040706; --text: #f2f5ee; --soft: #a7b8ae; --dim: #6c7f75;
  --blue: #3b7fff; --blue-hi: #7aaaff; --blue-lo: #1b4bb8; --blue-sh: #0b2a6c;
  --red: #ff4b4b; --red-hi: #ff8676; --red-lo: #a91d29; --red-sh: #520a10;
  --gold: #ffc533; --gold-hi: #ffe48a; --gold-lo: #b97800; --gold-sh: #5e3d00; --on-gold: #2a1c00;
  --green: #3fd27c; --green-lo: #1a7f45;
  --teal: #2bd4c7; --orange: #ff8c2c; --purple: #b06cff;
  --r1: #aab7af; --r2: #4aa3ff; --r3: #b06cff; --r4: #ffc533; --r5: #ff4d6d;
  /* battle map sheets (read by the canvas) */
  --paper: #dfe6cb; --paper-2: #ecdcb2; --paper-3: #e0eaee;
  --contour: #a47b4c; --contour-2: #b7854a; --contour-3: #7b97a6;
  --grid: #8ea089; --grid-2: #b39d76; --grid-3: #9aafb9;
  --ink: #18221d; --ink-soft: #52625a; --map-light: #f7f9f2;
  --friend: #2563eb; --hostile: #d42a3a; --hostile-2: #e8641e; --tracer: #cf8500; --map-gold: #b98800; --xp: #0d9c93; --ok: #2b8c47;
  --font-display: "Black Han Sans", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  --font-num: "Black Ops One", "SL Display", "Black Han Sans", Impact, "Arial Black", sans-serif;
  --font-body: "IBM Plex Sans KR", "IBM Plex Sans", "Malgun Gothic", "Apple SD Gothic Neo", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  /* Capacitor 8 (Android) injects --safe-area-inset-*; browsers and iOS use env() */
  --safe-t: var(--safe-area-inset-top, env(safe-area-inset-top, 0px)); --safe-b: var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
  --safe-l: var(--safe-area-inset-left, env(safe-area-inset-left, 0px)); --safe-r: var(--safe-area-inset-right, env(safe-area-inset-right, 0px));
  --nav-h: 64px;
  color-scheme: dark;
}
/* accents and Cyrillic: Black Han Sans has basic Latin only, so these languages use SL Display (Montserrat 800) for headings */
html[data-lang="es"], html[data-lang="pt-BR"], html[data-lang="fr"], html[data-lang="de"], html[data-lang="it"],
html[data-lang="tr"], html[data-lang="vi"], html[data-lang="ru"] { --font-display: "SL Display", "Black Han Sans", system-ui, sans-serif; }
* , *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  overflow: hidden; overscroll-behavior: none; color: var(--text);
  background: #050806 radial-gradient(ellipse at 50% 20%, #15241d, #050806 70%);
  font: 400 15px/1.45 var(--font-body);
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none;
}
button, input { font: inherit; color: inherit; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

#app { position: relative; width: 100%; height: 100%; max-width: 500px; margin: 0 auto; overflow: hidden; background: var(--bg); }
@media (min-width: 620px) and (min-height: 640px) {
  #app { top: 16px; height: min(940px, calc(100% - 32px)); border-radius: 30px; border: 3px solid #000; box-shadow: 0 0 0 2px #26332d, 0 40px 90px rgba(0,0,0,.7); }
}
#stage { position: absolute; inset: 0; overflow: hidden; touch-action: none; }
#map, #fx { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#fx { pointer-events: none; image-rendering: pixelated; z-index: 4; }
.pix { shape-rendering: crispEdges; }

/* ---------- building blocks ---------- */
.btn {
  appearance: none; cursor: pointer; position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 18px; border: 2px solid var(--line); border-radius: 14px; color: var(--text);
  background: linear-gradient(#34483f, #1f2c26); box-shadow: 0 4px 0 var(--line), inset 0 2px 0 rgba(255,255,255,.1);
  font: 400 17px/1 var(--font-display); text-shadow: 0 2px 0 rgba(0,0,0,.4); transition: transform .07s, box-shadow .07s, filter .15s;
}
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--line), inset 0 2px 0 rgba(255,255,255,.1); }
.btn:disabled { cursor: default; filter: grayscale(.85) brightness(.7); }
.btn-blue { background: linear-gradient(var(--blue-hi), var(--blue) 48%, var(--blue-lo)); box-shadow: 0 5px 0 var(--blue-sh), inset 0 2px 0 rgba(255,255,255,.4); }
.btn-blue:active:not(:disabled) { box-shadow: 0 2px 0 var(--blue-sh), inset 0 2px 0 rgba(255,255,255,.4); }
.btn-gold { background: linear-gradient(var(--gold-hi), var(--gold) 50%, var(--gold-lo)); color: var(--on-gold); text-shadow: 0 1px 0 rgba(255,255,255,.45); box-shadow: 0 4px 0 var(--gold-sh), inset 0 2px 0 rgba(255,255,255,.55); }
.btn-gold:active:not(:disabled) { box-shadow: 0 1px 0 var(--gold-sh), inset 0 2px 0 rgba(255,255,255,.55); }
.btn-red { background: linear-gradient(var(--red-hi), var(--red) 50%, var(--red-lo)); box-shadow: 0 4px 0 var(--red-sh), inset 0 2px 0 rgba(255,255,255,.35); }
.btn-red:active:not(:disabled) { box-shadow: 0 1px 0 var(--red-sh), inset 0 2px 0 rgba(255,255,255,.35); }
.btn-sm { min-height: 38px; padding: 7px 12px; font-size: 15px; border-radius: 11px; box-shadow: 0 3px 0 var(--line), inset 0 2px 0 rgba(255,255,255,.1); }
.btn-gold.btn-sm { box-shadow: 0 3px 0 var(--gold-sh), inset 0 2px 0 rgba(255,255,255,.55); }
.btn-play { min-height: 66px; font-size: 30px; border-radius: 18px; letter-spacing: .04em; }
.btn-play small { font: 400 12px/1 var(--font-mono); letter-spacing: 0; opacity: .85; }
.icon-btn {
  appearance: none; cursor: pointer; width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  border: 2px solid var(--line); background: linear-gradient(#34483f, #1f2c26); box-shadow: 0 3px 0 var(--line); color: var(--text);
}
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:disabled { opacity: .35; cursor: default; }
.panel {
  display: grid; gap: 12px; min-width: 0; padding: 14px; border-radius: 18px;
  background: var(--panel); border: 2px solid var(--line); box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 6px 18px rgba(0,0,0,.3);
}
.panel h3 { margin: 0; font: 400 19px/1.15 var(--font-display); }
.panel p { margin: 0; font-size: 13.5px; line-height: 1.5; }
.row { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.between { justify-content: space-between; }
.soft { color: var(--soft); }
.eyebrow { font: 600 10.5px/1.2 var(--font-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--soft); }
.bar { position: relative; height: 6px; border-radius: 4px; background: rgba(0,0,0,.5); overflow: hidden; box-shadow: inset 0 0 0 1px rgba(0,0,0,.4); }
.bar > i { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: inherit; background: linear-gradient(var(--blue-hi), var(--blue)); }
.bar.xp > i { background: linear-gradient(#8ff3ea, var(--teal)); }
.bar.gold > i { background: linear-gradient(var(--gold-hi), var(--gold)); }
.bar.red > i { background: linear-gradient(var(--red-hi), var(--red)); }
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px 0 3px; border-radius: 16px;
  background: rgba(4,7,6,.72); border: 2px solid var(--line); font: 400 15px/1 var(--font-num); white-space: nowrap; color: #fff;
}
.pill .ic { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: #0a0f0d; flex: none; }
.pill .ic svg { width: 16px; height: 16px; }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 8px; font: 400 12px/1 var(--font-display); background: var(--panel-3); }
.rar-1 { color: var(--r1); } .rar-2 { color: var(--r2); } .rar-3 { color: var(--r3); } .rar-4 { color: var(--r4); } .rar-5 { color: var(--r5); }
.tag.rb1 { background: #3a443f; color: #fff; } .tag.rb2 { background: #1a4f93; color: #fff; } .tag.rb3 { background: #5b2c95; color: #fff; }
.tag.rb4 { background: #9a6a00; color: #fff; } .tag.rb5 { background: #a1213a; color: #fff; }
.variant { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 8px; font: 400 12px/1 var(--font-display); background: linear-gradient(var(--gold-hi), var(--gold)); color: var(--on-gold); }
.variant.v2 { background: linear-gradient(#8ff3ea, var(--teal)); color: #052a27; }
.stars-mini { display: inline-flex; gap: 1px; }
.stars-mini svg { width: 11px; height: 11px; }
.star-on { fill: var(--gold); stroke: #6b4a00; stroke-width: .8; }
.star-off { fill: rgba(0,0,0,.35); stroke: var(--dim); stroke-width: 1; }
.pips { display: flex; gap: 3px; flex-wrap: wrap; }
.pips i { width: 9px; height: 9px; border-radius: 3px; background: rgba(0,0,0,.45); border: 1px solid var(--edge); }
.pips i.on { background: var(--teal); border-color: var(--teal); }

/* ---------- in-run HUD ---------- */
.hud {
  position: absolute; z-index: 5; inset: 0 0 auto 0; pointer-events: none; display: grid; gap: 6px;
  padding: calc(var(--safe-t) + 8px) max(10px, var(--safe-r)) 0 max(10px, var(--safe-l));
  /* buff chips and the combo share a row, so the boss bar does not jump when a chip appears */
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "r1 r1" "r2 r2" "r3 r3" "fx combo" "boss boss";
}
.hud-row { grid-area: r1; } .hud-row2 { grid-area: r2; } .hud-row3 { grid-area: r3; }
.hud > .buffs { grid-area: fx; } .hud > .combo { grid-area: combo; } .hud > .bossbar { grid-area: boss; }
.hud-row { display: grid; grid-template-columns: 44px 1fr 44px; gap: 8px; align-items: center; }
.hud-row > #btn-pause { grid-column: 1; } .hud-row > .obj { grid-column: 2; } .hud-row > .auto { grid-column: 3; }
.hbtn {
  pointer-events: auto; cursor: pointer; width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center;
  border: 2px solid var(--line); background: rgba(10,15,13,.8); color: var(--text); box-shadow: 0 3px 0 var(--line);
}
.hbtn svg { width: 18px; height: 18px; }
.hbtn.auto { font: 400 11px/1 var(--font-num); letter-spacing: .02em; }
.hbtn.auto[aria-pressed="true"] { background: linear-gradient(var(--blue-hi), var(--blue-lo)); }
.obj { min-width: 0; padding: 6px 12px 7px; border-radius: 14px; background: rgba(10,15,13,.8); border: 2px solid var(--line); display: grid; gap: 4px; }
.obj-label { font: 600 10.5px/1 var(--font-mono); color: var(--soft); letter-spacing: .05em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.obj-text { font: 400 16px/1.05 var(--font-display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.obj .bar { height: 5px; }
.hud-row2 { display: flex; align-items: center; gap: 6px; }
.xpbox { flex: 1; display: flex; align-items: center; gap: 7px; min-width: 0; height: 28px; padding: 0 10px; border-radius: 14px; background: rgba(10,15,13,.72); }
.xp-rank { font: 400 13px/1 var(--font-display); color: var(--teal); white-space: nowrap; }
.xpbox .bar { flex: 1; height: 6px; }
.chip { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px 0 7px; border-radius: 14px; background: rgba(10,15,13,.72); font: 400 14px/1 var(--font-num); white-space: nowrap; }
.chip svg { width: 15px; height: 15px; }
.chip.bump { animation: bump .22s ease-out; }
@keyframes bump { from { transform: scale(1.18); } to { transform: none; } }
.hud-row3 { display: flex; justify-content: space-between; gap: 8px; padding: 0 4px; font: 600 11px/1 var(--font-mono); color: var(--ink); text-shadow: 0 0 3px var(--paper), 0 0 6px var(--paper); }
.buffs { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-start; align-content: center; min-width: 0; }
.buffs:empty { display: none; }
.buff { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 10px; border-radius: 12px; font: 400 12.5px/1 var(--font-display); color: #fff; background: rgba(10,15,13,.8); border: 2px solid var(--bc, var(--edge)); }
.buff b { font: 400 12px/1 var(--font-num); color: var(--bc, #fff); }
.buff.warn { animation: hot 0.9s ease-in-out infinite; }
.combo { justify-self: end; margin-top: 2px; padding: 4px 12px; border-radius: 12px; font: 400 20px/1 var(--font-num); color: var(--gold); background: rgba(10,15,13,.72); opacity: 0; transform: scale(.9); transition: opacity .2s, transform .2s; }
.combo.on { opacity: 1; transform: none; }
.bossbar { justify-self: center; width: min(320px, 100%); display: grid; gap: 4px; justify-items: center; padding: 6px 12px 8px; border-radius: 14px; background: rgba(10,15,13,.8); border: 2px solid var(--line); }
.bossbar span { font: 400 13px/1 var(--font-display); color: var(--red-hi); }
.bossbar .bar { width: 100%; height: 8px; }
.banner {
  position: absolute; z-index: 5; left: 0; right: 0; top: 34%; display: grid; justify-items: center; gap: 8px; pointer-events: none; opacity: 0; text-align: center;
  padding: 0 16px; color: #fff; font: 400 clamp(40px, 11vw, 62px)/1 var(--font-num);
  text-shadow: 3px 3px 0 #000, -3px 3px 0 #000, 3px -3px 0 #000, -3px -3px 0 #000, 0 6px 0 #000;
}
.banner small { font: 400 clamp(18px, 5vw, 24px)/1.2 var(--font-display); color: var(--gold); text-shadow: 2px 2px 0 #000, -2px 2px 0 #000, 2px -2px 0 #000, -2px -2px 0 #000; }
.banner.show { animation: banner 1.9s ease-out forwards; }
@keyframes banner { 0% { opacity: 0; transform: scale(1.4); } 12% { opacity: 1; transform: scale(.96); } 20% { transform: none; } 75% { opacity: 1; } 100% { opacity: 0; } }
.pads {
  position: absolute; z-index: 5; left: 0; right: 0; bottom: calc(var(--safe-b) + 18px); display: none; justify-content: space-between; pointer-events: none;
  padding: 0 max(18px, var(--safe-r)) 0 max(18px, var(--safe-l));
}
#stage.playing.touch-ui .pads { display: flex; }
.pad { width: 74px; height: 74px; border-radius: 50%; display: grid; place-items: center; color: #fff; border: 3px solid rgba(255,255,255,.6); background: rgba(10,15,13,.3); transition: transform .08s, background .08s; }
.pad svg { width: 30px; height: 30px; }
.pad.on { background: rgba(59,127,255,.65); border-color: #fff; transform: scale(.92); }

/* ---------- lobby ---------- */
.lobby { position: absolute; z-index: 6; inset: 0; pointer-events: none; }
.lobby > * { pointer-events: auto; }
.topbar {
  position: absolute; z-index: 3; inset: 0 0 auto 0; display: flex; align-items: center; gap: 8px;
  padding: calc(var(--safe-t) + 10px) max(12px, var(--safe-r)) 16px max(12px, var(--safe-l));
  background: linear-gradient(rgba(9,14,12,.96) 62%, rgba(9,14,12,0));
}
.rank { display: flex; align-items: center; gap: 8px; min-width: 0; }
.rank-badge { width: 46px; height: 46px; flex: none; border-radius: 13px; display: grid; place-items: center; color: var(--gold); background: linear-gradient(#3a5045, #1c2823); border: 2px solid var(--line); box-shadow: inset 0 1px 0 rgba(255,255,255,.12); }
.rank-badge svg { width: 32px; height: 21px; }
.rank-info { display: grid; gap: 4px; min-width: 0; }
.rank-info b { font: 400 16px/1.1 var(--font-display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-info .lv-line { display: flex; align-items: center; gap: 6px; }
.rank-info small { font: 600 11px/1 var(--font-mono); color: var(--soft); flex: none; }
.rank { flex: 1 1 auto; }
.rank-info { grid-template-columns: minmax(0, 1fr); flex: 1 1 auto; }
.rank-info .lv-line { min-width: 0; }
.rank-info .bar { width: auto; flex: 1 1 64px; max-width: 64px; min-width: 16px; }
.wallet { margin-left: auto; display: flex; gap: 6px; }
.power-banner {
  position: absolute; z-index: 2; top: calc(var(--safe-t) + 72px); left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px; padding: 5px 16px 5px 6px; border-radius: 24px; white-space: nowrap;
  background: rgba(6,10,8,.8); border: 2px solid var(--line); box-shadow: 0 4px 12px rgba(0,0,0,.35);
}
.power-banner .pw-ic { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(var(--blue-hi), var(--blue-lo)); border: 2px solid var(--line); color: #fff; }
.power-banner .pw-ic svg { width: 18px; height: 18px; }
.power-banner b { font: 400 24px/1 var(--font-num); color: #fff; }
.power-banner small { font: 400 13px/1 var(--font-display); color: var(--gold); }
.boosts { position: absolute; z-index: 2; top: calc(var(--safe-t) + 120px); left: 50%; transform: translateX(-50%); display: flex; gap: 6px; white-space: nowrap; }
.boosts:empty { display: none; }
.boost { padding: 4px 9px; border-radius: 10px; font: 400 12px/1 var(--font-display); color: var(--on-gold); background: linear-gradient(var(--gold-hi), var(--gold)); border: 2px solid var(--line); }
.boost.blue { color: #fff; background: linear-gradient(var(--blue-hi), var(--blue-lo)); }
.side { position: absolute; z-index: 2; left: max(10px, var(--safe-l)); top: calc(var(--safe-t) + 150px); display: grid; gap: 12px; }
.qbtn {
  appearance: none; cursor: pointer; position: relative; width: 60px; display: grid; justify-items: center; gap: 3px; padding: 7px 0 6px;
  border-radius: 16px; border: 2px solid var(--line); background: linear-gradient(#34483f, #18231e); box-shadow: 0 3px 0 var(--line); color: var(--text);
  font: 400 11.5px/1 var(--font-display);
}
.qbtn svg { width: 30px; height: 30px; }
.qbtn .badge { position: absolute; top: -7px; right: -7px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; display: grid; place-items: center; background: var(--red); border: 2px solid var(--line); font: 400 12px/1 var(--font-num); color: #fff; }
.qbtn.hot { animation: hot 1.4s ease-in-out infinite; }
@keyframes hot { 0%, 100% { box-shadow: 0 3px 0 var(--line), 0 0 0 0 rgba(255,197,51,.0); } 50% { box-shadow: 0 3px 0 var(--line), 0 0 0 5px rgba(255,197,51,.35); } }
.page { position: absolute; z-index: 1; left: 0; right: 0; bottom: calc(var(--nav-h) + var(--safe-b)); }
.page-home {
  display: grid; gap: 10px; padding: 34px max(12px, var(--safe-r)) 12px max(12px, var(--safe-l));
  background: linear-gradient(rgba(9,14,12,0), rgba(9,14,12,.9) 30px, rgba(9,14,12,.96));
}
.page-sheet {
  top: calc(var(--safe-t) + 70px); overflow-y: auto; overscroll-behavior: contain; display: grid; align-content: start; gap: 12px;
  padding: 16px max(12px, var(--safe-r)) 20px max(12px, var(--safe-l));
  background: var(--bg-2); border-radius: 22px 22px 0 0; border-top: 2px solid var(--edge); box-shadow: 0 -10px 30px rgba(0,0,0,.45);
}
.sheet-head { display: grid; gap: 2px; padding: 0 2px; }
.sheet-head h2 { margin: 0; font: 400 26px/1.1 var(--font-display); }
.sheet-head p { margin: 0; font-size: 13px; color: var(--soft); }
.route-head { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; }
.th-title { display: grid; gap: 2px; text-align: center; }
.th-title b { font: 400 20px/1.05 var(--font-display); }
.route { display: flex; align-items: flex-start; gap: 12px; overflow-x: auto; scroll-snap-type: x proximity; padding: 8px 6px 4px; scrollbar-width: none; }
.route::-webkit-scrollbar { display: none; }
.node { flex: none; position: relative; appearance: none; cursor: pointer; width: 48px; display: grid; justify-items: center; gap: 5px; padding: 0; border: 0; background: none; color: var(--text); scroll-snap-align: center; }
.node + .node::before { content: ""; position: absolute; top: 21px; right: calc(100% - 2px); width: 16px; height: 4px; border-radius: 2px; background: var(--edge); }
.node.cleared + .node::before { background: var(--blue); }
.node .dot { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font: 400 19px/1 var(--font-num); color: #fff; background: linear-gradient(#425a4e, #1d2a24); border: 3px solid var(--line); box-shadow: 0 3px 0 var(--line), inset 0 2px 0 rgba(255,255,255,.12); }
.node.cleared .dot { background: linear-gradient(var(--blue-hi), var(--blue-lo)); }
.node.boss .dot { background: linear-gradient(var(--red-hi), var(--red-lo)); }
.node.boss .dot svg { width: 26px; height: 26px; }
.node.locked { cursor: default; }
.node.locked .dot { background: #121a16; color: var(--dim); }
.node.locked .dot svg { width: 16px; height: 16px; }
.node[aria-pressed="true"] .dot { outline: 3px solid var(--gold); outline-offset: 2px; transform: scale(1.06); }
.node .stars-mini svg { width: 10px; height: 10px; }
.mission-card { display: grid; gap: 8px; padding: 12px 14px; border-radius: 18px; background: var(--panel); border: 2px solid var(--line); box-shadow: inset 0 1px 0 rgba(255,255,255,.06); }
.mc-head { display: flex; align-items: center; gap: 8px; }
.mc-code { font: 600 11.5px/1 var(--font-mono); color: var(--soft); letter-spacing: .06em; }
.mc-head .tag { margin-left: auto; }
.mission-card h2 { margin: 0; font: 400 22px/1.15 var(--font-display); }
.goals { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.goals li { display: inline-flex; align-items: center; gap: 5px; padding: 5px 9px 5px 6px; border-radius: 10px; background: var(--panel-2); font-size: 12.5px; line-height: 1.2; }
.goals li.got { background: rgba(255,197,51,.16); color: var(--gold-hi); }
.mc-note { margin: 0; font-size: 12px; color: var(--soft); }
.mc-sweep { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.mc-sweep .soft { font-size: 12px; color: var(--soft); min-width: 0; }
.gimmicks { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 5px; }
.gimmicks:empty { display: none; }
.gimmicks li { padding: 4px 8px; border-radius: 8px; font: 400 12px/1.1 var(--font-display); background: #2a2216; color: #ffd98a; border: 1px solid #5e4a1f; }
.gimmicks li.boss { background: #3a1418; color: #ff9a8e; border-color: #7a2630; }
.gimmicks li.map { background: #14263a; color: #9cc6ff; border-color: #2a4a72; }
.cta { display: grid; grid-template-columns: 1fr; gap: 10px; }
.tabbar {
  position: absolute; z-index: 4; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  height: calc(var(--nav-h) + var(--safe-b)); padding: 0 var(--safe-r) var(--safe-b) var(--safe-l);
  background: #080d0b; border-top: 2px solid var(--line); box-shadow: 0 -1px 0 var(--edge);
}
.tab { appearance: none; cursor: pointer; position: relative; border: 0; background: transparent; color: var(--dim); display: grid; justify-items: center; align-content: center; gap: 4px; font: 400 12px/1 var(--font-display); }
.tab svg { width: 26px; height: 26px; transition: transform .15s; }
.tab > span { white-space: nowrap; }
.tab[aria-selected="true"] { color: var(--gold); }
.tab[aria-selected="true"] svg { transform: translateY(-2px) scale(1.12); }
.tab[aria-selected="true"]::before { content: ""; position: absolute; top: 0; left: 26%; right: 26%; height: 3px; border-radius: 0 0 3px 3px; background: var(--gold); }
.tab .dot { position: absolute; top: 8px; left: calc(50% + 9px); width: 11px; height: 11px; border-radius: 50%; background: var(--red); border: 2px solid #080d0b; }

/* armory */
.gun-hero { display: grid; justify-items: center; gap: 8px; padding: 16px 14px 14px; border-radius: 18px; border: 2px solid var(--line); text-align: center; background: radial-gradient(ellipse at 50% 30%, #2d4037, var(--panel) 70%); }
.gun-hero .art { width: 200px; height: 76px; filter: drop-shadow(0 4px 0 rgba(0,0,0,.5)); }
.gun-hero h3 { margin: 0; font: 400 24px/1.1 var(--font-display); }
/* one grid for all rows, so the label column fits the longest translated stat name */
.statbars { width: 100%; display: grid; grid-template-columns: minmax(52px, max-content) 1fr 48px; gap: 6px 8px; align-items: center; }
.statbar { display: contents; font-size: 12.5px; text-align: left; }
.statbar > span { max-width: 132px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.statbar b { font: 400 13px/1 var(--font-num); text-align: right; }
.slots { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.slot { appearance: none; cursor: pointer; display: grid; grid-template-columns: 38px 1fr; gap: 8px; align-items: center; text-align: left; min-height: 60px; padding: 8px; border-radius: 14px; border: 2px dashed var(--edge); background: var(--panel-2); color: var(--text); font-size: 12.5px; line-height: 1.3; }
.slot.filled { border-style: solid; border-color: var(--line); background: linear-gradient(#2a3a33, #1d2a24); }
.slot svg { width: 38px; height: 38px; }
.slot .plus { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: rgba(0,0,0,.35); font: 400 22px/1 var(--font-num); color: var(--dim); }
.crates { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.crate-box { display: grid; justify-items: center; gap: 6px; padding: 12px 10px; border-radius: 16px; border: 2px solid var(--line); background: linear-gradient(#2c3d35, #1a2520); text-align: center; }
.crate-box svg { width: 52px; height: 52px; }
.crate-box b { font: 400 17px/1.1 var(--font-display); }
.crate-box span { font-size: 11.5px; line-height: 1.35; color: var(--soft); }
.crate-box .btn { width: 100%; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13.5px; cursor: pointer; }
.switch { position: relative; flex: none; width: 50px; height: 28px; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch i { position: absolute; inset: 0; border-radius: 14px; background: #0a0f0d; border: 2px solid var(--line); transition: background .15s; pointer-events: none; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: var(--soft); transition: transform .15s, background .15s; }
.switch input:checked + i { background: var(--blue); }
.switch input:checked + i::after { transform: translateX(22px); background: #fff; }
.switch input:focus-visible + i { outline: 3px solid var(--gold); outline-offset: 2px; }
.coll { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.coll-item {
  appearance: none; cursor: pointer; position: relative; display: grid; gap: 4px; justify-items: center; text-align: center; padding: 10px 8px 9px;
  border-radius: 14px; border: 2px solid var(--line); background: var(--panel-2); color: var(--text); min-width: 0;
}
.coll-item::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; border-radius: 12px 12px 0 0; background: var(--rc, var(--r1)); }
.coll-item.b1 { --rc: var(--r1); } .coll-item.b2 { --rc: var(--r2); } .coll-item.b3 { --rc: var(--r3); } .coll-item.b4 { --rc: var(--r4); } .coll-item.b5 { --rc: var(--r5); }
.coll-item[aria-pressed="true"] { background: linear-gradient(#2f4a3d, #1f2c26); box-shadow: 0 0 0 2px var(--gold) inset; }
.coll-item.locked { cursor: default; opacity: .5; }
.coll-item .nm { font: 400 15px/1.15 var(--font-display); }
.coll-item .lv { font: 600 11px/1.3 var(--font-mono); color: var(--soft); }
.coll-item .gun { width: 92px; height: 36px; }
.coll-item .unit { width: 40px; height: 40px; }
.coll-item .eq { position: absolute; top: 8px; right: 8px; font: 400 10px/1 var(--font-display); padding: 3px 6px; border-radius: 6px; background: var(--gold); color: var(--on-gold); }
.coll-item .en-tag { position: absolute; top: 9px; left: 9px; font: 400 12px/1 var(--font-display); color: var(--gold); }
.coll-item .en-tag.hi { color: #ffd34d; text-shadow: 0 0 6px rgba(255, 211, 77, .6); }

/* upgrades */
.uplist { display: grid; gap: 8px; }
.uprow { display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; align-items: center; padding: 10px; border-radius: 14px; background: var(--panel-2); border: 2px solid var(--line); }
.up-ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: #0b110e; color: var(--gold); }
.up-ic svg { width: 26px; height: 26px; }
.uprow b { font: 400 16px/1.1 var(--font-display); }
.uprow .lvl { font: 600 11px/1 var(--font-mono); color: var(--soft); margin-left: 6px; }
.uprow .eff { font-size: 12px; color: var(--soft); margin-top: 3px; }
.uprow .eff b { font: 400 12px/1 var(--font-num); color: var(--green); }
.uprow .bar { margin-top: 6px; height: 5px; }
.uprow .btn { min-width: 82px; }
.rebirth { background: radial-gradient(ellipse at 50% 0%, #4a1a22, var(--panel) 70%); }
.rebirth h3 { color: var(--red-hi); }

/* rankings */
.segtabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 14px; background: #0a0f0d; }
.segtabs button { appearance: none; cursor: pointer; border: 0; border-radius: 10px; background: transparent; color: var(--soft); min-height: 40px; font: 400 15px/1 var(--font-display); }
.segtabs button[aria-pressed="true"] { background: linear-gradient(#3a5045, #24332c); color: #fff; box-shadow: 0 2px 0 var(--line); }
.lb { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.lb li { display: grid; grid-template-columns: 34px 34px 1fr auto; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 14px; background: var(--panel-2); min-width: 0; }
.lb li.me { background: linear-gradient(#22406e, #1a2c48); box-shadow: 0 0 0 2px var(--blue) inset; }
.lb li.tap { cursor: pointer; }
/* locked tabs (game-8 featureOpen) */
.tab.locked { opacity: .42; }
.tab.locked svg { filter: grayscale(1); }
/* the tutorial coach: a light on one thing, a ping on it, a bubble that says what to do */
.coach { position: fixed; inset: 0; z-index: 200; pointer-events: none; }
.coach[hidden] { display: none; }
.coach-block { position: fixed; pointer-events: auto; background: transparent; }
.coach-block.dim { background: rgba(4, 8, 6, .62); }
.coach-hole { position: fixed; pointer-events: none; border: 2px solid rgba(255, 255, 255, .92); box-shadow: 0 0 0 200vmax rgba(4, 8, 6, .62), 0 0 18px rgba(255, 197, 51, .55) inset; transition: left .16s, top .16s, width .16s, height .16s; }
.coach.wait .coach-hole { box-shadow: 0 0 0 200vmax rgba(4, 8, 6, .28), 0 0 18px rgba(255, 197, 51, .55) inset; }
.coach-ring { position: fixed; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%; border: 3px solid var(--gold); pointer-events: none; animation: coach-ping 1.1s ease-out infinite; }
@keyframes coach-ping { 0% { transform: scale(.45); opacity: 1; } 100% { transform: scale(1.45); opacity: 0; } }
.coach-bubble { position: fixed; pointer-events: auto; display: grid; gap: 10px; padding: 12px 14px; border-radius: 14px; background: var(--panel); border: 2px solid var(--gold); box-shadow: 0 6px 0 var(--line); }
.coach-text { margin: 0; font-size: 14.5px; line-height: 1.45; color: var(--text); overflow-wrap: anywhere; }
/* Korean breaks between words in the coach bubble (long sentences read badly split mid-word) */
html[lang="ko"] .coach-text { word-break: keep-all; }
.coach-acts { display: flex; justify-content: flex-end; gap: 8px; }
@media (prefers-reduced-motion: reduce) { .coach-ring { animation: none; } .coach-hole { transition: none; } }
.lb li.tap:active { filter: brightness(1.15); }
.lb .pos { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font: 400 15px/1 var(--font-num); background: #0b110e; }
.lb li:nth-child(1) .pos { background: linear-gradient(var(--gold-hi), var(--gold-lo)); color: var(--on-gold); }
.lb li:nth-child(2) .pos { background: linear-gradient(#f4f6f8, #9aa5ae); color: #20262b; }
.lb li:nth-child(3) .pos { background: linear-gradient(#f0b27a, #9a5a24); color: #2a1305; }
.lb .ins { width: 32px; height: 21px; color: var(--gold); }
.lb .who { display: grid; gap: 2px; min-width: 0; }
.lb .who b { font: 600 14px/1.2 var(--font-body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb .who span { font: 600 11px/1.2 var(--font-mono); color: var(--soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb .val { font: 400 16px/1 var(--font-num); text-align: right; }
.ai-tag { margin-left: 5px; padding: 1px 5px; border-radius: 5px; font: 600 9px/1.3 var(--font-mono); background: #0b110e; color: var(--soft); vertical-align: 1px; }
.lb-note { margin: 0; font-size: 12px; line-height: 1.5; color: var(--soft); }

/* supply */
.days { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.day { position: relative; display: grid; justify-items: center; align-content: start; gap: 4px; padding: 8px 4px; border-radius: 12px; border: 2px solid var(--line); background: var(--panel-2); text-align: center; font-size: 11px; line-height: 1.2; min-width: 0; }
.day:last-child { grid-column: span 2; }
.day b { font: 400 12px/1 var(--font-display); color: var(--soft); }
.day svg { width: 26px; height: 26px; }
.day.done { opacity: .45; }
.day.done::after { content: "✓"; position: absolute; top: 4px; right: 7px; font: 400 14px/1 var(--font-num); color: var(--green); }
.day.today { border-color: var(--gold); background: linear-gradient(#4a3c12, #2a2510); box-shadow: 0 0 0 2px rgba(255,197,51,.25); }
.missions { display: grid; gap: 8px; }
.mission { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 14px; background: var(--panel-2); border: 2px solid var(--line); }
.mission .t { font: 400 15px/1.2 var(--font-display); }
.mission .r { font-size: 11.5px; color: var(--soft); margin-top: 2px; }
.mission .bar { margin-top: 6px; }
.code-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.field { width: 100%; min-width: 0; min-height: 46px; padding: 8px 12px; border-radius: 12px; border: 2px solid var(--line); background: #0a0f0d; color: var(--text); font: 600 15px/1 var(--font-mono); -webkit-user-select: text; user-select: text; }
.settings { display: grid; gap: 10px; }
.set-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; min-height: 40px; font-size: 14px; }
.set-row form { display: flex; gap: 6px; }
.acct { display: grid; gap: 6px; justify-items: end; min-width: 0; }
.acct-who { font-size: 12.5px; color: var(--soft); text-align: right; overflow-wrap: anywhere; }
.acct-btns { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.set-row .field { width: 8.5em; min-height: 38px; }
.seg { display: inline-grid; grid-auto-flow: column; gap: 3px; padding: 3px; border-radius: 12px; background: #0a0f0d; }
.seg button { appearance: none; cursor: pointer; border: 0; border-radius: 9px; background: transparent; color: var(--soft); min-height: 34px; padding: 0 10px; font: 400 13px/1 var(--font-display); }
.seg button[aria-pressed="true"] { background: linear-gradient(#3a5045, #24332c); color: #fff; }
.foot-note { margin: 0; font: 600 11px/1.5 var(--font-mono); color: var(--dim); }

/* ---------- overlays ---------- */
.overlay {
  position: absolute; inset: 0; z-index: 9; display: grid; place-items: center; overflow-y: auto;
  padding: calc(var(--safe-t) + 16px) max(14px, var(--safe-r)) calc(var(--safe-b) + 16px) max(14px, var(--safe-l));
  background: rgba(4,7,6,.74);
}
.overlay.solid { background: radial-gradient(ellipse at 50% 30%, #1c2b24, #050806 75%); }
.card {
  width: min(420px, 100%); display: grid; gap: 12px; padding: 18px 16px 16px; border-radius: 22px; background: var(--panel);
  border: 2px solid var(--line); box-shadow: inset 0 1px 0 rgba(255,255,255,.07), 0 20px 50px rgba(0,0,0,.55);
}
.card-small { width: min(320px, 100%); }
.card h2 { margin: 0; font: 400 clamp(30px, 8vw, 40px)/1.05 var(--font-display); text-align: center; }
.doc { margin: 0; text-align: center; font: 600 11px/1 var(--font-mono); letter-spacing: .14em; color: var(--soft); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.actions .btn { flex: 1 1 120px; }
.aar { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.aar div { display: grid; gap: 5px; padding: 10px 12px; border-radius: 14px; background: var(--panel-2); }
.aar dt { font: 600 10.5px/1 var(--font-mono); letter-spacing: .08em; color: var(--soft); }
.aar dd { margin: 0; font: 400 24px/1 var(--font-num); }
.res-stars { display: flex; justify-content: center; gap: 8px; }
.res-stars svg { width: 54px; height: 54px; }
.res-stars svg:nth-child(2) { width: 64px; height: 64px; margin-top: -10px; }
.res-stars svg.pop { animation: starpop .45s cubic-bezier(.2,1.6,.4,1) both; }
@keyframes starpop { from { transform: scale(.2) rotate(-40deg); opacity: 0; } to { transform: none; opacity: 1; } }
.win h2 { color: var(--gold); text-shadow: 0 3px 0 #000; }
.lose h2 { color: var(--red-hi); text-shadow: 0 3px 0 #000; }
.rewards { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.rewards .pill { height: 36px; font-size: 17px; }
.bonus { display: grid; gap: 6px; }
.bonus-track { position: relative; display: grid; height: 42px; border-radius: 12px; overflow: hidden; border: 2px solid var(--line); }
.bonus-track span { display: grid; place-items: center; font: 400 15px/1 var(--font-num); background: var(--panel-3); color: #fff; border-left: 2px solid var(--line); }
.bonus-track span:first-child { border-left: 0; }
.bonus-track span.hot { background: linear-gradient(var(--gold-hi), var(--gold)); color: var(--on-gold); }
.bonus-track span.max { background: linear-gradient(var(--red-hi), var(--red)); }
.needle { position: absolute; top: 0; bottom: 0; width: 6px; margin-left: -3px; left: 0; background: #fff; box-shadow: 0 0 0 2px #000, 0 0 10px #fff; }
.perk-wrap { width: min(440px, 100%); display: grid; gap: 12px; justify-items: center; }
.perk-wrap h2 { margin: 0; text-align: center; font: 400 clamp(30px, 8vw, 40px)/1 var(--font-display); color: var(--teal); text-shadow: 0 3px 0 #000; }
.perk-cards { width: 100%; display: grid; gap: 10px; }
.perk {
  appearance: none; cursor: pointer; display: grid; grid-template-columns: 56px 1fr; column-gap: 14px; row-gap: 5px; align-items: center; text-align: left;
  padding: 12px 14px; border-radius: 18px; border: 2px solid var(--line); background: linear-gradient(#2a3a33, var(--panel)); color: var(--text);
  box-shadow: 0 5px 0 var(--line); animation: cardin .32s cubic-bezier(.2,1.3,.4,1) both;
}
.perk:nth-child(2) { animation-delay: .06s; } .perk:nth-child(3) { animation-delay: .12s; }
@keyframes cardin { from { transform: translateY(26px) scale(.92); opacity: 0; } to { transform: none; opacity: 1; } }
.perk:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--line); }
.perk .ico { grid-row: span 3; width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; color: #052a27; background: linear-gradient(#a6f6ee, var(--teal)); border: 2px solid var(--line); }
.perk .ico svg { width: 32px; height: 32px; }
.perk b { font: 400 19px/1.1 var(--font-display); }
.perk p { margin: 0; font-size: 13px; line-height: 1.4; color: var(--soft); }
.crate-stage { width: min(400px, 100%); display: grid; justify-items: center; gap: 14px; }
#crate-fx { width: min(352px, 100%); aspect-ratio: 176 / 132; image-rendering: pixelated; border-radius: 18px; background: radial-gradient(closest-side, #22302a, #0a0f0d); border: 2px solid var(--line); }
.reveal { width: 100%; display: grid; justify-items: center; gap: 8px; padding: 16px 14px; border-radius: 20px; text-align: center; background: var(--panel); border: 2px solid var(--line); box-shadow: 0 0 0 3px var(--rc, var(--r1)) inset, 0 0 30px color-mix(in srgb, var(--rc, var(--r1)) 35%, transparent); animation: cardin .3s ease-out both; }
.reveal.b1 { --rc: var(--r1); } .reveal.b2 { --rc: var(--r2); } .reveal.b3 { --rc: var(--r3); } .reveal.b4 { --rc: var(--r4); } .reveal.b5 { --rc: var(--r5); }
.reveal h3 { margin: 0; font: 400 28px/1.1 var(--font-display); }
.reveal p { margin: 0; font-size: 13px; color: var(--soft); }
.reveal .new { font: 400 17px/1 var(--font-num); color: var(--gold); letter-spacing: .06em; }
.reveal .art { width: 180px; height: 68px; }
.reveal .art.unit { width: 64px; height: 64px; }
.dialog p { margin: 0; font-size: 14px; line-height: 1.55; text-align: center; }
.toasts { position: absolute; z-index: 12; left: 50%; transform: translateX(-50%); top: calc(var(--safe-t) + 118px); width: min(400px, calc(100% - 32px)); display: grid; gap: 6px; justify-items: center; pointer-events: none; }
.toast { padding: 10px 16px; border-radius: 14px; background: rgba(6,10,8,.92); border: 2px solid var(--line); color: #fff; font: 400 14px/1.35 var(--font-display); text-align: center; animation: toast 2.6s ease-out forwards; }
@keyframes toast { 0% { opacity: 0; transform: translateY(-10px) scale(.95); } 10%, 80% { opacity: 1; transform: none; } 100% { opacity: 0; } }

/* ---------- splash ---------- */
.splash {
  position: absolute; inset: 0; z-index: 20; display: grid; grid-template-rows: 1fr auto; justify-items: center; align-items: center; gap: 22px;
  padding: calc(var(--safe-t) + 40px) 24px calc(var(--safe-b) + 34px); text-align: center;
  background: radial-gradient(ellipse at 50% 34%, #1e3a2d, #0a120e 62%, #050806);
}
.logo { display: grid; justify-items: center; gap: 12px; }
.emblem { width: 150px; height: 150px; filter: drop-shadow(0 8px 0 rgba(0,0,0,.6)); animation: float 3s ease-in-out infinite; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.logo h1 { margin: 0; font: 400 clamp(42px, 13vw, 58px)/1 var(--font-display); color: #fff; text-shadow: 0 5px 0 #000, 0 0 30px rgba(59,127,255,.55); }
.logo .en { font: 400 15px/1 var(--font-num); letter-spacing: .32em; color: var(--gold); }
.logo .tagline { margin: 4px 0 0; font-size: 14px; color: var(--soft); }
.load { width: min(300px, 86%); display: grid; gap: 14px; justify-items: center; }
.load .bar { width: 100%; height: 10px; border-radius: 6px; }
.load .bar > i { transition: width .2s; }
.load-text { font: 600 12px/1 var(--font-mono); color: var(--soft); }
.load .btn-play { width: 100%; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }
.install-link { appearance: none; cursor: pointer; border: 0; background: none; color: var(--gold-hi); font: 400 14px/1 var(--font-display); text-decoration: underline; text-underline-offset: 4px; padding: 6px; }
.ver { margin: 0; font: 600 11px/1 var(--font-mono); color: var(--dim); }

@media (max-height: 700px) {
  .side { top: calc(var(--safe-t) + 116px); gap: 8px; }
  .qbtn { width: 54px; padding: 5px 0 4px; }
  .qbtn svg { width: 24px; height: 24px; }
  .power-banner { top: calc(var(--safe-t) + 66px); }
  .page-home { gap: 8px; padding-top: 22px; }
  .mission-card { padding: 10px 12px; gap: 6px; }
  .mission-card h2 { font-size: 19px; }
  .btn-play { min-height: 56px; font-size: 26px; }
}
@media (prefers-reduced-motion: reduce) {
  .banner.show { animation: none; opacity: 1; }
  .perk, .reveal, .res-stars svg.pop, .toast, .emblem, .load .btn-play, .qbtn.hot { animation-duration: .01s; animation-iteration-count: 1; }
}

/* =====================================================================
   v4: shop, command tree, enhancement, pass, augment tiers, revive, settings
   ===================================================================== */
.wallet { align-items: center; gap: 4px; }
.wallet .pill { height: 30px; padding: 0 8px 0 2px; gap: 4px; font-size: 13.5px; }
.wallet .pill .ic { width: 22px; height: 22px; }
.wallet .pill .ic svg { width: 15px; height: 15px; }
.gear { appearance: none; cursor: pointer; width: 34px; height: 34px; flex: none; border-radius: 10px; border: 2px solid var(--line); background: linear-gradient(#34483f, #18231e); color: var(--soft); display: grid; place-items: center; box-shadow: 0 2px 0 var(--line); }
.gear svg { width: 18px; height: 18px; }
.wallet { flex: none; }
@media (max-width: 400px) { .rank-info .bar { max-width: 40px; } .rank-badge { width: 38px; height: 38px; } }
@media (max-width: 380px) {
  .rank-info .bar { display: none; }
  .rank-badge { width: 34px; height: 34px; border-radius: 10px; } .rank-badge svg { width: 26px; height: 17px; }
  .wallet .pill { padding: 0 6px 0 1px; gap: 3px; font-size: 12.5px; } .wallet .pill .ic { width: 20px; height: 20px; }
  .gear { width: 30px; height: 30px; }
}
.side { grid-auto-flow: column; grid-template-rows: repeat(4, auto); justify-content: start; }
.boost.gold { background: linear-gradient(#fff3c4, var(--gold)); }
.tab.main svg { width: 30px; height: 30px; }
.tab.main[aria-selected="true"] svg { transform: translateY(-4px) scale(1.18); }
.small { font-size: 11.5px; }
.bar.big { height: 12px; border-radius: 7px; }
.row.wrap { flex-wrap: wrap; }
.btn.link { background: none; box-shadow: none; border-color: transparent; color: var(--soft); text-decoration: underline; text-underline-offset: 3px; min-height: 32px; padding: 4px 8px; font-size: 13px; text-shadow: none; }
.tag.hot { background: var(--red); color: #fff; }
#arm-special { gap: 8px; margin-top: 8px; }
#arm-special .btn { flex: 1 1 150px; }

/* banner ad: the native ad sits under the tab bar, so the lobby moves up by its height */
#stage.has-banner .tabbar { bottom: var(--banner-h, 0px); height: var(--nav-h); padding-bottom: 0; }
#stage.has-banner .page { bottom: calc(var(--nav-h) + var(--banner-h, 0px)); }
#stage.mock-banner::after { content: "AD · TEST BANNER"; position: absolute; left: 0; right: 0; bottom: 0; height: var(--banner-h, 50px); z-index: 30; display: grid; place-items: center; background: #1a1a1a; color: #9a9a9a; font: 600 12px/1 var(--font-mono); border-top: 1px solid #444; }

/* dialogs can hold rich content now */
.dlg-body { display: grid; gap: 8px; font-size: 14px; line-height: 1.55; text-align: center; }
.offer-body .big, .offer .big { margin: 0; font: 400 18px/1.35 var(--font-display); color: var(--gold-hi); }
.odds-wrap { display: grid; gap: 12px; max-height: 52vh; overflow-y: auto; text-align: left; padding-right: 4px; }
.odds h4 { margin: 0 0 4px; font: 400 15px/1.2 var(--font-display); color: var(--gold-hi); }
.odds table { width: 100%; border-collapse: collapse; font-size: 13px; }
.odds td { padding: 5px 6px; border-bottom: 1px solid rgba(255,255,255,.07); }
.odds td.num { text-align: right; font: 600 12.5px/1 var(--font-mono); color: #fff; }

/* shop */
.panel.note { background: #132235; border-color: #26476e; }
.panel.offer { position: relative; border: 2px solid var(--gold); background: radial-gradient(ellipse at 50% 0%, #5a3a10, var(--panel) 72%); }
.ribbon { position: absolute; top: -9px; left: 50%; transform: translateX(-50%); padding: 3px 9px; border-radius: 8px; background: var(--red); color: #fff; font: 400 11px/1.1 var(--font-display); white-space: nowrap; border: 2px solid var(--line); z-index: 1; }
.panel.offer .ribbon { left: auto; right: 12px; transform: none; }
.shop-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 4px; }
.shop-item { position: relative; display: grid; justify-items: center; align-content: start; gap: 5px; padding: 14px 8px 10px; border-radius: 14px; background: var(--panel-2); border: 2px solid var(--line); text-align: center; min-width: 0; }
.shop-item > svg { width: 34px; height: 34px; }
.shop-item b { font: 400 16px/1.15 var(--font-display); }
.shop-item.medals b { font: 400 22px/1 var(--font-num); color: var(--gold-hi); }
.shop-item .soft { font-size: 11.5px; line-height: 1.3; }
.shop-item .btn { width: 100%; margin-top: 2px; }
.shop-item.wide { grid-column: 1 / -1; grid-template-columns: auto minmax(0, 1fr) minmax(0, 40%); justify-items: start; align-items: center; column-gap: 12px; text-align: left; padding: 12px; border-color: var(--gold); }
.shop-item.wide .txt { display: grid; gap: 3px; min-width: 0; }
.shop-item.wide .btn { margin-top: 0; }
.pass-card { display: grid; gap: 8px; padding: 12px; border-radius: 14px; background: var(--panel-2); border: 2px solid var(--line); }
.pass-card + .pass-card { margin-top: 8px; }
.pass-card b { font: 400 18px/1.1 var(--font-display); }
.pass-card.vip { border-color: var(--gold); background: linear-gradient(135deg, #3d2c05, #1f2c26 62%); }
.pass-card ul { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.5; color: var(--soft); }
.shop-foot { display: grid; gap: 8px; justify-items: center; padding: 4px 0 8px; text-align: center; }
.shop-foot .btn { min-width: 160px; }

/* supply: pass track */
.pass-top { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; margin-top: 4px; }
.pass-top b { font: 400 16px/1 var(--font-num); }
.pass-track { display: flex; gap: 6px; overflow-x: auto; padding: 6px 2px 8px; scroll-snap-type: x proximity; scrollbar-width: thin; }
.tier { flex: none; width: 86px; display: grid; gap: 6px; scroll-snap-align: start; }
.tier .tn { text-align: center; font: 400 13px/1 var(--font-num); color: var(--dim); }
.tier.reached .tn { color: var(--gold); }
.cell { appearance: none; position: relative; display: grid; justify-items: center; align-content: center; gap: 4px; min-height: 84px; padding: 8px 4px; border-radius: 12px; border: 2px solid var(--line); background: var(--panel-2); color: var(--text); font: 400 10.5px/1.2 var(--font-body); text-align: center; cursor: pointer; }
.cell svg { width: 24px; height: 24px; }
.cell.prem { background: linear-gradient(#3d2c05, #241b07); }
.cell.locked { opacity: .5; }
.cell.got { opacity: .35; }
.cell.got::after { content: "✓"; position: absolute; top: 3px; right: 6px; font: 400 13px/1 var(--font-num); color: var(--green); }
.cell.ready { border-color: var(--gold); animation: hot 1.4s ease-in-out infinite; }
.cell:disabled { cursor: default; }

/* armory: enhancement */
.enh { width: 100%; display: grid; gap: 8px; padding-top: 10px; margin-top: 4px; border-top: 1px solid rgba(255,255,255,.08); justify-items: center; }
.enh > .btn { width: 100%; }
.enh-line { display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap; font: 400 17px/1 var(--font-num); }
.enh .rate { color: var(--green); font: 400 17px/1 var(--font-display); }
.enh-max { color: var(--gold); font: 400 18px/1 var(--font-display); }
.tag.enh-tag { background: linear-gradient(#4a3a10, #2a2108); color: var(--gold-hi); font-family: var(--font-num); }
.tag.enh-tag.hi { background: linear-gradient(var(--red-hi), var(--red-lo)); color: #fff; }
.gun-hero .art.glow { filter: drop-shadow(0 0 7px var(--gold)) drop-shadow(0 4px 0 rgba(0,0,0,.5)); }
.shake { animation: shake .38s; }
@keyframes shake { 0%, 100% { transform: none; } 20% { transform: translateX(-7px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }

/* command tree */
.tree-wrap { position: relative; height: min(50vh, 440px); min-height: 280px; border-radius: 18px; overflow: hidden; border: 2px solid var(--line); background: radial-gradient(circle at 50% 50%, #1c2b24, #090f0c 72%); }
#tree-canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.tree-sum { position: absolute; left: 10px; top: 8px; padding: 5px 9px; border-radius: 9px; background: rgba(0,0,0,.5); font: 600 11px/1 var(--font-mono); color: var(--soft); pointer-events: none; }
.tree-tools { position: absolute; right: 8px; bottom: 8px; display: grid; gap: 6px; }
.tree-tools button { appearance: none; cursor: pointer; width: 40px; height: 40px; border-radius: 11px; border: 2px solid var(--line); background: rgba(24,35,30,.92); color: var(--text); font: 400 20px/1 var(--font-num); box-shadow: 0 2px 0 var(--line); }
.tree-detail { border-color: var(--bc, var(--line)); gap: 8px; }
.td-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.td-head b { font: 400 21px/1.1 var(--font-display); color: var(--bc, #fff); }
.td-head .lvl { margin-left: auto; font: 600 12px/1 var(--font-mono); color: var(--soft); }
.tag.br { background: var(--bc); color: #06100b; }
.tag.keep { background: #3d2c05; color: var(--gold-hi); }
.tree-detail .eff { margin: 0; font-size: 14px; }
.tree-detail .eff b { color: var(--green); font-weight: 600; }
.td-acts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.td-acts .btn { flex: 1 1 140px; }

/* augment tiers */
.perk .ico { grid-column: 1; grid-row: 1 / span 4; }
.perk > :not(.ico) { grid-column: 2; }
.perk .tier-tag { justify-self: start; padding: 3px 7px; border-radius: 6px; font: 600 10px/1 var(--font-mono); letter-spacing: .12em; text-transform: uppercase; background: #4b5751; color: #e8efe9; }
.perk .pips { display: flex; gap: 4px; }
.perk .pips i { width: 14px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.15); }
.perk .pips i.on { background: var(--teal); }
.perk.tier1 { border-color: #9aa7a0; }
.perk.tier2 { border-color: var(--gold); background: linear-gradient(#3d3210, var(--panel)); }
.perk.tier2 .tier-tag { background: var(--gold); color: var(--on-gold); }
.perk.tier2 .ico { background: linear-gradient(var(--gold-hi), var(--gold)); color: var(--on-gold); }
.perk.tier3 { border: 3px solid transparent; background: linear-gradient(#2a1f3d, var(--panel)) padding-box, conic-gradient(from var(--spin, 0deg), #ff4d6d, #ffc533, #3fd27c, #2bd4c7, #4f8cff, #b06cff, #ff4d6d) border-box; animation: cardin .32s cubic-bezier(.2,1.3,.4,1) both, prism 3s linear infinite; }
.perk.tier3 .tier-tag { background: linear-gradient(90deg, #ff4d6d, #ffc533, #3fd27c, #4f8cff, #b06cff); color: #fff; text-shadow: 0 1px 0 #000; }
.perk.tier3 .ico { background: linear-gradient(135deg, #ffd1f0, #b06cff 50%, #4f8cff); color: #fff; }
.perk.tier4 { border-color: #ff4d6d; background: linear-gradient(#4a1420, var(--panel)); box-shadow: 0 5px 0 var(--line), 0 0 22px rgba(255,77,109,.45); }
.perk.tier4 .tier-tag { background: #ff4d6d; color: #fff; }
.perk.tier4 .ico { background: linear-gradient(#ffb3c1, #ff4d6d); color: #3a0010; }
@property --spin { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
@keyframes prism { to { --spin: 360deg; } }
.perk-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; width: 100%; }
.perk-actions .btn { flex: 1 1 150px; }

/* revive */
.revive-card { text-align: center; }
.revive-card p { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--soft); }
.revive-card h2 { color: var(--red-hi); }
.revive-count { justify-self: center; width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; font: 400 40px/1 var(--font-num); color: var(--red-hi); border: 4px solid var(--red); background: #1a0a0d; animation: pulse 1s ease-in-out infinite; }

/* settings sheet */
.settings-card { width: min(440px, 100%); }
.settings-card h2 { font-size: 26px; text-align: left; }
.settings-card a { color: var(--soft); }
select.field { width: 11em; min-height: 38px; font: 400 14px/1 var(--font-body); -webkit-appearance: none; appearance: none; padding-right: 28px; }

/* test ad stand-in */
.adwatch-card { display: grid; gap: 10px; justify-items: center; min-width: 240px; padding: 30px 22px; border-radius: 20px; background: #000; border: 2px solid #444; text-align: center; }
.adwatch-card b { font: 400 64px/1 var(--font-num); color: #fff; }

@media (max-height: 700px) {
  .side { grid-template-rows: repeat(3, auto); }
  .tree-wrap { height: min(46vh, 380px); }
}
@media (prefers-reduced-motion: reduce) {
  .perk.tier3, .cell.ready, .revive-count, .shake { animation-duration: .01s; animation-iteration-count: 1; }
}
.revive-card .btn-play { font-size: 20px; min-height: 58px; letter-spacing: 0; }
.revive-card .actions .btn { flex: 1 1 130px; }

/* web test mode (?bmtest) shortcuts in settings */
.test-panel { margin-top: 10px; padding: 10px; border: 2px dashed var(--gold-lo); border-radius: 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.test-panel p { width: 100%; margin: 0 0 4px; color: var(--gold); }
/* one-line labels that shrink to fit (fitLabels) instead of wrapping onto a second line */
.qbtn > span:not(.badge) { white-space: nowrap; }
/* result: the big multiplier button gets its own full-width row, so long translations stay on one or two lines */
#res-actions .btn-play { flex: 1 1 100%; }
/* very short screens with a tall briefing: quick buttons shrink to icons (labels stay in aria-label) */
.side.mini { gap: 6px; }
.side.mini .qbtn { width: 42px; padding: 5px 0; border-radius: 12px; }
.side.mini .qbtn svg { width: 22px; height: 22px; }
.side.mini .qbtn > span:not(.badge) { display: none; }
.side.mini .qbtn .badge { top: -6px; right: -6px; min-width: 18px; height: 18px; font-size: 10px; padding: 0 4px; }
.page-home.compact #brief-note { display: none; }
/* long translations: settings controls drop below their label instead of pushing the card wider */
.set-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 10px; }
.set-row > :first-child { flex: 1 1 auto; min-width: 0; }
.set-row > :last-child { margin-left: auto; max-width: 100%; }
.seg { max-width: 100%; }
/* rankings: the rank · level · prestige line may take two lines; collection names stay on one (they shrink) */
.lb .who span { white-space: normal; }
.coll-item .nm { white-space: nowrap; }
.slot.filled .soft { font-size: 11px; }
.nb { white-space: nowrap; }
.promo-ranks { display: inline-block; }
/* revive: the ad button gets a full row like the result screen; medals and give up share the next one */
.revive-card .actions .btn-play { flex: 1 1 100%; }
/* bonus needle: blue while slowed by an ad, the ×5 cell pulses; the cell it stopped on gets a ring */
.bonus-track.slow .needle { background: var(--blue-hi); box-shadow: 0 0 0 2px #000, 0 0 14px var(--blue-hi); }
.bonus-track.slow span.max { animation: bonus-max 0.9s ease-in-out infinite; }
@keyframes bonus-max { 50% { filter: brightness(1.35); } }
.bonus-track span.hit { box-shadow: inset 0 0 0 3px #fff; }

/* fun pack: the ultimate button (charge ring), FEVER glow */
.ult {
  appearance: none; cursor: pointer; position: absolute; z-index: 6; left: 50%; bottom: calc(var(--safe-b) + 18px); transform: translateX(-50%);
  width: 82px; height: 82px; padding: 0; border-radius: 50%; display: none; place-items: center; align-content: center; gap: 1px;
  border: 3px solid var(--line); box-shadow: 0 4px 0 var(--line); color: #fff; font: 400 12px/1 var(--font-display);
  background: conic-gradient(var(--gold) calc(var(--ult, 0) * 1%), rgba(10,15,13,.72) 0);
}
.ult::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: radial-gradient(#2c3d35, #111a15); }
.ult > * { position: relative; }
.ult svg { width: 30px; height: 30px; opacity: .45; }
.ult b { opacity: .6; white-space: nowrap; }
.ult.ready { border-color: #fff; animation: ult-ready .9s ease-in-out infinite; }
.ult.ready svg, .ult.ready b { opacity: 1; color: var(--gold); }
@keyframes ult-ready { 50% { transform: translateX(-50%) scale(1.08); box-shadow: 0 4px 0 var(--line), 0 0 26px var(--gold); } }
#stage.playing .ult { display: grid; }
#stage.fever::after { content: ""; position: absolute; inset: 0; z-index: 4; pointer-events: none; box-shadow: inset 0 0 54px 14px rgba(255,197,51,.6); animation: fever-glow .45s ease-in-out infinite alternate; }
@keyframes fever-glow { from { opacity: .5; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .ult.ready, #stage.fever::after { animation: none; } }
