/* STELLAR DRIFT - retro vector UI */

:root {
  --bg: #02030a;
  --bg-2: #050818;
  --fg: #d5e5ff;
  --dim: #6f7e9b;
  --accent: #00e0ff;
  --accent-2: #38bdf8;
  --warn: #ff4d6d;
  --good: #84ffb2;
  --gold: #facc15;
  --panel: rgba(7, 12, 28, 0.92);
  --line: rgba(0, 224, 255, 0.28);
  --line-strong: rgba(0, 224, 255, 0.55);
  --shadow: 0 0 18px rgba(0, 224, 255, 0.35);
  --panel-inset: inset 0 0 60px rgba(0, 224, 255, 0.04);
  --overlay-backdrop: rgba(2, 3, 10, 0.65);
  --overlay-blur: 3px;
  --focus-ring: 0 0 0 4px rgba(0, 224, 255, 0.22), 0 0 14px rgba(0, 224, 255, 0.35);
  --mono: "JetBrains Mono", "Fira Code", "Consolas", ui-monospace, monospace;
  --tv-ui-scale: 1.06;
  --game-left: 0px;
  --game-top: 0px;
  --game-width: 100vw;
  --game-height: 100vh;
  --game-right: 0px;
  --game-bottom: 0px;
}

body[data-theme="neon"] {
  --bg: #02030a;
  --bg-2: #050818;
  --fg: #d5e5ff;
  --dim: #6f7e9b;
  --accent: #00e0ff;
  --accent-2: #38bdf8;
  --warn: #ff4d6d;
  --good: #84ffb2;
  --gold: #facc15;
  --panel: rgba(7, 12, 28, 0.92);
  --line: rgba(0, 224, 255, 0.28);
  --line-strong: rgba(0, 224, 255, 0.55);
  --shadow: 0 0 18px rgba(0, 224, 255, 0.35);
  --panel-inset: inset 0 0 60px rgba(0, 224, 255, 0.04);
  --overlay-backdrop: rgba(2, 3, 10, 0.65);
  --overlay-blur: 3px;
  --focus-ring: 0 0 0 4px rgba(0, 224, 255, 0.22), 0 0 14px rgba(0, 224, 255, 0.35);
}

body[data-theme="pixel16"] {
  --bg: #111318;
  --bg-2: #1a1f2b;
  --fg: #f4ecd8;
  --dim: #a89b7d;
  --accent: #7fb069;
  --accent-2: #d46a2c;
  --warn: #d94b3d;
  --good: #7fb069;
  --gold: #c0b498;
  --panel: rgba(28, 24, 20, 0.96);
  --line: rgba(127, 176, 105, 0.34);
  --line-strong: rgba(127, 176, 105, 0.62);
  --shadow: none;
  --panel-inset: inset 0 0 0 rgba(0, 0, 0, 0);
  --overlay-backdrop: rgba(14, 12, 10, 0.82);
  --overlay-blur: 0px;
  --focus-ring: 0 0 0 3px rgba(127, 176, 105, 0.30);
}

body[data-theme="pixel16"] .title-name,
body[data-theme="pixel16"] .title-name .title-glitch,
body[data-theme="pixel16"] .panel h2,
body[data-theme="pixel16"] .hud-value,
body[data-theme="pixel16"] .big-event,
body[data-theme="pixel16"] .score-float {
  text-shadow: none;
  filter: none;
}

body[data-theme="pixel16"] .panel::before,
body[data-theme="pixel16"] .panel::after,
body[data-theme="pixel16"] .dock-panel::before,
body[data-theme="pixel16"] .dock-panel::after {
  display: none;
}

body[data-theme="pixel16"] .overlay,
body[data-theme="pixel16"] #dock-overlay {
  backdrop-filter: none;
}

body[data-theme="pixel16"] .btn,
body[data-theme="pixel16"] .action-prompt,
body[data-theme="pixel16"] .action-bar,
body[data-theme="pixel16"] .setting-row.console-selected,
body[data-theme="pixel16"] .theme-btn.active,
body[data-theme="pixel16"] .diff-btn.active {
  box-shadow: none !important;
}

body[data-theme="pixel16"] #title .title-inner {
  background: #1b1714;
  image-rendering: pixelated;
}

body[data-theme="pixel16"] #title .title-actions .btn,
body[data-theme="pixel16"] .action-bar {
  border-top: 2px solid var(--line);
  background: #14110f;
}

body[data-theme="arcade"] {
  --bg: #07131d;
  --bg-2: #0f2230;
  --fg: #eef6ff;
  --dim: #86a3bc;
  --accent: #42c8ff;
  --accent-2: #2ef2b5;
  --warn: #ff6b4a;
  --good: #6ff7a1;
  --gold: #ffd166;
  --panel: rgba(10, 24, 35, 0.94);
  --line: rgba(66, 200, 255, 0.3);
  --line-strong: rgba(66, 200, 255, 0.6);
  --shadow: 0 12px 34px rgba(0, 0, 0, 0.35);
  --panel-inset: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  --overlay-backdrop: rgba(5, 12, 18, 0.7);
  --overlay-blur: 1px;
  --focus-ring: 0 0 0 4px rgba(66, 200, 255, 0.24), 0 10px 28px rgba(0, 0, 0, 0.28);
}

body[data-theme="arcade"] .panel,
body[data-theme="arcade"] .dock-panel,
body[data-theme="arcade"] .action-prompt,
body[data-theme="arcade"] #title .title-inner,
body[data-theme="arcade"] .action-bar {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(0, 0, 0, 0.08)), var(--panel);
}

body[data-theme="arcade"] .btn.primary {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(66, 200, 255, 0.18));
}

body[data-theme="realistic"] {
  --bg: #02060c;
  --bg-2: #08121e;
  --fg: #d8e2ee;
  --dim: #5f7084;
  --accent: #8ea3ba;
  --accent-2: #5f7084;
  --warn: #b94a4a;
  --good: #5f8f6a;
  --gold: #d8e2ee;
  --panel: rgba(8, 18, 30, 0.96);
  --line: rgba(142, 163, 186, 0.28);
  --line-strong: rgba(142, 163, 186, 0.55);
  --shadow: none;
  --panel-inset: inset 0 0 0 rgba(0, 0, 0, 0);
  --overlay-backdrop: rgba(2, 6, 12, 0.72);
  --overlay-blur: 0px;
  --focus-ring: 0 0 0 3px rgba(142, 163, 186, 0.30);
}

