:root {
  --ui: 1;
  --panel: rgba(13, 17, 23, 0.78);
  --panel-solid: rgba(18, 23, 31, 0.96);
  --panel-2: rgba(255, 255, 255, 0.05);
  --panel-border: rgba(255, 255, 255, 0.12);
  --text: #eef2f6;
  --muted: #9aa7b4;
  --accent: #ff9a2e;
  --accent-2: #ffcf5a;
  --danger: #ff4b4b;
  --good: #3ee07a;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
}
body[data-theme="light"] {
  --panel: rgba(250, 251, 253, 0.88);
  --panel-solid: rgba(246, 248, 251, 0.98);
  --panel-2: rgba(10, 30, 60, 0.05);
  --panel-border: rgba(10, 30, 60, 0.14);
  --text: #16202c;
  --muted: #5b6776;
  --shadow: 0 10px 30px rgba(20, 40, 70, 0.18);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; width: 100%; height: 100%; overflow: hidden;
  background: #0d1117; color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  touch-action: none; user-select: none; -webkit-user-select: none;
  -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; overscroll-behavior: none;
}
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
button { font: inherit; color: inherit; touch-action: manipulation; }
img { -webkit-user-drag: none; }

/* ------------------------------------------------------------- buttons */
.btn {
  border: 1px solid var(--panel-border); background: var(--panel); color: var(--text);
  padding: 11px 16px; border-radius: 12px; font-weight: 800; letter-spacing: 0.06em; font-size: 14px;
  cursor: pointer; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  transition: transform 0.08s ease, opacity 0.2s ease, background 0.2s ease;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap;
}
.btn:active { transform: scale(0.96); }
.btn.primary {
  background: linear-gradient(180deg, #ffb24d, #f07b12); border-color: rgba(255, 220, 160, 0.6); color: #1b0d00;
  box-shadow: 0 6px 20px rgba(240, 123, 18, 0.35);
}
.btn:disabled { filter: grayscale(1) brightness(0.75); opacity: 0.7; box-shadow: none; cursor: not-allowed; }
.btn.ghost { background: transparent; }
.btn.big { font-size: 18px; padding: 14px 30px; }
.btn.sm { padding: 6px 10px; font-size: 11.5px; border-radius: 9px; }
.btn svg.cur, .rchip svg.cur { width: 16px; height: 16px; }

.icon-btn {
  width: calc(52px * var(--ui)); height: calc(52px * var(--ui)); border-radius: 14px;
  border: 1px solid var(--panel-border); background: var(--panel); color: var(--text);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  font-size: 17px; font-weight: 900; cursor: pointer; padding: 0; line-height: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
}
.icon-btn svg { width: 55%; height: 55%; }
.icon-btn small { font-size: 8.5px; letter-spacing: 0.08em; margin-top: 2px; color: var(--muted); font-weight: 800; }
.icon-btn:active { transform: scale(0.93); }
.icon-btn.up { border-color: rgba(255, 210, 74, 0.6); }
.icon-btn.up small { color: #e8a800; }
.icon-btn.sm { width: calc(40px * var(--ui)); height: calc(40px * var(--ui)); }
.icon-btn.sm svg { width: 45%; height: 45%; }
.icon-btn.sm small { font-size: 7px; margin-top: 0; }
.x-btn { background: none; border: 0; color: var(--muted); padding: 4px; cursor: pointer; }
.x-btn svg { width: 20px; height: 20px; display: block; }

/* ------------------------------------------------------------------ HUD */
#hud { position: fixed; top: calc(8px + var(--sat)); left: calc(8px + var(--sal)); right: calc(8px + var(--sar)); z-index: 10; pointer-events: none; display: none; }
body.ingame #hud, body.layout-edit #hud { display: block; }
#hud-left { position: absolute; left: 0; top: 0; display: flex; gap: 6px; pointer-events: auto; }
#hud-pills { margin: 0 calc(100px * var(--ui)); display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.pill {
  display: flex; align-items: center; gap: 6px; background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: 999px; padding: 6px 12px; font-size: 15px; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  font-variant-numeric: tabular-nums; transition: transform 0.15s ease;
}
.pill.bump { transform: scale(1.12); }
.pill .lbl { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 0.1em; }
.pill.hp .bar { width: 80px; height: 8px; background: rgba(127, 127, 127, 0.25); border-radius: 99px; overflow: hidden; }
#hp-fill { width: 100%; height: 100%; background: linear-gradient(90deg, #ff4d4d, #3ee07a); background-size: 200% 100%; background-position: 100% 0; transition: width 0.25s ease; }
.ico { display: inline-block; width: 16px; height: 16px; flex: none; }
.ico.sm { width: 12px; height: 12px; vertical-align: -1px; }
.ico.gold { border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff3b0, #ffc62e 45%, #b87800); box-shadow: 0 0 6px rgba(255, 200, 60, 0.6); }
.ico.heart { background: #ff4d5e; clip-path: path("M8 14 L1.6 7.4 A3.6 3.6 0 0 1 8 3 A3.6 3.6 0 0 1 14.4 7.4 Z"); }
.ico.skull { border-radius: 50% 50% 40% 40%; background: radial-gradient(circle at 34% 45%, #111 18%, transparent 20%), radial-gradient(circle at 66% 45%, #111 18%, transparent 20%), #d9dee4; }
.ico.tp { transform: rotate(45deg) scale(0.8); border-radius: 3px; background: linear-gradient(135deg, #7ff0ff, #3a8dff); box-shadow: 0 0 8px rgba(80, 200, 255, 0.7); }

/* abilities */
#abilities {
  position: fixed; left: calc(8px + var(--sal)); top: calc(60px + var(--sat));
  display: none; flex-direction: column; gap: 8px; z-index: 11;
  scale: var(--ui); transform-origin: left top;
}
body.ingame #abilities, body.layout-edit #abilities { display: flex; }
.ability {
  --cd: 0deg; --ac: #ffcf5a;
  position: relative; width: 54px; height: 54px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25); background: rgba(13, 17, 23, 0.78);
  display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; padding: 0;
}
.ability svg { width: 28px; height: 28px; position: relative; z-index: 1; }
.ability small { position: relative; z-index: 1; font-size: 7px; font-weight: 900; letter-spacing: 0.08em; color: #c9d3dd; }
.ability em {
  position: absolute; right: -4px; top: -4px; z-index: 2; min-width: 19px; height: 19px; border-radius: 10px;
  background: var(--ac); color: #10151c; font-style: normal; font-size: 11px; font-weight: 900; line-height: 19px; text-align: center;
}
.ability::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(rgba(0, 0, 0, 0.72) var(--cd), transparent 0); }
.ability.ready { border-color: var(--ac); box-shadow: 0 0 14px color-mix(in srgb, var(--ac) 60%, transparent); }
.ability.empty { opacity: 0.45; }
.ability.empty em { background: #555; color: #ddd; }
.ability.armed { border-color: #ff4a2a; box-shadow: 0 0 22px rgba(255, 74, 42, 0.8); animation: blink 0.5s steps(2) infinite; }
body.targeting #game { cursor: crosshair; }

/* top-down UI */
#top-ui {
  position: fixed; left: 0; right: 0; bottom: calc(12px + var(--sab)); display: none; flex-direction: column; align-items: center; gap: 6px;
  z-index: 10; pointer-events: none; transition: opacity 0.25s ease, transform 0.25s ease;
}
body.ingame #top-ui { display: flex; }
#top-ui > * { pointer-events: auto; }
#hint { pointer-events: none; font-size: 12px; color: #fff; background: rgba(0, 0, 0, 0.5); padding: 5px 10px; border-radius: 99px; text-align: center; max-width: calc(100vw - 150px); }
#start-wave { font-size: 16px; padding: 13px 26px; scale: var(--ui); }
#start-wave.hidden { display: none; }
body.fpv #top-ui, body.sheet-open #top-ui { opacity: 0; transform: translateY(20px); pointer-events: none; }
body.fpv #top-ui > *, body.sheet-open #top-ui > * { pointer-events: none; }
#wave-preview { display: none; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; background: rgba(0, 0, 0, 0.55); pointer-events: none; color: #fff; }
#wave-preview.show { display: flex; }
.wp-lbl { font-size: 10px; font-weight: 900; letter-spacing: 0.14em; color: #9aa7b4; }
.wp-e { display: inline-flex; align-items: center; gap: 1px; font-size: 12px; }
.wp-e svg { width: 22px; height: 22px; }
.wp-e.boss b { color: #ff7a7a; }

/* coach (tutorial) */
#coach {
  position: fixed; left: 50%; top: calc(58px + var(--sat)); transform: translate(-50%, -12px);
  width: min(440px, calc(100vw - 160px)); display: flex; gap: 8px; align-items: center;
  background: linear-gradient(135deg, rgba(255, 178, 77, 0.95), rgba(240, 123, 18, 0.95)); color: #1b0d00;
  border-radius: 14px; padding: 9px 12px; font-size: 13px; font-weight: 700; line-height: 1.35; z-index: 14;
  opacity: 0; pointer-events: none; transition: opacity 0.3s ease, transform 0.3s ease; box-shadow: var(--shadow);
}
#coach.show { opacity: 1; transform: translate(-50%, 0); }
.coach-ico { font-size: 18px; }

/* ------------------------------------------------------------------ sheets */
.sheet {
  position: fixed; left: 50%; bottom: calc(10px + var(--sab)); width: min(500px, calc(100vw - 20px));
  transform: translate(-50%, 140%); background: var(--panel-solid); color: var(--text);
  border: 1px solid var(--panel-border); border-radius: 18px; padding: 12px 14px 14px; z-index: 20;
  transition: transform 0.28s cubic-bezier(.2, .9, .3, 1.15); box-shadow: var(--shadow);
  max-height: calc(100dvh - 20px - var(--sat) - var(--sab)); overflow-y: auto; touch-action: pan-y;
}
.sheet.open { transform: translate(-50%, 0); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.sheet-row { display: flex; gap: 10px; align-items: center; }
.sheet-row.actions { margin-top: 10px; }
.sheet-row.actions .btn { flex: 1; padding-left: 8px; padding-right: 8px; }
.sheet-row.actions.three .btn { font-size: 12px; }
.sheet-title { font-weight: 800; font-size: 16px; display: flex; align-items: center; gap: 6px; }
.sheet-sub { color: var(--muted); font-size: 12.5px; margin-top: 3px; line-height: 1.35; min-height: 17px; }
.opts { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 10px 0 6px; }
.opt {
  min-width: 0; border: 1px solid var(--panel-border); background: var(--panel-2); border-radius: 12px; padding: 5px 3px;
  display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer;
}
.opt.sel { border-color: var(--accent-2); background: rgba(255, 207, 90, 0.14); box-shadow: 0 0 0 1px var(--accent-2) inset; }
.opt .t-icon { width: 44px; height: 44px; background: transparent; border: 0; }
.opt .o-name { font-size: 10.5px; font-weight: 800; white-space: nowrap; }
.opt .o-cost { font-size: 11px; color: #e8a800; font-weight: 800; display: flex; align-items: center; gap: 3px; }
.opt .o-cost svg { width: 12px; height: 12px; }
.opt.poor .o-cost { color: var(--danger); }
.opt.locked { opacity: 0.45; }
.t-icon { width: 48px; height: 48px; flex: none; border-radius: 12px; background: rgba(0, 0, 0, 0.25); border: 1px solid var(--panel-border); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.t-icon img { width: 118%; height: 118%; object-fit: cover; }
.t-icon svg { width: 78%; height: 78%; }
.lvl-chip { font-size: 10px; font-weight: 900; padding: 2px 6px; border-radius: 6px; background: linear-gradient(135deg, #ffb24d, #f07b12); color: #1b0d00; }
.tc-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.tc-chips span { font-size: 10px; font-weight: 800; letter-spacing: 0.04em; padding: 2px 6px; border-radius: 6px; background: var(--panel-2); color: var(--muted); border: 1px solid var(--panel-border); }

/* upgrade tree (graph) */
.tree-sheet { width: min(520px, calc(100vw - 16px)); }
.tgraph { position: relative; height: 220px; margin: 26px auto 0; max-width: 460px; }
.tgraph svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.tgraph line { stroke: rgba(127, 127, 127, 0.35); stroke-width: 1.2; stroke-dasharray: 2 2; vector-effect: non-scaling-stroke; }
.tgraph line.on { stroke: var(--bc); stroke-width: 3; stroke-dasharray: none; filter: drop-shadow(0 0 3px var(--bc)); }
.troot { position: absolute; left: 5%; top: 50%; width: 36px; height: 36px; transform: translate(-50%, -50%); border-radius: 50%; background: var(--panel-solid); border: 2px solid var(--panel-border); display: flex; align-items: center; justify-content: center; }
.troot svg { width: 80%; height: 80%; }
.tnode {
  position: absolute; width: 36px; height: 36px; margin: -18px 0 0 -18px; border-radius: 50%; padding: 7px;
  border: 2px solid rgba(127, 127, 127, 0.4); background: var(--panel-solid); color: var(--muted); cursor: pointer;
  transition: transform 0.1s ease;
}
.tnode svg { width: 100%; height: 100%; display: block; }
.tnode i { position: absolute; right: -5px; bottom: -5px; font-style: normal; font-size: 9px; font-weight: 900; width: 15px; height: 15px; border-radius: 50%; line-height: 15px; text-align: center; background: var(--panel-solid); border: 1px solid var(--panel-border); color: var(--muted); }
.tnode.ult { width: 46px; height: 46px; margin: -23px 0 0 -23px; padding: 9px; border-style: dashed; }
.tnode.ult i.star { color: #ffcf5a; }
.tnode.owned { background: var(--bc); border-color: #fff; color: #10151c; box-shadow: 0 0 12px var(--bc); }
.tnode.owned i { background: #fff; color: #10151c; }
.tnode.next { border-color: #ffcf5a; color: var(--text); animation: nodepulse 1.4s ease-in-out infinite; }
.tnode.next.poor { animation: none; border-color: var(--danger); }
.tnode.sel { transform: scale(1.18); outline: 2px solid var(--text); outline-offset: 2px; z-index: 2; }
@keyframes nodepulse { 50% { box-shadow: 0 0 14px rgba(255, 207, 90, 0.8); } }
.tlabel { position: absolute; left: 16%; font-size: 9.5px; font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase; color: var(--bc); white-space: nowrap; transform: translateY(-50%); }
.tlabel.l0 { top: calc(18% - 27px); } .tlabel.l1 { top: calc(50% - 27px); } .tlabel.l2 { top: calc(82% - 27px); }
.tcount { position: absolute; left: 5%; top: calc(50% + 24px); transform: translateX(-50%); font-size: 10px; font-weight: 900; color: var(--muted); }
.tinfo { display: flex; align-items: center; gap: 10px; margin-top: 16px; padding: 8px 10px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--bc); }
.tinfo-ico { width: 34px; height: 34px; flex: none; color: var(--bc); }
.tinfo-ico svg { width: 100%; height: 100%; }
.tinfo-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tinfo-txt b { font-size: 14px; }
.tinfo-txt span { font-size: 12px; color: var(--muted); line-height: 1.3; }
.tinfo-txt small { font-size: 10px; color: var(--bc); font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
.tstate { font-size: 11px; font-weight: 800; color: var(--muted); max-width: 120px; text-align: right; }
.tstate.ok { color: var(--good); }

/* ------------------------------------------------------------------ FPV */
#fpv-ui { position: fixed; inset: 0; z-index: 8; opacity: 0; pointer-events: none; transition: opacity 0.25s ease; }
body.fpv #fpv-ui, body.layout-edit #fpv-ui { opacity: 1; }
body.fpv #aim-zone, body.fpv #fire-btn, body.fpv #fpv-corner > * { pointer-events: auto; }
#aim-zone { position: absolute; left: 0; top: 0; bottom: 0; width: 50%; touch-action: none; }
body.lefty #aim-zone { left: 50%; }
body.mouse #aim-zone { display: none; }
#crosshair { --gap: 8px; position: absolute; left: 50%; top: 50%; width: 0; height: 0; }
#crosshair i { position: absolute; background: #fff; box-shadow: 0 0 3px rgba(0, 0, 0, 0.9); }
#crosshair i.t, #crosshair i.b { width: 2px; height: 10px; left: -1px; }
#crosshair i.l, #crosshair i.r { width: 10px; height: 2px; top: -1px; }
#crosshair i.t { top: calc(-10px - var(--gap)); } #crosshair i.b { top: var(--gap); }
#crosshair i.l { left: calc(-10px - var(--gap)); } #crosshair i.r { left: var(--gap); }
#crosshair em { position: absolute; left: -2px; top: -2px; width: 4px; height: 4px; border-radius: 50%; background: #ff5a3c; box-shadow: 0 0 4px #ff5a3c; }
#crosshair.hot i { background: #ff7a3c; }
#scope { position: absolute; inset: 0; display: none; pointer-events: none; background: radial-gradient(circle at center, transparent 0, transparent min(34vw, 34vh), rgba(0, 10, 20, 0.55) calc(min(34vw, 34vh) + 2px), rgba(0, 10, 20, 0.72) 100%); }
#scope::before, #scope::after { content: ""; position: absolute; background: rgba(120, 220, 255, 0.35); }
#scope::before { left: 50%; top: 20%; bottom: 20%; width: 1px; }
#scope::after { top: 50%; left: 20%; right: 20%; height: 1px; }
body.scope #scope { display: block; }
#scope .mil { position: absolute; left: 50%; top: 50%; width: 0; height: 0; }
body[data-weapon="sniper"] #scope .mil::before { content: ""; position: absolute; left: -1px; top: 10px; width: 2px; height: 90px; background: repeating-linear-gradient(180deg, rgba(143, 227, 255, 0.8) 0 2px, transparent 2px 18px); }
#hitmark {
  position: absolute; left: 50%; top: 50%; width: 34px; height: 34px; margin: -17px 0 0 -17px; opacity: 0;
  background: linear-gradient(45deg, transparent 46%, #fff 46%, #fff 54%, transparent 54%), linear-gradient(-45deg, transparent 46%, #fff 46%, #fff 54%, transparent 54%);
  -webkit-mask: radial-gradient(circle, transparent 7px, #000 8px); mask: radial-gradient(circle, transparent 7px, #000 8px);
}
#hitmark.show { animation: hit 0.18s ease-out; }
#hitmark.weak { background: linear-gradient(45deg, transparent 44%, #ffd23c 44%, #ffd23c 56%, transparent 56%), linear-gradient(-45deg, transparent 44%, #ffd23c 44%, #ffd23c 56%, transparent 56%); }
@keyframes hit { from { opacity: 1; transform: scale(1.25); } to { opacity: 0; transform: scale(0.9); } }
#heat { position: absolute; left: 50%; bottom: calc(12px + var(--sab)); transform: translateX(-50%); width: min(230px, 36vw); text-align: center; pointer-events: none; }
.heat-label { font-size: 10px; font-weight: 800; letter-spacing: 0.14em; color: rgba(255, 255, 255, 0.85); margin-bottom: 4px; white-space: nowrap; text-shadow: 0 1px 3px #000; }
.heat-bar { height: 8px; border-radius: 99px; background: rgba(0, 0, 0, 0.5); border: 1px solid rgba(255, 255, 255, 0.2); overflow: hidden; }
#heat-fill { height: 100%; width: 0; background: linear-gradient(90deg, #4fd3ff, #ffcf5a 60%, #ff3b3b); background-size: 230px 100%; }
#heat.over .heat-label { color: var(--danger); animation: blink 0.35s steps(2) infinite; }
#heat.over .heat-label::after { content: " — OVERHEATED"; }
@keyframes blink { 50% { opacity: 0.3; } }
#fpv-corner { position: absolute; top: calc(8px + var(--sat)); right: calc(8px + var(--sar)); display: flex; flex-direction: column; gap: 6px; }
#fire-btn {
  position: absolute; right: calc(24px + var(--sar)); bottom: calc(34px + var(--sab));
  width: calc(124px * var(--ui)); height: calc(124px * var(--ui)); border-radius: 50%;
  border: 3px solid rgba(255, 120, 120, 0.85); background: radial-gradient(circle at 50% 40%, rgba(255, 70, 70, 0.6), rgba(170, 0, 0, 0.5));
  color: #fff; font-weight: 900; font-size: calc(21px * var(--ui)); letter-spacing: 0.12em; text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
  box-shadow: 0 0 30px rgba(255, 40, 40, 0.35), inset 0 0 20px rgba(255, 255, 255, 0.15); touch-action: none; cursor: pointer;
  transition: transform 0.06s ease, background 0.1s ease;
}
body.lefty #fire-btn { right: auto; left: calc(24px + var(--sal)); }
body.lefty #abilities { left: auto; right: calc(8px + var(--sar)); top: auto; bottom: calc(160px * var(--ui) + var(--sab)); transform-origin: right bottom; }
#fire-btn.down { transform: scale(0.92); background: radial-gradient(circle at 50% 40%, rgba(255, 110, 80, 0.85), rgba(200, 20, 0, 0.75)); }
#fire-btn.cool { filter: grayscale(0.8) brightness(0.7); }
#lock-hint { display: none; position: absolute; left: 50%; top: 24%; transform: translateX(-50%); font-size: 12px; color: #fff; background: rgba(0, 0, 0, 0.55); padding: 6px 12px; border-radius: 99px; white-space: nowrap; }
body.mouse.fpv:not(.locked) #lock-hint { display: block; }
#markers { position: absolute; inset: 0; pointer-events: none; }
.marker { position: absolute; left: 0; top: 0; width: 44px; height: 44px; padding: 3px; border-radius: 12px; border: 2px solid rgba(62, 224, 122, 0.9); background: rgba(13, 17, 23, 0.72); display: none; cursor: pointer; pointer-events: auto; }
body.markers-on .marker { display: block; }
.marker svg { width: 100%; height: 100%; display: block; }
.marker i { position: absolute; right: -6px; bottom: -6px; min-width: 18px; height: 18px; border-radius: 9px; background: #ffd24a; color: #1b0d00; font-style: normal; font-size: 11px; font-weight: 900; line-height: 18px; text-align: center; }
.marker.pad { border-color: rgba(57, 213, 255, 0.85); border-radius: 50%; background: transparent; }
.marker.pad.poor { opacity: 0.45; }
.marker::after { content: ""; position: absolute; left: 50%; bottom: -9px; margin-left: -5px; border: 5px solid transparent; border-top-color: rgba(62, 224, 122, 0.9); }
.marker.pad::after { display: none; }
#combo { position: absolute; left: 50%; top: calc(64% - 10px); transform: translateX(-50%); font-size: 13px; font-weight: 900; letter-spacing: 0.12em; color: #fff; text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8); opacity: 0; transition: opacity 0.2s ease; text-align: center; pointer-events: none; white-space: nowrap; }
#combo b { font-size: 22px; color: #ffd24a; }
#combo small { display: block; font-size: 10px; letter-spacing: 0.08em; color: var(--accent-2); }
#combo.show { opacity: 1; }
#combo.pop { animation: combopop 0.18s ease-out; }
@keyframes combopop { from { transform: translateX(-50%) scale(1.25); } to { transform: translateX(-50%) scale(1); } }
#ramp, #rangefinder { position: absolute; left: 50%; top: calc(50% + 26px); transform: translateX(-50%); font-size: 12px; font-weight: 900; color: #ff9ac0; text-shadow: 0 1px 4px #000; display: none; pointer-events: none; }
#rangefinder { color: #8fe3ff; top: calc(50% + 30px); }
body[data-weapon="laser"] #ramp { display: block; }
body[data-weapon="sniper"] #rangefinder, body[data-weapon="mortar"] #rangefinder, body[data-weapon="rail"] #rangefinder { display: block; }

/* floaties, banner, tip, vignette, toast */
#floaties { position: fixed; inset: 0; pointer-events: none; z-index: 9; overflow: hidden; }
.floaty { position: absolute; font-weight: 900; font-size: 15px; color: var(--accent-2); text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8); transform: translate(-50%, -50%); animation: floaty 0.9s ease-out forwards; white-space: nowrap; }
.floaty.weak { color: #ffe14a; font-size: 13px; }
.floaty.dmg { color: #fff; font-size: 12px; opacity: 0.9; }
.floaty.big { font-size: 20px; color: #fff; letter-spacing: 0.08em; }
.floaty.miss { color: #ff7a7a; }
@keyframes floaty { from { opacity: 1; margin-top: 0; } to { opacity: 0; margin-top: -46px; } }
#banner { position: fixed; left: 50%; top: 30%; transform: translate(-50%, -50%) scale(0.9); z-index: 12; font-size: clamp(22px, 6vw, 44px); font-weight: 900; letter-spacing: 0.08em; text-align: center; color: #fff; text-shadow: 0 4px 18px rgba(0, 0, 0, 0.7), 0 0 30px rgba(255, 150, 40, 0.5); opacity: 0; pointer-events: none; transition: opacity 0.3s ease, transform 0.3s ease; white-space: nowrap; }
#banner small { display: block; font-size: 0.42em; letter-spacing: 0.2em; color: var(--accent-2); margin-top: 4px; }
#banner.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
#tip { position: fixed; left: 50%; top: calc(110px + var(--sat)); transform: translate(-50%, -20px); width: min(460px, calc(100vw - 150px)); display: flex; gap: 10px; align-items: center; background: var(--panel-solid); border: 1px solid rgba(255, 207, 90, 0.6); border-radius: 14px; padding: 8px 12px; z-index: 13; opacity: 0; pointer-events: none; transition: opacity 0.3s ease, transform 0.3s ease; box-shadow: var(--shadow); }
#tip.show { opacity: 1; transform: translate(-50%, 0); }
#tip .tip-ico { width: 56px; height: 56px; flex: none; }
#tip .tip-ico img { width: 100%; height: 100%; object-fit: contain; }
#tip b { display: block; font-size: 12px; letter-spacing: 0.1em; color: #e8a800; }
#tip span { font-size: 12.5px; color: var(--text); line-height: 1.35; }
#vignette { position: fixed; inset: 0; pointer-events: none; z-index: 7; box-shadow: inset 0 0 120px 30px rgba(255, 0, 0, 0.75); opacity: 0; transition: opacity 0.5s ease; }
#vignette.hit { opacity: 1; transition: none; }
#toast { position: fixed; left: 50%; bottom: calc(80px + var(--sab)); transform: translate(-50%, 20px); z-index: 60; background: var(--panel-solid); border: 1px solid var(--panel-border); color: var(--text); border-radius: 12px; padding: 10px 14px; font-weight: 700; font-size: 13px; opacity: 0; pointer-events: none; transition: opacity 0.25s ease, transform 0.25s ease; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: center; max-width: calc(100vw - 24px); box-shadow: var(--shadow); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ----------------------------------------------------------------- screens */
.screen { position: fixed; inset: 0; z-index: 30; display: none; }
.screen.show { display: flex; }
#result, #pause { align-items: center; justify-content: center; padding: 16px; background: radial-gradient(ellipse at center, rgba(10, 14, 20, 0.45), rgba(5, 7, 10, 0.88)); overflow-y: auto; touch-action: pan-y; color: #eef2f6; }
#result .panel { margin: auto; }
.panel { max-width: 520px; width: 100%; text-align: center; }
.kicker { font-size: 11px; letter-spacing: 0.26em; color: var(--accent); font-weight: 800; }
.screen h1 { margin: 4px 0 8px; font-size: clamp(30px, 9vw, 60px); font-weight: 900; letter-spacing: 0.05em; background: linear-gradient(180deg, #fff, #ffc27a); -webkit-background-clip: text; background-clip: text; color: transparent; }
.r-lines { margin: 6px auto 14px; max-width: 360px; text-align: left; }
.r-line { display: flex; justify-content: space-between; align-items: center; padding: 6px 2px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); font-size: 14px; gap: 8px; }
.r-line b { display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }
.r-line b svg { width: 16px; height: 16px; }
.r-line.hl { color: var(--accent-2); font-weight: 800; }
.r-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 8px; }
.r-actions.col { flex-direction: column; align-items: center; margin-top: 16px; }
.r-actions.col .btn { min-width: 220px; }
.chest-open { animation: nodepulse 1.2s ease-in-out infinite; }
.stars { display: flex; gap: 4px; justify-content: center; color: rgba(127, 127, 127, 0.4); font-size: 16px; }
.stars .on { color: #ffd24a; text-shadow: 0 0 8px rgba(255, 210, 74, 0.6); }
.stars.sm { font-size: 12px; }
.stars.sm svg { width: 12px; height: 12px; }
.stars.big { font-size: 44px; gap: 10px; }
.stars.big span { transform: scale(0.4); opacity: 0; animation: star 0.4s cubic-bezier(.2, 1.6, .4, 1) forwards; }
.stars.big span:nth-child(2) { animation-delay: 0.25s; } .stars.big span:nth-child(3) { animation-delay: 0.5s; }
@keyframes star { to { transform: scale(1); opacity: 1; } }

/* ------------------------------------------------------------------- menu */
#menu { flex-direction: column; background: linear-gradient(180deg, rgba(5, 8, 12, 0.6), rgba(5, 8, 12, 0.1) 30%, rgba(5, 8, 12, 0.55)); }
body[data-theme="light"] #menu { background: linear-gradient(180deg, rgba(240, 245, 250, 0.7), rgba(240, 245, 250, 0.15) 30%, rgba(240, 245, 250, 0.6)); }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: calc(8px + var(--sat)) calc(12px + var(--sar)) 6px calc(12px + var(--sal)); }
.profile { display: flex; align-items: center; gap: 8px; min-width: 0; }
.lvl-badge { width: 42px; height: 42px; border-radius: 12px; flex: none; background: linear-gradient(160deg, #ffb24d, #b8500a); color: #1b0d00; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; box-shadow: 0 4px 14px rgba(240, 123, 18, 0.35); }
.lvl-badge small { font-size: 9px; font-weight: 900; } .lvl-badge b { font-size: 18px; font-weight: 900; }
.profile-main { min-width: 90px; }
.pname { font-size: 13px; font-weight: 900; letter-spacing: 0.1em; white-space: nowrap; }
.xpbar { height: 6px; background: rgba(127, 127, 127, 0.3); border-radius: 99px; overflow: hidden; margin-top: 4px; }
#m-xp { height: 100%; width: 0; background: linear-gradient(90deg, #ffb24d, #ffe08a); transition: width 0.5s ease; }
.curs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.cur-pill { display: inline-flex; align-items: center; gap: 5px; background: var(--panel); border: 1px solid var(--panel-border); border-radius: 99px; padding: 4px 10px 4px 6px; font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; }
.cur-pill svg.cur { width: 18px; height: 18px; }
#m-settings { font-size: 20px; }
.m-content { flex: 1; overflow-y: auto; touch-action: pan-y; -webkit-overflow-scrolling: touch; padding: 6px calc(12px + var(--sar)) 12px calc(12px + var(--sal)); }
.bottomnav { display: flex; justify-content: center; gap: 4px; padding: 6px calc(8px + var(--sar)) calc(6px + var(--sab)) calc(8px + var(--sal)); background: var(--panel-solid); border-top: 1px solid var(--panel-border); }
.bottomnav button { position: relative; flex: 1; max-width: 130px; border: 0; background: transparent; color: var(--muted); font-weight: 900; font-size: 10.5px; letter-spacing: 0.08em; padding: 5px 2px; border-radius: 12px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.bottomnav .nav-ico { font-size: 20px; line-height: 1; filter: grayscale(0.4); }
.bottomnav button.active { color: var(--text); background: var(--panel-2); }
.bottomnav button.active .nav-ico { filter: none; transform: scale(1.12); }
.bottomnav button.center { background: linear-gradient(180deg, #ffb24d, #f07b12); color: #1b0d00; max-width: 150px; margin-top: -14px; box-shadow: 0 6px 18px rgba(240, 123, 18, 0.4); }
.bottomnav button.center .nav-ico { filter: none; }
.badge { position: absolute; top: 0; right: 16%; min-width: 17px; height: 17px; border-radius: 9px; background: var(--danger); color: #fff; font-style: normal; font-size: 10px; line-height: 17px; font-weight: 900; }
.menu-note { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 12px 0 0; }
h3 { font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin: 14px 0 8px; }
h3 small { text-transform: none; letter-spacing: 0; font-weight: 500; margin-left: 6px; }
.card-panel { background: var(--panel); border: 1px solid var(--panel-border); border-radius: 16px; padding: 10px 12px; margin-bottom: 10px; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.card-panel h3 { margin-top: 0; }
.card-panel.gift { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.card-panel.gift h3 { margin: 0 0 2px; color: var(--text); }
.card-panel.gift small { color: var(--muted); font-size: 12px; }
.bar { position: relative; height: 10px; background: rgba(127, 127, 127, 0.25); border-radius: 99px; overflow: hidden; }
.bar i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, #3ee07a, #b8f58a); border-radius: 99px; }
.bar span { position: absolute; inset: 0; font-size: 9px; font-weight: 900; text-align: center; line-height: 10px; color: #fff; text-shadow: 0 1px 2px #000; }
.bar.big { height: 16px; margin: 8px 0 4px; }
.bar.big span { line-height: 16px; font-size: 10.5px; }
.ok { color: var(--good); font-weight: 900; font-size: 18px; }

/* battle tab */
.battle-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 14px; max-width: 1100px; margin: 0 auto; }
.hero { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.hero-kicker { font-size: 11px; font-weight: 900; letter-spacing: 0.2em; color: var(--accent); text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5); }
.hero-title { margin: 0; font-size: clamp(30px, 6vw, 54px); font-weight: 900; letter-spacing: 0.03em; color: #fff; text-shadow: 0 4px 22px rgba(0, 0, 0, 0.7); }
body[data-theme="light"] .hero-title { color: #16202c; text-shadow: 0 2px 12px rgba(255, 255, 255, 0.8); }
.hero-sub { color: var(--text); font-size: 14px; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.4); }
.hero .stars { justify-content: flex-start; font-size: 22px; }
.hero-actions { display: flex; gap: 10px; margin: 6px 0 10px; flex-wrap: wrap; }
.map-row { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 8px; touch-action: pan-x; scroll-snap-type: x mandatory; }
.map-chip { flex: 0 0 132px; scroll-snap-align: center; border-radius: 12px; border: 1px solid var(--panel-border); background: var(--panel-solid); padding: 0 0 6px; overflow: hidden; cursor: pointer; color: var(--text); }
.map-chip.sel { border-color: var(--accent-2); box-shadow: 0 0 0 2px var(--accent-2); }
.map-chip.locked { opacity: 0.45; }
.mc-art { height: 52px; }
.mc-art svg { width: 100%; height: 100%; display: block; }
.mc-name { font-size: 11.5px; font-weight: 800; padding: 4px 6px 1px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-chip .stars { justify-content: flex-start; padding: 0 6px; }
.side { min-width: 0; }
.quest { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px solid var(--panel-border); }
.quest:first-of-type { border-top: 0; }
.q-main { flex: 1; min-width: 0; }
.q-text { font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.quest small { display: inline-flex; align-items: center; gap: 3px; color: var(--muted); font-size: 11px; margin-top: 3px; }
.quest small svg { width: 12px; height: 12px; }
.quest.done { opacity: 0.55; }
.chest-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chest-btn { width: 70px; border: 1px solid var(--panel-border); background: var(--panel-2); border-radius: 12px; padding: 6px; cursor: pointer; color: var(--text); animation: nodepulse 1.6s ease-in-out infinite; }
.chest-btn svg { width: 100%; }
.chest-btn small { font-weight: 900; font-size: 10px; }

/* armory */
.subtabs { display: flex; gap: 6px; margin: 2px 0 10px; overflow-x: auto; touch-action: pan-x; }
.subtabs button { border: 1px solid var(--panel-border); background: var(--panel); color: var(--muted); border-radius: 99px; padding: 7px 14px; font-weight: 900; font-size: 11.5px; letter-spacing: 0.08em; cursor: pointer; white-space: nowrap; }
.subtabs button.active { background: var(--text); color: var(--panel-solid); }
.tcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.tcard { position: relative; border-radius: 14px; border: 1px solid var(--panel-border); background: linear-gradient(180deg, color-mix(in srgb, var(--tc) 22%, var(--panel-solid)), var(--panel-solid)); padding: 6px 8px 8px; cursor: pointer; color: var(--text); text-align: center; }
.tcard.can { border-color: var(--good); box-shadow: 0 0 0 1px var(--good) inset, 0 0 14px rgba(62, 224, 122, 0.35); }
.tcard.can::after { content: "LEVEL UP!"; position: absolute; top: 6px; left: 6px; font-size: 9px; font-weight: 900; color: #10151c; background: var(--good); border-radius: 6px; padding: 2px 5px; }
.tcard.locked .tc-pic { filter: grayscale(1) brightness(0.5); }
.tc-pic { height: 92px; display: flex; align-items: center; justify-content: center; }
.tc-pic img { height: 100%; }
.tc-name { font-weight: 900; font-size: 12.5px; }
.tc-lvl { font-size: 10px; font-weight: 900; color: #e8a800; margin: 2px 0 4px; }
.tc-lock { font-size: 10px; color: var(--muted); display: inline-flex; align-items: center; gap: 3px; margin-top: 4px; }
.tc-lock svg { width: 12px; height: 12px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.card { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border-radius: 14px; background: var(--panel-solid); border: 1px solid var(--panel-border); }
.card-row { display: flex; gap: 10px; align-items: center; }
.card .c-main { flex: 1; min-width: 0; }
.card .c-name { font-weight: 800; font-size: 14.5px; }
.card .c-desc { color: var(--muted); font-size: 12px; margin-top: 2px; line-height: 1.35; }
.card .c-stat { font-size: 11px; color: var(--muted); margin-top: 4px; }
.count { color: #e8a800; font-weight: 900; }
.ab-ico { width: 48px; height: 48px; flex: none; }
.ab-ico svg { width: 100%; height: 100%; }
.pips { display: flex; gap: 3px; margin-top: 5px; }
.pips i { width: 16px; height: 5px; border-radius: 3px; background: rgba(127, 127, 127, 0.3); }
.pips i.on { background: linear-gradient(90deg, #7ff0ff, #3a8dff); }
.lock-note { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: #e8a800; font-weight: 700; }
.lock-note svg { width: 13px; height: 13px; }
.codex { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.ecard { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 14px; background: var(--panel-solid); border: 1px solid var(--panel-border); }
.ec-pic { width: 84px; height: 84px; flex: none; border-radius: 12px; background: radial-gradient(circle at 50% 60%, rgba(127, 127, 127, 0.2), transparent 70%); }
.ec-pic img { width: 100%; height: 100%; object-fit: contain; }
.ec-main b { font-size: 15px; }
.ec-main small { display: block; color: var(--muted); font-size: 11.5px; line-height: 1.35; margin-top: 3px; }
.ec-stats { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.ec-stats span { font-size: 10px; font-weight: 800; padding: 1px 6px; border-radius: 6px; background: var(--panel-2); border: 1px solid var(--panel-border); display: inline-flex; align-items: center; gap: 2px; }
.ec-stats svg { width: 11px; height: 11px; }
.mini-tree { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mt-branch { display: flex; flex-direction: column; gap: 4px; }
.mt-branch b { color: var(--bc); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; border-bottom: 2px solid var(--bc); padding-bottom: 2px; }
.mt-branch span { font-size: 11.5px; font-weight: 700; }
.mt-branch span.ult { color: #e8a800; }
.mt-branch em { display: block; font-style: normal; font-weight: 400; font-size: 10.5px; color: var(--muted); }

/* shop */
.shop { max-width: 1000px; margin: 0 auto; }
.deals { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.deal { border-radius: 14px; background: var(--panel-solid); border: 1px solid var(--panel-border); padding: 8px; display: flex; flex-direction: column; align-items: center; gap: 5px; text-align: center; }
.deal b { font-size: 12.5px; }
.deal small { color: var(--muted); font-size: 10.5px; }
.deal .btn { width: 100%; }
.deal.done { opacity: 0.55; }
.deal-art { min-height: 54px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; justify-content: center; }
.deal-art.big { height: 70px; }
.deal-art.big svg, .deal-art.big img { height: 100%; width: auto; max-width: 100%; }
.skin-deal { border-color: var(--rc); }
.rar { color: var(--rc) !important; font-weight: 900; letter-spacing: 0.1em; }
.rchip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 7px; border-radius: 9px; background: var(--panel-2); border: 1px solid var(--panel-border); font-size: 12px; font-weight: 800; white-space: nowrap; }
.rchip svg { width: 20px; height: 20px; }
.rchip.chest svg { width: 28px; height: 24px; }
.rchip.chest b { font-size: 11px; }
.rchip.skin { border-color: var(--rc); }
.rchip.skin i { width: 14px; height: 14px; border-radius: 4px; border: 1px solid var(--rc); }

/* pass */
.pass { max-width: 760px; margin: 0 auto; }
.pass-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: linear-gradient(135deg, rgba(180, 107, 255, 0.35), rgba(79, 195, 255, 0.25)); border: 1px solid var(--panel-border); border-radius: 16px; padding: 12px 14px; }
.pass-head > div { flex: 1; min-width: 220px; }
.pass-head h2 { margin: 2px 0 0; font-size: 22px; }
.pass-head small { color: var(--muted); font-size: 11.5px; }
.prem-on { font-weight: 900; color: #e8a800; }
.pass-cols { display: grid; grid-template-columns: 1fr 44px 1fr; text-align: center; font-size: 11px; font-weight: 900; letter-spacing: 0.12em; color: var(--muted); margin: 10px 0 4px; }
.pass-list { display: flex; flex-direction: column; gap: 6px; }
.ptier { display: grid; grid-template-columns: 1fr 44px 1fr; gap: 6px; align-items: stretch; }
.pcell { background: var(--panel-solid); border: 1px solid var(--panel-border); border-radius: 12px; padding: 6px 8px; display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; min-height: 44px; }
.pcell svg { width: 18px; height: 18px; }
.pcell.prem { background: linear-gradient(135deg, rgba(255, 207, 90, 0.16), var(--panel-solid)); }
.pcell.lockedp { opacity: 0.6; }
.pnum { display: flex; align-items: center; justify-content: center; font-weight: 900; border-radius: 50%; background: var(--panel); border: 2px solid var(--panel-border); }
.ptier.reached .pnum { background: linear-gradient(160deg, #ffb24d, #f07b12); color: #1b0d00; border-color: transparent; }
.ptier.current .pnum { box-shadow: 0 0 0 3px var(--accent-2); }

/* road */
.road { max-width: 560px; margin: 0 auto; }
.road-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 14px; border-radius: 16px; background: linear-gradient(135deg, rgba(255, 207, 90, 0.3), rgba(240, 123, 18, 0.15)); border: 1px solid var(--panel-border); }
.road-head svg { width: 30px; height: 30px; }
.road-head b { font-size: 26px; }
.road-head small { width: 100%; color: var(--muted); font-size: 11.5px; }
.road-list { display: flex; flex-direction: column; margin-top: 8px; }
.rstep { position: relative; display: flex; align-items: center; gap: 10px; padding: 6px 4px 6px 0; min-height: 56px; }
.rline { position: absolute; left: 26px; top: 0; bottom: 0; width: 4px; background: rgba(127, 127, 127, 0.3); }
.rstep.reached .rline { background: linear-gradient(#ffcf5a, #f07b12); }
.rdot { position: relative; z-index: 1; width: 56px; flex: none; display: flex; flex-direction: column; align-items: center; background: var(--panel-solid); border: 2px solid var(--panel-border); border-radius: 12px; padding: 3px 0; }
.rdot svg { width: 18px; height: 18px; }
.rdot small { font-size: 11px; font-weight: 900; }
.rstep.reached .rdot { border-color: #ffcf5a; }
.rstep.next .rdot { box-shadow: 0 0 0 3px var(--accent-2); }
.rreward { flex: 1; display: flex; flex-wrap: wrap; gap: 4px; }
.rneed { color: var(--muted); font-size: 11px; white-space: nowrap; }

/* overlay */
.ov { position: fixed; inset: 0; z-index: 40; display: none; align-items: center; justify-content: center; padding: calc(10px + var(--sat)) calc(10px + var(--sar)) calc(10px + var(--sab)) calc(10px + var(--sal)); }
.ov.show { display: flex; }
#overlay-close-layer { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.55); }
#overlay-body { position: relative; width: min(520px, 100%); max-height: 100%; overflow-y: auto; touch-action: pan-y; background: var(--panel-solid); color: var(--text); border: 1px solid var(--panel-border); border-radius: 18px; padding: 14px 16px 16px; box-shadow: var(--shadow); }
.ov.wide #overlay-body { width: min(760px, 100%); }
.ov-x { position: absolute; right: 8px; top: 8px; z-index: 2; }
.detail { display: flex; gap: 14px; align-items: center; }
.d-pic { width: 150px; height: 150px; flex: none; border-radius: 16px; background: radial-gradient(circle at 50% 60%, color-mix(in srgb, var(--tc) 45%, transparent), transparent 70%); }
.d-pic img { width: 100%; height: 100%; object-fit: contain; }
.d-main h2 { margin: 2px 0 4px; }
.d-main p { color: var(--muted); font-size: 13px; margin: 0 0 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; align-items: center; }
.chips span { font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--panel-border); }
.skins { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; }
.skin { border-radius: 12px; border: 2px solid var(--rc); background: var(--panel-2); padding: 4px; cursor: pointer; color: var(--text); display: flex; flex-direction: column; align-items: center; }
.skin.sel { box-shadow: 0 0 0 2px var(--accent-2); }
.skin.locked .sk-pic { filter: saturate(0.4) brightness(0.8); }
.sk-pic { height: 70px; } .sk-pic img { height: 100%; }
.skin b { font-size: 11px; } .skin small { font-size: 10px; color: var(--muted); display: inline-flex; align-items: center; gap: 2px; }
.skin small svg { width: 12px; height: 12px; }
.brief-art { position: relative; height: 130px; border-radius: 14px; overflow: hidden; margin: 0 -2px 8px; }
.brief-art svg { width: 100%; height: 100%; display: block; }
.brief-title { position: absolute; left: 0; right: 0; bottom: 0; padding: 20px 12px 8px; background: linear-gradient(transparent, rgba(0, 0, 0, 0.75)); color: #fff; }
.brief-title h2 { margin: 0; font-size: 24px; }
.brief p { color: var(--muted); margin: 0 0 6px; font-size: 13px; }
.brief-enemies { display: flex; gap: 6px; overflow-x: auto; touch-action: pan-x; padding-bottom: 4px; }
.be { flex: 0 0 82px; text-align: center; background: var(--panel-2); border: 1px solid var(--panel-border); border-radius: 12px; padding: 4px; }
.be-pic { height: 64px; } .be-pic img { height: 100%; }
.be b { display: block; font-size: 11px; } .be small { font-size: 9.5px; color: var(--muted); }
.brief-rewards { display: flex; gap: 6px; flex-wrap: wrap; }
.brief-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }
.settings h2 { margin: 0 0 10px; }
.set-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 9px 0; border-top: 1px solid var(--panel-border); }
.set-row > span { flex: 0 0 130px; font-weight: 800; font-size: 13px; }
.set-row small { width: 100%; color: var(--muted); font-size: 11px; padding-left: 140px; margin-top: -4px; }
.set-row input[type=range] { flex: 1; min-width: 120px; accent-color: #f07b12; touch-action: pan-x; }
.set-row.danger .btn { color: var(--danger); }
.seg { display: inline-flex; border: 1px solid var(--panel-border); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: transparent; color: var(--muted); padding: 7px 13px; font-weight: 900; font-size: 12px; cursor: pointer; }
.seg button.on { background: linear-gradient(180deg, #ffb24d, #f07b12); color: #1b0d00; }

/* chest overlay */
.ov.chest { background: radial-gradient(circle at 50% 40%, rgba(60, 40, 10, 0.9), rgba(0, 0, 0, 0.95)); z-index: 50; }
.chest-stage { text-align: center; color: #fff; width: min(620px, 100%); max-height: 100%; overflow-y: auto; }
.chest-big { width: 150px; margin: 10px auto; cursor: pointer; animation: shake 0.6s ease-in-out infinite; filter: drop-shadow(0 0 30px rgba(255, 200, 80, 0.6)); }
.chest-big.open { animation: pop 0.5s ease-out forwards; }
.chest-big.open .chest-lid { transform: translate(0, -14px) rotate(-12deg); transform-origin: 10px 24px; transition: transform 0.3s ease; }
@keyframes shake { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-5deg) scale(1.03); } 75% { transform: rotate(5deg) scale(1.03); } }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.25); } 100% { transform: scale(0.8); } }
.chest-hint { font-weight: 900; letter-spacing: 0.2em; font-size: 12px; animation: blink 1s steps(2) infinite; }
.chest-items { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 10px 0 14px; }
.citem { width: 96px; padding: 8px 4px; border-radius: 14px; background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.2); display: flex; flex-direction: column; align-items: center; gap: 2px; animation: flyin 0.35s cubic-bezier(.2, 1.4, .4, 1); }
.citem svg, .citem img { width: 54px; height: 54px; object-fit: contain; }
.citem b { font-size: 16px; } .citem small { font-size: 10px; color: #c9d3dd; }
.citem.card { background: linear-gradient(180deg, color-mix(in srgb, var(--tc) 40%, transparent), rgba(255, 255, 255, 0.05)); }
.citem.new { box-shadow: 0 0 0 2px #ffcf5a, 0 0 20px rgba(255, 207, 90, 0.7); }
.citem.new small { color: #ffcf5a; font-weight: 900; }
.citem.skin { border: 2px solid var(--rc); }
@keyframes flyin { from { transform: translateY(40px) scale(0.5); opacity: 0; } to { transform: none; opacity: 1; } }

/* layout editor */
#layout-bar { display: none; position: fixed; left: 50%; top: 45%; transform: translate(-50%, -50%); z-index: 70; background: var(--panel-solid); color: var(--text); border: 1px solid var(--panel-border); border-radius: 14px; padding: 10px 12px; gap: 8px; align-items: center; box-shadow: var(--shadow); flex-wrap: wrap; justify-content: center; max-width: calc(100vw - 260px); }
#layout-bar span { font-size: 13px; font-weight: 700; }
body.layout-edit #layout-bar { display: flex; }
body.layout-edit #fire-btn, body.layout-edit #fpv-corner, body.layout-edit #abilities, body.layout-edit #heat, body.layout-edit #hud-left {
  pointer-events: auto !important; outline: 2px dashed #ffcf5a; outline-offset: 4px; cursor: grab; touch-action: none;
}
body.layout-edit #fpv-corner > * { pointer-events: none; }
body.layout-edit #hud-pills, body.layout-edit #crosshair { visibility: hidden; }

/* -------------------------------------------------- phones in landscape */
@media (max-height: 500px) and (orientation: landscape) {
  .pill { font-size: 12.5px; padding: 3px 9px; gap: 4px; }
  .pill.hp .bar { width: 50px; }
  #hud-pills { margin: 0 calc(90px * var(--ui)); }
  #hint { display: none; }
  #start-wave { font-size: 14px; padding: 10px 20px; }
  #abilities { top: calc(52px + var(--sat)); gap: 5px; }
  .ability { width: 46px; height: 46px; }
  .ability svg { width: 24px; height: 24px; }
  .icon-btn { width: calc(44px * var(--ui)); height: calc(44px * var(--ui)); border-radius: 12px; }
  .icon-btn.sm { width: calc(36px * var(--ui)); height: calc(36px * var(--ui)); }
  #fpv-corner { gap: 5px; }
  #fire-btn { width: calc(104px * var(--ui)); height: calc(104px * var(--ui)); bottom: calc(18px + var(--sab)); font-size: calc(18px * var(--ui)); }
  #coach { top: calc(46px + var(--sat)); font-size: 12px; padding: 6px 10px; }
  #tip { top: calc(46px + var(--sat)); }
  .sheet { bottom: calc(6px + var(--sab)); padding: 8px 12px 10px; }
  .opts { grid-template-columns: repeat(10, 1fr); margin: 6px 0 4px; }
  .opt .t-icon { width: 38px; height: 38px; }
  .opt .o-name { font-size: 9px; }
  .tree-sheet.open { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 10px; width: min(820px, calc(100vw - 16px)); align-items: start; }
  .tree-sheet .tgraph { height: 205px; margin-top: 24px; }
  .tree-sheet .tinfo { margin-top: 10px; }
  .topbar { padding-top: calc(4px + var(--sat)); }
  .lvl-badge { width: 34px; height: 34px; }
  .bottomnav { padding-top: 3px; }
  .bottomnav .nav-ico { font-size: 16px; }
  .bottomnav button { font-size: 9.5px; flex-direction: row; justify-content: center; gap: 5px; padding: 6px 4px; }
  .bottomnav button.center { margin-top: 0; }
  .hero-title { font-size: 30px; }
  .hero-actions .btn.big { font-size: 15px; padding: 10px 22px; }
  .map-chip { flex-basis: 112px; }
  .mc-art { height: 40px; }
  .screen h1 { font-size: 30px; margin: 2px 0 4px; }
  .stars.big { font-size: 30px; }
  .r-line { padding: 3px 2px; font-size: 12.5px; }
  #result .panel { max-width: 720px; }
  .r-lines { display: grid; grid-template-columns: 1fr 1fr; column-gap: 18px; max-width: 700px; }
  .brief-art { height: 90px; }
  .d-pic { width: 110px; height: 110px; }
}
@media (orientation: portrait) {
  #fire-btn { width: calc(106px * var(--ui)); height: calc(106px * var(--ui)); right: calc(16px + var(--sar)); bottom: calc(62px + var(--sab)); font-size: calc(18px * var(--ui)); }
  body.lefty #fire-btn { left: calc(16px + var(--sal)); }
  #heat { width: 44vw; }
  .pill { font-size: 13.5px; padding: 5px 9px; }
  .pill.hp .bar { width: 44px; }
  #hud-pills { margin: 0 calc(50px * var(--ui)) 0 calc(92px * var(--ui)); }
  #abilities { top: auto; bottom: calc(190px + var(--sab)); transform-origin: left bottom; }
  .ability { width: 48px; height: 48px; }
  #coach, #tip { width: auto; left: 12px; right: calc(70px * var(--ui) + 12px); transform: translateY(-12px); top: calc(96px + var(--sat)); }
  #coach.show, #tip.show { transform: none; }
  .battle-grid { grid-template-columns: 1fr; }
  .hero { padding-top: 22vh; }
  .curs { gap: 4px; }
  .cur-pill { font-size: 12px; padding: 3px 8px 3px 4px; }
  .cur-pill.tp { display: none; }
  .pname { display: none; }
  .profile-main { min-width: 60px; }
  .opts { grid-template-columns: repeat(5, 1fr); }
  .detail { flex-direction: column; text-align: center; }
  .detail .chips { justify-content: center; }
  .set-row > span { flex-basis: 100%; }
  .set-row small { padding-left: 0; }
  #layout-bar { max-width: calc(100vw - 24px); top: 40%; }
}

/* ======================================================================= v5 */
/* loading screen */
#loader { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; background: #070a0f; overflow: hidden; transition: opacity 0.6s ease; }
#loader.done { opacity: 0; pointer-events: none; }
.ld-sky { position: absolute; inset: -20%; background: radial-gradient(ellipse at 50% 110%, rgba(255, 122, 26, 0.35), transparent 55%), radial-gradient(ellipse at 20% 0%, rgba(80, 140, 255, 0.25), transparent 50%); animation: ldsky 6s ease-in-out infinite alternate; }
.ld-grid { position: absolute; left: -50%; right: -50%; bottom: -10%; height: 60%; background-image: linear-gradient(rgba(255, 170, 60, 0.25) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 170, 60, 0.25) 1px, transparent 1px); background-size: 48px 48px; transform: perspective(300px) rotateX(60deg); transform-origin: 50% 100%; animation: ldgrid 1.2s linear infinite; mask-image: linear-gradient(transparent, #000 70%); -webkit-mask-image: linear-gradient(transparent, #000 70%); }
@keyframes ldgrid { to { background-position: 0 48px; } }
@keyframes ldsky { to { transform: scale(1.1) rotate(2deg); } }
.ld-center { position: relative; text-align: center; color: #fff; width: min(360px, 80vw); }
.ld-logo { width: min(110px, 22vh); height: auto; filter: drop-shadow(0 0 24px rgba(255, 140, 40, 0.6)); animation: ldlogo 2.4s ease-in-out infinite; }
@keyframes ldlogo { 50% { transform: translateY(-6px) rotate(-3deg); } }
.ld-title { margin: 8px 0 0; font-size: clamp(30px, 9vw, 52px); font-weight: 900; letter-spacing: 0.08em; line-height: 1; background: linear-gradient(180deg, #fff, #ffc27a 60%, #ff7a1a); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ld-title span { margin-left: 0.25em; }
.ld-sub { font-size: 11px; font-weight: 900; letter-spacing: 0.4em; color: #ffb24d; margin: 6px 0 18px; }
.ld-bar { height: 10px; border-radius: 99px; background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.2); overflow: hidden; }
#ld-fill { height: 100%; width: 8%; border-radius: 99px; background: linear-gradient(90deg, #ffe27a, #ff7a1a); box-shadow: 0 0 14px rgba(255, 140, 40, 0.8); transition: width 0.35s ease; animation: ldfill 4s cubic-bezier(.1, .7, .3, 1) forwards; }
@keyframes ldfill { to { width: 62%; } }
.ld-tip { margin-top: 10px; font-size: 12px; color: #c9d2da; letter-spacing: 0.06em; }

/* button size setting reaches every button */
.btn, .bottomnav, #fpv-powers, .ability, .loadout, .cslot { zoom: var(--ui); }
#abilities { scale: none; }
#start-wave { scale: none; }
.size-preview { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.size-preview .icon-btn, .size-preview .ability { pointer-events: none; }
.size-preview .fire-prev { width: calc(64px * var(--ui)); height: calc(64px * var(--ui)); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: calc(12px * var(--ui)); color: #fff; border: 2px solid rgba(255, 120, 120, 0.85); background: radial-gradient(circle at 50% 40%, rgba(255, 70, 70, 0.7), rgba(170, 0, 0, 0.6)); }

/* scrolling: horizontal strips must still allow vertical page scroll (landscape fix) */
.map-row, .subtabs, .brief-enemies, .track, .dtabs { touch-action: pan-x pan-y; overscroll-behavior-x: contain; }
.m-content, #overlay-body, .chest-stage { touch-action: pan-y pan-x; overscroll-behavior: contain; min-height: 0; }

/* bottom navigation icons */
.bottomnav .nav-ico { width: 30px; height: 30px; display: block; font-size: 0; filter: grayscale(0.7) brightness(0.85); transition: transform 0.15s ease, filter 0.15s ease; }
.bottomnav .nav-ico svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.45)); }
.bottomnav button.active .nav-ico { filter: none; transform: scale(1.18) translateY(-2px); }
.bottomnav button.center .nav-ico { width: 36px; height: 36px; filter: none; }
.bottomnav button.active::after { content: ""; position: absolute; left: 30%; right: 30%; bottom: 1px; height: 3px; border-radius: 3px; background: var(--accent); }
.bottomnav button.center.active::after { display: none; }
#m-settings svg { width: 62%; height: 62%; }

/* battle tab: loadout + chest slots */
.play-btn svg { width: 22px; height: 22px; }
.loadout { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 14px; border: 1px solid var(--panel-border); background: var(--panel); cursor: pointer; color: var(--text); margin-bottom: 6px; align-self: flex-start; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.lo-slot { position: relative; width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--ac); background: rgba(13, 17, 23, 0.8); display: flex; align-items: center; justify-content: center; }
.lo-slot svg { width: 24px; height: 24px; }
.lo-slot em { position: absolute; right: -5px; top: -5px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--ac); color: #10151c; font-style: normal; font-size: 9.5px; font-weight: 900; line-height: 16px; text-align: center; }
.lo-edit { display: flex; flex-direction: column; font-size: 10px; font-weight: 900; letter-spacing: 0.1em; padding-left: 4px; text-align: left; }
.lo-edit small { font-weight: 600; letter-spacing: 0; color: var(--muted); }
.cslots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.cslot { position: relative; min-width: 0; border-radius: 14px; border: 2px solid var(--panel-border); background: var(--panel-2); padding: 6px 4px; display: flex; flex-direction: column; align-items: center; gap: 1px; color: var(--text); cursor: pointer; font-size: 10px; }
.cslot .cs-art { height: 40px; width: 100%; display: flex; align-items: center; justify-content: center; }
.cslot .cs-art svg { height: 100%; width: auto; }
.cslot b { font-size: 10px; white-space: nowrap; }
.cslot em { font-style: normal; font-size: 8.5px; font-weight: 900; color: var(--accent); letter-spacing: 0.05em; }
.cslot.empty { border-style: dashed; opacity: 0.55; cursor: default; }
.cslot.empty small { font-weight: 900; font-size: 9px; }
.cslot.empty em { color: var(--muted); font-weight: 600; }
.cslot.locked { border-color: color-mix(in srgb, var(--cc) 60%, transparent); }
.cs-dur, .cs-time { font-weight: 900; font-variant-numeric: tabular-nums; }
.cslot.unlocking { border-color: var(--cc); background: linear-gradient(180deg, color-mix(in srgb, var(--cc) 20%, transparent), var(--panel-2)); }
.cslot.unlocking .cs-art { animation: shake 2s ease-in-out infinite; }
.cs-gems { display: inline-flex; align-items: center; gap: 2px; font-weight: 900; color: #5fe3ff; }
.cs-gems svg { width: 12px; height: 12px; }
.cslot.ready { border-color: var(--good); box-shadow: 0 0 16px rgba(62, 224, 122, 0.5); animation: nodepulse 1.4s ease-in-out infinite; }
.cs-open { font-weight: 900; color: var(--good); letter-spacing: 0.08em; }
.slots-panel .chest-row { margin-top: 8px; }
.confirm { text-align: center; }
.cf-art svg { width: 110px; height: auto; }
.confirm .brief-actions { justify-content: center; }

/* loadout picker */
.lo-pick h2 { margin: 0 0 4px; }
.lo-slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 10px 0; }
.lo-big { position: relative; border-radius: 14px; border: 2px solid var(--ac); background: var(--panel-2); padding: 6px 4px 8px; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--text); cursor: pointer; min-width: 0; }
.lo-big svg { width: 38px; height: 38px; }
.lo-big small { font-size: 9px; font-weight: 900; color: var(--muted); letter-spacing: 0.08em; }
.lo-big b { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.lo-big em { font-style: normal; font-size: 11px; font-weight: 900; color: #e8a800; }
.lo-big.sel { box-shadow: 0 0 0 3px var(--accent-2), 0 0 18px color-mix(in srgb, var(--ac) 60%, transparent); transform: translateY(-2px); }
.lo-all { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; }
.lo-ab { display: flex; gap: 8px; align-items: center; text-align: left; border-radius: 12px; border: 1px solid var(--panel-border); background: var(--panel-solid); color: var(--text); padding: 6px 8px; cursor: pointer; }
.lo-ab .ab-ico { width: 40px; height: 40px; }
.lo-ab b { font-size: 13px; } .lo-ab small { display: block; color: var(--muted); font-size: 11px; line-height: 1.3; }
.lo-ab.in { border-color: var(--ac); background: linear-gradient(90deg, color-mix(in srgb, var(--ac) 18%, transparent), var(--panel-solid)); }
.lo-ab.none { opacity: 0.55; }

/* turret detail */
.lvbar { margin: 4px 0 8px; max-width: 280px; }
.dtabs { display: flex; gap: 4px; margin: 12px 0 8px; border-bottom: 2px solid var(--panel-border); overflow-x: auto; }
.dtabs button { flex: 1; border: 0; background: none; color: var(--muted); font-weight: 900; font-size: 11.5px; letter-spacing: 0.08em; padding: 8px 6px; cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.dtabs button.active { color: var(--text); border-bottom-color: var(--accent); }
.how { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.how-card { background: var(--panel-2); border: 1px solid var(--panel-border); border-radius: 12px; padding: 8px 10px; }
.how-card h4 { margin: 0 0 4px; font-size: 10px; letter-spacing: 0.16em; color: var(--accent); }
.how-card p { margin: 0 0 6px; font-size: 12.5px; line-height: 1.4; }
.chips .pos { color: var(--good); } .chips .neg { color: var(--danger); }
.stat-table { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 12.5px; }
.stat-table th { font-size: 10px; letter-spacing: 0.14em; color: var(--muted); text-align: left; padding: 4px 6px; }
.stat-table td { padding: 5px 6px; border-top: 1px solid var(--panel-border); font-variant-numeric: tabular-nums; }
.stat-table td:first-child { color: var(--muted); }
.stat-table td + td { font-weight: 800; }
.controls { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.controls div { background: var(--panel-2); border-radius: 10px; padding: 6px 8px; display: flex; flex-direction: column; }
.controls b { font-size: 12px; } .controls span { font-size: 10.5px; color: var(--muted); line-height: 1.3; }
.pcard { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 12px; border: 1px solid var(--panel-border); background: var(--panel-solid); margin-bottom: 6px; }
.pcard .pc-ico { width: 40px; height: 40px; flex: none; }
.pcard .pc-ico svg { width: 100%; height: 100%; }
.pcard b { font-size: 13.5px; } .pcard small { display: block; color: var(--muted); font-size: 11.5px; line-height: 1.3; }
.pcard.on { border-color: var(--accent-2); background: linear-gradient(90deg, rgba(255, 207, 90, 0.13), var(--panel-solid)); }
.pcard.nb .pc-ico { filter: saturate(0.4); opacity: 0.8; }
.pcard.hyper.on { border-color: #ff8a1a; box-shadow: 0 0 14px rgba(255, 138, 26, 0.3); }
.eq { font-size: 10.5px; font-weight: 900; letter-spacing: 0.08em; color: var(--good); white-space: nowrap; }
.gslot { border: 1px solid var(--panel-border); border-radius: 12px; padding: 7px 9px; margin-bottom: 6px; background: var(--panel-solid); }
.gslot.locked { opacity: 0.7; }
.gs-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; }
.gs-head small { display: inline-flex; align-items: center; gap: 3px; color: var(--muted); font-size: 11px; }
.gs-head small svg { width: 12px; height: 12px; }
.gears { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin-top: 6px; }
.gear { border: 1px solid var(--panel-border); background: var(--panel-2); border-radius: 10px; padding: 5px 3px; display: flex; flex-direction: column; align-items: center; color: var(--text); cursor: pointer; min-width: 0; }
.gear svg { width: 28px; height: 28px; }
.gear b { font-size: 10.5px; } .gear small { font-size: 9px; color: var(--muted); text-align: center; line-height: 1.2; }
.gear.on { border-color: var(--pc); box-shadow: 0 0 0 1px var(--pc) inset; opacity: 1 !important; filter: none !important; }
.gear:disabled { opacity: 0.45; cursor: default; }
.pdots { display: inline-flex; gap: 2px; margin-left: 4px; vertical-align: 1px; }
.pd { width: 7px; height: 7px; border-radius: 2px; display: inline-block; }
.pd.g { background: #ff9a3a; } .pd.s { background: #ffd24a; border-radius: 50%; } .pd.e { background: #9aa6b2; } .pd.h { background: #7ff6ff; box-shadow: 0 0 4px #7ff6ff; }
.mt-branch span i { font-style: normal; display: inline-block; width: 15px; height: 15px; border-radius: 50%; background: var(--bc); color: #10151c; font-size: 9px; font-weight: 900; text-align: center; line-height: 15px; margin-right: 4px; }
.skins { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.skin { position: relative; padding: 6px 6px 8px; background: linear-gradient(180deg, color-mix(in srgb, var(--rc) 22%, transparent), var(--panel-2) 60%); text-align: center; }
.sk-rar { position: absolute; left: 6px; top: 5px; font-size: 8.5px; font-weight: 900; letter-spacing: 0.12em; text-transform: uppercase; color: var(--rc); }
.sk-pic { height: 88px; }
.sk-desc { display: block !important; font-size: 9.5px !important; line-height: 1.25; min-height: 24px; margin: 2px 0; }
.sk-fx { display: flex; gap: 3px; justify-content: center; margin: 2px 0 3px; }
.sk-fx i { width: 14px; height: 5px; border-radius: 3px; }
.sk-state { font-weight: 900; color: var(--text) !important; }
.skin.sel .sk-state { color: var(--good) !important; }
.be { position: relative; }
.be.fresh { border-color: #ff5a3a; box-shadow: 0 0 10px rgba(255, 90, 58, 0.35); }
.be-new { position: absolute; top: 3px; left: 3px; font-size: 8.5px; font-weight: 900; background: #ff5a3a; color: #fff; border-radius: 5px; padding: 1px 4px; }
.new-e { color: #ff7a5a; }
.r-chestnote { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 4px auto 8px; max-width: 420px; font-size: 13px; text-align: left; }
.r-chestnote:empty { display: none; }
.r-chestnote svg { width: 44px; height: 38px; }

/* ---------------------------------------------------- pass & road tracks */
.track { display: flex; gap: 0; overflow-x: auto; padding: 8px 10px 10px; scrollbar-width: thin; }
.rtile { position: relative; width: 104px; height: 118px; flex: none; border-radius: 16px; border: 2px solid color-mix(in srgb, var(--rc) 55%, transparent); background: radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--rc) 38%, transparent), transparent 70%), linear-gradient(180deg, #1c2430, #10151c); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding: 4px 4px 7px; cursor: default; overflow: hidden; box-shadow: inset 0 -20px 30px rgba(0, 0, 0, 0.35); }
.rt-art { flex: 1; width: 100%; display: flex; align-items: center; justify-content: center; min-height: 0; }
.rt-art svg { width: 54px; height: 54px; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.5)); }
.rt-art img { height: 100%; max-height: 72px; }
.rt-chest .rt-art svg { width: 70px; height: 60px; }
.rtile b { font-size: 14px; font-weight: 900; line-height: 1.1; text-shadow: 0 2px 4px #000; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.rtile small { font-size: 9px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(255, 255, 255, 0.7); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.rt-skin { background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--rc) 60%, transparent), transparent 75%), linear-gradient(160deg, #2a1f3a, #10151c); border-width: 3px; }
.rt-skin b { font-size: 11px; }
.rtile.ready { cursor: pointer; border-color: #ffd24a; box-shadow: 0 0 0 2px rgba(255, 210, 74, 0.35), 0 0 22px rgba(255, 210, 74, 0.45); animation: tileglow 1.3s ease-in-out infinite; }
@keyframes tileglow { 50% { transform: translateY(-3px); } }
.rt-claim { position: absolute; left: 6px; right: 6px; bottom: 5px; padding: 3px 0; border-radius: 8px; background: linear-gradient(180deg, #ffe27a, #ff9a1a); color: #2a1400; font-size: 11px; font-weight: 900; letter-spacing: 0.08em; }
.rtile.ready b, .rtile.ready small { visibility: hidden; }
.rtile.claimed { filter: saturate(0.3) brightness(0.65); }
.rt-ok { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 44px; font-weight: 900; color: var(--good); text-shadow: 0 2px 8px #000; }
.rtile.locked { filter: saturate(0.5) brightness(0.8); }
.rt-lock { position: absolute; right: 6px; top: 6px; width: 20px; height: 20px; }
.rt-lock svg { width: 100%; height: 100%; }

.pass2, .road2 { max-width: 1100px; margin: 0 auto; }
.pass-hero { position: relative; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 12px 14px; border-radius: 18px; overflow: hidden; background: linear-gradient(120deg, #3b1466, #1a2e6a 55%, #0e4b5a); border: 1px solid rgba(255, 255, 255, 0.18); color: #fff; box-shadow: var(--shadow); }
.pass-hero::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(115deg, rgba(255, 255, 255, 0.05) 0 12px, transparent 12px 28px); pointer-events: none; }
.ph-badge { position: relative; width: 64px; height: 72px; flex: none; clip-path: polygon(50% 0, 100% 22%, 100% 78%, 50% 100%, 0 78%, 0 22%); background: linear-gradient(180deg, #ffe27a, #ff8a1a); color: #2a1400; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
.ph-badge small { font-size: 9px; font-weight: 900; letter-spacing: 0.12em; } .ph-badge b { font-size: 28px; font-weight: 900; }
.ph-main { position: relative; flex: 1; min-width: 200px; }
.ph-main h2 { margin: 0; font-size: 26px; font-weight: 900; letter-spacing: 0.04em; text-shadow: 0 3px 10px rgba(0, 0, 0, 0.5); }
.ph-main small { color: rgba(255, 255, 255, 0.75); font-size: 11px; }
.ph-main .kicker { color: #ffcf5a; }
.ph-skin { position: relative; width: 96px; text-align: center; }
.ph-skin img { width: 96px; height: 80px; object-fit: contain; filter: drop-shadow(0 0 12px var(--rc)); }
.ph-skin small { display: block; font-size: 9.5px; font-weight: 800; color: #fff; }
.prem-btn { position: relative; flex-direction: column; gap: 0; background: linear-gradient(180deg, #ffe27a, #ff9a1a); color: #2a1400; border-color: #fff3c0; box-shadow: 0 0 20px rgba(255, 200, 60, 0.5); }
.prem-btn small { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; }
.prem-btn small svg { width: 14px; height: 14px; }
.prem-on { position: relative; font-weight: 900; color: #ffe27a; letter-spacing: 0.1em; text-shadow: 0 0 10px rgba(255, 200, 60, 0.7); }
.track-wrap { position: relative; margin-top: 10px; border-radius: 18px; background: var(--panel); border: 1px solid var(--panel-border); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); display: flex; }
.track-labels { flex: none; width: 26px; display: flex; flex-direction: column; justify-content: space-around; align-items: center; border-right: 1px solid var(--panel-border); }
.track-labels span { writing-mode: vertical-rl; transform: rotate(180deg); font-size: 10px; font-weight: 900; letter-spacing: 0.2em; }
.tl-prem { color: #e8a800; } .tl-free { color: var(--muted); }
.track-wrap .track { flex: 1; min-width: 0; }
.tcol { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 0 5px; }
.tnodeP { position: relative; width: calc(100% + 10px); height: 30px; display: flex; align-items: center; justify-content: center; }
.tnodeP i { position: absolute; left: 0; right: 0; top: 50%; height: 6px; margin-top: -3px; background: rgba(127, 127, 127, 0.3); }
.tcol:first-child .tnodeP i { left: 50%; } .tcol:last-child .tnodeP i { right: 50%; }
.tcol.reached .tnodeP i { background: linear-gradient(90deg, #ffd24a, #ff8a1a); }
.tnodeP b { position: relative; width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 900; background: var(--panel-solid); border: 2px solid var(--panel-border); }
.tcol.reached .tnodeP b { background: linear-gradient(180deg, #ffe27a, #ff8a1a); color: #2a1400; border-color: #fff3c0; }
.tcol.current .tnodeP b { box-shadow: 0 0 0 4px rgba(255, 210, 74, 0.35); animation: nodepulse 1.4s ease-in-out infinite; }
.road-hero { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-radius: 18px; background: linear-gradient(120deg, #6a3a00, #a86a00 45%, #2a1a4a); color: #fff; border: 1px solid rgba(255, 230, 150, 0.4); box-shadow: var(--shadow); position: relative; overflow: hidden; }
.road-hero::after { content: ""; position: absolute; right: -40px; top: -60px; width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 230, 120, 0.35), transparent 70%); }
.rh-trophy svg { width: 64px; height: 64px; filter: drop-shadow(0 0 14px rgba(255, 210, 74, 0.8)); }
.rh-main { position: relative; z-index: 1; }
.rh-main .kicker { color: #ffe27a; }
.rh-num { display: block; font-size: 38px; font-weight: 900; line-height: 1; text-shadow: 0 3px 10px rgba(0, 0, 0, 0.5); }
.rh-main small { color: rgba(255, 255, 255, 0.8); font-size: 11.5px; }
.road-track { margin-top: 10px; border-radius: 18px; background: var(--panel); border: 1px solid var(--panel-border); padding-top: 12px; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); align-items: flex-end; }
.rcol { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: none; }
.rcol .rtile { margin: 0 5px; }
.rcol.big .rtile { width: 128px; height: 140px; }
.rrail { align-self: stretch; height: 8px; background: rgba(127, 127, 127, 0.3); position: relative; }
.rrail i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, #ffd24a, #ff8a1a); box-shadow: 0 0 8px rgba(255, 180, 40, 0.7); }
.rmark { display: flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 900; }
.rmark svg { width: 16px; height: 16px; }
.rcol.next .rmark { color: #ffcf5a; }

/* ------------------------------------------ FPV: tactic + overload buttons */
#fpv-powers { position: absolute; right: calc(24px + 132px + var(--sar)); bottom: calc(34px + var(--sab)); display: flex; flex-direction: column-reverse; gap: 10px; pointer-events: none; }
body.fpv #fpv-powers > * { pointer-events: auto; }
body.lefty #fpv-powers { right: auto; left: calc(24px + 132px + var(--sal)); }
#fpv-powers .icon-btn { width: 62px; height: 62px; border-radius: 16px; position: relative; overflow: hidden; }
#fpv-powers .icon-btn svg { width: 70%; height: 70%; }
#fpv-powers .icon-btn small { position: absolute; bottom: 2px; left: 0; right: 0; text-align: center; font-size: 8px; color: #fff; text-shadow: 0 1px 2px #000; }
#fpv-gadget { border: 2px solid #ff9a3a; }
#fpv-gadget:disabled { filter: grayscale(0.9) brightness(0.7); }
#fpv-hyper { --fill: 0%; border: 2px solid rgba(127, 246, 255, 0.5); }
#fpv-hyper::before { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: var(--fill); background: linear-gradient(0deg, rgba(255, 138, 26, 0.7), rgba(127, 246, 255, 0.5)); transition: height 0.2s ease; }
#fpv-hyper svg, #fpv-hyper small { position: relative; }
#fpv-hyper.full { border-color: #ff8a1a; box-shadow: 0 0 20px rgba(255, 138, 26, 0.8); animation: nodepulse 0.8s ease-in-out infinite; }
#fpv-hyper.on { border-color: #7ff6ff; box-shadow: 0 0 24px rgba(127, 246, 255, 0.9); }
#fpv-hyper.on svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* turret sheet: equipped powers */
.tc-powers { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.tc-powers:empty { display: none; }
.pw { display: flex; align-items: center; gap: 6px; padding: 4px 8px 4px 4px; border-radius: 10px; border: 1px solid var(--panel-border); background: var(--panel-2); color: var(--text); font-size: 11px; text-align: left; min-width: 0; flex: 1 1 150px; }
.pw svg { width: 26px; height: 26px; flex: none; }
.pw span { display: flex; flex-direction: column; min-width: 0; }
.pw b { font-size: 11.5px; } .pw small { font-size: 9.5px; color: var(--muted); line-height: 1.2; }
.pw.gadget { border-color: var(--pc); cursor: pointer; }
.pw.hyper { border-color: #ff8a1a; cursor: pointer; }
button.pw:disabled { opacity: 0.6; cursor: default; }
.pw-star { display: inline-flex; }
.pw-none { color: var(--muted); font-size: 11px; }

/* ------------------------------------------------------------- cockpit */
#cockpit { position: absolute; inset: 0; display: none; pointer-events: none; }
body.cockpit #cockpit { display: block; }
.ck-frame { position: absolute; inset: 0; width: 100%; height: 100%; filter: drop-shadow(0 0 18px rgba(0, 0, 0, 0.6)); }
.ck-dash { position: absolute; left: 50%; bottom: calc(6px + var(--sab)); transform: translateX(-50%); display: flex; align-items: flex-end; gap: 12px; }
.ck-gauge { --v: 0; position: relative; width: 58px; height: 58px; border-radius: 50%; background: conic-gradient(from 225deg, var(--gc, #4fd3ff) calc(var(--v) * 270deg), rgba(255, 255, 255, 0.1) 0 270deg, transparent 0); display: flex; align-items: center; justify-content: center; }
.ck-gauge::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: radial-gradient(circle at 50% 35%, #2a323e, #0c1016); box-shadow: inset 0 0 6px #000; }
.ck-gauge i { position: absolute; left: 50%; top: 50%; width: 3px; height: 22px; margin-left: -1.5px; background: #ffcf5a; border-radius: 2px; transform-origin: 50% 0; transform: rotate(calc(45deg + var(--v) * 270deg)); box-shadow: 0 0 4px #ffcf5a; }
.ck-gauge span { position: relative; margin-top: 30px; font-size: 8px; font-weight: 900; letter-spacing: 0.12em; color: #9aa6b2; }
#ck-heat { --gc: #ffb020; } #ck-heat.over { --gc: #ff3b3b; animation: blink 0.35s steps(2) infinite; }
#ck-hp { --gc: #3ee07a; }
.ck-screen { min-width: 170px; padding: 6px 12px; border-radius: 8px 8px 0 0; background: linear-gradient(180deg, rgba(10, 40, 30, 0.95), rgba(4, 18, 12, 0.95)); border: 2px solid #3a4452; border-bottom: 0; color: #6affa8; text-align: center; font-family: ui-monospace, Consolas, monospace; text-shadow: 0 0 6px rgba(106, 255, 168, 0.7); display: flex; flex-direction: column; }
.ck-screen b { font-size: 12px; letter-spacing: 0.1em; } .ck-screen small { font-size: 9.5px; opacity: 0.85; }
.ck-lights { position: absolute; left: 50%; top: calc(4px + var(--sat)); transform: translateX(-50%); display: flex; gap: 10px; }
.ck-lights i { width: 8px; height: 8px; border-radius: 50%; background: #ff3b3b; box-shadow: 0 0 8px #ff3b3b; animation: blink 1.4s steps(2) infinite; }
.ck-lights i:nth-child(2) { background: #ffcf5a; box-shadow: 0 0 8px #ffcf5a; animation-delay: 0.45s; }
.ck-lights i:nth-child(3) { background: #3ee07a; box-shadow: 0 0 8px #3ee07a; animation-delay: 0.9s; }
body.cockpit #heat { display: none; }
body.cockpit #fpv-corner { top: calc(40px + var(--sat)); }
body.cockpit #crosshair em { background: #6affa8; box-shadow: 0 0 6px #6affa8; }

/* landscape phones */
@media (max-height: 500px) and (orientation: landscape) {
  .tab-battle .hero-actions { position: fixed; right: calc(14px + var(--sar)); bottom: calc(54px + var(--sab)); z-index: 5; margin: 0; }
  .tab-battle .hero-actions .play-btn { font-size: 17px; padding: 12px 28px; box-shadow: 0 6px 24px rgba(240, 123, 18, 0.6); }
  .tab-battle .side { padding-bottom: 60px; }
  .cslot .cs-art { height: 30px; }
  .bottomnav .nav-ico { width: 22px; height: 22px; }
  .bottomnav button.center .nav-ico { width: 24px; height: 24px; }
  .rtile { width: 88px; height: 96px; }
  .rcol.big .rtile { width: 104px; height: 112px; }
  .rt-art svg { width: 40px; height: 40px; }
  .pass-hero, .road-hero { padding: 8px 12px; }
  .ph-badge { width: 48px; height: 54px; } .ph-badge b { font-size: 20px; }
  .ph-main h2 { font-size: 20px; }
  .ph-skin { display: none; }
  .rh-num { font-size: 28px; } .rh-trophy svg { width: 44px; height: 44px; }
  #fpv-powers { right: calc(16px + 112px + var(--sar)); bottom: calc(18px + var(--sab)); gap: 6px; }
  #fpv-powers .icon-btn { width: 52px; height: 52px; }
  .ck-gauge { width: 46px; height: 46px; } .ck-gauge i { height: 16px; } .ck-gauge span { margin-top: 24px; }
  .ck-screen { min-width: 140px; padding: 4px 10px; }
}
@media (orientation: portrait) {
  .how { grid-template-columns: 1fr; }
  .controls { grid-template-columns: 1fr 1fr; }
  .gears { grid-template-columns: repeat(2, 1fr); }
  .cslots { gap: 4px; }
  #fpv-powers { right: calc(16px + var(--sar)); bottom: calc(62px + 116px + var(--sab)); flex-direction: row; }
  body.lefty #fpv-powers { left: calc(16px + var(--sal)); right: auto; }
  .ck-dash { bottom: calc(4px + var(--sab)); gap: 6px; }
  .ck-screen { min-width: 120px; }
  .ck-gauge { width: 46px; height: 46px; } .ck-gauge i { height: 16px; } .ck-gauge span { margin-top: 24px; }
  .loadout { align-self: stretch; }
  .ph-skin { display: none; }
}
body.layout-edit #fpv-powers { pointer-events: auto !important; outline: 2px dashed #ffcf5a; outline-offset: 4px; cursor: grab; touch-action: none; min-width: 60px; min-height: 60px; }
body.layout-edit #fpv-powers > * { pointer-events: none; }
.pcard .c-main { flex: 1; min-width: 0; }
.ck-screen b, .ck-screen small { white-space: nowrap; }

/* World map, Hard, 3rd-star challenge and daily card (battle tab) */
.hero-extra { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 8px; }
.hero-extra .btn { padding: 7px 14px; font-size: 13px; }
.hero-extra #b-hard { background: linear-gradient(180deg, #ff6a6a, #b8202a); color: #fff; border-color: transparent; }
@media (orientation: landscape) and (max-height: 520px) { .hero-challenge { display: none; } }
.hero-challenge { display: none; }
  .hero-actions #b-world .lbl { display: none; }
}
.hero-challenge { margin-top: 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.hero-challenge small { font-weight: 900; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent-2); margin-right: 4px; }
#daily-card:empty { display: none; }

/* iPhone Safari: hint to add the game to the home screen (the only true full screen there) */
#ios-install { position: fixed; left: 50%; bottom: calc(var(--sab) + 70px); transform: translateX(-50%); z-index: 60; width: min(420px, calc(100% - 24px));
  display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 16px; background: var(--panel-solid); border: 1px solid var(--panel-border); box-shadow: var(--shadow); color: var(--text); font-size: 14px; line-height: 1.35; }
#ios-install b { color: var(--accent-2); }
#ios-install .share { display: inline-block; width: 16px; height: 16px; vertical-align: -3px; }
#ios-install button { margin-left: auto; flex: none; border: 0; background: var(--panel-2); color: var(--muted); border-radius: 10px; padding: 8px 10px; font-weight: 800; }
/* ---------------------------------------------------------------- I1 fixes */
/* briefing: DEPLOY stays on screen while the list scrolls */
.brief .brief-actions { position: sticky; bottom: -16px; z-index: 2; margin: 14px -16px -16px; padding: 10px 16px calc(12px + var(--sab)); background: var(--panel-solid); border-top: 1px solid var(--panel-border); box-shadow: 0 -10px 18px -10px rgba(0, 0, 0, 0.45); }
/* new-enemy card slides under the tutorial bubble instead of on top of it */
body.coach-on #tip { top: calc(58px + var(--coach-h, 56px) + 8px + var(--sat)); }
/* shop: skin chip with a real portrait, big deal art */
.rchip .rc-pic { width: 26px; height: 22px; object-fit: contain; }
.deal-big .deal-art.big { position: relative; width: 100%; border-radius: 10px; background: radial-gradient(circle at 50% 60%, color-mix(in srgb, var(--rc) 40%, transparent), transparent 70%); }
.deal-big .deal-art.big em { position: absolute; right: 6px; bottom: 2px; font-style: normal; font-weight: 900; font-size: 15px; text-shadow: 0 2px 4px #000; color: #fff; }
.deal-big .deal-art.big svg { height: 80%; }
@media (max-height: 500px) and (orientation: landscape) {
  body.coach-on #tip { top: calc(46px + var(--coach-h, 44px) + 6px + var(--sat)); }
  /* battle tab: both columns scroll on their own, PLAY sits at the top of the left one (never over the quests) */
  .m-content.tab-battle { overflow: hidden; padding-bottom: 6px; }
  .tab-battle .battle-grid { height: 100%; }
  .tab-battle .hero, .tab-battle .side { overflow-y: auto; min-height: 0; touch-action: pan-y pan-x; overscroll-behavior: contain; padding-bottom: 10px; }
  .tab-battle .hero-actions { position: static; margin: 4px 0 6px; }
  .tab-battle .side { padding-bottom: 10px; }
}
@media (orientation: portrait) {
  body.coach-on #tip { top: calc(96px + var(--coach-h, 64px) + 8px + var(--sat)); }
}

/* F1: zoom button only matters on the map view */
body.fpv #btn-zoom { display: none; }
#game { touch-action: none; }
@media (orientation: portrait) { #hud-pills { margin-left: calc(138px * var(--ui)); } }

/* ---------------------------------------------------- A1 / F2 feedback */
#hitmark.head { width: 46px; height: 46px; margin: -23px 0 0 -23px; background: linear-gradient(45deg, transparent 43%, #ffd23c 43%, #ffd23c 57%, transparent 57%), linear-gradient(-45deg, transparent 43%, #ffd23c 43%, #ffd23c 57%, transparent 57%); filter: drop-shadow(0 0 6px #ffb020); }
#hitmark.kill { width: 40px; height: 40px; margin: -20px 0 0 -20px; background: linear-gradient(45deg, transparent 42%, #ff3b3b 42%, #ff3b3b 58%, transparent 58%), linear-gradient(-45deg, transparent 42%, #ff3b3b 42%, #ff3b3b 58%, transparent 58%); filter: drop-shadow(0 0 5px #ff3b3b); }
#hitmark.show.kill { animation: hitkill 0.28s ease-out; }
@keyframes hitkill { from { opacity: 1; transform: scale(1.5) rotate(10deg); } to { opacity: 0; transform: scale(1); } }
#muzzleflash { position: absolute; left: 50%; bottom: 0; width: 70vmin; height: 45vmin; transform: translateX(-50%); pointer-events: none; opacity: 0; background: radial-gradient(ellipse at 50% 100%, rgba(255, 200, 120, 0.55), rgba(255, 120, 40, 0.18) 40%, transparent 70%); mix-blend-mode: screen; }
#muzzleflash.go { animation: mflash 0.12s ease-out; }
@keyframes mflash { from { opacity: 1; } to { opacity: 0; } }
#threats { position: fixed; inset: 0; pointer-events: none; z-index: 9; }
.threat { position: absolute; left: 0; top: 0; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; }
.threat i { position: absolute; inset: 0; background: radial-gradient(circle at 70% 50%, rgba(255, 59, 79, 0.95) 0 30%, transparent 31%); clip-path: polygon(100% 50%, 45% 10%, 55% 50%, 45% 90%); background: #ff3b4f; filter: drop-shadow(0 0 6px rgba(255, 59, 79, 0.9)); animation: threatpulse 0.8s ease-in-out infinite; }
.threat b { position: relative; font-size: 10px; font-weight: 900; color: #fff; text-shadow: 0 1px 3px #000; background: rgba(120, 0, 20, 0.75); border-radius: 6px; padding: 1px 4px; white-space: nowrap; }
.threat.boss i { background: #ff00aa; }
@keyframes threatpulse { 50% { opacity: 0.45; } }

/* ------------------------------------------------------ B1 active vent */
#vent { position: absolute; left: 50%; top: calc(50% + 56px); transform: translateX(-50%); width: min(260px, 60vw); text-align: center; opacity: 0; pointer-events: none; transition: opacity 0.15s ease; }
#vent.show { opacity: 1; }
#vent .vl { display: block; font-size: 10px; font-weight: 900; letter-spacing: 0.14em; color: #ffb4a0; text-shadow: 0 1px 3px #000; margin-bottom: 4px; }
#vent .vt { position: relative; height: 12px; border-radius: 99px; background: rgba(0, 0, 0, 0.6); border: 1px solid rgba(255, 255, 255, 0.35); overflow: hidden; }
#vent .vw { position: absolute; top: 0; bottom: 0; background: linear-gradient(90deg, #7affc0, #3ee07a); box-shadow: 0 0 10px #3ee07a; }
#vent .vn { position: absolute; top: -2px; bottom: -2px; width: 3px; margin-left: -1.5px; background: #fff; box-shadow: 0 0 6px #fff; }
#vent.ok .vt { border-color: #3ee07a; box-shadow: 0 0 14px #3ee07a; }
#vent.ok .vl::after { content: " — PERFECT!"; color: #7affc0; }
#vent.bad .vt { border-color: #ff3b3b; }
#vent.bad .vl::after { content: " — JAMMED"; color: #ff6b6b; }
/* Chest opening v2: rays, drop, crack, burst, card reveal */
.ov.chest { background: radial-gradient(circle at 50% 38%, color-mix(in srgb, var(--cc, #ffcf5a) 35%, #0b0806), #050404 75%); overflow-x: hidden; overflow-y: auto; }
.ov.chest .chest-stage { overflow: visible; max-height: none; margin: auto; }
.ov.chest .chest-stage > .kicker { position: relative; z-index: 2; margin-bottom: 18px; }
.chest-big svg { overflow: visible; }
.ch-fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
.ch-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 3; }
.ch-flash.go { animation: chFlash 0.5s ease-out; }
@keyframes chFlash { 0% { opacity: 0.85; } 100% { opacity: 0; } }
.chest-stage { position: relative; z-index: 4; }
.ch-stage { position: relative; height: 190px; display: grid; place-items: center; transition: height 0.4s ease, transform 0.4s ease; }
.ch-stage.small { height: 90px; transform: scale(0.6); }
.ch-rays { position: absolute; width: 360px; height: 360px; border-radius: 50%; pointer-events: none;
  background: repeating-conic-gradient(from 0deg, color-mix(in srgb, var(--cc, #ffcf5a) 55%, transparent) 0 10deg, transparent 10deg 24deg);
  -webkit-mask: radial-gradient(circle, #000 20%, transparent 68%); mask: radial-gradient(circle, #000 20%, transparent 68%);
  animation: chSpin 9s linear infinite; opacity: 0.8; }
@keyframes chSpin { to { transform: rotate(360deg); } }
.ch-shadow { position: absolute; bottom: 14px; width: 120px; height: 18px; border-radius: 50%; background: rgba(0, 0, 0, 0.55); filter: blur(4px); }
.chest-big { position: relative; z-index: 1; width: 150px; margin: 0 auto; cursor: pointer; animation: chIdle 1.4s ease-in-out infinite; filter: drop-shadow(0 0 28px color-mix(in srgb, var(--cc, #ffcf5a) 80%, transparent)); }
.chest-big.drop { animation: chDrop 0.7s cubic-bezier(.3, 1.6, .5, 1) both, chIdle 1.4s ease-in-out 0.7s infinite; }
@keyframes chDrop { 0% { transform: translateY(-260px) scale(0.7) rotate(-8deg); } 70% { transform: translateY(8px) scale(1.08, 0.9); } 100% { transform: none; } }
@keyframes chIdle { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.chest-big.crack1 { animation: chShake 0.35s ease-in-out 2; }
.chest-big.crack2 { animation: chShake 0.22s ease-in-out 4; }
@keyframes chShake { 0%, 100% { transform: rotate(0) scale(1.05); } 25% { transform: rotate(-7deg) scale(1.1); } 75% { transform: rotate(7deg) scale(1.1); } }
.ch-crack { position: absolute; left: 10%; right: 10%; top: 42%; height: 6px; border-radius: 6px; background: #fff; opacity: 0; box-shadow: 0 0 18px 6px #fff8c0; transition: opacity 0.2s; }
.chest-big.crack1 .ch-crack { opacity: 0.45; }
.chest-big.crack2 .ch-crack { opacity: 0.9; box-shadow: 0 0 30px 12px #fff8c0; }
.chest-big.open { animation: chBurst 0.6s ease-out forwards; }
@keyframes chBurst { 0% { transform: scale(1.1); } 30% { transform: scale(1.35, 0.85); } 100% { transform: scale(1) translateY(10px); } }
.chest-big.open .chest-lid { transform: translate(-2px, -14px) rotate(-20deg); transform-origin: 8px 24px; transition: transform 0.35s cubic-bezier(.2, 1.6, .4, 1); }
.chest-big.open .ch-crack { opacity: 0; }
.ch-reveal { min-height: 0; display: grid; place-items: center; perspective: 700px; }
.ch-card { width: 150px; margin: 6px auto 0; animation: chFly 0.55s cubic-bezier(.2, 1.4, .4, 1) both; }
.ch-card-in { padding: 14px 10px 12px; border-radius: 18px; background: linear-gradient(180deg, color-mix(in srgb, var(--rc) 45%, #1a1410), #120d09);
  border: 2px solid var(--rc); box-shadow: 0 0 26px color-mix(in srgb, var(--rc) 60%, transparent); display: flex; flex-direction: column; align-items: center; gap: 4px;
  animation: chFlip 0.6s ease-out both; transform-style: preserve-3d; }
.ch-card.t3 .ch-card-in { box-shadow: 0 0 44px 8px color-mix(in srgb, var(--rc) 75%, transparent); animation: chFlip 0.9s ease-out both, chShine 1.6s ease-in-out 0.9s infinite; }
.ch-art svg, .ch-art img { width: 84px; height: 84px; object-fit: contain; }
.ch-n { font-size: 28px; font-variant-numeric: tabular-nums; }
.ch-card small { font-size: 12px; font-weight: 800; color: #f1e6d0; letter-spacing: 0.04em; }
@keyframes chFly { 0% { transform: translateY(-120px) scale(0.3); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes chFlip { 0% { transform: rotateY(180deg); } 100% { transform: rotateY(0); } }
@keyframes chShine { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.25); } }
.ch-left { margin: 8px 0 0; font-size: 12px; font-weight: 900; letter-spacing: 0.18em; color: #e8d9b8; text-transform: uppercase; animation: blink 1.2s steps(2) infinite; }
.ch-left:empty { display: none; }
.citem { animation: chPop 0.4s cubic-bezier(.2, 1.5, .4, 1) both; }
.citem.t3 { border-color: var(--rc); box-shadow: 0 0 16px color-mix(in srgb, var(--rc) 60%, transparent); }
@keyframes chPop { 0% { transform: scale(0.3); opacity: 0; } 100% { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .ch-rays, .chest-big, .ch-card, .ch-card-in, .citem { animation: none !important; } }
@media (orientation: landscape) and (max-height: 520px) {
  .ch-stage { height: 130px; } .chest-big { width: 110px; } .ch-rays { width: 260px; height: 260px; }
  .ch-card { width: 130px; } .ch-art svg, .ch-art img { width: 60px; height: 60px; }
}

/* ------------------------------------------------------------ G3 boss bar */
#bossbar { position: fixed; left: 50%; top: calc(52px + var(--sat)); transform: translate(-50%, -10px); width: min(420px, calc(100vw - 200px)); z-index: 10; opacity: 0; pointer-events: none; transition: opacity 0.3s ease, transform 0.3s ease; }
#bossbar.show { opacity: 1; transform: translate(-50%, 0); }
.bb-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; color: #fff; text-shadow: 0 1px 4px #000; }
.bb-top b { font-size: 13px; font-weight: 900; letter-spacing: 0.12em; }
.bb-top small { font-size: 10px; font-weight: 900; letter-spacing: 0.1em; color: #ffb4a0; }
#bossbar.open .bb-top small { color: #ffe14a; animation: blink 0.4s steps(2) infinite; }
.bb-track { position: relative; height: 10px; margin-top: 3px; border-radius: 99px; background: rgba(0, 0, 0, 0.6); border: 1px solid rgba(255, 90, 110, 0.6); overflow: hidden; }
.bb-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #ff3355, #ff9a3a); transition: width 0.15s linear; }
#bossbar.p2 .bb-fill { background: linear-gradient(90deg, #ff0044, #ff3355); }
.bb-mark { position: absolute; left: 50%; top: -2px; bottom: -2px; width: 2px; background: #fff; opacity: 0.7; }
@media (orientation: portrait) { #bossbar { top: calc(100px + var(--sat)); width: calc(100vw - 120px); } }
body.fpv #bossbar { top: calc(46px + var(--sat)); }

/* ------------------------------------------------------------ D3 details */
/* tutorial bubble in first person: off the crosshair, top-left under the HUD */
body.fpv #coach { left: calc(12px + var(--sal)); right: auto; transform: translateY(-12px); width: min(380px, 42vw); top: calc(56px + var(--sat)); }
body.fpv #coach.show { transform: none; }
/* menu headings stay readable over the 3D background in both themes */
.m-content h3 { color: var(--text); text-shadow: 0 1px 6px var(--ground-shadow, rgba(0, 0, 0, 0.55)); }
body[data-theme="light"] .m-content h3 { --ground-shadow: rgba(255, 255, 255, 0.9); }
.m-content h3 small { color: var(--muted); }

/* ------------------------------------------------------ E4 first minutes */
body.newbie .tab-battle .side > :not(.welcome-card) { display: none; }
body.newbie #b-endless, body.newbie .hero-extra, body.newbie .hero-challenge, body.newbie .tab-battle .loadout, body.newbie #map-row { display: none; }
body.newbie #m-trophies, body.newbie #m-gems { display: none; }
body.newbie .play-btn { animation: nodepulse 1.3s ease-in-out infinite; }
body.newbie .bottomnav [data-tab="shop"], body.newbie .bottomnav [data-tab="pass"], body.newbie .bottomnav [data-tab="road"] { opacity: 0.4; filter: grayscale(1); }
.welcome-card h3 { color: var(--accent-2); margin-bottom: 4px; }
.welcome-card p { margin: 6px 0; font-size: 13.5px; line-height: 1.45; }
.welcome-card .wc-next { color: var(--muted); font-size: 12.5px; }
body.newbie .bottomnav .badge { display: none !important; }

/* ------------------------------------------------------------ turret deck */
.deck-row { display: flex; align-items: center; gap: 4px; padding: 5px 8px; border-radius: 14px; border: 1px solid var(--panel-border); background: var(--panel); cursor: pointer; color: var(--text); margin-bottom: 6px; align-self: flex-start; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); zoom: var(--ui); max-width: 100%; }
.dk-slot { width: 40px; height: 40px; flex: none; border-radius: 10px; border: 2px solid var(--tc); background: radial-gradient(circle at 50% 60%, color-mix(in srgb, var(--tc) 35%, transparent), rgba(13, 17, 23, 0.8)); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.dk-slot img { width: 118%; height: 118%; object-fit: cover; }
.dk-slots { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin: 10px 0; }
.dk-big { position: relative; min-width: 0; border-radius: 12px; border: 2px solid var(--tc, var(--panel-border)); background: var(--panel-2); padding: 4px 3px 6px; display: flex; flex-direction: column; align-items: center; gap: 1px; color: var(--text); cursor: pointer; }
.dk-big img { width: 100%; height: 56px; object-fit: contain; }
.dk-big small { font-size: 8.5px; font-weight: 900; color: var(--muted); letter-spacing: 0.08em; }
.dk-big b { font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.dk-big em { font-style: normal; font-size: 9.5px; color: #e8a800; font-weight: 800; }
.dk-big.sel { box-shadow: 0 0 0 3px var(--accent-2), 0 0 16px color-mix(in srgb, var(--tc) 55%, transparent); transform: translateY(-2px); }
.dk-big.empty { border-style: dashed; opacity: 0.5; cursor: default; justify-content: center; min-height: 90px; }
.dk-all { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; }
.dk-t { border-radius: 12px; border: 1px solid var(--panel-border); background: var(--panel-solid); padding: 4px; display: flex; flex-direction: column; align-items: center; color: var(--text); cursor: pointer; min-width: 0; }
.dk-t img { width: 100%; height: 60px; object-fit: contain; }
.dk-t b { font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.dk-t small { font-size: 9px; color: var(--muted); font-weight: 800; }
.dk-t.in { border-color: var(--tc); background: linear-gradient(180deg, color-mix(in srgb, var(--tc) 22%, transparent), var(--panel-solid)); }
.dk-t.in small { color: var(--good); }
.dk-t.locked { opacity: 0.4; cursor: default; filter: grayscale(1); }
@media (orientation: portrait) { .dk-slots { grid-template-columns: repeat(3, 1fr); } .deck-row { align-self: stretch; } }
/* build card: only the deck (≤ 6), one row */
#build-options { grid-template-columns: repeat(6, 1fr); }
#build-options[data-n="1"] { grid-template-columns: repeat(3, 1fr); }
#build-options[data-n="2"], #build-options[data-n="3"] { grid-template-columns: repeat(3, 1fr); }
#build-options[data-n="4"] { grid-template-columns: repeat(4, 1fr); }
#build-options[data-n="5"] { grid-template-columns: repeat(5, 1fr); }
body.newbie .tab-battle .deck-row { display: none; }
#build-options .o-name { white-space: normal; text-align: center; line-height: 1.15; font-size: 10px; min-height: 2.3em; display: flex; align-items: center; }

/* --------------------------------------------- quiet screen: small message strip */
#feed { position: fixed; left: 50%; top: calc(50px + var(--sat)); transform: translateX(-50%); z-index: 12; display: flex; flex-direction: column; align-items: center; gap: 4px; pointer-events: none; max-width: min(460px, calc(100vw - 220px)); }
body.boss-on #feed { top: calc(88px + var(--sat)); }
.note { display: flex; align-items: baseline; gap: 8px; padding: 4px 12px; border-radius: 99px; background: rgba(10, 13, 18, 0.72); border: 1px solid rgba(255, 255, 255, 0.14); color: #fff; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; animation: notein 0.2s ease-out; transition: opacity 0.3s ease, transform 0.3s ease; }
.note b { font-weight: 900; letter-spacing: 0.08em; font-size: 11.5px; }
.note span { color: var(--accent-2); font-size: 11px; overflow: hidden; text-overflow: ellipsis; }
.note.out { opacity: 0; transform: translateY(-6px); }
@keyframes notein { from { opacity: 0; transform: translateY(-6px); } }
@media (orientation: portrait) { #feed { top: calc(96px + var(--sat)); max-width: calc(100vw - 110px); } body.boss-on #feed { top: calc(134px + var(--sat)); } }
body.fpv #feed { top: calc(44px + var(--sat)); }
/* the new-enemy card is smaller */
#tip { width: min(340px, calc(100vw - 160px)); padding: 6px 10px; gap: 8px; }
#tip .tip-ico { width: 40px; height: 40px; }
#tip b { font-size: 10.5px; } #tip span { font-size: 11.5px; line-height: 1.3; }
.floaty.big { font-size: 16px; }
@media (orientation: portrait) {
  body.fpv #bossbar { top: calc(100px + var(--sat)); }
  body.fpv #feed { top: calc(100px + var(--sat)); }
  body.fpv.boss-on #feed { top: calc(136px + var(--sat)); }
}
body.fpv.boss-on #feed { top: calc(80px + var(--sat)); }
@media (orientation: portrait) { body.fpv.boss-on #feed { top: calc(136px + var(--sat)); } }
@media (orientation: portrait) { #hud-left { display: grid; grid-template-columns: repeat(2, auto); } #hud-pills { margin-left: calc(92px * var(--ui)); } }

/* ------------------------------------------------------------ command bunker */
#bunker-ui { position: fixed; inset: 0; z-index: 8; display: none; }
body.bunker.ingame #bunker-ui { display: block; }
body.bunker #top-ui, body.bunker #abilities, body.bunker #fpv-ui, body.bunker #btn-zoom, body.bunker #btn-bunker { display: none !important; }
#bk-move { position: absolute; left: 0; top: 0; bottom: 0; width: 50%; touch-action: none; }
#bk-look { position: absolute; right: 0; top: 0; bottom: 0; width: 50%; touch-action: none; }
#bk-knob { position: absolute; display: none; width: 110px; height: 110px; margin: -55px 0 0 -55px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.35); background: rgba(0, 0, 0, 0.2); pointer-events: none; }
#bk-knob i { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; background: rgba(255, 255, 255, 0.55); }
#bk-cross { position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: #fff; box-shadow: 0 0 4px #000; pointer-events: none; }
#bk-label { position: absolute; left: 50%; top: calc(50% + 22px); transform: translateX(-50%); font-size: 12px; font-weight: 800; color: #fff; text-shadow: 0 1px 4px #000; pointer-events: none; white-space: nowrap; }
#bk-use { position: absolute; right: calc(24px + var(--sar)); bottom: calc(34px + var(--sab)); width: calc(96px * var(--ui)); height: calc(96px * var(--ui)); border-radius: 50%; border: 3px solid #ffcf5a; background: radial-gradient(circle at 50% 40%, rgba(255, 190, 60, 0.75), rgba(160, 90, 0, 0.7)); color: #fff; font-weight: 900; font-size: 18px; letter-spacing: 0.1em; text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6); cursor: pointer; }
#bk-use:active { transform: scale(0.94); }
#bk-help { position: absolute; left: 50%; bottom: calc(10px + var(--sab)); transform: translateX(-50%); font-size: 11px; color: rgba(255, 255, 255, 0.75); text-shadow: 0 1px 3px #000; pointer-events: none; white-space: nowrap; }
body.bk-scope #bunker-ui::after { content: ""; position: fixed; inset: 0; pointer-events: none; background: radial-gradient(circle at center, transparent 0, transparent min(36vw, 36vh), rgba(0, 0, 0, 0.9) calc(min(36vw, 36vh) + 2px)); }
#bk-picker { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 41; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 40px); overflow-y: auto; background: var(--panel-solid); color: var(--text); border: 1px solid var(--panel-border); border-radius: 16px; padding: 10px 12px; box-shadow: var(--shadow); }
.bkp-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.bkp-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.bkp-t { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; border-radius: 12px; border: 1px solid var(--panel-border); background: var(--panel-2); color: var(--text); cursor: pointer; }
.bkp-t b { font-size: 11px; } .bkp-t small { font-size: 10px; color: var(--muted); }
@media (orientation: portrait) { #bk-help { white-space: normal; width: calc(100vw - 40px); text-align: center; } }
body.army-ctl #bunker-ui, body.fpv #bunker-ui { display: none !important; }
/* jet cockpit HUD: artificial horizon, speed and altitude, pull-up warning */
.ac-hud { position: absolute; left: 50%; top: 50%; width: min(46vw, 320px); height: min(40vh, 220px); transform: translate(-50%, -50%); pointer-events: none; overflow: hidden; border-radius: 12px; }
.ac-hud .hz { position: absolute; left: -50%; right: -50%; top: 50%; height: 2px; background: rgba(120, 255, 170, 0.8); box-shadow: 0 0 6px rgba(120, 255, 170, 0.6); }
.ac-hud .pitch { position: absolute; left: 50%; top: 50%; width: 60px; height: 2px; margin-left: -30px; background: none; border-left: 12px solid rgba(120, 255, 170, 0.9); border-right: 12px solid rgba(120, 255, 170, 0.9); }
.ac-hud .spd, .ac-hud .alt { position: absolute; top: 50%; transform: translateY(-50%); font: 800 12px ui-monospace, monospace; color: #8affb0; text-shadow: 0 0 4px #000; }
.ac-hud .spd { left: 4px; }
.ac-hud .alt { right: 4px; }
.ac-hud .pull { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); font: 900 16px system-ui, sans-serif; color: #ff4a4a; letter-spacing: 0.12em; display: none; }
.ac-hud.warn .pull { display: block; animation: bk-start 0.5s ease-in-out infinite; }
/* bunker: leaning over the map table (taps go to the table), START button, terminal map */
body.bk-table #bk-move, body.bk-table #bk-look, body.bk-table #bk-cross, body.bk-table #bk-knob, body.bk-table #bk-help { display: none !important; }
body.bk-table #bk-label, body.bk-scope #bk-label { top: auto; bottom: calc(14px + var(--sab)); padding: 6px 12px; border-radius: 999px; background: rgba(8, 14, 20, 0.7); font-size: 13px; }
#bk-use.back { width: auto; height: auto; min-width: calc(84px * var(--ui)); padding: 12px 18px; border-radius: 14px; font-size: 16px; background: rgba(20, 30, 40, 0.85); border-color: #9aa7b4; }
#bk-use.start {
  width: calc(118px * var(--ui)); height: calc(118px * var(--ui)); font-size: 24px; letter-spacing: 0.06em; border: 5px solid #ffd24a;
  background: radial-gradient(circle at 50% 35%, #ff7a6a 0, #ff2a2a 42%, #a80c0c 100%);
  box-shadow: 0 0 0 5px #1a1a1a, 0 0 0 9px #ffd24a, 0 8px 22px rgba(255, 40, 40, 0.55), inset 0 -8px 14px rgba(0, 0, 0, 0.35);
  animation: bk-start 1.1s ease-in-out infinite;
}
@keyframes bk-start { 0%, 100% { transform: scale(1); box-shadow: 0 0 0 5px #1a1a1a, 0 0 0 9px #ffd24a, 0 8px 22px rgba(255, 40, 40, 0.5), inset 0 -8px 14px rgba(0, 0, 0, 0.35); } 50% { transform: scale(1.07); box-shadow: 0 0 0 5px #1a1a1a, 0 0 0 9px #ffd24a, 0 0 38px rgba(255, 60, 40, 0.95), inset 0 -8px 14px rgba(0, 0, 0, 0.35); } }
.bkp-map { position: relative; width: 100%; margin: 4px 0 10px; border-radius: 12px; overflow: hidden; background: #12301f; background-image: linear-gradient(rgba(120, 255, 190, 0.07) 1px, transparent 1px), linear-gradient(90deg, rgba(120, 255, 190, 0.07) 1px, transparent 1px); background-size: 24px 24px; border: 2px solid #2a5a40; }
.bkp-map svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.bkp-map polyline { fill: none; stroke: #8a7650; stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.bkp-hq { position: absolute; transform: translate(-50%, -50%); padding: 2px 5px; border-radius: 4px; background: #58e1ff; color: #0b0f14; font: 900 10px system-ui, sans-serif; font-style: normal; }
.bkp-pin { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 0; border: 0; background: none; cursor: pointer; }
.bkp-pin .t-icon { display: block; width: 38px; height: 38px; border-radius: 50%; border: 3px solid var(--c); background: #0b0f14; overflow: hidden; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6); }
.bkp-pin .t-icon img, .bkp-pin .t-icon svg { width: 100%; height: 100%; object-fit: cover; }
.bkp-pin small { font: 800 9px system-ui, sans-serif; color: #fff; text-shadow: 0 1px 2px #000, 0 0 3px #000; white-space: nowrap; }
.bkp-pin:active .t-icon { transform: scale(0.92); }
.bkp-map { margin-left: auto; margin-right: auto; overflow: visible; }
.bkp-lead line { stroke: rgba(255, 255, 255, 0.55); stroke-width: 0.35; }
.bkp-lead circle { fill: #ffd24a; }
.bkp-pin small { background: rgba(8, 12, 16, 0.72); padding: 0 4px; border-radius: 4px; }
/* the USE button hides while a turret picker is open */
body:has(#bk-picker) #bk-use, body:has(#bk-picker) #bk-label { display: none !important; }
/* clean results: nothing of the bunker HUD shows under the mission report; it covers the screen */
body:has(#result.show) #bunker-ui, body:has(#result.show) #feed, body:has(#result.show) #bk-picker { display: none !important; }
#result { background: radial-gradient(ellipse at center, rgba(10, 14, 20, 0.86), rgba(5, 7, 10, 0.97)); }
/* success toasts drop below the row of top buttons (and stay clear of the result buttons at the bottom) */
body .ach-toast { top: calc(var(--sat, 0px) + 64px); }
/* O1 bunker tour: a step card under the HUD and an arrow over the station */
#bk-tut { position: fixed; left: 50%; top: calc(56px + var(--sat)); transform: translateX(-50%); z-index: 14; display: none; flex-direction: column; align-items: center; gap: 2px; max-width: min(460px, calc(100vw - 32px)); padding: 8px 14px 8px; border-radius: 14px; background: rgba(10, 20, 30, 0.88); border: 2px solid #ffd24a; color: #fff; text-align: center; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5); }
body.bunker.ingame #bk-tut { display: flex; }
body:has(#result.show) #bk-tut, body:has(#bk-picker) #bk-tut { display: none !important; }
body.bk-table #bunker-ui { touch-action: none; }
@media (orientation: portrait) {
  /* on tall phones the tour card sits low on the left, clear of the HUD, the HQ tips and the USE button */
  #bk-tut { top: auto; bottom: calc(40px + var(--sab)); left: 10px; transform: none; max-width: calc(100vw - 150px); align-items: flex-start; text-align: left; }
}
#bk-tut small { font: 900 10px system-ui, sans-serif; letter-spacing: 0.16em; color: #ffd24a; }
#bk-tut b { font-size: 14px; line-height: 1.25; }
#bk-tut button { margin-top: 4px; padding: 3px 10px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.4); background: transparent; color: rgba(255, 255, 255, 0.8); font: 800 10px system-ui, sans-serif; letter-spacing: 0.1em; cursor: pointer; }
#bk-tut-arrow { position: fixed; left: 0; top: 0; z-index: 13; width: 0; height: 0; pointer-events: none; display: none; }
body.bunker.ingame #bk-tut-arrow { display: block; }
#bk-tut-arrow::before { content: ""; position: absolute; left: -18px; top: -44px; border: 18px solid transparent; border-top: 26px solid #ffd24a; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6)); }
#bk-tut-arrow.on::before { animation: bk-tut-bob 0.8s ease-in-out infinite; }
#bk-tut-arrow.edge::before { top: -10px; border-top: none; border-bottom: 26px solid #ffd24a; }
@keyframes bk-tut-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

/* synergies in the turret card */
.pw.syn { border-color: var(--pc); }
.syn-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; background: var(--pc); box-shadow: 0 0 8px var(--pc); margin: 0 7px; }
