:root {
  --ivory: #f2ead8;
  --muted: rgba(235, 229, 213, 0.62);
  --faint: rgba(235, 229, 213, 0.24);
  --gold: #d5b274;
  --night: #09161d;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: 'Inter', Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body {
  background: var(--night);
  color: var(--ivory);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; }
button:focus-visible, a:focus-visible { outline: 1px solid var(--gold); outline-offset: 5px; }
button { border: 0; cursor: pointer; }
svg { display: block; }

#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#interface { position: fixed; inset: 0; z-index: 5; pointer-events: none; }
#interface button, #interface a, .detail-panel { pointer-events: auto; }

.film-grain {
  position: fixed; inset: -40%; z-index: 3; pointer-events: none; opacity: .045;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E");
  animation: grain .24s steps(2) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); }
  25% { transform: translate(3%, -2%); }
  50% { transform: translate(-2%, 3%); }
  75% { transform: translate(2%, 2%); }
  100% { transform: translate(-3%, -3%); }
}
.vignette {
  position: fixed; inset: 0; z-index: 2; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(2, 10, 14, .13) 68%, rgba(2, 8, 12, .48) 120%);
}
.letterbox { position: fixed; left: 0; right: 0; height: 3.2vh; background: #050b0e; z-index: 4; transition: transform 1.2s cubic-bezier(.22,.75,.24,1); pointer-events: none; }
.letterbox-top { top: 0; }
.letterbox-bottom { bottom: 0; }
.mode-explore .letterbox-top { transform: translateY(-105%); }
.mode-explore .letterbox-bottom { transform: translateY(105%); }

.masthead {
  position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between;
  padding: max(35px, 5.2vh) 3.6vw 0; z-index: 12;
}
.identity { color: var(--ivory); text-decoration: none; display: flex; align-items: center; gap: 13px; pointer-events: auto; }
.identity-mark { width: 28px; height: 39px; color: var(--gold); }
.identity-type { display: flex; flex-direction: column; gap: 3px; }
.identity-type strong { font-family: var(--serif); font-size: 24px; font-weight: 500; letter-spacing: .25em; line-height: 1; }
.identity-type small { font-size: 8px; font-weight: 500; letter-spacing: .22em; color: var(--muted); }
.mode-readout {
  position: absolute; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 9px;
  color: rgba(240,234,219,.72); font-size: 8px; letter-spacing: .22em; white-space: nowrap;
}
.live-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 9px rgba(213,178,116,.7); }
.mode-tour .live-dot { animation: pulse 2.5s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; box-shadow: 0 0 2px transparent; } }
.top-actions { display: flex; align-items: center; gap: 27px; }
.text-button, .skip-button, .replay-button { background: none; padding: 8px 0; font-size: 8px; font-weight: 500; letter-spacing: .17em; }
.text-button { display: flex; gap: 9px; align-items: center; color: var(--muted); transition: color .25s; }
.text-button:hover { color: var(--ivory); }
.text-button svg { width: 16px; height: 16px; }
.skip-button, .replay-button {
  display: flex; align-items: center; justify-content: center; gap: 15px; border: 1px solid rgba(235,229,213,.35);
  min-height: 39px; padding: 0 17px; backdrop-filter: blur(8px); background: rgba(9,20,26,.12); transition: background .25s, border-color .25s;
}
.skip-button:hover, .replay-button:hover { background: rgba(235,229,213,.1); border-color: var(--gold); }
.skip-button svg, .replay-button svg { width: 17px; height: 17px; }
.replay-button { display: none; }
.mode-explore .skip-button { display: none; }
.mode-explore .replay-button { display: flex; }

.chapter-heading { position: absolute; top: 20%; left: 6.4vw; max-width: 360px; transition: opacity .8s, transform .8s; }
.chapter-rule { width: 28px; height: 1px; background: var(--gold); margin-bottom: 18px; }
.chapter-heading p { margin: 0 0 10px; color: var(--gold); font-size: 8px; letter-spacing: .24em; }
.chapter-heading h1 { margin: 0; font-family: var(--serif); font-size: clamp(28px, 3vw, 48px); font-weight: 400; line-height: 1.03; text-wrap: balance; text-shadow: 0 2px 20px rgba(0,0,0,.18); }
.mode-explore .chapter-heading { opacity: 0; transform: translateY(12px); }

