/* ============================================================================
   SHARDBREAK — UI
   Neon glass over a dark arena. No web fonts: the whole demo stays offline.
   ========================================================================== */

:root {
  --a: #00e6ff;
  --b: #ff2f7e;
  --c: #ffc247;
  --ok: #54ff9f;
  --ink: #dff6ff;
  --panel: rgba(9, 6, 22, 0.88);
  --line: rgba(120, 240, 255, 0.22);
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: #04030a; color: var(--ink);
  font-family: var(--mono);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; }

.hidden { display: none !important; }

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

#damageVig {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0) 45%, rgba(0,0,0,0.55) 100%);
}

#lowhp {
  position: absolute; inset: 0; opacity: 0;
  background: radial-gradient(ellipse at center, rgba(255,0,60,0) 42%, rgba(255,0,60,0.42) 100%);
  transition: opacity 0.35s ease;
}
#lowhp.on { animation: lowPulse 1.9s ease-in-out infinite; }
@keyframes lowPulse {
  0%, 100% { opacity: 0.20; }
  50% { opacity: 0.62; }
}

/* ---------- crosshair ---------- */
#crosshair {
  --spread: 9px;
  position: absolute; left: 50%; top: 50%; width: 0; height: 0;
}
#crosshair i {
  position: absolute; background: #eafcff; opacity: 0.92;
  box-shadow: 0 0 6px rgba(120, 240, 255, 0.9);
}
#crosshair .dot { width: 2px; height: 2px; margin: -1px 0 0 -1px; border-radius: 50%; }
#crosshair .t { width: 2px; height: 7px; left: -1px; top: calc(-1 * (var(--spread) + 7px)); }
#crosshair .b { width: 2px; height: 7px; left: -1px; top: var(--spread); }
#crosshair .l { height: 2px; width: 7px; top: -1px; left: calc(-1 * (var(--spread) + 7px)); }
#crosshair .r { height: 2px; width: 7px; top: -1px; left: var(--spread); }
#crosshair i { transition: all 0.05s linear; }

.hm {
  position: absolute; left: 0; top: 0; width: 0; height: 0; opacity: 0;
  transform: scale(0.6) rotate(45deg);
}
.hm.show { opacity: 1; transform: scale(1) rotate(45deg); animation: hmPop 0.12s ease-out; }
.hm::before, .hm::after {
  content: ""; position: absolute; background: #fff;
  box-shadow: 0 0 8px rgba(255,255,255,0.9);
}
.hm::before { width: 2px; height: 12px; left: -1px; top: -6px; }
.hm::after { width: 12px; height: 2px; left: -6px; top: -1px; }
.hm.norm::before, .hm.norm::after { background: #eafcff; }
.hm.crit::before, .hm.crit::after {
  background: var(--c); box-shadow: 0 0 12px var(--c); width: 3px;
}
.hm.crit::after { height: 3px; }
@keyframes hmPop { from { transform: scale(1.7) rotate(45deg); } to { transform: scale(1) rotate(45deg); } }

/* ---------- hud boxes ---------- */
.hudbox {
  position: absolute; padding: 10px 14px;
  background: linear-gradient(180deg, rgba(10, 8, 26, 0.62), rgba(6, 4, 16, 0.42));
  border: 1px solid var(--line);
  border-radius: 3px;
  letter-spacing: 0.10em; font-size: 13px;
  text-shadow: 0 0 10px rgba(0, 230, 255, 0.35);
  min-width: 150px;
}
.hudbox.right { text-align: right; }
.hudbox .sub { font-size: 10px; opacity: 0.62; letter-spacing: 0.22em; margin-top: 3px; }
.hudbox .sub b { color: var(--b); font-size: 13px; letter-spacing: 0.05em; }
#topleft { left: 22px; top: 20px; }
#topright { right: 22px; top: 20px; }
#bottomleft { left: 22px; bottom: 22px; }
#bottomright { right: 22px; bottom: 22px; }

#scoreVal { font-size: 24px; font-weight: 700; color: #fff; text-shadow: 0 0 14px rgba(0, 230, 255, 0.7); }
#comboVal {
  font-size: 16px; font-weight: 700; color: var(--b); margin-top: 4px; height: 18px;
  opacity: 0; transition: opacity 0.16s ease;
  text-shadow: 0 0 16px var(--b);
}
#comboVal.on { opacity: 1; }

#topleft #waveName { font-size: 14px; color: var(--a); letter-spacing: 0.16em; }

.rowline { display: flex; justify-content: space-between; align-items: baseline; }
.rowline .tag { font-size: 10px; letter-spacing: 0.24em; opacity: 0.65; }
#hpNum { font-size: 20px; font-weight: 700; }

