/* ============================================================
   VOIDBREAK — design system
   Direction: neon-vector arcade / synthwave terminal.
   Near-black space, cyan signal glow, magenta hostiles,
   Orbitron display + Rajdhani UI (all sans).
   ============================================================ */

:root {
  --bg: #05060a;
  --panel: rgba(10, 14, 24, 0.88);
  --panel-2: rgba(16, 22, 38, 0.9);
  --line: rgba(89, 214, 255, 0.18);
  --line-strong: rgba(89, 214, 255, 0.45);
  --text: #dfeaf6;
  --text-dim: #8fa3c8;
  --text-faint: #55647f;
  --cyan: #59d6ff;
  --magenta: #ff4f9a;
  --gold: #ffd166;
  --green: #b8ff6b;
  --red: #ff3b3b;
  --font-display: 'Orbitron', 'Segoe UI', sans-serif;
  --font-body: 'Rajdhani', 'Segoe UI', sans-serif;
  --r: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body { background: var(--bg); color: var(--text); font-family: var(--font-body); }

#scene {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

button { font-family: var(--font-body); cursor: pointer; }

/* ================= HUD ================= */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }

.xpbar {
  position: absolute; top: 0; left: 0; right: 0; height: 5px;
  background: rgba(89, 214, 255, 0.12);
}
#xpFill { height: 100%; width: 0; background: linear-gradient(90deg, var(--cyan), #9ae6ff); box-shadow: 0 0 12px var(--cyan); transition: width 0.15s; }

.hud-row {
  position: absolute; top: 12px; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; gap: 12px;
}
#hudLevel { font-family: var(--font-display); font-size: 0.85rem; letter-spacing: 0.12em; color: var(--cyan); }
#hudTime { font-family: var(--font-display); font-size: clamp(1.2rem, 3vw, 1.7rem); letter-spacing: 0.1em; text-shadow: 0 0 18px rgba(89, 214, 255, 0.6); }
.hud-right { display: flex; gap: 14px; align-items: center; font-weight: 600; font-size: 1rem; }
.hud-right .k { color: var(--magenta); }
.hud-right .s { color: var(--gold); }
#pauseBtn { pointer-events: auto; background: none; border: 1px solid var(--line); border-radius: 6px; color: var(--text-dim); width: 40px; height: 40px; font-size: 1rem; }
#pauseBtn:hover { border-color: var(--line-strong); color: var(--text); }

.hpwrap {
  position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%);
  width: min(340px, 70vw); height: 14px;
  border: 1px solid var(--line-strong); border-radius: 999px;
  background: rgba(0, 0, 0, 0.6); overflow: hidden;
}
#hpFill { height: 100%; width: 100%; background: linear-gradient(90deg, #2ee66b, #b8ff6b); transition: width 0.12s; }

#hudFlash {
  position: absolute; top: 18%; left: 50%; transform: translateX(-50%);
  font-family: var(--font-display); font-size: clamp(0.9rem, 2.5vw, 1.3rem);
  letter-spacing: 0.2em; color: var(--gold); text-shadow: 0 0 20px rgba(255, 209, 102, 0.8);
  opacity: 0; transition: opacity 0.4s; text-align: center; max-width: 90vw;
}
#hudFlash.show { opacity: 1; }

/* touch joystick */
#stick {
  position: fixed; width: 80px; height: 80px; border-radius: 50%;
  border: 2px solid var(--line-strong); background: rgba(89, 214, 255, 0.06);
  pointer-events: none; z-index: 12;
}
#stickNub { position: absolute; left: 24px; top: 24px; width: 32px; height: 32px; border-radius: 50%; background: rgba(89, 214, 255, 0.4); }

/* ================= screens ================= */
.screen {
  position: fixed; inset: 0; z-index: 20;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; padding: 24px; overflow-y: auto;
}

.logo {
  font-family: var(--font-display); font-weight: 900;
  font-size: clamp(2.2rem, 8vw, 4.6rem); letter-spacing: 0.18em;
  color: var(--text);
  text-shadow: 0 0 12px var(--cyan), 0 0 45px rgba(89, 214, 255, 0.5);
}
.logo b { color: var(--cyan); }
.tagline { color: var(--text-dim); letter-spacing: 0.3em; text-transform: uppercase; font-size: clamp(0.7rem, 2vw, 0.9rem); margin-top: -10px; }

.menu-btns { display: flex; flex-direction: column; gap: 12px; width: min(320px, 80vw); margin-top: 10px; }

