:root {
  --cyan: #37e6ff;
  --pink: #7dff6a;
  --gold: #ffd24a;
  --bg: #03040d;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); overflow: hidden; font-family: var(--font); color: #e8f4ff; -webkit-user-select: none; user-select: none; }
canvas#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; cursor: none; touch-action: none; }
body.menu-open canvas#game { cursor: default; }

#ui { position: fixed; inset: 0; pointer-events: none; }
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px 16px; pointer-events: auto; background: radial-gradient(ellipse at center, rgba(3,4,13,0.35), rgba(3,4,13,0.82)); text-align: center; }
.screen.hidden, .hidden { display: none !important; }
#title { background: radial-gradient(ellipse at 50% 40%, rgba(3,4,13,0.15), rgba(3,4,13,0.72) 75%); }

.logo { margin: 0; display: flex; flex-direction: column; align-items: center; line-height: 0.95; font-weight: 900; font-style: italic; text-transform: uppercase; }
.logo span { display: block; background: linear-gradient(180deg, #fff 10%, var(--cyan) 55%, #1b6bff); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 12px rgba(55, 230, 255, 0.55)); }
.logo .l1 { font-size: clamp(34px, 7vw, 64px); letter-spacing: 0.34em; margin-right: -0.34em; }
.logo .l2 { font-size: clamp(56px, 12.5vw, 118px); letter-spacing: 0.06em; background: linear-gradient(180deg, #fff 5%, var(--pink) 60%, #17802a); -webkit-background-clip: text; background-clip: text; filter: drop-shadow(0 0 16px rgba(125, 255, 106, 0.6)); }
.logo .l3 { font-size: clamp(30px, 6.4vw, 60px); letter-spacing: 0.22em; margin-right: -0.22em; }
.tag { margin: 4px 0 10px; color: #9fb7d8; letter-spacing: 0.22em; text-transform: uppercase; font-size: clamp(11px, 1.6vw, 15px); }

h2 { margin: 0 0 4px; font-size: clamp(30px, 6vw, 52px); letter-spacing: 0.2em; font-weight: 900; color: #fff; text-shadow: 0 0 18px rgba(55, 230, 255, 0.8); }
h2.over { color: #ff6a6a; text-shadow: 0 0 22px rgba(255, 60, 60, 0.9); }

.menu { display: flex; flex-direction: column; gap: 10px; align-items: stretch; min-width: min(300px, 80vw); }
button { font: 800 16px/1 var(--font); letter-spacing: 0.18em; padding: 15px 22px; color: #dff6ff; background: rgba(10, 20, 50, 0.7); border: 1.5px solid rgba(55, 230, 255, 0.55); border-radius: 4px; cursor: pointer; transition: transform 0.08s, box-shadow 0.12s, background 0.12s; box-shadow: 0 0 0 rgba(55, 230, 255, 0); }
button:hover, button:focus-visible { background: rgba(20, 60, 110, 0.85); box-shadow: 0 0 18px rgba(55, 230, 255, 0.55); outline: none; transform: translateY(-1px); }
button.primary { border-color: var(--pink); color: #fff; background: linear-gradient(180deg, rgba(125, 255, 106, 0.28), rgba(20, 120, 40, 0.28)); box-shadow: 0 0 14px rgba(125, 255, 106, 0.35); }
button.primary:hover, button.primary:focus-visible { box-shadow: 0 0 26px rgba(125, 255, 106, 0.8); }
button:active { transform: translateY(1px) scale(0.99); }

.hint { margin: 8px 0 0; font-size: clamp(11px, 1.5vw, 13px); color: #8fa6c8; max-width: 640px; line-height: 1.7; }
.hint b { color: var(--cyan); }
.credit { position: absolute; bottom: 12px; left: 0; right: 0; font-size: 12px; color: #6f86a8; }
.credit a { color: #8fd8ff; text-decoration: none; border-bottom: 1px dotted rgba(143, 216, 255, 0.5); }
.credit a:hover { color: #fff; }

.panel { display: flex; flex-direction: column; gap: 14px; padding: 20px 26px; min-width: min(420px, 90vw); background: rgba(8, 14, 36, 0.78); border: 1px solid rgba(55, 230, 255, 0.35); border-radius: 6px; text-align: left; }
.panel label { display: flex; justify-content: space-between; align-items: center; gap: 18px; font-size: 15px; letter-spacing: 0.04em; }
.panel label.check { justify-content: flex-start; gap: 12px; }
input[type="range"] { width: 180px; accent-color: var(--cyan); }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--pink); }

.scorelist { list-style: none; margin: 0; padding: 14px 22px; min-width: min(380px, 90vw); background: rgba(8, 14, 36, 0.78); border: 1px solid rgba(55, 230, 255, 0.35); border-radius: 6px; counter-reset: r; }
.scorelist li { counter-increment: r; display: grid; grid-template-columns: 2.2em 3.6em 1fr auto; gap: 8px; padding: 6px 0; font-size: 17px; font-variant-numeric: tabular-nums; text-align: left; color: #bcd8f5; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
.scorelist li::before { content: counter(r) "."; color: #ff5d8f; font-weight: 800; }
.scorelist li .nm { font-weight: 800; letter-spacing: 0.12em; color: #fff; }
.scorelist li .sc { text-align: right; font-weight: 700; color: var(--cyan); }
.scorelist li .st { color: #7f95b8; font-size: 12px; align-self: center; text-align: right; padding-left: 8px; }
.scorelist li.me { background: rgba(255, 210, 74, 0.12); }
.scorelist li.me .nm, .scorelist li.me .sc { color: var(--gold); }

.final { margin: 0; font-size: 20px; color: #bcd8f5; }
.final b { color: var(--gold); }
.entry { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.newhs { margin: 0; color: var(--gold); letter-spacing: 0.12em; font-weight: 800; text-shadow: 0 0 12px rgba(255, 210, 74, 0.7); }
#goName { width: 7em; text-align: center; font: 900 44px/1.1 var(--font); letter-spacing: 0.3em; text-transform: uppercase; padding: 6px 0 6px 0.3em; color: #fff; background: rgba(10, 20, 50, 0.8); border: 2px solid var(--cyan); border-radius: 4px; outline: none; box-shadow: 0 0 18px rgba(55, 230, 255, 0.5); -webkit-user-select: text; user-select: text; }

@media (max-height: 560px) {
  .screen { gap: 8px; padding: 10px; }
  .hint, .tag { display: none; }
  button { padding: 11px 18px; font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) { button { transition: none; } }

/* ---- touch / mobile ---- */
* { -webkit-tap-highlight-color: transparent; }
html, body { overscroll-behavior: none; touch-action: none; -webkit-touch-callout: none; }
body { height: 100vh; height: 100dvh; }
canvas#game { touch-action: none; -webkit-touch-callout: none; }
.screen { overflow-y: auto; justify-content: flex-start; padding-top: max(24px, env(safe-area-inset-top)); padding-bottom: max(24px, env(safe-area-inset-bottom)); }
.screen > :first-child { margin-top: auto; }
.screen > :last-child { margin-bottom: auto; }
.credit { position: static; margin-top: 8px; }
button.alt { border-color: var(--cyan); background: linear-gradient(180deg, rgba(55, 230, 255, 0.2), rgba(20, 90, 200, 0.22)); }
.tabs { display: flex; gap: 8px; }
.tabs button { padding: 10px 18px; font-size: 13px; }
.tabs button:focus-visible { box-shadow: 0 0 18px rgba(125, 255, 106, 0.55); }
@media (max-width: 560px) { .menu { min-width: min(320px, 86vw); } button { padding: 16px 20px; } .hint { max-width: 90vw; } }
