:root {
  --charcoal: #0b0c0f;
  --panel: #14161a;
  --panel-2: #1b1e24;
  --bone: #b8b2a4;
  --bone-dim: rgba(184, 178, 164, 0.62);
  --bone-faint: rgba(184, 178, 164, 0.28);
  --gold: #c8a03c;
  --gold-bright: #e0bb66;
  --gold-dim: rgba(200, 160, 60, 0.38);
  --violet: #8a6fb0;
  --violet-bright: #b091d8;
  --violet-dim: rgba(138, 111, 176, 0.4);
  --health: #8ea05a;
  --red: #b54a40;
  --1vmin: 1vmin;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #07080a;
  color: var(--bone);
  font-family: 'Barlow', 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
}

body { touch-action: none; user-select: none; -webkit-user-select: none; }

#app { position: relative; width: 100%; height: 100%; overflow: hidden; }

#scene {
  touch-action: none;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: #1a1420;
  outline: none;
  transition: filter 0.25s linear;
}
#scene.slowmo { filter: saturate(0.55) contrast(1.08) brightness(0.88); }

.hidden { display: none !important; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ------------------------------------------------------------------ grades */
.grade { position: absolute; inset: 0; pointer-events: none; }
.vignette {
  background:
    radial-gradient(120% 95% at 50% 44%, transparent 52%, rgba(4, 4, 7, 0.34) 84%, rgba(4, 4, 7, 0.72) 100%),
    linear-gradient(180deg, rgba(5, 5, 8, 0.42) 0%, transparent 16%, transparent 78%, rgba(5, 5, 8, 0.5) 100%);
  z-index: 2;
}
.grain {
  z-index: 3;
  opacity: 0.09;
  background-image: url('assets/grain.png');
  background-size: 180px 180px;
  mix-blend-mode: overlay;
}
#slowmoWash {
  z-index: 4;
  opacity: 0;
  transition: opacity 0.28s ease;
  background:
    radial-gradient(circle at 50% 48%, transparent 34%, rgba(58, 38, 88, 0.35) 76%, rgba(32, 20, 54, 0.66) 100%),
    linear-gradient(180deg, rgba(70, 48, 106, 0.18), rgba(48, 32, 76, 0.26));
  mix-blend-mode: multiply;
}
#slowmoWash.on { opacity: 1; }
#hurtWash {
  z-index: 5;
  opacity: 0;
  background: radial-gradient(115% 92% at 50% 50%, transparent 42%, rgba(133, 35, 32, 0.5) 100%);
  transition: opacity 0.18s ease-out;
}
#lowHealth {
  z-index: 5;
  opacity: 0;
  background: radial-gradient(circle at 50% 50%, transparent 48%, rgba(150, 36, 34, 0.38) 90%, rgba(117, 24, 25, 0.6) 100%);
  transition: opacity 0.3s linear;
}
#lowHealth.pulse { animation: lowPulse 1.25s ease-in-out infinite; }
@keyframes lowPulse { 0%,100% { filter: brightness(0.85); } 50% { filter: brightness(1.3); } }

/* ------------------------------------------------------------------ loading */
.screen {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: none;
  pointer-events: none;
}
.screen.show { display: flex; pointer-events: auto; }

#loading {
  z-index: 90;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(100% 90% at 50% 62%, #1a1420 0%, #0b0c0f 68%, #07080a 100%);
  transition: opacity 0.5s ease;
}
#loading.fade { opacity: 0; pointer-events: none; }
.load-inner { display: flex; flex-direction: column; align-items: center; gap: 3.2vmin; width: min(70vw, 560px); }
.load-mark { width: min(54vw, 440px); height: auto; opacity: 0.92; filter: drop-shadow(0 6px 20px rgba(0,0,0,.6)); }
.load-line { width: 100%; height: 3px; background: rgba(184, 178, 164, 0.14); overflow: hidden; position: relative; }
.load-line i { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, rgba(200,160,60,.55), var(--gold-bright)); transition: width 0.25s ease; box-shadow: 0 0 10px rgba(200,160,60,.4); }
.load-label { font-size: clamp(10px, 1.35vmin, 13px); letter-spacing: 0.34em; text-transform: uppercase; color: var(--bone-dim); }

/* ------------------------------------------------------------------ wordmark */
.wordmark { display: block; user-select: none; -webkit-user-drag: none; }

