:root {
  color-scheme: dark;
  --bg: #10151f;
  --panel: #172133;
  --text: #eaf1ff;
  --muted: #9eb0cf;
  --accent: #77e4f3;
  --font-body: "DM Sans", system-ui, sans-serif;
  --font-display: "Orbitron", system-ui, sans-serif;
}

* { box-sizing: border-box; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
body {
  margin: 0;
  font-family: var(--font-body);
  background: radial-gradient(circle at top, #1a2740 0%, var(--bg) 45%);
  color: var(--text);
}
.app {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px;
  box-sizing: border-box;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
}
.panel {
  background: color-mix(in oklab, var(--panel), black 8%);
  border: 1px solid #2a3d64;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.menu-screen {
  max-width: 720px;
  margin: 0 auto;
}
.settings-shell {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 8px;
}
.settings-tablist {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border-bottom: 1px solid #2a3d64;
  padding-bottom: 10px;
}
.settings-tab {
  margin: 0;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-body);
  background: #1e2f4d;
  color: var(--muted);
  border: 1px solid #35507e;
  box-shadow: none;
  cursor: pointer;
}
.settings-tab:hover {
  filter: brightness(1.08);
  color: var(--text);
}
.settings-tab[aria-selected="true"] {
  background: linear-gradient(#6ecfe8, #3a9db8);
  color: #061018;
  border-color: #5bc8e0;
}
.settings-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.settings-tabpanels {
  max-height: min(52vh, 420px);
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-gutter: stable;
}
.settings-tabpanel {
  padding-top: 4px;
}
.settings-tabpanel:focus-visible {
  outline: 2px solid color-mix(in oklab, var(--accent), transparent 40%);
  outline-offset: 2px;
  border-radius: 8px;
}
.keybind-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px;
  margin-bottom: 12px;
}
.keybind-preset-label {
  flex: 1 1 180px;
  min-width: 0;
  margin: 0;
}
.keybind-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.keybind-new-form {
  margin: -2px 0 14px;
  padding: 12px;
  border: 1px solid rgba(93, 141, 188, 0.42);
  border-radius: 9px;
  background: rgba(10, 18, 31, 0.56);
}
.keybind-new-form-row {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) auto auto;
  gap: 8px;
  align-items: center;
}
.keybind-new-form-row input {
  margin: 0;
}
@media (max-width: 520px) {
  .keybind-new-form-row {
    grid-template-columns: 1fr 1fr;
  }
  .keybind-new-form-row input {
    grid-column: 1 / -1;
  }
}
select {
  width: 100%;
  max-width: 280px;
  padding: 10px 10px;
  border-radius: 8px;
  border: 1px solid #364c76;
  background: #0b1020;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  cursor: pointer;
}
select:focus-visible {
  outline: 2px solid color-mix(in oklab, var(--accent), transparent 35%);
  outline-offset: 1px;
}
.keybind-hint {
  font-size: 12px;
  margin: 0 0 10px;
  line-height: 1.4;
}
.keybind-conflict {
  font-size: 13px;
  font-weight: 600;
  color: #ff9b7a;
  margin: 0 0 10px;
}
.keybind-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.keybind-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  background: color-mix(in oklab, var(--panel), black 12%);
  border: 1px solid #2a3d64;
}
.keybind-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.keybind-cap-btn {
  min-width: 7rem;
  padding: 8px 12px;
  font-family: var(--font-display);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: #243a5c;
  color: var(--accent);
  border: 1px solid #35507e;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.keybind-cap-btn:hover {
  filter: brightness(1.1);
}
.keybind-cap-btn.is-capturing {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  background: #1a3d4a;
  color: #b8f6ff;
}
.game-title {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
  text-shadow: 0 0 24px color-mix(in oklab, var(--accent), transparent 65%);
}
.game-tagline {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.04em;
}
.run-preset-picker {
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid rgba(78, 119, 164, 0.46);
  border-radius: 11px;
  background: linear-gradient(145deg, rgba(12, 21, 36, 0.78), rgba(20, 34, 54, 0.62));
}
.run-preset-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}
.run-preset-heading .menu-section-title {
  margin-bottom: 4px;
}
.run-preset-help,
.settings-section-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.settings-section-note {
  margin: -3px 0 12px;
}
.settings-section-note-personal {
  color: color-mix(in oklab, var(--accent), var(--muted) 58%);
}
.run-preset-status {
  flex: 0 0 auto;
  padding: 4px 8px;
  border: 1px solid rgba(115, 226, 242, 0.42);
  border-radius: 999px;
  background: rgba(50, 143, 162, 0.14);
  color: #a8f3ff;
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.run-preset-picker.is-custom .run-preset-status {
  border-color: rgba(255, 164, 78, 0.5);
  background: rgba(170, 78, 30, 0.16);
  color: #ffc58e;
}
.run-preset-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.run-preset-card {
  display: flex;
  min-width: 0;
  min-height: 110px;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 10px;
  border: 1px solid #314967;
  border-radius: 9px;
  background: rgba(21, 36, 58, 0.9);
  color: var(--text);
  text-align: left;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
button.run-preset-card:hover {
  border-color: rgba(118, 209, 235, 0.66);
  background: rgba(30, 52, 80, 0.96);
  filter: none;
}
.run-preset-card[aria-checked="true"] {
  border-color: rgba(118, 228, 245, 0.84);
  background: linear-gradient(145deg, rgba(33, 83, 105, 0.72), rgba(22, 48, 72, 0.92));
  box-shadow:
    inset 0 0 0 1px rgba(126, 235, 255, 0.2),
    0 0 16px rgba(80, 203, 224, 0.13);
}
.run-preset-card-custom {
  opacity: 0.45;
}
.run-preset-picker.is-custom .run-preset-card-custom {
  opacity: 1;
  border-color: rgba(255, 160, 75, 0.66);
  background: linear-gradient(145deg, rgba(95, 46, 31, 0.7), rgba(49, 31, 37, 0.92));
}
.run-preset-card-name {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.run-preset-card-size {
  color: var(--accent);
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.run-preset-card-custom .run-preset-card-size {
  color: #ffb477;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.run-preset-card-copy {
  margin-top: auto;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.25;
}
.run-preset-card-plays {
  margin-top: 3px;
  color: color-mix(in oklab, var(--accent), var(--muted) 38%);
  font-family: var(--font-display);
  font-size: 8px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.menu-section {
  margin-bottom: 20px;
}
.menu-section-title {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0.95;
}
.menu-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}
.menu-section-mode .field-check {
  margin-bottom: 10px;
}
.menu-section-mode .field-check:last-child {
  margin-bottom: 0;
}
@media (max-width: 620px) {
  .run-preset-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.field-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.field-check {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  line-height: 1.45;
}
.field-check input[type="checkbox"] {
  margin: 0.15em 0 0;
  flex-shrink: 0;
  width: auto;
  accent-color: var(--accent);
}
.field-check-text {
  flex: 1;
  min-width: 0;
}
.field-check-title {
  font-weight: 600;
}
.field-hint {
  font-weight: 400;
  color: var(--muted);
  font-size: 12px;
}
label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  color: var(--muted);
}
input[type="number"] {
  width: 100%;
  padding: 10px 10px;
  border-radius: 8px;
  border: 1px solid #364c76;
  background: #0b1020;
  color: var(--text);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.35);
}
input[type="number"]:focus-visible {
  outline: 2px solid color-mix(in oklab, var(--accent), transparent 35%);
  outline-offset: 1px;
}
input[type="text"] {
  width: 100%;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid #364c76;
  background: #0f1726;
  color: var(--text);
  margin-top: 6px;
}
button {
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  background: linear-gradient(#7fdcf9, #52b4d2);
  color: #091524;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-body);
}
button:hover { filter: brightness(1.05); }
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.btn-primary {
  background: linear-gradient(#8aefff, #4eb8d8);
  color: #061018;
  box-shadow: 0 4px 16px rgba(81, 196, 224, 0.35);
}
.btn-start {
  width: 100%;
  margin-top: 8px;
  padding: 14px 20px;
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.btn-secondary {
  background: #2a3f5e;
  color: var(--text);
  font-weight: 600;
}
.btn-secondary:hover { filter: brightness(1.12); }
.menu-controls-hint {
  font-size: 13px;
  margin-top: 14px;
}
.icon-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 10px;
  background: #1e2f4d;
  color: var(--accent);
  border: 1px solid #35507e;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.icon-btn:hover {
  filter: brightness(1.12);
  background: #243a5c;
}
.icon-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.settings-button {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: linear-gradient(145deg, rgba(38, 62, 94, 0.92), rgba(18, 31, 51, 0.96));
  border-color: rgba(105, 158, 211, 0.42);
  color: #9fdfff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.09),
    0 4px 12px rgba(0, 0, 0, 0.22);
}
.settings-button:hover {
  background: linear-gradient(145deg, rgba(47, 78, 116, 0.96), rgba(22, 39, 63, 0.98));
  border-color: rgba(126, 205, 239, 0.66);
  filter: none;
}
.settings-button-icon {
  display: block;
  transition: transform 180ms ease, filter 180ms ease;
  filter: drop-shadow(0 0 4px rgba(105, 215, 255, 0.22));
}
.settings-button:hover .settings-button-icon {
  transform: rotate(18deg);
  filter: drop-shadow(0 0 5px rgba(105, 215, 255, 0.42));
}
.hidden { display: none; }
.game-screen {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding: 12px 0 0;
}
.game-screen.hidden {
  display: none;
}
.game-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  gap: 16px;
  align-items: stretch;
}
.run-sidebar {
  flex-shrink: 0;
  width: 200px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  align-self: stretch;
}
.run-sidebar-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}
.game-screen .hud {
  flex: 1;
  min-height: 0;
}
.hud {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
  margin: 0;
}
.hud-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.hud-stat-rise {
  gap: 8px;
}
.hud-rise-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.rise-countdown {
  min-width: 3ch;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  text-align: right;
}
.rise-countdown.is-urgent {
  color: #ff8a72;
  text-shadow: 0 0 8px rgba(255, 80, 60, 0.4);
}
.hud-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.hud-value {
  font-size: 1.35rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  color: var(--text);
  display: inline-block;
  transform-origin: left center;
  transition: text-shadow 220ms ease-out;
}
.hud-value.hud-pop {
  animation: hudPop 380ms ease-out;
}
@keyframes hudPop {
  0% {
    transform: scale(1);
    text-shadow: 0 0 0 transparent;
    color: var(--text);
  }
  35% {
    transform: scale(1.18);
    color: #fff;
    text-shadow: 0 0 12px color-mix(in oklab, var(--accent), transparent 30%);
  }
  100% {
    transform: scale(1);
    text-shadow: 0 0 0 transparent;
    color: var(--text);
  }
}
.rise-bar {
  height: 6px;
  border-radius: 4px;
  background: #0f1726;
  border: 1px solid #364c76;
  overflow: hidden;
}
.rise-bar-fill {
  height: 100%;
  width: 100%;
  transform: scaleX(0);
  transform-origin: left center;
  border-radius: 3px;
  background: linear-gradient(90deg, #56e09a 0%, #ffd84d 58%, #ff5d5d 100%);
  box-shadow: 0 0 6px rgba(255, 180, 100, 0.25);
  transition: transform 0.1s linear, box-shadow 220ms ease-out;
  will-change: transform;
}
.bomb-bar {
  border-color: #6b3d2e;
  background: #1a0f0c;
  box-shadow: inset 0 0 4px rgba(255, 90, 40, 0.2);
}
.bomb-bar-fill {
  background:
    linear-gradient(
      90deg,
      #ffd07a 0%,
      #ff9a3c 25%,
      #ff5d2d 55%,
      #ff3366 100%
    ),
    linear-gradient(90deg, rgba(255, 255, 255, 0.25), rgba(255, 255, 255, 0) 40%);
  background-size: 200% 100%, 100% 100%;
  animation: bombBarShimmer 2.4s linear infinite;
  box-shadow:
    0 0 8px rgba(255, 90, 60, 0.55),
    0 0 16px rgba(255, 60, 30, 0.25);
}
@keyframes bombBarShimmer {
  0% { background-position: 0% 0%, 0 0; }
  100% { background-position: 200% 0%, 0 0; }
}
.reduced-effects .bomb-bar-fill {
  animation: none;
}
.reduced-effects .hud-value.hud-pop {
  animation-duration: 140ms;
}
@media (prefers-reduced-motion: reduce) {
  .bomb-bar-fill {
    animation: none;
  }
  .hud-value.hud-pop {
    animation-duration: 140ms;
  }
  .rise-bar-fill {
    transition-duration: 0.01ms;
  }
  .settings-button-icon {
    transition: none;
  }
  .settings-button:hover .settings-button-icon {
    transform: none;
  }
}
.hud-label-bomb {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.bomb-glyph {
  color: #ff9a3c;
  filter: drop-shadow(0 0 3px rgba(255, 120, 60, 0.55));
  flex: 0 0 auto;
}
.hud-value-inline {
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
}
.next-preview {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}
.next-preview .hud-label {
  margin: 0;
}
#nextCanvas {
  display: block;
  width: 120px;
  min-height: 120px;
  height: auto;
  border-radius: 10px;
  border: 1px solid #364c76;
  background: #0b0f17;
  align-self: center;
}

/* Keep the animated canvas out of a filtered ancestor; filters can force an expensive
   offscreen composition of the entire game column on older GPUs. */
.canvas-wrap,
.game-canvas-col {
  position: relative;
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.game-over-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 24px;
  pointer-events: none;
}
.game-over-overlay:not(.hidden) {
  pointer-events: auto;
}
/* Beats `.game-over-overlay { display: flex }` (later, same specificity) so the overlay stays off during play. */
.game-over-overlay.hidden,
.game-over-overlay[hidden] {
  display: none;
  pointer-events: none;
}
.game-over-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 4vw, 1.75rem);
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text);
  text-shadow: 0 0 20px rgba(119, 228, 243, 0.45);
}
.game-over-overlay .btn-primary {
  pointer-events: auto;
  min-width: 180px;
}
.pause-overlay {
  z-index: 3;
  gap: 12px;
  background: rgba(5, 10, 19, 0.72);
  backdrop-filter: blur(2px);
}
.pause-overlay-hint {
  margin: -2px 0 6px;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
#canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  border: 1px solid #35507e;
  border-radius: 8px;
  background: #0b0f17;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}
.high-scores {
  --hs-grid: 1.4rem minmax(var(--hs-score-width, 6ch), max-content) 1fr 2.25rem;
  flex-shrink: 0;
  width: 248px;
  padding: 16px;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.high-scores-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}
.high-scores-titles {
  min-width: 0;
  flex: 1;
}
.high-scores-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  line-height: 1.2;
}
.high-scores-width {
  margin: 6px 0 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.leaderboard-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -2px 0 12px;
}
.leaderboard-filters.hidden,
.leaderboard-name-filter.hidden {
  display: none;
}
.leaderboard-view-toggle {
  display: inline-flex;
  padding: 2px;
  border: 1px solid rgba(105, 158, 211, 0.32);
  border-radius: 8px;
  background: rgba(10, 18, 31, 0.48);
}
.leaderboard-view-btn {
  min-width: 58px;
  padding: 5px 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  box-shadow: none;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}
.leaderboard-view-btn.is-active {
  background: linear-gradient(#65c9e2, #3e9db8);
  color: #061018;
}
.leaderboard-name-filter {
  min-width: 0;
  flex: 1;
}
.leaderboard-name-filter select {
  width: 100%;
  min-width: 0;
  padding: 6px 24px 6px 8px;
  border: 1px solid rgba(105, 158, 211, 0.4);
  border-radius: 7px;
  background: #15243a;
  color: var(--text);
  font: 600 11px var(--font-body);
}
.high-scores-table {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 2px;
}
.high-scores-colhead {
  display: grid;
  grid-template-columns: var(--hs-grid);
  gap: 0 0.35rem;
  align-items: baseline;
  padding: 0 0 8px;
  margin-bottom: 2px;
  border-bottom: 1px solid color-mix(in oklab, var(--accent), transparent 82%);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: color-mix(in oklab, var(--muted), var(--accent) 18%);
  font-family: var(--font-display);
}
.high-scores-colhead-score {
  text-align: right;
  padding-right: 1px;
}
.high-scores-colhead span:last-child {
  text-align: right;
}
.high-scores-list {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
  color: var(--muted);
  overflow-y: auto;
  flex: 1;
  line-height: 1.2;
}
.hs-row {
  display: grid;
  grid-template-columns: var(--hs-grid);
  gap: 0 0.35rem;
  align-items: baseline;
  padding: 6px 0 7px;
  border-radius: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.hs-row:last-child {
  border-bottom: none;
}
.hs-row--first {
  background: linear-gradient(
    90deg,
    color-mix(in oklab, #e8b923, transparent 88%) 0%,
    transparent 100%
  );
  box-shadow: inset 3px 0 0 #e8b923;
}
.hs-row--second {
  background: linear-gradient(
    90deg,
    color-mix(in oklab, #c0c8d4, transparent 90%) 0%,
    transparent 100%
  );
  box-shadow: inset 3px 0 0 #b8c0cc;
}
.hs-row--third {
  background: linear-gradient(
    90deg,
    color-mix(in oklab, #cd7f4c, transparent 88%) 0%,
    transparent 100%
  );
  box-shadow: inset 3px 0 0 #cd7f4c;
}
.high-scores-list .hs-rank {
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-display);
  color: color-mix(in oklab, var(--muted), var(--text) 25%);
  text-align: right;
}
.high-scores-list .hs-score {
  font-family: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
  min-width: var(--hs-score-width, 6ch);
  text-align: right;
  color: color-mix(in oklab, var(--accent), white 8%);
  text-shadow: 0 0 18px color-mix(in oklab, var(--accent), transparent 55%);
}
.high-scores-list .hs-name {
  color: var(--text);
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.high-scores-list .hs-lines {
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--muted);
  opacity: 0.92;
}
.high-scores-list .hs-lines::after {
  content: ' L';
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  opacity: 0.75;
}
.high-scores-list .hs-empty {
  list-style: none;
  margin: 12px 0 8px;
  padding: 10px 8px;
  text-align: center;
  font-size: 12px;
  line-height: 1.4;
  font-style: italic;
  color: var(--muted);
  border: 1px dashed color-mix(in oklab, var(--muted), transparent 55%);
  border-radius: 8px;
}
.highscore-hint {
  margin-top: 8px;
}
.muted { color: var(--muted); }
.hint { color: var(--muted); }

@media (max-width: 640px) {
  .game-layout {
    flex-direction: column;
  }
  .run-sidebar {
    width: 100%;
    order: 1;
  }
  .game-canvas-col {
    order: 2;
    min-height: min(55dvh, 420px);
  }
  .high-scores {
    width: 100%;
    max-height: 220px;
    order: 3;
  }
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal.hidden {
  display: none;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}
.modal-panel {
  position: relative;
  max-width: 380px;
  width: 100%;
  z-index: 1;
}
.modal-panel h2 {
  margin: 0 0 8px;
  font-size: 1.25rem;
  font-family: var(--font-display);
  letter-spacing: 0.04em;
}
.name-modal-label {
  display: block;
  margin: 16px 0;
}
.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}
