/* Astro Merge — sci-fi HUD skin: chamfered glowing panels over a full-bleed
   procedural sky. Orbitron (self-hosted, OFL) is the display face everywhere;
   the system stack is only a fallback while it loads. */

@font-face {
  font-family: 'Orbitron';
  src: url('fonts/orbitron-var.woff2') format('woff2-variations');
  font-weight: 400 900;
  font-display: swap;
}

:root {
  --font: 'Orbitron', system-ui, -apple-system, sans-serif;
  --ink: #dfe8ff;
  --ink-dim: rgba(185, 208, 255, 0.6);
  --cyan: #7fd4ff;
  --cyan-label: rgba(140, 205, 255, 0.85);
  --line: rgba(110, 185, 255, 0.3);
  --line-bright: rgba(150, 215, 255, 0.75);
  --glow: rgba(80, 170, 255, 0.3);
  --fill: rgba(7, 13, 32, 0.62);
  --fill-strong: rgba(8, 13, 32, 0.94);
  --gold: #ffd75e;
  /* Defaults match hud.js and are overwritten from the frame engine at boot.
     Content-bearing panels derive padding from this shared safe area. */
  --hud-frame-inset: 6px;
  --hud-safe-inset: 10px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  height: 100dvh;
  background: #04050c;
  color: var(--ink);
  font-family: var(--font);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

/* ---- the game canvas fills the entire screen; HUD floats above it ---- */
#game {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  display: block;
  touch-action: none;
  cursor: crosshair;
  z-index: 0;
}

/* ---- holo frames: js/hud.js generates each panel's stepped-outline SVG at
   its measured size and sets it as a static background-image, so the shapes
   cost nothing per frame. NO `filter` on any always-visible element (see
   CLAUDE.md — re-rasterizing filtered layers on score ticks froze mobile
   Safari); glow is baked into the SVG as stacked strokes. ---- */
.hud-frame,
[data-well] {
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

.hud-label {
  display: block;
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.28em;
  color: var(--cyan-label);
  text-shadow: 0 0 8px var(--glow);
}

/* bracket underline: a fading rule with a bright tick at its head */
.hud-label::after {
  content: '';
  display: block;
  height: 1px;
  margin-top: 3px;
  background:
    linear-gradient(90deg, rgba(190, 235, 255, 0.9), rgba(190, 235, 255, 0.85) 3px, rgba(150, 210, 255, 0.35) 30%, rgba(150, 210, 255, 0) 85%);
}

/* ---- top bar: score | title | next ---- */
#topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 10px 4px;
  pointer-events: none;
}

#score-box {
  flex: 1;
  min-width: 92px;
  max-width: 132px;
  padding: 12px 14px 12px 18px;
  overflow: hidden;
}

#score {
  max-width: 100%;
  font-size: clamp(24px, 7.5vw, 36px);
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  color: #fff;
  text-shadow: 0 0 18px rgba(120, 190, 255, 0.65);
  transform-origin: left center;
  will-change: transform;
}

#best {
  max-width: 100%;
  font-size: clamp(8px, 2.3vw, 10px);
  letter-spacing: 0.09em;
  white-space: nowrap;
  overflow: hidden;
  color: var(--ink-dim);
  margin-top: 4px;
}

#stars {
  max-width: 100%;
  font-size: clamp(11px, 3.2vw, 13px);
  letter-spacing: 0.08em;
  white-space: nowrap;
  overflow: hidden;
  color: var(--gold);
  text-shadow: 0 0 10px rgba(255, 200, 80, 0.5);
  margin-top: 4px;
}

#title-box {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-align: center;
  padding-top: 8px;
  white-space: nowrap;
}

#title {
  font-size: clamp(10px, 2.7vw, 14px);
  font-weight: 700;
  letter-spacing: 0.24em;
  margin-right: -0.24em; /* recenter: tracking pads the right edge */
  color: #fff;
  text-shadow: 0 0 14px rgba(120, 190, 255, 0.7);
}

