@font-face {
  font-family: "Oswald";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/oswald-cyrillic-500.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Oswald";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/oswald-latin-500.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Oswald";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/oswald-cyrillic-600.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Oswald";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/oswald-latin-600.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/plex-sans-cyrillic-400.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/plex-sans-latin-400.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/plex-sans-cyrillic-500.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/plex-sans-latin-500.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/plex-mono-cyrillic-400.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/plex-mono-latin-400.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --ink: #e7eef3;
  --dim: #a9b6c0;
  --muted: #7e8b96;
  --line: rgba(186, 214, 222, 0.28);
  --cyan: #9ee7ff;
  --amber: #e4c27a;
  --hot: #ff6a52;
  --ok: #c8f5a4;
  --plate: rgba(6, 10, 14, 0.66);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #07090b;
  color: var(--ink);
  overflow: hidden;
  user-select: none;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
}

body.still, body.still * { cursor: none !important; }

button, a { font: inherit; color: inherit; }

#world {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

#vignette, #scrim, #scan, #grain, .frame, #flash {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

#vignette {
  z-index: 1;
  background: radial-gradient(ellipse at 62% 42%, transparent 36%, rgba(0, 0, 0, 0.58) 100%);
}

#scrim {
  z-index: 1;
  background: linear-gradient(90deg, rgba(5, 8, 10, 0.9) 0%, rgba(5, 8, 10, 0.72) 28%, rgba(5, 8, 10, 0.28) 48%, rgba(5, 8, 10, 0) 68%);
}

body[data-sensor="lidar"] #scrim {
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.78) 0%, rgba(0, 0, 0, 0.4) 36%, rgba(0, 0, 0, 0) 64%);
}

#scan {
  z-index: 2;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.16),
    rgba(0, 0, 0, 0.16) 1px,
    transparent 1px,
    transparent 4px
  );
  opacity: 0.28;
}

body[data-sensor="lidar"] #scan { opacity: 0.45; }
body[data-sensor="thermal"] { --cyan: #ffb089; }
body[data-sensor="lidar"] { --cyan: #c6ff7a; }
body[data-sensor="ew"] { --cyan: #ff9b86; }

#grain {
  z-index: 3;
  opacity: 0.14;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  animation: grain 0.45s steps(2) infinite;
}

@keyframes grain {
  0% { transform: translate(0, 0); }
  50% { transform: translate(-1.5%, 1%); }
  100% { transform: translate(1%, -1%); }
}

.frame i {
  position: fixed;
  width: 34px;
  height: 34px;
  z-index: 6;
  border: 1.5px solid rgba(198, 228, 234, 0.78);
  pointer-events: none;
}
.frame .tl { top: 12px; left: 12px; border-right: 0; border-bottom: 0; }
.frame .tr { top: 12px; right: 12px; border-left: 0; border-bottom: 0; }
.frame .bl { bottom: 12px; left: 12px; border-right: 0; border-top: 0; }
.frame .br { bottom: 12px; right: 12px; border-left: 0; border-top: 0; }

#flash {
  z-index: 7;
  background: rgba(255, 255, 255, 0.35);
  opacity: 0;
}
#flash.on { animation: flash 0.45s linear forwards; }
@keyframes flash {
  0% { opacity: 0.28; }
  100% { opacity: 0; }
}

#progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0;
  z-index: 8;
  background: var(--cyan);
  box-shadow: 0 0 12px var(--cyan);
}

.chrome {
  position: fixed;
  z-index: 9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  left: 36px;
  right: 36px;
  top: 22px;
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--dim);
}

.brand, .brand-tools { display: flex; align-items: center; gap: 14px; }
.brand { white-space: nowrap; }
.brand-tools { gap: 8px; }
.brand-tools button { padding: 6px 8px; letter-spacing: 0.1em; }

.live {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--hot);
  box-shadow: 0 0 8px var(--hot);
  animation: blink 1.4s steps(1) infinite;
}
@keyframes blink {
  0%, 45% { opacity: 1; }
  50%, 100% { opacity: 0.25; }
}

#clock { color: var(--ink); }

button {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--dim);
  padding: 6px 10px;
  letter-spacing: 0.16em;
  cursor: pointer;
}
button[aria-pressed="true"] {
  color: #071014;
  background: var(--cyan);
  border-color: var(--cyan);
}
button:hover { border-color: var(--cyan); color: var(--ink); }
button[aria-pressed="true"]:hover { color: #071014; }
button:focus-visible { outline: 1px solid var(--cyan); outline-offset: 3px; }

#telemetry {
  position: fixed;
  z-index: 5;
  top: 78px;
  right: 36px;
  width: 228px;
  padding: 14px 14px 10px;
  background: var(--plate);
  border: 1px solid var(--line);
  backdrop-filter: blur(10px);
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-size: 12px;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
}