body[data-theme="realistic"] .title-name,
body[data-theme="realistic"] .title-name .title-glitch,
body[data-theme="realistic"] .panel h2,
body[data-theme="realistic"] .hud-value,
body[data-theme="realistic"] .big-event,
body[data-theme="realistic"] .score-float,
body[data-theme="realistic"] .dock-header-name,
body[data-theme="realistic"] .catalog-detail-name {
  text-shadow: none;
  filter: none;
  animation: none;
}

body[data-theme="realistic"] .panel::before,
body[data-theme="realistic"] .panel::after,
body[data-theme="realistic"] .dock-panel::before,
body[data-theme="realistic"] .dock-panel::after {
  display: none;
}

body[data-theme="realistic"] .overlay,
body[data-theme="realistic"] #dock-overlay {
  backdrop-filter: none;
}

body[data-theme="realistic"] .btn,
body[data-theme="realistic"] .action-prompt,
body[data-theme="realistic"] .action-bar,
body[data-theme="realistic"] .setting-row.console-selected,
body[data-theme="realistic"] .theme-btn.active,
body[data-theme="realistic"] .diff-btn.active,
body[data-theme="realistic"] .dock-tab.active,
body[data-theme="realistic"] .dock-catalog-card:hover,
body[data-theme="realistic"] .dock-catalog-card.selected,
body[data-theme="realistic"] .dock-upgrade-card:hover {
  box-shadow: none !important;
}

body[data-theme="realistic"] .panel,
body[data-theme="realistic"] .dock-panel,
body[data-theme="realistic"] .action-prompt,
body[data-theme="realistic"] #title .title-inner,
body[data-theme="realistic"] .action-bar,
body[data-theme="realistic"] .dock-section,
body[data-theme="realistic"] .dock-footer {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(0, 0, 0, 0.10)), var(--panel);
}

body[data-theme="realistic"] #title .title-actions .btn,
body[data-theme="realistic"] .action-bar {
  border-top: 1px solid var(--line);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(ellipse at 50% 40%, #0a1230 0%, #02030a 70%) #02030a;
  color: var(--fg);
  font-family: var(--mono);
  letter-spacing: 0.04em;
  overflow: hidden;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

body.tv-ui {
  zoom: var(--tv-ui-scale);
}

body.tv-ui .hud-label,
body.tv-ui .hud-value,
body.tv-ui .hud-sub,
body.tv-ui .hud-stat,
body.tv-ui .bar-label,
body.tv-ui .combo-chip,
body.tv-ui .radar-label,
body.tv-ui .action-bar,
body.tv-ui .btn,
body.tv-ui .panel,
body.tv-ui .dock-panel,
body.tv-ui .title-name,
body.tv-ui .title-tag,
body.tv-ui .title-foot,
body.tv-ui .setting-row,
body.tv-ui .lb-list,
body.tv-ui .go-stats,
body.tv-ui .hint,
body.tv-ui .ctrl-list,
body.tv-ui .catalog-desc,
body.tv-ui .catalog-detail-desc,
body.tv-ui .catalog-detail-meta,
body.tv-ui .catalog-owned,
body.tv-ui .dock-copy-line {
  letter-spacing: 0.08em;
}

body.tv-ui .panel,
body.tv-ui .dock-panel {
  box-shadow: 0 0 24px rgba(0, 224, 255, 0.35), var(--panel-inset);
}

body[data-theme="realistic"].tv-ui .panel,
body[data-theme="realistic"].tv-ui .dock-panel {
  box-shadow: none;
}

body.tv-ui .panel h2,
body.tv-ui .dock-header-name,
body.tv-ui .catalog-detail-name,
body.tv-ui .title-name {
  text-shadow: 0 0 14px rgba(0, 224, 255, 0.45);
}

body[data-theme="realistic"].tv-ui .panel h2,
body[data-theme="realistic"].tv-ui .dock-header-name,
body[data-theme="realistic"].tv-ui .catalog-detail-name,
body[data-theme="realistic"].tv-ui .title-name {
  text-shadow: none;
}

body.tv-ui .hud-label {
  font-size: 14px;
}

body.tv-ui .hud-value {
  font-size: 22px;
}

body.tv-ui .hud-sub,
body.tv-ui .bar-label,
body.tv-ui .radar-label,
body.tv-ui .title-tag,
body.tv-ui .title-foot,
body.tv-ui .setting-row,
body.tv-ui .hint,
body.tv-ui .ctrl-list,
body.tv-ui .go-label,
body.tv-ui .catalog-kind,
body.tv-ui .catalog-cost,
body.tv-ui .dock-copy-line,
body.tv-ui .dock-svc-cost {
  font-size: 14px;
}

body.tv-ui .btn {
  font-size: 15px;
  padding: 16px 22px;
}

body.tv-ui .panel {
  padding: 30px 36px;
}

body.tv-ui .ship-selector-panel,
body.tv-ui .settings-panel,
body.tv-ui .dock-panel,
body.tv-ui .title-inner {
  max-width: none;
}

body.tv-ui .ship-selector-panel {
  width: min(96vw, 980px);
  max-height: 92vh;
  min-width: 0;
  padding: 24px 28px 18px;
}

body.tv-ui .ship-selection,
body.tv-ui .color-selection {
  margin-bottom: 10px;
}

body.tv-ui .ship-select-header,
body.tv-ui .color-select-header {
  margin-bottom: 6px;
}

body.tv-ui .ship-grid,
body.tv-ui .color-grid {
  gap: 6px;
}

body.tv-ui .color-option {
  width: 64px;
  height: 72px;
  padding: 4px 3px;
}

body.tv-ui .ship-preview {
  margin-bottom: 12px;
  padding: 10px;
}

body.tv-ui #ship-preview-canvas {
  width: 160px;
  height: 160px;
}

body.tv-ui .title-actions {
  gap: 8px;
  margin-top: 10px;
}

body.tv-ui .settings-panel {
  max-height: 92vh;
  min-width: min(640px, 96vw);
  padding: 24px 28px;
}

body.tv-ui .setting-row {
  gap: 8px;
}

body.tv-ui .dock-catalog-grid {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}

body.tv-ui .dock-left canvas {
  width: min(100%, 500px);
}

canvas#stage {
  position: fixed;
  left: var(--game-left);
  top: var(--game-top);
  width: var(--game-width);
  height: var(--game-height);
  display: block;
  background: transparent;
  image-rendering: pixelated;
  cursor: none;
}