#tagline {
  font-size: clamp(6px, 1.6vw, 8px);
  font-weight: 500;
  letter-spacing: 0.22em;
  margin-right: -0.22em;
  margin-top: 5px;
  color: var(--cyan-label);
}

#title-box::after {
  content: '';
  display: block;
  height: 2px;
  margin: 6px 10% 0;
  background:
    radial-gradient(circle at 50% 50%, rgba(230, 248, 255, 0.95), rgba(160, 220, 255, 0.4) 3%, rgba(160, 220, 255, 0) 8%),
    linear-gradient(90deg, rgba(110, 185, 255, 0), rgba(140, 210, 255, 0.6), rgba(110, 185, 255, 0));
}

#next-box {
  flex: 1;
  min-width: 92px;
  max-width: 132px;
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

#next-box .hud-label {
  align-self: stretch;
  text-align: left;
}

#next-ring {
  position: relative;
  width: clamp(40px, 12vw, 52px);
  height: clamp(40px, 12vw, 52px);
  margin-top: 5px;
  border: 1px solid var(--line);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--glow), inset 0 0 8px rgba(80, 170, 255, 0.16);
  display: flex;
  align-items: center;
  justify-content: center;
}

#next-ring::after {
  content: '';
  position: absolute;
  inset: -5px;
  border: 1px dashed rgba(110, 185, 255, 0.35);
  border-radius: 50%;
  animation: spin 60s linear infinite;
}

#next {
  width: 84%;
  height: auto;
}

#next-name {
  align-self: stretch;
  min-width: 0;
  font-size: clamp(8px, 2.4vw, 10px);
  letter-spacing: 0.2em;
  margin-top: 6px;
  padding-left: calc(var(--hud-frame-inset) + 14px);
  white-space: nowrap;
  overflow: hidden;
  color: rgba(220, 228, 255, 0.85);
  text-transform: uppercase;
}

@media (max-width: 350px) {
  #topbar {
    gap: 4px;
    padding-left: 6px;
    padding-right: 6px;
  }

  #score-box,
  #next-box {
    min-width: 82px;
  }

  #title {
    font-size: 9px;
    letter-spacing: 0.16em;
    margin-right: -0.16em;
  }

  #tagline {
    font-size: 5px;
    letter-spacing: 0.12em;
    margin-right: -0.12em;
  }
}

/* ---- hint pill, tucked under the top bar ---- */
#hint {
  position: fixed;
  top: calc(21% + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  font-size: clamp(9px, 2.6vw, 11px);
  line-height: 1.6;
  text-align: center;
  color: rgba(205, 220, 255, 0.85);
  background: var(--fill);
  border: 1px solid var(--line);
  padding: 8px 16px;
  border-radius: 3px;
  transition: opacity 1.2s ease;
  max-width: min(78vw, 340px);
  pointer-events: none;
}

#hint.faded {
  opacity: 0;
}

/* ---- tools rail: vertical panel on the left edge; the whole dock slides
   off-screen leaving only the arrow tab peeking in ---- */
#tools-dock {
  position: fixed;
  left: 8px;
  top: 52%;
  transform: translate(0, -50%);
  z-index: 5;
  display: flex;
  align-items: center;
  pointer-events: none;
  transition: transform 0.35s ease;
}

#tools-dock.collapsed {
  /* slide left until only the tab remains on-screen: the extra 16px offsets
     the dock's own left: 8px so the panel edge lands just past x=0 */
  transform: translate(calc(-100% + 16px), -50%);
}

#tools-panel {
  pointer-events: none;
}

#tools-tab {
  flex: 0 0 auto;
  width: 22px;
  height: 58px;
  margin-left: 4px;
  padding: 0;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  color: var(--cyan-label);
  background: var(--fill);
  border: 1px solid var(--line);
  border-radius: 0 6px 6px 0;
  box-shadow: 0 0 8px rgba(80, 170, 255, 0.18);
  cursor: pointer;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
}

