:root {
  --bg-deep: #080706;
  --bg-surface: rgba(10, 9, 8, 0.48);
  --bg-input: rgba(14, 12, 10, 0.72);
  --text-main: #e8dfd0;
  --text-muted: #b3a58e;
  --text-dim: #807564;
  --amber: #d9a13a;
  --amber-glow: rgba(217, 161, 58, 0.25);
  --red-rec: #d64236;
  --green-ok: #72bd83;
  --font-serif: Georgia, "Times New Roman", Times, serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Courier New", monospace;
}

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

[hidden] {
  display: none !important;
}

html {
  background-color: var(--bg-deep);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.45;
  scroll-behavior: smooth;
  scroll-snap-type: y proximity;
}

body {
  margin: 0;
  min-height: 100dvh;
  background-color: var(--bg-deep);
  color: var(--text-main);
  overflow-x: hidden;
}

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

.skip-link {
  position: fixed;
  top: -100px;
  left: 1rem;
  z-index: 100;
  background: var(--amber);
  color: #080706;
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-decoration: none;
  border: none;
  border-radius: 3px;
}

.skip-link:focus {
  top: 0.6rem;
}

:focus-visible {
  outline: none;
  box-shadow: 0 0 0 1.5px var(--amber);
}

/* Layer 0 & 1: Video Background & Vignette */
.bg-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background: #080706;
}

.bg-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.bg-vignette {
  position: fixed;
  inset: 0;
  z-index: 1;
  background: radial-gradient(circle at 50% 45%, rgba(10, 9, 8, 0.18) 0%, rgba(8, 7, 6, 0.72) 92%);
  transition: background-color 0.45s ease, backdrop-filter 0.45s ease;
}

.bg-vignette.is-dimmed {
  background-color: rgba(8, 7, 6, 0.56);
  backdrop-filter: blur(3px);
}

/* Minimalist Camera HUD (Borderless, Low-Distraction, Compact Font) */
.hud-top,
.hud-bottom {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.9rem;
  border: none;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.hud-top {
  top: 0;
  background: linear-gradient(to bottom, rgba(8, 7, 6, 0.72), rgba(8, 7, 6, 0));
}

.hud-bottom {
  bottom: 0;
  background: linear-gradient(to top, rgba(8, 7, 6, 0.76), rgba(8, 7, 6, 0));
  flex-wrap: wrap;
}

.hud-corner {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.rec-dot {
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background-color: var(--red-rec);
  animation: pulse-rec 1.8s infinite ease-in-out;
}

.rec-label {
  color: var(--text-muted);
  font-weight: 600;
}

.hud-fiction {
  color: var(--amber);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.12rem 0.45rem;
  border: none;
  background: rgba(14, 12, 9, 0.65);
  border-radius: 3px;
  white-space: nowrap;
}

.hud-clock {
  color: var(--text-dim);
}

.hud-btn {
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 0.15rem 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  cursor: pointer;
  border-radius: 3px;
  transition: color 0.2s ease;
}

.hud-btn:hover {
  color: var(--text-main);
}

.hud-signal-line,
.hud-qr-note {
  color: var(--text-dim);
}

.hud-code {
  color: var(--text-muted);
  font-weight: 600;
  padding: 0.05rem 0.3rem;
  border: none;
  background: rgba(200, 176, 138, 0.08);
  border-radius: 2px;
}

.net-status {
  position: fixed;
  top: 2.2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 25;
  background: rgba(24, 18, 10, 0.88);
  color: var(--amber);
  border: none;
  padding: 0.25rem 0.65rem;
  font-size: 0.7rem;
  border-radius: 3px;
}

/* Layer 2: Scroll Container & Floating Sections */
.scroll-container {
  position: relative;
  z-index: 2;
  padding-top: 2.2rem;
  padding-bottom: 2.8rem;
}

.snap-section {
  min-height: 100dvh;
  scroll-snap-align: start;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1rem;
}

/* Borderless, Transparent Container so Props Float Over Video */
.dossier-frame {
  width: 100%;
  max-width: 560px;
  background: transparent;
  border: none;
  padding: 0.75rem 0.5rem;
  text-align: center;
}

.section-eyebrow {
  margin: 0 0 0.5rem;
  color: var(--text-muted);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 600;
}

.title-picture,
.prop-picture {
  display: block;
  width: 100%;
  margin: 0 auto 0.65rem;
}

.title-picture img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 145px;
  object-fit: contain;
  margin: 0 auto;
}

.prop-picture img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 230px;
  object-fit: contain;
  margin: 0 auto;
}

