@font-face {
  font-family: 'TT Chiaro';
  src: url('fonts/TT_CHIARO-B.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --navy: #0a0e1c;
  --navy-mid: #10152a;
  --navy-panel: #131a32;
  --red: #6c2fa3;
  --red-dim: #33184f;
  --cell-fill: #241333;
  --bone: #eef0f2;
  --wire: #3a4568;
  --wire-dim: #232c4a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--navy);
  color: var(--bone);
  font-family: 'TT Chiaro', monospace;
  min-height: 100%;
}

body {
  padding-bottom: 48px;
}

/* ---------- CRT overlay ---------- */
.crt-overlay {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 999;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0,0,0,0.15) 0px,
    rgba(0,0,0,0.15) 1px,
    transparent 2px,
    transparent 3px
  );
  animation: flicker 6.5s infinite;
  mix-blend-mode: overlay;
}

.vignette {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 998;
  box-shadow: inset 0 0 160px rgba(0,0,0,0.8);
}

@keyframes flicker {
  0%, 96%, 100% { opacity: 1; }
  97% { opacity: 0.85; }
  98% { opacity: 1; }
  98.5% { opacity: 0.9; }
}

/* ---------- Top bar / breadcrumbs ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--navy);
}

.stripe-strip {
  height: 10px;
  background:
    repeating-linear-gradient(
      -45deg,
      var(--red) 0 14px,
      var(--red-dim) 14px 28px
    );
  background-size: 200% 100%;
  animation: stripe-scroll 2.4s linear infinite;
}

@keyframes stripe-scroll {
  from { background-position: 0 0; }
  to { background-position: -40px 0; }
}

.crumb-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 14px 20px 14px;
  flex-wrap: wrap;
  gap: 10px;
}

.crumbs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.crumbs span {
  position: relative;
  padding: 8px 16px;
  font-size: 12px;
  letter-spacing: 0.05em;
  color: var(--bone);
  text-transform: uppercase;
  background: var(--red-dim);
  border-bottom: 2px solid rgba(238,240,242,0.15);
}

.location-crumbs span.current,
.case-crumbs span {
  background: var(--red);
  border-bottom-color: var(--bone);
}

.location-crumbs span.current::after,
.case-crumbs span::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -9px;
  width: 16px;
  height: 16px;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(238,240,242,0.9) 0%, var(--red) 60%, transparent 75%);
  filter: blur(1px);
  z-index: 1;
}

.case-crumbs span {
  font-family: 'TT Chiaro', monospace;
  font-size: 15px;
}

.dot-strip {
  height: 8px;
  display: flex;
  gap: 3px;
  padding: 10px 20px 0;
  overflow: hidden;
}

.dot-strip::before {
  content: '';
  flex: 1;
  background: repeating-linear-gradient(
    to right,
    var(--wire) 0 4px,
    transparent 4px 9px
  );
}

/* ---------- Viewport / layout ---------- */
.viewport {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 0;
}

.window-pair {
  position: relative;
  display: grid;
  grid-template-columns: minmax(220px, 320px) 1fr;
  gap: 18px;
  margin-bottom: 18px;
}

.diamond-marker {
  position: absolute;
  top: -14px;
  left: -14px;
  width: 26px;
  height: 26px;
  z-index: 3;
  transform: rotate(45deg);
  border: 2px solid var(--red);
  background: radial-gradient(circle, rgba(238,240,242,0.5) 0%, var(--red-dim) 70%);
  box-shadow: 0 0 10px var(--red);
}

.diamond-marker::after {
  content: '';
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: var(--bone);
  opacity: 0.7;
}

/* ---------- Window frames (shared) ---------- */
.window {
  position: relative;
  border: 1px solid var(--red-dim);
  background: var(--navy-panel);
}

.corner {
  position: absolute;
  width: 9px;
  height: 9px;
  background: var(--red);
  z-index: 2;
}
.corner.tl { top: -1px; left: -1px; }
.corner.tr { top: -1px; right: -1px; }
.corner.bl { bottom: -1px; left: -1px; }
.corner.br { bottom: -1px; right: -1px; }