#tools-panel {
  /* Clear both 16px rail chamfers before laying out labels or costs. */
  padding: calc(var(--hud-frame-inset) + 18px) 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#tools-panel .hud-label {
  font-size: 7px;
  margin-bottom: 8px;
  letter-spacing: 0.24em;
  align-self: stretch;
}

#powerups {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* mockup layout: circular well with the cost riding underneath it */
.pu {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
}

.pu-ring {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.pu .ico {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.game-icon {
  display: block;
  width: 24px;
  height: 24px;
  color: rgba(184, 222, 255, 0.92);
}

.pu .game-icon {
  width: 23px;
  height: 23px;
  color: rgba(190, 226, 255, 0.94);
}

.pu .cost {
  font-family: var(--font);
  font-size: 8px;
  color: var(--gold);
}

.pu.armed .pu-ring {
  background-color: rgba(45, 90, 160, 0.55);
  box-shadow: 0 0 16px rgba(110, 190, 255, 0.6), inset 0 0 10px rgba(110, 190, 255, 0.3);
}

.pu.broke {
  opacity: 0.35;
}

.pu.deny .pu-ring {
  box-shadow: 0 0 12px rgba(255, 96, 96, 0.7), inset 0 0 8px rgba(255, 96, 96, 0.4);
}

.pu.deny {
  animation: pu-shake 0.35s;
}

@keyframes pu-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-3px); }
}

#pu-hint {
  position: fixed;
  top: calc(21% + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  font-size: clamp(9px, 2.6vw, 11px);
  line-height: 1.6;
  text-align: center;
  color: #dfe8ff;
  background: rgba(24, 44, 90, 0.85);
  border: 1px solid rgba(130, 195, 255, 0.45);
  box-shadow: 0 0 12px var(--glow);
  padding: 8px 16px;
  border-radius: 3px;
  max-width: min(78vw, 340px);
  pointer-events: none;
}

#pu-hint.hidden {
  display: none;
}

/* ---- interactive first-round flight guide ---- */
#tutorial-layer {
  position: fixed;
  inset: 0;
  z-index: 8;
  pointer-events: none;
}

#tutorial-layer.hidden {
  display: none;
}

#tutorial-layer.modal-paused {
  opacity: 0;
}

#tutorial-focus {
  position: fixed;
  left: 0;
  top: 0;
  width: 72px;
  height: 72px;
  border: 1px solid rgba(255, 191, 108, 0.95);
  border-radius: 50%;
  box-shadow:
    0 0 0 5px rgba(255, 135, 45, 0.1),
    0 0 19px rgba(255, 137, 43, 0.64),
    inset 0 0 15px rgba(255, 168, 76, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.14s ease, height 0.14s ease;
  will-change: left, top, width, height;
  animation: tutorial-focus-pulse 1.4s ease-in-out infinite;
}

#tutorial-focus::before,
#tutorial-focus::after {
  content: '';
  position: absolute;
  inset: -9px;
  border: 1px dashed rgba(255, 153, 59, 0.52);
  border-radius: inherit;
}

#tutorial-focus::after {
  inset: 8px;
  border-style: solid;
  border-color: rgba(255, 218, 157, 0.25);
}

#tutorial-focus.rect {
  border-radius: 10px;
}

@keyframes tutorial-focus-pulse {
  0%, 100% { opacity: 0.72; }
  50% { opacity: 1; }
}

#tutorial-gesture {
  position: fixed;
  left: 0;
  top: 0;
  width: 100px;
  height: 2px;
  transform-origin: 0 50%;
  background: linear-gradient(90deg, rgba(255, 127, 35, 0.18), rgba(255, 211, 137, 0.94));
  box-shadow: 0 0 9px rgba(255, 137, 43, 0.55);
}