.hidden { display: none !important; }

/* ===== OVERLAYS ===== */
.overlay {
  position: fixed;
  left: var(--game-left);
  top: var(--game-top);
  width: var(--game-width);
  height: var(--game-height);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(10px, 1.6vh) max(12px, 1.6vw);
  background: var(--overlay-backdrop);
  backdrop-filter: blur(var(--overlay-blur));
  z-index: 50;
  overflow: auto;
  animation: fadein 0.25s ease-out;
}

@keyframes fadein {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow), var(--panel-inset);
  padding: 32px 40px;
  min-width: 340px;
  max-width: 520px;
  max-height: calc(var(--game-height) - 28px);
  text-align: center;
  position: relative;
  overflow: auto;
}

.panel::before,
.panel::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border: 1px solid var(--accent);
}
.panel::before { top: 0; left: 0; border-right: 0; border-bottom: 0; }
.panel::after { bottom: 0; right: 0; border-left: 0; border-top: 0; }

.panel h2 {
  margin: 0 0 18px;
  font-size: 24px;
  letter-spacing: 0.32em;
  color: var(--accent);
  text-shadow: 0 0 12px rgba(0, 224, 255, 0.5);
}

/* ===== SHIP SELECTOR ===== */
.ship-selector-panel {
  min-width: 560px;
  max-width: 800px;
}
.ship-selection {
  margin-bottom: 16px;
}
.color-selection {
  margin-bottom: 16px;
}
.ship-selection, .color-selection {
  display: flex;
  flex-direction: column;
}
.ship-select-header, .color-select-header {
  font-size: 11px;
  color: var(--dim);
  letter-spacing: 0.3em;
  margin-bottom: 10px;
  text-transform: uppercase;
}
.ship-grid {
  display: flex;
  flex-direction: row;
  gap: 8px;
}
.ship-grid .ship-option {
  flex: 1;
}
.color-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}
.ship-option, .color-option {
  padding: 10px 12px;
  border: 1px solid rgba(0, 224, 255, 0.15);
  background: rgba(0, 224, 255, 0.04);
  color: var(--fg);
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 12px;
  letter-spacing: 0.12em;
}
.ship-option:hover, .ship-option:focus,
.color-option:hover, .color-option:focus {
  border-color: var(--accent);
  background: rgba(0, 224, 255, 0.12);
  outline: none;
}
.ship-option.selected, .color-option.selected {
  border-color: var(--accent);
  background: rgba(0, 224, 255, 0.18);
  color: var(--accent);
  box-shadow: 0 0 12px rgba(0, 224, 255, 0.3);
}
/* Color swatch buttons — circle + label, 6-column grid */
.color-option {
  width: 72px;
  height: 80px;
  padding: 6px 4px 5px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 2px solid rgba(0, 224, 255, 0.2);
  background: rgba(0, 224, 255, 0.03);
}
.color-option:hover, .color-option:focus {
  border-color: rgba(255, 255, 255, 0.55);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.05);
}
.color-option.selected {
  border-color: #fff;
  box-shadow: 0 0 0 2px var(--swatch-color, var(--accent)),
              0 0 16px var(--swatch-color, var(--accent));
  background: rgba(255, 255, 255, 0.06);
}
.color-swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 8px var(--swatch-color, transparent);
}
.color-option.selected .color-swatch {
  box-shadow: 0 0 0 2px rgba(255,255,255,0.9),
              0 0 12px var(--swatch-color, var(--accent));
}
.color-name {
  font-size: 8px;
  letter-spacing: 0.12em;
  color: var(--dim);
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 68px;
  text-align: center;
}
.color-option.selected .color-name {
  color: var(--fg);
}
.ship-preview {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
  padding: 20px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.4);
  border-radius: 2px;
  position: relative;
  overflow: hidden;
}
.ship-preview::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(0, 224, 255, 0.06) 0%, transparent 70%);
  pointer-events: none;
}
#ship-preview-canvas {
  image-rendering: pixelated;
  filter: drop-shadow(0 0 14px rgba(0, 224, 255, 0.5)) drop-shadow(0 0 4px rgba(0, 224, 255, 0.25));
}

body[data-theme="realistic"] #ship-preview-canvas {
  image-rendering: auto;
  filter: none;
}

body[data-theme="realistic"] .ship-preview::before {
  background: radial-gradient(circle at 50% 50%, rgba(142, 163, 186, 0.08) 0%, transparent 72%);
}

body[data-theme="realistic"] #stage {
  image-rendering: pixelated;
  filter: brightness(1.08) saturate(0.92) contrast(1.12);
}
/* ===== TITLE SCREEN ===== */
#title .title-inner {
  text-align: center;
  position: relative;
  width: min(1100px, calc(100vw - 72px));
  min-height: min(640px, calc(100vh - 100px));
  display: grid;
  align-content: center;
  justify-items: center;
  padding: 36px 24px 120px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(0,0,0,0.14)), var(--panel);
  box-shadow: var(--shadow), var(--panel-inset);
}

.title-name {
  font-size: clamp(40px, 9vw, 120px);
  letter-spacing: 0.18em;
  margin: 0;
  line-height: 1;
  display: flex;
  gap: 0.4em;
  justify-content: center;
  flex-wrap: wrap;
  color: var(--fg);
  text-shadow:
    0 0 8px rgba(0, 224, 255, 0.5),
    0 0 24px rgba(0, 224, 255, 0.3);
}