.btn {
  font-family: var(--font-display); font-size: 0.95rem; letter-spacing: 0.14em;
  padding: 14px 22px; min-height: 48px;
  color: var(--text); background: var(--panel-2);
  border: 1px solid var(--line-strong); border-radius: var(--r);
  transition: box-shadow 0.15s, transform 0.15s, background 0.15s;
}
.btn:hover:not(:disabled) { box-shadow: 0 0 22px rgba(89, 214, 255, 0.35); transform: translateY(-1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.primary { background: linear-gradient(180deg, rgba(89, 214, 255, 0.25), rgba(89, 214, 255, 0.08)); border-color: var(--cyan); text-shadow: 0 0 10px var(--cyan); }
.btn.danger { border-color: rgba(255, 59, 59, 0.5); color: #ffb4b4; }
.btn.small { font-size: 0.75rem; padding: 9px 14px; min-height: 40px; }

.best-panel {
  display: flex; gap: clamp(14px, 4vw, 40px); padding: 14px 24px;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--panel);
}
.best-panel div { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.best-panel span { font-size: 0.7rem; letter-spacing: 0.2em; color: var(--text-faint); text-transform: uppercase; }
.best-panel b { font-family: var(--font-display); font-size: 1.1rem; color: var(--cyan); }

.toggles { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.toggles button { background: none; border: 1px solid var(--line); border-radius: 999px; color: var(--text-dim); padding: 8px 16px; font-size: 0.85rem; }
.toggles button:hover { border-color: var(--line-strong); color: var(--text); }

.scrap-chip { color: var(--gold); font-weight: 700; font-size: 1.05rem; }
.scrap-chip::before { content: '▲ '; }

/* ================= draft overlay ================= */
.overlay {
  position: fixed; inset: 0; z-index: 30;
  background: rgba(3, 5, 10, 0.78); backdrop-filter: blur(4px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 20px; padding: 20px;
}
.overlay h2 { font-family: var(--font-display); letter-spacing: 0.24em; font-size: clamp(1rem, 3vw, 1.5rem); color: var(--cyan); text-shadow: 0 0 16px rgba(89, 214, 255, 0.6); }

#draftCards { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.draft-card {
  position: relative;
  width: min(220px, 86vw); min-height: 170px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 18px 14px;
  background: var(--panel-2); border: 1px solid var(--line-strong); border-radius: var(--r);
  color: var(--text);
  transition: transform 0.15s, box-shadow 0.15s;
}
.draft-card:hover { transform: translateY(-4px); box-shadow: 0 0 28px rgba(89, 214, 255, 0.4); border-color: var(--cyan); }
.dc-key { position: absolute; top: 8px; left: 10px; font-size: 0.7rem; color: var(--text-faint); border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; }
.dc-icon { font-size: 1.9rem; color: var(--cyan); text-shadow: 0 0 14px var(--cyan); }
.dc-tag { font-size: 0.65rem; letter-spacing: 0.22em; color: var(--gold); }
.dc-name { font-family: var(--font-display); font-size: 0.9rem; letter-spacing: 0.06em; }
.dc-desc { font-size: 0.85rem; color: var(--text-dim); text-align: center; line-height: 1.35; }

/* ================= death ================= */
#deathTitle { color: var(--red); text-shadow: 0 0 20px rgba(255, 59, 59, 0.7); }
.death-stats { display: flex; gap: clamp(16px, 5vw, 48px); }
.death-stats div { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.death-stats span { font-size: 0.68rem; letter-spacing: 0.2em; color: var(--text-faint); text-transform: uppercase; }
.death-stats b { font-family: var(--font-display); font-size: clamp(1.1rem, 4vw, 1.7rem); }
.death-stats .gold { color: var(--gold); }
#dBest { color: var(--text-faint); font-size: 0.85rem; letter-spacing: 0.08em; }
.death-btns { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

/* ================= armory ================= */
.arm-head-row { display: flex; align-items: center; justify-content: space-between; width: min(760px, 92vw); }
.arm-head-row h2 { font-family: var(--font-display); letter-spacing: 0.2em; color: var(--cyan); }
#armGrid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px; width: min(760px, 92vw); max-height: 55vh; overflow-y: auto; padding: 4px;
}
.arm-card { display: flex; flex-direction: column; gap: 8px; padding: 14px; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r); }
.arm-card.maxed { border-color: rgba(255, 209, 102, 0.5); }
.arm-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.arm-name { font-family: var(--font-display); font-size: 0.78rem; letter-spacing: 0.05em; }
.arm-pips { display: flex; gap: 3px; }
.arm-pips i { width: 8px; height: 8px; border-radius: 2px; background: rgba(255, 255, 255, 0.1); }
.arm-pips i.on { background: var(--cyan); box-shadow: 0 0 6px var(--cyan); }
.arm-desc { font-size: 0.85rem; color: var(--text-dim); }
.arm-buy {
  min-height: 40px; border-radius: 6px; border: 1px solid var(--line-strong);
  background: rgba(89, 214, 255, 0.08); color: var(--gold); font-weight: 700; font-size: 0.95rem;
}
.arm-buy:hover:not(:disabled) { box-shadow: 0 0 14px rgba(89, 214, 255, 0.3); }
.arm-buy:disabled { opacity: 0.4; cursor: not-allowed; }
.arm-foot { display: flex; gap: 12px; }

/* ================= howto modal ================= */
#howto { z-index: 40; }
.how-card {
  width: min(430px, 92vw); padding: 26px;
  background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--r);
  display: flex; flex-direction: column; gap: 12px;
}
.how-card h3 { font-family: var(--font-display); letter-spacing: 0.18em; color: var(--cyan); }
.how-card p { color: var(--text-dim); font-size: 0.95rem; line-height: 1.5; }
.how-card b { color: var(--text); }

@media (max-width: 600px) {
  .best-panel { padding: 10px 14px; }
  #draftCards { flex-direction: column; align-items: center; }
  .draft-card { min-height: 0; width: min(300px, 90vw); }
}

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