#tutorial-gesture::after {
  content: '';
  position: absolute;
  right: -1px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-top: 2px solid rgba(255, 230, 190, 0.98);
  border-right: 2px solid rgba(255, 230, 190, 0.98);
  transform: translateY(-50%) rotate(45deg);
}

#tutorial-gesture > span {
  position: absolute;
  left: -7px;
  top: -7px;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 236, 204, 0.98);
  border-radius: 50%;
  background: rgba(238, 111, 29, 0.58);
  box-shadow: 0 0 14px rgba(255, 151, 61, 0.86);
  animation: tutorial-finger 1.8s ease-in-out infinite;
}

@keyframes tutorial-finger {
  0%, 18% { transform: translateX(0) scale(0.82); opacity: 0; }
  26% { opacity: 1; }
  72% { transform: translateX(var(--tutorial-travel, 82px)) scale(1); opacity: 1; }
  88%, 100% { transform: translateX(var(--tutorial-travel, 82px)) scale(0.78); opacity: 0; }
}

#tutorial-card {
  position: fixed;
  top: max(calc(env(safe-area-inset-top) + 110px), 13%);
  left: 50%;
  width: min(300px, 78vw);
  min-height: 104px;
  transform: translateX(-50%);
  padding: 18px 20px 15px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: left;
}

#tutorial-progress {
  margin-bottom: 5px;
  font-size: 7px;
  line-height: 1;
  letter-spacing: 0.22em;
  color: rgba(255, 179, 90, 0.92);
  text-transform: uppercase;
}

#tutorial-title {
  font-size: clamp(11px, 3.3vw, 14px);
  line-height: 1.3;
  letter-spacing: 0.12em;
  color: #fff;
  text-transform: uppercase;
  text-shadow: 0 0 12px rgba(255, 139, 45, 0.62);
}

#tutorial-copy {
  margin-top: 7px;
  font-size: clamp(8px, 2.45vw, 10px);
  line-height: 1.55;
  letter-spacing: 0.035em;
  color: rgba(255, 232, 207, 0.88);
}

#tutorial-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
  pointer-events: auto;
}

#tutorial-exit,
#tutorial-action {
  min-height: 34px;
  padding: 7px 10px;
  font-family: var(--font);
  font-size: 7px;
  font-weight: 650;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  cursor: pointer;
}

#tutorial-exit {
  color: rgba(255, 209, 164, 0.68);
  background: rgba(255, 146, 51, 0.035);
  border: 1px solid rgba(255, 170, 84, 0.2);
}

#tutorial-action {
  color: #fff3e7;
  background: rgba(165, 68, 13, 0.62);
  border: 1px solid rgba(255, 180, 96, 0.62);
  box-shadow: 0 0 11px rgba(255, 127, 35, 0.28);
}

#tutorial-action.hidden {
  display: none;
}

@media (max-height: 680px) {
  #tutorial-card {
    top: max(calc(env(safe-area-inset-top) + 92px), 14%);
    min-height: 94px;
    padding: 14px 18px 12px;
  }

  #tutorial-copy {
    line-height: 1.4;
  }
}

/* ---- view rail: manual camera steps layered on the automatic framing ---- */
#zoom-dock {
  position: fixed;
  right: 8px;
  top: 52%;
  transform: translate(0, -50%);
  z-index: 5;
  display: flex;
  align-items: center;
  pointer-events: none;
  transition: transform 0.35s ease;
}

#zoom-dock.collapsed {
  /* Mirror the TOOLS dock: park the panel just beyond the right edge while
     leaving its inward-facing arrow tab fully reachable. */
  transform: translate(calc(100% - 16px), -50%);
}

#zoom-tab {
  flex: 0 0 auto;
  width: 22px;
  height: 58px;
  margin-right: 4px;
  padding: 0;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  color: var(--cyan-label);
  background: var(--fill);
  border: 1px solid var(--line);
  border-radius: 6px 0 0 6px;
  box-shadow: 0 0 8px rgba(80, 170, 255, 0.18);
  cursor: pointer;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
}