.title-name .title-glitch {
  color: var(--accent);
  position: relative;
  animation: glitch 4s infinite steps(1);
}
@keyframes glitch {
  0%, 92%, 100% { transform: none; text-shadow: 0 0 8px var(--accent), 0 0 24px var(--accent-2); }
  93% { transform: translate(2px, -1px); text-shadow: -3px 0 var(--warn), 3px 0 var(--accent); }
  95% { transform: translate(-1px, 2px); text-shadow: 2px 0 var(--gold), -2px 0 var(--accent); }
  97% { transform: translate(1px, 0); text-shadow: 0 0 6px var(--accent); }
}

.title-tag {
  margin: 14px 0 26px;
  color: var(--dim);
  font-size: 13px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
}

.title-actions {
  display: grid;
  gap: 12px;
  width: min(420px, 78vw);
  margin: 18px auto 0;
}

#title .title-actions .btn {
  width: 100%;
  text-align: left;
  padding: 14px 18px;
  font-size: 14px;
  letter-spacing: 0.18em;
}

#title .title-actions .btn::before {
  content: ">";
  display: inline-block;
  margin-right: 12px;
  color: var(--accent);
  opacity: 0.35;
}

#title .title-actions .btn.console-selected::before,
#title .title-actions .btn:hover::before {
  opacity: 1;
}

.console-selected {
  border-color: var(--accent) !important;
  color: var(--accent) !important;
  box-shadow: var(--focus-ring) !important;
}

.setting-row.console-selected {
  background: rgba(255, 255, 255, 0.04);
  padding-left: 10px;
  padding-right: 10px;
  margin-left: -10px;
  margin-right: -10px;
}

.action-bar {
  position: fixed;
  left: var(--game-left);
  width: var(--game-width);
  bottom: var(--game-bottom);
  z-index: 90;
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  pointer-events: none;
  padding: 14px 24px 18px;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(0,0,0,0), color-mix(in srgb, var(--panel) 88%, black 12%) 28%, color-mix(in srgb, var(--panel) 95%, black 5%) 100%);
}

.action-prompt {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
}

.action-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid currentColor;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.action-label {
  color: var(--fg);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.action-pill-a { color: #86efac; }
.action-pill-b { color: #f87171; }
.action-pill-x { color: #7dd3fc; }
.action-pill-y { color: #fde047; }
.action-pill-lb,
.action-pill-rb,
.action-pill-d-pad { color: var(--accent); }

.title-foot {
  margin-top: 36px;
  color: var(--dim);
  font-size: 11px;
  letter-spacing: 0.2em;
}

/* ===== BUTTONS ===== */
.btn {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--line);
  padding: 10px 20px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.22em;
  cursor: pointer;
  position: relative;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 14px rgba(0, 224, 255, 0.3);
}
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: rgba(0, 224, 255, 0.08);
  color: var(--accent);
  border-color: var(--line-strong);
}
.btn.primary:hover {
  background: rgba(0, 224, 255, 0.18);
}

kbd {
  background: rgba(0, 224, 255, 0.08);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  padding: 2px 8px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  min-width: 22px;
  display: inline-block;
  text-align: center;
}

/* ===== CONTROLS PANEL ===== */
.ctrl-list {
  list-style: none;
  padding: 0;
  margin: 0 0 18px;
  text-align: left;
}
.ctrl-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px dashed rgba(0, 224, 255, 0.1);
  font-size: 12px;
  letter-spacing: 0.15em;
}
.ctrl-list li:last-child { border-bottom: 0; }
.ctrl-list span:not(.pad-glyph) {
  margin-left: auto;
  color: var(--dim);
  text-transform: uppercase;
}
.hint {
  font-size: 11px;
  color: var(--dim);
  text-align: left;
  line-height: 1.6;
  letter-spacing: 0.1em;
  margin-bottom: 18px;
}

/* ===== LEADERBOARD ===== */
.lb-list {
  list-style: none;
  padding: 0;
  margin: 0 0 18px;
  text-align: left;
  max-height: none;
  overflow: hidden;
}
.lb-list li {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  padding: 8px 6px;
  border-bottom: 1px dashed rgba(0, 224, 255, 0.12);
  font-size: 13px;
  align-items: center;
}
.lb-list li.lb-empty {
  display: block;
  text-align: center;
  color: var(--dim);
}
.lb-rank { color: var(--accent); }
.lb-name { letter-spacing: 0.18em; }
.lb-score { color: var(--gold); }
.lb-list li:nth-child(1) .lb-rank { color: var(--gold); text-shadow: 0 0 8px var(--gold); }
.lb-list li:nth-child(2) .lb-rank { color: #cbd5e1; }
.lb-list li:nth-child(3) .lb-rank { color: #d97706; }

/* ===== GAME OVER ===== */
.go-title { color: var(--warn) !important; text-shadow: 0 0 14px rgba(255, 77, 109, 0.5); }
.go-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 18px;
  margin-bottom: 18px;
  font-size: 13px;
}
.go-stats > div {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px dashed rgba(0, 224, 255, 0.1);
  padding: 6px 0;
}
.go-label { color: var(--dim); }
.go-val { color: var(--fg); }
.go-form {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  align-items: stretch;
}
.go-form label {
  display: none;
}
.go-form input {
  flex: 1;
  background: rgba(0, 224, 255, 0.04);
  border: 1px solid var(--line);
  color: var(--fg);
  font-family: var(--mono);
  letter-spacing: 0.32em;
  text-transform: uppercase;
  padding: 10px 12px;
  text-align: center;
}
.go-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 10px rgba(0, 224, 255, 0.3);
}

/* ===== HUD ===== */
#hud {
  position: fixed;
  left: var(--game-left);
  top: var(--game-top);
  width: var(--game-width);
  height: var(--game-height);
  pointer-events: none;
  z-index: 10;
  color: var(--fg);
}

.hud-top {
  position: absolute;
  top: 18px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 0 28px;
  gap: 24px;
}
.hud-block { text-align: center; }
.hud-block.hud-left { text-align: left; }
.hud-block.hud-right { text-align: right; }
.hud-label {
  font-size: 11px;
  color: var(--dim);
  letter-spacing: 0.4em;
  margin-bottom: 6px;
}
.hud-value {
  font-size: 32px;
  letter-spacing: 0.18em;
  color: var(--accent);
  text-shadow: 0 0 10px color-mix(in srgb, var(--accent) 55%, transparent 45%);
  font-variant-numeric: tabular-nums;
}
.hud-sub {
  margin-top: 3px;
  font-size: 11px;
  color: var(--dim);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.hud-block.hud-center .hud-value.alert { color: var(--warn); text-shadow: 0 0 10px var(--warn); }

.hud-bottom {
  position: absolute;
  bottom: 22px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 28px;
}

.hud-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 220px;
}
.bar {
  display: flex;
  align-items: center;
  gap: 10px;
}
.bar-label {
  width: 64px;
  font-size: 10px;
  color: var(--dim);
  letter-spacing: 0.3em;
}
.bar-track {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  position: relative;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 8px var(--accent);
  width: 100%;
  transition: width 0.15s linear;
}
.bar-hull .bar-fill { background: linear-gradient(90deg, var(--good), #38bdf8); box-shadow: 0 0 8px var(--good); }
.bar-hull .bar-fill.low { background: linear-gradient(90deg, var(--warn), #f97316); box-shadow: 0 0 10px var(--warn); }

.hud-radar {
  text-align: center;
  position: relative;
}
.hud-radar canvas {
  display: block;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: radial-gradient(circle at center, color-mix(in srgb, var(--accent) 20%, transparent 80%), transparent 70%);
  box-shadow: 0 0 20px color-mix(in srgb, var(--accent) 30%, transparent 70%), inset 0 0 18px color-mix(in srgb, var(--accent) 16%, transparent 84%);
}
.radar-label {
  font-size: 10px;
  color: var(--dim);
  letter-spacing: 0.3em;
  margin-top: 6px;
}

.hud-buffs {
  position: absolute;
  top: 90px;
  left: 28px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.buff {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 6px;
  background: color-mix(in srgb, var(--accent) 12%, transparent 88%);
  border: 1px solid var(--line);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--accent);
  text-transform: uppercase;
}
.buff svg {
  width: 16px;
  height: 16px;
}
.buff .buff-time {
  color: var(--dim);
  margin-left: 4px;
  font-variant-numeric: tabular-nums;
}

/* ===== SCANLINES + BOOT EFFECT ===== */
#scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0px,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.12) 3px,
    rgba(0, 0, 0, 0) 4px
  );
  mix-blend-mode: multiply;
}

#boot {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 99;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
}

/* ===== screen-shake helper (applied by JS) ===== */
.shake-1 { animation: shake 0.18s ease-out; }
.shake-2 { animation: shake 0.28s ease-out; }
.shake-3 { animation: shake 0.4s ease-out; }
@keyframes shake {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-4px, 2px); }
  40% { transform: translate(3px, -3px); }
  60% { transform: translate(-2px, 3px); }
  80% { transform: translate(2px, -1px); }
  100% { transform: translate(0, 0); }
}

