:root {
  --bg: #050806;
  --bg-soft: #080808;
  --panel: #050505;
  --panel-strong: #080808;
  --line: rgba(91, 255, 154, 0.35);
  --line-strong: rgba(91, 255, 154, 0.72);
  --text: #d9e2db;
  --muted: #7e9386;
  --green: #5bff9a;
  --green-deep: #39d978;
  --red: #ff6767;
  --glow: 0 0 16px rgba(91, 255, 154, 0.08);
  --shadow: 0 0 0 1px rgba(91, 255, 154, 0.05);
  --serif: "Cormorant Garamond", Georgia, serif;
  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--mono);
  color: var(--text);
  background: #000;
  min-height: 100vh;
  overflow-x: hidden;
}

body.intro-mode {
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 0%, rgba(91, 255, 154, 0.04), transparent 35%);
  z-index: -2;
}

.noise,
.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

.noise {
  opacity: 0.02;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.15) 0 1px, transparent 1px),
    radial-gradient(circle at 80% 60%, rgba(255, 255, 255, 0.1) 0 1px, transparent 1px);
  background-size: 160px 160px;
}

.scanlines {
  opacity: 0.05;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.03),
    rgba(255, 255, 255, 0.03) 1px,
    transparent 1px,
    transparent 4px
  );
}

.hero,
.section,
.footer {
  position: relative;
  z-index: 1;
}

.archive-shell {
  opacity: 0;
  transform: scale(1.02) translateY(24px);
  filter: blur(12px);
  transition: opacity 650ms steps(10), transform 650ms steps(10), filter 650ms steps(10);
}

body.archive-visible .archive-shell {
  opacity: 1;
  transform: none;
  filter: none;
}

body.reveal-phase .archive-shell {
  animation: archive-lift 1100ms cubic-bezier(0.18, 0.88, 0.22, 1) both;
}

.entry-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 1.2rem;
  background: #000;
  overflow: hidden;
}

.entry-flash,
.entry-scan {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
}

.entry-flash {
  background: radial-gradient(circle at 50% 50%, rgba(91, 255, 154, 0.22), rgba(91, 255, 154, 0.08) 18%, transparent 52%);
  mix-blend-mode: screen;
}

.entry-scan {
  background: linear-gradient(180deg, transparent 0%, rgba(91, 255, 154, 0.22) 48%, rgba(91, 255, 154, 0.38) 50%, rgba(91, 255, 154, 0.12) 52%, transparent 100%);
  transform: translateY(-100%);
}

.entry-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(91, 255, 154, 0.06), transparent 28%);
}

.entry-bg {
  position: absolute;
  inset: -10%;
  pointer-events: none;
  transition: transform 1400ms cubic-bezier(0.17, 0.84, 0.44, 1), opacity 900ms ease;
}

.entry-bg-a {
  background: radial-gradient(circle at 50% 50%, rgba(91, 255, 154, 0.06), transparent 26%);
}

.entry-bg-b {
  background:
    linear-gradient(90deg, transparent 49.7%, rgba(91, 255, 154, 0.08) 50%, transparent 50.3%),
    linear-gradient(transparent 49.7%, rgba(91, 255, 154, 0.08) 50%, transparent 50.3%);
  opacity: 0.28;
}

.entry-panel {
  position: relative;
  width: min(92vw, 660px);
  padding: 1.2rem;
  border: 1px solid var(--line-strong);
  background: #000;
  box-shadow: 0 0 0 1px rgba(91, 255, 154, 0.05), 0 0 24px rgba(91, 255, 154, 0.05);
}

.entry-title {
  margin: 0 0 1rem;
  font-size: clamp(2.2rem, 6vw, 4.6rem);
  line-height: 0.96;
  color: #dfe6e1;
}

.entry-label,
.entry-hint {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.entry-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.8rem;
  margin-top: 0.9rem;
}

.entry-hint {
  margin: 0.8rem 0 0;
}

.entry-status {
  margin: 0.9rem 0 0;
  min-height: 1.6rem;
  color: var(--green);
  font-size: 0.84rem;
  letter-spacing: 0.06em;
}

body.entering .entry-panel {
  animation: entry-panel-shift 1200ms cubic-bezier(0.16, 0.9, 0.3, 1) forwards;
}

body.entering .entry-bg-a {
  transform: translate3d(0, -10%, 0) scale(1.15);
  opacity: 0.2;
}