/* ------------------------------------------------------------------ title */
#title { z-index: 30; flex-direction: column; background: transparent; }
.title-shade {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(120% 100% at 60% 30%, transparent 35%, rgba(6,6,9,.5) 100%),
    linear-gradient(90deg, rgba(5,6,9,0.68) 0%, rgba(5,6,9,0.22) 34%, transparent 62%),
    linear-gradient(180deg, rgba(4,5,7,0.55) 0%, transparent 24%, transparent 68%, rgba(4,5,7,0.72) 100%);
}
.title-top { position: relative; width: 100%; display: flex; justify-content: center; padding-top: max(3vh, 18px); }
.title-mark {
  width: min(54vw, 680px);
  height: auto;
  filter: drop-shadow(0 10px 34px rgba(0,0,0,.72)) drop-shadow(0 0 28px rgba(200,160,60,.08));
}
.title-menu {
  position: relative;
  margin-top: auto;
  margin-bottom: auto;
  margin-left: max(6vw, 28px);
  display: flex;
  flex-direction: column;
  gap: 1.15vmin;
  width: min(32vw, 340px);
  align-self: flex-start;
}
.menu-item {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 1.2em;
  padding: 1.35vmin 1.6vmin 1.35vmin 1.9vmin;
  background: linear-gradient(90deg, rgba(13, 15, 19, 0.82), rgba(13, 15, 19, 0.18));
  border: 1px solid rgba(184, 178, 164, 0.08);
  border-left: 2px solid rgba(184, 178, 164, 0.16);
  color: var(--bone);
  font-family: 'Barlow', sans-serif;
  font-weight: 600;
  font-size: clamp(15px, 2.15vmin, 24px);
  letter-spacing: 0.19em;
  text-transform: uppercase;
  text-align: left;
  cursor: pointer;
  transition: color .16s ease, border-color .16s ease, background .16s ease, transform .16s ease;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 0 100%);
}
.menu-index {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.58em;
  letter-spacing: .12em;
  color: var(--violet);
  opacity: .75;
}
.menu-item:hover, .menu-item:focus-visible {
  color: var(--gold-bright);
  border-left-color: var(--gold);
  background: linear-gradient(90deg, rgba(31, 27, 20, 0.9), rgba(13, 15, 19, 0.22));
  transform: translateX(3px);
  outline: none;
}
.menu-item:active { transform: translateX(1px) scale(0.995); }
.title-foot {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 max(3vw, 18px) max(2vh, 14px);
  font-size: clamp(8px, 1.05vmin, 11px);
  letter-spacing: 0.24em;
  color: rgba(184, 178, 164, 0.44);
  text-transform: uppercase;
}
.build-tag { font-family: 'JetBrains Mono', monospace; color: rgba(138, 111, 176, 0.6); letter-spacing: 0.16em; }

/* ------------------------------------------------------------------ HUD */
#hud { position: absolute; inset: 0; z-index: 12; pointer-events: none; }
.hud-top { position: absolute; inset: 0 0 auto 0; display: flex; align-items: flex-start; justify-content: space-between; }
#objectivePanel {
  width: min(31vw, 380px);
  margin: max(2.4vh, 13px) 0 0 max(2.2vw, 14px);
  padding: 1.7vmin 1.8vmin 1.6vmin 1.9vmin;
  background: linear-gradient(100deg, rgba(10, 11, 15, 0.82), rgba(10, 11, 15, 0.28) 78%, transparent);
  border-left: 2px solid var(--gold);
  filter: drop-shadow(0 4px 14px rgba(0,0,0,.45));
}
.eyebrow {
  display: flex; align-items: center; gap: 0.7em;
  font-size: clamp(8px, 1.1vmin, 11px);
  letter-spacing: 0.32em;
  color: rgba(184, 178, 164, 0.54);
  text-transform: uppercase;
  margin-bottom: 0.55em;
}
.dia { width: 6px; height: 6px; background: var(--gold); transform: rotate(45deg); box-shadow: 0 0 8px rgba(200,160,60,.5); }
#objectiveTitle {
  font-family: 'Big Shoulders Stencil', 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: clamp(17px, 2.7vmin, 29px);
  line-height: 0.95;
  letter-spacing: 0.055em;
  color: var(--bone);
  text-transform: uppercase;
  text-shadow: 0 2px 10px rgba(0,0,0,.6);
}
.gold-rule { height: 1px; margin: 0.95vmin 0 0.8vmin; background: linear-gradient(90deg, var(--gold), rgba(200,160,60,0.08)); }
.objective-sub { font-size: clamp(8.5px, 1.15vmin, 11.5px); letter-spacing: 0.21em; color: var(--bone-dim); text-transform: uppercase; }
.objective-sub b { font-family: 'JetBrains Mono', monospace; font-weight: 500; color: var(--gold-bright); margin-left: 0.35em; }
.progress { height: 3px; margin-top: 0.8vmin; background: rgba(184,178,164,0.13); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, rgba(200,160,60,.6), var(--gold-bright)); transition: width .35s ease; }