.tel {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  margin-bottom: 7px;
}
.tel b { color: var(--ink); font-weight: 400; }
.tel-label { margin-bottom: 4px; }
#v-channel.radio { color: var(--amber); }
#v-channel.laser { color: var(--cyan); }
#v-channel.autonomous { color: var(--hot); }

.meter {
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  margin: 0 0 10px;
}
.meter i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--cyan);
}
.meter.amber i { background: var(--amber); }
.meter.hot i { background: var(--hot); }
.meter.ok i { background: var(--ok); }

#stage {
  position: fixed;
  z-index: 5;
  left: clamp(48px, 4.5vw, 84px);
  top: 92px;
  bottom: 128px;
  transform: none;
  width: min(720px, 46vw);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
#kicker {
  margin: 0 0 14px;
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-size: 13px;
  letter-spacing: 0.22em;
  color: var(--cyan);
}
#title {
  margin: 0;
  font-family: Oswald, "Segoe UI", sans-serif;
  font-weight: 600;
  font-size: clamp(40px, 4.8vw, 84px);
  line-height: 0.9;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  text-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}
#sub {
  margin: 14px 0 0;
  font-family: Oswald, "Segoe UI", sans-serif;
  font-weight: 500;
  font-size: clamp(22px, 2vw, 32px);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--amber);
}
#sub:empty { display: none; }
#body { margin-top: 22px; }
#body p.say {
  color: rgba(213, 222, 230, 0.34);
  border-left: 2px solid transparent;
  padding-left: 10px;
}
#body p.say.on {
  color: #f7fbff;
  border-left-color: var(--cyan);
}
#body p {
  margin: 0 0 10px;
  max-width: 38em;
  font-size: clamp(15px, 1.2vw, 19px);
  line-height: 1.45;
  font-weight: 400;
  color: #d5dee6;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.65);
}
#stage.boot #title { font-size: clamp(36px, 4vw, 64px); }
#stage.tease #body p.say { display: none; }
#stage.tease #body p.say.on {
  display: block;
  max-width: 16em;
  margin-top: 18px;
  font-family: Oswald, "Segoe UI", sans-serif;
  font-size: clamp(28px, 2.8vw, 46px);
  font-weight: 500;
  line-height: 1.18;
  letter-spacing: 0.01em;
  color: #f7fbff;
}
#brief-btn { letter-spacing: 0.12em; }
.log { color: var(--muted) !important; font-family: "IBM Plex Mono", Consolas, monospace; font-size: 14px !important; letter-spacing: 0.08em; }
.log.on { color: var(--ink) !important; }
.log::before { content: "> "; color: var(--cyan); }

#channel-big {
  font-family: Oswald, "Segoe UI", sans-serif;
  font-weight: 600;
  font-size: clamp(52px, 6vw, 96px);
  line-height: 0.9;
  letter-spacing: 0.04em;
  color: var(--amber);
  text-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}
#channel-big.laser { color: var(--cyan); }
#channel-big.autonomous { color: var(--hot); }
.fine {
  margin-top: 8px !important;
  font-family: "IBM Plex Mono", Consolas, monospace !important;
  font-size: 12px !important;
  letter-spacing: 0.12em;
  color: var(--muted) !important;
}

.row {
  display: grid;
  grid-template-columns: 42px 148px 1fr;
  gap: 10px;
  align-items: baseline;
  padding: 8px 0;
  border-top: 1px solid rgba(186, 214, 222, 0.16);
  font-size: 16px;
  color: #c5d0d8;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
}
.row b {
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-weight: 400;
  color: var(--cyan);
  letter-spacing: 0.08em;
}
.row strong {
  font-family: Oswald, "Segoe UI", sans-serif;
  font-weight: 500;
  letter-spacing: 0.06em;
  font-size: 18px;
}
.row.on { color: var(--ink); background: linear-gradient(90deg, rgba(158, 231, 255, 0.14), transparent 80%); }
#stage.lexicon {
  justify-content: flex-start;
  width: min(980px, 62vw);
  padding-top: 8px;
}
#stage.lexicon #title { font-size: clamp(32px, 3.2vw, 56px); }
#stage.lexicon #body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 28px;
  margin-top: 12px;
}
#stage.lexicon #body p.say { grid-column: 1 / -1; }
#stage.lexicon .row {
  grid-template-columns: 108px 1fr;
  gap: 8px;
  padding: 4px 0;
  font-size: 14px;
}
#stage.lexicon .row strong { font-size: 15px; letter-spacing: 0.04em; }
#stage.lexicon .row b:empty { display: none; }
.row.foe strong, .row.foe b { color: var(--amber); }
.credit {
  margin-top: 28px !important;
  font-family: "IBM Plex Mono", Consolas, monospace !important;
  letter-spacing: 0.12em;
  font-size: 12px !important;
  color: var(--muted) !important;
  white-space: pre-line;
}