.hero-lead {
  font-family: var(--font-serif);
  font-size: 0.92rem;
  color: var(--text-muted);
  margin: 0.4rem auto 1rem;
  max-width: 28rem;
}

.hero-help {
  color: var(--text-dim);
  font-size: 0.76rem;
  margin: 0.35rem auto 1rem;
  max-width: 28rem;
}

.scroll-cue {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-muted);
  text-decoration: none;
  border: none;
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  background: var(--bg-surface);
  transition: color 0.2s ease, background-color 0.2s ease;
}

.scroll-cue:hover {
  color: var(--text-main);
  background: rgba(200, 176, 138, 0.14);
}

/* Chapter Meta & Badges */
.chapter-meta {
  margin-bottom: 0.25rem;
}

.status-badge {
  display: inline-block;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  padding: 0.12rem 0.45rem;
  border-radius: 3px;
  border: none;
  background: var(--bg-surface);
  color: var(--text-muted);
  text-transform: uppercase;
}

.status-badge.is-solved {
  color: var(--green-ok);
  background: rgba(30, 68, 40, 0.28);
}

/* Sealed State */
.sealed-box {
  text-align: center;
  padding: 1.25rem 1rem;
  background: var(--bg-surface);
  border: none;
  border-radius: 6px;
}

.countdown-timer {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--amber);
  margin: 0.35rem 0 0;
}

/* Compact Selectable Riddle Transcript */
.riddle-transcript {
  background: var(--bg-surface);
  border: none;
  border-radius: 6px;
  padding: 0.65rem 0.85rem;
  margin: 0.5rem auto;
  text-align: center;
}

.riddle-letters,
.riddle-pattern {
  font-family: var(--font-serif);
  font-size: 0.98rem;
  letter-spacing: 0.2em;
  color: var(--text-main);
  margin: 0;
  user-select: all;
}

.riddle-prompt-text {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.98rem;
  color: var(--text-main);
  margin: 0;
}

.riddle-teaser-text {
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  color: var(--text-main);
  margin: 0 0 0.45rem;
}

.teaser-codes {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.fragment-list {
  display: flex;
  justify-content: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  list-style: none;
  padding: 0;
  margin: 0;
}

.fragment-chip {
  background: rgba(229, 193, 88, 0.12);
  border: none;
  color: var(--text-main);
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 0.88rem;
  letter-spacing: 0.08em;
  padding: 0.28rem 0.65rem;
  border-radius: 4px;
  user-select: all;
}

.ping-log-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.15rem 1rem;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  line-height: 1.38;
  color: var(--text-muted);
  max-height: 210px;
  overflow-y: auto;
  padding: 0.15rem;
}

.ping-log-line {
  white-space: pre;
  margin: 0;
}

/* Compact Answer Input Form */
.answer-form {
  margin: 0.65rem auto 0;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.answer-row {
  display: flex;
  gap: 0.4rem;
}

.answer-input {
  flex: 1;
  min-width: 0;
  background: var(--bg-input);
  color: var(--text-main);
  border: none;
  border-radius: 4px;
  padding: 0.48rem 0.7rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
}

.answer-input::placeholder {
  color: var(--text-dim);
}

.submit-btn {
  background: rgba(28, 23, 17, 0.85);
  color: var(--text-muted);
  border: none;
  border-radius: 4px;
  padding: 0.48rem 0.8rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease;
  white-space: nowrap;
}

.submit-btn:hover:not(:disabled) {
  color: var(--text-main);
  background: rgba(217, 161, 58, 0.2);
}

.submit-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.feedback-box {
  padding: 0.4rem 0.65rem;
  border-radius: 4px;
  font-size: 0.74rem;
  border: none;
  background: var(--bg-surface);
}

.feedback-box.is-correct {
  color: var(--green-ok);
}

.feedback-box.is-wrong,
.feedback-box.is-rate {
  color: var(--amber);
}

.feedback-box.is-initials {
  color: var(--text-main);
}

.feedback-id {
  display: block;
  color: var(--text-dim);
  font-size: 0.7rem;
  margin-top: 0.1rem;
}

/* Compact Inline Hints Row */
.hints-block {
  margin: 0.65rem auto 0;
  max-width: 460px;
}

.hints-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem;
}

