:root {
  --navy: #061725;
  --blue: #0d669a;
  --light-blue: #7db9dc;
  --signal: #e87a3b;
  --white: #fff;
  --panel: rgba(5,22,35,.94);
  --line: rgba(255,255,255,.2);
  --sans: Inter, "Helvetica Neue", Arial, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; font-family: var(--sans); color: white; background: #000; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, summary:focus-visible { outline: 3px solid #ffba78; outline-offset: 3px; }
.skip-link { position: fixed; z-index: 1000; left: 1rem; top: -5rem; padding: .8rem 1rem; color: #000; background: #fff; }
.skip-link:focus { top: 1rem; }
#pano { position: fixed; inset: 0; filter: brightness(var(--scene-brightness,1)); }
.viewer-shade { pointer-events: none; position: fixed; inset: 0; background: linear-gradient(to bottom,rgba(0,0,0,.6),transparent 17%,transparent 68%,rgba(0,0,0,.74)); }

.tour-header { position: fixed; z-index: 20; left: 0; right: 0; top: 0; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 70px; padding: .6rem clamp(.7rem,2vw,1.5rem); background: linear-gradient(to bottom,rgba(3,15,24,.94),rgba(3,15,24,.72)); border-bottom: 1px solid var(--line); }
.tour-brand { display: grid; grid-template-columns: 34px auto; grid-template-rows: auto auto; gap: 0 .7rem; color: white; text-decoration: none; }
.tour-brand > span { grid-row: 1 / 3; display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid rgba(255,255,255,.5); border-radius: 50%; font-size: .68rem; font-weight: 800; }
.tour-brand strong { align-self: end; font-size: .78rem; text-transform: uppercase; letter-spacing: .13em; }
.tour-brand small { color: rgba(255,255,255,.55); font-size: .61rem; letter-spacing: .08em; }
.scene-readout { display: grid; grid-template-columns: auto auto; gap: .75rem; align-items: baseline; }
.scene-readout span { color: var(--light-blue); font-size: .62rem; font-weight: 800; letter-spacing: .14em; }
.scene-readout strong { font-family: var(--serif); font-size: 1rem; font-weight: 400; }
.tour-header nav { justify-self: end; display: flex; align-items: center; gap: .75rem; }
.tour-header nav a { color: rgba(255,255,255,.72); font-size: .64rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; text-decoration: none; }
.tour-header button { display: grid; place-items: center; width: 42px; height: 42px; color: white; border: 1px solid var(--line); background: rgba(0,0,0,.25); cursor: pointer; }
.tour-header svg, .control-ribbon svg { width: 19px; height: 19px; fill: currentColor; }

.audio-dock { position: fixed; z-index: 30; right: 1.2rem; top: 86px; width: min(390px,calc(100vw - 2rem)); color: white; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 18px 55px rgba(0,0,0,.4); backdrop-filter: blur(12px); }
.audio-dock.is-minimized { width: min(320px,calc(100vw - 2rem)); }
.audio-drag { display: flex; justify-content: center; gap: 4px; height: 12px; cursor: move; background: rgba(255,255,255,.04); }
.audio-drag i { width: 22px; height: 1px; margin-top: 5px; background: rgba(255,255,255,.25); }
.audio-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: .65rem .8rem .7rem; border-bottom: 1px solid var(--line); }
.audio-head div { min-width: 0; }
.audio-head span { display: block; color: var(--light-blue); font-size: .58rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.audio-head strong { display: block; overflow: hidden; margin-top: .25rem; font-family: var(--serif); font-size: 1rem; font-weight: 400; text-overflow: ellipsis; white-space: nowrap; }
.audio-head button { flex: 0 0 auto; width: 28px; height: 28px; color: white; border: 0; background: transparent; cursor: pointer; }
#audio-body { padding: .8rem; }
.audio-controls { display: grid; grid-template-columns: 30px 42px 30px 1fr auto; gap: .4rem; align-items: center; }
.audio-controls button { display: grid; place-items: center; height: 32px; color: white; border: 1px solid var(--line); background: rgba(255,255,255,.05); cursor: pointer; }
.audio-controls .audio-play { width: 42px; height: 42px; border-radius: 50%; color: var(--navy); border-color: var(--signal); background: var(--signal); }
.audio-controls .audio-play:disabled { cursor: not-allowed; color: rgba(255,255,255,.45); border-color: rgba(255,255,255,.2); background: rgba(255,255,255,.08); }
.audio-play svg { width: 18px; height: 18px; fill: currentColor; }
.audio-play .pause-icon { display: none; }
.audio-play.is-playing .play-icon { display: none; }
.audio-play.is-playing .pause-icon { display: block; }
.audio-controls input { min-width: 0; accent-color: var(--signal); }
.audio-controls > span { font-size: .58rem; color: rgba(255,255,255,.62); white-space: nowrap; }
.transcript-chyron { max-height: 3.4em; overflow: hidden; margin-top: .7rem; padding: .55rem .65rem; color: rgba(255,255,255,.78); background: rgba(255,255,255,.055); border-left: 2px solid var(--signal); font-family: var(--serif); font-size: .77rem; line-height: 1.55; }
.audio-dock details { margin-top: .55rem; }
.audio-dock summary { color: var(--light-blue); cursor: pointer; font-size: .61rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
#transcript-text { max-height: 190px; overflow: auto; padding: .7rem 0 .2rem; color: rgba(255,255,255,.78); font-family: var(--serif); font-size: .8rem; line-height: 1.6; }

.scene-rail { position: fixed; z-index: 25; left: clamp(.5rem,2vw,1.5rem); right: clamp(.5rem,2vw,1.5rem); bottom: 86px; display: grid; grid-template-columns: 42px 1fr 42px; gap: .5rem; align-items: stretch; pointer-events: none; }
.scene-list { display: flex; gap: .45rem; overflow-x: auto; padding: .2rem; scrollbar-width: thin; pointer-events: auto; scroll-snap-type: x proximity; }
.scene-card { flex: 0 0 142px; display: grid; grid-template-columns: 54px 1fr; align-items: center; gap: .55rem; min-height: 58px; padding: .3rem; color: white; text-align: left; background: rgba(4,18,29,.82); border: 1px solid rgba(255,255,255,.2); backdrop-filter: blur(8px); cursor: pointer; scroll-snap-align: center; }
.scene-card img { width: 54px; height: 50px; object-fit: cover; }
.scene-card span { display: block; color: var(--light-blue); font-size: .52rem; font-weight: 800; letter-spacing: .1em; }
.scene-card strong { display: block; margin-top: .2rem; font-family: var(--serif); font-size: .72rem; font-weight: 400; line-height: 1.15; }
.scene-card.is-active { border-color: var(--signal); box-shadow: inset 0 -3px var(--signal); background: rgba(7,49,75,.94); }
.rail-step { pointer-events: auto; color: white; border: 1px solid var(--line); background: rgba(4,18,29,.85); cursor: pointer; }

.control-ribbon { position: fixed; z-index: 25; left: 50%; bottom: 14px; display: flex; align-items: center; gap: .35rem; padding: .35rem; background: rgba(4,18,29,.9); border: 1px solid var(--line); transform: translateX(-50%); backdrop-filter: blur(10px); }
.control-ribbon > button { display: grid; place-items: center; width: 42px; height: 42px; color: white; border: 0; background: transparent; cursor: pointer; }
.control-ribbon > button:hover { background: rgba(255,255,255,.08); }
.joypad { position: relative; width: 66px; height: 66px; margin: 0 .3rem; border: 1px solid rgba(255,255,255,.24); border-radius: 50%; }
.joypad button { position: absolute; width: 24px; height: 24px; padding: 0; color: white; border: 0; background: transparent; cursor: pointer; }
.joypad button:nth-of-type(1) { left: 21px; top: 0; }.joypad button:nth-of-type(2) { right: 0; top: 21px; }.joypad button:nth-of-type(3) { left: 21px; bottom: 0; }.joypad button:nth-of-type(4) { left: 0; top: 21px; }
.joypad span { position: absolute; left: 28px; top: 28px; width: 8px; height: 8px; border-radius: 50%; background: var(--signal); }

.settings-panel { position: fixed; z-index: 40; right: 1rem; top: 82px; width: min(340px,calc(100vw - 2rem)); padding: 1rem; color: white; background: rgba(4,18,29,.97); border: 1px solid var(--line); box-shadow: 0 22px 70px rgba(0,0,0,.45); }
.settings-panel[hidden] { display: none; }
.settings-head { display: flex; justify-content: space-between; align-items: center; padding-bottom: .8rem; border-bottom: 1px solid var(--line); }
.settings-head strong { text-transform: uppercase; letter-spacing: .13em; font-size: .7rem; }
.settings-head button { width: 32px; height: 32px; color: white; border: 0; background: transparent; font-size: 1.3rem; cursor: pointer; }
.setting-row { display: flex; justify-content: space-between; gap: 1rem; padding: .85rem 0; border-bottom: 1px solid rgba(255,255,255,.1); font-size: .78rem; }
.setting-row input { accent-color: var(--signal); }
.setting-range { display: grid; grid-template-columns: 1fr auto; gap: .55rem; padding: .85rem 0; font-size: .78rem; }
.setting-range input { grid-column: 1; accent-color: var(--signal); }.setting-range output { grid-column: 2; grid-row: 1 / 3; align-self: end; color: var(--light-blue); font-size: .7rem; }
.settings-panel fieldset { display: flex; flex-wrap: wrap; gap: .7rem 1rem; margin: 0; padding: .8rem 0; border: 0; border-top: 1px solid rgba(255,255,255,.1); }
.settings-panel legend { margin-bottom: .7rem; font-size: .7rem; font-weight: 700; }.settings-panel fieldset label { font-size: .7rem; }.settings-panel fieldset input { accent-color: var(--signal); }
.keyboard-guide { display: grid; gap: .35rem; padding: .75rem; color: rgba(255,255,255,.6); background: rgba(255,255,255,.05); font-size: .67rem; line-height: 1.5; }.keyboard-guide strong { color: white; text-transform: uppercase; letter-spacing: .1em; }
.load-status { position: fixed; z-index: 50; left: 50%; top: 50%; padding: .8rem 1rem; color: white; background: rgba(4,18,29,.94); border: 1px solid var(--line); transform: translate(-50%,-50%); font-size: .72rem; letter-spacing: .08em; }
.load-status.is-ready { opacity: 0; pointer-events: none; transition: opacity .5s; }

body.high-contrast { --panel: #000; }
body.high-contrast .tour-header, body.high-contrast .scene-card, body.high-contrast .control-ribbon { background: #000; border-color: #fff; }
body.reduce-motion *, body.reduce-motion *::before, body.reduce-motion *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }

@media (max-width: 780px) {
  .tour-header { grid-template-columns: 1fr auto; }
  .scene-readout { display: none; }
  .tour-header nav a { display: none; }
  .audio-dock { top: 76px; right: .65rem; }
  .scene-rail { bottom: 82px; }
  .scene-card { flex-basis: 128px; grid-template-columns: 46px 1fr; }
  .scene-card img { width: 46px; height: 44px; }
  .control-ribbon { bottom: 9px; }
}

@media (max-width: 520px) {
  .tour-brand small { display: none; }
  .tour-brand { grid-template-rows: auto; }
  .tour-brand > span { grid-row: 1; }
  .audio-dock { width: calc(100vw - 1.3rem); }
  .audio-controls { grid-template-columns: 28px 40px 28px 1fr; }
  .audio-controls > span { display: none; }
  .scene-rail { grid-template-columns: 34px 1fr 34px; left: .35rem; right: .35rem; }
  .rail-step { padding: 0; }
  .control-ribbon > button { width: 34px; }
  #look-left { display: none; }
}

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