/* ===== SETTINGS PANEL ===== */
.settings-panel { min-width: 420px; }
.setting-row {
  display: grid;
  grid-template-columns: 1fr 2fr auto;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px dashed rgba(0, 224, 255, 0.12);
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--dim);
}
.setting-row label { text-align: left; }
.setting-row.toggle-row { grid-template-columns: 1fr auto; }
.setting-row.diff-row { grid-template-columns: 1fr auto; }
.setting-val {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  min-width: 48px;
  text-align: right;
}

.theme-btns {
  display: flex;
  gap: 6px;
}

.theme-btn {
  padding: 7px 12px;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--dim);
  border-color: color-mix(in srgb, var(--accent) 18%, transparent 82%);
}

.theme-btn.active {
  color: var(--accent);
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent 88%);
  box-shadow: var(--focus-ring);
}

/* Range slider */
.settings-panel input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: rgba(0, 224, 255, 0.12);
  border: 1px solid var(--line);
  outline: none;
  cursor: pointer;
}
.settings-panel input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background: var(--accent);
  border: 1px solid #022;
  box-shadow: 0 0 10px rgba(0, 224, 255, 0.6);
  cursor: pointer;
}
.settings-panel input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: var(--accent);
  border: 1px solid #022;
  box-shadow: 0 0 10px rgba(0, 224, 255, 0.6);
  cursor: pointer;
}

/* Toggle */
.toggle {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 22px;
  cursor: pointer;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: rgba(0, 224, 255, 0.08);
  border: 1px solid var(--line);
  transition: background 0.15s, border-color 0.15s;
}
.toggle-slider::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: var(--dim);
  transition: transform 0.15s, background 0.15s, box-shadow 0.15s;
}
.toggle input:checked + .toggle-slider {
  background: rgba(0, 224, 255, 0.18);
  border-color: var(--accent);
}
.toggle input:checked + .toggle-slider::before {
  transform: translateX(20px);
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}
.toggle input[type=checkbox]:focus + .toggle-slider {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Scanlines toggle (controlled by body.no-scanlines) */
body.no-scanlines #scanlines { display: none; }

/* ===== COMBO CHIP ===== */
.combo-chip {
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  background: rgba(0, 224, 255, 0.08);
  border: 1px solid var(--line);
  font-size: 12px;
  letter-spacing: 0.18em;
  color: var(--accent);
  position: relative;
  min-width: 130px;
  transition: opacity 0.2s, transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.combo-chip.hidden { opacity: 0; transform: translateY(-4px); pointer-events: none; display: inline-flex !important; }
.combo-chip #combo-mult {
  font-size: 14px;
  font-weight: bold;
  color: var(--accent);
  text-shadow: 0 0 8px var(--accent);
  font-variant-numeric: tabular-nums;
}
.combo-chip .combo-count {
  font-size: 10px;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}
.combo-chip .combo-count::before { content: "x"; opacity: 0.4; }
.combo-chip .combo-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: rgba(0, 224, 255, 0.08);
}
.combo-chip #combo-bar-fill {
  height: 100%;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
  width: 100%;
  transition: width 0.08s linear;
}
.combo-chip.hot {
  border-color: var(--gold);
  box-shadow: 0 0 12px rgba(250, 204, 21, 0.45);
}
.combo-chip.hot #combo-mult { color: var(--gold); text-shadow: 0 0 10px var(--gold); }
.combo-chip.hot #combo-bar-fill { background: var(--gold); box-shadow: 0 0 6px var(--gold); }
.combo-chip.blazing {
  border-color: var(--warn);
  box-shadow: 0 0 14px rgba(255, 77, 109, 0.55);
}
.combo-chip.blazing #combo-mult { color: var(--warn); text-shadow: 0 0 10px var(--warn); }
.combo-chip.blazing #combo-bar-fill { background: var(--warn); box-shadow: 0 0 6px var(--warn); }

