/* REAPER — BLACKSITE · gothic noir ledger styling */
@font-face {
  font-family: 'Bebas Neue';
  src: url('../vendor/bebas-neue.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}

:root {
  --void: #050608;
  --ash: #9aa0a8;
  --ash-dim: #5a6068;
  --blood: #8e1f1f;
  --blood-hot: #c93030;
  --bone: #e8e4da;
  --ledger-font: 'Bebas Neue', 'Arial Narrow', 'Impact', sans-serif;
  --body-font: Georgia, 'Times New Roman', serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; background: var(--void); }
body { font-family: var(--body-font); color: var(--ash); -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent; touch-action: none; }

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

.hidden { display: none !important; }

/* ---------- overlays ---------- */
.overlay { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 120%, rgba(142,31,31,0.12), transparent 55%),
              radial-gradient(ellipse at 50% -20%, rgba(30,32,38,0.7), transparent 60%),
              var(--void); }

.title-fog { position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background:
    radial-gradient(ellipse 60% 30% at 20% 80%, rgba(120,125,135,.07), transparent 70%),
    radial-gradient(ellipse 70% 25% at 80% 70%, rgba(120,125,135,.05), transparent 70%);
  animation: fogdrift 17s ease-in-out infinite alternate; }
@keyframes fogdrift { from { transform: translateX(-3%) } to { transform: translateX(3%) } }

.title-inner, .end-inner { text-align: center; z-index: 1; padding: 24px; max-width: 760px; }

.title-eyebrow { font-family: var(--ledger-font); letter-spacing: .5em; font-size: 12px;
  color: var(--ash-dim); margin-bottom: 18px; text-indent: .5em; }

.title-word { font-family: var(--ledger-font); font-weight: 400; color: var(--bone);
  font-size: clamp(64px, 14vw, 150px); letter-spacing: .12em; line-height: .9;
  text-shadow: 0 0 30px rgba(232,228,218,.14), 0 0 90px rgba(142,31,31,.25); }

.title-sub { font-family: var(--ledger-font); color: var(--blood-hot); letter-spacing: .55em;
  font-size: clamp(13px, 2.4vw, 20px); margin: 14px 0 22px; text-indent: .55em; }
.flicker { animation: flicker 7s linear infinite; }
@keyframes flicker {
  0%, 100% { opacity: 1 } 92% { opacity: 1 } 93% { opacity: .25 } 94% { opacity: 1 }
  96% { opacity: .4 } 96.5% { opacity: 1 } }

.title-flavor { font-size: 14px; font-style: italic; color: var(--ash-dim); line-height: 1.7; margin-bottom: 34px; }

.btn-ledger { font-family: var(--ledger-font); font-size: 22px; letter-spacing: .35em; text-indent: .35em;
  color: var(--bone); background: transparent; border: 1px solid rgba(232,228,218,.28);
  padding: 14px 42px; cursor: pointer; transition: all .25s; }
.btn-ledger:hover, .btn-ledger:focus-visible { background: rgba(142,31,31,.22); border-color: var(--blood-hot);
  color: #fff; box-shadow: 0 0 24px rgba(201,48,48,.25); outline: none; }

.title-controls { margin-top: 38px; display: flex; flex-direction: column; gap: 7px;
  font-family: var(--ledger-font); font-size: 13px; letter-spacing: .18em; color: var(--ash-dim); }
.title-controls b { color: var(--ash); font-weight: 400; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; z-index: 20; pointer-events: none; }
.hud-label { font-family: var(--ledger-font); font-size: 11px; letter-spacing: .3em; color: var(--ash-dim); }

#crosshair { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); }
.ch-dot { position: absolute; left: -2px; top: -2px; width: 4px; height: 4px; border-radius: 50%;
  background: var(--bone); box-shadow: 0 0 6px rgba(232,228,218,.8); }
.ch-ring { position: absolute; left: -13px; top: -13px; width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid rgba(232,228,218,.35); transition: transform .12s ease-out, border-color .12s; }
#crosshair.hot .ch-ring { border-color: var(--blood-hot); }

#hitmarker { position: absolute; left: 50%; top: 50%; width: 22px; height: 22px;
  transform: translate(-50%,-50%) rotate(45deg); opacity: 0; }
#hitmarker::before, #hitmarker::after { content: ''; position: absolute; background: var(--bone); }
#hitmarker::before { left: 10px; top: 0; width: 2px; height: 22px; }
#hitmarker::after { left: 0; top: 10px; width: 22px; height: 2px; }
#hitmarker.show { animation: hitpop .18s ease-out; }
#hitmarker.kill::before, #hitmarker.kill::after { background: var(--blood-hot); }
@keyframes hitpop { 0% { opacity: 1; transform: translate(-50%,-50%) rotate(45deg) scale(1.5) }
  100% { opacity: 0; transform: translate(-50%,-50%) rotate(45deg) scale(.8) } }

#hud-bl { position: absolute; left: 28px; bottom: 26px; }
#health-wrap { display: flex; align-items: center; gap: 12px; }
#health-bar { width: 220px; height: 10px; background: rgba(232,228,218,.08);
  border: 1px solid rgba(232,228,218,.2); position: relative; }