#waypointPanel {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: max(2vh, 11px);
  display: flex;
  align-items: center;
  gap: 0.9vmin;
  padding: 0.7vmin 1.1vmin;
  filter: drop-shadow(0 3px 12px rgba(0,0,0,.55));
}
.wp-diamond {
  width: clamp(22px, 3.2vmin, 34px);
  height: clamp(22px, 3.2vmin, 34px);
  border: 1px solid rgba(200,160,60,0.55);
  transform: rotate(45deg);
  display: flex; align-items: center; justify-content: center;
  background: rgba(10,11,15,0.58);
  box-shadow: inset 0 0 14px rgba(200,160,60,.08);
}
#wpArrow {
  display: block;
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 9px solid var(--gold-bright);
  transform: translateY(-1px);
  filter: drop-shadow(0 0 4px rgba(200,160,60,.5));
}
.wp-copy { display: flex; flex-direction: column; }
.wp-dist { font-family: 'JetBrains Mono', monospace; font-weight: 500; font-size: clamp(17px, 2.5vmin, 27px); line-height: 1; color: var(--bone); letter-spacing: 0.02em; }
.wp-dist small { font-size: .48em; color: var(--bone-dim); margin-left: 0.3em; letter-spacing: .12em; }
.wp-label { font-size: clamp(7px, 0.95vmin, 9.5px); letter-spacing: 0.22em; color: var(--bone-dim); text-transform: uppercase; margin-top: 0.3em; }