#hpBar {
  width: 210px; height: 9px; margin-top: 6px;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 2px; overflow: hidden;
}
#hpFill {
  height: 100%; width: 100%;
  transform-origin: left center; transform: scaleX(1);
  background: linear-gradient(90deg, #2affc0, #00e6ff 60%, #7f8cff);
  box-shadow: 0 0 14px rgba(0, 230, 255, 0.6);
  transition: transform 0.18s ease, background 0.3s ease;
}
#hpBar.flash { animation: hpFlash 0.28s ease-out; }
@keyframes hpFlash {
  0% { box-shadow: 0 0 0 3px rgba(255, 47, 126, 0.9); border-color: #ff2f7e; }
  100% { box-shadow: none; }
}

#wpnName { font-size: 12px; letter-spacing: 0.24em; color: var(--a); }
#wpnName.pulse { animation: namePulse 0.3s ease-out; }
@keyframes namePulse { from { color: #fff; text-shadow: 0 0 18px #fff; } }
.ammoline { margin: 2px 0 4px; }
#ammoMag { font-size: 30px; font-weight: 700; }
#ammoMag.low { color: var(--b); text-shadow: 0 0 16px var(--b); animation: lowBlink 0.7s steps(2) infinite; }
@keyframes lowBlink { 50% { opacity: 0.45; } }
.ammoline .sep { opacity: 0.35; margin: 0 4px; }
#ammoRes { font-size: 15px; opacity: 0.6; }

#slots { display: flex; gap: 6px; justify-content: flex-end; margin-top: 2px; }
#slots .slot {
  font-size: 9px; letter-spacing: 0.14em; padding: 3px 6px;
  border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 2px; opacity: 0.45;
}
#slots .slot.on {
  opacity: 1; border-color: var(--a); color: var(--a);
  box-shadow: 0 0 12px rgba(0, 230, 255, 0.35), inset 0 0 10px rgba(0, 230, 255, 0.12);
}

/* ---------- damage / score popups ---------- */
#popups { position: absolute; inset: 0; overflow: hidden; }
.pop {
  position: absolute; transform: translate(-50%, -50%);
  font-size: 15px; font-weight: 700; color: #fff;
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.9), 0 0 18px rgba(0, 230, 255, 0.7);
  animation: popUp 0.92s ease-out forwards;
  will-change: transform, opacity;
}
.pop.crit { color: var(--c); font-size: 20px; text-shadow: 0 0 12px #000, 0 0 22px var(--c); }
.pop.dmg { color: #ff5f7a; font-size: 19px; text-shadow: 0 0 12px #000, 0 0 22px #ff2f4e; }
.pop.heal { color: var(--ok); text-shadow: 0 0 12px #000, 0 0 22px var(--ok); }
.pop.ammo { color: #6fd0ff; }
.pop.combo { color: var(--b); font-size: 18px; text-shadow: 0 0 12px #000, 0 0 24px var(--b); }
@keyframes popUp {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.7); }
  18% { opacity: 1; transform: translate(-50%, -62%) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, -145%) scale(0.95); }
}

/* ---------- banner ---------- */
#banner {
  position: absolute; left: 0; right: 0; top: 21%;
  text-align: center; opacity: 0; transition: opacity 0.35s ease;
}
#banner.show { opacity: 1; }
#bannerTitle {
  font-size: 40px; font-weight: 800; letter-spacing: 0.16em; color: #fff;
  text-shadow: 0 0 26px rgba(0, 230, 255, 0.75), 0 0 60px rgba(255, 47, 126, 0.5);
}
#bannerSub { font-size: 12px; letter-spacing: 0.34em; opacity: 0.72; margin-top: 8px; color: var(--a); }
#banner.glitch #bannerTitle { animation: glitchIn 0.5s cubic-bezier(0.2, 0.9, 0.2, 1); }
@keyframes glitchIn {
  0% { transform: translateX(-14px) skewX(14deg); filter: blur(3px); opacity: 0; }
  35% { transform: translateX(7px) skewX(-8deg); filter: blur(1px); }
  60% { transform: translateX(-3px) skewX(3deg); }
  100% { transform: none; filter: none; }
}

/* ---------- toast + debug ---------- */
#toast {
  position: absolute; left: 50%; top: 8%; transform: translateX(-50%);
  padding: 7px 16px; font-size: 11px; letter-spacing: 0.24em;
  border: 1px solid var(--line); background: rgba(6, 4, 16, 0.7);
  border-radius: 2px; opacity: 0; transition: opacity 0.25s ease; color: var(--a);
}
#toast.show { opacity: 1; }
#dbg {
  position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%);
  font-size: 10px; opacity: 0.32; letter-spacing: 0.18em;
}

/* ==========================================================================
   SCREENS
   ========================================================================== */
.screen {
  position: fixed; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 40%, rgba(20, 8, 44, 0.72), rgba(2, 2, 8, 0.93));
  backdrop-filter: blur(7px);
}