body.entering .entry-bg-b {
  transform: translate3d(0, 14%, 0) scale(1.25);
  opacity: 0.08;
}

body.entering .entry-screen {
  animation: gate-fade 1400ms steps(14) forwards;
}

body.entering .entry-flash {
  animation: unlock-flash 820ms steps(8) forwards;
}

body.entering .entry-scan {
  opacity: 1;
  animation: unlock-scan 980ms cubic-bezier(0.16, 0.84, 0.3, 1) forwards;
}

.hero {
  padding: 1.5rem clamp(1.1rem, 3vw, 3rem) 5rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.topbar,
.panel-header,
.mini-stats,
.footer {
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.74rem;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  color: var(--muted);
  padding-bottom: 1rem;
}

.top-links {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand {
  color: var(--green);
}

.inline-link {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid rgba(91, 255, 154, 0.22);
  padding-bottom: 0.18rem;
  transition: color 120ms steps(2), border-color 120ms steps(2);
}

.inline-link:hover,
.inline-link:focus-visible {
  color: var(--green);
  border-color: rgba(91, 255, 154, 0.65);
}

.hero-grid,
.preview-layout,
.logic-layout,
.admin-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: stretch;
}

.hero-copy,
.hero-panel,
.card,
.section-intro,
.credits-sim {
  backdrop-filter: none;
}

.hero-copy {
  max-width: 780px;
  padding-top: 7vh;
}

.eyebrow {
  font-size: 0.74rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--green);
  margin-bottom: 1rem;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(3rem, 9vw, 6.8rem);
  line-height: 1;
  margin-bottom: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.hero-title {
  display: flex;
  flex-direction: column;
  gap: 0.12em;
  max-width: 9.2ch;
}

.hero-title span {
  display: block;
}

h2 {
  font-size: clamp(2rem, 4vw, 3.4rem);
  margin-bottom: 1rem;
  font-weight: 600;
}

h3 {
  font-size: 1.05rem;
  margin-bottom: 0.7rem;
  color: var(--text);
}

.hero-subtitle,
.hero-quote,
.section-intro p,
.card p,
.logic-chain li {
  color: var(--muted);
  line-height: 1.65;
  font-size: 0.94rem;
}

.hero-subtitle {
  max-width: 44rem;
  font-size: 1.12rem;
}

.hero-quote {
  font-family: var(--mono);
  font-size: clamp(1rem, 1.7vw, 1.15rem);
  max-width: 35rem;
  color: #b6c6bb;
  margin-bottom: 2rem;
}

.hero-actions {
  display: flex;
  gap: 0.9rem;
  flex-wrap: wrap;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.9rem 1.2rem;
  border-radius: 0;
  border: 1px solid var(--line-strong);
  color: var(--text);
  text-decoration: none;
  background: #020202;
  transition: transform 160ms steps(2), box-shadow 160ms steps(2), background 160ms steps(2), color 160ms steps(2);
  box-shadow: var(--glow);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.button:hover,
.button:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 0 18px rgba(91, 255, 154, 0.14);
  color: var(--green);
}

.button.primary {
  background: rgba(91, 255, 154, 0.04);
}

.button.ghost {
  background: #020202;
}

.hero-panel,
.card,
.credits-sim,
.section-intro {
  border: 1px solid var(--line);
  background: #020202;
  box-shadow: var(--shadow);
}

.hero-panel,
.card,
.credits-sim {
  border-radius: 0;
  padding: 1.1rem;
}

.section {
  padding: 2.5rem clamp(1.1rem, 3vw, 3rem);
}

.section.alt .card,
.section.alt .section-intro,
.section.alt .credits-sim {
  background: #020202;
}

.section-intro {
  padding: 1.2rem 1.2rem 1rem;
  border-radius: 0;
  margin-bottom: 1.5rem;
}

.section-intro.narrow {
  max-width: 58rem;
}

.panel-header,
.mini-stats,
.dossier-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.dossier-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 1rem;
  margin-top: 1rem;
}

.terminal-lines {
  padding: 1rem 0;
  border-top: 1px solid rgba(91, 255, 154, 0.18);
  border-bottom: 1px solid rgba(91, 255, 154, 0.18);
  margin: 1rem 0 1.3rem;
}