.hud-right {
  margin: max(2.2vh, 12px) max(2.2vw, 14px) 0 0;
  display: flex;
  flex-direction: row-reverse;
  align-items: flex-start;
  gap: 1.4vmin;
}
.sys-buttons { display: flex; flex-direction: column; gap: 0.8vmin; pointer-events: auto; }
.sys-btn {
  width: clamp(26px, 3.4vmin, 38px);
  height: clamp(26px, 3.4vmin, 38px);
  display: flex; align-items: center; justify-content: center;
  background: rgba(10, 11, 15, 0.66);
  border: 1px solid rgba(184,178,164,0.16);
  color: rgba(184,178,164,0.72);
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(8px, 1.1vmin, 12px);
  letter-spacing: -0.08em;
  cursor: pointer;
  transition: color .16s, border-color .16s, background .16s;
  clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 0 100%);
}
.sys-btn:hover, .sys-btn:focus-visible { color: var(--gold); border-color: var(--gold-dim); background: rgba(20,18,14,.85); outline: none; }
.stat-panel {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.95vmin;
  padding: 1.1vmin 1.3vmin 1.2vmin 1.6vmin;
  background: linear-gradient(260deg, rgba(10,11,15,0.78), rgba(10,11,15,0.18) 80%, transparent);
}
.ammo-row { display: flex; flex-direction: column; align-items: flex-end; line-height: 1; }
.weapon-name { font-size: clamp(8px, 1.05vmin, 10px); letter-spacing: 0.28em; color: var(--bone-dim); text-transform: uppercase; margin-bottom: 0.5em; }
.ammo-num { font-family: 'JetBrains Mono', monospace; font-weight: 500; font-size: clamp(29px, 5vmin, 54px); color: var(--bone); letter-spacing: -0.04em; text-shadow: 0 2px 14px rgba(0,0,0,.65); }
.ammo-num .slash { color: rgba(184,178,164,0.26); margin: 0 0.1em; font-weight: 100; }
#ammoReserve { font-size: 0.52em; color: rgba(184,178,164,0.62); }
.ammo-num.low { color: #d3a04b; }
.ammo-num.empty { color: var(--red); }
.health-block { width: clamp(130px, 17vmin, 210px); }
.health-label { display: flex; justify-content: space-between; font-size: clamp(7.5px, 0.95vmin, 9.5px); letter-spacing: 0.26em; color: var(--bone-dim); text-transform: uppercase; margin-bottom: 0.42em; }
.health-label span:last-child { font-family: 'JetBrains Mono', monospace; letter-spacing: 0; color: var(--bone); }
.health-bar { height: clamp(7px, 1vmin, 10px); background: rgba(0,0,0,0.42); border: 1px solid rgba(184,178,164,0.12); overflow: hidden; }
.health-bar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #71834a, #9bb164); transition: width .25s ease, background .25s ease; box-shadow: 0 0 10px rgba(142,160,90,.35); }
.health-bar i.low { background: linear-gradient(90deg, #7e3a34, #bf554a); box-shadow: 0 0 10px rgba(191,85,74,.4); }

#reticle {
  position: absolute;
  left: 50%; top: 48%;
  transform: translate(-50%, -50%);
  width: 26px; height: 26px;
  opacity: 0.55;
  transition: opacity .2s, transform .12s;
}
#reticle i { position: absolute; left: 50%; top: 50%; width: 3px; height: 3px; margin: -1.5px; background: var(--bone); border-radius: 50%; box-shadow: 0 0 5px rgba(0,0,0,.8); }
#reticle b { position: absolute; inset: 0; border: 1px solid rgba(184,178,164,0.34); border-radius: 50%; }
#reticle.aim { opacity: 0.95; transform: translate(-50%,-50%) scale(0.72); }
#reticle.fire { transform: translate(-50%, -50%) scale(1.35); }
#reticle.hit b { border-color: var(--gold-bright); box-shadow: 0 0 8px rgba(200,160,60,.7); }
#reticle.hit i { background: var(--gold-bright); box-shadow: 0 0 8px rgba(200,160,60,.9); }
#hud.aiming #reticle { opacity: 0.9; }

#interactPrompt {
  position: absolute; left: 50%; bottom: 25%;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 0.7em;
  padding: 0.8vmin 1.2vmin;
  background: rgba(10,11,15,0.78);
  border: 1px solid rgba(200,160,60,0.32);
  border-left: 2px solid var(--gold);
  font-size: clamp(9px, 1.25vmin, 13px);
  letter-spacing: 0.19em;
  color: var(--bone);
  text-transform: uppercase;
  overflow: hidden;
  filter: drop-shadow(0 4px 16px rgba(0,0,0,.55));
}
.prompt-key { font-family: 'JetBrains Mono', monospace; border: 1px solid rgba(200,160,60,.5); padding: 0.18em 0.44em; color: var(--gold-bright); font-size: .9em; }
.prompt-sub { color: var(--bone-dim); letter-spacing: .12em; }
.prompt-fill { position: absolute; left: 0; bottom: 0; height: 2px; width: 0%; background: var(--gold); transition: width .1s linear; }

#toast {
  position: absolute; left: 50%; top: 20%;
  transform: translateX(-50%);
  padding: 0.8vmin 1.5vmin;
  background: rgba(10,11,15,0.82);
  border: 1px solid rgba(184,178,164,0.14);
  border-left: 2px solid var(--violet);
  color: var(--bone);
  font-size: clamp(9px, 1.25vmin, 13px);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  white-space: nowrap;
  animation: toastIn .22s ease both;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -6px); } to { opacity: 1; transform: translate(-50%, 0); } }

#hintBar {
  position: absolute; left: 50%; bottom: max(2.2vh, 12px);
  transform: translateX(-50%);
  display: flex; gap: 1.8vmin; flex-wrap: wrap; justify-content: center;
  width: max-content; max-width: 46vw;
  padding: 0.55vmin 1vmin;
  background: rgba(8,9,12,0.5);
  font-size: clamp(7.5px, 1vmin, 10px);
  letter-spacing: 0.24em;
  color: rgba(184,178,164,0.5);
  text-transform: uppercase;
  transition: opacity .6s ease;
  pointer-events: none;
}
#hintBar span::before { content: '·'; color: var(--gold-dim); margin-right: 1.2em; }
#hintBar span:first-child::before { content: ''; margin: 0; }
.hint-desktop { display: inline; }
.hint-touch { display: none; }
body.touch .hint-desktop { display: none; }
body.touch .hint-touch { display: inline; }
body.touch .act-key, body.touch .portrait-key { display: none; }
body.touch #hintBar { max-width: 40vw; }

