:root {
  --ink: #f2e9ff;
  --muted: #93a3c2;
  --bg: #0b0e1f;
  --bg2: #141a3d;
  --accent: #6ef2c9;
  --accent2: #ff9b3d;
  --danger: #ff5d6c;
  --panel: #12183aee;
  --panel-border: #2c3550;
  --cell-bg: #0e1330;
  --cell-border: #232b52;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(ellipse at 80% -10%, #7c4dff22, transparent 55%),
    radial-gradient(ellipse at 10% 100%, #6ef2c922, transparent 50%),
    var(--bg);
  color: var(--ink);
}

body { padding: 24px 20px 60px; }

.topbar { max-width: 1100px; margin: 0 auto 20px; }
.topbar h1, .lb-layout h1 { font-size: 34px; margin: 0 0 6px; letter-spacing: -0.02em; }
.topbar h1 a, .lb-layout h1 a { color: inherit; text-decoration: none; }
.accent { color: var(--accent); }
.tagline { color: var(--muted); margin: 0 0 12px; font-size: 15px; max-width: 60ch; }

nav.tabs { display: flex; gap: 8px; margin: 4px 0 10px; }
nav.tabs a {
  padding: 5px 12px;
  border: 1px solid var(--panel-border);
  border-radius: 7px;
  text-decoration: none;
  color: var(--muted);
  background: var(--panel);
  font-size: 13px;
}
nav.tabs a.active { color: var(--bg); background: var(--accent); border-color: var(--accent); }

.session-bar { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.session-bar input[type="text"] {
  font-family: inherit;
  font-size: 13px;
  padding: 7px 10px;
  border-radius: 7px;
  border: 1px solid var(--panel-border);
  background: var(--cell-bg);
  color: var(--ink);
  width: 160px;
}
.session-bar button {
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 7px 12px;
  border-radius: 7px;
  border: none;
  background: var(--accent);
  color: #06251c;
  cursor: pointer;
}
.session-bar button:hover { filter: brightness(1.08); }
.lb-hint { font-size: 11px; color: var(--muted); }

.record-status { font-size: 12px; color: var(--muted); margin: 2px 0 12px; min-height: 14px; }

.layout {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

@media (max-width: 880px) {
  .layout { grid-template-columns: 1fr; }
}

.stage-panel, .control-panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 16px;
}

#stage {
  width: 100%;
  height: auto;
  aspect-ratio: 760 / 320;
  display: block;
  background: linear-gradient(180deg, #0d1230, #080a1c);
  border-radius: 10px;
  border: 1px solid var(--panel-border);
}

.hud {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.hud-stat { display: flex; flex-direction: column; gap: 2px; }
.hud-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.hud-value { font-size: 20px; font-weight: 700; }
#status.fell { color: var(--danger); }

.run-btn {
  margin-left: auto;
  background: var(--accent);
  color: #06251c;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.run-btn:hover { filter: brightness(1.08); }

.touch-controls {
  display: none;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}
.touch-cluster { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.touch-btn {
  font: inherit;
  font-weight: 800;
  font-size: 16px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.25);
  padding: 14px 0;
  color: #0c0a1a;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
}
.touch-btn span { display: block; font-size: 10px; font-weight: 600; opacity: 0.75; text-transform: uppercase; letter-spacing: 0.05em; margin-top: 2px; }
.touch-btn.q, .touch-btn.o { background: var(--accent); }
.touch-btn.w, .touch-btn.p { background: var(--accent2); color: #241100; }
.touch-btn.active { filter: brightness(1.15); transform: scale(0.97); }

@media (pointer: coarse) {
  .touch-controls { display: flex; }
}

.control-panel h2 { margin: 0 0 14px; font-size: 16px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }

.keys { display: flex; flex-direction: column; gap: 10px; }

.key-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--cell-bg);
  border: 1px solid var(--cell-border);
  border-radius: 8px;
  padding: 8px 12px;
}

.key-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex: none;
  background: var(--accent2);
  color: #241100;
  font-weight: 800;
  font-size: 15px;
  border-radius: 7px;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.key-badge.active {
  background: var(--accent);
  transform: scale(1.12);
  box-shadow: 0 0 0 3px #6ef2c944;
}

.key-label { font-size: 13px; color: var(--ink); }

.hint {
  margin: 16px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}
.hint em { color: var(--ink); font-style: normal; font-weight: 700; }

.splat {
  position: fixed;
  inset: 0;
  background: #05060fcc;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  padding: 20px;
}
.splat[hidden] {
  display: none;
}
.splat-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 28px 32px;
  text-align: center;
  max-width: 380px;
}
.splat-card h2 {
  margin: 0 0 8px;
  color: var(--danger);
  font-size: 32px;
  letter-spacing: 0.05em;
}
.splat-distance { font-size: 28px; font-weight: 800; margin: 0; }
.splat-sub { color: var(--muted); margin: 4px 0 18px; }

.splat-actions { display: flex; flex-direction: column; gap: 8px; }
.splat-actions button, .splat-actions a {
  font: inherit;
  font-weight: 700;
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  text-decoration: none;
}
#splat-restart { background: var(--accent); color: #06251c; border: none; }
#share-btn { background: transparent; color: var(--ink); border: 1px solid var(--panel-border); }
.bsky-btn { background: #1a80e5; color: #fff; border: none; }

.credit {
  max-width: 1100px;
  margin: 28px auto 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}
.credit a { color: var(--accent); }

.lb-layout { max-width: 720px; margin: 0 auto; padding: 24px 20px 60px; }
.lb-layout .lede { color: var(--muted); font-size: 14px; margin: 8px 0 18px; }
.lb-layout .lede a { color: var(--accent); }

.lb-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 18px 20px;
}
.lb-card .status { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
.lb-card .empty-state { color: var(--muted); font-size: 13px; margin: 0; }
.lb-card .empty-state a { color: var(--accent); }

table.standings { width: 100%; border-collapse: collapse; font-size: 13px; }
table.standings th, table.standings td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--panel-border); }
table.standings th { color: var(--muted); font-weight: normal; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; }
table.standings tr:first-child td { color: var(--accent); font-weight: 700; }