#health-fill { position: absolute; inset: 1px; transform-origin: left; background: var(--bone);
  box-shadow: 0 0 10px rgba(232,228,218,.35); }
#health-fill.low { background: var(--blood-hot); box-shadow: 0 0 12px rgba(201,48,48,.6); }
#health-ghost { position: absolute; inset: 1px; transform-origin: left; background: rgba(201,48,48,.5); z-index: -1; }
#health-num { font-family: var(--ledger-font); font-size: 26px; color: var(--bone); min-width: 52px; }
#shells { display: flex; gap: 5px; margin-top: 10px; }
.shell-pip { width: 7px; height: 18px; background: var(--bone); opacity: .9;
  clip-path: polygon(0 20%, 50% 0, 100% 20%, 100% 100%, 0 100%); transition: opacity .1s, transform .1s; }
.shell-pip.spent { opacity: .12; transform: translateY(3px); }

#hud-br { position: absolute; right: 28px; bottom: 26px; display: flex; gap: 12px; }
.ability { position: relative; width: 64px; height: 64px; border: 1px solid rgba(232,228,218,.22);
  background: rgba(5,6,8,.55); text-align: center; overflow: hidden; }
.ab-key { font-family: var(--ledger-font); font-size: 15px; color: var(--bone); padding-top: 7px; }
.ab-name { font-family: var(--ledger-font); font-size: 9px; letter-spacing: .12em; color: var(--ash-dim); line-height: 1.25; margin-top: 3px; }
.ab-cd { position: absolute; left: 0; bottom: 0; width: 100%; background: rgba(142,31,31,.55); height: 0%; }
.ability.ready { border-color: rgba(232,228,218,.5); box-shadow: 0 0 12px rgba(232,228,218,.12); }
.ability.ult-ready { border-color: var(--blood-hot); box-shadow: 0 0 16px rgba(201,48,48,.5); animation: ultpulse 1.2s ease-in-out infinite; }
@keyframes ultpulse { 50% { box-shadow: 0 0 26px rgba(201,48,48,.8) } }
#ult-charge { position: absolute; left: 0; bottom: 0; width: 100%; height: 0%; background: rgba(142,31,31,.4); }

#hud-tr { position: absolute; right: 28px; top: 24px; text-align: right; }
#score { font-family: var(--ledger-font); font-size: 34px; color: var(--bone); line-height: 1; }
#wave-wrap { margin-top: 12px; }
#wave { font-family: var(--ledger-font); font-size: 20px; color: var(--ash); }

#ledger { position: absolute; left: 28px; top: 24px; width: 330px; font-family: var(--ledger-font);
  font-size: 14px; letter-spacing: .08em; }
.ledger-entry { color: var(--ash); padding: 3px 0 3px 10px; border-left: 2px solid rgba(142,31,31,.7);
  margin-bottom: 5px; background: linear-gradient(90deg, rgba(5,6,8,.6), transparent);
  animation: ledgerin .35s ease-out; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ledger-entry .bonus { color: var(--blood-hot); }
.ledger-entry .pts { color: var(--bone); float: right; padding-left: 12px; }
.ledger-entry.death { color: var(--blood-hot); border-left-color: var(--blood-hot); }
.ledger-entry.old { opacity: .35; }
@keyframes ledgerin { from { transform: translateX(-14px); opacity: 0 } }

#wave-banner { position: absolute; left: 50%; top: 22%; transform: translateX(-50%);
  font-family: var(--ledger-font); font-size: clamp(28px, 5vw, 44px); letter-spacing: .4em; text-indent: .4em;
  color: var(--bone); text-shadow: 0 0 24px rgba(201,48,48,.5); text-align: center; }

#blossom-text { position: absolute; left: 50%; top: 34%; transform: translateX(-50%);
  font-family: var(--ledger-font); font-size: clamp(40px, 9vw, 90px); letter-spacing: .2em;
  color: var(--blood-hot); text-shadow: 0 0 40px rgba(201,48,48,.8); animation: blossomslam .3s ease-out; }