/* ===== BIG SCREEN EVENT ===== */
.big-event {
  position: absolute;
  top: 28%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.6);
  font-size: clamp(36px, 7vw, 96px);
  letter-spacing: 0.18em;
  font-weight: bold;
  color: var(--accent);
  text-shadow: 0 0 24px currentColor, 0 0 8px currentColor;
  pointer-events: none;
  opacity: 0;
  max-width: calc(var(--game-width) - 48px);
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.04;
  animation: big-event-pop 1.4s ease-out forwards;
}
.big-event.long,
.big-event[data-kind="boss-intro"],
.big-event[data-kind="boss-victory"] {
  font-size: clamp(22px, 4.4vw, 58px);
  letter-spacing: 0.08em;
  max-width: calc(var(--game-width) - 32px);
}
.big-event.hidden { display: none; }
.big-event.rainbow {
  background: linear-gradient(90deg, #ff4d6d, #fde047, #84ffb2, #00e0ff, #a855f7);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.6));
}
@keyframes big-event-pop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.4); letter-spacing: 0.4em; }
  20% { opacity: 1; transform: translate(-50%, -50%) scale(1.18); letter-spacing: 0.22em; }
  35% { transform: translate(-50%, -50%) scale(1.0); letter-spacing: 0.18em; }
  85% { opacity: 0.95; }
  100% { opacity: 0; transform: translate(-50%, -52%) scale(1.0); }
}

/* ===== SCORE FLOATERS ===== */
#score-floats {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.score-float {
  position: absolute;
  transform: translate(-50%, -50%);
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 0.15em;
  color: var(--accent);
  text-shadow: 0 0 10px currentColor;
  pointer-events: none;
  white-space: nowrap;
  animation: score-float-rise 0.9s ease-out forwards;
}
@keyframes score-float-rise {
  0% { opacity: 0; transform: translate(-50%, -40%) scale(0.8); }
  15% { opacity: 1; transform: translate(-50%, -55%) scale(1.05); }
  100% { opacity: 0; transform: translate(-50%, -110%) scale(1.0); }
}

/* ===== PAD-ACTIVE SWAP ===== */
.ctrl-pad { display: none; }
body.pad-active .ctrl-kbd { display: none; }
body.pad-active .ctrl-pad { display: block; }
body.pad-active .pick-console-hint { display: block; }
body.pad-active #gameover .pick-grid { display: none; }
.pad-glyph svg {
  width: 28px;
  height: 22px;
  color: var(--accent);
  filter: drop-shadow(0 0 6px rgba(0, 224, 255, 0.5));
}
.pad-glyph {
  display: inline-flex;
  min-width: 60px;
  align-items: center;
}

@media (max-width: 640px) {
  .panel { min-width: auto; width: calc(100vw - 32px); padding: 24px; }
  .hud-bars { min-width: 150px; }
  .bar-label { width: 48px; }
  .hud-radar canvas { width: 110px; height: 110px; }
  .settings-panel { min-width: auto; }
  .setting-row { grid-template-columns: 1fr; gap: 6px; }
  .setting-row.toggle-row { grid-template-columns: 1fr auto; }
  .dock-body { flex-direction: column; }
  .dock-left { min-width: auto; }
  .dock-panel { width: var(--game-width); height: var(--game-height); }
  .dock-catalog-grid { grid-template-columns: 1fr; }
}

/* ===== DOCK OVERLAY ===== */
#dock-overlay {
  position: fixed;
  left: var(--game-left);
  top: var(--game-top);
  width: var(--game-width);
  height: var(--game-height);
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2, 3, 10, 0.85);
  backdrop-filter: blur(6px);
}
#dock-overlay.hidden { display: none !important; }

.dock-panel {
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(0,0,0,0.14)), var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow), var(--panel-inset), inset 0 0 80px rgba(0, 224, 255, 0.03);
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-width: 100vw;
  max-height: 100vh;
  position: relative;
}
.dock-panel::before,
.dock-panel::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border: 1px solid var(--accent);
}
.dock-panel::before { top: 0; left: 0; border-right: 0; border-bottom: 0; }
.dock-panel::after { bottom: 0; right: 0; border-left: 0; border-top: 0; }

.dock-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 24px 36px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(0,0,0,0));
  flex: 0 0 auto;
}
.dock-header-label {
  font-size: 10px;
  color: var(--dim);
  letter-spacing: 0.4em;
  margin-bottom: 4px;
}
.dock-header-name {
  font-size: 28px;
  letter-spacing: 0.28em;
  color: var(--accent);
  text-shadow: 0 0 16px rgba(0, 224, 255, 0.5);
  animation: glitch 4s infinite steps(1);
}
.dock-header-right {
  text-align: right;
}

.dock-body {
  display: grid;
  grid-template-columns: minmax(260px, 0.72fr) minmax(0, 1.28fr);
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

.dock-left {
  min-width: 260px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 12px;
  padding: 20px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(0,0,0,0.1));
}
.dock-left canvas {
  display: block;
  width: min(100%, 420px);
  height: auto;
  border: 1px solid var(--line);
  background: rgba(0, 224, 255, 0.03);
}

