/* Rampwave page. Tokens mirror THEME in main.js; --accent is re-tinted per
   world at runtime. */
@font-face { font-family: "Lexend"; src: url("fonts/lexend-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Lexend"; src: url("fonts/lexend-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Lexend"; src: url("fonts/lexend-800.woff2") format("woff2"); font-weight: 800; font-display: swap; }

:root {
  --bg: #0b0d14;
  --surface: rgba(16, 19, 30, 0.86);
  --edge: rgba(255, 255, 255, 0.14);
  --ink: #f2f4fa;
  --muted: #a7afc2;
  --accent: #ffb35c;
  --reward: #ffd54a;
  --danger: #ff5d6c;
  --good: #58f0a0;
  --font-ui: "Lexend", system-ui, sans-serif;
}

html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); font-family: var(--font-ui); }
#app { position: fixed; inset: 0; }
#view, #fx { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#fx { pointer-events: none; }
#flash { position: absolute; inset: 0; pointer-events: none; background: #fff; opacity: 0; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: var(--text-s); }

a.back { color: var(--muted); font-size: var(--text-s); text-decoration: none; }
a.back:hover { color: var(--accent); }
a.back.corner { position: absolute; left: calc(var(--space) * 2); bottom: calc(var(--space) * 1.5); z-index: 30; }

/* ---------------- HUD ---------------- */
#hud { position: absolute; inset: 0; pointer-events: none; font-variant-numeric: tabular-nums; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55); }
.hud-tl { position: absolute; top: calc(var(--space) * 2); left: calc(var(--space) * 2.5); }
.hud-label { font-size: var(--text-s); color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; }
.hud-stage { font-size: var(--text-m); font-weight: 600; margin-top: 2px; }
.hud-time { font-size: 2rem; font-weight: 800; margin-top: 2px; letter-spacing: 0.01em; }
.hud-sub { font-size: var(--text-s); color: var(--muted); }
.hud-tr { position: absolute; top: calc(var(--space) * 2); right: calc(var(--space) * 2.5); display: flex; gap: var(--space); align-items: center; }
.badge.warn { color: #1b1203; background: var(--reward); border-color: var(--reward); }
.badge.gems { display: inline-flex; align-items: center; gap: 6px; color: var(--reward); }
.gem-ico { display: inline-block; width: 10px; height: 10px; background: var(--reward); transform: rotate(45deg); }
#crosshair { position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px 0 0 -2px; border-radius: 50%; background: rgba(255, 255, 255, 0.85); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5); }
.hud-bottom { position: absolute; left: 50%; bottom: calc(var(--space) * 3); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.speed { display: flex; align-items: baseline; gap: 6px; }
.speed b { font-size: 2.4rem; font-weight: 800; min-width: 4ch; text-align: right; }
.speed small { color: var(--muted); font-size: var(--text-s); }
.speed-bar { position: relative; width: 240px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.14); overflow: hidden; }
.speed-bar i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--accent); border-radius: 3px; }
.speed-bar em { position: absolute; top: -2px; bottom: -2px; width: 2px; background: #fff; left: 0; opacity: 0.8; }
.keys { display: flex; gap: 4px; margin-top: 4px; }
.keys span { min-width: 26px; padding: 2px 6px; text-align: center; border: 1px solid rgba(255, 255, 255, 0.25); border-radius: 5px; font-size: 0.72rem; color: var(--muted); background: rgba(0, 0, 0, 0.25); }
.keys span.wide { min-width: 52px; }
.keys span.on { color: #111; background: var(--ink); border-color: var(--ink); }
.split { position: absolute; left: 50%; top: 24%; transform: translateX(-50%); padding: 6px 16px; border-radius: 10px; background: rgba(0, 0, 0, 0.45); font-size: 1.3rem; font-weight: 600; text-align: center; }
.split .ahead { color: var(--good); }
.split .behind { color: var(--danger); }
.split small { display: block; font-size: var(--text-s); color: var(--muted); font-weight: 400; }
.lock-hint { position: absolute; left: 50%; top: 58%; transform: translateX(-50%); padding: 8px 16px; border-radius: 8px; background: rgba(0, 0, 0, 0.55); color: var(--ink); font-size: var(--text-m); }

.toast { z-index: 40; font-weight: 600; }
.toast small { display: block; font-weight: 400; color: var(--muted); font-size: var(--text-s); }

/* ---------------- screens ---------------- */
.screen { position: absolute; inset: 0; z-index: 20; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: calc(var(--space) * 2); text-align: center; }
.title-screen { background: radial-gradient(ellipse at 50% 60%, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.45) 100%); cursor: pointer; }
.logo { display: flex; font-weight: 800; font-size: clamp(3.2rem, 9vw, 7.5rem); letter-spacing: 0.06em; line-height: 1; font-style: italic; filter: drop-shadow(0 6px 24px rgba(0, 0, 0, 0.45)); }
.logo span:first-child { color: #fff; }
.logo span:last-child { color: var(--accent); }
.tag { max-width: 44ch; color: var(--ink); opacity: 0.9; margin: 0; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6); }
.press { margin: 0; font-weight: 600; animation: pulse 1.8s ease-in-out infinite; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6); }
html.rm .press { animation: none; }
@keyframes pulse { 50% { opacity: 0.45; } }
.controls-line { margin: 0; color: var(--ink); font-size: var(--text-s); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: center; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7); }