/* ------------------------------------------------------------------ portraits */
#portraits {
  position: absolute;
  z-index: 14;
  left: max(2.4vw, 16px);
  bottom: max(26vh, 150px);
  display: flex;
  gap: clamp(5px, 0.9vmin, 10px);
  pointer-events: auto;
}
.portrait {
  position: relative;
  width: clamp(54px, 9.4vmin, 84px);
  height: clamp(55px, 9.6vmin, 86px);
  padding: 0;
  background: rgba(10, 11, 15, 0.78);
  border: 1px solid rgba(184,178,164,0.2);
  cursor: pointer;
  overflow: hidden;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 7px), calc(100% - 7px) 100%, 0 100%);
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease, opacity .16s ease;
  opacity: 0.72;
}
.portrait-img { position: absolute; inset: 0; display: block; }
.portrait-img img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 18%; display: block; filter: saturate(.9) brightness(.86); transition: filter .18s ease; }
.portrait.active {
  opacity: 1;
  transform: translateY(-3px) scale(1.045);
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold), 0 0 18px rgba(200,160,60,0.3);
}
.portrait.active .portrait-img img { filter: saturate(1.05) brightness(1.02); }
.portrait.down { opacity: .42; filter: grayscale(.6); }
.portrait.down::after {
  content: 'DOWN'; position: absolute; inset: auto 0 30% 0; text-align: center;
  font-family: 'JetBrains Mono', monospace; font-size: .6em; letter-spacing: .16em;
  color: #d2766b; background: rgba(10,11,15,.7);
}
.portrait-key {
  position: absolute; left: 4px; top: 3px;
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(7px, 0.95vmin, 10px);
  color: rgba(184,178,164,.68);
  background: rgba(10,11,15,.66);
  padding: 0 3px;
  line-height: 1.4;
}
.portrait-name {
  position: absolute; left: 0; right: 0; bottom: 5px;
  text-align: center;
  font-size: clamp(6.5px, 0.82vmin, 9px);
  letter-spacing: .16em;
  color: rgba(184,178,164,.7);
  text-transform: uppercase;
  text-shadow: 0 1px 4px #000;
}
.portrait-health {
  position: absolute; left: 4px; right: 4px; bottom: 1px;
  height: 2px; background: rgba(0,0,0,.55);
}
.portrait-health i { display: block; height: 100%; width: 100%; background: var(--health); transition: width .25s ease; }
.portrait-cd {
  position: absolute; inset: 0;
  background: conic-gradient(from -90deg, rgba(6,7,10,.74) calc(var(--cd, 0) * 1turn), transparent 0);
  pointer-events: none;
}
.portrait-ready {
  position: absolute; inset: 2px;
  border: 1px solid rgba(200,160,60,0);
  pointer-events: none;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.portrait.active .portrait-ready.ready {
  border-color: rgba(200,160,60,.55);
  box-shadow: inset 0 0 12px rgba(200,160,60,.18);
}

/* ------------------------------------------------------------------ joystick */
#joystick {
  position: absolute;
  z-index: 14;
  left: max(2.4vw, 16px);
  bottom: max(2.4vh, 14px);
  width: clamp(118px, 21vmin, 190px);
  height: clamp(118px, 21vmin, 190px);
  pointer-events: auto;
  touch-action: none;
}
.stick-base { position: absolute; inset: 0; opacity: .4; transition: opacity .22s ease; }
.stick-base img { width: 100%; height: 100%; object-fit: contain; display: block; filter: saturate(.8) brightness(.88); }
#joystick.on .stick-base { opacity: .92; }
.stick-knob {
  position: absolute; left: 50%; top: 50%;
  width: 30%; height: 30%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle at 42% 38%, rgba(184,178,164,.25), rgba(14,15,19,.86) 62%, rgba(8,9,12,.92));
  border: 1px solid rgba(200,160,60,.35);
  box-shadow: 0 4px 16px rgba(0,0,0,.5), inset 0 0 10px rgba(0,0,0,.6);
  transition: border-color .15s;
}