.hint-btn {
  background: var(--bg-surface);
  color: var(--text-muted);
  border: none;
  border-radius: 3px;
  padding: 0.25rem 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.hint-btn:hover:not(:disabled),
.hint-btn.is-active {
  color: var(--text-main);
  background: rgba(217, 161, 58, 0.18);
}

.hint-btn:disabled {
  color: var(--text-dim);
  cursor: not-allowed;
  opacity: 0.65;
}

.hints-panels {
  margin-top: 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.hint-panel {
  padding: 0.45rem 0.65rem;
  background: rgba(10, 9, 8, 0.78);
  border: none;
  border-radius: 4px;
  font-size: 0.75rem;
  text-align: left;
}

.hint-en {
  margin: 0 0 0.15rem;
  color: var(--text-main);
}

.hint-id {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.71rem;
  font-style: italic;
}

/* Quiet Story & Transcript Toggles */
.drawer-row {
  margin-top: 0.45rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.teaser-meta {
  margin-top: 0.35rem;
}

.story-details {
  margin: 0.15rem auto 0;
  width: 100%;
  max-width: 460px;
  border: none;
  background: transparent;
  padding: 0.1rem 0.3rem;
}

.story-summary {
  cursor: pointer;
  color: var(--text-dim);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  list-style: none;
}

.story-summary:hover {
  color: var(--text-muted);
}

.story-text {
  margin: 0.4rem 0 0;
  padding: 0.5rem 0.65rem;
  background: var(--bg-surface);
  border-radius: 4px;
  color: var(--text-muted);
  font-family: var(--font-serif);
  font-size: 0.78rem;
  line-height: 1.55;
  text-align: left;
}

/* Reveal CTA */
.reveal-cta {
  display: inline-block;
  margin-top: 0.65rem;
  background: var(--amber);
  color: #080706;
  font-size: 0.76rem;
  font-weight: 700;
  text-decoration: none;
  border: none;
  padding: 0.55rem 1.1rem;
  border-radius: 4px;
  letter-spacing: 0.08em;
}

/* Emergency Kill-Switch */
.kill-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: #050504;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  text-align: center;
}

.kill-box {
  max-width: 360px;
  border: none;
  padding: 1.5rem;
  background: transparent;
}

.kill-fiction {
  color: var(--amber);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 0 0 0.75rem;
}

.kill-title {
  font-family: var(--font-mono);
  font-size: 1.35rem;
  letter-spacing: 0.2em;
  color: var(--red-rec);
  margin: 0 0 0.4rem;
}

.kill-sub {
  color: var(--text-dim);
  margin: 0;
  font-size: 0.76rem;
}

@keyframes pulse-rec {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

@media (min-width: 640px) {
  .ping-log-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
  .hud-top,
  .hud-bottom,
  .hud-btn {
    font-size: 0.74rem;
  }
  .dossier-frame {
    max-width: 620px;
  }
  .answer-form {
    max-width: 460px;
  }
  .answer-input {
    font-size: 0.85rem;
    padding: 0.54rem 0.8rem;
  }
  .submit-btn {
    font-size: 0.78rem;
    padding: 0.54rem 0.9rem;
  }
  .hints-block,
  .story-details {
    max-width: 520px;
  }
  .hint-btn {
    font-size: 0.74rem;
    padding: 0.3rem 0.6rem;
  }
  .hint-panel {
    font-size: 0.8rem;
  }
  .hint-id {
    font-size: 0.76rem;
  }
  .story-summary {
    font-size: 0.74rem;
  }
  .story-text {
    font-size: 0.82rem;
  }
}

@media (max-width: 480px) {
  .hud-top,
  .hud-bottom {
    font-size: 0.62rem;
    padding: 0.4rem 0.55rem;
  }
  .hud-clock {
    display: none;
  }
  .answer-row {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
