:root {
  --blood: #ff1a00;
  --blood-dim: #8a0d00;
  --ember: #ff4d1a;
  --amber: #ff6a00;
  --steel: #c8c2b8;
  --void: #050201;
  --hud: rgba(255, 26, 0, 0.85);
  --scan: rgba(255, 40, 0, 0.045);
  --font-hud: "Share Tech Mono", "Consolas", "Courier New", monospace;
  --font-display: "Orbitron", "Segoe UI", sans-serif;
}

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

html,
body {
  height: 100%;
  background: var(--void);
  color: var(--blood);
  font-family: var(--font-hud);
  overflow: hidden;
}

body {
  cursor: crosshair;
}

.bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 58% 42%, rgba(255, 20, 0, 0.22), transparent 42%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.82)),
    url("../assets/endoskeleton.jpg") center 18% / cover no-repeat;
  filter: contrast(1.18) saturate(1.25) brightness(0.72);
  transform: scale(1.06);
  animation: drift 28s ease-in-out infinite alternate;
  z-index: 0;
}

.bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.62) 0%, transparent 22%, transparent 78%, rgba(0, 0, 0, 0.62) 100%),
    radial-gradient(circle at 50% 110%, rgba(255, 0, 0, 0.18), transparent 50%);
}

@keyframes drift {
  from { transform: scale(1.06) translate3d(-1.2%, 0, 0); }
  to { transform: scale(1.1) translate3d(1.4%, -1%, 0); }
}

.vignette,
.scanlines,
.grain,
.reticle {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 8;
}

.vignette {
  background: radial-gradient(ellipse at center, transparent 38%, rgba(0, 0, 0, 0.72) 100%);
  z-index: 7;
}

.scanlines {
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 2px,
    var(--scan) 3px,
    var(--scan) 4px
  );
  mix-blend-mode: multiply;
  animation: flicker 6s infinite;
}

.grain {
  opacity: 0.09;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='.85'/%3E%3C/svg%3E");
  animation: grain 0.35s steps(2) infinite;
  z-index: 9;
}

@keyframes flicker {
  0%, 100% { opacity: 0.72; }
  13% { opacity: 0.58; }
  14% { opacity: 0.9; }
  61% { opacity: 0.66; }
  62% { opacity: 0.82; }
}

@keyframes grain {
  0% { transform: translate(0, 0); }
  100% { transform: translate(-2%, 3%); }
}

.hud-frame {
  position: fixed;
  inset: 14px;
  z-index: 10;
  pointer-events: none;
  border: 1px solid rgba(255, 26, 0, 0.28);
  box-shadow: inset 0 0 40px rgba(255, 0, 0, 0.08);
}

.hud-frame::before,
.hud-frame::after,
.hud-frame .c {
  content: "";
  position: absolute;
  width: 42px;
  height: 42px;
  border: 2px solid var(--blood);
}

.hud-frame::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.hud-frame::after { top: -1px; right: -1px; border-left: 0; border-bottom: 0; }
.hud-frame .c.bl { bottom: -1px; left: -1px; border-right: 0; border-top: 0; }
.hud-frame .c.br { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }

.reticle .ring {
  position: absolute;
  left: var(--rx, 50%);
  top: var(--ry, 46%);
  width: 86px;
  height: 86px;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(255, 26, 0, 0.55);
  border-radius: 50%;
  box-shadow: 0 0 12px rgba(255, 0, 0, 0.25);
  transition: left 0.12s linear, top 0.12s linear;
}

.reticle .ring::before,
.reticle .ring::after {
  content: "";
  position: absolute;
  background: var(--blood);
}

.reticle .ring::before {
  left: 50%;
  top: -10px;
  width: 1px;
  height: calc(100% + 20px);
}

.reticle .ring::after {
  top: 50%;
  left: -10px;
  height: 1px;
  width: calc(100% + 20px);
}

.wrap {
  position: relative;
  z-index: 11;
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 28px 36px 22px;
}

header,
footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 11px;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brand b {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.42em;
  color: var(--ember);
  text-shadow: 0 0 12px rgba(255, 26, 0, 0.65);
}

.meta {
  opacity: 0.78;
}

.clock {
  text-align: right;
  line-height: 1.55;
}