/* ------------------------------------------------------------------ actions */
#actions {
  position: absolute;
  z-index: 14;
  right: max(2vw, 14px);
  bottom: max(2.4vh, 14px);
  width: clamp(190px, 34vmin, 300px);
  height: clamp(132px, 24vmin, 212px);
  pointer-events: none;
}
.act {
  position: absolute;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
  touch-action: none;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,.55));
  transition: transform .1s ease, filter .16s ease;
  -webkit-tap-highlight-color: transparent;
}
.act img { width: 100%; height: 100%; display: block; object-fit: contain; border-radius: 50%; }
.act:active, .act.held { transform: scale(.94); filter: drop-shadow(0 0 12px rgba(200,160,60,.35)); }
.act.aiming img { filter: drop-shadow(0 0 10px rgba(200,160,60,.45)) brightness(1.15); }
.act.active img { filter: drop-shadow(0 0 12px rgba(200,160,60,.5)) brightness(1.2); }
.act-key {
  position: absolute;
  left: 50%; bottom: 3%;
  transform: translateX(-50%);
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(6px, 0.75vmin, 8px);
  letter-spacing: .1em;
  color: rgba(184,178,164,.55);
  background: rgba(8,9,12,.55);
  padding: 0 3px;
  pointer-events: none;
}
.act-fire { width: clamp(68px, 12.4vmin, 104px); height: clamp(68px, 12.4vmin, 104px); right: 0; bottom: 0; }
.act-aim { width: clamp(54px, 9.4vmin, 80px); height: clamp(54px, 9.4vmin, 80px); right: clamp(78px, 14vmin, 120px); bottom: clamp(66px, 11.6vmin, 96px); }
.act-reload { width: clamp(46px, 8vmin, 68px); height: clamp(46px, 8vmin, 68px); right: clamp(78px, 13.6vmin, 116px); bottom: clamp(8px, 1.4vmin, 14px); }
.act-sprint { width: clamp(44px, 7.8vmin, 66px); height: clamp(44px, 7.8vmin, 66px); right: clamp(126px, 22vmin, 188px); bottom: clamp(8px, 1.4vmin, 14px); }
.act-interact { width: clamp(44px, 7.8vmin, 66px); height: clamp(44px, 7.8vmin, 66px); right: clamp(124px, 21.4vmin, 182px); bottom: clamp(64px, 11.2vmin, 94px); }
.act-ability { width: clamp(46px, 8.2vmin, 70px); height: clamp(46px, 8.2vmin, 70px); right: clamp(4px, 0.8vmin, 10px); bottom: clamp(74px, 12.8vmin, 108px); }
.act-cd {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from -90deg, rgba(5,6,9,.76) calc(var(--cd, 0) * 1turn), transparent 0);
  pointer-events: none;
}
.act.cooling img { filter: grayscale(.55) brightness(.62); }
.act.ready { filter: drop-shadow(0 0 8px rgba(200,160,60,.22)); }

/* ------------------------------------------------------------------ panels */
.overlay-panel {
  z-index: 50;
  align-items: center;
  justify-content: center;
  background: rgba(5, 6, 9, 0.58);
  backdrop-filter: blur(7px) saturate(.8);
  -webkit-backdrop-filter: blur(7px) saturate(.8);
  padding: max(2.4vh, 14px) max(2.4vw, 14px);
}
.panel-wrap { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.panel {
  width: min(88vw, 820px);
  max-height: 88vh;
  overflow-y: auto;
  padding: clamp(18px, 3.4vmin, 42px);
  background:
    linear-gradient(160deg, rgba(27, 30, 36, 0.97), rgba(13, 15, 19, 0.98) 58%, rgba(9, 10, 13, 0.99));
  border: 1px solid rgba(184,178,164,0.14);
  box-shadow: 0 30px 90px rgba(0,0,0,.65), inset 0 1px 0 rgba(184,178,164,0.06);
  clip-path: polygon(0 0, calc(100% - 20px) 0, 100% 20px, 100% 100%, 20px 100%, 0 calc(100% - 20px));
  scrollbar-width: thin;
  scrollbar-color: rgba(200,160,60,.4) transparent;
}
.panel.narrow { width: min(88vw, 430px); }
.panel::-webkit-scrollbar { width: 5px; }
.panel::-webkit-scrollbar-thumb { background: rgba(200,160,60,.35); }
.panel-head { margin-bottom: 2.2vmin; }
.panel-kicker { display: block; font-size: clamp(8px, 1.05vmin, 10px); letter-spacing: .34em; color: var(--violet); text-transform: uppercase; margin-bottom: .55em; }
.panel h2 {
  margin: 0;
  font-family: 'Big Shoulders Stencil', 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: clamp(30px, 6vmin, 62px);
  line-height: .9;
  letter-spacing: .045em;
  color: var(--bone);
  text-transform: uppercase;
}
.panel .gold-rule { margin-top: 1.3vmin; }
.control-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 3.2vmin; }
.control-col h3 { margin: 0 0 1.2vmin; font-size: clamp(9px, 1.25vmin, 12px); letter-spacing: .26em; color: var(--gold); text-transform: uppercase; font-weight: 600; }
.control-col dl { margin: 0; display: flex; flex-direction: column; gap: .78vmin; }
.control-col dl > div { display: flex; justify-content: space-between; gap: 1.5em; border-bottom: 1px solid rgba(184,178,164,.07); padding-bottom: .65vmin; }
.control-col dt { font-size: clamp(8.5px, 1.1vmin, 11px); letter-spacing: .16em; color: var(--bone-dim); text-transform: uppercase; white-space: nowrap; }
.control-col dd { margin: 0; font-size: clamp(9px, 1.22vmin, 12px); letter-spacing: .04em; color: var(--bone); text-align: right; }
.panel-note { margin: 2.2vmin 0 0; font-size: clamp(9.5px, 1.25vmin, 12.5px); line-height: 1.55; color: rgba(184,178,164,.52); letter-spacing: .04em; }
.panel-actions { margin-top: 2.6vmin; display: flex; justify-content: flex-end; gap: 1.2vmin; }
.panel-btn {
  appearance: none;
  padding: 1.15vmin 2.4vmin;
  background: rgba(20, 22, 27, 0.9);
  border: 1px solid rgba(184,178,164,0.18);
  border-left: 2px solid rgba(184,178,164,0.28);
  color: var(--bone);
  font-family: 'Barlow', sans-serif;
  font-size: clamp(10px, 1.35vmin, 13px);
  font-weight: 600;
  letter-spacing: .2em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color .16s, border-color .16s, background .16s, transform .1s;
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 0 100%);
}
.panel-btn:hover, .panel-btn:focus-visible { color: var(--gold-bright); border-color: var(--gold-dim); background: rgba(31, 27, 20, 0.9); outline: none; }
.panel-btn:active { transform: translateY(1px); }
.panel-btn.gold { border-left-color: var(--gold); color: var(--gold-bright); }
.panel-btn.quiet { color: rgba(184,178,164,.45); }
.stack { display: flex; flex-direction: column; gap: 1.05vmin; }
.stack.row { flex-direction: row; justify-content: center; flex-wrap: wrap; }
.stack .panel-btn { width: 100%; text-align: center; }
.stack.row .panel-btn { width: auto; }

