:root {
  color-scheme: dark;
  --accent: #2dd4bf;
  --dark: #071a1f;
  --muted: #658790;
  --light: #c7e5e5;
  --danger: #f87171;
  --food: #ffda83;

  --bg: var(--dark);
  --panel: var(--dark);
  --fg: color-mix(in srgb, var(--light) 94%, #ffffff);
  --dim: var(--dim-surface);
  --dim-surface: color-mix(in srgb, var(--muted) 42%, var(--light));
  --dim-quiet: color-mix(in srgb, var(--muted) 72%, var(--light));
  --danger-text: color-mix(in srgb, var(--danger) 48%, #ffffff);
  --faint: color-mix(in srgb, var(--light) 5%, transparent);
  --line: color-mix(in srgb, var(--light) 13%, transparent);
  --line-strong: color-mix(in srgb, var(--light) 22%, transparent);
  --line-accent: color-mix(in srgb, var(--accent) 42%, transparent);
  --glow: color-mix(in srgb, var(--accent) 22%, transparent);
  --glow-soft: color-mix(in srgb, var(--accent) 12%, transparent);
  --surface: color-mix(in srgb, var(--dark) 78%, color-mix(in srgb, var(--light) 8%, var(--dark)));
  --surface-raised: color-mix(in srgb, var(--dark) 66%, color-mix(in srgb, var(--light) 12%, var(--dark)));
  --glass: color-mix(in srgb, var(--dark) 58%, transparent);
  --glass-strong: color-mix(in srgb, var(--dark) 76%, color-mix(in srgb, var(--light) 4%, var(--dark)));
  --glass-highlight: inset 0 1px 0 color-mix(in srgb, #ffffff 8%, transparent);
  --backdrop: color-mix(in srgb, var(--dark) 72%, transparent);
  --shadow-soft: 0 12px 32px rgba(0, 0, 0, 0.32), 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-modal: 0 32px 80px rgba(0, 0, 0, 0.56), 0 4px 16px rgba(0, 0, 0, 0.28);

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-pill: 999px;
  --touch-target: 44px;

  --font-ui: "Inter", "Plus Jakarta Sans", "SF Pro Display", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", "Cascadia Mono", ui-monospace,
    SFMono-Regular, Menlo, Consolas, monospace;

  --ease-structural: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-smooth: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  color: var(--fg);
  background: var(--bg);
  font: 14px / 1.5 var(--font-ui);
  user-select: none;
  -webkit-user-select: none;
}

.ui-icon {
  flex-shrink: 0;
  display: block;
}

.icon-sound-off { display: none; }
[aria-pressed="false"] .icon-sound-on { display: none; }
[aria-pressed="false"] .icon-sound-off { display: block; }

.keycap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--dim-surface);
  background: color-mix(in srgb, var(--light) 7%, var(--dark));
  border: 1px solid color-mix(in srgb, var(--light) 14%, transparent);
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.3);
}

/* ==========================================================================
   CANVAS & STAGE
   ========================================================================== */
.game {
  position: relative;
  isolation: isolate;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  --atmo-intensity: 14%;
  --atmo-radial-x: 50%;
  --atmo-radial-y: 46%;
  --atmo-radial-spread: 72%;
  --atmo-vignette: 34%;
  --atmo-vignette-spread: 160px;
}

.game-backdrop, .game-canvas {
  position: absolute;
  inset: 0;
}

.game-backdrop {
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(
      circle at 30% 28%,
      color-mix(in srgb, var(--accent) var(--atmo-intensity), transparent),
      transparent var(--atmo-radial-spread)
    ),
    radial-gradient(
      circle at 70% 72%,
      color-mix(in srgb, var(--muted) 11%, transparent),
      transparent 58%
    ),
    var(--bg);
}

.game-backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 var(--atmo-vignette-spread)
    color-mix(in srgb, var(--dark) var(--atmo-vignette), transparent);
}

.game-canvas {
  z-index: 1;
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
  touch-action: none;
  contain: strict;
}
.game.in-title .game-canvas {
  cursor: default;
}
.game.paint-mode .game-canvas {
  cursor: cell;
}

/* ==========================================================================
   BASE BUTTONS (Crisp, Smooth, Softly Lit)
   ========================================================================== */
button {
  font-family: var(--font-ui);
  font-size: 13.5px;
  font-weight: 550;
  color: var(--fg);
  background: color-mix(in srgb, var(--light) 6%, var(--dark));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: var(--touch-target);
  padding: 0 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: var(--glass-highlight);
  transition:
    border-color 200ms var(--ease-structural),
    background-color 200ms var(--ease-structural),
    color 200ms var(--ease-structural),
    box-shadow 220ms var(--ease-structural),
    transform 180ms var(--ease-structural),
    opacity 180ms ease;
}

button:hover {
  background: color-mix(in srgb, var(--light) 10%, var(--dark));
  border-color: color-mix(in srgb, var(--light) 26%, transparent);
}

button:active {
  transform: scale(0.985);
}

button:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 70%, transparent);
  outline-offset: 2px;
}

button.primary {
  background: color-mix(in srgb, var(--accent) 18%, color-mix(in srgb, var(--dark) 78%, transparent));
  border-color: color-mix(in srgb, var(--accent) 46%, transparent);
  color: color-mix(in srgb, var(--accent) 72%, #ffffff);
  box-shadow:
    var(--glass-highlight),
    0 8px 24px color-mix(in srgb, var(--accent) 16%, transparent);
}

button.primary:hover {
  background: color-mix(in srgb, var(--accent) 26%, color-mix(in srgb, var(--dark) 72%, transparent));
  border-color: color-mix(in srgb, var(--accent) 68%, transparent);
  box-shadow:
    var(--glass-highlight),
    0 10px 28px color-mix(in srgb, var(--accent) 24%, transparent);
}

button[aria-pressed="true"]:not(.hud-ghost-btn):not(.utility-pill-btn):not(.pause-btn-tile) {
  background: color-mix(in srgb, var(--accent) 16%, var(--surface-raised));
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
  color: var(--accent);
}

button:disabled {
  opacity: 0.42;
  cursor: default;
  transform: none;
}

button.danger-btn:hover,
button.danger-btn.pad-selected {
  border-color: color-mix(in srgb, var(--danger) 52%, transparent);
  background: color-mix(in srgb, var(--danger) 12%, var(--dark));
  color: var(--danger-text);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--danger) 16%, transparent);
}

button.pad-selected {
  border-color: color-mix(in srgb, var(--accent) 62%, transparent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent),
              0 10px 26px color-mix(in srgb, var(--accent) 18%, transparent);
}

/* ==========================================================================
   MINIMALIST FROSTED IN-GAME HUD
   ========================================================================== */