.panel {
  position: relative;
  padding: 28px 34px 24px;
  background: linear-gradient(180deg, rgba(12, 8, 28, 0.92), rgba(5, 3, 14, 0.95));
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: 0 0 90px rgba(0, 230, 255, 0.14), inset 0 0 60px rgba(255, 47, 126, 0.05);
  text-align: center;
  max-width: 92vw; max-height: 94vh; overflow: auto;
}
.panel.wide { width: 940px; }
.panel::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--a), var(--b), transparent);
  opacity: 0.85;
}

h1 {
  margin: 0 0 6px; font-size: 44px; letter-spacing: 0.20em; font-weight: 800;
  text-shadow: 0 0 30px rgba(0, 230, 255, 0.55), 0 0 70px rgba(255, 47, 126, 0.30);
}
h1 span { color: var(--b); text-shadow: 0 0 30px rgba(255, 47, 126, 0.85); }
h2 {
  font-size: 11px; letter-spacing: 0.30em; color: var(--a); opacity: 0.85;
  margin: 18px 0 8px; text-align: left; font-weight: 600;
}
h2:first-child { margin-top: 0; }
.sub { margin: 0 0 18px; font-size: 12px; letter-spacing: 0.20em; opacity: 0.6; }

.cols { display: flex; gap: 30px; text-align: left; }
.col { flex: 1; min-width: 0; }
.brief { font-size: 12px; line-height: 1.75; opacity: 0.78; margin: 0; letter-spacing: 0.02em; }
.brief b { color: var(--c); }

.keys { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.keys td { padding: 4px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.keys td:first-child { color: var(--a); letter-spacing: 0.10em; width: 46%; }

.row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.row.center { justify-content: center; margin-top: 14px; }

.chip {
  pointer-events: auto; cursor: pointer;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.18em;
  padding: 8px 12px; color: var(--ink);
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 2px; transition: all 0.14s ease;
  user-select: none;
}
.chip:hover { border-color: var(--a); color: #fff; background: rgba(0, 230, 255, 0.10); }
.chip.on {
  border-color: var(--a); color: #04121a; background: var(--a); font-weight: 700;
  box-shadow: 0 0 18px rgba(0, 230, 255, 0.45);
}

.btn {
  pointer-events: auto; cursor: pointer;
  font-family: var(--mono); font-size: 15px; font-weight: 700; letter-spacing: 0.30em;
  padding: 14px 46px; margin-top: 8px; color: #04121a;
  background: linear-gradient(180deg, #9df6ff, var(--a));
  border: none; border-radius: 3px;
  box-shadow: 0 0 30px rgba(0, 230, 255, 0.45);
  transition: transform 0.12s ease, box-shadow 0.18s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 0 46px rgba(0, 230, 255, 0.75); }
.btn:active { transform: translateY(1px); }
.btn.ghost {
  background: transparent; color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.2); box-shadow: none; font-size: 11px;
  padding: 10px 20px;
}
.btn.small { font-size: 10px; padding: 7px 14px; letter-spacing: 0.2em; }

.slider {
  display: block; font-size: 10px; letter-spacing: 0.22em; opacity: 0.85;
  margin-bottom: 12px; text-align: left;
}
.slider span { color: var(--a); float: right; }
.slider input {
  -webkit-appearance: none; appearance: none; width: 100%; height: 3px; margin-top: 9px;
  background: rgba(255, 255, 255, 0.18); outline: none; border-radius: 2px;
}
.slider input::-webkit-slider-thumb {
  -webkit-appearance: none; width: 13px; height: 13px; border-radius: 50%;
  background: var(--a); box-shadow: 0 0 12px var(--a); cursor: pointer;
}
.slider input::-moz-range-thumb {
  width: 13px; height: 13px; border: none; border-radius: 50%;
  background: var(--a); box-shadow: 0 0 12px var(--a); cursor: pointer;
}

.stats { display: flex; gap: 26px; justify-content: center; margin: 20px 0 6px; }
.stats .stat { display: flex; flex-direction: column; gap: 5px; }
.stats .stat b { font-size: 26px; color: #fff; text-shadow: 0 0 18px rgba(0, 230, 255, 0.6); }
.stats .stat span { font-size: 9px; letter-spacing: 0.24em; opacity: 0.55; }

.tiny { font-size: 10px; letter-spacing: 0.18em; opacity: 0.42; margin: 16px 0 0; }
.tiny span { color: var(--a); }

.err {
  margin-top: 14px; padding: 10px 14px; text-align: left;
  font-size: 11px; color: #ffd0d8; background: rgba(255, 47, 126, 0.14);
  border: 1px solid rgba(255, 47, 126, 0.5); border-radius: 2px;
  white-space: pre-wrap;
}
