:root {
  --bg: #040604;
  --ink: #eaf8c8;
  --muted: #7a9260;
  --green: #b6ff3b;
  --green-dim: rgba(182, 255, 59, 0.14);
  --alert: #ff4d3a;
  --paper: #f3ecdc;
  --frame: #0c140c;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", monospace;
  --serif: "Instrument Serif", "Times New Roman", serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #000;
  color: var(--ink);
  font-family: var(--mono);
  overflow: hidden;
}

body {
  display: grid;
  place-items: center;
}

.chrome {
  position: relative;
  width: min(96vw, 1600px);
  height: min(94vh, calc(96vw * 9 / 16), 900px);
  background: var(--bg);
  border: 1px solid rgba(182, 255, 59, 0.18);
  box-shadow: 0 0 80px rgba(182, 255, 59, 0.06);
  overflow: hidden;
}

canvas#field {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.55;
}

.scan {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(0, 0, 0, 0.08) 0px,
      rgba(0, 0, 0, 0.08) 1px,
      transparent 2px,
      transparent 4px
    );
  mix-blend-mode: multiply;
  z-index: 6;
}

.vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(0, 0, 0, 0.55) 100%);
  z-index: 5;
}

.topbar, .bottombar {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.topbar { top: 0; }
.bottombar { bottom: 2.4rem; }

.live {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--alert);
  font-weight: 600;
}

.live i {
  width: 0.55rem;
  height: 0.55rem;
  background: var(--alert);
  border-radius: 50%;
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.75); }
}

.stage {
  position: absolute;
  inset: 3.4rem 1.5rem 5.2rem;
  z-index: 4;
}

.scene {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  filter: blur(6px);
  transition: opacity 0.35s ease, transform 0.45s ease, filter 0.45s ease;
}

.scene.active {
  opacity: 1;
  pointer-events: auto;
  transform: none;
  filter: none;
}

.scene.leaving {
  opacity: 0;
  transform: translateY(-10px);
  filter: blur(8px);
}

.kicker {
  font-size: clamp(0.7rem, 1.3vw, 0.9rem);
  letter-spacing: 0.28em;
  color: var(--green);
  margin: 0 0 0.8rem;
  text-transform: uppercase;
}

.scene h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(3.2rem, 10vw, 8.4rem);
  line-height: 0.88;
  margin: 0 0 0.7rem;
  letter-spacing: -0.03em;
  max-width: 14ch;
}

.scene h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.8rem, 4.4vw, 3.6rem);
  line-height: 1.02;
  margin: 0 0 1rem;
  max-width: 18ch;
}

.scene p, .beat {
  margin: 0.18rem 0;
  font-size: clamp(0.85rem, 1.7vw, 1.15rem);
  color: var(--ink);
  max-width: 42rem;
  line-height: 1.45;
}

.beat {
  opacity: 0;
  transform: translateY(12px);
  filter: blur(4px);
}

.beat.in {
  opacity: 1;
  transform: none;
  filter: none;
  transition: opacity 0.45s ease, transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), filter 0.45s ease;
}

.beat.alert { color: var(--alert); }
.beat.green { color: var(--green); }
.beat.quote {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.2rem, 2.6vw, 2rem);
  color: var(--paper);
  margin-top: 0.8rem;
}

.statrow {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 2.2rem;
  margin-top: 1.2rem;
}

.stat {
  min-width: 7rem;
}

.stat b {
  display: block;
  font-family: var(--serif);
  font-size: clamp(1.8rem, 4vw, 3.2rem);
  font-weight: 400;
  color: var(--green);
  line-height: 1;
}

.stat span {
  display: block;
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.ticker-wrap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2.4rem;
  overflow: hidden;
  border-top: 1px solid rgba(182, 255, 59, 0.16);
  background: #020302;
  z-index: 8;
}

.ticker {
  display: flex;
  gap: 2.5rem;
  white-space: nowrap;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--green);
  padding: 0.7rem 0;
  animation: ticker 42s linear infinite;
  width: max-content;
}

@keyframes ticker {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.controls {
  position: absolute;
  left: 1.25rem;
  right: 1.25rem;
  bottom: 2.7rem;
  z-index: 9;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  pointer-events: none;
}

.controls button {
  pointer-events: auto;
  appearance: none;
  border: 1px solid rgba(182, 255, 59, 0.28);
  background: rgba(4, 6, 4, 0.7);
  color: var(--green);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.35rem 0.55rem;
  cursor: pointer;
}

.controls button:hover { background: var(--green-dim); }

.progress {
  pointer-events: auto;
  flex: 1;
  height: 3px;
  background: rgba(182, 255, 59, 0.12);
  cursor: pointer;
}

.progress > span {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--green);
  box-shadow: 0 0 12px var(--green);
}

.time {
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  color: var(--muted);
  min-width: 6.2rem;
  text-align: right;
}

.gate, .endcard {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: grid;
  place-items: center;
  background: rgba(4, 6, 4, 0.92);
  text-align: center;
  padding: 2rem;
}

.gate[hidden], .endcard[hidden] { display: none; }

.gate h1, .endcard h1 {
  font-family: var(--serif);
  font-size: clamp(2.4rem, 7vw, 5.5rem);
  line-height: 0.9;
  margin: 0.4rem 0 1rem;
}

.play {
  appearance: none;
  border: 1px solid var(--green);
  background: transparent;
  color: var(--green);
  font-family: var(--mono);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  padding: 0.9rem 1.4rem;
  cursor: pointer;
  font-size: 0.8rem;
}

.play:hover { background: var(--green); color: #041004; }

.gate p, .endcard p {
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  max-width: 34rem;
  margin: 0 auto 1.4rem;
  line-height: 1.6;
}

.back {
  position: absolute;
  top: 1rem;
  left: 1.25rem;
  z-index: 20;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.back:hover { color: var(--green); }

.glitch .stage {
  animation: glitch 0.28s steps(2, end);
}

@keyframes glitch {
  0% { transform: translate(0); filter: none; }
  20% { transform: translate(-6px, 1px); filter: hue-rotate(20deg); }
  40% { transform: translate(7px, -2px); }
  60% { transform: translate(-3px, 0); }
  80% { transform: translate(4px, 1px); }
  100% { transform: none; filter: none; }
}

.transcript {
  position: absolute;
  inset: 12% 8%;
  z-index: 15;
  overflow: auto;
  background: #071007;
  border: 1px solid rgba(182, 255, 59, 0.25);
  padding: 1.4rem 1.6rem;
  color: var(--ink);
  font-size: 0.85rem;
  line-height: 1.55;
}

.transcript[hidden] { display: none; }

.transcript h2 {
  font-family: var(--serif);
  font-size: 1.6rem;
  margin: 0 0 0.8rem;
}

.transcript h3 {
  color: var(--green);
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin: 1.1rem 0 0.35rem;
}

@media (max-width: 720px) {
  .chrome {
    width: 100vw;
    height: 100vh;
    border: 0;
  }
  .scene h1 { max-width: 10ch; }
  .statrow { gap: 1rem 1.4rem; }
}

@media (prefers-reduced-motion: reduce) {
  .scene, .beat, .ticker, .live i {
    animation: none !important;
    transition: opacity 0.2s linear !important;
    filter: none !important;
    transform: none !important;
  }
}