.caption-wrap {
  position: absolute; bottom: max(108px, 14vh); left: 50%; transform: translate(-50%, 8px); width: min(760px, 76vw);
  text-align: center; opacity: 0; transition: opacity .65s ease, transform .65s ease;
  text-shadow: 0 2px 18px rgba(0,0,0,.55);
}
.caption-wrap.visible { opacity: 1; transform: translate(-50%, 0); }
.caption-eyebrow { margin: 0 0 10px; color: var(--gold); font-size: 8px; font-weight: 500; letter-spacing: .28em; }
.caption-text { margin: 0; font-family: var(--serif); font-size: clamp(22px, 2.2vw, 34px); line-height: 1.2; font-weight: 400; text-wrap: balance; }
.mode-explore .caption-wrap { display: none; }

.tour-timeline { position: absolute; bottom: max(40px, 5.5vh); left: 6.4vw; right: 6.4vw; transition: opacity .7s, transform .7s; }
.timeline-track { position: relative; display: block; width: 100%; height: 18px; padding: 0; background: none; }
.timeline-base, .timeline-progress { position: absolute; left: 0; top: 8px; height: 1px; }
.timeline-base { width: 100%; background: rgba(235,229,213,.22); }
.timeline-progress { width: 0; background: var(--gold); box-shadow: 0 0 8px rgba(213,178,116,.3); }
.timeline-progress::after { content: ''; position: absolute; right: -2px; top: -2px; width: 5px; height: 5px; border-radius: 50%; background: var(--ivory); }
.timeline-chapters { position: absolute; inset: 0; }
.timeline-tick { position: absolute; top: 5px; width: 1px; height: 7px; background: rgba(235,229,213,.5); }
.timeline-meta { display: flex; justify-content: space-between; margin-top: 5px; font-size: 8px; letter-spacing: .14em; color: var(--muted); font-variant-numeric: tabular-nums; }
.timeline-hint { position: absolute; left: 50%; transform: translateX(-50%); font-size: 7px; letter-spacing: .25em; }
.mode-explore .tour-timeline { opacity: 0; transform: translateY(12px); pointer-events: none; }
.mode-explore .tour-timeline button { pointer-events: none; }

.explore-intro { position: absolute; top: 19%; left: 5vw; opacity: 0; transform: translateY(15px); transition: opacity 1s .35s, transform 1s .35s; }
.mode-explore .explore-intro { opacity: 1; transform: translateY(0); }
.mode-tour .explore-intro, .mode-tour .explore-footer, .mode-tour .hotspots { opacity: 0; transition: none; }
.mode-tour .detail-panel { display: none; }
.eyebrow { margin: 0 0 15px; font-size: 8px; font-weight: 500; letter-spacing: .25em; color: var(--gold); }
.explore-intro h1 { margin: 0 0 17px; font-family: var(--serif); font-size: clamp(34px, 3.5vw, 56px); font-weight: 400; line-height: .98; text-shadow: 0 2px 22px rgba(0,0,0,.25); }
.explore-intro > p:last-child { margin: 0; color: var(--muted); font-size: 9px; line-height: 1.9; letter-spacing: .06em; }
.mode-explore.has-detail .explore-intro { opacity: 0; transition-delay: 0s; }

