@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-display: swap;
  font-weight: 400 700;
  font-stretch: 75% 100%;
  src: url(../fonts/instrument-sans-latin-standard-normal.woff2) format('woff2');
}
@font-face {
  font-family: 'Instrument Sans';
  font-style: italic;
  font-display: swap;
  font-weight: 400 700;
  font-stretch: 75% 100%;
  src: url(../fonts/instrument-sans-latin-standard-italic.woff2) format('woff2');
}
@font-face {
  font-family: 'Martian Mono';
  font-weight: 300;
  font-display: swap;
  src: url(../fonts/martian-mono-latin-300-normal.woff2) format('woff2');
}
@font-face {
  font-family: 'Martian Mono';
  font-weight: 400;
  font-display: swap;
  src: url(../fonts/martian-mono-latin-400-normal.woff2) format('woff2');
}

:root {
  --accent: #9da8ff;
  --accent-soft: rgba(157, 168, 255, 0.16);
  --text: #e6f1f3;
  --text-2: #93a9b0;
  --text-3: #5f767d;
  --glass: rgba(11, 25, 33, 0.5);
  --glass-strong: rgba(9, 20, 27, 0.78);
  --line: rgba(190, 230, 240, 0.11);
  --line-2: rgba(190, 230, 240, 0.2);
  --hover: rgba(190, 230, 240, 0.06);
  --sans: 'Instrument Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Martian Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --gap: 18px;
  --rail-w: 212px;
  --insp-w: 344px;
  --dock-h: 58px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #061520; }
body {
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.45;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 1.5px solid var(--accent); outline-offset: 2px; }

#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#leaders { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
#labels { position: fixed; inset: 0; pointer-events: none; z-index: 3; }

.panel {
  background: var(--glass);
  -webkit-backdrop-filter: blur(22px) saturate(1.35);
  backdrop-filter: blur(22px) saturate(1.35);
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.045);
  z-index: 10;
}

/* ---------- Brand ---------- */
.brand {
  position: fixed; top: var(--gap); left: calc(var(--gap) + 4px); z-index: 10;
  display: flex; align-items: center; gap: 11px; color: var(--text);
}
.brand-mark { width: 34px; height: 34px; color: var(--text); }
.brand-mark.big { width: 44px; height: 44px; }
.brand-name { font-weight: 600; font-size: 17.5px; font-stretch: 82%; letter-spacing: 0.01em; line-height: 1.1; }
.brand-sub { color: var(--text-2); font-size: 12px; line-height: 1.2; }

/* ---------- Design credit ---------- */
.credit {
  position: fixed; right: calc(var(--gap) + 6px); bottom: calc(var(--gap) + 6px); z-index: 9;
  font-family: var(--mono); font-size: 9.5px; font-weight: 400; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-2); text-decoration: none; padding: 6px 2px; text-shadow: 0 1px 8px rgba(0, 0, 0, 0.55); transition: color 0.15s, opacity 0.6s ease;
}
.credit:hover, .credit:focus-visible { color: var(--accent); }

/* ---------- Specimen rail ---------- */
.rail {
  position: fixed; left: var(--gap); top: 72px; width: var(--rail-w);
  border-radius: 16px; padding: 6px;
  display: flex; flex-direction: column; gap: 1px;
  max-height: calc(100vh - 72px - 110px); overflow-y: auto; scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }
.spec {
  display: grid; grid-template-columns: 46px 1fr; gap: 11px; align-items: center;
  padding: 5px 7px; border-radius: 11px; text-align: left; position: relative; flex: none;
  transition: background 0.18s;
}
.spec:hover { background: var(--hover); }
.spec[aria-current='true'] { background: rgba(190, 230, 240, 0.085); }
.spec[aria-current='true']::before {
  content: ''; position: absolute; left: -6px; top: 12px; bottom: 12px; width: 2px; border-radius: 2px; background: var(--accent);
}
.spec-thumb {
  width: 46px; height: 46px; border-radius: 9px; overflow: hidden; background: #08202a;
  border: 1px solid var(--line);
}
.spec-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.spec-name { font-weight: 560; font-size: 13.5px; line-height: 1.2; }
.spec-latin { font-style: italic; color: var(--text-2); font-size: 11.5px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spec-size { font-family: var(--mono); font-size: 9.5px; color: var(--text-3); margin-top: 2px; letter-spacing: 0.02em; }

/* ---------- Inspector ---------- */
.inspector {
  position: fixed; right: var(--gap); top: calc(var(--gap) + 52px); bottom: calc(var(--gap) + var(--dock-h) + 14px);
  width: var(--insp-w); border-radius: 18px; overflow: hidden; display: flex; flex-direction: column;
}
.insp-scroll { overflow-y: auto; padding: 22px 20px 18px; scrollbar-width: thin; scrollbar-color: rgba(190, 230, 240, 0.15) transparent; }
.insp-kicker { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 11.5px; }
.chip {
  display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 999px;
  border: 1px solid var(--line-2); color: var(--text); font-size: 11px;
}
.inspector h1 {
  margin: 14px 0 0; font-weight: 620; font-size: 34px; line-height: 1.02; font-stretch: 76%; letter-spacing: -0.005em;
}
.latin { font-style: italic; color: var(--text-2); font-size: 15px; margin-top: 4px; }
.summary { margin: 14px 0 0; color: #c3d3d7; font-size: 13px; line-height: 1.55; max-width: 34em; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; margin: 18px 0 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.stats div { padding: 10px 0 11px; }
.stats div + div { padding-left: 12px; border-left: 1px solid var(--line); }
.stats dt { color: var(--text-3); font-size: 11px; }
.stats dd { margin: 2px 0 0; font-size: 12.5px; line-height: 1.3; }

.actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.actions[hidden] { display: none; }
.btn-act {
  height: 30px; padding: 0 12px 0 10px; border-radius: 9px; font-size: 12px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid rgba(157, 168, 255, 0.35); background: var(--accent-soft); color: var(--text);
  transition: background 0.15s, border-color 0.15s;
}
.btn-act:hover { background: rgba(157, 168, 255, 0.26); border-color: rgba(157, 168, 255, 0.6); }
.act-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.btn-act.fired .act-dot { animation: ping 0.7s ease-out; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(157, 168, 255, 0.9); } 100% { box-shadow: 0 0 0 10px rgba(157, 168, 255, 0); } }
.inspector h2 { font-size: 12.5px; font-weight: 600; margin: 0; color: var(--text); }
.anatomy { margin-top: 22px; }
.sec-row { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.sec-count { font-family: var(--mono); font-size: 10px; color: var(--text-3); }
.parts { list-style: none; margin: 0 -8px; padding: 0; }
.part { border-radius: 10px; transition: background 0.15s; }
.part-row {
  width: 100%; display: grid; grid-template-columns: 22px 10px 1fr auto; align-items: center; gap: 9px;
  padding: 7px 8px; text-align: left; border-radius: 10px;
}
.part:hover, .part.hover { background: var(--hover); }
.part.sel { background: rgba(157, 168, 255, 0.09); }
.p-idx { font-family: var(--mono); font-size: 9.5px; color: var(--text-3); text-align: right; }
.part.sel .p-idx { color: var(--accent); }
.p-dot { width: 8px; height: 8px; border-radius: 50%; box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.25); }
.p-name { font-size: 13px; font-weight: 500; }
.p-role { font-size: 11px; color: var(--text-3); }
.part-body { display: none; padding: 2px 10px 12px 49px; }
.part.sel .part-body { display: block; animation: rise 0.22s ease-out; }
.part-body p { margin: 0 0 8px; color: #c3d3d7; line-height: 1.55; }
.part-body .p-fact { color: var(--text-2); font-size: 12px; padding-left: 10px; border-left: 2px solid var(--accent-soft); }
.part-body .p-size { font-family: var(--mono); font-size: 10px; color: var(--text-2); margin-bottom: 8px; }
.p-actions { display: flex; gap: 6px; margin-top: 10px; }
.btn-s {
  height: 26px; padding: 0 11px; border-radius: 8px; border: 1px solid var(--line-2); font-size: 11.5px; color: var(--text);
  transition: background 0.15s, border-color 0.15s;
}
.btn-s:hover { background: var(--hover); border-color: rgba(190, 230, 240, 0.3); }
.btn-s[aria-pressed='true'] { background: var(--accent-soft); border-color: rgba(157, 168, 255, 0.45); }
@keyframes rise { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }

.notable { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.notable p { margin: 6px 0 0; color: var(--text-2); line-height: 1.55; }

/* ---------- Readout (instrument status) ---------- */
.readout {
  position: fixed; top: calc(var(--gap) + 6px); z-index: 9;
  left: calc(var(--gap) + var(--rail-w) + 24px); right: calc(var(--gap) + var(--insp-w) + 24px);
  display: flex; justify-content: center; flex-wrap: wrap; gap: 4px 22px;
  font-family: var(--mono); font-size: 9.5px; font-weight: 300; color: var(--text-2); letter-spacing: 0.02em;
  pointer-events: none;
}
.readout span b { font-weight: 400; color: var(--text); }
.readout .warn { color: #e8c48a; }

/* ---------- Optics: scale bar + channels ---------- */
.optics {
  position: fixed; left: calc(var(--gap) + 6px); bottom: calc(var(--gap) + 6px); z-index: 9;
  display: flex; flex-direction: column; gap: 14px; pointer-events: none;
}
.scalebar { display: flex; flex-direction: column; gap: 5px; }
.sb-label { font-family: var(--mono); font-size: 10.5px; color: var(--text); }
.sb-bar { height: 6px; border: 1.5px solid var(--text); border-top: 0; width: 100px; transition: width 0.2s; }
.sb-mag { font-family: var(--mono); font-size: 9.5px; color: var(--text-2); font-weight: 300; }
.channels[hidden] { display: none; }
.channels { display: flex; flex-direction: column; gap: 5px; font-size: 11.5px; }
.channels div { display: flex; align-items: center; gap: 8px; }
.channels i { width: 8px; height: 8px; border-radius: 50%; box-shadow: 0 0 10px currentColor; }
.channels span { color: var(--text-2); }

/* ---------- Dock ---------- */
.dock {
  position: fixed; bottom: var(--gap); left: 50%; transform: translateX(-50%);
  height: var(--dock-h); border-radius: 16px; padding: 0 9px;
  display: flex; align-items: center; gap: 10px; max-width: calc(100vw - 2 * var(--gap));
}
.dock-div { width: 1px; height: 26px; background: var(--line); }
.seg { display: flex; padding: 3px; border-radius: 11px; background: rgba(0, 0, 0, 0.18); border: 1px solid rgba(190, 230, 240, 0.06); }
.seg button {
  height: 32px; padding: 0 13px; border-radius: 8px; font-size: 12.5px; font-weight: 500; color: var(--text-2);
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; transition: color 0.15s, background 0.15s;
}
.seg button:hover { color: var(--text); }
.seg button[aria-checked='true'] { color: var(--text); background: rgba(190, 230, 240, 0.1); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06); }
.sw { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.sw-live { background: radial-gradient(circle at 35% 35%, #d9f3f2, #5b9aa3); }
.sw-fluo { background: conic-gradient(#5b7cff 0 25%, #3dff8f 0 50%, #ff3d8b 0 75%, #ffcf4a 0); }
.sw-sem { background: radial-gradient(circle at 35% 35%, #f4f4f4, #4a4a4a); }
.sw-dark { background: radial-gradient(circle, #050608 45%, #f3ecd8 58%, #050608 75%); }
.sw-phase { background: radial-gradient(circle at 40% 40%, #2c302d 30%, #e4e8e4 62%, #7d827e 80%); }
.l-short { display: none; }
@media (max-width: 1320px) { .l-full { display: none; } .l-short { display: inline; } .seg button { padding: 0 10px; } }
.ctx {
  position: fixed; left: 50%; bottom: calc(var(--gap) + var(--dock-h) + 10px); transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px; height: 44px; padding: 0 14px; border-radius: 13px; z-index: 10;
  animation: riseC 0.22s ease-out;
}
@keyframes riseC { from { opacity: 0; transform: translate(-50%, 4px); } to { opacity: 1; transform: translate(-50%, 0); } }
.ctx:empty { display: none; }
.ctx > div { display: flex; align-items: center; gap: 8px; }
.ctx label { font-size: 11.5px; color: var(--text-2); white-space: nowrap; }
.ctx .mini { display: flex; padding: 2px; border-radius: 8px; background: rgba(0, 0, 0, 0.18); }
.ctx .mini button { width: 26px; height: 26px; border-radius: 6px; font-family: var(--mono); font-size: 10.5px; color: var(--text-2); }
.ctx .mini button[aria-checked='true'] { background: rgba(190, 230, 240, 0.12); color: var(--text); }
.ctx .val { font-family: var(--mono); font-size: 10px; color: var(--text-2); min-width: 50px; white-space: nowrap; }
input[type='range'] { -webkit-appearance: none; appearance: none; width: 120px; height: 20px; background: transparent; cursor: pointer; }
input[type='range']::-webkit-slider-runnable-track { height: 2px; background: linear-gradient(to right, var(--accent) var(--p, 50%), rgba(190, 230, 240, 0.2) var(--p, 50%)); border-radius: 2px; }
input[type='range']::-moz-range-track { height: 2px; background: rgba(190, 230, 240, 0.2); border-radius: 2px; }
input[type='range']::-moz-range-progress { height: 2px; background: var(--accent); }
input[type='range']::-webkit-slider-thumb { -webkit-appearance: none; width: 13px; height: 13px; margin-top: -5.5px; border-radius: 50%; background: #eef4ff; border: 0; box-shadow: 0 0 0 4px rgba(157, 168, 255, 0.22); }
input[type='range']::-moz-range-thumb { width: 13px; height: 13px; border-radius: 50%; background: #eef4ff; border: 0; box-shadow: 0 0 0 4px rgba(157, 168, 255, 0.22); }
.tools { display: flex; gap: 2px; }
.icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; color: var(--text-2); transition: color 0.15s, background 0.15s; }
.icon svg { width: 18px; height: 18px; }
.icon:hover { color: var(--text); background: var(--hover); }
.icon[aria-pressed='true'] { color: var(--text); background: rgba(190, 230, 240, 0.09); }
#tMotion .ic-play { display: none; }
#tMotion[aria-pressed='false'] .ic-play { display: block; }
#tMotion[aria-pressed='false'] .ic-pause { display: none; }
#tMotion[aria-pressed='true'] { background: none; color: var(--text-2); }
#tMotion[aria-pressed='false'] { color: var(--accent); }

/* ---------- 3D labels ---------- */
.lbl {
  position: absolute; left: 0; top: 0; display: flex; align-items: center; gap: 7px; white-space: nowrap;
  font-size: 12px; font-weight: 500; color: var(--text); pointer-events: auto; cursor: pointer;
  padding: 3px 8px 3px 4px; border-radius: 999px;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6);
  transition: opacity 0.25s, background 0.15s, color 0.15s;
  will-change: transform;
}
.lbl.left { flex-direction: row-reverse; padding: 3px 4px 3px 8px; }
.lbl .n {
  font-family: var(--mono); font-size: 9px; width: 17px; height: 17px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid rgba(230, 241, 243, 0.4); color: var(--text-2); text-shadow: none; flex: none;
}
.lbl:hover, .lbl.hover { background: rgba(9, 20, 27, 0.6); }
.lbl.sel { color: #fff; background: rgba(157, 168, 255, 0.18); }
.lbl.sel .n { border-color: var(--accent); color: var(--accent); background: rgba(9, 20, 27, 0.6); }
.lbl.dim { opacity: 0.32; }
#leaders line, #leaders polyline { stroke: rgba(230, 241, 243, 0.38); stroke-width: 1; fill: none; }
#leaders circle { fill: #e6f1f3; }
#leaders .sel { stroke: var(--accent); }
#leaders circle.sel { fill: var(--accent); }
#leaders .dim { opacity: 0.3; }
#leaders .ring { fill: none; stroke: var(--accent); stroke-width: 1; }

#cursorTag {
  position: fixed; z-index: 20; pointer-events: none; padding: 4px 9px; border-radius: 8px; font-size: 12px;
  background: var(--glass-strong); border: 1px solid var(--line); opacity: 0; transition: opacity 0.15s;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}

/* ---------- Hint ---------- */
.hint {
  position: fixed; left: 50%; bottom: calc(var(--gap) + var(--dock-h) + 14px); transform: translateX(-50%);
  font-size: 11.5px; color: var(--text-2); z-index: 9; pointer-events: none; transition: opacity 0.6s;
}
.hint.gone, body.has-ctx .hint { opacity: 0; }

/* ---------- Loader ---------- */
.loader {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center;
  background: radial-gradient(ellipse at 50% 60%, #0d2a33 0%, #061520 60%);
  transition: opacity 0.8s ease;
}
.loader.done { opacity: 0; pointer-events: none; }
.loader-inner { display: flex; flex-direction: column; align-items: center; gap: 16px; color: var(--text); }
.loader-text { font-size: 12.5px; color: var(--text-2); }
.loader-bar { width: 160px; height: 1.5px; background: rgba(190, 230, 240, 0.15); border-radius: 2px; overflow: hidden; }
.loader-bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.3s; }

/* ---------- Top bar: tour, intro, language ---------- */
.topbar {
  position: fixed; top: var(--gap); right: var(--gap); z-index: 11; height: 40px;
  display: flex; align-items: center; justify-content: flex-end; gap: 8px; max-width: var(--insp-w);
}
.tb-btn {
  height: 38px; padding: 0 15px 0 13px; border-radius: 12px; display: inline-flex; align-items: center; gap: 8px;
  font-size: 12.5px; font-weight: 560; white-space: nowrap; color: var(--text);
  background: var(--glass); border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(22px) saturate(1.35); backdrop-filter: blur(22px) saturate(1.35);
  transition: background 0.15s, border-color 0.15s, box-shadow 0.2s, transform 0.15s;
}
.tb-btn svg { width: 15px; height: 15px; flex: none; }
.tb-btn:hover { background: rgba(23, 44, 55, 0.62); border-color: var(--line-2); }
.tb-btn.primary {
  color: #0b1124; background: linear-gradient(180deg, #b3bcff, #8f9bff); border-color: rgba(255, 255, 255, 0.25);
  box-shadow: 0 10px 28px -12px rgba(157, 168, 255, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
.tb-btn.primary:hover { transform: translateY(-1px); box-shadow: 0 14px 32px -12px rgba(157, 168, 255, 0.95), inset 0 1px 0 rgba(255, 255, 255, 0.5); }
.topbar .lang { background: var(--glass); -webkit-backdrop-filter: blur(22px); backdrop-filter: blur(22px); border-color: var(--line); height: 38px; align-items: center; }
.topbar .lang button { height: 30px; padding: 0 9px; font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.04em; }

/* ---------- Rail: show all ---------- */
.spec-all .spec-thumb {
  display: grid; place-items: center; color: var(--accent);
  background: radial-gradient(circle at 30% 30%, rgba(157, 168, 255, 0.28), rgba(157, 168, 255, 0.06) 70%), #0a1d27;
  border-color: rgba(157, 168, 255, 0.3);
}
.spec-all .spec-thumb svg { width: 30px; height: 30px; }
.spec-all .spec-name { color: var(--text); }
.spec-all .spec-latin { font-style: normal; }
.rail-sep { height: 1px; background: var(--line); margin: 4px 8px; flex: none; }

/* ---------- Size line-up ---------- */
.lu-scroll { display: none; overflow-y: auto; padding: 22px 20px 18px; scrollbar-width: thin; scrollbar-color: rgba(190, 230, 240, 0.15) transparent; }
body.lineup .insp-scroll { display: none; }
body.lineup .lu-scroll { display: block; }
.lu-hint { font-family: var(--mono); font-size: 9.5px; color: var(--text-3); margin: 12px 0 0; letter-spacing: 0.02em; }
.lu-list { list-style: none; margin: 16px -8px 0; padding: 0; }
.lu-row { display: flex; align-items: stretch; border-radius: 10px; transition: background 0.15s; }
.lu-row:hover { background: var(--hover); }
.lu-row.on { background: rgba(157, 168, 255, 0.09); }
.lu-go { flex: 1; display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 8px 8px 9px; text-align: left; border-radius: 10px; }
.lu-name { font-size: 13px; font-weight: 500; }
.lu-name em { font-style: normal; font-family: var(--mono); font-size: 8.5px; color: var(--text-3); margin-left: 7px; letter-spacing: 0.04em; text-transform: uppercase; }
.lu-size { font-family: var(--mono); font-size: 10px; color: var(--text-2); align-self: center; }
.lu-bar { grid-column: 1 / -1; height: 3px; border-radius: 2px; background: rgba(190, 230, 240, 0.08); overflow: hidden; }
.lu-bar i { display: block; height: 100%; border-radius: 2px; background: linear-gradient(90deg, rgba(157, 168, 255, 0.35), var(--accent)); }
.lu-row.on .lu-name { color: #fff; }
.lu-open { width: 34px; display: grid; place-items: center; color: var(--text-3); border-radius: 10px; }
.lu-open svg { width: 14px; height: 14px; }
.lu-open:hover { color: var(--text); background: var(--hover); }
.lu-exit { margin-top: 16px; }
#luTags { position: fixed; inset: 0; pointer-events: none; z-index: 3; display: none; }
body.lineup #luTags { display: block; }
.lu-tag {
  position: absolute; left: 0; top: 0; display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 3px 9px 4px; border-radius: 9px; white-space: nowrap; opacity: 0; will-change: transform, opacity;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.7); transition: background 0.15s;
}
.lu-tag b { font-size: 12.5px; font-weight: 600; color: var(--text); }
.lu-tag span { font-family: var(--mono); font-size: 9.5px; color: var(--text-2); }
.lu-tag:hover, .lu-tag.hover { background: rgba(9, 20, 27, 0.55); }
.lu-tag.on b { color: #fff; }
.lu-tag.on span { color: var(--accent); }
body.lineup #viewSeg { opacity: 0.35; pointer-events: none; }
body.lineup #ctx, body.lineup .channels, body.lineup #tAtlas { display: none; }

/* ---------- Life cycle ---------- */
.btn-lc { border-color: rgba(157, 168, 255, 0.55); background: linear-gradient(180deg, rgba(157, 168, 255, 0.28), rgba(157, 168, 255, 0.14)); }
.btn-lc svg { width: 15px; height: 15px; color: var(--accent); flex: none; }
.btn-lc.on { background: rgba(157, 168, 255, 0.38); border-color: var(--accent); }
.lc-tray {
  position: fixed; left: var(--free-cx, 50%); transform: translateX(-50%); bottom: calc(var(--gap) + var(--dock-h) + 10px); z-index: 11;
  width: min(600px, calc(var(--free-w, 100vw) - 16px)); border-radius: 16px; padding: 12px 10px 12px 12px;
  display: grid; grid-template-columns: 42px 1fr 32px; gap: 12px; align-items: start; animation: riseC 0.25s ease-out;
}
.lc-tray[hidden] { display: none; }
.lc-play {
  width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; color: #0b1124;
  background: linear-gradient(180deg, #b3bcff, #8f9bff); box-shadow: 0 8px 22px -10px rgba(157, 168, 255, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
.lc-play svg { width: 18px; height: 18px; }
.lc-play .ic-pause { display: none; }
.lc-play[aria-pressed='true'] .ic-pause { display: block; }
.lc-play[aria-pressed='true'] .ic-play { display: none; }
.lc-main { min-width: 0; }
.lc-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.lc-kicker { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lc-count { font-family: var(--mono); font-size: 10px; color: var(--text-3); }
.lc-stage { font-size: 19px; font-weight: 620; font-stretch: 78%; line-height: 1.15; margin-top: 3px; }
.lc-track { position: relative; height: 20px; margin: 6px 0 2px; }
.lc-rail { position: absolute; left: 0; right: 0; top: 9px; height: 2px; border-radius: 2px; background: rgba(190, 230, 240, 0.16); overflow: hidden; }
.lc-rail i { display: block; height: 100%; width: 0; background: var(--accent); }
.lc-track input[type='range'] { position: absolute; inset: 0; width: 100%; height: 20px; opacity: 0; margin: 0; }
.lc-ticks { position: absolute; inset: 0; pointer-events: none; }
.lc-tick {
  position: absolute; top: 5px; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; pointer-events: auto;
  background: #0b1820; border: 1.5px solid rgba(190, 230, 240, 0.4); transition: background 0.2s, border-color 0.2s, transform 0.15s;
}
.lc-tick:hover { transform: scale(1.25); }
.lc-tick.on { background: var(--accent); border-color: var(--accent); }
.lc-desc { margin: 6px 0 0; font-size: 12.5px; line-height: 1.5; color: #c3d3d7; min-height: 2.9em; }
.lc-close { width: 32px; height: 32px; }
body.lc-on .ctx, body.lc-on .hint { display: none; }
body.cinema .lc-tray { display: none !important; }

/* ---------- Capture ---------- */
.cap-pop {
  position: fixed; left: 50%; bottom: calc(var(--gap) + var(--dock-h) + 10px); transform: translateX(-50%);
  width: min(430px, calc(100vw - 2 * var(--gap))); border-radius: 15px; padding: 14px 14px 12px; z-index: 12;
  display: flex; flex-direction: column; gap: 10px; animation: riseC 0.2s ease-out;
}
.cap-pop[hidden] { display: none; }
.cap-head { font-weight: 600; font-size: 13px; display: flex; justify-content: space-between; align-items: baseline; }
.cap-head span { font-weight: 400; font-size: 11px; color: var(--text-3); }
.cap-row { display: flex; align-items: center; gap: 8px; min-height: 32px; }
.cap-l { width: 58px; flex: none; font-size: 11.5px; color: var(--text-2); }
.cap-note { flex: 1; font-family: var(--mono); font-size: 9.5px; color: var(--text-3); }
.cap-row .btn-act { margin-left: auto; }
.seg-sm button { height: 26px; padding: 0 9px; font-size: 11.5px; }
.rec-dot { width: 8px; height: 8px; border-radius: 50%; background: #ff4d5e; box-shadow: 0 0 10px rgba(255, 77, 94, 0.8); flex: none; }
.btn-act.rec { border-color: rgba(255, 77, 94, 0.35); background: rgba(255, 77, 94, 0.12); }
.btn-act.rec:hover { background: rgba(255, 77, 94, 0.22); border-color: rgba(255, 77, 94, 0.6); }
.btn-act.rec.on .rec-dot, .rec-badge .rec-dot { animation: recPulse 1.2s ease-in-out infinite; }
@keyframes recPulse { 50% { opacity: 0.3; } }
#tCapture[aria-expanded='true'] { color: var(--text); background: rgba(190, 230, 240, 0.09); }
body.recording #tCapture { color: #ff7a86; }
.frame-guide {
  position: fixed; z-index: 4; pointer-events: none; border: 1px dashed rgba(157, 168, 255, 0.75); border-radius: 2px;
  box-shadow: 0 0 0 9999px rgba(2, 8, 12, 0.38);
}
.frame-guide[hidden] { display: none; }
.rec-badge {
  position: fixed; top: var(--gap); left: 50%; transform: translateX(-50%); z-index: 60;
  display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 6px 0 12px; border-radius: 999px;
  font-family: var(--mono); font-size: 11px;
}
.rec-badge[hidden] { display: none; }
.rec-badge button { height: 24px; padding: 0 10px; border-radius: 999px; background: rgba(255, 77, 94, 0.18); font-family: var(--sans); font-size: 11.5px; }
.rec-badge button:hover { background: rgba(255, 77, 94, 0.3); }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--gap) + var(--dock-h) + 18px); transform: translate(-50%, 6px); z-index: 70;
  padding: 8px 14px; border-radius: 10px; font-size: 12px; background: var(--glass-strong); border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); opacity: 0; pointer-events: none; transition: opacity 0.25s, transform 0.25s;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.shutter { position: fixed; inset: 0; z-index: 65; background: #fff; opacity: 0; pointer-events: none; }
.shutter.go { animation: shutter 0.45s ease-out; }
@keyframes shutter { 0% { opacity: 0.55; } 100% { opacity: 0; } }

/* ---------- Cinema ---------- */
.brand, .topbar, .rail, .inspector, .dock, .readout, .optics, .hint { transition: opacity 0.6s ease; }
body.cinema .brand, body.cinema .topbar, body.cinema .rail, body.cinema .inspector, body.cinema .dock, body.cinema .ctx,
body.cinema .readout, body.cinema .optics, body.cinema .hint, body.cinema .cap-pop, body.cinema #cursorTag, body.cinema .credit {
  opacity: 0; pointer-events: none;
}
body.cinema #luTags { opacity: 0.9; }
body.cinema .ctx { display: none !important; }
.cin-cap::before {
  content: ''; position: absolute; z-index: -1; left: -8vw; right: -30vw; top: -14vh; bottom: -10vh;
  background: radial-gradient(ellipse 60% 70% at 25% 70%, rgba(2, 8, 12, 0.55), rgba(2, 8, 12, 0) 75%);
}
.lb { position: fixed; left: 0; right: 0; height: 0; background: #000; z-index: 30; pointer-events: none; }
.lb-top { top: 0; }
.lb-bot { bottom: 0; }
.cin-cap {
  position: fixed; left: 6vw; bottom: 7.5vh; z-index: 33; pointer-events: none; opacity: 0;
  max-width: min(52vw, 600px); text-shadow: 0 2px 18px rgba(0, 0, 0, 0.55);
}
.cc-k { font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
.cc-t { font-size: 46px; font-weight: 620; font-stretch: 76%; line-height: 1.02; margin-top: 10px; color: #fff; }
.cc-b { font-size: 16px; line-height: 1.45; color: #c9d8dc; margin-top: 10px; }
.tcard {
  position: fixed; inset: 0; z-index: 31; display: flex; flex-direction: column; align-items: center; justify-content: center;
  pointer-events: none; opacity: 0; text-shadow: 0 4px 40px rgba(0, 0, 0, 0.5);
}
.tc-main { font-size: clamp(56px, 9vw, 112px); font-weight: 600; font-stretch: 76%; letter-spacing: -0.01em; line-height: 1; }
.tc-sub { font-family: var(--mono); font-weight: 300; font-size: 13px; letter-spacing: 0.22em; text-transform: uppercase; color: #b9cbd0; margin-top: 18px; }
.skip {
  position: fixed; right: 26px; bottom: 24px; z-index: 32;
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  height: 38px; padding: 0 9px 0 16px; border-radius: 999px; display: none; align-items: center; gap: 10px;
  font-size: 13px; font-weight: 560; color: var(--text); background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.22);
  transition: color 0.15s, background 0.15s;
}
body.cinema .skip:not([hidden]) { display: inline-flex; }
.skip:hover { color: var(--text); background: rgba(255, 255, 255, 0.12); }
.skip kbd { font-family: var(--mono); font-size: 9px; padding: 3px 6px; border-radius: 6px; background: rgba(255, 255, 255, 0.08); }
.tourbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 32; pointer-events: none; }
.tourbar[hidden] { display: none; }
/* soft floor so the controls and captions stay readable over any frame */
.tourbar::before {
  content: ''; position: fixed; left: 0; right: 0; bottom: 0; height: 190px; pointer-events: none;
  background: linear-gradient(to top, rgba(2, 8, 12, 0.85), rgba(2, 8, 12, 0.5) 42%, rgba(2, 8, 12, 0));
}
.tb-progress {
  position: fixed; left: 32px; right: 32px; bottom: 74px; height: 2px; border-radius: 2px; background: rgba(255, 255, 255, 0.14); overflow: hidden;
}
.tb-progress i { display: block; height: 100%; width: 0; background: var(--accent); }
.tb-row {
  position: fixed; left: 18px; right: 18px; bottom: 16px; height: 50px; padding: 0 8px;
  display: flex; align-items: center; gap: 14px; pointer-events: auto;
  background: rgba(8, 18, 24, 0.72); border: 1px solid rgba(190, 230, 240, 0.16); border-radius: 15px;
  -webkit-backdrop-filter: blur(18px) saturate(1.3); backdrop-filter: blur(18px) saturate(1.3);
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.7);
}
.tb-row .icon { color: var(--text); }
.tb-row .icon:hover { background: rgba(255, 255, 255, 0.08); }
.tb-ctrl { display: flex; align-items: center; gap: 4px; flex: none; }
.tb-time { font-family: var(--mono); font-size: 10.5px; color: var(--text); margin-left: 8px; min-width: 88px; }
#tbPlay .ic-play { display: none; }
#tbPlay[aria-pressed='true'] .ic-play { display: block; }
#tbPlay[aria-pressed='true'] .ic-pause { display: none; }
.tb-chapters { flex: 1; display: flex; justify-content: center; gap: 2px; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.tb-ch { height: 32px; padding: 0 10px; border-radius: 9px; display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-2); white-space: nowrap; transition: color 0.15s, background 0.15s; }
.tb-ch i { font-style: normal; font-family: var(--mono); font-size: 9px; }
.tb-ch:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }
.tb-ch.on { color: #fff; background: rgba(157, 168, 255, 0.18); }
.tb-ch:not(.on) span { display: none; }
.tb-ch:not(.on) { padding: 0 8px; }
.tb-ch.on i { color: var(--accent); }
.tourbar .btn-s { border-color: rgba(255, 255, 255, 0.22); background: rgba(255, 255, 255, 0.05); }
body.cin-paused .cin-cap { opacity: 1 !important; }
body.cin-tour .cin-cap { bottom: calc(104px + 2.5vh); }
.film-modal { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; background: rgba(2, 7, 10, 0.94); }
.film-modal[hidden] { display: none; }
.fm-card { padding: 16px; border-radius: 18px; width: min(544px, calc(100vw - 32px)); display: flex; flex-direction: column; gap: 12px; }
#filmPrev { width: 100%; height: auto; aspect-ratio: 16 / 9; border-radius: 10px; background: #000; display: block; }
.fm-row { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; }
#fmPct { font-family: var(--mono); font-size: 11px; color: var(--accent); }
.fm-eta { font-family: var(--mono); font-size: 10px; color: var(--text-2); }
.fm-bar { height: 3px; border-radius: 2px; background: rgba(190, 230, 240, 0.12); overflow: hidden; }
.fm-bar i { display: block; height: 100%; width: 0; background: var(--accent); }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  :root { --insp-w: 300px; --rail-w: 188px; }
  .seg button { padding: 0 10px; }
}
@media (max-width: 980px) {
  :root { --gap: 12px; }
  .topbar { top: 12px; height: 40px; }
  .inspector { top: auto; }
  .spec-all .spec-thumb svg { width: 26px; height: 26px; }
  .rail-sep { width: 1px; height: auto; margin: 8px 4px; }
  .rail { top: 64px; width: auto; flex-direction: row; right: var(--gap); max-height: none; overflow-x: auto; overflow-y: hidden; }
  .spec { grid-template-columns: 40px; padding: 5px; }
  .spec-thumb { width: 40px; height: 40px; }
  .spec > div:last-child { display: none; }
  .spec[aria-current='true']::before { left: 12px; right: 12px; top: auto; bottom: -5px; width: auto; height: 2px; }
  .inspector { top: auto; height: 38vh; left: var(--gap); right: var(--gap); width: auto; }
  .readout { display: none; }
  .optics { bottom: calc(38vh + var(--dock-h) + 40px); }
  .dock { overflow-x: auto; justify-content: flex-start; }
  .hint { display: none; }
}
@media (max-width: 640px) {
  :root { --dock-h: 146px; }
  .topbar { gap: 6px; }
  .tb-btn { height: 34px; padding: 0 11px; }
  #navIntro span { display: none; }
  #navIntro { padding: 0 10px; }
  .topbar .lang { height: 34px; }
  .topbar .lang button { height: 26px; padding: 0 7px; }
  .cc-t { font-size: 30px; }
  .cc-b { font-size: 13.5px; }
  .cin-cap { max-width: 86vw; }
  .tb-chapters { display: none; }
  .tb-time { display: none; }
  .dock { height: auto; flex-wrap: wrap; justify-content: center; padding: 8px; gap: 6px; overflow: visible; width: calc(100vw - 2 * var(--gap)); }
  .dock-div { display: none; }
  .seg button { padding: 0 10px; font-size: 12px; height: 30px; }
  .seg-img button { gap: 5px; }
  .inspector { height: 34vh; }
  .inspector h1 { font-size: 28px; }
  .insp-scroll { padding: 16px 16px 14px; }
  .optics { bottom: calc(34vh + var(--dock-h) + 36px); }
  .ctx { bottom: calc(var(--gap) + var(--dock-h) + 10px); max-width: calc(100vw - 2 * var(--gap)); gap: 8px; padding: 0 10px; }
  .ctx input[type='range'] { width: 80px; }
  .ctx label { display: none; }
  .brand-sub { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- Tour menu ---------- */
.tour-menu {
  position: fixed; top: 62px; right: var(--gap); z-index: 14; width: 290px; padding: 6px; border-radius: 15px;
  display: flex; flex-direction: column; gap: 2px; animation: riseC 0.18s ease-out;
}
.tour-menu[hidden] { display: none; }
.tm-item {
  display: flex; align-items: center; gap: 11px; padding: 10px 11px; border-radius: 10px; text-align: left; color: var(--text);
  transition: background 0.15s;
}
.tm-item:hover, .tm-item:focus-visible { background: rgba(157, 168, 255, 0.12); }
.tm-ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; color: #0b1124; background: linear-gradient(180deg, #b3bcff, #8f9bff); }
.tm-ic svg { width: 14px; height: 14px; }
.tm-txt { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.tm-t { font-size: 13px; font-weight: 600; }
.tm-s { font-size: 11px; color: var(--text-3); }
.tm-item kbd { font-family: var(--mono); font-size: 10px; color: var(--text-3); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; }
.icon-sq { width: 38px; padding: 0; justify-content: center; }
.icon-sq .ic-off { display: none; }
.icon-sq[aria-pressed="false"] .ic-on { display: none; }
.icon-sq[aria-pressed="false"] .ic-off { display: block; }
.icon-sq[aria-pressed="false"] { color: var(--text-3); }

@media (min-width: 981px) and (max-width: 1250px) {
  .inspector { bottom: calc(var(--gap) + var(--dock-h) + 32px); }
  .credit { bottom: calc(var(--gap) + var(--dock-h) + 5px); right: calc(var(--gap) + 4px); }
}
@media (max-width: 980px) { .credit { right: calc(var(--gap) + 4px); bottom: calc(38vh + var(--dock-h) + 36px); } }
@media (max-width: 640px) { .credit { font-size: 8.5px; letter-spacing: 0.1em; bottom: calc(34vh + var(--dock-h) + 32px); } }