.select-screen { justify-content: flex-start; padding: calc(var(--space) * 4) calc(var(--space) * 3) calc(var(--space) * 6); box-sizing: border-box; background: linear-gradient(180deg, rgba(5, 6, 12, 0.55), rgba(5, 6, 12, 0.2) 40%, rgba(5, 6, 12, 0.7)); overflow-y: auto; }
.select-head { display: flex; align-items: center; justify-content: space-between; gap: calc(var(--space) * 2); width: min(1100px, 100%); flex-wrap: wrap; }
.select-head h2 { margin: 0; font-size: var(--text-l); }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: calc(var(--space) * 2); width: min(1100px, 100%); }
@media (max-width: 900px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.card { position: relative; text-align: left; padding: calc(var(--space) * 2); min-height: 150px; border-radius: 14px; border: 1px solid var(--edge); color: var(--ink); font-family: var(--font-ui); cursor: pointer; background: var(--surface); overflow: hidden; display: flex; flex-direction: column; gap: 6px; transition: transform 140ms, border-color 140ms; }
.card::before { content: ""; position: absolute; inset: 0; background: var(--card-bg); opacity: 0.55; z-index: 0; }
.card > * { position: relative; z-index: 1; }
.card:hover, .card:focus-visible, .card[aria-selected="true"] { border-color: var(--card-accent, var(--accent)); transform: translateY(-2px); }
.card[aria-selected="true"] { box-shadow: 0 0 0 2px var(--card-accent, var(--accent)); }
html.rm .card { transition: none; }
.card h3 { margin: 0; font-size: 1.25rem; }
.card .blurb { margin: 0; color: var(--ink); opacity: 0.85; font-size: var(--text-s); line-height: 1.4; }
.card .meta { display: flex; justify-content: space-between; align-items: center; margin-top: auto; font-size: var(--text-s); font-variant-numeric: tabular-nums; }
.card .pb { color: var(--reward); font-weight: 600; }
.diff { display: inline-flex; gap: 3px; }
.diff i { width: 8px; height: 8px; border-radius: 2px; background: rgba(255, 255, 255, 0.25); transform: rotate(45deg); }
.diff i.on { background: var(--card-accent, var(--accent)); }
.medals { display: inline-flex; gap: 4px; align-items: center; }
.medal { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.35); display: inline-block; }
.medal.gold.on { background: #ffd54a; border-color: #ffd54a; }
.medal.silver.on { background: #d6dde8; border-color: #d6dde8; }
.medal.bronze.on { background: #d08a4f; border-color: #d08a4f; }
.medal:not(.on) { background: transparent; }
.select-foot { display: flex; gap: calc(var(--space) * 2); align-items: center; }
.ghost-btn { padding: 10px 16px; min-height: 44px; border-radius: 10px; border: 1px solid var(--edge); background: var(--surface); color: var(--ink); font-family: var(--font-ui); cursor: pointer; }
.ghost-btn:hover { border-color: var(--accent); }

.panel-screen { background: rgba(4, 5, 10, 0.55); }
.panel { background: var(--surface); border: 1px solid var(--edge); border-radius: 16px; padding: calc(var(--space) * 3); min-width: 300px; max-width: 520px; display: flex; flex-direction: column; gap: calc(var(--space) * 1.5); align-items: stretch; backdrop-filter: blur(6px); }
.panel.wide { max-width: 640px; width: min(640px, 92vw); }
.panel h2 { margin: 0; font-size: var(--text-l); }
.panel .menu { min-width: 0; }
.menu-item { min-height: 44px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.menu-item.primary { border-color: var(--accent); color: var(--accent); }
.menu-item .kbd { margin-left: 4px; }
.row-end { display: flex; gap: var(--space); justify-content: flex-end; flex-wrap: wrap; }
.row-end .menu-item { flex: 1; }
.set-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 12px 18px; align-items: center; text-align: left; font-size: var(--text-s); }
.set-grid output { color: var(--accent); font-variant-numeric: tabular-nums; margin-left: 6px; }
.set-grid .toggle { justify-self: start; }
.set-grid .seg { min-height: 44px; }
.howto { text-align: left; margin: 0; padding-left: 1.2rem; display: flex; flex-direction: column; gap: 10px; line-height: 1.45; font-size: 0.92rem; }
.fin-time { font-size: 3rem !important; font-weight: 800; font-variant-numeric: tabular-nums; }
.fin-medal { margin: 0; font-weight: 600; display: flex; gap: 8px; align-items: center; justify-content: center; }
.fin-delta { margin: 0; font-variant-numeric: tabular-nums; }
.fin-delta.ahead { color: var(--good); }
.fin-delta.behind { color: var(--danger); }
.splits { width: 100%; border-collapse: collapse; font-size: var(--text-s); font-variant-numeric: tabular-nums; }
.splits td { padding: 5px 6px; border-top: 1px solid var(--edge); text-align: right; }
.splits td:first-child { text-align: left; color: var(--muted); }
.splits .ahead { color: var(--good); }
.splits .behind { color: var(--danger); }
.loading { position: absolute; left: 50%; bottom: 20%; transform: translateX(-50%); z-index: 35; padding: 8px 16px; border-radius: 8px; background: rgba(0, 0, 0, 0.6); }

.courses { gap: var(--space); }
.course-item { display: grid; grid-template-columns: 1fr auto auto; grid-template-rows: auto auto; column-gap: 12px; text-align: left; justify-content: stretch; }
.course-item .c-name { font-weight: 600; grid-column: 1; }
.course-item .c-meta { grid-column: 1; grid-row: 2; font-size: var(--text-s); color: var(--muted); }
.course-item .c-pb { grid-column: 2; grid-row: 1 / span 2; align-self: center; color: var(--reward); font-variant-numeric: tabular-nums; }
.course-item .medals { grid-column: 3; grid-row: 1 / span 2; align-self: center; }
.splits-wrap { max-height: 38vh; overflow-y: auto; }
