:root {
  --bg: #0C0F14;
  --panel: #151A22;
  --panel-2: #1E2530;
  --ink: #E8EDF4;
  --muted: #8A96A6;
  --line: #2A3340;
  --amber: #FFB020;
  --steel: #5BC8FF;
  --green: #57E08A;
  --red: #FF5470;
  --gold: #FFD54A;
}
* { box-sizing: border-box; margin: 0; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { height: 100%; overflow: hidden; background: var(--bg); }
body { font-family: Inter, system-ui, sans-serif; color: var(--ink); user-select: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }

#wrap { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; }
#c { display: block; background: #0A0D12; touch-action: none; }

/* HUD */
#hud { position: absolute; inset: 0; pointer-events: none; display: flex; flex-direction: column; justify-content: space-between; }
.hud-top, .hud-bottom { pointer-events: none; padding: 12px 14px; }
.hud-top { display: flex; gap: 10px; align-items: center; }
.stat { background: rgba(21,26,34,.82); border: 1px solid var(--line); border-radius: 10px; padding: 6px 12px; backdrop-filter: blur(4px); }
.stat .lbl { display: block; font-size: .62rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.stat b { font-family: "Chakra Petch", sans-serif; font-size: 1.15rem; }
.stat.redoubt { flex: 1; max-width: 240px; }
.bar { height: 9px; background: #2A1116; border-radius: 5px; overflow: hidden; margin-top: 4px; }
.bar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--red), #FF8FA3); transition: width .2s; }
.icon-btn { pointer-events: auto; margin-left: auto; width: 40px; height: 40px; border-radius: 10px; background: rgba(21,26,34,.82); border: 1px solid var(--line); font-family: "Chakra Petch"; letter-spacing: .1em; }

.hud-bottom { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.wave-msg { font-family: "Chakra Petch", sans-serif; font-size: 1.1rem; letter-spacing: .04em; color: var(--amber); text-shadow: 0 2px 12px #000; min-height: 1.4em; text-align: center; }
.ability-dock { display: flex; gap: 8px; pointer-events: auto; flex-wrap: wrap; justify-content: center; }
.dock-btn {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 18px; font-family: "Chakra Petch", sans-serif; font-size: .92rem;
  letter-spacing: .03em; min-width: 92px; transition: transform .1s, border-color .1s, opacity .1s;
}
.dock-btn:active { transform: scale(.95); }
.dock-btn:disabled { opacity: .38; }
.dock-btn.armed { border-color: var(--amber); color: var(--amber); box-shadow: 0 0 0 2px rgba(255,176,32,.25); }
.dock-btn.ghost { background: transparent; border-style: dashed; }
#b-drop { border-color: var(--steel); color: var(--steel); }

/* overlays */
.overlay { position: absolute; inset: 0; background: rgba(8,10,14,.82); backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 10; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 26px 24px; max-width: 420px; width: 100%; max-height: 90vh; overflow-y: auto; text-align: center; }
.panel h2 { font-family: "Chakra Petch", sans-serif; font-weight: 700; font-size: 1.35rem; margin-bottom: 14px; letter-spacing: .02em; }
.logo { font-family: "Chakra Petch", sans-serif; font-weight: 700; font-size: 2.8rem; letter-spacing: .14em; color: var(--amber); text-shadow: 0 0 30px rgba(255,176,32,.35); }
.tag { color: var(--steel); font-family: "Chakra Petch"; letter-spacing: .1em; margin: 4px 0 16px; font-size: .95rem; }
.blurb, .how-list { color: var(--muted); font-size: .92rem; line-height: 1.55; text-align: left; }
.blurb { margin-bottom: 20px; }
.how-list { margin: 0 0 20px; padding-left: 18px; display: flex; flex-direction: column; gap: 7px; }
.how-list b { color: var(--ink); }
.how-list i { color: var(--amber); font-style: normal; }

.btn { display: block; width: 100%; border-radius: 12px; padding: 13px; font-family: "Chakra Petch", sans-serif; font-weight: 600; letter-spacing: .04em; margin-top: 10px; transition: transform .1s, filter .1s; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--amber); color: #221600; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { background: var(--panel-2); border: 1px solid var(--line); }
.btn.lg { padding: 16px; font-size: 1.05rem; }

/* class picker */
.picker-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.pick-card { display: flex; gap: 12px; align-items: center; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; text-align: left; transition: border-color .1s; }
.pick-card:disabled { opacity: .4; }
.pick-card:not(:disabled):hover { border-color: var(--steel); }
.pick-swatch { width: 34px; height: 34px; border-radius: 8px; flex-shrink: 0; }
.pick-info { flex: 1; }
.pick-info b { font-family: "Chakra Petch"; display: block; font-size: 1rem; }
.pick-info span { color: var(--muted); font-size: .8rem; line-height: 1.35; }
.pick-cost { font-family: "Chakra Petch"; color: var(--steel); font-size: .95rem; }

/* game over */
.score-big { font-family: "Chakra Petch", sans-serif; font-weight: 700; font-size: 3rem; color: var(--gold); text-shadow: 0 0 30px rgba(255,213,74,.3); margin: 4px 0; }
.breakdown { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; color: var(--muted); margin-bottom: 12px; }
.breakdown .row { display: flex; justify-content: space-between; }
.breakdown .row b { color: var(--ink); font-family: "Chakra Petch"; }
.achv-earned { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-bottom: 14px; }
.achv-chip { background: rgba(255,213,74,.14); border: 1px solid rgba(255,213,74,.4); color: var(--gold); border-radius: 999px; padding: 5px 12px; font-size: .78rem; }
.submit-row { display: flex; gap: 8px; margin-bottom: 6px; }
.submit-row input { flex: 1; background: var(--panel-2); border: 1px solid var(--line); color: var(--ink); border-radius: 10px; padding: 11px 13px; font: inherit; }
.submit-row input:focus-visible { outline: 2px solid var(--amber); }
.submit-row .btn { width: auto; margin: 0; padding: 11px 18px; }
.submit-msg { font-size: .82rem; color: var(--green); min-height: 1.2em; margin-bottom: 8px; }

/* board */
.board-list { list-style: none; padding: 0; margin: 0 0 16px; display: flex; flex-direction: column; gap: 4px; text-align: left; counter-reset: rank; }
.board-list li { display: flex; justify-content: space-between; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 9px 13px; font-size: .9rem; }
.board-list li::before { counter-increment: rank; content: counter(rank) ". "; color: var(--muted); margin-right: 8px; font-family: "Chakra Petch"; }
.board-list li .nm { flex: 1; }
.board-list li .sc { font-family: "Chakra Petch"; color: var(--gold); }
.board-list li.me { border-color: var(--amber); }
.board-loading { justify-content: center !important; color: var(--muted); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