/* ---------- Scene window (decorative "film window") ---------- */
.scene-window {
  min-height: 260px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.marker-dot {
  position: absolute;
  top: 40%;
  right: -4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 6px var(--red);
  z-index: 2;
}

.scene-visual {
  flex: 1;
  position: relative;
  background: linear-gradient(to bottom, #1a2140 0%, #0d1226 100%);
  overflow: hidden;
}

.scene-buildings {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 0 10px;
}

.bld {
  flex: 1;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(238,240,242,0.12) 0 6px,
      transparent 6px 14px
    ),
    #161d38;
  border-top: 1px solid var(--wire);
}

.b1 { height: 55%; }
.b2 { height: 85%; }
.b3 { height: 65%; }
.b4 { height: 40%; }

.scene-label {
  padding: 6px 10px;
  font-family: 'TT Chiaro', monospace;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--red);
  border-top: 1px solid var(--red-dim);
  background: var(--navy-mid);
}

/* ---------- Content window ---------- */
.content-window {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.content-tab {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  border-bottom: 1px solid var(--red-dim);
  background: var(--navy-mid);
  font-family: 'TT Chiaro', monospace;
  font-size: 13px;
  letter-spacing: 0.06em;
}

.rec {
  color: var(--red);
  font-size: 10px;
  letter-spacing: 0.1em;
}

.content-body {
  padding: 20px 22px 26px;
  font-size: 14px;
  line-height: 1.7;
  flex: 1;
}

.pane { display: none; animation: pane-in 0.2s ease; }
.pane.active { display: block; }

@keyframes pane-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.entry-meta {
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--wire);
  text-transform: uppercase;
  margin-top: 0;
  margin-bottom: 16px;
  border-bottom: 1px dashed var(--wire-dim);
  padding-bottom: 8px;
}

/* ---------- About fact list ---------- */
.fact-list {
  list-style: none;
  padding: 0;
  margin-top: 20px;
  border-top: 1px solid var(--wire-dim);
}

.fact-list li {
  display: flex;
  gap: 14px;
  padding: 8px 0;
  border-bottom: 1px solid var(--wire-dim);
  font-size: 12px;
}

.fact-key {
  color: var(--wire);
  min-width: 130px;
  letter-spacing: 0.05em;
}

.fact-val {
  color: var(--bone);
}

/* ---------- Links ---------- */
.link-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.link-list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--wire-dim);
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.link-list a {
  color: var(--bone);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.link-list a:hover {
  color: var(--red);
}

.link-note {
  color: var(--wire);
  font-size: 11px;
}

/* ---------- Agenda / log entries ---------- */
.log-entry {
  border-left: 2px solid var(--red-dim);
  padding-left: 16px;
  margin-bottom: 26px;
}

.log-header {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--wire);
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.log-date { color: var(--red); }

.log-entry h3 {
  font-family: 'TT Chiaro', monospace;
  font-weight: normal;
  font-size: 17px;
  margin: 0 0 8px;
  color: var(--bone);
}

.log-entry p {
  margin: 0;
  font-size: 13px;
  color: #c7cbe0;
}

/* ---------- Agenda pagination ---------- */
.log-page {
  display: none;
}

.log-page.active {
  display: block;
  animation: pane-in 0.2s ease;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px dashed var(--wire-dim);
}

.page-btn {
  background: var(--cell-fill);
  border: 1px solid var(--red-dim);
  color: var(--bone);
  font-family: 'TT Chiaro', monospace;
  font-size: 11px;
  letter-spacing: 0.05em;
  padding: 7px 14px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.page-btn:hover:not(:disabled) {
  border-color: var(--red);
  background: var(--red-dim);
}

.page-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.page-indicator {
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--wire);
  min-width: 90px;
  text-align: center;
}

/* ---------- Guestbook ---------- */
.cbox-frame {
  border: 1px solid var(--wire);
  background: var(--navy);
  max-width: 480px;
  margin-bottom: 14px;
}

.cbox-frame iframe {
  display: block;
}

.guestbook-note {
  font-size: 11px;
  color: var(--wire);
  font-style: italic;
  max-width: 480px;
}

/* ---------- Gallery ---------- */
.gallery-page {
  display: none;
}

.gallery-page.active {
  display: block;
  animation: pane-in 0.2s ease;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
  margin-bottom: 4px;
}

.exhibit {
  border: 1px solid var(--wire-dim);
  background: var(--navy-panel);
  display: flex;
  flex-direction: column;
}

.exhibit-image {
  aspect-ratio: 4 / 3;
  border-bottom: 1px solid var(--wire-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--wire);
  letter-spacing: 0.08em;
  background:
    repeating-linear-gradient(45deg, var(--navy-mid) 0 8px, var(--navy-panel) 8px 16px);
}

.exhibit-caption {
  margin: 0;
  padding: 8px 10px;
  font-size: 11px;
  color: var(--wire);
  font-style: italic;
  line-height: 1.4;
}

/* ---------- Select grid (inventory-style nav) ---------- */
.select-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 26px;
}