.bottom {
  top: auto;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  pointer-events: none;
}
.bottom::before {
  content: "";
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 120px;
  background: linear-gradient(180deg, rgba(5, 8, 10, 0), rgba(5, 8, 10, 0.88) 46%);
  z-index: -1;
  pointer-events: none;
}
.bottom button, #slots button { pointer-events: auto; }

#slots { display: flex; gap: 8px; flex-wrap: nowrap; width: 100%; min-width: 0; }
.slot {
  flex: 1 1 0;
  min-width: 0;
  text-align: left;
  padding: 7px 8px 6px;
  background: var(--plate);
  backdrop-filter: blur(8px);
}
.slot small, .slot b { display: block; letter-spacing: 0.06em; }
.slot small { color: var(--muted); font-size: 10px; }
.slot b {
  color: var(--ink);
  font-weight: 400;
  margin-top: 3px;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.slot.on { border-color: var(--cyan); }
.slot.on small { color: var(--cyan); }
.slot.crit { border-color: var(--hot); }
.slot.crit b { color: var(--hot); }

#evac {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 2px 0 4px;
  color: var(--muted);
}
#evac b { font-weight: 400; color: var(--ink); }
#evac-core {
  display: block;
  min-height: 12px;
  margin: 0 0 10px;
  font-style: normal;
  letter-spacing: 0.08em;
  color: var(--ok);
  font-size: 10px;
  white-space: nowrap;
}
#modes { margin-top: 2px; }
#evac.live b { color: var(--ok); }
#evac.off b { color: var(--muted); }

#modes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
#modes button { padding: 6px 4px; letter-spacing: 0.12em; }
#hint {
  position: static;
  margin: 0;
  text-align: left;
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-size: 10px;
  letter-spacing: 0.12em;
  color: rgba(169, 182, 192, 0.72);
  white-space: nowrap;
  overflow: hidden;
}

#dots {
  position: fixed;
  z-index: 5;
  left: 16px;
  top: 50%;
  bottom: auto;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 7px;
}
#dots button {
  width: 8px;
  height: 16px;
  padding: 0;
  border: 0;
  border-left: 2px solid rgba(255, 255, 255, 0.28);
  background: transparent;
}
#dots button.on { height: 28px; border-color: var(--cyan); }

body:not(.is-manual) #prev,
body:not(.is-manual) #next,
body:not(.is-manual) #dots,
body:not(.is-manual) #slots,
body:not(.is-manual) #modes {
  pointer-events: none;
}

#prev, #next {
  position: fixed;
  z-index: 5;
  top: 0;
  bottom: 0;
  width: 48px;
  border: 0;
  background: transparent;
  color: transparent;
}
#prev { left: 0; }
#next { right: 0; }
#prev:hover, #next:hover { background: linear-gradient(90deg, rgba(158, 231, 255, 0.08), transparent); }
#next:hover { background: linear-gradient(270deg, rgba(158, 231, 255, 0.08), transparent); }

body.jam #title { animation: tear 0.4s steps(2) infinite; }
@keyframes tear {
  0% { transform: none; text-shadow: none; }
  40% { transform: translateX(-2px); text-shadow: 2px 0 var(--hot); }
  100% { transform: translateX(2px); }
}

@media (max-width: 1100px) {
  #stage { width: min(54vw, 640px); top: 84px; bottom: 108px; }
  #telemetry { width: 188px; top: 64px; right: 16px; padding: 10px 10px 8px; }
  .bottom { left: 24px; right: 16px; }
  .tel { margin-bottom: 4px; }
}
@media (max-width: 720px) {
  .chrome { left: 18px; right: 18px; letter-spacing: 0.08em; }
  #telemetry { display: none; }
  #hint { display: none; }
  #stage { left: 36px; width: min(92vw, 640px); bottom: 96px; }
  #stage.lexicon { width: min(92vw, 640px); }
  #stage.lexicon #body { grid-template-columns: 1fr; }
  .frame i { width: 22px; height: 22px; }
}
@media (max-height: 760px) {
  #title { font-size: clamp(32px, 6vh, 52px); }
  #telemetry { top: 60px; }
  #stage { top: 72px; bottom: 112px; }
  #body p { font-size: 15px; }
}
