:root {
  --bg: #070a17;
  --bg-card: #0b1024;
  --line: #1b2447;
  --text: #eef1ff;
  --muted: #8a93c4;
  --blue: #0052FF;
  --blue-bright: #3d7bff;
  --danger: #ff4d6d;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  background: var(--bg);
  background-image:
    radial-gradient(1200px 600px at 50% -200px, rgba(0, 82, 255, 0.14), transparent 70%),
    radial-gradient(900px 500px at 50% 110%, rgba(0, 82, 255, 0.07), transparent 70%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100dvh;
  padding: 16px clamp(12px, 4vw, 24px) calc(24px + env(safe-area-inset-bottom));
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

main { width: 100%; max-width: 520px; }

/* ---------- header ---------- */
.site-header {
  width: 100%;
  max-width: 520px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 2px 14px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  letter-spacing: 0.14em;
  font-size: 15px;
}

.logo svg { width: 26px; height: 26px; filter: drop-shadow(0 0 6px rgba(0, 82, 255, 0.8)); }

.chip {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--blue-bright);
  border: 1px solid rgba(0, 82, 255, 0.45);
  background: rgba(0, 82, 255, 0.1);
  border-radius: 999px;
  padding: 5px 11px;
  white-space: nowrap;
}

/* ---------- game card ---------- */
.game-card {
  position: relative;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  background: var(--bg-card);
  box-shadow: 0 0 60px rgba(0, 82, 255, 0.12), 0 20px 50px rgba(0, 0, 0, 0.5);
}

#game {
  display: block;
  width: 100%;
  aspect-ratio: 480 / 640;
  touch-action: none;
  cursor: pointer;
}

/* HUD */
.hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 14px 16px;
  pointer-events: none;
  z-index: 2;
}

.hud-score {
  font-size: 44px;
  font-weight: 900;
  text-shadow: 0 0 18px rgba(0, 82, 255, 0.9);
  font-variant-numeric: tabular-nums;
}

.hud-best {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--muted);
  padding-top: 8px;
  min-width: 64px;
}

.hud-mute {
  pointer-events: auto;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 15px;
  padding: 5px 9px;
  cursor: pointer;
  min-width: 64px;
  color: var(--text);
}

/* overlays */
.overlay { position: absolute; inset: 0; z-index: 3; }

.ov {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
  padding: 24px;
  background: rgba(7, 10, 23, 0.72);
  backdrop-filter: blur(3px);
}

.hidden { display: none !important; }

.ov-logo {
  width: 74px; height: 74px;
  filter: drop-shadow(0 0 14px rgba(0, 82, 255, 0.9));
  animation: bob 2.4s ease-in-out infinite;
}

@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-9px) rotate(180deg); }
}

.ov h1 { font-size: 30px; font-weight: 900; letter-spacing: 0.16em; }
.ov h2 { font-size: 24px; font-weight: 900; letter-spacing: 0.2em; color: var(--danger); text-shadow: 0 0 16px rgba(255, 77, 109, 0.5); }

.tagline { color: var(--muted); font-size: 14px; }

.cta {
  margin-top: 14px;
  font-size: 19px;
  font-weight: 900;
  letter-spacing: 0.22em;
  color: var(--blue-bright);
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.hint { font-size: 12px; color: var(--muted); }
kbd {
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 1px 6px;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.05);
}

.final-score {
  font-size: 64px;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 0 22px rgba(0, 82, 255, 0.9);
}

.final-best { color: var(--muted); font-size: 13px; font-weight: 700; letter-spacing: 0.12em; }

.new-best {
  color: #ffd166;
  font-weight: 900;
  letter-spacing: 0.14em;
  font-size: 14px;
  text-shadow: 0 0 14px rgba(255, 209, 102, 0.6);
  animation: pulse 1s ease-in-out infinite;
}

.btn-row { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; justify-content: center; }

.btn {
  font-family: inherit;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.1em;
  padding: 13px 22px;
  border-radius: 13px;
  border: none;
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.15s ease;
}

.btn:active { transform: scale(0.96); }

.btn-primary {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 6px 24px rgba(0, 82, 255, 0.45);
}
.btn-primary:hover { filter: brightness(1.15); }

.btn-ghost {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border: 1px solid var(--line);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.1); }

/* ---------- content sections ---------- */
.how, .about { margin-top: 34px; }

.how h2, .about h2 {
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.22em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 14px;
}

.how-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

.how-tile {
  border: 1px solid var(--line);
  background: var(--bg-card);
  border-radius: 16px;
  padding: 16px 14px;
}

.how-ico { font-size: 22px; display: block; margin-bottom: 10px; }
.how-tile h3 { font-size: 14px; margin-bottom: 6px; }
.how-tile p { font-size: 12px; color: var(--muted); line-height: 1.5; }

.about p { color: var(--muted); font-size: 14px; line-height: 1.65; }
.about a { color: var(--blue-bright); text-decoration: none; }
.about a:hover { text-decoration: underline; }

/* ---------- footer ---------- */
.site-footer {
  margin-top: 40px;
  display: flex;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.06em;
}

.base-blue { color: var(--blue-bright); font-weight: 700; }
.dot { opacity: 0.4; }

@media (max-width: 460px) {
  .how-grid { grid-template-columns: 1fr; }
  .hud-score { font-size: 36px; }
  .btn { padding: 12px 16px; font-size: 13px; }
}