.cell {
  aspect-ratio: 3 / 2;
  border: 1px solid var(--red-dim);
  background: var(--cell-fill);
  color: var(--bone);
  font-family: 'TT Chiaro', monospace;
  font-size: 12px;
  letter-spacing: 0.06em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.cell:hover {
  border-color: var(--red);
}

.cell.active {
  border-color: var(--red);
  background: var(--red-dim);
  box-shadow: inset 0 0 12px rgba(108,47,163,0.4);
}

.cell.empty {
  background: var(--navy-panel);
  border-color: var(--wire-dim);
  cursor: default;
  padding: 4px;
}

.clearance-note {
  color: #e0334a;
  font-size: 9px;
  letter-spacing: 0.04em;
  line-height: 1.4;
  text-align: center;
  opacity: 0.85;
}

/* ---------- Audio control ---------- */
.audio-control {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 1100px;
  margin: 10px auto 0;
  padding: 6px 14px;
  border: 1px solid var(--wire-dim);
  background: var(--navy-panel);
  width: fit-content;
}

.audio-btn {
  background: var(--cell-fill);
  border: 1px solid var(--red-dim);
  color: var(--bone);
  font-size: 11px;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.audio-btn:hover {
  border-color: var(--red);
  background: var(--red-dim);
}

.audio-btn.playing {
  border-color: var(--red);
  box-shadow: 0 0 8px var(--red);
}

.audio-label {
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--wire);
}

.audio-volume {
  -webkit-appearance: none;
  appearance: none;
  width: 80px;
  height: 3px;
  background: var(--wire-dim);
  outline: none;
  cursor: pointer;
}

.audio-volume::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--red);
  border: 1px solid var(--bone);
  box-shadow: 0 0 4px var(--red);
  cursor: pointer;
}

.audio-volume::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--red);
  border: 1px solid var(--bone);
  box-shadow: 0 0 4px var(--red);
  cursor: pointer;
}

.audio-volume::-moz-range-track {
  background: var(--wire-dim);
  height: 3px;
}

/* ---------- Dialogue box footer ---------- */
.dialogue-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 5;
  display: flex;
  justify-content: center;
  padding: 8px 20px;
  background: linear-gradient(to top, var(--navy) 60%, transparent);
}

.dialogue-box {
  width: 100%;
  max-width: 720px;
  background: #000;
  border: 1px solid var(--bone);
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  letter-spacing: 0.04em;
}

.advance-arrow {
  color: var(--bone);
  animation: blink 1s step-start infinite;
}

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

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .window-pair {
    grid-template-columns: 1fr;
  }
  .scene-window {
    min-height: 160px;
  }
  .select-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .crumb-row {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .crt-overlay, .advance-arrow, .pane.active, .stripe-strip {
    animation: none !important;
  }
}
