/* Xeno Skies — the planet is one full-screen canvas; everything else floats
   over it as glass: the hangar's cards, the flight HUD (always dark glass,
   it sits on the scene), the sheets (light or dark with the theme). The
   accent is the fleet's cyan; credits are crystal teal, firepower amber. */

:root {
  color-scheme: light;
  --ink: #142033;
  --muted: #56647a;
  --panel: rgba(246, 249, 253, 0.86);
  --panel-2: rgba(226, 234, 244, 0.9);
  --sheet: #f6f8fc;
  --line: rgba(20, 40, 70, 0.12);
  --accent: #0aa5bd;
  --accent-ink: #062a33;
  --accent-soft: rgba(10, 165, 189, 0.14);
  --ca-accent: #0b7285; /* the accounts SDK's sheets and chip (white on it 5.3:1) */
  --gold: #ffc23a;
  --crystal: #4fe6d6;
  --danger: #d8344a;
  --shadow: 0 18px 40px -18px rgba(10, 20, 40, 0.5), 0 2px 8px -2px rgba(10, 20, 40, 0.18);
  --backdrop: rgba(6, 10, 22, 0.45);
  --glass: rgba(10, 16, 32, 0.56);
  --glass-ink: #eef6ff;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --display: "Avenir Next Condensed", "SF Pro Display", "Arial Narrow", "Roboto Condensed", system-ui, sans-serif;
  --ease-out: cubic-bezier(0.2, 0.9, 0.25, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --ink: #eaf2ff;
    --muted: #9aa8bf;
    --panel: rgba(14, 22, 40, 0.84);
    --panel-2: rgba(26, 38, 64, 0.9);
    --sheet: #111a2e;
    --line: rgba(255, 255, 255, 0.1);
    --accent-soft: rgba(60, 220, 240, 0.14);
    --shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.8), 0 2px 8px -2px rgba(0, 0, 0, 0.5);
    --backdrop: rgba(2, 4, 12, 0.6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #eaf2ff;
  --muted: #9aa8bf;
  --panel: rgba(14, 22, 40, 0.84);
  --panel-2: rgba(26, 38, 64, 0.9);
  --sheet: #111a2e;
  --line: rgba(255, 255, 255, 0.1);
  --accent-soft: rgba(60, 220, 240, 0.14);
  --shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.8), 0 2px 8px -2px rgba(0, 0, 0, 0.5);
  --backdrop: rgba(2, 4, 12, 0.6);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: #0d1424;
  color: var(--ink);
  font: 16px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  /* nothing in the game can be selected, magnified or called out on iPhone */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
button, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
[hidden] { display: none !important; }
i[data-icon] { display: inline-grid; place-items: center; font-style: normal; width: 22px; height: 22px; flex: none; }
i[data-icon] svg { width: 100%; height: 100%; display: block; }

/* ------------------------------------------------------------ the scene */
.stage {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: block;
  touch-action: none;
}
.field {
  position: fixed;
  inset: 0;
  z-index: 1;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  pointer-events: none;
}
body.mode-play .field { pointer-events: auto; cursor: none; }
body.mode-play.cursor .field { cursor: crosshair; }

/* ------------------------------------------------------------ glass bits */
.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  transition: transform 0.15s var(--ease-out);
}
.icon-btn:active { transform: scale(0.92); }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px 0 10px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}
.pill i[data-icon] { width: 20px; height: 20px; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--ink);
  font-weight: 700;
  transition: transform 0.15s var(--ease-out), filter 0.15s, background 0.2s;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: default; transform: none; }
