:root {
  --bg: #06111f;
  --bg2: #0b1930;
  --panel: rgba(10, 22, 40, 0.72);
  --line: rgba(148, 241, 255, 0.18);
  --text: #e7fbff;
  --muted: #8fb1c2;
  --cyan: #35e7ff;
  --green: #4dff93;
  --pink: #ff4fd8;
  --orange: #ffba4d;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 10%, rgba(53, 231, 255, 0.20), transparent 28rem),
    radial-gradient(circle at 80% 0%, rgba(255, 79, 216, 0.16), transparent 30rem),
    linear-gradient(145deg, #020611, var(--bg) 48%, var(--bg2));
  overflow-x: hidden;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.55), transparent 75%);
}
button { font: inherit; }
.shell { width: min(1240px, calc(100% - 28px)); margin: 0 auto; padding: 28px 0; }
.topbar { display: flex; justify-content: space-between; gap: 24px; align-items: end; margin-bottom: 18px; }
.eyebrow { margin: 0 0 7px; color: var(--cyan); letter-spacing: .18em; text-transform: uppercase; font-weight: 900; font-size: .78rem; }
h1 { margin: 0; font-size: clamp(2.4rem, 8vw, 6.8rem); line-height: .86; letter-spacing: -.08em; text-shadow: 0 0 28px rgba(53,231,255,.24); }
.stats { display: grid; grid-template-columns: repeat(3, minmax(94px, 1fr)); gap: 10px; min-width: min(440px, 100%); }
.stats article, .side-panel, .game-card { border: 1px solid var(--line); background: var(--panel); box-shadow: 0 24px 80px rgba(0,0,0,.38), inset 0 1px 0 rgba(255,255,255,.06); backdrop-filter: blur(18px); }
.stats article { border-radius: 20px; padding: 14px 16px; }
.stats span { display: block; color: var(--muted); font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; }
.stats strong { display: block; margin-top: 5px; font-size: 1.8rem; line-height: 1; }
.game-card { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; padding: 18px; border-radius: 34px; }
.canvas-wrap { position: relative; min-height: 0; border-radius: 26px; overflow: hidden; background: linear-gradient(180deg, rgba(3,10,20,.95), rgba(9,23,42,.96)); box-shadow: inset 0 0 90px rgba(53,231,255,.09); }
canvas { display: block; width: 100%; aspect-ratio: 1 / 1; touch-action: none; }
.overlay { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; padding: 28px; background: radial-gradient(circle, rgba(6,17,31,.56), rgba(6,17,31,.88)); transition: opacity .2s ease, visibility .2s ease; }
.overlay.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.overlay h2 { margin: 0; font-size: clamp(1.7rem, 5vw, 3.5rem); letter-spacing: -.04em; }
.overlay p { max-width: 480px; color: var(--muted); line-height: 1.55; margin: 14px auto 22px; }
button { border: 1px solid rgba(53,231,255,.28); border-radius: 16px; padding: 13px 17px; color: var(--text); background: rgba(13,31,55,.86); cursor: pointer; font-weight: 900; transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease; }
button:hover { transform: translateY(-1px); border-color: rgba(53,231,255,.7); box-shadow: 0 10px 28px rgba(53,231,255,.12); }
#play { color: #03111e; background: linear-gradient(135deg, var(--green), var(--cyan)); border: 0; min-width: 170px; }
.side-panel { border-radius: 26px; padding: 18px; display: flex; flex-direction: column; gap: 18px; }
.hint h2 { margin: 0 0 10px; }
.hint p { color: var(--muted); line-height: 1.55; }
kbd { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 30px; margin: 2px; border-radius: 8px; border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.06); color: var(--text); font-weight: 900; }
.settings { display: grid; gap: 12px; padding: 14px; border: 1px solid rgba(53,231,255,.14); border-radius: 20px; background: rgba(2, 6, 17, .24); }
.settings label { display: grid; gap: 7px; color: var(--muted); font-size: .82rem; font-weight: 900; text-transform: uppercase; letter-spacing: .10em; }
.settings select { width: 100%; border: 1px solid rgba(53,231,255,.24); border-radius: 13px; padding: 11px 12px; color: var(--text); background: rgba(13,31,55,.94); outline: none; font-weight: 800; text-transform: none; letter-spacing: 0; }
.settings select:focus { border-color: rgba(53,231,255,.85); box-shadow: 0 0 0 4px rgba(53,231,255,.12); }
.sound-toggle[aria-pressed="false"] { color: #ffd5e9; border-color: rgba(255,79,216,.32); background: rgba(255,79,216,.09); }
.buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pad { margin-top: auto; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-areas: ". up ." "left down right"; gap: 10px; }
.pad button { min-height: 56px; font-size: 1.15rem; }
.pad [data-dir="up"] { grid-area: up; }
.pad [data-dir="left"] { grid-area: left; }
.pad [data-dir="down"] { grid-area: down; }
.pad [data-dir="right"] { grid-area: right; }
@media (max-width: 900px) {
  .topbar { align-items: stretch; flex-direction: column; }
  .stats { min-width: 0; }
  .game-card { grid-template-columns: 1fr; }
  .side-panel { order: 2; }
}
@media (max-width: 520px) {
  .shell { width: min(100% - 16px, 1240px); padding: 14px 0; }
  .stats { grid-template-columns: repeat(3, 1fr); }
  .stats article { padding: 10px; border-radius: 16px; }
  .stats strong { font-size: 1.35rem; }
  .game-card { padding: 10px; border-radius: 24px; }
}
