:root {
  --red: #ff3b3b; --orange: #ff8a1f; --yellow: #ffcc1a;
  --grad: linear-gradient(110deg, var(--red) 0%, var(--orange) 55%, var(--yellow) 100%);
  --text: #fff7ee; --muted: #e7cfc0; --panel: rgb(26 12 20 / 0.72); --line: rgb(255 255 255 / 0.14);
  --font-display: "Space Grotesk", system-ui, sans-serif; --font-body: "Inter", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #1a0d14; color: var(--text); font-family: var(--font-body); -webkit-tap-highlight-color: transparent; }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---- HUD ---- */
.hud { position: fixed; top: 0; left: 0; right: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: max(12px, env(safe-area-inset-top)) 14px 0; pointer-events: none; }
.hud > * { pointer-events: auto; }
.back { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px 6px 6px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); text-decoration: none; color: var(--text); }
.back svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.back img { height: 26px; width: auto; display: block; }
.stats { margin: 0 auto; display: flex; gap: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 6px 8px; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.stats > div { display: grid; justify-items: center; min-width: 64px; padding: 0 6px; }
.stats .lbl { font-size: 0.66rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.stats b { font-family: var(--font-display); font-size: 1.25rem; font-variant-numeric: tabular-nums; line-height: 1.1; }
.lives { display: flex !important; gap: 3px; align-items: center; height: 1.4rem; }
.lives i { width: 12px; height: 12px; background: var(--grad); transform: rotate(45deg); border-radius: 2px; display: block; }
.lives i.lost { background: rgb(255 255 255 / 0.18); }
.tools { display: flex; gap: 6px; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn[aria-pressed="true"] .wave { display: none; }
.icon-btn:hover { border-color: rgb(255 138 31 / 0.6); }
@media (max-width: 560px) {
  .back img { display: none; }
  .stats > div { min-width: 52px; padding: 0 3px; }
  .stats b { font-size: 1.05rem; }
  .icon-btn { width: 36px; height: 36px; }
  #btnRestart { display: none; }
}

/* ---- in-play indicators ---- */
.tension { position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 4; pointer-events: none;
  font-family: var(--font-display); font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; font-size: 0.8rem;
  padding: 8px 16px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); color: var(--muted); transition: color 0.2s, border-color 0.2s, box-shadow 0.2s; }
.tension.is-pull { color: #fff; border-color: rgb(255 138 31 / 0.8); box-shadow: 0 0 24px -4px rgb(255 120 30 / 0.8); }
.combo { position: fixed; right: 16px; top: 70px; z-index: 4; pointer-events: none; font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; opacity: 0; transition: opacity 0.3s; }
.combo.is-on { opacity: 1; }
.combo b { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; font-size: 1.6rem; }
.meters, .floaters { position: fixed; inset: 0; pointer-events: none; z-index: 3; }
.meter { position: absolute; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%;
  background: conic-gradient(var(--c, #ffcc1a) calc(var(--p, 0) * 1turn), rgb(0 0 0 / 0.35) 0);
  -webkit-mask: radial-gradient(circle, transparent 15px, #000 16px); mask: radial-gradient(circle, transparent 15px, #000 16px); filter: drop-shadow(0 0 6px var(--c, #ffcc1a)); }
.meter.danger { --c: #ff3b3b; }
.floater { position: absolute; transform: translate(-50%, -50%); font-family: var(--font-display); font-weight: 700; font-size: 1.4rem; white-space: nowrap; text-shadow: 0 2px 12px rgb(0 0 0 / 0.6); animation: float-up 1.4s ease-out forwards; }
.floater.good { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 2px 6px rgb(0 0 0 / 0.5)); font-size: 1.7rem; }
.floater.bad { color: #ff6b6b; }
@keyframes float-up { 0% { opacity: 0; transform: translate(-50%, -30%) scale(0.7); } 15% { opacity: 1; transform: translate(-50%, -60%) scale(1.1); } 100% { opacity: 0; transform: translate(-50%, -190%) scale(1); } }

/* ---- cards ---- */
.card { position: fixed; z-index: 10; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(460px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto;
  padding: 28px 28px 24px; border-radius: 22px; background: rgb(22 10 18 / 0.86); border: 1px solid var(--line); text-align: center;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 30px 80px -20px rgb(0 0 0 / 0.7); }
.eyebrow { margin: 0 0 6px; font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--orange); font-weight: 600; }
.card h1, .card h2 { margin: 0; font-family: var(--font-display); letter-spacing: -0.02em; }
.card h1 { font-size: 3rem; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.card h2 { font-size: 2rem; }
.sub { margin: 6px 0 14px; color: var(--muted); }
.how { text-align: left; margin: 0 0 20px; padding: 0 0 0 18px; color: var(--muted); font-size: 0.93rem; line-height: 1.5; }
.how li { margin: 4px 0; }
.how b { color: var(--text); }
.how i { color: var(--yellow); font-style: normal; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 22px; border-radius: 999px; border: 0; cursor: pointer;
  background: var(--grad); color: #1d0700; font-weight: 700; font-size: 1rem; box-shadow: 0 10px 30px -10px rgb(255 80 40 / 0.7); }
.btn--ghost { background: transparent; color: var(--text); border: 1px solid var(--line); box-shadow: none; }
.btn:hover { filter: brightness(1.08); }
.row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.best { margin: 12px 0 0; font-size: 0.85rem; color: var(--muted); min-height: 1em; }
.noscript { position: fixed; inset: 0; display: grid; place-items: center; }
@media (prefers-reduced-motion: reduce) { .floater { animation-duration: 0.01s; } }