.explore-footer { position: absolute; bottom: max(29px, 4vh); left: 3.6vw; right: 3.6vw; display: flex; align-items: center; justify-content: space-between; opacity: 0; transform: translateY(10px); transition: opacity .8s .4s, transform .8s .4s; }
.mode-explore .explore-footer { opacity: 1; transform: translateY(0); }
.control-guide { display: flex; align-items: center; gap: 17px; }
.guide-item { display: flex; align-items: center; gap: 9px; font-size: 7px; letter-spacing: .13em; color: var(--muted); }
.guide-item strong { color: var(--ivory); font-weight: 500; margin-right: 3px; }
.guide-item svg { width: 20px; height: 20px; color: var(--gold); }
.guide-divider { width: 1px; height: 16px; background: var(--faint); }
.reconstruction-note { display: flex; align-items: center; gap: 10px; padding: 8px 0; background: none; color: var(--muted); font-size: 7px; letter-spacing: .14em; }
.reconstruction-note:hover { color: var(--ivory); }
.small-diamond { width: 5px; height: 5px; display: inline-block; flex: 0 0 auto; border: 1px solid var(--gold); transform: rotate(45deg); }

.hotspots { position: absolute; inset: 0; overflow: hidden; pointer-events: none; opacity: 0; transition: opacity .7s .2s; }
.mode-explore .hotspots { opacity: 1; }
.hotspot {
  position: absolute; top: 0; left: 0; display: flex; align-items: center; gap: 9px; padding: 10px 12px 10px 9px;
  border: 0; background: transparent; white-space: nowrap; will-change: transform; transition: opacity .25s, background .25s;
  pointer-events: auto; color: var(--ivory); text-shadow: 0 1px 7px rgba(0,0,0,.8);
}
.hotspot-dot { position: relative; display: block; width: 19px; height: 19px; border: 1px solid rgba(242,234,216,.65); border-radius: 50%; background: rgba(6,17,23,.25); backdrop-filter: blur(4px); }
.hotspot-dot::before { content: ''; position: absolute; width: 5px; height: 5px; left: 6px; top: 6px; background: var(--ivory); border-radius: 50%; box-shadow: 0 0 8px rgba(255,238,190,.5); transition: background .25s; }
.hotspot-dot::after { content: ''; position: absolute; inset: -5px; border: 1px solid rgba(242,234,216,.12); border-radius: 50%; }
.hotspot-label { font-size: 8px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; }
.hotspot:hover .hotspot-dot, .hotspot.active .hotspot-dot { border-color: var(--gold); background: rgba(213,178,116,.12); }
.hotspot:hover .hotspot-dot::before, .hotspot.active .hotspot-dot::before { background: var(--gold); }
.hotspot.active .hotspot-label { color: var(--gold); }