@keyframes blossomslam { from { transform: translateX(-50%) scale(1.6); opacity: 0 } }

#step-channel { position: absolute; left: 50%; bottom: 18%; transform: translateX(-50%); text-align: center; }
.channel-label { font-family: var(--ledger-font); letter-spacing: .4em; font-size: 13px; color: var(--blood-hot); margin-bottom: 6px; }
.channel-bar { width: 180px; height: 5px; border: 1px solid rgba(201,48,48,.5); }
#channel-fill { height: 100%; width: 0%; background: var(--blood-hot); box-shadow: 0 0 10px rgba(201,48,48,.8); }

#damage-vignette { position: absolute; inset: 0; opacity: 0; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(142,31,31,.55) 100%); }
#lowhp-pulse { position: absolute; inset: 0; opacity: 0; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(142,31,31,.4) 100%); }
#lowhp-pulse.on { animation: heartbeat 1.1s ease-in-out infinite; }
@keyframes heartbeat { 0%, 100% { opacity: 0 } 12% { opacity: .8 } 24% { opacity: .25 } 36% { opacity: .7 } 60% { opacity: 0 } }

#mute-note { position: absolute; left: 50%; bottom: 8%; transform: translateX(-50%);
  font-family: var(--ledger-font); letter-spacing: .3em; font-size: 13px; color: var(--ash); }

/* ---------- touch ---------- */
#touch-ui { position: fixed; inset: 0; z-index: 30; pointer-events: none; }
#joystick { position: absolute; left: 6vw; bottom: 12vh; width: 130px; height: 130px; border-radius: 50%;
  border: 1px solid rgba(232,228,218,.25); background: rgba(232,228,218,.05); pointer-events: auto; }
#joystick-knob { position: absolute; left: 45px; top: 45px; width: 40px; height: 40px; border-radius: 50%;
  background: rgba(232,228,218,.35); }
#touch-buttons { position: absolute; right: 4vw; bottom: 10vh; display: grid;
  grid-template-columns: repeat(2, 72px); gap: 12px; pointer-events: auto; }
.tbtn { width: 72px; height: 72px; border-radius: 50%; border: 1px solid rgba(232,228,218,.3);
  background: rgba(5,6,8,.5); color: var(--bone); font-family: var(--ledger-font); font-size: 16px;
  display: flex; align-items: center; justify-content: center; letter-spacing: .1em; }
.tbtn.big { grid-column: span 2; width: 156px; border-radius: 40px; background: rgba(142,31,31,.3);
  border-color: rgba(201,48,48,.5); font-size: 20px; }
.tbtn:active { background: rgba(201,48,48,.5); }

/* ---------- end screen ---------- */
.end-word { font-family: var(--ledger-font); font-weight: 400; color: var(--bone);
  font-size: clamp(40px, 8vw, 90px); letter-spacing: .1em; line-height: 1;
  text-shadow: 0 0 40px rgba(142,31,31,.4); margin-bottom: 18px; }
.end-word.won { color: var(--bone); text-shadow: 0 0 40px rgba(232,228,218,.3); }
.end-quip { font-style: italic; color: var(--ash-dim); font-size: 16px; line-height: 1.7; margin-bottom: 30px; }
.end-ledger { font-family: var(--ledger-font); font-size: 17px; letter-spacing: .12em; color: var(--ash);
  margin-bottom: 36px; display: inline-block; text-align: left; }
.end-ledger .row { display: flex; justify-content: space-between; gap: 48px; padding: 3px 0;
  border-bottom: 1px solid rgba(232,228,218,.08); }
.end-ledger .row.total { color: var(--bone); border-bottom: 2px solid var(--blood); font-size: 22px; }
#btn-restart { display: block; margin: 0 auto; }

#rotate-note { display: none; }

@media (max-width: 700px) {
  #hud-bl { left: 12px; bottom: 12px; }
  #health-bar { width: 92px; }
  #health-wrap { gap: 8px; }
  #health-num { font-size: 20px; min-width: 40px; }
  .shell-pip { width: 6px; height: 15px; }
  #hud-br { right: 12px; bottom: 12px; gap: 7px; }
  .ability { width: 46px; height: 46px; }
  .ab-key { font-size: 11px; padding-top: 4px; }
  .ab-name { font-size: 7px; }
  #ledger { width: 210px; font-size: 11px; left: 12px; top: 12px; }
  #hud-tr { right: 12px; top: 12px; }
  #score { font-size: 24px; }
  .title-controls { font-size: 11px; }
  #joystick { width: 110px; height: 110px; left: 5vw; bottom: 16vh; }
  #joystick-knob { left: 38px; top: 38px; width: 34px; height: 34px; }
}