.game-hud {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: max(16px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  gap: 10px;
  transition: padding-bottom 200ms var(--ease-structural);
}

.game-hud.hud-primed {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.game-hud.hud-entering .hud-top-stack {
  animation: hudSlideInTop 520ms var(--ease-smooth) both;
  will-change: transform, opacity;
}

.game-hud.hud-entering .hud-bottom-row {
  animation: hudSlideInBottom 520ms var(--ease-smooth) 60ms both;
  will-change: transform, opacity;
}

@keyframes hudSlideInTop {
  from { opacity: 0; transform: translateY(-14px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes hudSlideInBottom {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.game.dev-open .game-hud {
  padding-bottom: 312px;
}
.game.dev-open.dev-minimized .game-hud {
  padding-bottom: 62px;
}

.hud-top-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
}

.hud-top-row,
.hud-bottom-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}

.hud-bottom-row {
  align-items: flex-end;
}

.hud-cluster {
  pointer-events: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.hud-combat-dock {
  pointer-events: none;
}

.hud-combat-dock > .ability-chip,
.hud-combat-dock .hud-group > * {
  pointer-events: auto;
}

.hud-combat-dock .hud-group {
  pointer-events: none;
}

.hud-cluster-right {
  justify-content: flex-end;
}

.hud-glass-strip {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 40px;
  padding: 5px 14px;
  background: var(--glass);
  backdrop-filter: blur(18px) saturate(135%);
  -webkit-backdrop-filter: blur(18px) saturate(135%);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  box-shadow: var(--glass-highlight), var(--shadow-soft);
  contain: layout style;
}

.hud-progression-strip {
  padding: 5px 16px;
}

.hud-controls-strip {
  gap: 2px;
  padding: 3px 5px;
}

.hud-level-group {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.hud-lvl-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--dim-surface);
}

.hud-lvl-badge strong {
  color: var(--accent);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.hud-biome-name {
  color: var(--fg);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding-left: 9px;
  border-left: 1px solid var(--line);
  white-space: nowrap;
}

.hud-divider {
  width: 1px;
  height: 20px;
  background: var(--line);
  flex-shrink: 0;
}

.hud-meter {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  min-width: 104px;
  padding: 2px 0;
  contain: layout style;
}

.hud-meter-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  color: var(--dim-quiet);
  letter-spacing: 0.08em;
}

.hud-meter-head strong {
  font-size: 11px;
  font-weight: 600;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
  transition: color 220ms ease;
}

.hud-meter.goal-met .hud-meter-head strong {
  color: var(--accent);
}

.meter-track {
  width: 100%;
  height: 4px;
  background: color-mix(in srgb, var(--light) 10%, transparent);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  width: 100%;
  transform: scaleX(0);
  transform-origin: left center;
  border-radius: var(--radius-pill);
  transition: transform 220ms var(--ease-structural);
  will-change: transform;
}

.meter-fill.mass {
  background: linear-gradient(90deg, color-mix(in srgb, var(--prey, var(--accent)) 78%, var(--accent)), var(--prey, var(--accent)));
}

.meter-fill.xp {
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 72%, var(--light)), var(--accent));
}

.hud-micro-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.09em;
  color: var(--dim-quiet);
}

.hud-credits-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 13px;
  min-height: 40px;
  background: var(--glass);
  backdrop-filter: blur(18px) saturate(135%);
  -webkit-backdrop-filter: blur(18px) saturate(135%);
  border: 1px solid color-mix(in srgb, var(--food, #ffda83) 26%, var(--line));
  border-radius: var(--radius-pill);
  box-shadow: var(--glass-highlight), var(--shadow-soft);
  contain: layout style;
}

.hud-credits-pill .hud-micro-label {
  color: color-mix(in srgb, var(--food, #ffda83) 82%, var(--fg));
}

.hud-credits-pill strong {
  font-family: var(--font-mono);
  color: var(--fg);
  font-size: 13px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.hud-icon-btn {
  min-height: 40px !important;
  padding: 0 14px !important;
  background: var(--glass);
  backdrop-filter: blur(18px) saturate(135%);
  -webkit-backdrop-filter: blur(18px) saturate(135%);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: var(--glass-highlight), var(--shadow-soft);
}

.shop-btn {
  position: relative;
  gap: 7px;
  color: var(--fg);
}

.shop-btn.has-deals {
  border-color: color-mix(in srgb, var(--food, #ffda83) 50%, transparent);
  color: var(--food, #ffda83);
  background: color-mix(in srgb, var(--food, #ffda83) 12%, var(--glass));
  box-shadow:
    var(--glass-highlight),
    0 8px 24px color-mix(in srgb, var(--food, #ffda83) 16%, transparent);
}

.shop-key {
  font-family: var(--font-mono);
  padding: 1px 6px;
  border-radius: 5px;
  background: color-mix(in srgb, var(--light) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--light) 12%, transparent);
  font-size: 10px;
  font-weight: 600;
  color: var(--dim-surface);
}

.shop-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--food, #ffda83);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--food, #ffda83) 24%, transparent);
  animation: softPulse 2.2s ease-in-out infinite;
  will-change: transform, opacity;
}

@keyframes softPulse {
  0%, 100% { opacity: 0.78; transform: scale(0.92); }
  50% { opacity: 1; transform: scale(1.12); }
}

.combo-pill {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  min-width: 126px;
  min-height: 40px;
  padding: 5px 13px;
  background: color-mix(in srgb, var(--food, #ffda83) 11%, var(--glass));
  backdrop-filter: blur(18px) saturate(135%);
  -webkit-backdrop-filter: blur(18px) saturate(135%);
  border: 1px solid color-mix(in srgb, var(--food, #ffda83) 42%, transparent);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-highlight), 0 8px 22px color-mix(in srgb, var(--food, #ffda83) 12%, transparent);
  contain: layout style;
}

.combo-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 10.5px;
}

.combo-row strong {
  color: var(--food, #ffda83);
  letter-spacing: 0.05em;
}

.combo-mult {
  font-size: 10px;
  font-weight: 700;
  color: var(--fg);
}

.combo-track {
  width: 100%;
  height: 3px;
  background: color-mix(in srgb, var(--dark) 50%, transparent);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.combo-fill {
  height: 100%;
  width: 100%;
  transform: scaleX(1);
  transform-origin: left center;
  background: var(--food, #ffda83);
  border-radius: var(--radius-pill);
  transition: transform 90ms linear;
  will-change: transform;
}

.hud-score-pill {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  padding: 0 15px;
  min-height: 40px;
  background: var(--glass);
  backdrop-filter: blur(18px) saturate(135%);
  -webkit-backdrop-filter: blur(18px) saturate(135%);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  box-shadow: var(--glass-highlight), var(--shadow-soft);
  contain: layout style;
  transition: border-color 240ms ease;
}

.hud-score-item {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}

.hud-score-pill strong {
  font-family: var(--font-mono);
  color: var(--fg);
  font-size: 13px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.hud-score-pill.new-best {
  border-color: color-mix(in srgb, var(--food, #ffda83) 48%, transparent);
}

.hud-score-pill.new-best strong#hudScore {
  color: var(--food, #ffda83);
}

.hud-sep {
  width: 1px;
  height: 16px;
  background: var(--line);
}

.hud-ghost-btn {
  min-height: 32px !important;
  padding: 0 11px !important;
  border-radius: var(--radius-pill);
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  font-size: 12.5px;
  font-weight: 550;
  color: var(--dim-surface);
  gap: 6px;
}

.hud-ghost-btn:hover {
  background: color-mix(in srgb, var(--light) 9%, transparent);
  border-color: transparent;
  color: var(--fg);
}

.hud-ghost-btn[aria-pressed="true"] {
  color: var(--fg);
}

.hud-ghost-btn[aria-pressed="false"] {
  color: var(--dim-quiet);
}

.hud-zoom-pill {
  padding: 6px 11px;
  border-radius: var(--radius-pill);
  background: var(--glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--dim-quiet);
}

.toast-row {
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.toast-banner {
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: 600px;
  padding: 8px 18px;
  background: var(--glass-strong);
  backdrop-filter: blur(18px) saturate(135%);
  -webkit-backdrop-filter: blur(18px) saturate(135%);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  border-radius: var(--radius-pill);
  box-shadow: var(--glass-highlight), var(--shadow-soft);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--fg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px) scale(0.98);
  transition:
    opacity 280ms var(--ease-structural),
    transform 280ms var(--ease-structural),
    visibility 0s linear 280ms;
  will-change: opacity, transform;
}

.toast-banner.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  transition:
    opacity 280ms var(--ease-structural),
    transform 280ms var(--ease-structural),
    visibility 0s;
}

.toast-banner strong { color: var(--accent); }

.hud-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.ability-chip {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px;
  min-height: 36px;
  background: var(--glass);
  backdrop-filter: blur(18px) saturate(135%);
  -webkit-backdrop-filter: blur(18px) saturate(135%);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 550;
  color: var(--dim-surface);
  box-shadow: var(--glass-highlight), var(--shadow-soft);
  contain: layout style;
  transition:
    border-color 220ms var(--ease-structural),
    color 220ms var(--ease-structural),
    box-shadow 220ms var(--ease-structural);
}

.ability-chip > * {
  position: relative;
  z-index: 1;
}

.chip-charge {
  position: absolute !important;
  inset: 0;
  z-index: 0 !important;
  transform: scaleX(1);
  transform-origin: left center;
  background: color-mix(in srgb, var(--accent) 13%, transparent);
  transition: transform 90ms linear;
  will-change: transform;
}

.weapon-chip {
  cursor: pointer;
  min-height: 36px !important;
  padding: 6px 13px !important;
  font-size: 12px !important;
  font-weight: 600;
  border-radius: var(--radius-pill);
}

.weapon-chip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.weapon-chip-icon svg {
  width: 15px;
  height: 15px;
  display: block;
}

.weapon-chip .chip-charge {
  background: color-mix(in srgb, var(--food, #ffda83) 14%, transparent);
}

.weapon-chip.equipped {
  border-color: color-mix(in srgb, var(--food, #ffda83) 52%, transparent);
  color: color-mix(in srgb, var(--food, #ffda83) 84%, #ffffff);
  box-shadow:
    var(--glass-highlight),
    0 6px 20px color-mix(in srgb, var(--food, #ffda83) 15%, transparent);
}

#chipBoost.boosting {
  border-color: color-mix(in srgb, var(--accent) 68%, var(--light));
  color: color-mix(in srgb, var(--accent) 55%, #ffffff);
  box-shadow:
    var(--glass-highlight),
    0 6px 22px color-mix(in srgb, var(--accent) 26%, transparent);
}

.ability-chip.active {
  border-color: color-mix(in srgb, var(--accent) 36%, var(--line));
  color: var(--fg);
}

.ability-chip .key {
  font-family: var(--font-mono);
  padding: 1px 6px;
  border-radius: 5px;
  background: color-mix(in srgb, var(--light) 7%, var(--dark));
  border: 1px solid color-mix(in srgb, var(--light) 12%, transparent);
  font-weight: 600;
  font-size: 10px;
  color: var(--dim-surface);
}

/* ==========================================================================
   SPLASH SCREEN — OPEN OCEAN + BIG PLAYER SHIP PLAY BUTTON
   ========================================================================== */
.title-screen {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: clamp(22px, 4vh, 42px) clamp(20px, 4vw, 44px);
  transition: opacity 420ms var(--ease-smooth);
}

.title-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(
    circle at 50% 50%,
    transparent 24%,
    color-mix(in srgb, var(--dark) 54%, transparent) 100%
  );
  opacity: 1;
  transition: opacity 320ms var(--ease-smooth);
  will-change: opacity;
}

.title-top-bar {
  position: relative;
  z-index: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: none;
  transition:
    opacity 320ms var(--ease-structural),
    transform 420ms var(--ease-smooth);
  will-change: transform, opacity;
}

.title-wordmark {
  margin: 0;
  display: inline-flex;
  align-items: center;
  font-family: var(--font-ui);
  font-size: clamp(22px, 3.2vw, 34px);
  font-weight: 300;
  letter-spacing: 0.42em;
  text-indent: 0.42em;
  color: color-mix(in srgb, var(--fg) 92%, #ffffff);
  text-shadow: 0 2px 24px color-mix(in srgb, var(--dark) 80%, transparent);
  transition: filter 320ms ease;
}

.wordmark-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 65%, transparent);
  flex-shrink: 0;
}

.title-best {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--dark) 48%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--dim-surface);
}

.title-best strong {
  color: var(--accent);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

/* Center stage: Dead-center geometric alignment with canvas origin (50%, 50%) */
.title-stage {
  position: fixed;
  inset: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ship-play-btn {
  --ship-rot: 0deg;
  --ship-tx: 0px;
  --ship-ty: 0px;
  position: relative;
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  width: clamp(180px, 24vmin, 232px);
  height: clamp(180px, 24vmin, 232px);
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
  color: var(--accent);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translate3d(var(--ship-tx), var(--ship-ty), 0) rotate(var(--ship-rot));
  transition:
    transform 420ms var(--ease-smooth),
    opacity 360ms ease;
  will-change: transform, opacity;
}

.ship-play-btn:hover,
.ship-play-btn:focus,
.ship-play-btn:focus-visible,
.ship-play-btn:active,
.ship-play-btn.pad-selected {
  background: transparent;
  border: 0;
  box-shadow: none;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.game[data-input-mode="touch"] button:focus,
.game[data-input-mode="touch"] button:focus-visible {
  outline: none;
}

.game[data-input-mode="touch"] .ship-play-btn:hover .ship-svg,
.game[data-input-mode="touch"] .ship-play-btn:focus .ship-svg {
  transform: none;
}

.ship-play-btn:active {
  transform: translate3d(var(--ship-tx), var(--ship-ty), 0) rotate(var(--ship-rot)) scale(0.95);
}

.ship-halo {
  position: absolute;
  inset: -14%;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    color-mix(in srgb, var(--accent) 20%, transparent) 0%,
    color-mix(in srgb, var(--accent) 6%, transparent) 46%,
    transparent 72%
  );
  opacity: 0.72;
  transition: transform 420ms var(--ease-smooth), opacity 320ms ease;
  pointer-events: none;
  will-change: transform, opacity;
}

.ship-play-btn:hover .ship-halo,
.ship-play-btn:focus-visible .ship-halo,
.ship-play-btn.pad-selected .ship-halo {
  opacity: 1;
  transform: scale(1.16);
}

.ship-ring {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  transition:
    transform 460ms var(--ease-smooth),
    border-color 320ms ease,
    opacity 320ms ease;
  will-change: transform, opacity;
}

.ship-ring-inner {
  inset: 8%;
  border: 1px solid color-mix(in srgb, var(--accent) 26%, transparent);
  animation: shipRingBreath 5.2s ease-in-out infinite;
}

.ship-ring-outer {
  inset: -6%;
  border: 1px dashed color-mix(in srgb, var(--light) 14%, transparent);
  animation: shipRingSpin 34s linear infinite;
}

.ship-play-btn:hover .ship-ring-inner,
.ship-play-btn:focus-visible .ship-ring-inner,
.ship-play-btn.pad-selected .ship-ring-inner {
  border-color: color-mix(in srgb, var(--accent) 56%, transparent);
  transform: scale(1.07);
}

.ship-play-btn:hover .ship-ring-outer,
.ship-play-btn:focus-visible .ship-ring-outer,
.ship-play-btn.pad-selected .ship-ring-outer {
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
  transform: scale(1.12);
}

.ship-launch-ripple {
  position: absolute;
  inset: 14%;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  opacity: 0;
  transform: scale(0.7);
  pointer-events: none;
  will-change: transform, opacity;
}

.ship-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 0 22px color-mix(in srgb, var(--accent) 34%, transparent));
  animation: shipIdleFloat 4.6s ease-in-out infinite;
  transition:
    transform 360ms var(--ease-smooth),
    filter 320ms ease;
}

.ship-play-btn:hover .ship-svg,
.ship-play-btn:focus-visible .ship-svg,
.ship-play-btn.pad-selected .ship-svg {
  transform: scale(1.07) translateX(5px);
  filter: drop-shadow(0 0 32px color-mix(in srgb, var(--accent) 55%, transparent));
}

.ship-svg-flame,
.ship-svg-flame-core {
  opacity: 0.28;
  transform-box: fill-box;
  transform-origin: right center;
  transform: scaleX(0.62);
  transition: opacity 280ms ease, transform 340ms var(--ease-smooth);
}

.ship-play-btn:hover .ship-svg-flame,
.ship-play-btn:focus-visible .ship-svg-flame,
.ship-play-btn.pad-selected .ship-svg-flame {
  opacity: 0.92;
  transform: scaleX(1.15);
}

.ship-play-btn:hover .ship-svg-flame-core,
.ship-play-btn:focus-visible .ship-svg-flame-core,
.ship-play-btn.pad-selected .ship-svg-flame-core {
  opacity: 1;
  transform: scaleX(1.25);
}

.ship-svg-prong {
  opacity: 0.72;
  transition: opacity 260ms ease, transform 320ms var(--ease-smooth);
}

.ship-play-btn:hover .ship-svg-prong,
.ship-play-btn:focus-visible .ship-svg-prong {
  opacity: 1;
}

.title-launch-cue {
  position: absolute;
  top: calc(50% + clamp(108px, 14.5vmin, 138px));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  pointer-events: none;
  transition:
    opacity 280ms var(--ease-structural),
    transform 360ms var(--ease-smooth);
  will-change: transform, opacity;
}

.launch-cue-word {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.34em;
  text-indent: 0.34em;
  color: var(--fg);
  opacity: 0.88;
}

.launch-cue-sub {
  font-size: 12px;
  color: var(--dim-quiet);
  letter-spacing: 0.03em;
}

.title-bottom-bar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: relative;
  z-index: 2;
  transition:
    opacity 280ms var(--ease-structural),
    transform 380ms var(--ease-smooth);
  will-change: transform, opacity;
}

.title-controls-hint {
  margin: 0;
  font-size: 12px;
  color: var(--dim-quiet);
  letter-spacing: 0.02em;
}

.title-utilities {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.utility-pill-btn {
  min-height: 36px;
  padding: 0 13px;
  border-radius: var(--radius-pill);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--dim-surface);
  background: color-mix(in srgb, var(--dark) 48%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  box-shadow: var(--glass-highlight);
}

.utility-pill-btn:hover {
  color: var(--fg);
  background: color-mix(in srgb, var(--light) 10%, color-mix(in srgb, var(--dark) 56%, transparent));
  border-color: var(--line-strong);
}

/* Smooth Launch Choreography: Big Ship -> Live Canvas Player Ship */
.title-screen.launching {
  pointer-events: none;
}

.title-screen.launching::before {
  opacity: 0;
}

.title-screen.launching .title-top-bar {
  opacity: 0;
  transform: translateY(-20px);
}

.title-screen.launching .title-wordmark {
  filter: blur(4px);
}

.title-screen.launching .title-launch-cue {
  opacity: 0;
  transform: translateX(-50%) translateY(14px);
}

.title-screen.launching .title-bottom-bar {
  opacity: 0;
  transform: translateY(18px);
}

.title-screen.launching .ship-play-btn {
  animation: shipLaunchMorph 560ms var(--ease-smooth) forwards;
}

.title-screen.launching .ship-svg {
  animation: none;
  transform: none;
}

.title-screen.launching .ship-svg-flame,
.title-screen.launching .ship-svg-flame-core {
  opacity: 1;
  transform: scaleX(1.45);
}

.title-screen.launching .ship-ring-inner,
.title-screen.launching .ship-ring-outer,
.title-screen.launching .ship-halo {
  opacity: 0;
  transform: scale(1.65);
  transition: opacity 320ms ease, transform 480ms var(--ease-smooth);
}

.title-screen.launching .ship-launch-ripple {
  animation: shipLaunchRipple 520ms var(--ease-smooth) forwards;
}

@keyframes shipIdleFloat {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-5px); }
}

@keyframes shipRingBreath {
  0%, 100% { opacity: 0.45; transform: scale(0.98); }
  50% { opacity: 0.9; transform: scale(1.03); }
}

@keyframes shipRingSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes shipLaunchMorph {
  0% {
    transform: translate3d(0, 0, 0) rotate(0deg) scale(1);
    opacity: 1;
  }
  20% {
    transform: translate3d(-4px, 0, 0) rotate(0deg) scale(1.06);
    opacity: 1;
  }
  72% {
    transform: translate3d(0, 0, 0) rotate(0deg) scale(0.35);
    opacity: 0.92;
  }
  100% {
    transform: translate3d(0, 0, 0) rotate(0deg) scale(0.34);
    opacity: 0;
  }
}

@keyframes shipLaunchRipple {
  0% { opacity: 0.85; transform: scale(0.75); }
  100% { opacity: 0; transform: scale(2.4); }
}

/* ==========================================================================
   MODALS — SMOOTH FROSTED GLASS & HIGH READABILITY
   ========================================================================== */
.modal-overlay {
  width: min(740px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--fg);
  overflow: visible;
}

.modal-overlay[open] {
  animation: modalReveal 260ms var(--ease-smooth) both;
}

.modal-overlay::backdrop {
  background: color-mix(in srgb, var(--dark) 62%, rgba(2, 8, 12, 0.72));
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  animation: backdropFadeIn 220ms ease both;
}

@keyframes modalReveal {
  from { opacity: 0; transform: translateY(10px) scale(0.975); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes backdropFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

#pauseModal { width: min(490px, calc(100% - 28px)); }
#overModal { width: min(500px, calc(100% - 28px)); }
.guide-modal { width: min(760px, calc(100% - 28px)); }
.shop-modal { width: min(920px, calc(100% - 24px)); }

.modal-card {
  width: 100%;
  max-height: calc(100dvh - 36px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  margin: auto;
  background:
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--light) 6%, transparent) 0%,
      transparent 28%
    ),
    var(--glass-strong);
  backdrop-filter: blur(26px) saturate(145%);
  -webkit-backdrop-filter: blur(26px) saturate(145%);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xl);
  padding: 28px 30px;
  box-shadow: var(--glass-highlight), var(--shadow-modal);
}

.modal-eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--accent);
  margin-bottom: 4px;
}

.modal-eyebrow.danger {
  color: var(--danger);
}

.modal-card h2 {
  margin: 0 0 8px;
  font-family: var(--font-ui);
  font-size: 26px;
  font-weight: 650;
  letter-spacing: -0.015em;
  line-height: 1.15;
  color: var(--fg);
}

.modal-card p {
  margin: 0 0 18px;
  color: var(--dim-surface);
  font-size: 14px;
  line-height: 1.55;
}

/* Pause Menu — Spacious, Easy to Read, Clear Hierarchy */
.pause-card {
  padding: 30px 30px 26px;
}

.pause-header {
  text-align: center;
  margin-bottom: 24px;
}

.pause-header h2 {
  font-size: 30px;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}

.pause-stats-strip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--light) 5%, var(--dark));
  border: 1px solid var(--line);
}

.pause-stat {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.pause-stat-k {
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--dim-quiet);
}

.pause-stat strong {
  color: var(--fg);
  font-weight: 650;
}

.pause-stat.accent strong {
  color: var(--food, #ffda83);
}

.pause-stat-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--line-strong);
}

.pause-actions {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.pause-btn-main {
  display: inline-flex;
  align-items: center;
  gap: 11px;
}

.pause-btn-hero {
  width: 100%;
  min-height: 56px;
  padding: 0 20px;
  justify-content: space-between;
  border-radius: var(--radius-lg);
  font-size: 16px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.pause-btn-featured {
  width: 100%;
  min-height: 52px;
  padding: 0 20px;
  justify-content: space-between;
  border-radius: var(--radius-lg);
  font-size: 15px;
  font-weight: 600;
  background: color-mix(in srgb, var(--food, #ffda83) 8%, color-mix(in srgb, var(--dark) 75%, transparent));
  border-color: color-mix(in srgb, var(--food, #ffda83) 26%, var(--line));
}

.pause-btn-featured:hover {
  background: color-mix(in srgb, var(--food, #ffda83) 14%, color-mix(in srgb, var(--dark) 70%, transparent));
  border-color: color-mix(in srgb, var(--food, #ffda83) 48%, transparent);
  color: color-mix(in srgb, var(--food, #ffda83) 84%, #ffffff);
}

.pause-deal-pill {
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--dark);
  background: var(--food, #ffda83);
}

.pause-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 2px;
}

.pause-grid:has(#btnPauseFullscreen[hidden]) #btnPauseAudio {
  grid-column: 1 / -1;
}

.pause-btn-tile {
  width: 100%;
  min-height: 50px;
  padding: 0 15px;
  justify-content: space-between;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 550;
  color: var(--fg);
  background: color-mix(in srgb, var(--light) 5%, var(--dark));
}

.pause-btn-tile[aria-pressed="false"] {
  color: var(--dim-surface);
}

.pause-footer-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.pause-btn-subtle {
  flex: 1;
  min-height: 44px;
  font-size: 13.5px;
  font-weight: 550;
  color: var(--dim-surface);
  background: transparent;
  border-color: var(--line);
  box-shadow: none;
}

.pause-btn-subtle:hover {
  color: var(--fg);
  background: color-mix(in srgb, var(--light) 6%, transparent);
}

/* ==========================================================================
   ARMORY SHOP 2.0 — HADES-INSPIRED MINIMAL VECTOR ALTAR + OPTIONAL INSPECT
   ========================================================================== */
.shop-modal::backdrop {
  background: radial-gradient(
    ellipse 70% 60% at 50% 42%,
    color-mix(in srgb, var(--dark) 54%, rgba(2, 8, 12, 0.56)) 0%,
    color-mix(in srgb, var(--dark) 82%, rgba(2, 6, 10, 0.84)) 100%
  );
  backdrop-filter: blur(16px) saturate(125%);
  -webkit-backdrop-filter: blur(16px) saturate(125%);
}

.shop-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px 26px 18px;
  border-radius: 18px;
  background:
    radial-gradient(
      ellipse 72% 44% at 50% -8%,
      color-mix(in srgb, var(--accent) 14%, transparent) 0%,
      transparent 72%
    ),
    radial-gradient(
      ellipse 56% 36% at 50% 108%,
      color-mix(in srgb, var(--food, #ffda83) 6%, transparent) 0%,
      transparent 70%
    ),
    color-mix(in srgb, var(--dark) 86%, color-mix(in srgb, var(--light) 4%, var(--dark)));
  border: 1px solid color-mix(in srgb, var(--light) 16%, transparent);
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, var(--light) 10%, transparent),
    inset 0 0 0 1px color-mix(in srgb, var(--accent) 7%, transparent),
    0 34px 88px rgba(0, 0, 0, 0.62),
    0 4px 18px rgba(0, 0, 0, 0.32);
  overflow: hidden;
}

/* Geometric vector corner brackets (Hades architectural trim in Hexavore lines) */
.shop-corner {
  position: absolute;
  width: 14px;
  height: 14px;
  pointer-events: none;
  z-index: 2;
  opacity: 0.72;
}

.shop-corner::before,
.shop-corner::after {
  content: "";
  position: absolute;
  background: color-mix(in srgb, var(--accent) 68%, var(--light));
}

.shop-corner::before { width: 100%; height: 1.5px; }
.shop-corner::after { width: 1.5px; height: 100%; }

.shop-corner.tl { top: 8px; left: 8px; }
.shop-corner.tl::before, .shop-corner.tl::after { top: 0; left: 0; }
.shop-corner.tr { top: 8px; right: 8px; }
.shop-corner.tr::before, .shop-corner.tr::after { top: 0; right: 0; }
.shop-corner.bl { bottom: 8px; left: 8px; }
.shop-corner.bl::before, .shop-corner.bl::after { bottom: 0; left: 0; }
.shop-corner.br { bottom: 8px; right: 8px; }
.shop-corner.br::before, .shop-corner.br::after { bottom: 0; right: 0; }

/* Header */
.shop-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: nowrap;
}

.shop-brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.shop-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.24em;
  color: color-mix(in srgb, var(--accent) 88%, var(--light));
}

.shop-diamond {
  width: 5px;
  height: 5px;
  transform: rotate(45deg);
  background: var(--accent);
  box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 70%, transparent);
  flex-shrink: 0;
}

.shop-brand h2 {
  margin: 0;
  font-size: 21px;
  font-weight: 450;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--fg) 94%, #ffffff);
  line-height: 1.15;
}

/* Mobile / compact category tabs (hidden on roomy desktop) */
.shop-tabs {
  display: none;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--dark) 62%, transparent);
  border: 1px solid var(--line);
}

.shop-tab {
  position: relative;
  min-height: 32px;
  padding: 0 13px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  background: transparent;
  box-shadow: none;
  font-size: 12px;
  font-weight: 550;
  letter-spacing: 0.04em;
  color: var(--dim-surface);
  gap: 6px;
}

.shop-tab:hover {
  color: var(--fg);
  background: color-mix(in srgb, var(--light) 6%, transparent);
  border-color: transparent;
}

.shop-tab[aria-selected="true"] {
  background: color-mix(in srgb, var(--accent) 16%, color-mix(in srgb, var(--dark) 74%, transparent));
  border-color: color-mix(in srgb, var(--accent) 46%, transparent);
  color: color-mix(in srgb, var(--accent) 72%, #ffffff);
}

.shop-tab-count {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--dim-quiet);
  font-variant-numeric: tabular-nums;
}

.shop-tab[aria-selected="true"] .shop-tab-count {
  color: color-mix(in srgb, var(--accent) 82%, var(--light));
}

.shop-tab-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--food, #ffda83);
  box-shadow: 0 0 8px color-mix(in srgb, var(--food, #ffda83) 72%, transparent);
}

.shop-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.shop-credits-crest {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--food, #ffda83) 9%, color-mix(in srgb, var(--dark) 78%, transparent));
  border: 1px solid color-mix(in srgb, var(--food, #ffda83) 34%, transparent);
  color: var(--food, #ffda83);
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--food, #ffda83) 14%, transparent);
}

.shop-cr-glyph {
  flex-shrink: 0;
  color: var(--food, #ffda83);
}

.shop-credits-crest strong {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: color-mix(in srgb, var(--food, #ffda83) 86%, #ffffff);
}

.shop-cr-unit {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: color-mix(in srgb, var(--food, #ffda83) 72%, var(--dim-surface));
}

.shop-close-btn {
  min-height: 38px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  background: color-mix(in srgb, var(--accent) 14%, color-mix(in srgb, var(--dark) 78%, transparent));
  border-color: color-mix(in srgb, var(--accent) 38%, transparent);
  color: color-mix(in srgb, var(--accent) 70%, #ffffff);
}

.shop-close-btn:hover {
  background: color-mix(in srgb, var(--accent) 22%, color-mix(in srgb, var(--dark) 72%, transparent));
  border-color: color-mix(in srgb, var(--accent) 62%, transparent);
}

/* Hades Geometric Diamond Divider */
.shop-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  flex-shrink: 0;
}

.shop-divider-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    color-mix(in srgb, var(--accent) 34%, var(--line)) 50%,
    transparent 100%
  );
}

.shop-divider.subtle .shop-divider-line {
  background: linear-gradient(
    90deg,
    transparent 0%,
    color-mix(in srgb, var(--light) 18%, transparent) 50%,
    transparent 100%
  );
}

.shop-divider-node {
  width: 6px;
  height: 6px;
  transform: rotate(45deg);
  border: 1px solid color-mix(in srgb, var(--accent) 72%, var(--light));
  background: color-mix(in srgb, var(--accent) 22%, var(--dark));
  box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 44%, transparent);
  flex-shrink: 0;
}

/* Stage & Sections */
.shop-stage {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
}

.shop-section {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.shop-section-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.shop-section-title {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--accent) 84%, var(--light));
  white-space: nowrap;
}

.shop-section-rule {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--line) 0%, transparent 100%);
}

.shop-section-hint {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--dim-quiet);
  white-space: nowrap;
}

.shop-weapons-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.shop-upgrades-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

/* Minimal Boon / Offering Plate */
.shop-plate-wrap {
  position: relative;
  min-width: 0;
}

.shop-card.shop-entering .shop-plate-wrap {
  animation: shopPlateIn 320ms var(--ease-smooth) calc(var(--stagger, 0) * 26ms) both;
}

@keyframes shopPlateIn {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.shop-plate {
  position: relative;
  width: 100%;
  overflow: hidden;
  text-align: left;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--light) 12%, transparent);
  background:
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--light) 4.5%, transparent) 0%,
      transparent 55%
    ),
    color-mix(in srgb, var(--dark) 74%, color-mix(in srgb, var(--light) 3%, var(--dark)));
  box-shadow: inset 0 1px 0 color-mix(in srgb, #ffffff 6%, transparent);
  transition:
    transform 200ms var(--ease-structural),
    border-color 200ms var(--ease-structural),
    background-color 200ms var(--ease-structural),
    box-shadow 220ms var(--ease-structural),
    opacity 180ms ease;
}

.shop-plate::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    115deg,
    transparent 20%,
    color-mix(in srgb, var(--light) 9%, transparent) 50%,
    transparent 80%
  );
  opacity: 0;
  transform: translateX(-55%);
  transition: transform 420ms var(--ease-smooth), opacity 220ms ease;
  pointer-events: none;
}

.shop-plate:hover::after,
.shop-plate.pad-selected::after {
  opacity: 1;
  transform: translateX(45%);
}

/* Weapon Offering Plate (compact vertical altar card) */
.shop-plate.is-weapon {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  min-height: 126px;
  padding: 13px 14px 12px;
}

.shop-plate-top {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding-right: 26px;
}

.shop-slot-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--dim-quiet);
  padding: 1px 6px;
  border-radius: 5px;
  background: color-mix(in srgb, var(--light) 5%, var(--dark));
  border: 1px solid color-mix(in srgb, var(--light) 10%, transparent);
}

/* Upgrade Boon Plate (sleek horizontal banner) */
.shop-plate.is-upgrade {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  min-height: 76px;
  padding: 11px 13px;
}

.shop-plate.is-upgrade .shop-plate-foot {
  align-self: flex-end;
  padding-top: 16px;
}

.shop-plate-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
  width: 100%;
}

.shop-plate-title {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.005em;
  color: var(--fg);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.shop-plate.is-upgrade .shop-plate-title {
  padding-right: 0;
}

.shop-plate-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  min-width: 0;
}

.shop-plate-tag {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim-surface);
  white-space: nowrap;
}

.shop-plate-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-top: auto;
}

.shop-plate.is-upgrade .shop-plate-foot {
  width: auto;
  margin-top: 0;
}

/* Plate States */
.shop-plate.is-affordable {
  border-color: color-mix(in srgb, var(--food, #ffda83) 34%, var(--line));
  background:
    radial-gradient(
      circle at 14% 18%,
      color-mix(in srgb, var(--food, #ffda83) 9%, transparent),
      transparent 60%
    ),
    color-mix(in srgb, var(--dark) 72%, color-mix(in srgb, var(--light) 3%, var(--dark)));
}

.shop-plate.is-equipped {
  border-color: color-mix(in srgb, var(--accent) 56%, transparent);
  background:
    radial-gradient(
      circle at 18% 18%,
      color-mix(in srgb, var(--accent) 16%, transparent),
      transparent 64%
    ),
    color-mix(in srgb, var(--accent) 7%, var(--dark));
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, var(--accent) 20%, transparent),
    0 8px 24px color-mix(in srgb, var(--accent) 14%, transparent);
}

.shop-plate.is-owned {
  border-color: color-mix(in srgb, var(--accent) 26%, var(--line));
}

.shop-plate.is-maxed {
  border-color: color-mix(in srgb, var(--accent) 30%, var(--line));
  background:
    radial-gradient(
      circle at 14% 20%,
      color-mix(in srgb, var(--accent) 10%, transparent),
      transparent 58%
    ),
    color-mix(in srgb, var(--dark) 78%, var(--light) 2%);
}

.shop-plate.is-locked {
  opacity: 0.62;
}

.shop-plate:hover,
.shop-plate.pad-selected {
  opacity: 1;
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 54%, var(--light));
  background:
    radial-gradient(
      circle at 20% 20%,
      color-mix(in srgb, var(--accent) 13%, transparent),
      transparent 66%
    ),
    color-mix(in srgb, var(--light) 6%, var(--dark));
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, #ffffff 10%, transparent),
    0 12px 26px rgba(0, 0, 0, 0.34),
    0 0 0 1px color-mix(in srgb, var(--accent) 24%, transparent);
}

.shop-plate.is-affordable:hover,
.shop-plate.is-affordable.pad-selected {
  border-color: color-mix(in srgb, var(--food, #ffda83) 70%, transparent);
  background:
    radial-gradient(
      circle at 20% 20%,
      color-mix(in srgb, var(--food, #ffda83) 14%, transparent),
      transparent 66%
    ),
    color-mix(in srgb, var(--light) 5%, var(--dark));
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, var(--food, #ffda83) 18%, transparent),
    0 12px 28px color-mix(in srgb, var(--food, #ffda83) 16%, transparent),
    0 0 0 1px color-mix(in srgb, var(--food, #ffda83) 26%, transparent);
}

.shop-plate.just-bought {
  animation: shopBoughtPulse 460ms var(--ease-smooth);
}

@keyframes shopBoughtPulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 70%, transparent); }
  50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 24%, transparent), 0 0 28px color-mix(in srgb, var(--accent) 34%, transparent); }
  100% { box-shadow: inset 0 1px 0 color-mix(in srgb, #ffffff 8%, transparent); }
}

/* Hexagonal Vector Medallion Emblem */
.shop-medallion {
  position: relative;
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--accent);
}

.shop-medallion.sm {
  width: 38px;
  height: 38px;
}

.shop-medallion.lg {
  width: 56px;
  height: 56px;
}

.shop-hex-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.shop-hex-bg {
  fill: color-mix(in srgb, currentColor 11%, var(--dark));
  stroke: color-mix(in srgb, currentColor 38%, transparent);
  stroke-width: 1.5;
  stroke-linejoin: round;
}

.shop-hex-ring {
  fill: none;
  stroke: color-mix(in srgb, currentColor 18%, transparent);
  stroke-width: 1;
  stroke-dasharray: 4 3;
}

.shop-medallion-icon {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.shop-medallion.lg .shop-medallion-icon svg {
  width: 24px;
  height: 24px;
}

.shop-medallion.is-affordable {
  color: var(--food, #ffda83);
}

.shop-medallion.is-equipped,
.shop-medallion.is-maxed {
  color: var(--accent);
  filter: drop-shadow(0 0 10px color-mix(in srgb, var(--accent) 34%, transparent));
}

.shop-medallion.is-locked {
  color: var(--dim-surface);
}

/* Glowing Diamond Rank Pips */
.shop-pips {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.shop-pips.lg {
  gap: 6px;
}

.shop-pip {
  width: 6px;
  height: 6px;
  transform: rotate(45deg);
  border: 1px solid color-mix(in srgb, var(--light) 26%, transparent);
  background: transparent;
  transition: background-color 200ms ease, border-color 200ms ease, box-shadow 200ms ease;
}

.shop-pips.lg .shop-pip {
  width: 7px;
  height: 7px;
}

.shop-pip.filled {
  background: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 85%, #ffffff);
  box-shadow: 0 0 8px color-mix(in srgb, var(--accent) 62%, transparent);
}

/* Price & Status Pills */
.shop-price-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  color: var(--dim-surface);
  white-space: nowrap;
}

.shop-price-pill.is-affordable {
  border-color: color-mix(in srgb, var(--food, #ffda83) 56%, transparent);
  color: var(--food, #ffda83);
  background: color-mix(in srgb, var(--food, #ffda83) 12%, var(--dark));
}

.shop-price-pill.is-owned {
  border-color: color-mix(in srgb, var(--accent) 46%, transparent);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--dark));
}

.shop-price-pill.is-equipped {
  border-color: transparent;
  color: var(--dark);
  background: var(--accent);
}

.shop-price-pill.is-maxed {
  border-color: color-mix(in srgb, var(--accent) 34%, transparent);
  color: color-mix(in srgb, var(--accent) 82%, var(--light));
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

/* Subtle Optional Inspect Trigger ("i") on each offering */
.shop-info-btn {
  position: absolute;
  top: 7px;
  right: 7px;
  z-index: 3;
  width: 24px;
  height: 24px;
  min-height: 24px !important;
  padding: 0 !important;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--light) 14%, transparent);
  background: color-mix(in srgb, var(--dark) 78%, transparent);
  color: var(--dim-surface);
  box-shadow: none;
  opacity: 0.56;
  transition:
    opacity 160ms ease,
    color 160ms ease,
    border-color 160ms ease,
    background-color 160ms ease,
    transform 160ms var(--ease-structural);
}

.shop-plate-wrap:hover .shop-info-btn,
.shop-plate-wrap:focus-within .shop-info-btn,
.shop-info-btn:hover,
.shop-info-btn:focus-visible {
  opacity: 1;
}

.shop-info-btn:hover,
.shop-info-btn:focus-visible {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 56%, transparent);
  background: color-mix(in srgb, var(--accent) 14%, var(--dark));
  transform: scale(1.06);
}

.game[data-input-mode="touch"] .shop-info-btn {
  opacity: 0.86;
  width: 28px;
  height: 28px;
  min-height: 28px !important;
  top: 6px;
  right: 6px;
}

/* Quiet Hades-style Bottom Control Prompt Strip */
.shop-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding-top: 10px;
  border-top: 1px solid color-mix(in srgb, var(--light) 8%, transparent);
  font-size: 11.5px;
  color: var(--dim-quiet);
}

.shop-footer-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.shop-footer-key {
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  font-size: 10px;
}

.shop-footer-sep {
  width: 3px;
  height: 3px;
  transform: rotate(45deg);
  background: color-mix(in srgb, var(--light) 22%, transparent);
}

/* Optional Hades-Style Inspect Popup Layer */
.shop-inspect-layer {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: backdropFadeIn 160ms ease both;
}

.shop-inspect-scrim {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--dark) 74%, rgba(2, 8, 12, 0.78));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.shop-inspect-sheet {
  position: relative;
  z-index: 1;
  width: min(468px, 100%);
  max-height: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px 22px 18px;
  border-radius: 16px;
  background:
    radial-gradient(
      ellipse 80% 50% at 50% -12%,
      color-mix(in srgb, var(--accent) 18%, transparent),
      transparent 72%
    ),
    color-mix(in srgb, var(--dark) 92%, color-mix(in srgb, var(--light) 5%, var(--dark)));
  border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--line-strong));
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, var(--light) 12%, transparent),
    0 24px 64px rgba(0, 0, 0, 0.68);
  animation: inspectReveal 210ms var(--ease-smooth) both;
}

@keyframes inspectReveal {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.shop-inspect-top {
  display: flex;
  align-items: center;
  gap: 14px;
}

.shop-inspect-heading {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}

.shop-inspect-eyebrow {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: 0.18em;
  color: var(--accent);
}

.shop-inspect-title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.15;
  color: var(--fg);
}

.shop-inspect-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}

.shop-inspect-role,
.shop-inspect-slot {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--dim-surface);
}

.shop-inspect-slot {
  padding: 1px 6px;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--light) 5%, var(--dark));
}

.shop-inspect-rank {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  color: var(--dim-surface);
}

.shop-inspect-x {
  align-self: flex-start;
  width: 32px;
  height: 32px;
  min-height: 32px !important;
  padding: 0 !important;
  border-radius: 50%;
  background: transparent;
  border-color: var(--line);
  color: var(--dim-surface);
  box-shadow: none;
}

.shop-inspect-x:hover {
  color: var(--fg);
  border-color: var(--line-strong);
  background: color-mix(in srgb, var(--light) 8%, transparent);
}

.shop-inspect-desc {
  margin: 0 !important;
  font-size: 13.5px !important;
  line-height: 1.55 !important;
  color: color-mix(in srgb, var(--light) 82%, var(--muted)) !important;
}

/* Live Hades-Style Stat Comparison Grid */
.shop-inspect-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.shop-stat-chip {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 9px 11px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--light) 3.5%, var(--dark));
  border: 1px solid color-mix(in srgb, var(--light) 10%, transparent);
}

.shop-stat-chip.has-upgrade {
  border-color: color-mix(in srgb, var(--accent) 22%, var(--line));
}

.shop-stat-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim-quiet);
}

.shop-stat-value {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.shop-stat-cur {
  color: var(--fg);
  font-weight: 600;
}

.shop-stat-chip.has-upgrade .shop-stat-cur {
  color: var(--dim-surface);
  font-weight: 500;
}

.shop-stat-arrow {
  color: var(--accent);
  font-size: 11px;
}

.shop-stat-next {
  color: var(--food, #ffda83);
  font-weight: 700;
}

.shop-inspect-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 4px;
}

.shop-inspect-back {
  min-height: 40px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  background: transparent;
  border-color: var(--line);
  color: var(--dim-surface);
  box-shadow: none;
}

.shop-inspect-cta {
  min-height: 40px;
  min-width: 148px;
  padding: 0 18px;
  border-radius: var(--radius-pill);
  font-weight: 650;
}

.shop-inspect-cta.is-buy {
  background: color-mix(in srgb, var(--food, #ffda83) 18%, color-mix(in srgb, var(--dark) 74%, transparent));
  border-color: color-mix(in srgb, var(--food, #ffda83) 56%, transparent);
  color: color-mix(in srgb, var(--food, #ffda83) 86%, #ffffff);
  box-shadow: var(--glass-highlight), 0 8px 24px color-mix(in srgb, var(--food, #ffda83) 18%, transparent);
}

.shop-inspect-cta.is-buy:hover {
  background: color-mix(in srgb, var(--food, #ffda83) 26%, color-mix(in srgb, var(--dark) 68%, transparent));
  border-color: color-mix(in srgb, var(--food, #ffda83) 76%, transparent);
}

.shop-inspect-cta.is-equip {
  background: color-mix(in srgb, var(--accent) 18%, color-mix(in srgb, var(--dark) 74%, transparent));
  border-color: color-mix(in srgb, var(--accent) 54%, transparent);
  color: color-mix(in srgb, var(--accent) 78%, #ffffff);
}

/* ==========================================================================
   FIELD GUIDE & GAME OVER MODALS
   ========================================================================== */
.modal-head-clean {
  margin-bottom: 18px;
}

.modal-head-clean p {
  margin-bottom: 0;
}

.guide-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 20px;
}

.guide-box {
  background: color-mix(in srgb, var(--light) 4%, var(--dark));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
}

.guide-box h3 {
  margin: 0 0 10px;
  font-size: 12.5px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.guide-box ul {
  margin: 0;
  padding-left: 16px;
  font-size: 13px;
  color: var(--dim-surface);
  line-height: 1.75;
}

.guide-box li strong { color: var(--fg); font-weight: 600; }

.modal-foot-end {
  display: flex;
  justify-content: flex-end;
}

.over-card {
  text-align: center;
}

.over-header p {
  margin-bottom: 18px;
}

.over-heading {
  color: var(--danger-text) !important;
}

.over-score-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 18px 20px;
  margin-bottom: 16px;
  background: radial-gradient(
    circle at 50% 0%,
    color-mix(in srgb, var(--accent) 14%, transparent),
    color-mix(in srgb, var(--light) 3%, var(--dark)) 78%
  );
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
}

.over-score-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  color: var(--dim-quiet);
}

.over-score-val {
  font-family: var(--font-mono);
  font-size: 38px;
  font-weight: 700;
  line-height: 1.05;
  color: var(--food, #ffda83);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.over-new-best {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--dark);
  background: var(--food, #ffda83);
  padding: 3px 11px;
  border-radius: var(--radius-pill);
}

.modal-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 22px;
}

.metric-box {
  background: color-mix(in srgb, var(--light) 4%, var(--dark));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 8px;
  text-align: center;
}

.metric-box .label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--dim-quiet);
}

.metric-box .val {
  display: block;
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--fg);
  margin-top: 3px;
}

.over-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.over-actions .primary {
  min-width: 150px;
}

/* ==========================================================================
   VIRTUAL TWIN-STICK TOUCH CONTROLS (MOBILE 2.0)
   ========================================================================== */
.touch-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.touch-ghost {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  opacity: 0.28;
  pointer-events: none;
  transition: opacity 280ms ease;
}

.touch-ghost-move {
  left: max(54px, calc(env(safe-area-inset-left) + 46px));
  bottom: max(52px, calc(env(safe-area-inset-bottom) + 44px));
}

.touch-ghost-aim {
  right: max(112px, calc(env(safe-area-inset-right) + 104px));
  bottom: max(106px, calc(env(safe-area-inset-bottom) + 96px));
}

.touch-ghost-ring {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 1.5px dashed color-mix(in srgb, var(--accent) 75%, transparent);
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}

.touch-ghost-aim .touch-ghost-ring {
  border-color: color-mix(in srgb, var(--food, #ffda83) 82%, transparent);
  background: color-mix(in srgb, var(--food, #ffda83) 6%, transparent);
}

.touch-ghost-label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--light);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7);
}

.touch-pad {
  position: absolute;
  width: 112px;
  height: 112px;
  margin: -56px 0 0 -56px;
  border-radius: 50%;
  border: 1.5px solid color-mix(in srgb, var(--accent) 44%, transparent);
  background: color-mix(in srgb, var(--dark) 36%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.touch-pad.aim {
  border-color: color-mix(in srgb, var(--food, #ffda83) 50%, transparent);
}

.touch-pad.aim.firing {
  border-color: color-mix(in srgb, var(--food, #ffda83) 88%, transparent);
  box-shadow:
    0 0 0 4px color-mix(in srgb, var(--food, #ffda83) 14%, transparent),
    0 0 26px color-mix(in srgb, var(--food, #ffda83) 26%, transparent);
}

.touch-knob {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 26%, transparent);
  border: 1.5px solid color-mix(in srgb, var(--accent) 82%, transparent);
  box-shadow: 0 4px 16px var(--glow);
}

.touch-pad.aim .touch-knob {
  background: color-mix(in srgb, var(--food, #ffda83) 26%, transparent);
  border-color: color-mix(in srgb, var(--food, #ffda83) 84%, transparent);
}

.touch-pad.aim.firing .touch-knob {
  background: color-mix(in srgb, var(--food, #ffda83) 48%, transparent);
  box-shadow: 0 0 18px color-mix(in srgb, var(--food, #ffda83) 48%, transparent);
}

.touch-actions {
  position: absolute;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 12px;
  pointer-events: none;
}

.touch-btn {
  position: relative;
  pointer-events: auto;
  width: 60px;
  height: 60px;
  min-height: 60px;
  padding: 0;
  border-radius: 50%;
  flex-direction: column;
  gap: 2px;
  font-family: var(--font-mono);
  background: color-mix(in srgb, var(--dark) 62%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid color-mix(in srgb, var(--light) 14%, transparent);
  color: var(--dim-surface);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.34);
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}

.touch-btn:active {
  transform: scale(0.93);
}

.touch-btn.blink {
  width: 64px;
  height: 64px;
  min-height: 64px;
}

.touch-btn.boost {
  margin-bottom: 6px;
}

.touch-ring {
  position: absolute;
  inset: -2px;
  width: calc(100% + 4px);
  height: calc(100% + 4px);
  transform: rotate(-90deg);
  pointer-events: none;
}

.touch-ring-bg,
.touch-ring-fill {
  fill: none;
  stroke-width: 2.6;
}

.touch-ring-bg {
  stroke: color-mix(in srgb, var(--light) 12%, transparent);
}

.touch-ring-fill {
  stroke-dasharray: 163.36;
  stroke-dashoffset: 0;
  stroke-linecap: round;
  transition: stroke-dashoffset 85ms linear, stroke 180ms ease;
}

.touch-btn.blink .touch-ring-fill {
  stroke: var(--accent);
}

.touch-btn.boost .touch-ring-fill {
  stroke: var(--food, #ffda83);
}

.touch-btn.boost.cooling .touch-ring-fill {
  stroke: var(--danger);
}

.touch-btn-icon {
  position: relative;
  z-index: 1;
  display: block;
}

.touch-btn-label {
  position: relative;
  z-index: 1;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1;
}

.touch-btn.blink.ready {
  border-color: color-mix(in srgb, var(--accent) 56%, transparent);
  color: var(--accent);
  box-shadow: 0 6px 22px var(--glow);
}

.touch-btn.boost.ready {
  border-color: color-mix(in srgb, var(--food, #ffda83) 48%, transparent);
  color: var(--food, #ffda83);
}

.touch-btn.boost.boosting {
  background: color-mix(in srgb, var(--food, #ffda83) 22%, var(--dark));
  box-shadow: 0 0 24px color-mix(in srgb, var(--food, #ffda83) 36%, transparent);
}

.touch-btn.boost.cooling {
  border-color: color-mix(in srgb, var(--danger) 42%, transparent);
  color: var(--danger-text);
  opacity: 0.72;
}

/* ==========================================================================
   INPUT-MODE ADAPTIVE UI (MOBILE 2.0 TOUCH HUD & GAMEPAD PROMPTS)
   ========================================================================== */
.game[data-input-mode="gamepad"] .keycap,
.game[data-input-mode="gamepad"] .shop-key,
.game[data-input-mode="gamepad"] .ability-chip .key {
  border-radius: var(--radius-pill);
  padding: 1px 7px;
  border-color: color-mix(in srgb, var(--accent) 44%, transparent);
  color: color-mix(in srgb, var(--accent) 78%, #ffffff);
  background: color-mix(in srgb, var(--accent) 14%, var(--dark));
}

.game[data-input-mode="touch"] #chipBlink,
.game[data-input-mode="touch"] #chipBoost,
.game[data-input-mode="touch"] #zoomReadout,
.game[data-input-mode="touch"] #padBadge,
.game[data-input-mode="touch"] .hud-biome-name,
.game[data-input-mode="touch"] .hud-divider,
.game[data-input-mode="touch"] .hud-best-sep,
.game[data-input-mode="touch"] .hud-best-item,
.game[data-input-mode="touch"] .shop-label,
.game[data-input-mode="touch"] .hud-ghost-btn .btn-label {
  display: none !important;
}

.game[data-input-mode="touch"] .game-hud {
  padding: max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  gap: 6px;
}

.game[data-input-mode="touch"] .hud-top-row {
  align-items: center;
  gap: 8px;
}

.game[data-input-mode="touch"] .hud-cluster {
  flex-wrap: nowrap;
  gap: 6px;
}

.game[data-input-mode="touch"] .hud-progression-strip {
  min-height: 34px;
  padding: 3px 10px;
  gap: 8px;
}

.game[data-input-mode="touch"] .hud-lvl-badge {
  font-size: 9.5px;
}

.game[data-input-mode="touch"] .hud-lvl-badge strong {
  font-size: 11.5px;
}

.game[data-input-mode="touch"] .hud-meter {
  min-width: 64px;
  gap: 2px;
  padding: 0;
}

.game[data-input-mode="touch"] .hud-meter-head {
  font-size: 8.5px;
  gap: 4px;
}

.game[data-input-mode="touch"] .hud-meter-head strong {
  font-size: 9.5px;
}

.game[data-input-mode="touch"] .meter-track {
  height: 3px;
}

.game[data-input-mode="touch"] .hud-credits-pill,
.game[data-input-mode="touch"] .hud-score-pill {
  min-height: 34px;
  padding: 0 10px;
  gap: 5px;
}

.game[data-input-mode="touch"] .hud-credits-pill strong,
.game[data-input-mode="touch"] .hud-score-pill strong {
  font-size: 11.5px;
}

.game[data-input-mode="touch"] .hud-micro-label {
  font-size: 9px;
}

.game[data-input-mode="touch"] .shop-btn {
  min-height: 34px !important;
  width: 34px;
  padding: 0 !important;
}

.game[data-input-mode="touch"] .hud-controls-strip {
  min-height: 34px;
  padding: 2px 3px;
  gap: 1px;
}

.game[data-input-mode="touch"] .hud-ghost-btn {
  min-height: 30px !important;
  width: 30px;
  padding: 0 !important;
}

.game[data-input-mode="touch"] .combo-pill {
  position: fixed;
  top: max(46px, calc(env(safe-area-inset-top) + 40px));
  left: 50%;
  transform: translateX(-50%);
  min-width: 108px;
  min-height: 26px;
  padding: 3px 10px;
  gap: 3px;
  border-radius: var(--radius-pill);
  pointer-events: none;
}

.game[data-input-mode="touch"] .combo-row {
  font-size: 9.5px;
}

.game[data-input-mode="touch"] .toast-banner {
  padding: 5px 13px;
  font-size: 11.5px;
  max-width: min(460px, 82vw);
}

.game[data-input-mode="touch"] .hud-bottom-row {
  justify-content: center;
}

.game[data-input-mode="touch"] .hud-bottom-row > .hud-cluster:last-child {
  display: none;
}

.game[data-input-mode="touch"] .hud-combat-dock {
  justify-content: center;
  gap: 6px;
}

.game[data-input-mode="touch"] .weapon-chip {
  min-height: 32px !important;
  padding: 4px 10px !important;
  font-size: 11px !important;
  gap: 5px;
}

.game[data-input-mode="touch"] .shield-chip {
  min-height: 32px !important;
  padding: 4px 8px !important;
}

.game:focus,
.game:focus-visible,
.game[data-input-mode="touch"] *:focus,
.game[data-input-mode="touch"] *:focus-visible { outline: none; }

/* ==========================================================================
   LEVEL DESIGNER & DEV STUDIO (Zero-Scroll Bottom Dock)
   ========================================================================== */
.dev-studio {
  position: absolute;
  z-index: 3;
  left: 10px;
  right: 10px;
  bottom: 10px;
  display: flex;
  flex-direction: column;
  background: color-mix(in srgb, var(--dark) 94%, var(--light));
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.35;
}

.dev-studio button {
  font-family: var(--font-mono);
  min-height: 26px;
  padding: 0 8px;
  font-size: 11px;
  border-radius: 6px;
  gap: 4px;
  box-shadow: none;
}

.dev-studio input[type="number"],
.dev-studio input[type="text"],
.dev-studio select {
  min-width: 0;
  height: 26px;
  padding: 2px 6px;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--fg);
  font: 11.5px / 1.2 var(--font-mono);
}

.dev-studio input[type="number"]:focus,
.dev-studio input[type="text"]:focus,
.dev-studio select:focus {
  outline: none;
  border-color: var(--accent);
}

.dev-studio input[type="checkbox"] {
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
  margin: 0;
  cursor: pointer;
}

.dev-studio input[type="range"] {
  accent-color: var(--accent);
  height: 4px;
  cursor: pointer;
}

.studio-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--dark) 90%, var(--light));
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  flex-wrap: nowrap;
}

.dev-studio.minimized .studio-bar {
  border-bottom: 0;
  border-radius: var(--radius-lg);
}
.dev-studio.minimized .studio-body,
.dev-studio.minimized .studio-status-bar {
  display: none;
}

.studio-cluster {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.studio-right {
  margin-left: auto;
}

.studio-badge {
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--dark);
  background: var(--accent);
  padding: 2px 6px;
  border-radius: 5px;
}

.studio-level-picker {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.studio-level-picker select {
  min-width: 170px;
  max-width: 220px;
  font-weight: 700;
  color: var(--accent);
  border-color: var(--line-accent);
}

.studio-micro-label {
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--dim-surface);
  font-weight: 700;
}

.studio-btn-group {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.studio-tabs {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.studio-tabs button[role="tab"] {
  min-height: 24px;
  padding: 0 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--dim-surface);
  box-shadow: none;
}

.studio-tabs button[role="tab"]:hover {
  color: var(--fg);
  border-color: var(--line-accent);
}

.studio-tabs button[role="tab"][aria-selected="true"] {
  background: color-mix(in srgb, var(--accent) 18%, var(--surface-raised));
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
}

.studio-telemetry {
  color: var(--dim-surface);
  font-size: 10.5px;
  white-space: nowrap;
  padding: 0 4px;
}

.studio-menu-wrap {
  position: relative;
}

.studio-popover {
  position: absolute;
  right: 0;
  bottom: calc(100% + 6px);
  min-width: 210px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line-accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow-modal);
  z-index: 10;
}

.studio-popover button {
  justify-content: flex-start;
  width: 100%;
  min-height: 28px;
}

.studio-body {
  padding: 8px 10px;
  height: 228px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: hidden;
}

.studio-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 3px 10px;
  border-top: 1px solid var(--line);
  font-size: 10.5px;
  color: var(--dim-surface);
  background: color-mix(in srgb, var(--dark) 92%, var(--light));
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.studio-status-bar [data-tone="ok"] { color: var(--accent); }
.studio-status-bar [data-tone="error"] { color: var(--danger-text); font-weight: 700; }

.studio-eff-summary {
  color: var(--dim-surface);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Studio Multi-Column Grids */
.studio-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  height: 100%;
}

.studio-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  height: 100%;
}

.studio-grid-mods {
  display: grid;
  grid-template-columns: minmax(220px, 28%) minmax(0, 1fr);
  gap: 8px;
  height: 100%;
}

.studio-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 9px;
  background: var(--faint);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 0;
  min-height: 0;
}

.studio-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
}

.studio-card-title {
  margin: 0;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.studio-row {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.studio-field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 82px;
  align-items: center;
  gap: 6px;
}

.studio-field-row.wide {
  grid-template-columns: 78px minmax(0, 1fr);
}

.studio-field-row label,
.studio-field-label {
  color: var(--dim-surface);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.studio-two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px 8px;
}

.studio-three-col {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px 8px;
}

.studio-compact-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.studio-compact-field span {
  font-size: 10px;
  color: var(--dim-surface);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.studio-compact-field input,
.studio-compact-field select {
  width: 100%;
}

.studio-inline-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 68px;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.studio-inline-field span {
  font-size: 10.5px;
  color: var(--dim-surface);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.studio-slider-row {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr) 54px;
  align-items: center;
  gap: 6px;
}

.studio-slider-row span {
  font-size: 10.5px;
  color: var(--dim-surface);
}

.studio-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--fg);
  cursor: pointer;
}

.studio-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-content: flex-start;
  overflow-y: auto;
  min-height: 0;
}

.mod-chip {
  min-height: 24px !important;
  padding: 2px 7px !important;
  font-size: 10.5px !important;
  border-radius: var(--radius-pill) !important;
  background: var(--bg);
  color: var(--dim-surface);
  border: 1px solid var(--line);
}

.mod-chip.from-level {
  border-style: dashed;
  border-color: var(--accent);
  color: var(--fg);
}

.mod-chip.active,
.mod-chip[aria-pressed="true"] {
  background: color-mix(in srgb, var(--accent) 20%, var(--bg));
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
  box-shadow: none;
}

.studio-pill-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.studio-pill-bar button[aria-selected="true"],
.studio-pill-bar button.active {
  background: color-mix(in srgb, var(--accent) 18%, var(--surface-raised));
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
}

.studio-tuning-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px 12px;
  align-content: start;
  flex: 1;
  min-height: 0;
}

.studio-tuning-subgrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  flex: 1;
  min-height: 0;
}

.studio-effects-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 5px 8px;
  align-content: start;
}

.studio-color-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.color-field {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 6px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.color-field input[type="color"] {
  width: 22px;
  height: 20px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.color-field span {
  font-size: 10px;
  color: var(--dim-surface);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.spawn-pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-content: flex-start;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.spawn-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid var(--line);
  font-size: 10px;
  color: var(--dim-surface);
}

.spawn-pill button {
  min-height: 16px;
  padding: 0 3px;
  border: 0;
  background: transparent;
  color: var(--danger-text);
  font-size: 11px;
}

.studio-danger-btn:hover {
  border-color: var(--danger);
  color: var(--danger-text);
}

.studio-muted-note {
  color: var(--dim-surface);
  font-size: 10.5px;
}

.boot-status {
  position: absolute;
  z-index: 4;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: calc(100% - 24px);
  margin: 0;
  padding: 14px 20px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--glass-strong);
  backdrop-filter: blur(18px);
}

/* ==========================================================================
   RESPONSIVE REFINEMENTS
   ========================================================================== */
@media (max-width: 1120px) {
  .studio-bar { flex-wrap: wrap; }
  .studio-body { height: auto; max-height: 46dvh; overflow-y: auto; }
  .studio-grid-4, .studio-grid-3, .studio-tuning-grid, .studio-tuning-subgrid, .studio-grid-mods {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .studio-effects-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 820px), (max-height: 540px) {
  .game-hud {
    padding: max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  }
  .hud-progression-strip {
    padding: 4px 10px;
    gap: 8px;
  }
  .hud-biome-name,
  .hud-divider { display: none; }
  .hud-meter { min-width: 72px; }
  .hud-ghost-btn .btn-label { display: none; }
  .ability-chip, .weapon-chip {
    min-height: 32px !important;
    padding: 4px 10px !important;
    font-size: 11px !important;
  }
  .title-screen {
    padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  }
  .title-bottom-bar {
    flex-direction: column-reverse;
    align-items: center;
    gap: 8px;
  }
  .title-utilities { margin-left: 0; }
  .title-controls-hint { text-align: center; font-size: 11px; }
  .guide-list { grid-template-columns: 1fr 1fr; }
  .studio-grid-4, .studio-grid-3, .studio-tuning-grid, .studio-tuning-subgrid, .studio-grid-mods {
    grid-template-columns: 1fr;
  }
}

/* Shop 2.0 — Compact & Mobile Tabbed Mode (Portrait Phones & Landscape Phones) */
@media (max-width: 759px), (max-height: 560px) {
  .shop-modal { width: min(860px, calc(100% - 18px)); }
  .shop-card { padding: 15px 18px 13px; gap: 10px; border-radius: 16px; }
  .shop-corner { width: 10px; height: 10px; }
  .shop-corner.tl { top: 6px; left: 6px; }
  .shop-corner.tr { top: 6px; right: 6px; }
  .shop-corner.bl { bottom: 6px; left: 6px; }
  .shop-corner.br { bottom: 6px; right: 6px; }
  .shop-tabs { display: inline-flex; }
  .shop-section-head { display: none; }
  .shop-stage { gap: 10px; }
  .shop-brand .shop-eyebrow { display: none; }
  .shop-brand h2 { font-size: 15px; letter-spacing: 0.14em; }
  .shop-credits-crest { min-height: 34px; padding: 0 11px; gap: 6px; }
  .shop-credits-crest strong { font-size: 13.5px; }
  .shop-close-btn { min-height: 34px; padding: 0 12px; font-size: 12px; }
  .shop-footer { padding-top: 7px; font-size: 10.5px; gap: 6px 10px; }
}

/* Mobile Landscape (short viewport height, generous width — e.g. Android sensorLandscape) */
@media (max-height: 560px) and (min-width: 561px) {
  .shop-card { padding: 12px 16px 10px; gap: 8px; }
  .shop-weapons-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .shop-upgrades-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .shop-plate.is-weapon { min-height: 112px; padding: 10px 11px; gap: 7px; }
  .shop-plate.is-upgrade { min-height: 66px; padding: 8px 10px; gap: 9px; }
  .shop-medallion { width: 34px; height: 34px; }
  .shop-medallion.sm { width: 32px; height: 32px; }
  .shop-medallion-icon svg { width: 16px; height: 16px; }
  .shop-plate-title { font-size: 12.5px; }
  .shop-plate-tag { font-size: 9px; }
  .shop-price-pill { font-size: 9.5px; padding: 2px 7px; }
  .shop-inspect-layer { padding: 10px; }
  .shop-inspect-sheet {
    width: min(560px, 100%);
    padding: 13px 16px 12px;
    gap: 9px;
  }
  .shop-medallion.lg { width: 42px; height: 42px; }
  .shop-medallion.lg .shop-medallion-icon svg { width: 20px; height: 20px; }
  .shop-inspect-title { font-size: 17px; }
  .shop-inspect-desc { font-size: 12.5px !important; line-height: 1.4 !important; }
  .shop-inspect-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .shop-stat-chip { padding: 6px 8px; }
  .shop-stat-value { font-size: 11.5px; }
  .shop-inspect-back, .shop-inspect-cta { min-height: 36px; font-size: 12.5px; }
}

/* Mobile Portrait (narrow width) */
@media (max-width: 759px) and (min-height: 561px) {
  .shop-header { flex-wrap: wrap; row-gap: 10px; }
  .shop-brand { order: 1; }
  .shop-header-right { order: 2; margin-left: auto; }
  .shop-tabs { order: 3; width: 100%; }
  .shop-tab { flex: 1; justify-content: center; }
  .shop-weapons-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .shop-upgrades-grid { grid-template-columns: 1fr; gap: 8px; }
  .shop-plate.is-weapon { min-height: 124px; }
  .shop-plate.is-upgrade { min-height: 68px; }
}

@media (max-width: 560px) and (max-height: 560px) {
  .shop-header { flex-wrap: wrap; row-gap: 8px; }
  .shop-tabs { order: 3; width: 100%; }
  .shop-tab { flex: 1; justify-content: center; }
  .shop-weapons-grid, .shop-upgrades-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .shop-plate.is-upgrade {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-rows: auto auto;
    row-gap: 6px;
  }
  .shop-plate.is-upgrade .shop-plate-foot {
    grid-column: 1 / -1;
    padding-top: 0;
  }
}

@media (max-height: 500px) {
  .ship-play-btn {
    width: clamp(120px, 34vh, 168px);
    height: clamp(120px, 34vh, 168px);
  }
  .title-launch-cue {
    top: calc(50% + clamp(68px, 19vh, 98px));
    gap: 2px;
  }
  .launch-cue-word { font-size: 11.5px; }
  .launch-cue-sub { font-size: 11px; }
  .title-wordmark { font-size: clamp(15px, 2.6vw, 21px); }
  .title-bottom-bar {
    flex-direction: row;
    justify-content: space-between;
  }
  .title-controls-hint { text-align: left; }
  .modal-card { padding: 16px 20px; border-radius: 18px; }
  .shop-card { padding: 11px 15px 9px; border-radius: 15px; }
  .pause-card { padding: 16px 20px; }
  .pause-header { margin-bottom: 12px; }
  .pause-header h2 { font-size: 22px; margin-bottom: 8px; }
  .pause-actions { gap: 8px; }
  .pause-btn-hero { min-height: 44px; font-size: 14.5px; }
  .pause-btn-featured { min-height: 42px; font-size: 13.5px; }
  .pause-btn-tile { min-height: 40px; font-size: 13px; }
  .pause-footer-row { margin-top: 4px; padding-top: 10px; }
  .pause-btn-subtle { min-height: 38px; font-size: 12.5px; }
  .modal-card h2 { font-size: 20px; }
  .shop-brand h2 { font-size: 14px; }
  .over-score-hero { padding: 10px 14px; margin-bottom: 10px; }
  .over-score-val { font-size: 28px; }
  .modal-metrics { margin-bottom: 14px; gap: 8px; }
  .metric-box { padding: 8px 6px; }
  .metric-box .val { font-size: 15px; }
}

@media (max-width: 560px) {
  .game[data-input-mode="touch"] .hud-top-row {
    flex-wrap: wrap;
    row-gap: 6px;
  }
  .game[data-input-mode="touch"] .hud-meter { min-width: 48px; }
  .game[data-input-mode="touch"] .hud-bottom-row {
    justify-content: flex-start;
  }
  .game[data-input-mode="touch"] .hud-combat-dock {
    justify-content: flex-start;
    max-width: calc(100% - 156px);
  }
  .modal-card { padding: 20px 16px; border-radius: 20px; }
  .shop-card { padding: 14px 14px 12px; border-radius: 16px; }
  .pause-grid { grid-template-columns: 1fr; }
  .pause-footer-row { flex-direction: column; align-items: stretch; }
  .modal-metrics { grid-template-columns: repeat(2, 1fr); }
  .guide-list { grid-template-columns: 1fr; }
}

/* ==========================================================================
   ACCESSIBILITY
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .shop-plate:hover { transform: none; }
}

@media (forced-colors: active) {
  .game-backdrop { display: none; }
  .hud-glass-strip, .hud-score-pill, .hud-credits-pill, .ability-chip, .modal-card, .shop-inspect-sheet, .dev-studio, .boot-status {
    border-color: CanvasText;
    background: Canvas;
  }
  .modal-overlay::backdrop { background: Canvas; }
}
