/* Stackrise: a sky that climbs with the tower */
@font-face { font-family: "Unbounded"; font-weight: 700; font-display: swap; src: url("/assets/fonts/unbounded-700.woff2") format("woff2"); }
@font-face { font-family: "Unbounded"; font-weight: 800; font-display: swap; src: url("/assets/fonts/unbounded-800.woff2") format("woff2"); }
@font-face { font-family: "Sora"; font-weight: 500; font-display: swap; src: url("/assets/fonts/sora-500.woff2") format("woff2"); }
@font-face { font-family: "Sora"; font-weight: 700; font-display: swap; src: url("/assets/fonts/sora-700.woff2") format("woff2"); }

:root {
  --accent: #ffd166;
  --accent-ink: #2a1d00;
  --fg: #ffffff;
  --fg-2: rgba(255, 255, 255, 0.78);
  --glass: rgba(255, 255, 255, 0.14);
  --glass-2: rgba(255, 255, 255, 0.24);
  --line: rgba(255, 255, 255, 0.28);
  --font-display: "Unbounded", system-ui, sans-serif;
  --font-body: "Sora", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; color: var(--fg); font-family: var(--font-body); font-weight: 500; background: #5aa9ff;
  display: grid; grid-template-rows: auto 1fr; min-height: 100dvh; overflow: hidden;
  -webkit-font-smoothing: antialiased; user-select: none; -webkit-user-select: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}
button { font: inherit; color: inherit; }
#sky { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; }
.hud, .stage { position: relative; z-index: 1; }
.hud { display: grid; grid-template-columns: auto 1fr auto; align-items: start; gap: 12px; padding: 12px 14px 0; padding-top: max(12px, env(safe-area-inset-top)); }
.hud-brand svg { width: 34px; height: 34px; display: block; filter: drop-shadow(0 4px 10px rgba(0,0,0,.35)); }
.hud-score { text-align: center; line-height: 1; }
.hud-score b { display: block; font-family: var(--font-display); font-weight: 800; font-size: clamp(2.6rem, 9vw, 4.2rem); letter-spacing: -0.03em; text-shadow: 0 4px 18px rgba(0, 0, 0, 0.35); transition: transform 0.12s; }
.hud-score b.bump { transform: scale(1.12); }
.hud-score span { display: block; margin-top: 6px; font-size: 0.78rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--fg-2); font-weight: 700; }
.hud-score em { font-style: normal; color: var(--accent); }
body.demo .hud-score, body.demo .hud-actions { visibility: hidden; }
.hud-actions { display: flex; gap: 8px; }
.icon-btn { width: 40px; height: 40px; border-radius: 999px; border: 1px solid var(--line); background: var(--glass); display: grid; place-items: center; cursor: pointer; transition: background 0.15s, transform 0.15s; backdrop-filter: blur(10px); }
.icon-btn:hover { background: var(--glass-2); transform: translateY(-1px); }
.icon-btn svg { width: 20px; height: 20px; fill: currentColor; }
#btn-sound .ic-off { display: none; }
#btn-sound[aria-pressed="false"] .ic-on { display: none; }
#btn-sound[aria-pressed="false"] .ic-off { display: block; }