.dock-left-copy {
  padding: 14px 16px;
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent 30%);
  background: color-mix(in srgb, var(--panel) 88%, black 12%);
}
.dock-copy-line {
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--fg);
  margin-top: 8px;
}

.dock-right {
  flex: 1;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  overflow: auto;
}

.dock-section {
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent 30%);
  background: color-mix(in srgb, var(--panel) 90%, black 10%);
  padding: 9px 10px;
}

.dock-section-title {
  font-size: 10px;
  letter-spacing: 0.4em;
  color: var(--dim);
  margin-bottom: 10px;
  border-bottom: 1px dashed rgba(0, 224, 255, 0.12);
  padding-bottom: 6px;
}

.dock-manifest {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.dock-stat {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
}
.dock-stat-label {
  width: 64px;
  color: var(--dim);
  letter-spacing: 0.3em;
  font-size: 10px;
}
.dock-stat .bar-track {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  position: relative;
  overflow: hidden;
}
.dock-stat .bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 8px var(--accent);
  transition: width 0.15s linear;
}
.dock-stat .bar-fill-hull {
  background: linear-gradient(90deg, var(--good), #38bdf8);
  box-shadow: 0 0 8px var(--good);
}
.dock-stat-val {
  color: var(--fg);
  font-variant-numeric: tabular-nums;
  min-width: 48px;
  text-align: right;
}
.dock-ore {
  color: var(--gold);
  text-shadow: 0 0 8px var(--gold);
}

.dock-services {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 8px;
}
.dock-svc-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 9px 12px;
  pointer-events: auto;
}
.dock-svc-cost {
  font-size: 9px;
  color: var(--dim);
  letter-spacing: 0.18em;
}

.dock-upgrades {
  display: none;
}

.dock-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
.dock-tab {
  padding: 8px 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--dim);
  letter-spacing: 0.2em;
  cursor: pointer;
}
.dock-tab.active {
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(0, 224, 255, 0.25);
}

.dock-catalog-detail {
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent 30%);
  background: color-mix(in srgb, var(--panel) 90%, black 10%);
  padding: 10px 12px;
  margin-bottom: 8px;
}
.catalog-detail-label {
  font-size: 10px;
  color: var(--dim);
  letter-spacing: 0.35em;
  margin-bottom: 6px;
}
.catalog-detail-name {
  font-size: 16px;
  color: var(--accent);
  letter-spacing: 0.16em;
  margin-bottom: 6px;
}
.catalog-detail-desc {
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--fg);
  line-height: 1.35;
}
.catalog-detail-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 7px;
  font-size: 9px;
  letter-spacing: 0.14em;
  color: var(--gold);
}
.catalog-detail-empty {
  font-size: 11px;
  letter-spacing: 0.24em;
  color: var(--dim);
}

.dock-catalog-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(170px, 1fr));
  gap: 8px;
  align-content: start;
}

.dock-catalog-card {
  background: color-mix(in srgb, var(--panel) 86%, black 14%);
  border: 1px solid var(--line);
  padding: 9px;
  text-align: left;
  cursor: pointer;
  font-family: var(--mono);
  color: var(--fg);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s, transform 0.15s;
  pointer-events: auto;
}
.dock-catalog-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(0, 224, 255, 0.3);
  background: rgba(0, 224, 255, 0.08);
  transform: translateY(-1px);
}
.dock-catalog-card.selected {
  border-color: var(--accent-2);
  box-shadow: 0 0 14px rgba(0, 224, 255, 0.34);
}
.dock-catalog-card.locked {
  opacity: 0.45;
}
.dock-catalog-card.maxed {
  border-color: var(--good);
  opacity: 0.65;
}
.catalog-card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.catalog-name {
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--accent);
  margin-bottom: 2px;
}
.catalog-kind {
  font-size: 9px;
  color: var(--dim);
  letter-spacing: 0.14em;
}
.catalog-cost {
  font-size: 9px;
  color: var(--gold);
  letter-spacing: 0.12em;
  white-space: nowrap;
}
.catalog-desc {
  margin-top: 5px;
  font-size: 9px;
  color: var(--fg);
  letter-spacing: 0.08em;
  line-height: 1.25;
}
.catalog-owned {
  font-size: 9px;
  color: var(--good);
  letter-spacing: 0.12em;
  margin-top: 5px;
}

.dock-right .dock-section:last-child {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.dock-upgrade-card {
  background: color-mix(in srgb, var(--panel) 86%, black 14%);
  border: 1px solid var(--line);
  padding: 12px;
  text-align: left;
  cursor: pointer;
  font-family: var(--mono);
  color: var(--fg);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  pointer-events: auto;
}
.dock-upgrade-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(0, 224, 255, 0.3);
  background: rgba(0, 224, 255, 0.08);
}
.dock-upgrade-card.locked {
  opacity: 0.4;
  cursor: not-allowed;
}
.dock-upgrade-card.locked:hover {
  border-color: var(--line);
  box-shadow: none;
  background: rgba(0, 224, 255, 0.04);
}
.dock-upgrade-card.maxed {
  opacity: 0.5;
  cursor: default;
  border-color: var(--good);
}
.dock-upgrade-card.maxed:hover {
  box-shadow: none;
  background: rgba(0, 224, 255, 0.04);
}
.upgrade-name {
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--accent);
  margin-bottom: 4px;
}
.upgrade-desc {
  font-size: 9px;
  color: var(--dim);
  letter-spacing: 0.12em;
  margin-bottom: 6px;
}
.upgrade-cost {
  font-size: 10px;
  color: var(--gold);
  letter-spacing: 0.15em;
}
.upgrade-owned {
  font-size: 9px;
  color: var(--good);
  letter-spacing: 0.2em;
  margin-top: 4px;
}

.dock-footer {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 0 0 auto;
  padding: 14px 28px;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(0,0,0,0), color-mix(in srgb, var(--panel) 90%, black 10%));
}
.dock-footer .btn {
  pointer-events: auto;
}
.dock-ticker {
  flex: 1;
  overflow: hidden;
  font-size: 10px;
  color: var(--dim);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  white-space: nowrap;
}
.dock-ticker span {
  display: inline-block;
  animation: ticker-scroll 20s linear infinite;
}
@keyframes ticker-scroll {
  0% { transform: translateX(100%); }
  100% { transform: translateX(-100%); }
}