.clock .jd {
  color: var(--amber);
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.stage {
  display: grid;
  grid-template-columns: 220px 1fr 220px;
  align-items: center;
  min-height: 0;
  gap: 12px;
}

.col {
  font-size: 11px;
  letter-spacing: 0.12em;
  line-height: 1.7;
  text-transform: uppercase;
  opacity: 0.86;
}

.col h3 {
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 0.32em;
  margin-bottom: 10px;
  color: var(--amber);
}

.bar {
  height: 6px;
  background: rgba(255, 26, 0, 0.12);
  border: 1px solid rgba(255, 26, 0, 0.45);
  margin: 6px 0 14px;
  overflow: hidden;
}

.bar > i {
  display: block;
  height: 100%;
  width: var(--w, 40%);
  background: linear-gradient(90deg, var(--blood-dim), var(--blood));
  box-shadow: 0 0 10px var(--blood);
  animation: load 2.8s ease-in-out infinite alternate;
}

@keyframes load {
  from { filter: brightness(0.8); }
  to { filter: brightness(1.4); }
}

.optic {
  width: 168px;
  aspect-ratio: 1;
  margin-top: 8px;
  border: 1px solid rgba(255, 26, 0, 0.5);
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 24px rgba(255, 0, 0, 0.25);
}

.optic img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: contrast(1.2) saturate(1.3);
  animation: optic 4s ease-in-out infinite;
}

.optic::after {
  content: "OPTICAL SENSOR // ACTIVE";
  position: absolute;
  left: 6px;
  bottom: 5px;
  font-size: 8px;
  letter-spacing: 0.14em;
  text-shadow: 0 0 8px #000;
}

@keyframes optic {
  0%, 100% { transform: scale(1); filter: contrast(1.2) saturate(1.3) brightness(0.9); }
  50% { transform: scale(1.06); filter: contrast(1.35) saturate(1.5) brightness(1.05); }
}

.hero {
  text-align: center;
  position: relative;
}

.kicker {
  font-family: var(--font-display);
  font-size: clamp(10px, 1.2vw, 13px);
  letter-spacing: 0.55em;
  color: var(--amber);
  margin-bottom: 14px;
}

.title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(42px, 9vw, 108px);
  letter-spacing: 0.08em;
  line-height: 0.9;
  color: #ffe8e0;
  text-shadow:
    0 0 8px var(--blood),
    0 0 24px rgba(255, 0, 0, 0.7),
    3px 0 0 rgba(255, 0, 70, 0.55),
    -2px 0 0 rgba(0, 220, 255, 0.35);
  animation: glitch 3.2s infinite;
}

.title span {
  display: block;
  font-size: 0.42em;
  letter-spacing: 0.28em;
  margin-top: 8px;
  color: var(--blood);
}

@keyframes glitch {
  0%, 86%, 100% { transform: none; }
  87% { transform: translate(-2px, 1px) skewX(-2deg); }
  89% { transform: translate(3px, -1px); }
  91% { transform: translate(-3px, 0) skewX(2deg); }
  93% { transform: none; }
}

.sub {
  margin-top: 22px;
  font-size: 13px;
  letter-spacing: 0.42em;
  color: var(--steel);
  text-transform: uppercase;
}

.sub b {
  color: var(--blood);
  font-weight: 400;
}

.status-row {
  margin-top: 28px;
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.chip {
  border: 1px solid rgba(255, 26, 0, 0.45);
  padding: 7px 12px;
  font-size: 10px;
  letter-spacing: 0.22em;
  background: rgba(20, 0, 0, 0.45);
}

.chip.live {
  color: var(--amber);
  box-shadow: 0 0 12px rgba(255, 80, 0, 0.25);
}

.log {
  margin-top: 26px;
  min-height: 4.6em;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: #ff8a73;
  text-align: left;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
  opacity: 0.9;
}

.log::after {
  content: "";
  display: inline-block;
  width: 8px;
  height: 1em;
  background: var(--blood);
  margin-left: 4px;
  vertical-align: -2px;
  animation: blink 0.9s steps(1) infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

footer {
  align-items: flex-end;
  opacity: 0.8;
}

.progress {
  flex: 1;
  max-width: 420px;
}

.progress label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}

.boot {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: #000;
  color: var(--blood);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  letter-spacing: 0.12em;
  transition: opacity 0.7s ease, visibility 0.7s;
}

.boot.hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.boot pre {
  font-family: var(--font-hud);
  line-height: 1.7;
  text-shadow: 0 0 8px rgba(255, 26, 0, 0.6);
}

@media (max-width: 860px) {
  html, body {
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
  }
  .wrap {
    padding: 18px 14px 16px;
    min-height: 100dvh;
    height: auto;
    grid-template-rows: auto auto auto;
    gap: 10px;
  }
  .stage {
    grid-template-columns: 1fr;
    align-items: start;
  }
  .col { display: none; }
  header, footer { flex-direction: column; gap: 6px; }
  header { font-size: 10px; }
  .clock { text-align: left; letter-spacing: 0.08em; }
  .title {
    font-size: clamp(36px, 14vw, 64px);
    letter-spacing: 0.02em;
  }
  .title span {
    font-size: 0.24em;
    letter-spacing: 0.14em;
    padding: 0 4px;
  }
  .kicker {
    letter-spacing: 0.28em;
    margin-top: 6px;
    margin-bottom: 10px;
  }
  .sub {
    letter-spacing: 0.08em;
    font-size: 11px;
    padding: 0 4px;
  }
  .status-row {
    flex-direction: column;
    align-items: center;
    margin-top: 16px;
  }
  .chip {
    letter-spacing: 0.12em;
    width: min(260px, 92%);
    text-align: center;
  }
  .log { font-size: 11px; padding: 0 4px; margin-top: 18px; }
  .wrap { align-content: start; }
  footer { font-size: 9px; letter-spacing: 0.08em; margin-top: 8px; }
  footer > :first-child,
  footer > :last-child { display: none; }
  .hud-frame { inset: 8px; }
  .progress { max-width: 100%; }
  .reticle { display: none; }
}

.fx-kill {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  background: #000;
  pointer-events: auto;
  cursor: none;
}

body.killing .fx-kill,
body.dead .fx-kill {
  display: block;
}

body.killing .wrap,
body.killing .hud-frame,
body.killing .reticle,
body.dead .wrap,
body.dead .hud-frame,
body.dead .reticle {
  pointer-events: none;
}

body.killing .bg {
  animation: none;
  filter: contrast(1.8) saturate(0.2) brightness(1.4) hue-rotate(-10deg);
}

body.killing .wrap {
  animation: hud-glitch 0.18s steps(2) infinite;
  filter: contrast(1.6) saturate(2);
}

@keyframes hud-glitch {
  0% { transform: translate(0, 0); }
  50% { transform: translate(-8px, 1px) skewX(-2deg); }
  100% { transform: translate(6px, -2px); }
}

#fx-static {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  mix-blend-mode: screen;
  image-rendering: pixelated;
  pointer-events: none;
}