.btn.primary {
  border: 0;
  color: var(--accent-ink);
  background: linear-gradient(180deg, #7ff2ff 0%, #2fd0e6 55%, #14a9c4 100%);
  box-shadow: 0 10px 24px -10px rgba(20, 200, 230, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}
.btn.gold { border: 0; color: #3a2400; background: linear-gradient(180deg, #ffe08a, #ffc23a 60%, #f0a020); box-shadow: 0 10px 24px -12px rgba(255, 180, 40, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.6); }
.btn.ghost { background: transparent; }
.btn.danger { border: 0; color: #fff; background: var(--danger); }
.btn.wide { width: 100%; }
.btn.big { min-height: 58px; font-size: 19px; letter-spacing: 0.06em; text-transform: uppercase; font-family: var(--display); font-weight: 800; border-radius: 18px; padding: 0 30px; }
.btn i[data-icon] { width: 22px; height: 22px; }
.link-btn { border: 0; background: none; color: var(--accent); font-weight: 650; padding: 8px 0; text-decoration: underline; text-underline-offset: 3px; }

.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--accent-soft); gap: 2px; }
.seg button { border: 0; background: transparent; padding: 7px 12px; border-radius: 9px; font-weight: 650; font-size: 14px; color: var(--muted); min-height: 36px; }
.seg button[aria-pressed="true"] { background: var(--sheet); color: var(--ink); box-shadow: 0 2px 6px -2px rgba(0, 0, 0, 0.3); }
.switch { appearance: none; -webkit-appearance: none; width: 50px; height: 30px; border-radius: 999px; background: var(--line); position: relative; cursor: pointer; transition: background 0.2s; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3); transition: transform 0.22s var(--spring); }
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(20px); }