.terminal-lines p,
.input-label,
.meta-label {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.prompt,
.accent,
.card-tag,
.timeline-item span,
.sound-card span,
.meta-value,
.counter-value {
  color: var(--green);
}

.counter-row,
.grid.three,
.grid.two,
.sound-grid,
.timeline,
.incident-board {
  display: grid;
  gap: 1rem;
}

.counter-row,
.grid.three,
.sound-grid,
.incident-board {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.two,
.preview-layout,
.timeline {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.timeline {
  align-items: stretch;
}

.counter-card {
  border: 1px solid rgba(91, 255, 154, 0.2);
  border-radius: 0;
  padding: 1rem;
  background: #010101;
}

.counter-card.danger,
.classified,
.question-chip.danger {
  color: var(--red);
  border-color: rgba(255, 103, 103, 0.35);
}

.counter-value {
  font-size: 1.8rem;
  font-weight: 700;
  display: block;
  margin-bottom: 0.35rem;
}

.scroll-indicator {
  align-self: flex-start;
  margin-top: 2rem;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid rgba(124, 255, 186, 0.2);
  padding-bottom: 0.2rem;
}

.card {
  transition: transform 120ms steps(2), border-color 120ms steps(2), box-shadow 120ms steps(2);
}

.card:hover {
  transform: translateY(-2px);
  border-color: rgba(91, 255, 154, 0.5);
  box-shadow: 0 0 0 1px rgba(91, 255, 154, 0.12), 0 0 18px rgba(91, 255, 154, 0.06);
}

.card-tag {
  display: inline-block;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 0.8rem;
}

.input-row {
  display: flex;
  gap: 0.8rem;
  margin: 0.8rem 0 1rem;
}

input {
  width: 100%;
  background: #000;
  color: var(--text);
  border: 1px solid rgba(91, 255, 154, 0.34);
  border-radius: 0;
  padding: 0.95rem 1rem;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.2em;
}

.entry-row input {
  min-width: 0;
}

input:focus {
  outline: none;
  border-color: var(--line-strong);
  box-shadow: inset 0 0 0 1px rgba(91, 255, 154, 0.18), 0 0 10px rgba(91, 255, 154, 0.08);
}

.progress-shell {
  width: 100%;
  height: 10px;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
  border: 1px solid rgba(91, 255, 154, 0.18);
}

.progress-bar {
  width: 8%;
  height: 100%;
  background: linear-gradient(90deg, var(--green-deep), var(--green));
  border-radius: inherit;
  transition: width 220ms steps(8);
}

.demo-response {
  min-height: 3.2rem;
  margin: 1rem 0;
}

.meta-label {
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.meta-value {
  margin-bottom: 1.1rem;
  font-weight: 600;
}

.typing-box {
  border-top: 1px solid rgba(91, 255, 154, 0.16);
  margin-top: 0.5rem;
  padding-top: 1rem;
}

.typing-demo {
  min-height: 5.6rem;
}

.question-chip {
  border: 1px solid rgba(91, 255, 154, 0.2);
  border-radius: 0;
  padding: 0.7rem 0.9rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.timeline-item,
.sound-card,
.incident,
.feature-card,
.cinematic-card {
  position: relative;
  overflow: hidden;
}

.timeline-item::after,
.sound-card::after,
.incident::after,
.feature-card::after,
.cinematic-card::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(91, 255, 154, 0.9), transparent);
  opacity: 0.75;
}

.logic-chain ol {
  margin: 1rem 0 0;
  padding-left: 1.25rem;
}

.logic-chain li + li {
  margin-top: 0.65rem;
}

.sound-card span,
.timeline-item span {
  display: block;
  margin-bottom: 0.85rem;
  font-size: 1rem;
  font-weight: 700;
}

.incident-board {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.admin-screen {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 1rem;
  margin-top: 1rem;
}

.admin-screen aside,
.admin-fields {
  border: 1px solid rgba(91, 255, 154, 0.14);
  border-radius: 0;
  padding: 1rem;
  background: #010101;
}

.admin-screen ul {
  margin: 0;
  padding-left: 1rem;
  color: var(--muted);
}

.admin-screen li + li,
.admin-fields p + p {
  margin-top: 0.6rem;
}

.admin-screen .active {
  color: var(--green);
}

.credits-sim {
  min-height: 360px;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.credits-column {
  text-align: center;
  animation: credits-scroll 20s linear infinite;
}

.credits-column h3 {
  font-family: var(--serif);
  font-size: 3rem;
  margin: 1rem 0;
}

.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  color: var(--muted);
  padding: 1rem clamp(1.1rem, 3vw, 3rem) 2rem;
  border-top: 1px solid rgba(91, 255, 154, 0.18);
}

.footer p {
  margin: 0;
}

.memory {
  padding-bottom: 6rem;
}

.closing-line {
  font-family: var(--serif);
  font-size: clamp(1.3rem, 2.4vw, 1.9rem);
  color: #dce7e1;
  margin: 1.5rem 0 2rem;
}

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 420ms steps(10), transform 420ms steps(10);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

body.phase-loading .hero-copy,
body.phase-loading .hero-panel,
body.phase-loading .section-intro,
body.phase-loading .card,
body.phase-loading .credits-sim,
body.phase-loading .footer {
  opacity: 0;
  transform: translateY(24px);
}

body.phase-loading .hero-copy.phase-visible,
body.phase-loading .hero-panel.phase-visible,
body.phase-loading .section-intro.phase-visible,
body.phase-loading .card.phase-visible,
body.phase-loading .credits-sim.phase-visible,
body.phase-loading .footer.phase-visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 320ms steps(8), transform 320ms steps(8);
}

.glitch {
  position: relative;
  display: inline-block;
}

.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.glitch.active::before {
  color: rgba(105, 150, 255, 0.8);
  transform: translate(1px, 0);
  opacity: 0.5;
}

.glitch.active::after {
  color: rgba(255, 103, 103, 0.65);
  transform: translate(-1px, 0);
  opacity: 0.5;
}

.typing-demo::after,
.hero-subtitle::after {
  content: "_";
  color: var(--green);
  animation: caret-blink 1s steps(2) infinite;
}

@keyframes credits-scroll {
  0% { transform: translateY(28%); }
  100% { transform: translateY(-42%); }
}

@keyframes caret-blink {
  0%, 45% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

@keyframes gate-fade {
  0% {
    opacity: 1;
    clip-path: inset(0 0 0 0);
  }
  60% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    clip-path: inset(0 0 100% 0);
    visibility: hidden;
  }
}

@keyframes entry-panel-shift {
  0% {
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
  35% {
    transform: translateY(-10px) scale(1.025);
  }
  100% {
    transform: translateY(-60px) scale(1.12);
    filter: blur(10px);
    opacity: 0;
  }
}

@keyframes unlock-flash {
  0% { opacity: 0; }
  12% { opacity: 0.15; }
  30% { opacity: 0.95; }
  55% { opacity: 0.28; }
  100% { opacity: 0; }
}

@keyframes unlock-scan {
  0% {
    transform: translateY(-100%);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  100% {
    transform: translateY(100%);
    opacity: 0;
  }
}

@keyframes archive-lift {
  0% {
    transform: perspective(1400px) translate3d(0, 48px, 0) scale(0.99);
    filter: blur(10px);
  }
  55% {
    transform: perspective(1400px) translate3d(0, -8px, 0) scale(1.002);
    filter: blur(2px);
  }
  100% {
    transform: none;
    filter: none;
  }
}

@media (max-width: 1080px) {
  .hero-grid,
  .preview-layout,
  .logic-layout,
  .admin-layout,
  .counter-row,
  .grid.three,
  .grid.two,
  .sound-grid,
  .incident-board,
  .timeline {
    grid-template-columns: 1fr;
  }

  .hero-copy {
    padding-top: 2rem;
  }

  .entry-panel {
    width: min(94vw, 620px);
  }
}

@media (max-width: 720px) {
  .hero {
    padding-top: 1rem;
    padding-bottom: 3.5rem;
  }

  .topbar,
  .panel-header,
  .mini-stats,
  .dossier-footer,
  .admin-screen {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .topbar,
  .panel-header,
  .mini-stats,
  .dossier-footer {
    display: flex;
    align-items: flex-start;
  }

  .topbar {
    gap: 0.4rem;
  }

  .top-links,
  .footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-title {
    max-width: none;
  }

  .input-row,
  .hero-actions,
  .entry-row {
    flex-direction: column;
  }

  .entry-row {
    display: flex;
  }

  .dossier-grid {
    grid-template-columns: 1fr;
  }

  h1 {
    letter-spacing: -0.02em;
  }

  .hero-quote,
  .closing-line {
    line-height: 1.35;
  }

  .credits-column h3 {
    font-size: 2.2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}
