/* ASHFALL — cold, desaturated, tired. */
:root {
  --ink: #0b0e12;
  --paper: #cfd6dd;
  --dim: #8a97a5;
  --faint: #55616e;
  --hp: #b7c3cf;
  --st: #7fa3ad;
  --sp: #9fb4d8;
  --blood: #6d1216;
  --line: rgba(207, 214, 221, 0.22);
  --pillbg: rgba(10, 13, 17, 0.72);
  --mono: "SF Mono", "Cascadia Code", Consolas, "Liberation Mono", Menlo, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--ink);
  font-family: var(--mono);
  color: var(--paper);
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
}

#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

.hidden { display: none !important; }

/* ================= SCREENS (title / pause / verdict) ================= */
.screen {
  position: fixed; inset: 0; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(120% 90% at 50% 110%, rgba(38, 48, 60, 0.55), transparent 60%),
    linear-gradient(180deg, #10151b 0%, #0b0e12 70%, #080a0d 100%);
}
.title-inner { text-align: center; padding: 24px; max-width: 720px; animation: riseIn 1.1s ease both; }
@keyframes riseIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

#titleKicker, #verdictKicker {
  font-size: 11px; letter-spacing: 0.34em; color: var(--faint); margin-bottom: 18px;
}
#titleLine {
  font-size: clamp(56px, 11vw, 118px);
  letter-spacing: 0.28em; margin-right: -0.28em;
  font-weight: 700; color: var(--paper);
  text-shadow: 0 0 34px rgba(159, 180, 216, 0.14);
}
#titleSub { margin-top: 14px; color: var(--dim); font-size: 13px; line-height: 1.75; }
#titleFoot { margin-top: 26px; color: var(--faint); font-size: 10px; letter-spacing: 0.18em; }

button {
  margin-top: 30px;
  font-family: var(--mono); font-size: 14px; letter-spacing: 0.32em; text-indent: 0.32em;
  color: var(--paper); background: transparent;
  border: 1px solid var(--line); border-radius: 2px;
  padding: 14px 42px; cursor: pointer;
  transition: border-color .25s, color .25s, background .25s, box-shadow .25s;
}
button:hover, button:focus-visible {
  border-color: rgba(207, 214, 221, 0.65);
  background: rgba(159, 180, 216, 0.07);
  box-shadow: 0 0 24px rgba(159, 180, 216, 0.10);
  outline: none;
}

.controls-grid {
  margin-top: 34px;
  display: grid; grid-template-columns: auto auto; gap: 7px 18px;
  justify-content: center; align-items: baseline;
  font-size: 11px; color: var(--dim);
}
.controls-grid .k { text-align: right; color: var(--paper); letter-spacing: 0.14em; font-size: 11px; }

.pause-h { font-size: 34px; letter-spacing: 0.3em; margin-right: -0.3em; }
.pause-p { margin-top: 12px; color: var(--dim); font-size: 12px; }

#verdictTitle { font-size: clamp(44px, 9vw, 92px); letter-spacing: 0.24em; margin-right: -0.24em; font-weight: 700; }
#verdictTitle.win { color: #dfe6ec; text-shadow: 0 0 40px rgba(207, 214, 221, 0.22); }
#verdictTitle.loss { color: #8a2f33; text-shadow: 0 0 46px rgba(109, 18, 22, 0.45); }
#verdictSub { margin-top: 14px; color: var(--dim); font-size: 13px; line-height: 1.7; white-space: pre-line; }
#verdictStats {
  margin-top: 22px; display: inline-block; text-align: left;
  font-size: 12px; line-height: 2; color: var(--dim);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  padding: 10px 26px;
}
#verdictStats b { color: var(--paper); font-weight: 600; }
#verdictFoot { margin-top: 24px; color: var(--faint); font-size: 10px; letter-spacing: 0.18em; }

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

#timerPill { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); filter: drop-shadow(0 4px 14px rgba(0,0,0,.5)); }
#timerPill rect { fill: var(--pillbg); stroke: var(--line); stroke-width: 1; }
#timerText { font-family: var(--mono); font-size: 21px; letter-spacing: 0.22em; fill: var(--paper); }
#timerPill.low rect { stroke: rgba(138, 47, 51, 0.85); }
#timerPill.low #timerText { fill: #c96a6e; animation: pulseLow 1s steps(2) infinite; }
@keyframes pulseLow { 50% { opacity: 0.55; } }