.detail-panel {
  position: absolute; top: 16%; right: 3.6vw; width: min(360px, 32vw); padding: 34px 32px 30px;
  background: linear-gradient(145deg, rgba(13,29,36,.94), rgba(8,20,26,.89)); border: 1px solid rgba(213,178,116,.23);
  backdrop-filter: blur(20px); opacity: 0; transform: translateX(25px); visibility: hidden; transition: opacity .45s, transform .45s, visibility .45s;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.detail-panel.open { opacity: 1; transform: translateX(0); visibility: visible; }
.icon-button { display: grid; place-items: center; width: 32px; height: 32px; padding: 7px; background: transparent; color: var(--muted); transition: color .2s, background .2s; }
.icon-button:hover { color: var(--ivory); background: rgba(255,255,255,.05); }
.icon-button svg { width: 100%; height: 100%; }
.detail-close { position: absolute; right: 13px; top: 13px; }
.detail-index { color: var(--muted); font-size: 8px; letter-spacing: .15em; margin-bottom: 28px; }
.detail-evidence { display: inline-flex; align-items: center; margin: 0 0 12px; color: var(--gold); font-size: 7px; letter-spacing: .19em; }
.detail-evidence::before { content: ''; width: 4px; height: 4px; border: 1px solid var(--gold); transform: rotate(45deg); margin-right: 8px; }
.detail-panel h2 { margin: 0 0 5px; font-family: var(--serif); font-size: 35px; line-height: 1.05; font-weight: 400; }
.detail-subtitle { margin: 0; color: var(--muted); font-family: var(--serif); font-style: italic; font-size: 16px; }
.detail-rule { width: 100%; height: 1px; background: var(--faint); margin: 23px 0; }
.detail-copy { margin: 0; color: rgba(240,234,219,.76); font-family: var(--serif); font-size: 17px; line-height: 1.45; user-select: text; }
.detail-facts { margin: 23px 0 0; display: grid; gap: 9px; }
.detail-facts div { display: flex; justify-content: space-between; gap: 12px; font-size: 8px; line-height: 1.5; letter-spacing: .06em; }
.detail-facts dt { color: var(--muted); }
.detail-facts dd { margin: 0; text-align: right; color: var(--ivory); }
.focus-button { display: flex; align-items: center; justify-content: space-between; width: 100%; margin-top: 27px; padding: 13px 0 5px; border-top: 1px solid var(--faint); background: none; color: var(--gold); font-size: 8px; letter-spacing: .18em; }
.focus-button svg { width: 19px; height: 19px; }

.toast { position: absolute; left: 50%; bottom: 12vh; transform: translate(-50%, 15px); padding: 13px 20px; border: 1px solid rgba(213,178,116,.25); background: rgba(7,20,26,.75); backdrop-filter: blur(12px); color: var(--ivory); font-family: var(--serif); font-size: 17px; opacity: 0; transition: opacity .5s, transform .5s; white-space: nowrap; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.about-modal { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; visibility: hidden; opacity: 0; transition: opacity .4s, visibility .4s; }
.about-modal.open { visibility: visible; opacity: 1; }
.about-backdrop { position: absolute; inset: 0; background: rgba(3,11,15,.72); backdrop-filter: blur(9px); }
.about-card { position: relative; width: min(790px, calc(100vw - 48px)); max-height: 88vh; overflow: auto; padding: 52px 55px 38px; border: 1px solid rgba(213,178,116,.27); background: #0c2028; box-shadow: 0 30px 100px rgba(0,0,0,.45); transform: translateY(12px); transition: transform .45s; }
.about-modal.open .about-card { transform: translateY(0); }
.about-close { position: absolute; top: 18px; right: 18px; }
.about-card h2 { margin: 0 0 17px; font-family: var(--serif); font-size: clamp(38px, 5vw, 55px); font-weight: 400; line-height: 1; }
.about-lead { max-width: 620px; margin: 0; font-family: var(--serif); font-size: 19px; line-height: 1.45; color: rgba(242,234,216,.78); user-select: text; }
.about-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 38px; margin-top: 32px; padding-top: 28px; border-top: 1px solid var(--faint); }
.about-columns h3 { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-family: var(--sans); font-size: 9px; letter-spacing: .1em; font-weight: 500; text-transform: uppercase; }
.about-columns h3 span { color: var(--gold); font-family: var(--serif); font-size: 17px; font-weight: 400; }
.about-columns p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.75; user-select: text; }
.about-footnote { display: flex; align-items: flex-start; gap: 13px; margin-top: 27px; padding: 17px; background: rgba(213,178,116,.05); }
.about-footnote .small-diamond { margin-top: 5px; }
.about-footnote p { margin: 0; color: var(--muted); font-size: 9px; line-height: 1.65; }
.about-return { display: flex; justify-content: space-between; align-items: center; width: 100%; margin-top: 25px; padding: 17px 0 0; border-top: 1px solid var(--faint); background: none; color: var(--gold); font-size: 8px; letter-spacing: .2em; }
.about-return span { font-size: 17px; }

.loading-screen { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center; background: #091920; transition: opacity 1.2s ease, visibility 1.2s; }
.loading-screen.done { opacity: 0; visibility: hidden; pointer-events: none; }
.loading-emblem { color: var(--gold); margin-bottom: 23px; }
.loading-emblem svg { width: 50px; height: 64px; }
.loading-title { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 31px; letter-spacing: .34em; text-indent: .34em; }
.loading-subtitle { margin: 10px 0 25px; color: var(--muted); font-size: 7px; letter-spacing: .27em; }
.loading-line { width: 130px; height: 1px; background: rgba(255,255,255,.1); overflow: hidden; }
.loading-line span { display: block; width: 45%; height: 1px; background: var(--gold); animation: loading 1.5s ease-in-out infinite; }
@keyframes loading { from { transform: translateX(-110%); } to { transform: translateX(330%); } }
.noscript { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 30px; background: #091920; color: var(--ivory); font-family: var(--serif); font-size: 24px; text-align: center; }

@media (max-width: 900px) {
  .masthead { padding-left: 24px; padding-right: 24px; }
  .about-button span { display: none; }
  .top-actions { gap: 15px; }
  .chapter-heading { left: 6vw; max-width: 280px; }
  .detail-panel { width: min(350px, 44vw); right: 24px; padding: 30px 25px 25px; }
  .explore-intro { left: 30px; }
  .reconstruction-note { max-width: 230px; text-align: right; line-height: 1.6; }
  .guide-pan, .guide-divider:last-of-type { display: none; }
}

@media (max-width: 640px) {
  .letterbox { height: 2vh; }
  .masthead { padding: max(26px, 4vh) 18px 0; align-items: flex-start; }
  .identity-mark { width: 22px; height: 32px; }
  .identity { gap: 9px; }
  .identity-type strong { font-size: 20px; }
  .identity-type small { font-size: 6px; }
  .mode-readout { top: 76px; font-size: 6px; }
  .top-actions { gap: 10px; }
  .skip-button, .replay-button { min-height: 34px; padding: 0 11px; font-size: 7px; gap: 8px; }
  .skip-button svg, .replay-button svg { width: 14px; height: 14px; }
  .chapter-heading { top: 110px; left: 22px; max-width: 200px; }
  .chapter-heading h1 { font-size: 26px; text-shadow: 0 2px 14px rgba(0,0,0,.45); }
  .chapter-heading p { font-size: 6px; margin-bottom: 7px; }
  .chapter-rule { margin-bottom: 10px; width: 20px; }
  .caption-wrap { width: calc(100vw - 38px); bottom: 125px; }
  .caption-text { font-size: 23px; }
  .caption-eyebrow { font-size: 6px; }
  .tour-timeline { left: 22px; right: 22px; bottom: 48px; }
  .timeline-hint { display: none; }
  .explore-intro { top: 16%; left: 22px; }
  .explore-intro h1 { font-size: 37px; }
  .explore-intro > p:last-child { font-size: 8px; }
  .hotspot { padding: 8px; }
  .hotspot-label { display: none; }
  .hotspot.active .hotspot-label { display: block; font-size: 7px; }
  .detail-panel { top: auto; left: 14px; right: 14px; bottom: 85px; width: auto; max-height: 56vh; overflow-y: auto; padding: 24px 25px 20px; }
  .detail-index { margin-bottom: 14px; }
  .detail-panel h2 { font-size: 29px; }
  .detail-copy { font-size: 15px; }
  .detail-rule { margin: 16px 0; }
  .detail-facts { margin-top: 15px; }
  .focus-button { margin-top: 18px; }
  .explore-footer { left: 20px; right: 20px; bottom: 25px; justify-content: center; }
  .control-guide { gap: 13px; }
  .reconstruction-note { position: absolute; right: 0; bottom: 45px; width: 30px; overflow: hidden; color: var(--gold); font-size: 0; }
  .reconstruction-note .small-diamond { width: 7px; height: 7px; }
  .guide-item { font-size: 6px; }
  .toast { bottom: 86px; font-size: 14px; max-width: 90vw; white-space: normal; text-align: center; }
  .about-card { width: calc(100vw - 26px); padding: 40px 25px 25px; max-height: 90vh; }
  .about-card h2 { font-size: 39px; }
  .about-lead { font-size: 17px; }
  .about-columns { grid-template-columns: 1fr; gap: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .film-grain, .live-dot, .loading-line span { animation: none; }
  *, *::before, *::after { scroll-behavior: auto !important; }
}