#zoom-panel {
  width: 62px;
  padding: calc(var(--hud-frame-inset) + 18px) 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  pointer-events: none;
}

#zoom-panel .hud-label {
  align-self: stretch;
  text-align: right;
  font-size: 7px;
  letter-spacing: 0.18em;
  margin-bottom: 1px;
}

#zoom-panel .hud-label::after {
  transform: scaleX(-1);
}

#zoom-in,
#zoom-out {
  width: 42px;
  height: 42px;
  padding: 0;
  font-family: var(--font);
  font-size: 21px;
  font-weight: 500;
  line-height: 1;
  color: rgba(220, 242, 255, 0.95);
  background-color: transparent;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
}

#zoom-in:disabled,
#zoom-out:disabled {
  opacity: 0.28;
  cursor: default;
}

#zoom-level {
  width: 44px;
  min-height: 11px;
  font-size: 7px;
  line-height: 11px;
  letter-spacing: 0.06em;
  text-align: center;
  color: var(--cyan-label);
  white-space: nowrap;
}

/* ---- bottom bar: solar-system strip + sound buttons, one clean row ---- */
#bottombar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 5;
  display: flex;
  align-items: stretch; /* both panels share the same height and baseline */
  justify-content: center;
  gap: 7px;
  padding: 6px 10px calc(8px + env(safe-area-inset-bottom));
  pointer-events: none;
}

#evo-panel {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 520px;
  display: flex;
  padding: var(--hud-safe-inset);
}

#evo {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  display: block;
  opacity: 0.92;
}

#sound-cluster {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  padding: var(--hud-safe-inset);
  pointer-events: none;
}

#mute,
#music,
#account {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  background-color: transparent;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
}

#mute,
#music,
#account {
  display: flex;
  align-items: center;
  justify-content: center;
}

#mute.off,
#music.off {
  opacity: 0.4;
}

#account .game-icon {
  width: 25px;
  height: 25px;
}

/* ---- dialog cards (game over / spend confirm / settings) ----
   these are hidden during play, so the drop-shadow filter is safe here */
.dialog-card {
  filter: drop-shadow(0 0 16px rgba(80, 170, 255, 0.35));
  padding: 26px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* ---- game over overlay ---- */
#over {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 5, 12, 0.82);
  backdrop-filter: blur(3px);
  padding: 24px;
}

#over.hidden {
  display: none;
}

#over .dialog-card {
  width: min(350px, 92vw);
  max-height: calc(100dvh - 24px);
  padding: 20px 20px 16px;
  overflow: hidden;
}

#over h1 {
  font-size: clamp(23px, 7.2vw, 32px);
  font-weight: 900;
  letter-spacing: 0.22em;
  margin-right: -0.22em;
  color: #fff;
  text-shadow: 0 0 24px rgba(115, 200, 255, 0.72);
}

#final {
  max-width: 100%;
  font-size: clamp(18px, 5.5vw, 24px);
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #fff;
  text-shadow: 0 0 14px rgba(110, 195, 255, 0.65);
  margin-top: 7px;
  white-space: nowrap;
  overflow: hidden;
}

#result-preview-frame {
  position: relative;
  width: min(248px, 67vw);
  aspect-ratio: 1;
  margin-top: 9px;
  padding: 5px;
  background: rgba(5, 12, 29, 0.88);
  border: 1px solid rgba(135, 205, 255, 0.5);
  box-shadow:
    0 0 14px rgba(70, 165, 255, 0.28),
    inset 0 0 12px rgba(70, 165, 255, 0.16);
  clip-path: polygon(10px 0, calc(100% - 10px) 0, 100% 10px, 100% calc(100% - 10px), calc(100% - 10px) 100%, 10px 100%, 0 calc(100% - 10px), 0 10px);
}

#result-preview {
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  display: block;
}

