:root {
  color-scheme: dark;
  --bg: #081214;
  --panel: #0d1b1e;
  --cyan: #35e5f3;
  --pink: #f48bd4;
  --amber: #f6c75b;
  --text: #f4fcfd;
  --muted: #8ba8ad;
  --line: rgba(53, 229, 243, 0.22);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; background: var(--bg); }
body { color: var(--text); font-family: "Courier New", ui-monospace, monospace; overflow-x: hidden; }
button, input { font: inherit; letter-spacing: 0; }
button { color: inherit; }

.game-shell {
  width: 100%; min-height: 100vh; display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  background: linear-gradient(rgba(53,229,243,.035) 1px,transparent 1px), linear-gradient(90deg,rgba(53,229,243,.035) 1px,transparent 1px), var(--bg);
  background-size: 24px 24px;
}
.game-panel { min-width: 0; padding: 18px; display: flex; flex-direction: column; justify-content: center; }
.game-header { width: min(100%,720px); margin: 0 auto 12px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.game-logo { width: 118px; height: auto; }
.score-strip { display: flex; gap: 24px; text-align: right; }
.score-strip span { display: grid; }
.score-strip small, .eyebrow, .overlay-content label { color: var(--muted); font-size: 10px; font-weight: 700; }
.score-strip strong { color: var(--cyan); font-size: 20px; line-height: 1; }

.canvas-wrap {
  position: relative; width: min(100%,720px); aspect-ratio: 8/5; margin: 0 auto; overflow: hidden;
  border: 1px solid var(--cyan); border-radius: 6px; background: #091517;
  box-shadow: 0 0 0 1px rgba(53,229,243,.08), 0 18px 50px rgba(0,0,0,.42); touch-action: manipulation;
}
#game-canvas { display: block; width: 100%; height: 100%; }
.game-overlay { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; padding: 20px; background: rgba(4,12,14,.78); backdrop-filter: blur(4px); }
.game-overlay.is-hidden { display: none; }
.overlay-content { width: min(100%,310px); text-align: center; }
.eyebrow { margin: 0 0 7px; color: var(--cyan); }
.overlay-content h1, .overlay-content h2 { margin: 0 0 22px; color: var(--text); font-size: clamp(27px,6vw,46px); line-height: 1; text-shadow: 0 0 22px rgba(53,229,243,.48); }
.overlay-content h2 { color: var(--cyan); }
.overlay-content label { display: block; margin-bottom: 7px; text-align: left; }
.overlay-content input { width: 100%; height: 44px; margin-bottom: 10px; padding: 0 14px; border: 1px solid var(--line); border-radius: 4px; outline: none; background: #081214; color: var(--text); text-transform: uppercase; }
.overlay-content input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(53,229,243,.12); }
.primary-button { width: 100%; height: 44px; border: 1px solid var(--cyan); border-radius: 4px; background: var(--cyan); color: #061012; font-weight: 900; cursor: pointer; box-shadow: 0 8px 28px rgba(53,229,243,.2); }
.primary-button:hover, .primary-button:focus-visible { background: #fff; border-color: #fff; }
.rank-result { margin: -10px 0 20px; color: var(--amber); font-size: 13px; font-weight: 700; }
.jump-button { position: absolute; right: 16px; bottom: 16px; z-index: 2; width: 48px; height: 48px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.55); border-radius: 50%; background: rgba(8,18,20,.64); font-size: 26px; cursor: pointer; backdrop-filter: blur(6px); }
.jump-button:hover, .jump-button:focus-visible, .jump-button.is-pressed { border-color: var(--cyan); color: var(--cyan); transform: translateY(-2px); }

.leaderboard-panel { padding: 22px 18px; border-left: 1px solid var(--line); background: rgba(9,24,27,.94); display: flex; flex-direction: column; }
.leaderboard-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.leaderboard-heading h2 { margin: 0; color: var(--text); font-size: 24px; }
.leaderboard-heading .eyebrow { margin-bottom: 4px; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 12px var(--cyan); }
.leaderboard-list { min-height: 0; margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.leaderboard-entry { min-height: 38px; display: grid; grid-template-columns: 30px minmax(0,1fr) auto; align-items: center; gap: 8px; padding: 0 10px; border: 1px solid rgba(255,255,255,.055); border-radius: 4px; background: rgba(255,255,255,.035); color: var(--muted); font-size: 11px; }
.leaderboard-entry:nth-child(1) { border-color: rgba(246,199,91,.45); color: var(--amber); }
.leaderboard-entry:nth-child(2) { border-color: rgba(53,229,243,.3); }
.leaderboard-entry:nth-child(3) { border-color: rgba(244,139,212,.25); }
.leaderboard-entry.is-current { background: rgba(53,229,243,.12); }
.leaderboard-entry .player { overflow: hidden; color: var(--text); font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.leaderboard-entry .points { color: var(--cyan); font-weight: 700; }
.built-by { margin-top: auto; padding-top: 18px; color: var(--muted); font-size: 10px; text-align: center; text-decoration: none; }
.built-by:hover, .built-by:focus-visible { color: var(--cyan); }

@media (max-width: 760px) {
  .game-shell { grid-template-columns: 1fr; }
  .game-panel { padding: 12px; justify-content: flex-start; }
  .game-header { margin-bottom: 9px; }
  .game-logo { width: 96px; }
  .score-strip { gap: 14px; }
  .score-strip strong { font-size: 17px; }
  .leaderboard-panel { border-top: 1px solid var(--line); border-left: 0; }
  .leaderboard-list { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .jump-button { right: 10px; bottom: 10px; width: 44px; height: 44px; }
}
@media (max-width: 430px) {
  .game-panel { padding: 10px 8px; }
  .game-header { gap: 8px; }
  .game-logo { width: 82px; }
  .score-strip small { font-size: 8px; }
  .score-strip strong { font-size: 14px; }
  .canvas-wrap { aspect-ratio: 4/3; }
  .overlay-content h1, .overlay-content h2 { margin-bottom: 16px; }
  .leaderboard-panel { padding: 18px 10px; }
  .leaderboard-entry { grid-template-columns: 24px minmax(0,1fr); min-height: 42px; }
  .leaderboard-entry .points { grid-column: 2; font-size: 9px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