/* ------------------------------------------------------------ hangar */
.topbar {
  position: fixed;
  z-index: 5;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(10px + var(--safe-t)) calc(14px + var(--safe-r)) 8px calc(14px + var(--safe-l));
}
.brand {
  display: flex;
  flex-direction: column;
  line-height: 0.86;
  font-family: var(--display);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #fff;
  text-shadow: 0 2px 10px rgba(0, 10, 30, 0.6);
  min-width: 0;
}
.brand-a { font-size: 13px; color: #9af4ff; letter-spacing: 0.32em; }
.brand.long .brand-a { font-size: 10.5px; letter-spacing: 0.24em; }
.brand.long .brand-b { font-size: 15px; letter-spacing: 0.05em; }
.brand-b { font-size: 24px; background: linear-gradient(180deg, #ffffff, #9af4ff); -webkit-background-clip: text; background-clip: text; color: transparent; white-space: nowrap; }
.credits { margin-left: auto; }
.credits b { color: var(--ink); }
.credits.bump { animation: bump 0.45s var(--spring); }
.bar-tools { display: flex; align-items: center; gap: 8px; }
.chip-slot { display: flex; }
body:not(.mode-hangar) .topbar, body:not(.mode-hangar) .hangar { display: none; }

.screen { position: fixed; inset: 0; z-index: 3; }
.hangar {
  display: flex;
  flex-direction: column;
  padding: calc(66px + var(--safe-t)) calc(12px + var(--safe-r)) 0 calc(12px + var(--safe-l));
  overflow: hidden;
}
.hangar-inner {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  display: grid;
  gap: 12px;
  align-content: start;
  padding-bottom: 12px;
  max-width: 980px;
  width: 100%;
  margin: 0 auto;
  scrollbar-width: none;
}
.hangar-inner::-webkit-scrollbar { display: none; }
@media (min-width: 820px) {
  .hangar-inner { grid-template-columns: 1fr 1fr; align-content: center; }
}
.ship-card, .upgrades-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 14px 16px 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
}
.ship-stage { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; }
.ship-view { width: 100%; height: 168px; display: block; }
@media (min-height: 760px) { .ship-view { height: 210px; } }
.nav-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel-2); display: grid; place-items: center; color: var(--ink); }
.nav-btn:active { transform: scale(0.92); }
.ship-dots { display: flex; justify-content: center; gap: 6px; margin: 2px 0 6px; }
.ship-dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--line); transition: background 0.2s, transform 0.2s; }
.ship-dots span.on { background: var(--accent); transform: scale(1.25); }
.ship-dots span.own { box-shadow: inset 0 0 0 1.5px var(--accent); }
.ship-card h2 { margin: 0; text-align: center; font-family: var(--display); font-weight: 800; text-transform: uppercase; letter-spacing: 0.14em; font-size: 24px; }
.ship-desc { text-align: center; margin: 4px auto 10px; max-width: 42ch; color: var(--muted); font-size: 14.5px; min-height: 3em; }
.stats { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; align-items: center; margin-bottom: 12px; font-size: 13px; font-weight: 650; color: var(--muted); }
.stats .sbar { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; position: relative; }
.stats .sbar b { position: absolute; inset: 0 auto 0 0; border-radius: 99px; background: linear-gradient(90deg, #2fd0e6, #9af4ff); width: calc(var(--v, 0) * 100%); transition: width 0.45s var(--ease-out); }
.stats .sbar b.up { background: linear-gradient(90deg, #ffc23a, #ffe08a); }
.ship-card .btn.wide { margin-top: 2px; }
.ship-card.swap .ship-view { animation: swap 0.35s var(--ease-out); }

.upgrades-card h2 { margin: 0 0 2px; font-family: var(--display); text-transform: uppercase; letter-spacing: 0.14em; font-size: 17px; }
.upgrades-card .muted { margin: 0 0 8px; }
.upgrades { display: grid; gap: 8px; }
.up {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 8px 8px 10px;
  border-radius: 16px;
  background: var(--panel-2);
  border: 1px solid var(--line);
}
.up .up-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); }
.up .up-ic i[data-icon] { width: 26px; height: 26px; }
.up h3 { margin: 0; font-size: 15px; line-height: 1.2; }
.up p { margin: 1px 0 4px; font-size: 12.5px; color: var(--muted); line-height: 1.25; }
.pips { display: flex; gap: 3px; }
.up .pips b { width: 14px; height: 5px; border-radius: 3px; background: var(--line); }
.up .pips b.on { background: linear-gradient(90deg, #ffc23a, #ffe08a); }
.up .buy { min-height: 40px; padding: 0 12px; border-radius: 12px; font-size: 14px; gap: 5px; font-variant-numeric: tabular-nums; }
.up .buy i[data-icon] { width: 16px; height: 16px; }
.up.done .buy { opacity: 0.6; }
.up.flash { animation: glowup 0.6s var(--ease-out); }

.launch-row {
  display: flex;
  justify-content: center;
  padding: 10px 0 calc(12px + var(--safe-b));
}
.launch-row .btn { width: min(100%, 420px); }

/* ------------------------------------------------------------ flight HUD */
.hud { position: fixed; inset: 0; z-index: 4; pointer-events: none; color: var(--glass-ink); }
body:not(.mode-play) .hud, body:not(.mode-play) .banner, body:not(.mode-play) .lift { display: none !important; }
.hud-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 8px;
  padding: calc(8px + var(--safe-t)) calc(10px + var(--safe-r)) 0 calc(10px + var(--safe-l));
}
.hud-left { display: grid; gap: 5px; justify-items: start; }
.meter, .power, .rescues, .sub, .chain, .score {
  background: var(--glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.meter { display: flex; align-items: center; gap: 6px; padding: 4px 8px 4px 5px; border-radius: 999px; }
.meter i[data-icon] { width: 16px; height: 16px; }
.meter .bar { width: clamp(70px, 22vw, 130px); height: 7px; border-radius: 99px; background: rgba(255, 255, 255, 0.14); overflow: hidden; position: relative; }
.meter .bar b { position: absolute; inset: 0 auto 0 0; width: calc(var(--v, 1) * 100%); border-radius: 99px; background: linear-gradient(90deg, #ff9a3a, #ffd27a); transition: width 0.18s linear; }
.meter.shield .bar b { background: linear-gradient(90deg, #2fa8ff, #9ae8ff); }
.meter.low .bar b { background: linear-gradient(90deg, #ff3a4a, #ff8a6a); animation: pulse 0.7s ease-in-out infinite; }
.meter.hit { animation: shake 0.3s; }
.power { display: flex; align-items: center; gap: 5px; padding: 3px 8px 3px 5px; border-radius: 999px; }
.power i[data-icon] { width: 15px; height: 15px; }
.power .pips b { width: 9px; height: 9px; border-radius: 3px; background: rgba(255, 255, 255, 0.18); transition: background 0.2s; }
.power .pips b.on { background: linear-gradient(180deg, #ffe08a, #ffb02a); box-shadow: 0 0 6px rgba(255, 190, 60, 0.7); }
.power .xp { width: 28px; height: 4px; border-radius: 99px; background: rgba(255, 255, 255, 0.15); overflow: hidden; position: relative; }
.power .xp b { position: absolute; inset: 0 auto 0 0; width: calc(var(--v, 0) * 100%); background: #ffe08a; }
.power.up { animation: bump 0.5s var(--spring); }
.hud-mid { display: grid; justify-items: center; gap: 4px; }
.score {
  font-family: var(--display);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  padding: 2px 14px;
  border-radius: 999px;
  min-width: 96px;
  text-align: center;
  color: #fff;
}
.chain { font-weight: 800; font-size: 13px; padding: 2px 10px; border-radius: 999px; color: #ffe08a; white-space: nowrap; font-variant-numeric: tabular-nums; }
.chain.bump { animation: bump 0.25s var(--spring); }
.hud-right { display: grid; justify-items: end; gap: 6px; }
.hud-btn { pointer-events: auto; width: 42px; height: 42px; background: var(--glass); color: #fff; border-color: rgba(255, 255, 255, 0.14); box-shadow: none; }
.rescues { display: flex; align-items: center; gap: 4px; padding: 3px 10px 3px 6px; border-radius: 999px; font-weight: 800; font-variant-numeric: tabular-nums; font-size: 14px; }
.rescues i[data-icon] { width: 18px; height: 18px; }
.rescues.bump { animation: bump 0.45s var(--spring); }
.bossbar {
  position: absolute;
  top: calc(96px + var(--safe-t));
  left: 50%;
  transform: translateX(-50%);
  width: min(78vw, 420px);
  display: grid;
  gap: 3px;
  justify-items: center;
  animation: drop 0.5s var(--ease-out);
}
.boss-name { font-family: var(--display); font-weight: 800; text-transform: uppercase; letter-spacing: 0.18em; font-size: 12.5px; color: #ffd0e0; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8); }
.bossbar .bar { width: 100%; height: 9px; border-radius: 99px; background: rgba(10, 4, 16, 0.6); border: 1px solid rgba(255, 140, 180, 0.35); overflow: hidden; position: relative; }
.bossbar .bar b { position: absolute; inset: 0 auto 0 0; width: calc(var(--v, 1) * 100%); background: linear-gradient(90deg, #ff3a7a, #ff9ac0); transition: width 0.25s linear; }
.hud-bottom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 calc(14px + var(--safe-r)) calc(14px + var(--safe-b)) calc(14px + var(--safe-l));
}
.sub { display: flex; align-items: center; gap: 6px; padding: 5px 12px 5px 7px; border-radius: 999px; font-weight: 800; font-variant-numeric: tabular-nums; animation: drop 0.35s var(--spring); }
.sub i[data-icon] { width: 22px; height: 22px; }
.sub.low b { color: #ff9a9a; }
.bomb-btn {
  pointer-events: auto;
  margin-left: auto;
  width: 66px;
  height: 66px;
  border-radius: 50%;
  border: 2px solid rgba(255, 190, 120, 0.55);
  background: radial-gradient(circle at 35% 30%, rgba(255, 170, 90, 0.45), rgba(40, 14, 10, 0.65) 70%);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  position: relative;
  color: #fff;
  touch-action: none;
  transition: transform 0.12s var(--ease-out), opacity 0.2s;
}
.bomb-btn i[data-icon] { width: 32px; height: 32px; }
.bomb-btn b { position: absolute; right: -2px; top: -2px; min-width: 22px; height: 22px; border-radius: 11px; background: #ff8a2a; color: #2a1000; font-size: 13px; font-weight: 900; display: grid; place-items: center; padding: 0 5px; }
.bomb-btn:active, .bomb-btn.pressed { transform: scale(0.9); }
.bomb-btn.empty { opacity: 0.4; }

.banner {
  position: fixed;
  z-index: 6;
  left: 50%;
  top: 34%;
  transform: translate(-50%, -50%);
  display: grid;
  justify-items: center;
  gap: 4px;
  text-align: center;
  pointer-events: none;
  color: #fff;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.7);
  width: min(92vw, 520px);
  animation: banner 2.6s var(--ease-out) both;
}
.banner small { font-weight: 800; letter-spacing: 0.3em; text-transform: uppercase; font-size: 12.5px; color: #9af4ff; }
.banner strong { font-family: var(--display); font-weight: 800; font-size: clamp(28px, 8vw, 46px); letter-spacing: 0.08em; text-transform: uppercase; line-height: 1.05; }
.banner span { font-size: 15px; color: #e0eaff; }
.banner.warn small { color: #ff8aa8; }
.banner.warn strong { color: #ffd0dc; animation: flicker 0.5s steps(2) 4; }
.lift {
  position: fixed;
  z-index: 5;
  left: 50%;
  bottom: calc(110px + var(--safe-b));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px 10px 14px;
  border-radius: 999px;
  background: var(--glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #fff;
  font-weight: 700;
  pointer-events: none;
  animation: rise 0.3s var(--ease-out);
}
.lift i[data-icon] { width: 26px; height: 26px; animation: tap 1.4s ease-in-out infinite; }

.toast {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: calc(96px + var(--safe-b));
  transform: translate(-50%, 20px);
  opacity: 0;
  padding: 10px 16px;
  border-radius: 14px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow);
  font-weight: 650;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.3s var(--ease-out);
  max-width: 90vw;
  text-align: center;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ------------------------------------------------------------ sheets */
.sheet {
  border: 0;
  padding: 0;
  border-radius: 24px;
  width: min(94vw, 460px);
  max-height: min(88dvh, 760px);
  background: var(--sheet);
  color: var(--ink);
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.7);
  overflow: hidden;
  -webkit-user-select: text;
  user-select: text;
}
.sheet[open] { display: flex; flex-direction: column; animation: sheet-in 0.3s var(--ease-out); }
.sheet.closing { animation: sheet-out 0.2s ease-in forwards; }
.sheet::backdrop { background: var(--backdrop); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.sheet.tall { height: min(88dvh, 760px); }
.sheet.small-sheet { padding: 22px; width: min(92vw, 380px); text-align: center; gap: 10px; }
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 16px 16px 8px 20px; }
.sheet-head h2 { margin: 0; flex: 1; font-size: 20px; font-family: var(--display); text-transform: uppercase; letter-spacing: 0.1em; }
.close { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--accent-soft); display: grid; place-items: center; }
.sheet-body { padding: 4px 20px calc(20px + var(--safe-b)); overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; display: grid; gap: 10px; align-content: start; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); min-height: 52px; }
.row.last { border-bottom: 0; }
.row select { min-height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); padding: 0 10px; }
.version { color: var(--muted); font-size: 13px; }
.row-btns { display: flex; gap: 8px; }
.row-btns .btn { flex: 1; }
.toggles { display: flex; gap: 8px; }
.toggle { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; border-radius: 14px; border: 1px solid var(--line); background: transparent; font-weight: 650; opacity: 0.55; }
.toggle[aria-pressed="true"] { opacity: 1; background: var(--accent-soft); border-color: var(--accent); }
.help .rule { display: grid; grid-template-columns: 34px 1fr; gap: 12px; align-items: start; }
.help .rule i[data-icon] { width: 30px; height: 30px; margin-top: 2px; color: var(--accent); }
.help h3 { margin: 0 0 2px; font-size: 16px; }
.help p { margin: 0; color: var(--muted); font-size: 14.5px; }
.intro-art { display: grid; place-items: center; }
.intro-art i[data-icon] { width: 60px; height: 60px; color: var(--accent); animation: tap 1.4s ease-in-out infinite; }
.small-sheet h2 { margin: 4px 0 0; font-family: var(--display); text-transform: uppercase; letter-spacing: 0.1em; }

/* regions */
.region-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.region {
  position: relative;
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 12px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 10px;
  background: linear-gradient(120deg, var(--a, #333) 0%, var(--b, #111) 100%);
  color: #fff;
  overflow: hidden;
  transition: transform 0.15s var(--ease-out);
}
.region:active { transform: scale(0.98); }
.region canvas { width: 74px; height: 74px; border-radius: 12px; display: block; box-shadow: 0 6px 14px -6px rgba(0, 0, 0, 0.6); }
.region .r-n { font-size: 11.5px; font-weight: 800; letter-spacing: 0.18em; text-transform: uppercase; opacity: 0.85; }
.region h3 { margin: 0; font-family: var(--display); font-size: 20px; letter-spacing: 0.04em; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5); }
.region p { margin: 2px 0 4px; font-size: 13px; line-height: 1.3; opacity: 0.92; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6); }
.region .r-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; font-weight: 700; }
.region .r-medals { display: flex; gap: 2px; }
.region .r-medals i[data-icon] { width: 20px; height: 20px; opacity: 0.25; filter: grayscale(1); }
.region .r-medals i.on { opacity: 1; filter: none; }
.region .badge { background: var(--gold); color: #3a2400; border-radius: 99px; padding: 1px 8px; font-size: 11.5px; font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase; }
.region.locked { filter: grayscale(0.85) brightness(0.65); }
.region.locked::after { content: ""; position: absolute; inset: 0; background: rgba(0, 0, 0, 0.15); }
.region .lockmark { position: absolute; right: 10px; top: 10px; width: 24px; height: 24px; color: #fff; }

/* result */
.result .sheet-body { padding-top: 22px; text-align: center; }
.result h2 { margin: 0; font-family: var(--display); text-transform: uppercase; letter-spacing: 0.1em; font-size: 28px; }
.result-line { margin: 0; color: var(--muted); }
.medals { display: flex; justify-content: center; gap: 14px; min-height: 64px; }
.medal { display: grid; justify-items: center; gap: 2px; width: 82px; font-size: 11.5px; font-weight: 700; color: var(--muted); }
.medal i[data-icon] { width: 46px; height: 46px; opacity: 0.18; filter: grayscale(1); }
.medal.on i[data-icon] { opacity: 1; filter: none; animation: medal 0.6s var(--spring) both; animation-delay: var(--d, 0s); }
.medal.on { color: var(--ink); }
.tally { display: grid; grid-template-columns: 1fr auto; gap: 6px 14px; margin: 4px 0; text-align: left; }
.tally dt { color: var(--muted); }
.tally dd { margin: 0; font-weight: 800; font-variant-numeric: tabular-nums; text-align: right; }
.tally dd.hl { color: var(--accent); }
.tally .best { color: var(--gold); font-size: 12px; margin-left: 6px; }
.friends { text-align: left; display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; }
.friends h3 { margin: 0; font-size: 15px; }
.friends-board { min-height: 90px; }
.result-actions { display: flex; gap: 8px; margin-top: 4px; }
.result-actions .btn { flex: 1; padding: 0 10px; white-space: nowrap; font-size: 15px; gap: 6px; }
.result-actions .btn i[data-icon] { width: 18px; height: 18px; }

/* ------------------------------------------------------------ motion */
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.18); } 100% { transform: scale(1); } }
@keyframes pulse { 50% { opacity: 0.55; } }
@keyframes shake { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
@keyframes drop { from { opacity: 0; transform: translate(var(--tx, 0), -10px); } to { opacity: 1; transform: translate(var(--tx, 0), 0); } }
.bossbar { --tx: -50%; }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes banner { 0% { opacity: 0; transform: translate(-50%, -40%) scale(0.92); } 12% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -56%); } }
@keyframes flicker { 50% { opacity: 0.4; } }
@keyframes tap { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(4px) scale(0.94); } }
@keyframes sheet-in { from { opacity: 0; transform: translateY(18px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes sheet-out { to { opacity: 0; transform: translateY(12px) scale(0.98); } }
@keyframes medal { from { transform: scale(0.3) rotate(-30deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes swap { from { opacity: 0.2; transform: translateX(var(--dir, 20px)); } to { opacity: 1; transform: none; } }
@keyframes glowup { 0% { box-shadow: 0 0 0 0 rgba(255, 194, 58, 0.7); } 100% { box-shadow: 0 0 0 14px rgba(255, 194, 58, 0); } }
html.reduce *, html.reduce *::before, html.reduce *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
@media (prefers-reduced-motion: reduce) {
  html:not(.full) *, html:not(.full) *::before, html:not(.full) *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* landscape phones: a slimmer HUD and hangar */
@media (orientation: landscape) and (max-height: 520px) {
  .hangar { padding-top: calc(58px + var(--safe-t)); }
  .hangar-inner { grid-template-columns: 1fr 1fr; }
  .ship-view { height: 120px; }
  .ship-desc { min-height: 0; }
  .launch-row { padding-top: 6px; }
  .btn.big { min-height: 48px; }
  .bossbar { top: calc(60px + var(--safe-t)); }
  .bomb-btn { width: 56px; height: 56px; }
}
@media (max-width: 360px) {
  .brand-b { font-size: 20px; }
  .credits { padding: 0 10px 0 8px; }
  .score { font-size: 19px; min-width: 80px; }
}