#earn {
  min-height: 16px;
  max-width: 100%;
  font-size: clamp(9px, 2.8vw, 11px);
  color: var(--gold);
  text-shadow: 0 0 10px rgba(255, 200, 80, 0.5);
  margin-top: 7px;
  white-space: nowrap;
  overflow: hidden;
}

#game-over-tip {
  align-self: stretch;
  margin-top: 7px;
  padding: 8px 10px;
  font-size: 7px;
  line-height: 1.55;
  letter-spacing: 0.055em;
  text-align: left;
  color: rgba(255, 226, 194, 0.9);
  background: linear-gradient(90deg, rgba(116, 47, 10, 0.42), rgba(56, 25, 15, 0.2));
  border-left: 2px solid rgba(255, 164, 70, 0.82);
  box-shadow: inset 0 0 12px rgba(255, 124, 38, 0.06);
}

#game-over-tip.hidden {
  display: none;
}

#result-actions {
  align-self: stretch;
  display: flex;
  gap: 9px;
  margin-top: 9px;
}

#restart,
#share-score {
  flex: 1;
  min-width: 0;
  min-height: 46px;
  font-family: var(--font);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #fff;
  background: linear-gradient(135deg, rgba(20, 105, 180, 0.92), rgba(55, 76, 196, 0.94));
  border: 1px solid rgba(150, 215, 255, 0.55);
  border-radius: 3px;
  box-shadow: 0 0 14px rgba(80, 170, 255, 0.45);
  padding: 11px 10px;
  cursor: pointer;
}

#share-score {
  background: linear-gradient(135deg, rgba(17, 126, 166, 0.94), rgba(34, 91, 192, 0.94));
}

#restart span,
#share-score span {
  display: inline-block;
  margin-right: 5px;
  font-size: 16px;
  line-height: 0;
  vertical-align: -1px;
}

#restart:hover,
#share-score:hover {
  filter: brightness(1.15);
}

#share-status {
  min-height: 12px;
  margin-top: 5px;
  font-size: 7px;
  letter-spacing: 0.14em;
  color: var(--cyan-label);
  text-transform: uppercase;
}

@media (max-height: 700px) {
  #over .dialog-card {
    padding-top: 14px;
  }

  #result-preview-frame {
    width: min(206px, 59vw);
  }

  #game-over-tip {
    padding-block: 6px;
    line-height: 1.4;
  }

  #share-status {
    display: none;
  }
}

/* ---- powerup spend confirmation ---- */
#pu-confirm {
  position: fixed;
  inset: 0;
  z-index: 11;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 5, 12, 0.7);
  backdrop-filter: blur(2px);
  padding: 24px;
}

#pu-confirm.hidden {
  display: none;
}

#pu-confirm-card {
  width: min(310px, 86vw);
}

#pu-confirm-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #fff;
  margin-bottom: 10px;
}

#pu-confirm-text {
  font-size: 11px;
  color: rgba(200, 214, 255, 0.85);
  line-height: 1.7;
  margin-bottom: 18px;
}

#pu-confirm-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  align-self: stretch;
}

#pu-cancel,
#pu-ok {
  flex: 1;
  min-height: 44px;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  border-radius: 4px;
  cursor: pointer;
}

#pu-cancel {
  color: rgba(200, 214, 255, 0.85);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
}

#pu-ok {
  color: #1b1500;
  background: linear-gradient(135deg, #ffd75e, #ffb62e);
  border: none;
  box-shadow: 0 0 12px rgba(255, 200, 80, 0.35);
}

/* ---- account modal ---- */
#acct {
  position: fixed;
  inset: 0;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 5, 12, 0.85);
  backdrop-filter: blur(3px);
  padding: 24px;
}

#acct.hidden {
  display: none;
}

#acct .dialog-card {
  width: min(340px, 88vw);
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
}

#acct .dialog-card {
  gap: 12px;
}

#audio-settings {
  align-self: stretch;
  padding: 8px 12px 10px;
  border-top: 1px solid rgba(140, 200, 255, 0.18);
  border-bottom: 1px solid rgba(140, 200, 255, 0.18);
}

