/* Cosmojar: a jar of planets on a night-sky canvas, glass HUD, dark cards. */
@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 { --spawn: #31e981; --ink-on-spawn: #0b1a12; --font-display: "Unbounded", system-ui, sans-serif; --font-body: "Sora", system-ui, sans-serif; --fg: #f4f1ea; --fg-2: rgba(244, 241, 234, 0.72); --line: rgba(255, 255, 255, 0.14); --glass: rgba(10, 12, 30, 0.55); --glass-2: rgba(255, 255, 255, 0.08); }
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: #070a1c; color: var(--fg); font-family: var(--font-body); font-weight: 500; overflow: hidden; user-select: none; -webkit-user-select: none; -webkit-font-smoothing: antialiased; touch-action: none; }
button { font: inherit; color: inherit; }
#game { position: fixed; inset: 0; display: block; touch-action: none; outline: 0; cursor: crosshair; }

.hud { position: fixed; left: 0; right: 0; top: 0; display: flex; align-items: center; gap: 10px; padding: max(10px, env(safe-area-inset-top)) 12px 8px; pointer-events: none; }
.hud-brand { display: flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; pointer-events: auto; }
.hud-brand svg { width: 32px; height: 32px; display: block; filter: drop-shadow(0 4px 10px rgba(0,0,0,.4)); }
.hud-title { font-family: var(--font-display); font-size: 0.95rem; font-weight: 800; margin: 0; }
.hud-score, .hud-next { display: flex; flex-direction: column; line-height: 1.1; background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: 12px; padding: 6px 12px; min-width: 76px; }
.hud-score span, .hud-next span { font-size: 0.62rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--fg-2); font-weight: 700; }
.hud-score b { font-family: var(--font-display); font-size: 1.05rem; font-weight: 800; }
.hud-next b { font-size: 0.9rem; font-weight: 700; }
.next.t0 { color: #c7c2bb; } .next.t1 { color: #d9a977; } .next.t2 { color: #dff6ff; } .next.t3 { color: #f4f1ea; } .next.t4 { color: #ff9a5a; } .next.t5 { color: #ffe6a8; } .next.t6 { color: #6fd0ff; } .next.t7 { color: #7f9cff; } .next.t8 { color: #f3dcb0; } .next.t9 { color: #f0c9a0; } .next.t10 { color: #fff1a8; }
.hud-actions { margin-left: auto; display: flex; gap: 6px; pointer-events: auto; }
.icon-btn { width: 36px; height: 36px; border-radius: 999px; border: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(10px); color: var(--fg); display: grid; place-items: center; cursor: pointer; transition: transform 0.15s, background 0.15s; }
.icon-btn:hover { transform: translateY(-1px); background: rgba(255, 255, 255, 0.14); }
.icon-btn svg { width: 18px; height: 18px; 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; }

.combo { position: fixed; left: 50%; top: 92px; transform: translateX(-50%); font-family: var(--font-display); font-weight: 800; font-size: 1.1rem; color: #8af0ff; text-shadow: 0 2px 14px rgba(0,0,0,.7), 0 0 24px rgba(138,240,255,.5); pointer-events: none; animation: combo-pop 0.3s cubic-bezier(.2,.9,.2,1.4); }
.combo[hidden] { display: none; }
@keyframes combo-pop { from { transform: translateX(-50%) scale(0.6); opacity: 0; } }
.toast { position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%) translateY(10px); z-index: 20; background: rgba(20, 20, 28, 0.92); border: 1px solid var(--line); color: var(--fg); padding: 10px 16px; border-radius: 999px; font-size: 0.88rem; font-weight: 700; 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(5, 7, 20, 0.55); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); overflow: auto; }
.overlay[hidden] { display: none; }
.card { width: 100%; max-width: 440px; color: var(--fg); background: linear-gradient(180deg, rgba(28, 30, 54, 0.97), rgba(12, 14, 32, 0.99)); border: 1px solid var(--line); 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; }
@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(--spawn); }
.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(--spawn); color: var(--ink-on-spawn); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(49, 233, 129, 0.35); }
.btn-ghost { background: transparent; border-color: var(--line); }
.btn-ghost:hover { border-color: var(--fg); }
.btn[hidden] { display: none; }
.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.93rem; }
.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, #8af0ff, #2f6bff); }
.ic-b { background: linear-gradient(180deg, #ffd166, #e0702e); }
.ic-c { background: linear-gradient(180deg, #d7c8ff, #6a4fd0); }
.keys { margin: 16px 0 0; font-size: 0.78rem; color: var(--fg-2); line-height: 1.7; }
.card kbd { font-family: inherit; font-weight: 700; font-size: 0.78em; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; padding: 1px 6px; background: var(--glass-2); margin: 0 1px; }
.card-win { text-align: center; }
.card-win .card-actions { justify-content: center; }

@media (max-width: 520px) {
  .hud { gap: 6px; padding-left: 8px; padding-right: 8px; }
  .hud-title { display: none; }
  .hud-score, .hud-next { min-width: 0; padding: 5px 9px; }
  .hud-score b { font-size: 0.9rem; }
  .hud-next b { font-size: 0.78rem; }
  .icon-btn { width: 32px; height: 32px; }
  .icon-btn svg { width: 16px; height: 16px; }
  #btn-help { display: none; }
  .combo { top: 78px; font-size: 0.95rem; }
}
@media (prefers-reduced-motion: reduce) { .card, .combo { animation: none; } }