/* Dock entrance animation */
.dock-enter .dock-panel {
  animation: dock-slide-in 0.6s ease-out;
}
@keyframes dock-slide-in {
  0% { opacity: 0; transform: scale(0.94) translateY(20px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
.dock-exit {
  animation: dock-fade-out 0.4s ease-in forwards;
}
@keyframes dock-fade-out {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

body[data-theme="pixel16"] .dock-panel,
body[data-theme="pixel16"] .dock-section,
body[data-theme="pixel16"] .dock-left canvas,
body[data-theme="pixel16"] .dock-footer {
  border-width: 2px;
  box-shadow: none !important;
  background: #18130f;
}

body[data-theme="pixel16"] .dock-header-name {
  text-shadow: none;
  animation: none;
}

body[data-theme="arcade"] .dock-panel,
body[data-theme="arcade"] .dock-section,
body[data-theme="arcade"] .dock-footer {
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(0,0,0,0.12)), var(--panel);
}

/* ===== GAMEPAD FOCUS RING ===== */
/* All interactive elements get a visible focus ring for TV/gamepad play. */
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  box-shadow: var(--focus-ring);
}
/* Gamepad focus via programmatic .focus() — browsers may not show :focus-visible,
   so we also style :focus without :focus-visible for button elements. */
button:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  box-shadow: var(--focus-ring);
}

/* ===== DIFFICULTY BUTTONS ===== */
.diff-row { grid-template-columns: 1fr auto; }
.diff-btns {
  display: flex;
  gap: 6px;
}
.diff-btn {
  padding: 7px 14px;
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--dim);
  border-color: rgba(0, 224, 255, 0.18);
}
.diff-btn.active {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(0, 224, 255, 0.1);
  box-shadow: var(--focus-ring);
}
#diff-hard.active {
  color: var(--warn);
  border-color: var(--warn);
  background: rgba(255, 77, 109, 0.1);
  box-shadow: 0 0 10px rgba(255, 77, 109, 0.25);
}
#diff-easy.active {
  color: var(--good);
  border-color: var(--good);
  background: rgba(132, 255, 178, 0.1);
  box-shadow: 0 0 10px rgba(132, 255, 178, 0.25);
}

/* ===== LETTER PICKER ===== */
.name-picker {
  margin-bottom: 16px;
}
.pick-label {
  font-size: 10px;
  color: var(--dim);
  letter-spacing: 0.3em;
  margin-bottom: 10px;
}
.pick-display {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 14px;
}
.pick-console-hint {
  display: none;
  margin-bottom: 14px;
  color: var(--dim);
  font-size: 10px;
  letter-spacing: 0.18em;
  line-height: 1.5;
}
.pick-char {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 52px;
  border: 1px solid var(--line);
  font-size: 28px;
  letter-spacing: 0.12em;
  color: var(--dim);
  background: rgba(0, 224, 255, 0.03);
  font-family: var(--mono);
  transition: color 0.1s, border-color 0.1s, box-shadow 0.1s;
}
.pick-char.pick-filled {
  color: var(--fg);
  border-color: var(--line-strong);
}

/* ===== DEBUG CONSOLE ===== */
#debug-console {
  position: fixed;
  left: 20px;
  right: 20px;
  bottom: 18px;
  z-index: 45;
  pointer-events: none;
}

#debug-console.hidden {
  display: none;
}

#debug-console.open {
  display: block;
  pointer-events: auto;
}

.debug-console-shell {
  margin: 0 auto;
  max-width: 920px;
  border: 1px solid var(--line-strong);
  background: rgba(6, 10, 18, 0.94);
  box-shadow: 0 14px 42px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0, 224, 255, 0.15);
  backdrop-filter: blur(4px);
  padding: 10px 12px;
}

.debug-console-title {
  color: var(--accent);
  letter-spacing: 0.2em;
  font-size: 11px;
  margin-bottom: 6px;
}

.debug-console-status {
  color: var(--dim);
  font-size: 11px;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.debug-console-status.error {
  color: var(--warn);
}

.debug-console-input {
  width: 100%;
  height: 34px;
  border: 1px solid var(--line-strong);
  background: rgba(8, 14, 24, 0.95);
  color: var(--fg);
  font: 14px/1.2 var(--mono);
  padding: 6px 10px;
}

.debug-console-input::placeholder {
  color: rgba(157, 174, 194, 0.65);
}
.pick-char.pick-cursor {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 12px rgba(0, 224, 255, 0.4);
  animation: pick-blink 0.9s infinite;
}
@keyframes pick-blink {
  0%, 100% { box-shadow: 0 0 12px rgba(0, 224, 255, 0.4); }
  50% { box-shadow: 0 0 20px rgba(0, 224, 255, 0.7); }
}
.pick-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 12px;
  pointer-events: auto;
}
.pick-key {
  padding: 8px 6px;
  font-size: 12px;
  letter-spacing: 0.1em;
  border-color: rgba(0, 224, 255, 0.15);
  color: var(--fg);
  text-align: center;
  pointer-events: auto;
  cursor: pointer;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.pick-key:hover, .pick-key:focus {
  border-color: var(--accent);
  color: var(--accent);
}
.pick-del {
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--warn);
  border-color: rgba(255, 77, 109, 0.3);
}
.pick-del:hover, .pick-del:focus {
  border-color: var(--warn);
  color: var(--warn);
  box-shadow: 0 0 10px rgba(255, 77, 109, 0.25);
}
.pick-ok {
  font-size: 10px;
  color: var(--good);
  border-color: rgba(132, 255, 178, 0.3);
}
.pick-ok:hover, .pick-ok:focus {
  border-color: var(--good);
  color: var(--good);
  box-shadow: 0 0 10px rgba(132, 255, 178, 0.3);
}
.pick-key-spacer { display: block; }