#audio-settings .hud-label {
  text-align: left;
  margin-bottom: 10px;
}

#round-settings {
  align-self: stretch;
  padding: 2px 12px 10px;
  border-bottom: 1px solid rgba(140, 200, 255, 0.18);
}

#round-settings .hud-label {
  text-align: left;
  margin-bottom: 8px;
}

#round-settings p {
  margin-top: 6px;
  font-size: 7px;
  line-height: 1.4;
  letter-spacing: 0.08em;
  color: rgba(180, 205, 235, 0.58);
  text-transform: uppercase;
}

#new-round {
  width: 100%;
  min-height: 40px;
  color: #ffd777;
  border-color: rgba(255, 194, 74, 0.38);
  background: rgba(50, 30, 18, 0.45);
}

#replay-tutorial {
  width: 100%;
  min-height: 40px;
  margin-top: 7px;
  color: var(--cyan-label);
  border-color: rgba(105, 190, 255, 0.38);
  background: rgba(14, 39, 72, 0.5);
}

#replay-tutorial.confirming {
  color: #fff;
  border-color: rgba(130, 210, 255, 0.72);
  background: rgba(20, 76, 125, 0.68);
  box-shadow: 0 0 12px rgba(70, 170, 255, 0.3);
}

#new-round.confirming {
  color: #fff;
  border-color: rgba(255, 105, 105, 0.7);
  background: rgba(95, 22, 30, 0.62);
  box-shadow: 0 0 12px rgba(255, 70, 90, 0.25);
}

#audio-controls {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 9px;
}

.audio-control {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 9px;
}

.audio-control > label {
  flex: 0 0 44px;
  text-align: left;
  font-size: 8px;
  letter-spacing: 0.16em;
  color: var(--ink-dim);
}

.audio-control input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  flex: 1 1 auto;
  min-width: 0;
  height: 18px;
  margin: 0;
  accent-color: var(--cyan);
  background: transparent;
  cursor: pointer;
}

.audio-control input[type='range']::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, rgba(95, 190, 255, 0.75), rgba(100, 140, 220, 0.35));
  box-shadow: 0 0 6px rgba(80, 170, 255, 0.25);
}

.audio-control input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  margin-top: -6px;
  border: 1px solid rgba(210, 240, 255, 0.95);
  border-radius: 50%;
  background: #79cfff;
  box-shadow: 0 0 8px rgba(90, 190, 255, 0.75);
}

#acct h2 {
  font-size: clamp(17px, 5vw, 22px);
  font-weight: 700;
  letter-spacing: 0.3em;
  margin-right: -0.3em;
  color: #fff;
  text-shadow: 0 0 14px rgba(120, 190, 255, 0.6);
}

#acct-status {
  font-size: clamp(10px, 3vw, 12px);
  color: rgba(200, 214, 255, 0.8);
  text-align: center;
  max-width: 300px;
  line-height: 1.7;
}

.acct-btn {
  width: min(260px, 74vw);
  min-height: 48px;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: #fff;
  background: rgba(12, 24, 52, 0.7);
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: 0 0 8px rgba(80, 170, 255, 0.16);
  cursor: pointer;
}

.acct-btn.hidden {
  display: none;
}

.acct-btn:disabled {
  cursor: default;
  opacity: 0.85;
}

.acct-btn.loading {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.acct-btn.loading::before {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

#acct-close {
  margin-top: 4px;
  font-family: var(--font);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--ink-dim);
  background: none;
  border: none;
  cursor: pointer;
  padding: 10px 20px;
}

@media (max-height: 650px) {
  #acct {
    padding: 10px;
  }

  #acct .dialog-card {
    gap: 7px;
    padding: 16px 20px;
  }

  #acct-status {
    line-height: 1.4;
  }

  .acct-btn {
    min-height: 40px;
  }
}