.settings-group { display: flex; flex-direction: column; gap: 1.7vmin; }
.setting { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .45vmin 1.5vmin; }
.setting-name { font-size: clamp(8.5px, 1.15vmin, 11px); letter-spacing: .22em; color: var(--bone-dim); text-transform: uppercase; }
.setting-value { font-family: 'JetBrains Mono', monospace; font-size: clamp(9px, 1.2vmin, 12px); color: var(--gold-bright); grid-column: 2; grid-row: 1; }
.range { grid-column: 1 / -1; width: 100%; appearance: none; height: 20px; background: transparent; cursor: pointer; margin: 0; }
.range::-webkit-slider-runnable-track { height: 2px; background: rgba(184,178,164,.2); }
.range::-moz-range-track { height: 2px; background: rgba(184,178,164,.2); }
.range::-webkit-slider-thumb { appearance: none; width: 13px; height: 13px; margin-top: -5.5px; background: var(--gold); border: 1px solid #e8c77e; transform: rotate(45deg); box-shadow: 0 0 10px rgba(200,160,60,.35); }
.range::-moz-range-thumb { width: 12px; height: 12px; background: var(--gold); border: 1px solid #e8c77e; border-radius: 0; transform: rotate(45deg); }
.switch {
  appearance: none;
  display: inline-flex; align-items: center; gap: .7em;
  padding: .35em .85em .35em .45em;
  background: rgba(20,22,27,.9);
  border: 1px solid rgba(184,178,164,.18);
  color: var(--bone-dim);
  font-family: 'Barlow', sans-serif; font-size: clamp(8px, 1.05vmin, 10px);
  letter-spacing: .18em; text-transform: uppercase; cursor: pointer;
  grid-column: 3; justify-self: end;
}
.switch i { width: 9px; height: 9px; background: rgba(184,178,164,.3); display: block; transition: background .16s, box-shadow .16s; }
.switch[aria-checked="true"] { color: var(--gold-bright); border-color: var(--gold-dim); }
.switch[aria-checked="true"] i { background: var(--gold); box-shadow: 0 0 8px rgba(200,160,60,.55); }
.segmented { display: inline-flex; gap: 2px; grid-column: 3; justify-self: end; }
.segmented button {
  appearance: none; padding: .42em .85em;
  background: rgba(20,22,27,.85); border: 1px solid rgba(184,178,164,.14);
  color: rgba(184,178,164,.5); font-family: 'Barlow', sans-serif; font-size: clamp(7.5px, 0.98vmin, 9.5px);
  font-weight: 600; letter-spacing: .14em; text-transform: uppercase; cursor: pointer;
}
.segmented button.on { color: var(--gold-bright); border-color: var(--gold-dim); background: rgba(36,31,22,.9); }

/* ------------------------------------------------------------------ result */
.result { z-index: 60; align-items: center; justify-content: center; background: radial-gradient(circle at 50% 45%, rgba(15,12,18,.55), rgba(5,6,9,.9)); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.result::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(90% 70% at 50% 48%, transparent 40%, rgba(179,128,66,.18) 100%);
  mix-blend-mode: screen;
}
.result.defeat::before { background: radial-gradient(90% 70% at 50% 48%, transparent 34%, rgba(95,63,140,.36) 100%); }
.result-inner { position: relative; width: min(86vw, 720px); text-align: center; display: flex; flex-direction: column; align-items: center; }
.result-kicker { font-size: clamp(8px, 1.2vmin, 11px); letter-spacing: .38em; color: var(--violet-bright); text-transform: uppercase; }
.result h2 {
  margin: 1.2vmin 0 0;
  font-family: 'Big Shoulders Stencil', 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: clamp(68px, 19vmin, 200px);
  line-height: .82;
  letter-spacing: .03em;
  color: var(--bone);
  text-transform: uppercase;
  text-shadow: 0 4px 40px rgba(0,0,0,.7), 0 0 70px rgba(200,160,60,.1);
}
.defeat h2 { color: #c6bcd0; text-shadow: 0 4px 40px rgba(0,0,0,.7), 0 0 70px rgba(138,111,176,.2); }
.result-rule { width: min(360px, 60vw); height: 1px; background: linear-gradient(90deg, transparent, var(--gold), transparent); margin: 2.2vmin 0; }
.defeat .result-rule { background: linear-gradient(90deg, transparent, var(--violet), transparent); }
.result p { margin: 0 0 2.4vmin; max-width: 54ch; font-size: clamp(11px, 1.7vmin, 16px); line-height: 1.55; color: rgba(184,178,164,.66); letter-spacing: .04em; }
.result-stats { display: flex; gap: 3.2vmin; margin-bottom: 3vmin; }
.result-stats .rs { display: flex; flex-direction: column; align-items: center; gap: .35em; }
.result-stats .rs b { font-family: 'JetBrains Mono', monospace; font-weight: 500; font-size: clamp(22px, 4.2vmin, 44px); color: var(--gold-bright); line-height: 1; }
.result-stats .rs span { font-size: clamp(7px, 0.98vmin, 9.5px); letter-spacing: .26em; color: var(--bone-dim); text-transform: uppercase; }

/* ------------------------------------------------------------------ fatal */
#fatalError { z-index: 95; align-items: center; justify-content: center; background: #0b0c0f; }
#fatalError .panel { display: block; }

/* ------------------------------------------------------------------ responsive */
@media (max-aspect-ratio: 1/1) {
  .title-top { padding-top: max(6vh, 34px); }
  .title-mark { width: min(88vw, 560px); }
  .title-menu {
    position: absolute;
    left: 50%; bottom: 11vh;
    transform: translateX(-50%);
    margin: 0;
    width: min(76vw, 340px);
    align-self: center;
  }
  .title-foot { position: absolute; left: 0; right: 0; bottom: 2vh; }
  #objectivePanel { width: min(58vw, 330px); }
  #waypointPanel { top: auto; left: 50%; top: max(13vh, 100px); transform: translateX(-50%) scale(0.9); }
  #hintBar { display: none; }
  #portraits { bottom: max(25vh, 208px); }
  #actions { transform: scale(.93); transform-origin: 100% 100%; }
}

@media (max-width: 540px) {
  .title-menu { width: 88vw; }
  .menu-item { font-size: 15px; padding: 10px 12px; }
  #objectiveTitle { font-size: 17px; }
  .objective-sub { font-size: 8px; }
  #waypointPanel { display: none; }
  .ammo-num { font-size: 27px; }
  .health-block { width: 112px; }
  .control-grid { grid-template-columns: 1fr; gap: 2.4vmin; }
  .panel { padding: 16px; }
  .panel h2 { font-size: 30px; }
  .result-stats { gap: 5vw; }
  .result p { font-size: 11px; }
}

@media (max-height: 470px) {
  .title-menu { bottom: auto; margin-top: 2vh; width: min(52vw, 330px); }
  .menu-item { font-size: 14px; padding: 8px 11px; }
  .title-foot { font-size: 8px; }
  #objectivePanel { margin-top: 8px; }
  #portraits { bottom: max(25vh, 150px); }
}

@media (pointer: coarse) { body.touch .hint-desktop { display: none; } }
