/* Bowfall: full-screen canvas arena with a glass HUD and 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, 14, 26, 0.55); --glass-2: rgba(255, 255, 255, 0.08);
  --hp: #31e981; --st: #5aa2ff; --p2: #5aa2ff;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: #12192b; 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 ---------- */
.hud { position: fixed; inset: 0; pointer-events: none; display: flex; flex-direction: column; justify-content: space-between; padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
.hud[hidden] { display: none; }
.hud-top { display: flex; align-items: flex-start; gap: 12px; }
.panel { pointer-events: none; background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: 14px; padding: 8px 12px 10px; min-width: 190px; }
.pname { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: 0.82rem; margin-bottom: 6px; }
.pname small { margin-left: auto; color: var(--fg-2); font-size: 0.72rem; font-weight: 500; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--spawn); box-shadow: 0 0 10px var(--spawn); }
.dot-p2 { background: var(--p2); box-shadow: 0 0 10px var(--p2); }
.bar { height: 9px; border-radius: 999px; background: rgba(255, 255, 255, 0.12); overflow: hidden; margin-top: 5px; }
.bar i { display: block; height: 100%; width: 100%; border-radius: 999px; transition: width 0.18s ease-out; }
.bar.hp i { background: linear-gradient(90deg, #1fc46a, #31e981); box-shadow: 0 0 10px rgba(49, 233, 129, 0.6); }
.bar.st i { background: linear-gradient(90deg, #3d7bff, #7ab8ff); box-shadow: 0 0 10px rgba(90, 162, 255, 0.6); }
.bar.st { height: 6px; }
.bar i.flash { background: #ff5a5a; }
.p2[hidden] { display: none; }
.mid { margin-left: auto; margin-right: auto; text-align: center; background: var(--glass); backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: 14px; padding: 7px 18px; display: flex; flex-direction: column; line-height: 1.15; }
.mid b { font-family: var(--font-display); font-weight: 800; font-size: 1.05rem; letter-spacing: -0.01em; }
.mid span { font-size: 0.78rem; color: var(--fg-2); font-weight: 700; }
.mid small { font-size: 0.68rem; color: var(--fg-2); font-weight: 500; }
.wind { margin-top: 4px; font-size: 0.72rem; font-weight: 700; color: #ffd166; letter-spacing: 0.08em; }
.wind[hidden] { display: none; }
.right { display: flex; align-items: center; gap: 6px; pointer-events: auto; }
.skulls { display: inline-flex; align-items: center; gap: 6px; background: var(--glass); backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px 6px 9px; font-family: var(--font-display); font-weight: 700; font-size: 0.9rem; margin-right: 4px; }
.skulls svg { width: 18px; height: 18px; fill: #f4f1ea; }
.icon-btn { pointer-events: auto; width: 38px; height: 38px; 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: 19px; height: 19px; 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; }

.hud-bottom { display: flex; align-items: flex-end; justify-content: center; gap: 12px; position: relative; }
.quiver { display: flex; gap: 6px; pointer-events: auto; background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: 18px; padding: 6px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.quiver::-webkit-scrollbar { display: none; }
.qv { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; width: 62px; padding: 6px 4px 5px; border-radius: 12px; border: 1px solid transparent; background: transparent; cursor: pointer; color: var(--fg-2); flex: none; transition: background 0.15s, color 0.15s; }
.qv:hover { background: var(--glass-2); }
.qv.is-on { background: rgba(255, 255, 255, 0.14); border-color: rgba(255, 255, 255, 0.35); color: var(--fg); }
.qv-n { font-size: 0.66rem; font-weight: 700; letter-spacing: 0.02em; }
.qv-c { font-size: 0.6rem; color: var(--st); font-weight: 700; }
.qv-k { position: absolute; top: 3px; left: 5px; font-size: 0.58rem; color: var(--fg-2); font-weight: 700; }
.qv-ic { width: 26px; height: 26px; border-radius: 50%; display: block; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.25), 0 0 0 2px rgba(255, 255, 255, 0.12); }
.ic-wood { background: linear-gradient(135deg, #e0b27f, #a9774a); }
.ic-heavy { background: linear-gradient(135deg, #cfd0dd, #6f6f80); }
.ic-triple { background: linear-gradient(135deg, #ffe58a, #b99a3a); }
.ic-fire { background: radial-gradient(circle at 40% 35%, #ffd27a, #ff6a1f 60%, #8a3a1a); box-shadow: 0 0 12px rgba(255, 138, 60, 0.7); }
.ic-ice { background: radial-gradient(circle at 40% 35%, #ffffff, #a6ecff 55%, #4aa8c8); box-shadow: 0 0 12px rgba(166, 236, 255, 0.7); }
.ic-poison { background: radial-gradient(circle at 40% 35%, #d8ffb0, #8fe05a 55%, #3f7a2a); box-shadow: 0 0 12px rgba(156, 240, 106, 0.6); }
.ic-bomb { background: radial-gradient(circle at 40% 35%, #ff9a9a, #ff5a5a 55%, #5a1e1e); box-shadow: 0 0 12px rgba(255, 90, 90, 0.6); }
.ic-bolt { background: radial-gradient(circle at 40% 35%, #ffffff, #d7c8ff 55%, #6a4fd0); box-shadow: 0 0 14px rgba(215, 200, 255, 0.8); }
.ic-ghost { background: radial-gradient(circle at 40% 35%, #ffffff, #e9ecff 55%, #9aa3c8); box-shadow: 0 0 14px rgba(255, 255, 255, 0.7); }
.jump { pointer-events: auto; position: absolute; right: 0; bottom: 0; width: 66px; height: 66px; border-radius: 50%; border: 1px solid var(--line); background: var(--glass); color: var(--fg); display: grid; place-items: center; cursor: pointer; }
.jump[hidden] { display: none; }
.jump svg { width: 30px; height: 30px; fill: currentColor; }

.banner { position: fixed; left: 50%; top: 22%; transform: translate(-50%, 0) scale(0.9); z-index: 15; pointer-events: none; font-family: var(--font-display); font-weight: 800; font-size: clamp(1.4rem, 4vw, 2.6rem); letter-spacing: -0.02em; color: #fff; text-shadow: 0 4px 24px rgba(0, 0, 0, 0.6), 0 0 40px rgba(49, 233, 129, 0.35); opacity: 0; transition: opacity 0.25s, transform 0.35s cubic-bezier(.2,.9,.2,1.3); text-align: center; white-space: nowrap; }
.banner.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
.banner.big { font-size: clamp(1.8rem, 5.5vw, 3.4rem); color: #ffd166; text-shadow: 0 4px 24px rgba(0, 0, 0, 0.7), 0 0 50px rgba(255, 209, 102, 0.45); }
.banner[hidden] { display: none; }
.toast { position: fixed; left: 50%; bottom: 96px; 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; }

/* ---------- overlays ---------- */
.overlay { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 16px; background: rgba(8, 10, 20, 0.5); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); overflow: auto; }
.overlay[hidden] { display: none; }
.card { width: 100%; max-width: 460px; color: var(--fg); background: linear-gradient(180deg, rgba(28, 34, 50, 0.97), rgba(14, 18, 30, 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; }
.card-wide { max-width: 560px; }
@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; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.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:not(:disabled) { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(49, 233, 129, 0.35); }
.btn:disabled { opacity: 0.4; cursor: default; transform: none; box-shadow: none; }
.btn-ghost { background: transparent; border-color: var(--line); }
.btn-ghost:hover:not(:disabled) { border-color: var(--fg); }
.btn-sm { padding: 8px 14px; font-size: 0.82rem; flex: none; }
.btn[hidden] { display: none; }

.card-start { text-align: center; max-width: 520px; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--fg-2); text-decoration: none; font-weight: 700; font-size: 0.85rem; }
.brand svg { width: 26px; height: 26px; }
.title { margin: 14px 0 4px; font-family: var(--font-display); font-weight: 800; font-size: clamp(2.4rem, 8vw, 3.6rem); letter-spacing: -0.03em; line-height: 1; background: linear-gradient(90deg, #ffffff, #31e981 60%, #8af0ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tag { margin: 0 0 18px; color: var(--fg-2); font-size: 0.95rem; }
.modes { display: grid; gap: 8px; text-align: left; }
.mode { display: flex; flex-direction: column; gap: 3px; padding: 12px 16px; border-radius: 16px; border: 1px solid var(--line); background: var(--glass-2); cursor: pointer; transition: transform 0.15s, border-color 0.15s, background 0.15s; }
.mode:hover { transform: translateY(-2px); border-color: var(--spawn); background: rgba(49, 233, 129, 0.12); }
.mode b { font-family: var(--font-display); font-weight: 700; font-size: 1rem; }
.mode span { font-size: 0.82rem; color: var(--fg-2); }
.menu-meta { margin: 14px 0 0; font-size: 0.82rem; color: var(--fg-2); }
.skulls-inline { display: inline-flex; align-items: center; gap: 4px; }
.skulls-inline svg { width: 16px; height: 16px; fill: currentColor; }
.card-start .card-actions { justify-content: center; }

.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 em { font-style: normal; color: var(--fg); font-weight: 700; }
.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, #31e981, #148a4a); }
.ic-b { background: linear-gradient(180deg, #ff7a5a, #c43b3b); }
.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; }
.keys b { color: var(--fg); }
.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; }

.shop-h { margin: 14px 0 8px; font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--fg-2); }
.shop-list { display: flex; flex-direction: column; gap: 6px; }
.shop-row { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 14px; border: 1px solid var(--line); background: var(--glass-2); }
.shop-row .qv-ic { flex: none; }
.shop-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.shop-text b { font-size: 0.92rem; }
.shop-text small { font-size: 0.76rem; color: var(--fg-2); line-height: 1.35; }
.up-dots { display: flex; gap: 3px; width: 26px; flex-wrap: wrap; justify-content: center; flex: none; }
.up-dots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 255, 255, 0.18); }
.up-dots i.on { background: var(--spawn); box-shadow: 0 0 6px var(--spawn); }
.card-win { text-align: center; }
.stars { display: flex; justify-content: center; gap: 8px; margin: 4px 0 10px; }
.stars[hidden] { display: none; }
.stars span { font-size: 2.4rem; line-height: 1; color: rgba(255, 255, 255, 0.14); transform: scale(0.6); transition: transform 0.35s cubic-bezier(.2,.9,.2,1.4), color 0.3s, text-shadow 0.3s; }
.stars span.lit { color: #ffd166; transform: scale(1); text-shadow: 0 0 22px rgba(255, 209, 102, 0.7); }
.region-blurb { margin: -6px 0 12px; font-size: 0.85rem; color: var(--fg-2); }
.world-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.world-tab { border: 1px solid var(--line); background: var(--glass-2); border-radius: 999px; padding: 7px 12px; font-size: 0.78rem; font-weight: 700; cursor: pointer; }
.world-tab[aria-selected="true"] { background: var(--fg); color: #111; border-color: transparent; }
.world-tab.locked { opacity: 0.45; }
.level-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.lvl { position: relative; min-height: 86px; border-radius: 14px; border: 1px solid var(--line); background: var(--glass-2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; cursor: pointer; font-family: var(--font-display); font-weight: 700; font-size: 1rem; padding: 6px 4px; transition: background 0.15s, transform 0.15s; }
.lvl:hover:not(:disabled) { background: rgba(255, 255, 255, 0.14); transform: translateY(-2px); }
.lvl em { font-family: var(--font-body); font-style: normal; font-weight: 600; font-size: 0.62rem; color: var(--fg-2); text-align: center; line-height: 1.2; }
.lvl small { font-family: var(--font-body); font-size: 0.62rem; letter-spacing: 0.08em; color: #ffd166; }
.lvl.boss { border-color: rgba(255, 209, 102, 0.5); }
.lvl:disabled { opacity: 0.35; cursor: default; }
.lvl:disabled::after { content: ""; position: absolute; right: 7px; top: 7px; width: 9px; height: 11px; border: 2px solid currentColor; border-radius: 3px 3px 2px 2px; border-top-width: 3px; opacity: 0.8; }
.level-grid + .muted { margin-top: 12px; font-size: 0.8rem; }
@media (max-width: 480px) { .level-grid { grid-template-columns: repeat(3, 1fr); } }
.card-win .card-actions { justify-content: center; }

@media (max-width: 720px) {
  .panel { min-width: 140px; padding: 6px 10px 8px; }
  .pname { font-size: 0.72rem; }
  .pname small { display: none; }
  .mid { padding: 5px 12px; }
  .mid b { font-size: 0.9rem; }
  .icon-btn { width: 34px; height: 34px; }
  .skulls { padding: 5px 10px 5px 8px; font-size: 0.8rem; }
  #btn-hud-help { display: none; }
  .qv { width: 52px; }
  .qv-n { display: none; }
  .hud-bottom { padding-right: 76px; }
  .jump { width: 60px; height: 60px; }
  .card { padding: 20px 18px 18px; }
}
@media (max-height: 460px) {
  .hud-top { gap: 8px; }
  .panel { min-width: 130px; padding: 4px 8px 6px; }
  .bar { height: 7px; margin-top: 3px; }
  .bar.st { height: 5px; }
  .quiver { padding: 4px; }
  .qv { width: 46px; padding: 4px 3px; }
  .qv-ic { width: 22px; height: 22px; }
  .toast { bottom: 70px; }
  .banner { top: 16%; }
}
@media (prefers-reduced-motion: reduce) { .card { animation: none; } }
