/* Layout: playable board is the hero with the HUD rail beside it; reference sections follow in one 1120px column.
   Deliberately a single dark look (arcade screen), so there are no light-theme blocks. */
:root {
  color-scheme: dark;
  --ink: #0C1216;
  --panel: #121C21;
  --panel-2: #17252B;
  --line: #24373E;
  --fg: #E2EDEF;
  --muted: #8FA6AB;
  --solder: #FFB547;
  --solder-ink: #1A1206;
  --threat: #FF4D6D;
  --ok: #7EE0A0;
  --grid: rgba(143, 166, 171, 0.05);
  --f-display: 'Tektur', 'Barlow', system-ui, sans-serif;
  --f-body: 'Barlow', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-mono: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background-color: var(--ink);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 32px 32px;
  color: var(--fg);
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.55;
}
[hidden] { display: none !important; }

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 28px 72px;
}

h1, h2, h3, h4 { font-family: var(--f-display); text-wrap: balance; margin: 0; }
p { margin: 0; }
a { color: var(--solder); }
.eyebrow {
  font-family: var(--f-mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Header ---------- */
.top { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 20px; }
.brand { display: flex; gap: 16px; align-items: center; min-width: 0; }
.logo-mark { display: grid; grid-template-columns: repeat(2, 14px); gap: 3px; flex: none; }
.logo-mark i { width: 14px; height: 14px; border-radius: 3px; display: block; }
.logo-mark i:nth-child(1) { background: #3FD0E8; }
.logo-mark i:nth-child(2) { background: var(--solder); }
.logo-mark i:nth-child(3) { background: #A57BFF; }
.logo-mark i:nth-child(4) { background: var(--threat); }
h1 { font-weight: 800; letter-spacing: 0.08em; font-size: clamp(2rem, 6vw, 3.2rem); line-height: 1; }
.brand p { color: var(--muted); max-width: 46ch; margin-top: 6px; }
.top nav { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.9rem; }
.top nav a { color: var(--muted); text-decoration: none; border-bottom: 1px solid transparent; }
.top nav a:hover, .top nav a:focus-visible { color: var(--fg); border-color: var(--solder); outline: none; }

/* ---------- Play area ---------- */
.play {
  display: grid;
  grid-template-columns: minmax(0, 480px) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
  margin-top: 28px;
}
.board-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
/* The frame's border and glow follow the current scene's hue (--scene-h is set by the game). */
.board-frame {
  position: relative;
  width: 100%;
  max-width: 480px;
  border: 1px solid hsla(var(--scene-h, 195), 40%, 42%, 0.55);
  border-radius: 14px;
  background: #0A1013;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.55),
    0 16px 36px -12px rgba(0, 0, 0, 0.75),
    0 0 30px -8px hsla(var(--scene-h, 195), 85%, 55%, 0.28);
  transition: border-color 0.6s ease, box-shadow 0.6s ease;
}
/* Rising tide levels: the frame glows deep red from the bottom up. */
.board-frame.tide-on {
  border-color: rgba(255, 77, 109, 0.6);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.55),
    0 16px 36px -12px rgba(0, 0, 0, 0.75),
    0 22px 38px -14px rgba(255, 40, 70, 0.55),
    0 0 26px -8px rgba(255, 77, 109, 0.3);
}
/* A hairline of light along the top inner edge, like the lip of a glass panel. */
.board-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), inset 0 0 0 1px rgba(255, 255, 255, 0.025);
}
#board { display: block; margin: 0 auto; touch-action: none; cursor: pointer; border-radius: 13px; }
#board:focus-visible { outline: 2px solid var(--solder); outline-offset: -2px; }
.hint { color: var(--muted); font-size: 0.92rem; min-height: 2.9em; }
.hint b { color: var(--fg); }
.arm-hint { display: none; }

.toast {
  position: absolute; top: 10px; left: 50%; z-index: 3;
  transform: translate(-50%, -8px);
  background: rgba(18, 28, 33, 0.96);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.85rem;
  max-width: 90%;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.overlay {
  position: absolute; inset: 0;
  background: rgba(6, 10, 12, 0.8);
  backdrop-filter: blur(3px);
  display: flex; flex-direction: column; align-items: center;
  overflow-y: auto;
  padding: 16px;
}
.ov-card { margin-block: auto; }
.ov-card {
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(143, 227, 255, 0.06), transparent 70%),
    linear-gradient(180deg, #16232A, var(--panel) 42%);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 0 0 1px rgba(0, 0, 0, 0.35),
    0 18px 48px -12px rgba(0, 0, 0, 0.7);
  padding: 22px;
  width: 100%;
  max-width: 340px;
  display: flex; flex-direction: column; gap: 12px;
}
.ov-card h3 { font-size: 1.5rem; }
.ov-card dl { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin: 0; font-variant-numeric: tabular-nums; }
.ov-card dt { color: var(--muted); }
.ov-card dd { margin: 0; text-align: right; font-weight: 600; }
.ov-card .note { font-size: 0.85rem; color: var(--muted); border-left: 2px solid var(--solder); padding-left: 10px; }
.ov-card .unlock { color: var(--solder); font-weight: 600; }
.ov-actions { display: flex; flex-direction: column; gap: 8px; }

.btn {
  font: 600 0.95rem/1 var(--f-body);
  border-radius: 10px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #1C2C33, var(--panel-2));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 1px 2px rgba(0, 0, 0, 0.35);
  color: var(--fg);
  cursor: pointer;
  transition: border-color 0.15s, filter 0.15s, transform 0.08s, box-shadow 0.15s;
}
.btn:hover { border-color: var(--muted); }
.btn:active:not(:disabled) { transform: translateY(1px); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35); }
.btn:focus-visible { outline: 2px solid var(--solder); outline-offset: 2px; }
.btn.primary {
  background: linear-gradient(180deg, #FFC86A, var(--solder) 55%, #F0A232);
  color: var(--solder-ink); border-color: #FFC46A;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), inset 0 -2px 0 rgba(120, 70, 0, 0.25), 0 4px 14px -4px rgba(255, 181, 71, 0.55);
  font-family: var(--f-display); letter-spacing: 0.04em;
}
.btn.primary:hover { filter: brightness(1.08); }
.btn.primary:active:not(:disabled) { box-shadow: inset 0 2px 3px rgba(120, 70, 0, 0.35); }
.btn.ad { border-style: dashed; border-color: var(--solder); background: rgba(255, 181, 71, 0.04); box-shadow: none; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---------- HUD ---------- */
.hud {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  display: flex; flex-direction: column; gap: 18px;
  min-width: 0;
}
.pilot-row { display: flex; gap: 14px; align-items: center; }
#pilotCanvas { width: 72px; height: 72px; border-radius: 12px; background: var(--panel-2); flex: none; }
.pilot-row strong { display: block; font-family: var(--f-display); font-size: 1.3rem; letter-spacing: 0.04em; }
.pilot-row span.role { color: var(--muted); font-size: 0.9rem; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stats div { display: flex; flex-direction: column; gap: 2px; }
.stats b { font-family: var(--f-display); font-size: 1.6rem; font-variant-numeric: tabular-nums; line-height: 1.1; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.5), 0 0 18px rgba(143, 227, 255, 0.12); }
.stats #diff { text-shadow: 0 1px 0 rgba(0, 0, 0, 0.5), 0 0 16px rgba(255, 181, 71, 0.3); }
#diff { color: var(--solder); }
.prog-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 6px; }
#scoreTxt { font-family: var(--f-mono); font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.bar { height: 10px; background: var(--panel-2); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--solder), #FFE0A3); transition: width 0.3s; }
.threat {
  color: #FFC2CD;
  background: linear-gradient(180deg, rgba(255, 77, 109, 0.12), rgba(255, 77, 109, 0.05));
  border: 1px solid rgba(255, 77, 109, 0.32);
  box-shadow: inset 3px 0 0 rgba(255, 77, 109, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.9rem;
}
.threat b { color: var(--threat); font-variant-numeric: tabular-nums; }
.threat.calm { color: var(--ok); background: linear-gradient(180deg, rgba(126, 224, 160, 0.1), rgba(126, 224, 160, 0.04)); border-color: rgba(126, 224, 160, 0.3); box-shadow: inset 3px 0 0 rgba(126, 224, 160, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.04); }

.powers { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.pw {
  position: relative;
  display: grid; gap: 6px; justify-items: start;
  text-align: left;
  background: linear-gradient(180deg, #1B2B32, var(--panel-2) 60%, #142126);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 2px 6px -2px rgba(0, 0, 0, 0.5);
  padding: 10px;
  color: var(--fg);
  font: 500 0.82rem/1.2 var(--f-body);
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s, transform 0.08s;
}
.pw:hover:not(:disabled) { border-color: rgba(255, 181, 71, 0.55); }
.pw:active:not(:disabled) { transform: translateY(1px); }
/* The picture is drawn bigger than the row it sits in (negative margins), so the buttons keep their height. */
.pw .pwi { width: 30px; height: 30px; margin: -4px 0 -4px -4px; }
.pw .ct {
  position: absolute; top: 8px; right: 8px;
  font: 600 0.75rem/1 var(--f-mono);
  background: linear-gradient(180deg, #0F181C, var(--ink)); border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  font-variant-numeric: tabular-nums;
}
.pw .ct:empty { display: none; }
.pw .rar { font: 600 0.62rem/1 var(--f-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.pw.r1 { border-color: rgba(79, 139, 255, 0.55); box-shadow: inset 0 1px 0 rgba(143, 179, 255, 0.14), 0 2px 6px -2px rgba(0, 0, 0, 0.5); } .pw.r1 .rar { color: #8FB3FF; }
.pw.r2 { border-color: rgba(176, 123, 255, 0.6); box-shadow: inset 0 1px 0 rgba(205, 179, 255, 0.16), 0 0 10px rgba(176, 123, 255, 0.12); } .pw.r2 .rar { color: #CDB3FF; }
.pw.r3 { border-color: rgba(255, 181, 71, 0.7); box-shadow: inset 0 1px 0 rgba(255, 224, 163, 0.18), 0 0 12px rgba(255, 181, 71, 0.2); } .pw.r3 .rar { color: var(--solder); }
.pw.active {
  border-color: var(--solder);
  background: linear-gradient(180deg, rgba(255, 181, 71, 0.22), rgba(255, 181, 71, 0.08));
  box-shadow: inset 0 1px 0 rgba(255, 224, 163, 0.3), 0 0 0 1px rgba(255, 181, 71, 0.35), 0 0 16px rgba(255, 181, 71, 0.3);
}
.pw:focus-visible { outline: 2px solid var(--solder); outline-offset: 2px; }
.pw:disabled { opacity: 0.42; cursor: not-allowed; box-shadow: none; }
.pw.locked { background: var(--panel-2); }

.proto {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center;
  font-size: 0.88rem; color: var(--muted);
}
.proto select {
  background: var(--panel-2); color: var(--fg);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 8px; font: inherit; margin-left: 6px;
}
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.switch input { accent-color: var(--solder); width: 18px; height: 18px; }

/* ---------- Sections ---------- */
section.block { margin-top: 80px; display: flex; flex-direction: column; gap: 20px; }
section.block > header { display: flex; flex-direction: column; gap: 8px; }
h2 { font-size: clamp(1.5rem, 3.4vw, 2rem); letter-spacing: 0.03em; }
.lede { color: var(--muted); max-width: 66ch; }
h3.sub { font-size: 1.1rem; letter-spacing: 0.04em; margin-top: 8px; }

.steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; counter-reset: step; }
.steps li {
  list-style: none;
  border-top: 2px solid var(--line);
  padding-top: 12px;
  display: flex; flex-direction: column; gap: 6px;
  min-width: 0;
}
.steps li::before {
  counter-increment: step;
  content: 'Step ' counter(step);
  font: 600 0.7rem/1 var(--f-mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--solder);
}
.steps h4 { font-size: 1rem; }
.steps p { color: var(--muted); font-size: 0.93rem; }
.steps ol, ol.steps { margin: 0; padding: 0; }

.chars { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.char {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  display: flex; flex-direction: column;
}
.char canvas { width: 100%; max-width: 100%; aspect-ratio: 1; display: block; background: var(--panel-2); }
.char-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.char h3 { font-size: 1.25rem; letter-spacing: 0.05em; }
.char p { font-size: 0.92rem; color: var(--muted); }
.char p b { color: var(--fg); font-weight: 600; }
.char .btn { margin-top: auto; }
.char.enemy { border-color: rgba(255, 77, 109, 0.35); }
.char.enemy .eyebrow { color: #FF8FA3; }
.char.selected { border-color: var(--solder); }
.char-body .spacer { flex: 1; }

.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
th { font: 600 0.68rem/1.2 var(--f-mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
td.name { font-weight: 600; white-space: nowrap; }
.pill {
  display: inline-block; font: 600 0.7rem/1 var(--f-mono); letter-spacing: 0.06em;
  padding: 4px 8px; border-radius: 99px; border: 1px solid var(--line); white-space: nowrap;
}
.pill.now { color: var(--ok); border-color: rgba(126, 224, 160, 0.4); }
.pill.planned { color: var(--muted); }
.pill.destroy { color: #FFC2CD; border-color: rgba(255, 77, 109, 0.4); }
.pill.change { color: #D7C6FF; border-color: rgba(165, 123, 255, 0.45); }
.pill.control, .pill.boost { color: #BFF3FB; border-color: rgba(63, 208, 232, 0.4); }
.caption { font-size: 0.88rem; color: var(--muted); max-width: 72ch; }

.tiers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.tier {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 20px; display: flex; flex-direction: column; gap: 12px; min-width: 0;
}
.tier.pro { border-color: var(--solder); }
.tier .price { font-family: var(--f-display); font-size: 2rem; line-height: 1; }
.tier .price small { font-family: var(--f-body); font-size: 0.9rem; color: var(--muted); }
.tier ul { margin: 0; padding-left: 1.1em; display: flex; flex-direction: column; gap: 6px; }
.tier li::marker { color: var(--solder); }

.rules { margin: 0; padding-left: 1.1em; display: flex; flex-direction: column; gap: 6px; max-width: 72ch; }
.rules li::marker { color: var(--solder); }

.ideas { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.idea { border: 1px solid var(--line); border-radius: 12px; padding: 16px; background: var(--panel); display: flex; flex-direction: column; gap: 6px; }
.idea h4 { font-size: 1rem; letter-spacing: 0.03em; }
.idea p { font-size: 0.92rem; color: var(--muted); }

footer.foot { margin-top: 72px; border-top: 1px solid var(--line); padding-top: 18px; color: var(--muted); font-size: 0.85rem; }

/* ---------- Missions, stars, energy ---------- */
.wallet { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 0.9rem; color: var(--muted); }
.wallet b { color: var(--fg); font-family: var(--f-display); font-weight: 700; font-variant-numeric: tabular-nums; }
.goals { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.goal { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; gap: 5px 10px; align-items: center; font-size: 0.92rem; }
.goal .bar { grid-column: 2 / -1; }
.goal .g-n { font: 600 0.78rem/1 var(--f-mono); color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.goal.done .g-n { color: var(--ok); }
.goal.done .bar i { background: linear-gradient(90deg, #5FCB86, var(--ok)); box-shadow: 0 0 8px rgba(126, 224, 160, 0.4); }
.g-ic { width: 12px; height: 12px; border-radius: 3px; display: inline-block; flex: none; }
.g-score { background: var(--solder); }
.g-bots { background: var(--threat); border-radius: 50%; }
.g-repair { background: #26101A; border: 1.5px solid var(--threat); }
.g-combo { background: #3FD0E8; transform: rotate(45deg) scale(0.85); }
.g-crates { background: #8A5A1C; border: 1.5px solid var(--solder); }
.g-bombs { background: radial-gradient(circle at 35% 35%, #6E7C88, #11171C 70%); border-radius: 50%; box-shadow: 0 0 0 1.5px #FFB547, 2px -2px 0 -0.5px #FFC24D; }
.bar.sb { position: relative; overflow: visible; }
.bar.sb i { border-radius: 99px; }
.tick { position: absolute; top: -4px; width: 2px; height: 18px; background: var(--line); transform: translateX(-1px); }
.tick.on { background: var(--solder); }
.stars-sm { color: var(--solder); letter-spacing: 0.12em; font-size: 1rem; }
.goal-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 0.92rem; }
.goal-list li { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.goal-list li.done span:nth-child(2)::after { content: ' ✓'; color: var(--ok); }
.goal-list .g-n { font: 600 0.75rem/1 var(--f-mono); color: var(--muted); white-space: nowrap; }
.goal-list li.done .g-n { color: var(--ok); }
.say { background: var(--panel-2); border-radius: 10px; padding: 10px 12px; font-size: 0.93rem; }
.stars-big { font-size: 2.3rem; line-height: 1; color: var(--solder); letter-spacing: 0.14em; }

/* ---------- Level map ---------- */
.map { display: flex; flex-direction: column; gap: 16px; }
.zone {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; min-width: 0;
}
.zone.closed { opacity: 0.6; }
.zone-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.zone h3 { font-size: 1.25rem; letter-spacing: 0.04em; }
.zone-stars { font: 600 0.85rem/1 var(--f-mono); color: var(--solder); white-space: nowrap; }
.zone-twist { color: var(--muted); font-size: 0.92rem; max-width: 70ch; }
.path {
  list-style: none; margin: 6px 0 0; padding: 12px 0;
  display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 6px; position: relative;
}
.path::before { content: ''; position: absolute; left: 5%; right: 5%; top: 50%; border-top: 2px dashed var(--line); }
.path li { display: flex; justify-content: center; position: relative; }
.path li:nth-child(odd) { transform: translateY(-9px); }
.path li:nth-child(even) { transform: translateY(9px); }
.node {
  width: 50px; max-width: 100%; aspect-ratio: 1; border-radius: 50%;
  border: 2px solid var(--line); background: var(--panel-2); color: var(--fg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  padding: 0; cursor: pointer;
}
.node .n { font: 700 0.95rem/1 var(--f-display); }
.node .ns { font-size: 0.55rem; line-height: 1; color: var(--solder); letter-spacing: -0.02em; }
.node:hover:not(:disabled) { border-color: var(--muted); }
.node.done { border-color: var(--solder); }
.node.boss { border-color: var(--threat); width: 58px; }
.node.boss .n::before { content: 'BOSS '; font-size: 0.5rem; letter-spacing: 0.08em; display: block; color: var(--threat); margin-bottom: 2px; }
.node.current { border-color: var(--ok); box-shadow: 0 0 0 4px rgba(126, 224, 160, 0.18); }
.node.locked { opacity: 0.45; cursor: not-allowed; }
.node:focus-visible { outline: 2px solid var(--solder); outline-offset: 3px; }
@media (max-width: 640px) {
  .path, .zone .path { grid-template-columns: repeat(5, minmax(0, 1fr)); row-gap: 26px; }
  .path::before { display: none; }
}

.g-drives { background: #6A7B88; border-top: 3px solid var(--solder); }
.g-locks { background: #0B1418; border: 1.5px solid #8FE3FF; }
.g-core { background: radial-gradient(circle at 50% 45%, #FF5FA2 0 3px, #3A1D44 4px); border: 1.5px solid #FFC45C; border-radius: 4px; }
.g-datacenter { background: #1E2A33; border: 1.5px solid #3FD0E8; border-radius: 3px; width: 16px; box-shadow: inset 0 0 0 3px #1E2A33, inset 0 0 0 6px #B07BFF; }
.g-dive { background: linear-gradient(#FFB547, #6A7B88); border-radius: 2px; }
.g-servers { background: #2A3A44; border: 1.5px solid #7EE0A0; border-radius: 2px; box-shadow: inset 0 -3px 0 #FF4D6D; }
/* Gravity shift: a HUD chip after the goals. Its arrow turns with gravity (rotated by the game). */
.g-grav { background: none; width: 14px; height: 14px; }
.g-grav svg { width: 14px; height: 14px; display: block; fill: none; stroke: #6EEBFF; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 3px rgba(110, 235, 255, 0.7)); }
.goal.grav-chip { color: #BFF6FF; grid-template-columns: 14px minmax(0, 1fr) auto; }
.goal.grav-chip .g-n { color: #6EEBFF; }
.goal.grav-chip.warn, .goal.grav-chip.warn .g-n { color: #FFB547; }
.goal.grav-chip.warn .g-grav svg { stroke: #FFB547; filter: drop-shadow(0 0 4px rgba(255, 181, 71, 0.9)); }
body.playmode .goal.grav-chip { border-color: rgba(110, 235, 255, 0.45); }
body.playmode .goal.grav-chip.warn { border-color: rgba(255, 181, 71, 0.8); }
html:not(.reduce-motion) .goal.grav-chip.warn { animation: grav-warn 0.9s ease-in-out infinite; }
@keyframes grav-warn { 50% { box-shadow: 0 0 14px rgba(255, 181, 71, 0.55); } }
.g-tide { background: linear-gradient(#1B2A31 0 45%, #FF8DA2 45% 58%, #8E1530 58%); border-radius: 2px; box-shadow: 0 0 6px rgba(255, 77, 109, 0.55); }
.g-packets { background: linear-gradient(#F6FFFF, #46B2C6); border: 1.5px solid #6CF7E0; border-radius: 999px; width: 18px; box-shadow: inset -5px 0 0 -2px #0D2733, inset 0 -3px 0 -1px #7CFFB2; }
.tip-art { width: 100%; max-width: 100%; aspect-ratio: 280 / 120; border-radius: 10px; background: var(--panel-2); display: block; }
.spot-art { max-width: 260px; margin: 0 auto; }
/* On phones the spotlight keeps to the words, so the callout stays small and clear of the board (the tip card keeps the art). */
@media (max-width: 520px), (max-height: 520px) { .spot-art { display: none; } }
.proto input[type="number"] {
  width: 6.5em; background: var(--panel-2); color: var(--fg);
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font: inherit; margin-left: 6px;
}
.proto .btn { padding: 8px 12px; font-size: 0.85rem; }

/* ---------- Sections map ---------- */
.map-nav { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; }
.map-nav .btn { padding: 9px 14px; font-size: 0.88rem; }
.map-pos { font: 600 0.85rem/1 var(--f-mono); color: var(--fg); min-width: 11em; text-align: center; }
.map-go { font-size: 0.88rem; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.map-go input { width: 7em; background: var(--panel-2); color: var(--fg); border: 1px solid var(--line); border-radius: 8px; padding: 8px; font: inherit; }
.sec-banner { width: 100%; max-width: 100%; height: 84px; display: block; border-radius: 10px; }
.zone .path { grid-template-columns: repeat(10, minmax(0, 1fr)); row-gap: 26px; }
.zone .path::before { display: none; }
@media (max-width: 640px) { .zone .path { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.node.gate { border-color: #8FE3FF; width: 58px; box-shadow: 0 0 0 4px rgba(143, 227, 255, 0.14); }
.node.gate .n::before { content: 'GATE '; font-size: 0.5rem; letter-spacing: 0.08em; display: block; color: #8FE3FF; margin-bottom: 2px; }
.chest {
  display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center;
  border-top: 1px solid var(--line); padding-top: 12px; font-size: 0.9rem; color: var(--muted);
}
.chest-n { font: 600 0.85rem/1 var(--f-mono); color: var(--solder); }
.chest .btn { margin-left: auto; padding: 9px 14px; }

/* ---------- Overdrive upgrades (Pilots tab) ---------- */
.od-card { background: var(--panel); border: 1px solid rgba(90, 184, 255, 0.45); border-radius: 14px; padding: 14px 16px; margin: 0 0 14px; display: grid; gap: 10px; }
.od-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.od-top h3 { font-size: 1.1rem; letter-spacing: 0.03em; margin: 0; flex: 1 1 200px; }
.od-top h3 small { display: block; margin-top: 2px; font-size: 0.78rem; font-weight: 600; letter-spacing: 0.06em; opacity: 0.8; }
.od-top h3:focus { outline: none; } .od-top h3:focus-visible { outline: 2px solid #8FDCFF; outline-offset: 3px; border-radius: 6px; }
.od-cores { display: inline-flex; align-items: center; gap: 6px; font: 600 0.95rem/1 var(--f-mono); color: #9FD8FF; }
.od-gem { width: 16px; height: 16px; flex: none; }
.od-shards { font: 500 0.75rem/1 var(--f-mono); color: var(--muted); }
.od-ladder { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 6px; }
.od-ladder li { border: 1px solid var(--line); border-radius: 10px; padding: 7px 9px; font-size: 0.82rem; color: var(--muted); min-width: 0; }
.od-ladder li b { display: block; color: var(--fg); font-size: 0.86rem; }
.od-ladder li small { font: 500 0.7rem/1.2 var(--f-mono); color: var(--muted); }
.od-ladder li.past { opacity: 0.6; }
.od-ladder li.now { border-color: #5AB8FF; background: rgba(90, 184, 255, 0.1); color: var(--fg); }
.od-ladder li.next { border-style: dashed; border-color: rgba(90, 184, 255, 0.5); }
.od-act { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.od-act p { margin: 0; font-size: 0.85rem; color: var(--muted); flex: 1 1 220px; }
.char p.abil b, .char p.pass b { color: #9FD8FF; }
.ov-od { margin: 4px 0 0; }

/* ---------- Workshop ---------- */
.workshop { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.wk { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.wk.r1 { border-color: rgba(79, 139, 255, 0.5); }
.wk.r2 { border-color: rgba(176, 123, 255, 0.55); }
.wk.r3 { border-color: rgba(255, 181, 71, 0.65); }
.wk-head { display: flex; gap: 10px; align-items: center; }
.wk-head .pwi { width: 44px; height: 44px; }
.wk-head h3 { font-size: 1.05rem; letter-spacing: 0.03em; }
.rar-pill { display: inline-block; font: 600 0.66rem/1 var(--f-mono); letter-spacing: 0.08em; text-transform: uppercase; padding: 3px 7px; border-radius: 99px; border: 1px solid currentColor; margin-top: 3px; }
.rar-pill.r0 { color: #9FB3B8; } .rar-pill.r1 { color: #8FB3FF; } .rar-pill.r2 { color: #CDB3FF; } .rar-pill.r3 { color: var(--solder); }
.wk-tiers { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; font-size: 0.85rem; color: var(--muted); }
.wk-tiers li { display: grid; grid-template-columns: 10px minmax(0, 1fr); gap: 8px; align-items: baseline; }
.wk-tiers li.now { color: var(--fg); }
.wk-tiers li.past { opacity: 0.6; }
.rar-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.rar-dot.r0 { background: #9FB3B8; } .rar-dot.r1 { background: #4F8BFF; } .rar-dot.r2 { background: #B07BFF; } .rar-dot.r3 { background: var(--solder); }
.wk .btn { margin-top: auto; }

/* ---------- Block gallery ---------- */
.items { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.item { display: flex; gap: 12px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; min-width: 0; }
.item canvas { width: 72px; height: 72px; flex: none; border-radius: 10px; background: var(--panel-2); }
.item div { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.item h3 { font-size: 1rem; letter-spacing: 0.03em; }
.item p { font-size: 0.88rem; color: var(--muted); }

/* ---------- Quests & events ---------- */
.quest-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0;
}
.panel h3 { font-size: 1.3rem; letter-spacing: 0.04em; }
.panel h4 { font-size: 0.95rem; letter-spacing: 0.04em; margin-top: 6px; }
.panel .muted { color: var(--muted); }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.tasks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.task-top { display: flex; justify-content: space-between; gap: 12px; font-size: 0.93rem; margin-bottom: 6px; }
.task-n { font-family: var(--f-mono); font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tasks li.done .task-n { color: var(--ok); }
.bar.thin { height: 6px; }
.tasks li.done .bar i { background: var(--ok); }
.tier-track { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.tier-track li {
  display: grid; grid-template-columns: 78px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--panel-2);
}
.tier-track li.got { border-color: rgba(126, 224, 160, 0.45); }
.tier-txt { font-size: 0.86rem; color: var(--muted); }
.tier-txt b { color: var(--fg); font-weight: 600; }
.medal {
  font: 700 0.78rem/1 var(--f-display); letter-spacing: 0.06em; text-align: center;
  padding: 8px 6px; border-radius: 8px; color: var(--solder-ink);
}
.medal.m0 { background: #D08A4E; }
.medal.m1 { background: #C9D4D8; }
.medal.m2 { background: #FFC94A; }
.crown-row { display: flex; gap: 14px; align-items: center; border-top: 1px solid var(--line); padding-top: 14px; }
.crown-row canvas { width: 96px; height: 96px; border-radius: 12px; background: var(--panel-2); flex: none; }
.crown-row strong { display: block; font-family: var(--f-display); font-size: 1.1rem; letter-spacing: 0.04em; }
.crown-row p { color: var(--muted); font-size: 0.9rem; margin-bottom: 8px; }
.ev-tiers { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 0.88rem; }
.ev-tiers li { display: flex; gap: 10px; color: var(--muted); }
.ev-tiers .tier-n { font-family: var(--f-mono); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); flex: none; width: 52px; padding-top: 2px; }
.ev-tiers li:last-child span:last-child { color: var(--fg); font-weight: 600; }
.ev-tiers li.got span:last-child { color: var(--ok); }
.ev-tiers li.got span:last-child::after { content: ' ✓'; }
.ev-status { font-size: 0.88rem; }
.ev-actions { display: flex; flex-direction: column; gap: 8px; margin-top: auto; }
.ev-actions:empty { display: none; }

/* ---------- Ad modal ---------- */
.admodal {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(4, 7, 9, 0.92);
  display: grid; place-items: center;
  padding: 16px;
}
.ad-card {
  width: 100%; max-width: 380px;
  background: var(--panel); border: 1px dashed var(--solder); border-radius: 16px;
  padding: 24px; display: flex; flex-direction: column; gap: 14px; text-align: center;
}
.ad-card p { color: var(--muted); }
.ad-count { font-family: var(--f-display); font-size: 3.4rem; line-height: 1; color: var(--solder); font-variant-numeric: tabular-nums; }

@media (max-width: 860px) {
  .play { grid-template-columns: minmax(0, 1fr); }
  .board-frame { margin-inline: auto; }
  .board-col .hint { text-align: center; }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tiers { grid-template-columns: minmax(0, 1fr); }
  .quest-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 480px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .steps { grid-template-columns: minmax(0, 1fr); }
  .hud { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---------- Menu tabs, settings, ranks, unlock timeline ---------- */
.top-tools { display: flex; gap: 8px; align-items: center; }
.icon-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
  color: var(--fg); font: 600 0.9rem/1 var(--f-body); padding: 9px 12px; cursor: pointer; min-height: 40px;
}
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:hover { border-color: var(--muted); }
.icon-btn:focus-visible { outline: 2px solid var(--solder); outline-offset: 2px; }
.icon-btn[aria-pressed="true"] .wave { display: none; }
.icon-btn[aria-pressed="true"] { color: var(--threat); }
.tabs {
  display: flex; gap: 6px; margin-top: 18px; overflow-x: auto; padding-bottom: 4px;
  scrollbar-width: thin; -webkit-overflow-scrolling: touch;
}
.tab {
  flex: none; background: transparent; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px; padding: 9px 14px;
  font: 600 0.9rem/1 var(--f-body); cursor: pointer; white-space: nowrap;
}
.tab:hover { color: var(--fg); border-color: var(--muted); }
.tab[aria-current="page"] { background: var(--solder); border-color: var(--solder); color: var(--solder-ink); }
.tab:focus-visible { outline: 2px solid var(--solder); outline-offset: 2px; }
.pilot-row .rank { display: block; font: 600 0.72rem/1.4 var(--f-mono); letter-spacing: 0.06em; color: var(--solder); text-transform: uppercase; }
.next-unlock { color: var(--solder); font-weight: 600; }
.char.locked { opacity: 0.6; }
.modal {
  position: fixed; inset: 0; z-index: 60; background: rgba(4, 7, 9, 0.85);
  display: flex; justify-content: center; align-items: flex-start; overflow-y: auto;
  padding-block: max(24px, env(safe-area-inset-top, 0px)) 24px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.modal-card {
  width: 100%; max-width: 460px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 20px; display: flex; flex-direction: column; gap: 18px; margin-block: auto;
}
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.modal-head h2 { font-size: 1.4rem; }
.set-group { display: flex; flex-direction: column; gap: 12px; border-top: 1px solid var(--line); padding-top: 14px; }
.set-group h3 { font: 600 0.72rem/1 var(--f-mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.set-row { display: grid; grid-template-columns: 120px minmax(0, 1fr) auto; gap: 12px; align-items: center; font-size: 0.95rem; }
.set-row input[type="range"] { width: 100%; accent-color: var(--solder); }
.set-row output { font: 600 0.8rem/1 var(--f-mono); color: var(--muted); min-width: 3.5em; text-align: right; font-variant-numeric: tabular-nums; }
.set-row select, .set-row input[type="number"] {
  background: var(--panel-2); color: var(--fg); border: 1px solid var(--line); border-radius: 8px; padding: 8px; font: inherit; grid-column: 2 / -1; width: 100%;
}
.set-group .btn { align-self: flex-start; }
.acct-group p { margin: 0; font-size: 0.95rem; overflow-wrap: anywhere; }
.acct-group .acct-note { color: var(--muted); font-size: 0.85rem; }
.acct-group a.btn { text-decoration: none; }
.unlock-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.unlock-list li {
  display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; align-items: baseline;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 0.9rem;
}
.unlock-list .ul-l { font: 600 0.78rem/1 var(--f-mono); color: var(--muted); font-variant-numeric: tabular-nums; grid-row: span 2; align-self: center; min-width: 6.5em; }
.unlock-list .ul-k { font: 600 0.66rem/1.2 var(--f-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.unlock-list li.got { border-color: rgba(126, 224, 160, 0.45); }
.unlock-list li.got .ul-l { color: var(--ok); }
.unlock-list li.got .ul-n::after { content: ' ✓'; color: var(--ok); }
@media (max-width: 480px) {
  .icon-btn span { display: none; }
  .set-row { grid-template-columns: 1fr auto; }
  .set-row input[type="range"] { grid-column: 1 / -1; grid-row: 2; }
  .set-row output { grid-row: 1; grid-column: 2; }
}

/* Spotlight tips: the screen darkens around something new, with a callout beside it. */
.spot { position: fixed; inset: 0; z-index: 45; cursor: pointer; }
.spot[hidden] { display: none; }
.spot-dim { position: absolute; inset: 0; width: 100%; height: 100%; }
.spot-ring { fill: none; stroke: #3FD0E8; stroke-width: 2.5; filter: drop-shadow(0 0 6px rgba(63, 208, 232, 0.8)); animation: spot-pulse 1.4s ease-in-out infinite; }
@keyframes spot-pulse { 0%, 100% { stroke-opacity: 1; } 50% { stroke-opacity: 0.45; } }
.spot.in .spot-dim, .spot.in .spot-bubble, .spot-bubble.pop { animation: spot-in 0.25s ease-out; }
@keyframes spot-in { from { opacity: 0; } to { opacity: 1; } }
.spot-bubble {
  position: absolute; cursor: default;
  width: min(330px, calc(100vw - 24px));
  max-height: calc(100vh - 24px); overflow-y: auto;
  background: var(--panel); border: 1px solid #3FD0E8; border-radius: 14px;
  padding: 16px 18px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  display: flex; flex-direction: column; gap: 8px;
}
.spot-bubble h3 { font-size: 1.25rem; margin: 0; }
.spot-bubble p { margin: 0; line-height: 1.45; }
.spot-how { color: var(--fg); }
.spot-how b { color: var(--solder); }
.spot-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.spot-arrow { position: absolute; width: 14px; height: 14px; background: var(--panel); border: 1px solid #3FD0E8; transform: rotate(45deg); }
.spot-bubble[data-side="below"] .spot-arrow { top: -8px; margin-left: -7px; border-right: 0; border-bottom: 0; }
.spot-bubble[data-side="above"] .spot-arrow { bottom: -8px; top: auto !important; margin-left: -7px; border-left: 0; border-top: 0; }
.spot-bubble[data-side="right"] .spot-arrow { left: -8px !important; margin-top: -7px; border-right: 0; border-top: 0; }
.spot-bubble[data-side="left"] .spot-arrow { right: -8px; left: auto !important; margin-top: -7px; border-left: 0; border-bottom: 0; }
.spot-bubble[data-side="over"] .spot-arrow { display: none; }
@media (prefers-reduced-motion: reduce) {
  .spot-ring, .spot.in .spot-dim, .spot.in .spot-bubble, .spot-bubble.pop { animation: none; }
}
html.reduce-motion .spot-ring, html.reduce-motion .spot.in .spot-dim, html.reduce-motion .spot.in .spot-bubble,
html.reduce-motion .spot-bubble.pop, html.reduce-motion .pm-sheet { animation: none; }
/* Toasts stay readable above an open card (the card layer covers the screen in play mode) and above
   an open spotlight. The spotlight rule comes second so it wins when both are up. */
body.ov-up #toast, body.spot-open #toast { width: max-content; max-width: min(90vw, 560px); }
body.ov-up #toast { position: fixed; z-index: 32; top: max(12px, env(safe-area-inset-top, 0px)); }
/* Toasts stay readable above an open spotlight. */
body.spot-open #toast { position: fixed; z-index: 46; top: max(12px, env(safe-area-inset-top, 0px)); }

/* ---------- Full-screen play mode ----------
   Phones, tablets, the installed app, and the "Full-screen mode" button use an app layout:
   the board fills the screen, with a compact top bar, a power-up bar and the menus behind a button. */
.pm-only { display: none; }
.ad-short { display: none; }
body.playmode { overflow: hidden; overscroll-behavior: none; }
body.playmode .top, body.playmode .tabs, body.playmode .foot { display: none; }
body.playmode .wrap { padding: 0; max-width: none; }
body.playmode #play {
  position: fixed; inset: 0; z-index: 20; margin: 0;
  height: 100vh; height: 100dvh;
  background-color: var(--ink);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 32px 32px;
  padding: max(8px, env(safe-area-inset-top, 0px)) max(10px, env(safe-area-inset-right, 0px)) max(8px, env(safe-area-inset-bottom, 0px)) max(10px, env(safe-area-inset-left, 0px));
  display: grid; gap: 8px 10px; align-items: center;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  grid-template-areas: "menu stats fs" "goals goals goals" "stars stars stars" "board board board" "powers powers ad";
}
body.playmode .pm-only { display: inline-flex; }
body.playmode .pm-menu-btn { grid-area: menu; justify-self: start; }
body.playmode .pm-fs-btn { grid-area: fs; justify-self: end; }
body.playmode .pm-only { padding: 8px; min-height: 40px; min-width: 40px; justify-content: center; }
.pm-fs-btn .fs-out, .pm-fs-btn[aria-pressed="true"] .fs-in { display: none; }
/* How to play does nothing while a result or tip card is up, so it looks it. */
#helpBtn[aria-disabled="true"] { opacity: 0.45; cursor: default; filter: saturate(0.4); }
.pm-fs-btn[aria-pressed="true"] .fs-out { display: inline; }
.pm-fs-btn[aria-pressed="true"] { color: var(--fg); }
body.playmode .hud { display: contents; }
body.playmode .board-col { grid-area: board; display: flex; align-items: center; justify-content: center; min-height: 0; min-width: 0; height: 100%; overflow: hidden; }
body.playmode .board-frame { width: auto; max-width: none; flex: none; }
body.playmode .hint, body.playmode .pilot-row, body.playmode .wallet, body.playmode .proto,
body.playmode .goals-box .prog-top, body.playmode .powers-box .prog-top, body.playmode .threat { display: none; }
/* Top bar */
body.playmode .stats { grid-area: stats; display: flex; justify-content: center; gap: 4px 16px; min-width: 0; }
body.playmode .stats div { align-items: center; gap: 0; min-width: 0; }
body.playmode .stats .eyebrow { font-size: 0.58rem; letter-spacing: 0.1em; }
body.playmode .stats b { font-size: 1.15rem; }
/* Goals as chips */
body.playmode .goals-box { grid-area: goals; min-width: 0; }
body.playmode .goals { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 6px; }
body.playmode .goal { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; font-size: 0.78rem; line-height: 1.2; }
body.playmode .goal.done { border-color: rgba(126, 224, 160, 0.5); }
body.playmode .goal .bar { display: none; }
/* Star meter as a thin line */
body.playmode #starBar { grid-area: stars; display: flex; align-items: center; gap: 10px; min-width: 0; }
body.playmode #starBar .prog-top { margin: 0; }
body.playmode #starBar .prog-top .eyebrow { display: none; }
body.playmode #starBar .stars-sm { font-size: 0.85rem; }
body.playmode #starBar .bar { flex: 1; height: 6px; }
body.playmode #starBar .tick { top: -3px; height: 12px; }
/* Power-up bar */
body.playmode .powers-box { grid-area: powers; min-width: 0; }
body.playmode .powers { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px 1px; }
body.playmode .powers::-webkit-scrollbar { display: none; }
body.playmode .pw { flex: 0 0 auto; min-width: 68px; padding: 7px 8px 6px; gap: 3px; justify-items: center; text-align: center; font-size: 0.68rem; white-space: nowrap; }
body.playmode .pw .rar { display: none; }
body.playmode .pw .pwi { width: 26px; height: 26px; margin: -3px; }
body.playmode .pw .ct { top: 3px; right: 3px; font-size: 0.6rem; padding: 2px 4px; }
body.playmode #adBtn { grid-area: ad; padding: 8px 10px; font-size: 0.75rem; line-height: 1.15; align-self: stretch; }
body.playmode .ad-full { display: none; }
body.playmode .ad-short { display: inline; }
.ad-short small { display: block; color: var(--muted); font-size: 0.68rem; }

/* Landscape: side columns around the board (iPad landscape, phones on their side, desktop). */
@media (min-aspect-ratio: 6/5) {
  body.playmode #play {
    --pm-side: 150px;
    grid-template-columns: minmax(var(--pm-side), 1fr) auto minmax(var(--pm-side), 1fr);
    grid-template-rows: auto auto auto auto minmax(0, 1fr) auto;
    grid-template-areas: "menu board fs" "stats board powers" "goals board powers" "stars board powers" "threat board powers" ". board ad";
    align-items: start; gap: 12px 18px;
  }
  body.playmode .board-col { grid-row: 1 / -1; align-self: stretch; }
  body.playmode .stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; justify-items: start; }
  body.playmode .stats div { align-items: flex-start; }
  body.playmode .stats b { font-size: 1.4rem; }
  body.playmode .goals-box .prog-top { display: flex; }
  body.playmode .goals { flex-direction: column; flex-wrap: nowrap; }
  body.playmode .goal { display: grid; background: none; border: 0; padding: 0; border-radius: 0; font-size: 0.85rem; }
  body.playmode .goal .bar { display: block; }
  body.playmode .threat { display: block; grid-area: threat; font-size: 0.82rem; padding: 8px 10px; }
  body.playmode .powers-box { align-self: start; }
  body.playmode .powers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: visible; }
  body.playmode .pw { min-width: 0; }
  body.playmode #adBtn { align-self: end; }
}
/* Tall landscape screens with a big board leave narrow side columns (a 940x700 window): one power-up
   per row there, so the full names never spill into the next button. Short phones keep two columns. */
@media (min-aspect-ratio: 6/5) and (min-height: 561px) {
  body.playmode .powers-box { container-type: inline-size; }
  @container (max-width: 200px) {
    body.playmode .powers { grid-template-columns: minmax(0, 1fr); }
  }
}
/* Short landscape screens (phones on their side): keep the side columns compact. */
@media (min-aspect-ratio: 6/5) and (max-height: 560px) {
  body.playmode #play { gap: 6px 12px; grid-template-areas: "menu board fs" "stats board powers" "goals board powers" "stars board powers" ". board powers" ". board ad"; }
  body.playmode .threat, body.playmode .goals-box .prog-top { display: none; }
  body.playmode .stats b { font-size: 1.05rem; }
  body.playmode .stats { gap: 4px 10px; }
  body.playmode .goal { font-size: 0.74rem; gap: 2px 8px; }
  body.playmode .goal .bar { display: none; }
  body.playmode .pw { padding: 5px 6px; }
  body.playmode .pw span:not(.ct) { font-size: 0.62rem; }
}

/* Menu sheet */
.pm-menu { position: fixed; inset: 0; z-index: 40; background: rgba(4, 7, 9, 0.72); display: flex; }
.pm-sheet {
  width: min(360px, 100%); height: 100%; overflow-y: auto;
  background: var(--panel); border-right: 1px solid var(--line);
  padding: max(18px, env(safe-area-inset-top, 0px)) 18px max(18px, env(safe-area-inset-bottom, 0px)) max(18px, env(safe-area-inset-left, 0px));
  display: flex; flex-direction: column; gap: 14px;
  animation: pm-in 0.22s ease-out;
}
@keyframes pm-in { from { transform: translateX(-24px); opacity: 0; } to { transform: none; opacity: 1; } }
.pm-head { display: flex; justify-content: space-between; align-items: center; }
.pm-head h2 { font-size: 1.4rem; letter-spacing: 0.06em; }
.pm-who { color: var(--muted); font-size: 0.9rem; }
.pm-who b { color: var(--fg); }
.pm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.pm-grid .btn { text-align: left; justify-content: flex-start; }
.pm-tip { font-size: 0.85rem; color: var(--muted); border-left: 2px solid var(--solder); padding-left: 10px; }
@media (prefers-reduced-motion: reduce) { .pm-sheet { animation: none; } }

/* Menu pages on phones and tablets: keep the tab strip on screen so Play is one tap away. */
@media (max-width: 900px), (pointer: coarse) {
  .tabs { position: sticky; top: 0; z-index: 10; background: var(--ink); margin-inline: -16px; padding: 8px 16px; }
}

/* Play mode on phones: every power-up fits on one row, and the ad button shrinks to an icon. */
@media (max-width: 480px) and (max-aspect-ratio: 6/5) {
  body.playmode .powers { overflow: visible; }
  body.playmode .pw { flex: 1 1 0; min-width: 0; padding: 7px 4px 6px; }
  body.playmode .pw span:not(.ct) { font-size: 0.6rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  body.playmode #adBtn { width: 58px; padding: 6px 4px; font-size: 0.7rem; }
  body.playmode .ad-short .ad-word { display: none; }
}
/* Play mode on tablets: scale the bars up to suit the bigger screen. */
@media (min-width: 700px) and (min-height: 700px) {
  body.playmode .stats .eyebrow { font-size: 0.7rem; }
  body.playmode .stats b { font-size: 1.6rem; }
  body.playmode .goal { font-size: 0.95rem; }
  body.playmode .pw { min-width: 100px; padding: 10px 10px 8px; font-size: 0.82rem; gap: 5px; }
  body.playmode .pw .pwi { width: 32px; height: 32px; margin: -4px; }
  body.playmode .pw .ct { font-size: 0.72rem; }
  body.playmode #adBtn { font-size: 0.85rem; }
  body.playmode .pm-only { min-height: 48px; min-width: 48px; }
  body.playmode .threat { font-size: 0.95rem; }
}
@media (min-aspect-ratio: 6/5) and (min-width: 1000px) and (min-height: 700px) {
  body.playmode .stats b { font-size: 1.9rem; }
  body.playmode .goal { font-size: 1rem; }
  body.playmode .pw { min-width: 0; }
}
.pw-short { display: none; }
@media (max-width: 480px) and (max-aspect-ratio: 6/5) {
  body.playmode .pw-full { display: none; }
  body.playmode .pw-short { display: inline; }
}

/* Level tiers and timed levels */
.tier { display: inline-block; font: 700 0.6rem/1 var(--f-mono); letter-spacing: 0.08em; text-transform: uppercase; padding: 3px 6px; border-radius: 999px; vertical-align: middle; margin-left: 4px; }
.tier.t-easy { background: rgba(126, 224, 160, 0.16); color: var(--ok); }
.tier.t-medium { background: rgba(143, 166, 171, 0.16); color: var(--muted); }
.tier.t-hard { background: rgba(255, 77, 109, 0.18); color: #FF8DA2; }
.tier.t-timed { background: rgba(63, 208, 232, 0.16); color: #8FE3FF; }
.tier.t-tide { background: rgba(255, 77, 109, 0.18); color: #FF8DA2; }
.threat .tide-line { display: block; margin-top: 4px; color: #FF8DA2; }
.tier-line .tier { margin: 0 6px 0 0; }
.tier-line { font-size: 0.9rem; color: var(--muted); }
#moves.low { color: var(--threat); }
.hard-reward, .ov-card .unlock.hard-reward { color: #FF8DA2; }
.move-reward, .ov-card .unlock.move-reward { color: #7EE0A0; }
/* Finale: leftover moves fly from the moves counter into the power-up buttons. */
.mv-fly { position: fixed; z-index: 60; width: 18px; height: 18px; border-radius: 50%; pointer-events: none; will-change: transform, opacity;
  background: radial-gradient(circle at 40% 35%, #FFFFFF 0 18%, #9FF5C0 40%, #3FD07A 70%, rgba(63, 208, 122, 0) 72%);
  box-shadow: 0 0 10px 3px rgba(126, 224, 160, 0.75); }
.pw-plus { position: fixed; z-index: 61; pointer-events: none; font: 800 1.1rem/1 Tektur, Barlow, sans-serif; color: #9FF5C0; text-align: center; white-space: nowrap; box-sizing: border-box;
  padding: 3px 5px 4px; border-radius: 8px; background: rgba(8, 12, 15, 0.82); border: 1px solid rgba(126, 224, 160, 0.55);
  text-shadow: 0 0 8px rgba(63, 208, 122, 0.9), 0 1px 2px #000; will-change: transform, opacity; }
.pw-plus small { display: block; margin-top: 2px; white-space: normal; line-height: 1.1; font: 700 0.62rem/1 Barlow, system-ui, sans-serif; letter-spacing: 0.04em; color: #D8FFE6; text-shadow: none; }
.node.t-hard { box-shadow: inset 0 -3px 0 var(--threat); }
.node.t-easy { box-shadow: inset 0 -3px 0 rgba(126, 224, 160, 0.7); }
.node.timed::after { content: '⏱'; position: absolute; top: -9px; right: -7px; font-size: 0.75rem; line-height: 1; }
.node { position: relative; }
body.playmode .stats .tier { font-size: 0.5rem; padding: 2px 4px; margin-left: 2px; }
.node.t-hard:not(.boss):not(.gate) .n::before { content: 'HARD '; font-size: 0.5rem; letter-spacing: 0.08em; display: block; color: #FF8DA2; margin-bottom: 2px; }

/* ---------- HUD look (play mode goal chips): colour and depth only, layout stays in the play-mode block ---------- */
body.playmode .goal {
  background: linear-gradient(180deg, #17252B, var(--panel));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 2px 6px -3px rgba(0, 0, 0, 0.6);
}
body.playmode .goal.done {
  background: linear-gradient(180deg, rgba(126, 224, 160, 0.14), rgba(126, 224, 160, 0.05));
  box-shadow: inset 0 1px 0 rgba(126, 224, 160, 0.15), 0 0 10px rgba(126, 224, 160, 0.12);
}
@media (min-aspect-ratio: 6/5) {
  body.playmode .goal, body.playmode .goal.done { background: none; box-shadow: none; }
}

/* Overdrive Beam button: shown when the tank is full. */
.pw.od { border-color: #5AB8FF; background: linear-gradient(180deg, rgba(42,140,255,.28), rgba(22,54,200,.22)); box-shadow: 0 0 14px rgba(90,184,255,.45); }
.pw.od .rar { color: #8FDCFF; }
.pw.od.active { border-color: #CFF3FF; box-shadow: 0 0 20px rgba(143,220,255,.75); }
/* The Overdrive button takes its pilot's colour (VOLT-7 keeps the blue above). */
.pw.od[data-pilot="nova"] { --pc: #FFB27A; --odg: rgba(255,138,77,.8); border-color: #FF8A4D; background: linear-gradient(180deg, rgba(255,138,77,.3), rgba(184,54,26,.22)); box-shadow: 0 0 14px rgba(255,138,77,.45); }
.pw.od[data-pilot="prism"] { --pc: #DCC4FF; --odg: rgba(196,155,255,.8); border-color: #C49BFF; background: linear-gradient(180deg, rgba(196,155,255,.3), rgba(106,63,200,.22)); box-shadow: 0 0 14px rgba(196,155,255,.45); }
.pw.od[data-pilot="echo"] { --pc: #9FF0FF; --odg: rgba(63,208,232,.85); border-color: #3FD0E8; background: linear-gradient(180deg, rgba(63,208,232,.3), rgba(20,90,140,.24)); box-shadow: 0 0 14px rgba(63,208,232,.45); }
.pw.od[data-pilot="nova"] .rar { color: #FFC8A0; } .pw.od[data-pilot="prism"] .rar { color: #E2D0FF; } .pw.od[data-pilot="echo"] .rar { color: #A6F2FF; }
html:not(.reduce-motion) .pw.od:not(:disabled) { animation: od-glow 1.2s ease-in-out infinite; }
@keyframes od-glow { 50% { box-shadow: 0 0 22px var(--odg, rgba(90,184,255,.8)); } }

/* ---------- Power-up illustrations (SVG pictures from PW_ART in game.js) ----------
   Idle: a soft halo pulse behind the picture while a power-up has charges. It is the button's ::before
   and animates opacity only, so the compositor runs it with no style or layout work per frame
   (transform/opacity on SVG children is not composited, so those loops are kept to the armed button).
   Armed (.active): an action loop that shows what it does. Fire (.fire, ~0.55 s): flash, sparks and a
   badge bump when a charge is spent. html.reduce-motion turns the loops off. */
.pwi { display: block; flex: none; overflow: visible; }
.pwi .a-glow { opacity: 0.7; transform-box: fill-box; transform-origin: center; }
.pwi .a-fx { opacity: 0; pointer-events: none; }
.pwi .a-pt { fill: var(--pc); }
.pwi .a-pt.w { fill: #FFF; }
.pwi .a-flash, .pwi .a-shock { transform-origin: 16px 16px; }
.pwi .a-shock { stroke: var(--pc); }
.pwi .a-tw { transform-box: fill-box; transform-origin: center; }
.pwi-laser .a-beam { transform-origin: 14.2px 16px; }
.pwi-bomb .a-core, .pwi-bomb .a-spark { transform-box: fill-box; transform-origin: center; }
.pwi-morph .a-rainbow { transform-origin: 16.2px 15.6px; }
.pwi-emp .a-ring { transform-origin: 16px 13px; }
.pwi-od .a-oring, .pwi-od .a-orb { transform-origin: 10.5px 16px; }
.pwi-od .a-obeam { transform-origin: 11px 16px; }
.pwi-odp .a-oring, .pwi-odp .a-orb { transform-origin: 16px 16px; }
.pw[data-id="laser"] { --pc: #FFB547; } .pw[data-id="bomb"] { --pc: #FF5FA2; } .pw[data-id="morph"] { --pc: #B07BFF; }
.pw[data-id="swap"] { --pc: #5CF29A; } .pw[data-id="emp"] { --pc: #3FD0E8; } .pw[data-id="od"] { --pc: #8FDCFF; } #adBtn { --pc: #FFC870; }
/* The idle halo sits above the button's background and below its content (isolation + z-index -1).
   --gx/--gy put it on the picture in each layout. */
.pw, #adBtn { isolation: isolate; }
#adBtn { position: relative; }
.pw::before, #adBtn::before {
  content: ''; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none; opacity: 0;
  background: radial-gradient(circle 22px at var(--gx, 21px) var(--gy, 21px), var(--pc), transparent);
}
#adBtn::before { background: radial-gradient(closest-side, var(--pc), transparent); }
body.playmode .pw { --gx: 50%; --gy: 17px; }
/* Empty: no loop, a little washed out. Locked: a grey silhouette (the 'Lv N' tag stays). */
.pw:disabled .pwi { filter: saturate(0.45); }
.pw:disabled .a-glow { opacity: 0.2; }
.pw.locked .pwi { filter: grayscale(1) brightness(1.15); }
.pw.fire:disabled .pwi { filter: none; }
.pw.locked .a-glow { opacity: 0; }
.pw.active .a-glow { opacity: 1; }
/* The ad button's supply crate */
#adBtn .pwi { display: inline-block; vertical-align: middle; width: 30px; height: 30px; margin: -8px 8px -8px -4px; }
#adBtn:disabled .pwi { filter: grayscale(1) brightness(0.8); }
#adBtn.fire:disabled .pwi { filter: none; }
#adBtn:disabled .a-glow { opacity: 0; }
/* Play mode: the crate sits beside the two text lines (a flex row), never under the second one. */
body.playmode #adBtn { display: flex; align-items: center; justify-content: center; }
body.playmode #adBtn .pwi { width: 24px; height: 24px; margin: -6px 4px -6px -2px; }
/* Phone portrait: the bar is tight, so the count badge sits on the button's corner, clear of the picture. */
/* Phone portrait: the ad button is narrow, so the crate sits above its '+1 0/3' line. */
@media (max-width: 480px) and (max-aspect-ratio: 6/5) {
  body.playmode .pw .ct { top: -7px; right: -2px; z-index: 1; }
  body.playmode #adBtn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 3px 2px; }
  body.playmode #adBtn .pwi { width: 22px; height: 22px; margin: -2px 0 0; }
  body.playmode #adBtn .ad-short { display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; column-gap: 3px; line-height: 1.1; }
  body.playmode #adBtn .ad-short small { display: inline; font-size: 0.62rem; }
}
@media (min-width: 700px) and (min-height: 700px) {
  body.playmode #adBtn .pwi { width: 30px; height: 30px; margin: -8px 6px -8px -2px; }
  body.playmode .pw { --gy: 22px; }
}
@media (min-aspect-ratio: 6/5) and (max-height: 560px) { body.playmode .pw { --gy: 15px; } }
/* Power-ups tables: icon + name pairs; a combo's '+' sits centred between them. */
.tbl-pw { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; vertical-align: middle; }
.tbl-pw .pwi { width: 28px; height: 28px; }
.tbl-combo { display: inline-flex; align-items: center; gap: 4px 10px; vertical-align: middle; }
.tbl-plus { font-weight: 600; color: var(--muted); line-height: 1; }
.tbl-vs span { display: block; }
.tbl-vs .vs-combo { color: #7EE0A0; font-weight: 600; }
.tbl-vs .vs-solo { color: var(--muted); margin-top: 4px; }
/* Combo table: 4 columns on wide screens; below 960px the power-ups and the comparison move
   inside the name and description cells (2 columns, no sideways scroll). */
#comboTable .cb-narrow { display: none; }
@media (max-width: 959px) {
  #comboTable .cb-wide { display: none; }
  #comboTable .cb-narrow { display: block; }
  #comboTable td.name { white-space: normal; width: 34%; }
  #comboTable .cb-pws { margin-top: 8px; font-weight: 400; font-size: 0.86rem; }
  #comboTable .cb-pws .tbl-combo { flex-direction: column; align-items: flex-start; gap: 4px; }
  #comboTable .cb-pws .tbl-pw { white-space: normal; gap: 6px; }
  #comboTable .cb-pws .tbl-pw .pwi { width: 22px; height: 22px; flex: none; }
  #comboTable .cb-pws .tbl-plus { width: 22px; text-align: center; }
  #comboTable .tbl-vs.cb-narrow { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
}
@media (max-width: 480px) {
  .tbl-pw { gap: 6px; }
  .tbl-combo .tbl-pw { white-space: normal; }
  .tbl-pw .pwi { width: 20px; height: 20px; }
  .tbl-combo { flex-direction: column; align-items: flex-start; }
  .tbl-plus { width: 20px; text-align: center; }
}

html:not(.reduce-motion) .pw:not(:disabled):not(.active)::before { animation: pwi-halo 2.6s ease-in-out var(--pd, 0s) infinite; }
html:not(.reduce-motion) #adBtn:not(:disabled)::before { animation: pwi-halo-ad 2.6s ease-in-out infinite; }
@keyframes pwi-halo { 0%, 100% { opacity: 0; } 50% { opacity: 0.42; } }
@keyframes pwi-halo-ad { 0%, 100% { opacity: 0; } 50% { opacity: 0.2; } }
@keyframes pwi-glow { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }

/* Armed: each picture acts out its power. */
html:not(.reduce-motion) .pw.active .a-glow { animation: pwi-glow-a 0.9s ease-in-out infinite; }
html:not(.reduce-motion) .pw.active .a-tw { animation: pwi-spin 1.2s linear infinite; }
html:not(.reduce-motion) .pw.active .pwi-laser .a-beam { animation: pwi-sweep 1.1s ease-in-out infinite alternate; }
html:not(.reduce-motion) .pw.active .pwi-bomb .a-core { animation: pwi-throb 0.6s ease-in-out infinite; }
html:not(.reduce-motion) .pw.active .pwi-bomb .a-spark { animation: pwi-sparkle 0.32s linear infinite; }
html:not(.reduce-motion) .pw.active .pwi-morph .a-rainbow { animation: pwi-fan 1.4s ease-in-out infinite alternate; }
html:not(.reduce-motion) .pw.active .pwi-morph .a-band { animation: pwi-band 1.1s ease-in-out calc(var(--i) * -0.18s) infinite; }
html:not(.reduce-motion) .pw.active .pwi-swap .a-ba { animation: pwi-swap-a 1.8s ease-in-out infinite; }
html:not(.reduce-motion) .pw.active .pwi-swap .a-bb { animation: pwi-swap-b 1.8s ease-in-out infinite; }
html:not(.reduce-motion) .pw.active .pwi-swap .a-arr { animation: pwi-glow 0.9s ease-in-out infinite; }
html:not(.reduce-motion) .pw.active .pwi-emp .a-ring { animation: pwi-ring 1.2s ease-out infinite; }
html:not(.reduce-motion) .pw.active .pwi-emp .a-r2 { animation-delay: -0.4s; }
html:not(.reduce-motion) .pw.active .pwi-emp .a-r3 { animation-delay: -0.8s; }
html:not(.reduce-motion) .pw.active .pwi-od .a-oring { animation: pwi-spin 1.1s linear infinite; }
html:not(.reduce-motion) .pw.active .pwi-od .a-orb { animation: pwi-charge 0.7s ease-in-out infinite alternate; }
html:not(.reduce-motion) .pw.active .pwi-od .a-obeam { animation: pwi-beam 1.4s ease-in infinite; }
html:not(.reduce-motion) .pw.active .pwi-odp .a-flick { animation: pwi-flick 0.9s steps(1) infinite; }
@keyframes pwi-flick { 0%, 100% { opacity: 1; } 40% { opacity: 0.35; } 55% { opacity: 1; } 70% { opacity: 0.6; } }
@keyframes pwi-glow-a { 0%, 100% { opacity: 0.7; transform: scale(0.95); } 50% { opacity: 1; transform: scale(1.12); } }
@keyframes pwi-spin { to { transform: rotate(360deg); } }
@keyframes pwi-sweep { from { transform: rotate(-17deg); } to { transform: rotate(17deg); } }
@keyframes pwi-throb { 0%, 100% { transform: scale(0.78); opacity: 0.75; } 50% { transform: scale(1.22); opacity: 1; } }
@keyframes pwi-sparkle { 0% { transform: scale(0.8) rotate(0deg); } 50% { transform: scale(1.35) rotate(45deg); } 100% { transform: scale(0.8) rotate(90deg); } }
@keyframes pwi-fan { from { transform: rotate(-7deg) scaleY(0.9); } to { transform: rotate(6deg) scaleY(1.1); } }
@keyframes pwi-band { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }
@keyframes pwi-swap-a { 0%, 15% { transform: none; opacity: 1; } 32% { opacity: 0.45; } 50%, 65% { transform: translate(14.2px, 14.2px); opacity: 1; } 82% { opacity: 0.45; } 100% { transform: none; opacity: 1; } }
@keyframes pwi-swap-b { 0%, 15% { transform: none; opacity: 1; } 32% { opacity: 0.45; } 50%, 65% { transform: translate(-14.2px, -14.2px); opacity: 1; } 82% { opacity: 0.45; } 100% { transform: none; opacity: 1; } }
@keyframes pwi-ring { 0% { transform: scale(0.45); opacity: 0; } 20% { opacity: 1; } 100% { transform: scale(1.3); opacity: 0; } }
@keyframes pwi-charge { from { transform: scale(0.84); } to { transform: scale(1.14); } }
@keyframes pwi-beam { 0% { transform: scaleX(0.15); opacity: 0.3; } 70% { transform: scaleX(1); opacity: 1; } 100% { transform: scaleX(1.05); opacity: 0.2; } }

/* Fire: a flash, sparks and a badge bump (and a tiny button shake if screen shake is on). */
.pw.fire, #adBtn.fire { animation: pwi-btn 0.55s ease-out; }
.pw.fire.shk, #adBtn.fire.shk { animation-name: pwi-btn-shk; }
.fire .pwi .a-fx { opacity: 1; }
.fire .pwi .a-flash { animation: pwi-flash 0.5s ease-out both; }
.fire .pwi .a-shock { animation: pwi-shock 0.5s cubic-bezier(0.2, 0.7, 0.3, 1) both; }
html.reduce-motion .fire .pwi .a-flash { animation-name: pwi-fade; }
html.reduce-motion .fire .pwi .a-pt, html.reduce-motion .fire .pwi .a-shock { display: none; }
html:not(.reduce-motion) .fire .pwi .a-pt { animation: pwi-pt 0.55s cubic-bezier(0.2, 0.7, 0.3, 1) both; }
html:not(.reduce-motion) .pw.fire .pwi, html:not(.reduce-motion) #adBtn.fire .pwi { animation: pwi-pop 0.45s cubic-bezier(0.3, 1.5, 0.5, 1); }
html:not(.reduce-motion) .pw.fire .ct, html:not(.reduce-motion) .pw.gain .ct { animation: pwi-bump 0.45s cubic-bezier(0.3, 1.6, 0.5, 1); }
.pw.gain .ct { border-color: var(--pc); }
@keyframes pwi-btn { 0% { opacity: 1; border-color: #fff; box-shadow: 0 0 0 2px var(--pc), 0 0 22px var(--pc); } 70% { opacity: 1; } }
@keyframes pwi-btn-shk {
  0% { opacity: 1; border-color: #fff; box-shadow: 0 0 0 2px var(--pc), 0 0 22px var(--pc); transform: translateX(0); }
  15% { transform: translateX(-1.5px); } 30% { transform: translateX(1.5px); } 45% { transform: translateX(-1px); } 60% { transform: translateX(0.5px); } 70% { opacity: 1; } 75% { transform: none; }
}
@keyframes pwi-flash { 0% { opacity: 1; transform: scale(0.3); } 100% { opacity: 0; transform: scale(1.4); } }
@keyframes pwi-shock { 0% { opacity: 1; transform: scale(0.25); } 55% { opacity: 0.85; } 100% { opacity: 0; transform: scale(1.5); } }
@keyframes pwi-fade { 0% { opacity: 1; } 100% { opacity: 0; } }
@keyframes pwi-pt { 0% { transform: translate(0, 0) scale(1.4); opacity: 1; } 60% { opacity: 1; } 100% { transform: translate(var(--dx), var(--dy)) scale(0.3); opacity: 0; } }
@keyframes pwi-pop { 0% { transform: scale(1); } 30% { transform: scale(1.28); } 100% { transform: scale(1); } }
@keyframes pwi-bump { 0% { transform: scale(1); } 35% { transform: scale(1.5); } 100% { transform: scale(1); } }

/* ---------- Intro story (a full-screen layer above everything, on a 400×720 stage scaled by --k) ---------- */
body.intro-open { overflow: hidden; }
.intro {
  position: fixed; inset: 0; z-index: 1000; background: #000; overflow: hidden; outline: none;
  touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
  --k: 1; --ox: 0px; --oy: 0px; opacity: 1; transition: opacity 0.25s ease;
}
.intro.out { opacity: 0; }
.intro canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.intro-skip {
  position: absolute; z-index: 3;
  top: max(12px, env(safe-area-inset-top, 0px)); right: max(12px, env(safe-area-inset-right, 0px));
  min-height: 40px; padding: 0 16px; border-radius: 999px; cursor: pointer;
  font: 600 14px/1 var(--f-body); letter-spacing: 0.02em; color: var(--fg);
  background: rgba(8, 14, 18, 0.62); border: 1px solid rgba(226, 237, 239, 0.28);
}
.intro-skip:hover { border-color: rgba(226, 237, 239, 0.6); }
.intro-skip:focus-visible, .intro .btn:focus-visible { outline: 2px solid var(--solder); outline-offset: 2px; }
.intro-dots {
  position: absolute; z-index: 3; display: flex; gap: 7px; align-items: center; pointer-events: none;
  top: calc(max(12px, env(safe-area-inset-top, 0px)) + 20px); left: max(16px, env(safe-area-inset-left, 0px)); transform: translateY(-50%);
}
.intro-dots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(226, 237, 239, 0.22); transition: background 0.2s, transform 0.2s; }
.intro-dots i.done { background: rgba(143, 227, 255, 0.55); }
.intro-dots i.on { background: #8FE3FF; transform: scale(1.35); box-shadow: 0 0 8px rgba(143, 227, 255, 0.8); }
.intro-cap {
  position: absolute; z-index: 2; left: 50%; top: calc(var(--oy) + var(--k) * 640px); transform: translate(-50%, -50%);
  width: min(calc(100vw - 32px), max(calc(var(--k) * 400px), 360px)); pointer-events: none;
  text-align: center; color: #fff; font: 600 max(15px, calc(var(--k) * 22px))/1.25 var(--f-display);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.9), 0 0 14px rgba(0, 0, 0, 0.7);
}
.intro-cap .cap { margin: 0; transition: opacity 0.2s; }
/* Small stages: the closing line also shows as a caption, sitting on top of the dock (stage y 486),
   wide enough on landscape phones to stay on one line below the chips. */
.intro-cap.end { top: auto; bottom: calc(100% - var(--oy) - var(--k) * 486px + 8px); transform: translateX(-50%); width: min(calc(100vw - 32px), 560px); }
.intro-cap .cap.gone { position: absolute; inset: 0; opacity: 0; }
.intro-cap .w { display: inline-block; opacity: 0; transform: scale(0.6); animation: intro-word 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards; }
.intro-cap .now, .intro-cap .now .sw { animation: none; opacity: 1; transform: none; }
@keyframes intro-word { to { opacity: 1; transform: none; } }
@keyframes intro-fade { from { opacity: 0; } to { opacity: 1; } }
.intro-cap .slam {
  display: inline-block; margin-top: 4px; font-size: max(20px, calc(var(--k) * 30px)); line-height: 1.1;
  background: linear-gradient(180deg, #EAF8FF, #5AB8FF 55%, #1636C8); -webkit-background-clip: text; background-clip: text;
  color: transparent; -webkit-text-stroke: 1px #fff; text-shadow: none;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.8)) drop-shadow(0 0 10px rgba(90, 184, 255, 0.75));
  opacity: 0; transform: scale(1.6); animation: intro-slam 0.18s ease-out forwards;
}
@keyframes intro-slam { to { opacity: 1; transform: none; } }
.intro-cap .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.intro-gate {
  position: absolute; z-index: 2; left: 0; right: 0; top: calc(var(--oy) + var(--k) * 470px); transform: translateY(-50%);
  margin: 0; text-align: center; pointer-events: none; color: #FFD9A0;
  font: 600 max(13px, calc(var(--k) * 13px)) var(--f-mono); letter-spacing: 0.2em; text-transform: uppercase;
  animation: intro-pulse 1.25s ease-in-out infinite;
}
@keyframes intro-pulse { 50% { opacity: 0.35; } }
.intro-chips {
  position: absolute; z-index: 2; left: 50%; top: calc(var(--oy) + var(--k) * 294px); transform: translateX(-50%);
  width: min(calc(100vw - 32px), max(calc(var(--k) * 380px), 300px)); display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
  animation: intro-fade 0.4s ease-out both;
}
.intro-chip {
  font: 600 max(11px, calc(var(--k) * 12px))/1 var(--f-mono); letter-spacing: 0.06em; text-transform: uppercase;
  color: #CFE8EE; background: rgba(8, 16, 22, 0.78); border: 1px solid rgba(143, 227, 255, 0.32); border-radius: 999px; padding: 7px 12px;
}
/* Short landscape phones: one wide row of chips leaves room for the closing caption above the dock. */
@media (orientation: landscape) and (max-height: 500px) { .intro-chips { width: min(calc(100vw - 32px), 600px); } }
.intro-chip.rank { color: var(--solder); border-color: rgba(255, 181, 71, 0.5); }
.intro-act {
  /* Hangs just below the dock (stage y 598), so it never covers the dock on short screens. */
  position: absolute; z-index: 3; left: 50%; top: calc(var(--oy) + var(--k) * 598px + 12px); transform: translateX(-50%);
  animation: intro-fade 0.4s ease-out both;
}
.intro-act .btn {
  white-space: nowrap; animation: intro-glow 1.6s ease-in-out infinite;
  min-width: max(170px, calc(var(--k) * 210px)); font-size: max(15px, calc(var(--k) * 18px));
  padding: max(9px, calc(var(--k) * 14px)) max(20px, calc(var(--k) * 28px));
}
@keyframes intro-glow {
  0%, 100% { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 0 18px 2px rgba(255, 181, 71, 0.7); }
  50% { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 0 24px 5px rgba(90, 184, 255, 0.85); }
}
html.reduce-motion .intro-cap .w { transform: none; animation-name: intro-fade; animation-timing-function: ease-out; }
html.reduce-motion .intro-cap .slam { transform: none; animation-name: intro-fade; animation-duration: 0.3s; }
html.reduce-motion .intro-gate, html.reduce-motion .intro-act .btn { animation: none; }
.intro-replay { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 18px; color: var(--muted); }
/* Short screens (a phone in landscape): drop the spotlight's illustration so its button stays in view. */
@media (max-height: 500px) { .spot-art { display: none; } }

/* ---------- Cards that fit (tips, briefing, results) ----------
   In play mode the card layer covers the whole screen, not just the board, so a card always has the
   room it needs. The menu and full-screen buttons stay above it. Tip and briefing cards put their
   parts in .ov-row/.ov-col: one column on upright phones, side by side on short landscape screens. */
body.playmode .overlay {
  position: fixed; z-index: 30;
  padding: max(12px, env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px)) max(12px, env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
}
body.playmode .pm-only { position: relative; z-index: 31; }
/* On touch devices the screen-wide layer skips the backdrop blur (the board keeps animating under it). */
@media (pointer: coarse) { body.playmode .overlay { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(6, 10, 12, 0.86); } }
.ov-row, .ov-col { display: contents; }
.ov-row > .ov-col > .eyebrow:first-child { order: -1; }
.tip-card > .tip-art { order: -1; }
.tip-card > .ov-col > .eyebrow:first-child { order: -2; }
.ov-actions .btn { min-height: 46px; }
.ov-card p { line-height: 1.45; }
body.playmode .ov-card { max-width: 380px; }
/* Upright phones: tighter type and spacing, and the art shrinks on short screens. */
@media (max-width: 520px) {
  .ov-card { padding: 16px; gap: 10px; }
  .ov-card h3 { font-size: 1.3rem; }
  .ov-card .eyebrow { font-size: 0.64rem; line-height: 1.4; }
  .ov-card p, .ov-card .goal-list { font-size: 0.93rem; }
  .ov-card .note { font-size: 0.8rem; }
  .ov-card .say { padding: 8px 10px; }
  .ov-card .goal-list { gap: 4px; }
  .ov-card .tip-art { width: auto; height: min(120px, 19vh); margin-inline: auto; }
}
/* Short landscape screens (a phone on its side): art beside the words, briefing in two columns. */
@media (max-height: 520px) and (min-aspect-ratio: 6/5) {
  body.playmode .ov-card { max-width: 460px; }
  body.playmode .ov-card:has(> .ov-row) { max-width: min(700px, 100%); }
  .ov-card { padding: 14px 16px; gap: 8px; }
  .ov-card h3 { font-size: 1.25rem; }
  .ov-card .eyebrow { font-size: 0.64rem; line-height: 1.4; }
  .ov-card p, .ov-card .goal-list { font-size: 0.9rem; }
  .ov-card .note { font-size: 0.8rem; }
  .ov-card .say { padding: 8px 10px; }
  .ov-card .goal-list { gap: 4px; }
  .ov-row { display: flex; gap: 18px; align-items: center; }
  .ov-row > .ov-col { display: flex; flex-direction: column; gap: 8px; flex: 1 1 0; min-width: 0; }
  .ov-row > .tip-art { flex: 0 0 auto; width: min(240px, 34vw); height: auto; }
  .brief-card { align-items: stretch; }
  .brief-card > .ov-col:last-child { justify-content: center; }
  .ov-actions { flex-direction: row; }
  .ov-actions .btn { flex: 1 1 0; min-height: 44px; padding-inline: 10px; }
}
/* The spotlight's arrow sits outside its bubble, so the bubble no longer scrolls; its words do if they must. */
.spot-bubble { overflow: visible; max-height: none; }
#spotBody { display: flex; flex-direction: column; gap: 8px; max-height: calc(100vh - 56px); max-height: calc(100dvh - 56px); overflow-y: auto; }
.spot-actions .btn { min-height: 44px; }

/* ---------- Game bar and panels ----------
   The top bar (.gbar), the pilot/threat panel (.hud-side) and the stats strip (.hud-top) are wrappers
   that vanish (display: contents) on phones and tablets, so their pieces keep their own places in the
   play-mode grid there. On desktop-sized screens they become real panels around the board. */
.gbar { display: none; }
body.playmode .gbar, body.playmode .hud-side, body.playmode .hud-top { display: contents; }
.gb-brand, .gb-label { display: none; }
body.playmode .gb-brand { display: none; }

/* Desktop game screen: a top bar, the board in the middle under the stats strip, the mission goals
   (one card each, with progress bars) and the pilot/threat panel on the left, the power-up rack and
   the supply crate on the right. */
@media (min-aspect-ratio: 6/5) and (min-width: 960px) and (min-height: 520px) {
  body.playmode #play {
    --pm-side: 220px;
    grid-template-columns: minmax(var(--pm-side), 1fr) auto minmax(var(--pm-side), 1fr);
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    grid-template-areas: "bar bar bar" "goals hud powers" "goals board powers" "side board ad";
    gap: 10px 28px; align-items: start;
    padding: max(12px, env(safe-area-inset-top, 0px)) max(20px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left, 0px));
  }
  /* Top bar */
  body.playmode .gbar {
    grid-area: bar; display: flex; align-items: center; gap: 10px; min-width: 0;
    padding: 6px; border: 1px solid var(--line); border-radius: 16px;
    background: linear-gradient(180deg, rgba(23, 37, 43, 0.92), rgba(18, 28, 33, 0.92));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 8px 24px -14px rgba(0, 0, 0, 0.8);
  }
  /* The bar stays usable (How to play, Settings) above the card layer's dimming. */
  body.playmode .gbar { position: relative; z-index: 31; }
  body.playmode .gbar .pm-only { min-height: 42px; min-width: 42px; }
  body.playmode .pm-menu-btn { padding: 8px 14px 8px 10px; gap: 8px; }
  body.playmode .gb-label { display: inline; }
  body.playmode .gb-brand { display: flex; align-items: center; gap: 10px; margin-right: auto; padding-left: 6px; min-width: 0; }
  .gb-brand .logo-mark { grid-template-columns: repeat(2, 9px); gap: 2px; }
  .gb-brand .logo-mark i { width: 9px; height: 9px; border-radius: 2px; }
  .gb-brand b { font: 800 1.15rem/1 var(--f-display); letter-spacing: 0.14em; }
  body.playmode .wallet { display: flex; gap: 8px; font-size: 0.85rem; }
  .gb-chip {
    display: inline-flex; align-items: baseline; gap: 6px; white-space: nowrap;
    padding: 9px 14px; border-radius: 999px; background: var(--ink); border: 1px solid var(--line);
  }
  body.playmode .proto { display: flex; align-items: center; gap: 8px; border: 0; padding: 0; }
  body.playmode .proto .btn { padding: 0 16px; min-height: 42px; font-size: 0.9rem; border-radius: 999px; }
  body.playmode .gb-sound { min-height: 42px; min-width: 42px; padding: 8px; justify-content: center; }
  /* Board */
  body.playmode .board-col { grid-area: board; align-self: stretch; }
  /* Stats strip: never wider than the board (contain: inline-size keeps it from widening the column). */
  body.playmode .hud-top {
    grid-area: hud; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 22px; contain: inline-size; min-width: 0;
    padding: 8px 18px; border: 1px solid var(--line); border-radius: 14px;
    background: linear-gradient(180deg, #17252B, var(--panel));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 6px 18px -10px rgba(0, 0, 0, 0.7);
  }
  body.playmode .stats { display: flex; flex-wrap: wrap; gap: 4px 18px; justify-content: flex-start; flex: 0 0 auto; max-width: 100%; min-width: 0; }
  body.playmode .stats div { align-items: flex-start; gap: 1px; }
  body.playmode .stats .eyebrow { font-size: 0.62rem; }
  body.playmode .stats b { font-size: 1.45rem; }
  body.playmode #starBar { flex: 1 1 130px; min-width: 0; display: flex; flex-direction: column; align-items: stretch; gap: 7px; }
  body.playmode #starBar .prog-top { display: flex; justify-content: flex-end; }
  body.playmode #starBar .stars-sm { font-size: 1.05rem; }
  body.playmode #starBar .bar { flex: none; height: 8px; }
  body.playmode #starBar .tick { top: -4px; height: 16px; }
  /* Mission goals: a card per goal, top left */
  body.playmode .goals-box { grid-area: goals; justify-self: end; align-self: start; width: min(100%, 270px); min-width: 0; }
  body.playmode .goals-box .prog-top { display: flex; margin-bottom: 8px; }
  body.playmode .goals { flex-direction: column; flex-wrap: nowrap; gap: 6px; }
  body.playmode .goal, body.playmode .goal.done {
    display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; gap: 6px 9px; align-items: center;
    padding: 9px 12px 10px; border: 1px solid var(--line); border-radius: 12px; font-size: 0.88rem; line-height: 1.25;
    background: linear-gradient(180deg, #17252B, var(--panel));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 2px 6px -3px rgba(0, 0, 0, 0.6);
  }
  body.playmode .goal.done {
    border-color: rgba(126, 224, 160, 0.5);
    background: linear-gradient(180deg, rgba(126, 224, 160, 0.14), rgba(126, 224, 160, 0.05));
  }
  body.playmode .goal .bar { display: block; height: 6px; }
  body.playmode .goal.grav-chip .bar { display: none; }
  /* Left: pilot card and the threat line */
  body.playmode .hud-side { grid-area: side; display: flex; flex-direction: column-reverse; gap: 10px; justify-self: end; align-self: end; width: min(100%, 270px); min-width: 0; }
  body.playmode .pilot-row {
    display: flex; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 14px;
    background: linear-gradient(180deg, #17252B, var(--panel));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 6px 18px -10px rgba(0, 0, 0, 0.7);
  }
  body.playmode #pilotCanvas { width: 60px; height: 60px; }
  body.playmode .pilot-row strong { font-size: 1.15rem; }
  body.playmode .pilot-row span.role { display: block; font-size: 0.8rem; line-height: 1.35; }
  body.playmode .threat { display: block; font-size: 0.86rem; padding: 10px 12px; }
  /* Right: the power-up rack, one wide button each, and the supply crate under it */
  body.playmode .powers-box { grid-area: powers; justify-self: start; align-self: start; width: min(100%, 250px); }
  body.playmode .powers-box .prog-top { display: flex; margin-bottom: 8px; }
  body.playmode .pb-how { display: none; }
  body.playmode .powers { display: flex; flex-direction: column; gap: 8px; overflow: visible; padding: 0; }
  body.playmode .pw {
    --gx: 27px; --gy: 50%;
    display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 12px; row-gap: 2px;
    align-items: center; justify-items: start; text-align: left; min-width: 0; white-space: nowrap;
    padding: 9px 12px; font-size: 0.9rem;
  }
  body.playmode .pw .pwi { grid-row: 1 / 3; width: 34px; height: 34px; margin: -2px 0; }
  body.playmode .pw .rar { display: block; align-self: start; }
  body.playmode .pw .pw-name { align-self: end; }
  body.playmode .pw .pw-full { display: inline; }
  body.playmode .pw .pw-short { display: none; }
  body.playmode .pw .ct { top: 50%; right: 10px; transform: translateY(-50%); font-size: 0.75rem; padding: 3px 6px; }
  body.playmode #adBtn { grid-area: ad; justify-self: start; align-self: end; width: min(100%, 250px); padding: 10px 12px; font-size: 0.85rem; }
  body.playmode #adBtn .pwi { width: 30px; height: 30px; margin: -8px 8px -8px -2px; }
  body.playmode .threat .tide-line { font-size: 0.82rem; }
  /* What to tap next while a power-up, combo or the Overdrive Beam is armed */
  body.playmode .arm-hint:not([hidden]) {
    display: block; margin: 10px 0 0; padding: 9px 12px; font-size: 0.84rem; line-height: 1.35; color: var(--muted);
    border: 1px solid rgba(255, 181, 71, 0.45); border-left: 3px solid var(--solder); border-radius: 12px; background: rgba(255, 181, 71, 0.07);
  }
  body.playmode .arm-hint b { color: var(--fg); }
  .arm-hint .ah-short { display: none; }
  /* Toasts over a card sit just under the top bar, not on it. */
  body.ov-up #toast { top: 80px; }
}
/* Short desktop windows: slimmer side cards so goals and the pilot card never meet. */
@media (min-aspect-ratio: 6/5) and (min-width: 960px) and (min-height: 520px) and (max-height: 740px) {
  body.playmode #play { row-gap: 8px; }
  body.playmode .goal, body.playmode .goal.done { padding: 6px 10px 7px; font-size: 0.84rem; gap: 4px 8px; }
  body.playmode .goals { gap: 5px; }
  body.playmode .pilot-row { padding: 8px 10px; }
  body.playmode .pilot-row span.role { display: none; }
  body.playmode #pilotCanvas { width: 44px; height: 44px; }
  body.playmode .threat { padding: 8px 10px; font-size: 0.8rem; }
  body.playmode .hud-top { padding: 6px 16px; }
  body.playmode .stats b { font-size: 1.3rem; }
  body.playmode .pw { padding: 7px 12px; }
}
@media (min-aspect-ratio: 6/5) and (min-width: 960px) and (min-height: 520px) and (max-height: 640px) {
  .arm-hint .ah-full { display: none; }
  .arm-hint .ah-short { display: inline; color: var(--fg); }
  body.playmode .arm-hint:not([hidden]) { margin-top: 8px; padding: 7px 10px; }
  body.playmode .powers { gap: 6px; }
  body.playmode .pw { padding: 5px 12px; }
  body.playmode .pw .pwi { width: 30px; height: 30px; }
  body.playmode .stats { column-gap: 12px; }
  body.playmode .hud-top { padding: 6px 12px; column-gap: 14px; }
  body.playmode .stats b { font-size: 1.12rem; }
  body.playmode .stats .eyebrow { font-size: 0.56rem; }
}
/* Roomier desktops: bigger stats and power-ups. */
@media (min-aspect-ratio: 6/5) and (min-width: 1360px) and (min-height: 860px) {
  body.playmode #play { --pm-side: 260px; gap: 12px 36px; }
  body.playmode .stats b { font-size: 1.7rem; }
  body.playmode .hud-side { width: min(100%, 300px); }
  body.playmode .powers-box, body.playmode #adBtn { width: min(100%, 280px); }
  body.playmode .pw { padding: 11px 14px; font-size: 0.95rem; }
  body.playmode .pw .pwi { width: 38px; height: 38px; }
  body.playmode .goals-box { width: min(100%, 300px); }
  body.playmode .goal, body.playmode .goal.done { font-size: 0.94rem; }
}
/* Big screens (1080p and up): scale the panels with the board. */
@media (min-aspect-ratio: 6/5) and (min-width: 1700px) and (min-height: 1000px) {
  body.playmode #play { --pm-side: 320px; gap: 14px 44px; padding-inline: max(28px, env(safe-area-inset-left, 0px)) max(28px, env(safe-area-inset-right, 0px)); }
  body.playmode .gbar { padding: 8px; }
  body.playmode .gbar .pm-only, body.playmode .gb-sound, body.playmode .proto .btn { min-height: 50px; min-width: 50px; font-size: 1rem; }
  body.playmode .gb-brand b { font-size: 1.4rem; }
  body.playmode .wallet { font-size: 1rem; }
  body.playmode .stats .eyebrow { font-size: 0.72rem; }
  body.playmode .stats b { font-size: 2.1rem; }
  body.playmode .hud-top { padding: 10px 22px; gap: 28px; }
  body.playmode .goals-box, body.playmode .hud-side { width: min(100%, 360px); }
  body.playmode .goals-box .eyebrow, body.playmode .powers-box .eyebrow { font-size: 0.8rem; }
  body.playmode .goal, body.playmode .goal.done { font-size: 1.05rem; padding: 12px 14px; }
  body.playmode .threat { font-size: 1rem; }
  body.playmode #pilotCanvas { width: 72px; height: 72px; }
  body.playmode .pilot-row strong { font-size: 1.35rem; }
  body.playmode .pilot-row span.role { font-size: 0.92rem; }
  body.playmode .powers-box, body.playmode #adBtn { width: min(100%, 340px); }
  body.playmode .pw { padding: 13px 16px; font-size: 1.08rem; }
  body.playmode .pw .pwi { width: 46px; height: 46px; }
  body.playmode .pw .rar { font-size: 0.7rem; }
  body.playmode .pw .ct { font-size: 0.88rem; }
  body.playmode #adBtn { font-size: 1rem; }
  body.playmode .ov-card { max-width: 440px; font-size: 1.08rem; }
  body.ov-up #toast { top: 96px; font-size: 1rem; }
}