.stage { position: relative; min-height: 0; }
#board { display: block; width: 100%; height: 100%; touch-action: none; cursor: pointer; }
.start { position: absolute; left: 50%; top: 14%; transform: translateX(-50%); text-align: center; width: min(92vw, 520px); pointer-events: none; animation: rise 0.6s cubic-bezier(.2,.9,.2,1); }
.start[hidden] { display: none; }
@keyframes rise { from { opacity: 0; transform: translateX(-50%) translateY(16px); } }
.start-kicker { margin: 0 0 8px; font-size: 0.78rem; letter-spacing: 0.2em; text-transform: uppercase; font-weight: 700; color: var(--fg-2); }
.start h1 { margin: 0; font-family: var(--font-display); font-weight: 800; font-size: clamp(1.7rem, 6vw, 2.8rem); line-height: 1.08; letter-spacing: -0.025em; text-shadow: 0 6px 24px rgba(0, 0, 0, 0.35); }
.start-hint { margin: 14px 0 0; font-size: 0.95rem; color: var(--fg-2); }
.streak { position: absolute; left: 50%; top: 26%; transform: translateX(-50%); font-family: var(--font-display); font-weight: 800; font-size: clamp(1.1rem, 4vw, 1.6rem); color: var(--accent); letter-spacing: -0.01em; text-shadow: 0 4px 18px rgba(0, 0, 0, 0.4); pointer-events: none; animation: popup 0.7s cubic-bezier(.2,.9,.2,1) forwards; }
.streak[hidden] { display: none; }
@keyframes popup { 0% { opacity: 0; transform: translateX(-50%) scale(0.6); } 25% { opacity: 1; transform: translateX(-50%) scale(1.1); } 100% { opacity: 0; transform: translateX(-50%) translateY(-24px) scale(1); } }
kbd { font-family: inherit; font-weight: 700; font-size: 0.8em; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; padding: 1px 6px; background: var(--glass); text-shadow: none; }

.toast { position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%) translateY(10px); z-index: 20; background: rgba(10, 14, 30, 0.7); border: 1px solid var(--line); color: var(--fg); padding: 10px 16px; border-radius: 999px; font-size: 0.9rem; font-weight: 700; backdrop-filter: blur(10px); opacity: 0; transition: opacity 0.2s, transform 0.2s; pointer-events: none; max-width: 90vw; text-align: center; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast[hidden] { display: none; }

.overlay { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 16px; background: rgba(6, 10, 24, 0.5); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.overlay[hidden] { display: none; }
.card { width: 100%; max-width: 440px; background: linear-gradient(180deg, rgba(26, 30, 52, 0.96), rgba(12, 14, 30, 0.98)); border: 1px solid rgba(255,255,255,.14); border-radius: 26px; padding: 26px 24px 22px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5); animation: pop 0.28s cubic-bezier(.2,.9,.2,1.2); max-height: calc(100dvh - 32px); overflow: auto; text-shadow: none; }
@keyframes pop { from { transform: scale(0.92) translateY(10px); opacity: 0; } }
.kicker { margin: 0 0 6px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); }
.card h2 { margin: 0 0 14px; font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; letter-spacing: -0.02em; line-height: 1.1; }
.muted { color: var(--fg-2); margin: 0; line-height: 1.55; font-size: 0.95rem; }
.card-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 20px; border-radius: 999px; border: 1.5px solid transparent; font-weight: 700; font-size: 0.95rem; cursor: pointer; text-decoration: none; color: inherit; transition: transform 0.15s, box-shadow 0.15s; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(255, 209, 102, 0.35); }
.btn-ghost { background: transparent; border-color: rgba(255,255,255,.3); }
.btn-ghost:hover { border-color: var(--fg); }
.how { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.how li { display: flex; gap: 14px; align-items: flex-start; color: var(--fg-2); line-height: 1.5; font-size: 0.95rem; }
.how-ic { flex: none; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: #fff; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35); }
.how-ic svg { width: 26px; height: 26px; fill: currentColor; }
.ic-a { background: linear-gradient(180deg, #5aa9ff, #2f6fe0); }
.ic-b { background: linear-gradient(180deg, #ff8a65, #e0397a); }
.ic-c { background: linear-gradient(180deg, #ffd166, #e39a12); }
.keys { margin: 18px 0 0; font-size: 0.8rem; color: var(--fg-2); }
.card-over { text-align: center; }
.over-score { margin: 4px 0 10px; }
.over-score b { display: block; font-family: var(--font-display); font-weight: 800; font-size: 4rem; line-height: 1; letter-spacing: -0.03em; color: var(--accent); }
.over-score span { display: block; font-size: 0.78rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--fg-2); font-weight: 700; margin-top: 6px; }
.card-over .card-actions { justify-content: center; }

@media (max-width: 560px) {
  .icon-btn { width: 36px; height: 36px; }
  .hud-brand svg { width: 30px; height: 30px; }
}
@media (prefers-reduced-motion: reduce) {
  .card, .start, .streak { animation: none; }
}