/* character panel */
#charPanel {
  position: absolute; top: 16px; left: 16px;
  display: flex; gap: 12px; align-items: flex-start;
  padding: 10px 14px 12px 10px;
  background: var(--pillbg); border: 1px solid var(--line); border-radius: 6px;
  backdrop-filter: blur(3px);
}
#portraitCanvas { width: 76px; height: 76px; border-radius: 4px; border: 1px solid var(--line); background: #131920; }
#charName { font-size: 12px; letter-spacing: 0.2em; margin-bottom: 7px; color: var(--paper); }
.char-tag { color: var(--faint); font-size: 10px; letter-spacing: 0.08em; }
.bar { position: relative; width: 190px; height: 9px; background: rgba(255,255,255,0.05); border: 1px solid rgba(207,214,221,0.14); border-radius: 2px; margin-bottom: 6px; overflow: hidden; }
.bar i { position: absolute; inset: 0; transform-origin: left center; transform: scaleX(var(--v, 1)); transition: transform .18s ease-out; display: block; }
.bar.hp i { background: linear-gradient(90deg, #93a2b1, var(--hp)); }
.bar.st i { background: linear-gradient(90deg, #5d818b, var(--st)); height: 100%; }
.bar.sp i { background: linear-gradient(90deg, #6f83ab, var(--sp)); }
.bar i.hitflash { animation: barFlash .35s ease-out; }
@keyframes barFlash { 0%,100% { filter: brightness(1); } 40% { filter: brightness(2.4); } }
#lockHint { font-size: 9px; color: var(--faint); letter-spacing: 0.16em; margin-top: 2px; }
#lockHint.on { color: var(--sp); }

/* ability slots */
#abilityBar { position: absolute; left: 16px; bottom: 16px; display: flex; gap: 10px; }
.slot {
  position: relative; width: 56px; height: 56px;
  background: var(--pillbg); border: 1px solid var(--line); border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  transition: border-color .2s, box-shadow .2s, filter .2s;
}
.slot svg { width: 30px; height: 30px; stroke: var(--dim); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: stroke .2s; }
.slot b { position: absolute; bottom: 2px; right: 5px; font-size: 9px; color: var(--faint); font-weight: 400; }
.slot u { position: absolute; inset: 0; text-decoration: none; pointer-events: none; }
.slot.ready svg { stroke: var(--paper); }
.slot.ready { border-color: rgba(207, 214, 221, 0.5); }
.slot.cooldown { filter: brightness(0.55) saturate(0.6); }
.slot.cooldown u::before {
  content: attr(data-cd); position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 15px; color: var(--paper);
}
.slot.pop { animation: slotPop .3s ease-out; }
@keyframes slotPop { 0% { transform: scale(1); } 40% { transform: scale(1.12); box-shadow: 0 0 18px rgba(159,180,216,.35); } 100% { transform: scale(1); } }

/* radio typewriter */
#radioBox {
  position: absolute; right: 18px; bottom: 18px; max-width: min(420px, 44vw);
  font-size: 12px; line-height: 1.6; color: var(--dim);
  text-align: right; text-shadow: 0 1px 3px rgba(0,0,0,.8);
  min-height: 40px;
}
#radioCursor { opacity: 0; }
#radioBox.typing #radioCursor { opacity: 1; animation: blinkCaret .8s steps(2) infinite; }
@keyframes blinkCaret { 50% { opacity: 0; } }

/* score */
#scoreBox { position: absolute; top: 18px; right: 18px; text-align: right; }
#scoreKills { font-size: 15px; letter-spacing: 0.22em; color: var(--paper); text-shadow: 0 1px 4px rgba(0,0,0,.7); }
#scoreWave { font-size: 10px; letter-spacing: 0.26em; color: var(--faint); margin-top: 4px; }

/* floating nameplates */
#plateLayer { position: absolute; inset: 0; overflow: hidden; }
.nameplate {
  position: absolute; left: 0; top: 0;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  will-change: transform, opacity;
  transition: opacity .2s;
}
.np-name {
  font-size: 10px; letter-spacing: 0.22em; color: rgba(207, 214, 221, 0.82);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9); white-space: nowrap;
}
.np-bar {
  width: 64px; height: 4px;
  background: rgba(8, 10, 13, 0.75);
  border: 1px solid rgba(207, 214, 221, 0.25);
  border-radius: 1px; overflow: hidden;
}
.np-bar i {
  display: block; height: 100%; transform-origin: left center;
  background: linear-gradient(90deg, #7e5457, #b06266);
  transition: transform .16s ease-out;
}
.nameplate.hurt .np-bar i { filter: brightness(1.9); }

/* reticle + lock marker */
#reticle {
  position: absolute; left: 50%; top: 50%; width: 6px; height: 6px;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(207, 214, 221, 0.5); border-radius: 50%;
}
#lockMarker {
  position: absolute; width: 34px; height: 34px; margin: -17px 0 0 -17px;
  border: 1px solid rgba(159, 180, 216, 0.75); border-radius: 4px;
  transform: rotate(45deg);
  box-shadow: 0 0 12px rgba(159, 180, 216, 0.25), inset 0 0 8px rgba(159, 180, 216, 0.12);
  transition: opacity .15s;
}
#lockMarker::after {
  content: ""; position: absolute; inset: 4px;
  border: 1px solid rgba(159, 180, 216, 0.3); border-radius: 2px;
}

/* vignette + flash */
#vig { position: absolute; inset: 0; opacity: 0; transition: opacity .5s ease-out;
  background: radial-gradient(ellipse at center, transparent 42%, rgba(64, 8, 10, 0.55) 100%); }
#flashWhite { position: absolute; inset: 0; opacity: 0; background: #dfe6ec; }

@media (max-width: 760px) {
  #charPanel { transform: scale(0.82); transform-origin: top left; }
  #abilityBar { transform: scale(0.82); transform-origin: bottom left; }
  #radioBox { max-width: 52vw; font-size: 11px; }
  #timerPill svg { width: 170px; height: 36px; }
}