.fx-kill.static-on #fx-static {
  opacity: 0.72;
}

.fx-kill.static-hard #fx-static {
  opacity: 1;
  mix-blend-mode: normal;
}

.fx-crt {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  opacity: 0;
  overflow: hidden;
}

.fx-kill.halt .fx-crt {
  opacity: 1;
  animation: crt-collapse 2.7s cubic-bezier(0.7, 0, 1, 0.4) forwards;
}

@keyframes crt-collapse {
  0% { transform: scaleY(1) scaleX(1); filter: brightness(1.4); }
  55% { transform: scaleY(0.018) scaleX(1); filter: brightness(2.4); }
  78% { transform: scaleY(0.018) scaleX(0.04); filter: brightness(3); }
  100% { transform: scaleY(0) scaleX(0); filter: brightness(0); }
}

.fx-crt-beam {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 3px;
  background: #fff;
  box-shadow: 0 0 18px 6px #ff2a00, 0 0 40px 10px #ff1a00;
  transform: translateY(-50%);
  opacity: 0;
}

.fx-kill.halt .fx-crt-beam {
  animation: beam 2.7s ease forwards;
}

@keyframes beam {
  0%, 40% { opacity: 0; }
  55% { opacity: 1; }
  100% { opacity: 0; }
}

#fx-halt {
  position: relative;
  z-index: 1;
  color: var(--blood);
  font-family: var(--font-hud);
  font-size: clamp(12px, 2.2vw, 18px);
  letter-spacing: 0.16em;
  line-height: 1.7;
  text-shadow: 0 0 10px rgba(255, 26, 0, 0.8);
  text-align: left;
}

.fx-reveal {
  position: absolute;
  inset: 0;
  background: #000 url("../assets/warzone.jpg") center / cover no-repeat;
  opacity: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fx-kill.show-t800 .fx-reveal {
  opacity: 1;
  animation: t800-in 1.65s steps(6) forwards;
}

@keyframes t800-in {
  0% { opacity: 0; filter: contrast(2) saturate(0) brightness(2); transform: scale(1.08); }
  40% { opacity: 1; filter: contrast(1.6) saturate(2) brightness(1.3); transform: scale(1.02) translateX(-6px); }
  70% { filter: contrast(1.2) saturate(1.2) brightness(0.9); transform: scale(1.01) translateX(4px); }
  100% { opacity: 1; filter: none; transform: none; }
}

.fx-reveal::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 2px,
    rgba(255, 40, 0, 0.05) 3px,
    rgba(255, 40, 0, 0.05) 4px
  );
  mix-blend-mode: multiply;
}

.fx-reveal img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 22% 16%;
  background: transparent;
}

@media (min-width: 1280px) {
  .fx-reveal img {
    object-fit: cover;
    object-position: 18% 12%;
  }
}

@media (max-width: 860px) {
  .fx-reveal img {
    object-fit: cover;
    object-position: 16% 8%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bg, .scanlines, .grain, .title, .bar > i, .optic img, .clock .jd, .log::after {
    animation: none !important;
  }
}
