@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Press+Start+2P&display=swap");

:root {
  --bg: #0b0a10; --panel: #17141f; --text: #f4f1e8; --muted: #9a93a8;
  --accent: #ffcf4d; --good: #5be37a; --bad: #ff5277; --line: #2a2536;
  --pix: "Press Start 2P", system-ui, monospace;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1100px 700px at 50% -8%, #1a1530 0%, var(--bg) 62%);
  color: var(--text); font-family: "Inter", system-ui, sans-serif;
  min-height: 100%; display: flex; flex-direction: column; align-items: center;
  padding: 1rem; overflow-x: hidden;
}
a { color: var(--accent); text-decoration: none; font-weight: 700; }
.wrap { width: 100%; max-width: 440px; margin: 0 auto; flex: 1; display: flex; flex-direction: column; }

header.top { text-align: center; margin: 0.7rem 0 0.3rem; }
header.top h1 { font-family: var(--pix); font-size: 1.05rem; margin: 0; letter-spacing: 0; line-height: 1.4; color: var(--accent); text-shadow: 2px 2px 0 #00000055; }
header.top p { margin: 0.55rem 0 0; color: var(--muted); font-size: 0.82rem; }

.hud { display: flex; gap: 0.5rem; margin: 0.9rem 0 0.2rem; }
.stat { flex: 1; background: var(--panel); border: 2px solid var(--line); border-radius: 4px; padding: 0.55rem 0.4rem; text-align: center; }
.stat .label { font-family: var(--pix); font-size: 0.48rem; letter-spacing: 0.04em; color: var(--muted); }
.stat .value { font-family: var(--pix); font-size: 0.95rem; margin-top: 0.45rem; }

.stage { position: relative; margin: 0.7rem auto 0; width: 100%; border-radius: 6px; overflow: hidden; border: 2px solid var(--line); background: #07070c; touch-action: none; }
canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; image-rendering: crisp-edges; }

.hint { color: var(--muted); font-size: 0.76rem; text-align: center; margin: 0.6rem 0 0.1rem; }

/* overlay card */
.overlay { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; background: rgba(7,7,12,0.86); z-index: 5; padding: 1rem; }
.overlay.show { display: flex; }
.card { background: var(--panel); border: 2px solid var(--line); border-radius: 6px; padding: 1.4rem 1.2rem; max-width: 360px; width: 100%; text-align: center; box-shadow: 0 0 0 4px #00000040, 0 18px 50px -18px rgba(0,0,0,0.8); }
.card h2 { font-family: var(--pix); margin: 0 0 0.6rem; font-size: 1.05rem; line-height: 1.4; }
.card p { color: var(--muted); margin: 0.4rem 0; line-height: 1.55; font-size: 0.88rem; }
.card .big { font-family: var(--pix); font-size: 1.9rem; margin: 0.6rem 0 0.2rem; color: var(--accent); }
.card .big small { font-size: 0.8rem; color: var(--muted); }
.rules { text-align: left; font-size: 0.84rem; color: var(--muted); line-height: 1.55; margin: 0.7rem 0 1rem; padding-left: 1.1rem; }
.rules li { margin: 0.3rem 0; }
.modes { display: flex; gap: 0.6rem; margin: 0.9rem 0 0.2rem; }
.mode-btn { flex: 1; cursor: pointer; background: #110f18; color: var(--text); border: 2px solid var(--line); border-radius: 4px; padding: 0.9rem 0.5rem; font-family: inherit; text-align: center; transition: border-color 0.15s ease, transform 0.08s ease, background 0.15s ease; }
.mode-btn:hover { border-color: var(--accent); transform: translateY(-2px); }
.mode-btn .t { font-family: var(--pix); font-size: 0.7rem; line-height: 1.4; }
.mode-btn .ic { font-size: 1.5rem; display: block; margin-bottom: 0.5rem; }
.mode-btn .b { font-size: 0.72rem; color: var(--good); margin-top: 0.5rem; font-weight: 700; min-height: 0.9rem; }
.btn { cursor: pointer; background: var(--accent); color: #1a1206; border: none; border-radius: 4px; padding: 0.85rem 1.4rem; font-family: var(--pix); font-size: 0.72rem; line-height: 1.3; transition: filter 0.15s ease, transform 0.08s ease; }
.btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn:active { transform: scale(0.97); }
.btn.ghost { background: transparent; color: var(--muted); border: 2px solid var(--line); margin-top: 0.6rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
