:root {
  --bg: #02040b;
  --glass: rgba(10, 16, 32, 0.72);
  --glass-strong: rgba(12, 19, 38, 0.92);
  --line: rgba(140, 175, 255, 0.12);
  --line-strong: rgba(140, 175, 255, 0.24);
  --text: #e8edf4;
  --text-2: #aab8da;
  --dim: #7686ab;
  --accent: #e8edf4;
  --gold: #f4f7fb;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.3);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --top: 60px;
  --strip: 46px;
  --c-roots: #9cc6e6; --c-phrase: #93d5c6; --c-index: #b6ade6; --c-footnote: #dde3ea; --c-entity: #c9a9d8; --c-meaning: #a99ad8;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 13px/1.5 Inter, system-ui, sans-serif; overflow: hidden; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
kbd { font: 500 10.5px Inter, system-ui, sans-serif; color: var(--text-2); border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; background: rgba(255, 255, 255, 0.03); }
#stage { position: fixed; inset: 0; }
#stage canvas { display: block; }
.glass { background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); backdrop-filter: blur(16px) saturate(1.2); -webkit-backdrop-filter: blur(16px) saturate(1.2); }

/* top bar */
.topbar { position: fixed; top: 12px; left: 12px; right: 12px; height: 52px; display: flex; align-items: center; gap: 14px; padding: 0 10px 0 14px; z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 210px; }
.mark { color: #eef2f7; flex: none; }
.title { font-weight: 500; font-size: 12px; letter-spacing: 0.24em; text-transform: uppercase; }
.subtitle { font-size: 11px; color: var(--dim); font-variant-numeric: tabular-nums; }
.search-trigger { flex: 1; max-width: 520px; margin: 0 auto; display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px 0 12px; border-radius: 10px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.25); color: var(--dim); transition: border-color 0.2s var(--ease), background 0.2s; }
.search-trigger:hover { border-color: var(--line-strong); background: rgba(0, 0, 0, 0.35); color: var(--text-2); }
.search-trigger span { flex: 1; text-align: left; }
.top-right { display: flex; align-items: center; gap: 8px; }
.seg { display: flex; background: rgba(0, 0, 0, 0.28); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; color: var(--dim); padding: 5px 11px; border-radius: 7px; font-size: 12px; font-weight: 500; transition: color 0.15s, background 0.2s var(--ease); }
.seg button:hover { color: var(--text); }
.seg button.on { background: rgba(232, 237, 244, 0.16); color: var(--text); box-shadow: inset 0 0 0 1px rgba(232, 237, 244, 0.35); }
.select-wrap select { appearance: none; height: 32px; border-radius: 9px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.28) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%237686ab' fill='none' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 10px center; padding: 0 28px 0 11px; font-size: 12px; color: var(--text-2); }
.icon-btn { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.25); color: var(--text-2); font-weight: 600; transition: all 0.15s; }
.icon-btn:hover { color: var(--text); border-color: var(--line-strong); }
.icon-btn.sm { width: 28px; height: 28px; font-size: 15px; }

/* popover */
.popover { position: fixed; top: 72px; right: 12px; width: 260px; padding: 14px; z-index: 30; background: var(--glass-strong); }
.pop-title { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); margin-bottom: 10px; font-weight: 600; }
.range-row, .toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 0; color: var(--text-2); }
.range-row { flex-direction: column; align-items: stretch; gap: 4px; }
.toggle-row small { display: block; color: var(--dim); font-size: 11px; }

/* controls */
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 18px; background: transparent; }
input[type=range]::-webkit-slider-runnable-track { height: 3px; border-radius: 3px; background: linear-gradient(90deg, var(--track, var(--accent)) var(--p, 50%), rgba(255, 255, 255, 0.1) var(--p, 50%)); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 13px; height: 13px; margin-top: -5px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 3px rgba(232, 237, 244, 0.25), 0 1px 4px rgba(0, 0, 0, 0.5); }
input[type=range]::-moz-range-track { height: 3px; border-radius: 3px; background: rgba(255, 255, 255, 0.1); }
input[type=range]::-moz-range-progress { height: 3px; background: var(--track, var(--accent)); }
input[type=range]::-moz-range-thumb { width: 13px; height: 13px; border: 0; border-radius: 50%; background: #fff; }
.switch { -webkit-appearance: none; appearance: none; position: relative; width: 30px; height: 17px; border-radius: 17px; background: rgba(255, 255, 255, 0.12); flex: none; transition: background 0.2s var(--ease); cursor: pointer; margin: 0; }
.switch::after { content: ''; position: absolute; left: 2px; top: 2px; width: 13px; height: 13px; border-radius: 50%; background: #cfd8f0; transition: transform 0.2s var(--ease); }
.switch:checked { background: var(--sw, var(--accent)); }
.switch:checked::after { transform: translateX(13px); background: #fff; }
.switch:focus-visible, button:focus-visible, input:focus-visible { outline: 2px solid rgba(232, 237, 244, 0.6); outline-offset: 2px; }

/* sidebar */
.sidebar { position: fixed; top: calc(var(--top) + 16px); left: 12px; bottom: calc(var(--strip) + 24px); width: 330px; display: flex; flex-direction: column; z-index: 15; overflow: hidden; }
.tabs { display: flex; gap: 2px; padding: 8px 8px 0; border-bottom: 1px solid var(--line); }
.tab { flex: 1; border: 0; background: none; color: var(--dim); padding: 8px 4px 10px; font-weight: 500; font-size: 12.5px; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color 0.15s; }
.tab:hover { color: var(--text-2); }
.tab.on { color: var(--text); border-bottom-color: var(--accent); }
.tabpane { flex: 1; overflow: auto; padding: 12px; scrollbar-width: thin; scrollbar-color: rgba(140, 175, 255, 0.2) transparent; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 12px; }
.stat { background: rgba(232, 237, 244, 0.05); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 7px 9px; }
.stat b { display: block; font-size: 17px; font-weight: 300; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.stat span { font-size: 10.5px; color: var(--dim); white-space: nowrap; }
.presets { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }
.chipbtn { border: 1px solid var(--line); background: rgba(255, 255, 255, 0.02); color: var(--text-2); border-radius: 20px; padding: 3px 10px; font-size: 11.5px; transition: all 0.15s; }
.chipbtn:hover { border-color: var(--line-strong); color: var(--text); }
.chipbtn.on { background: rgba(232, 237, 244, 0.13); border-color: rgba(232, 237, 244, 0.4); color: var(--text); }
.src-card { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px 6px; margin-bottom: 6px; background: rgba(255, 255, 255, 0.015); transition: opacity 0.2s, border-color 0.2s; }
.src-card:hover { border-color: var(--line-strong); }
.src-card.off { opacity: 0.5; }
.src-top { display: flex; align-items: center; gap: 8px; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; box-shadow: 0 0 9px currentColor; background: currentColor; }
.src-name { flex: 1; min-width: 0; font-weight: 500; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.src-tag { font-size: 9.5px; letter-spacing: 0.02em; color: var(--dim); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; white-space: nowrap; }
.src-count { font-size: 11px; color: var(--text-2); font-variant-numeric: tabular-nums; min-width: 42px; text-align: right; }
.src-slider { display: flex; align-items: center; gap: 8px; margin-top: 3px; color: var(--dim); font-size: 11px; }
.src-slider input { flex: 1; }
.src-slider output { min-width: 74px; text-align: right; color: var(--text-2); font-variant-numeric: tabular-nums; }
.src-extra { margin-top: 4px; font-size: 11px; color: var(--dim); display: flex; align-items: center; gap: 6px; }
.agree-row { margin-top: 6px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 9px 10px; }
.agree-row b { color: var(--text); font-weight: 500; }
.legend { padding: 9px 12px 10px; border-top: 1px solid var(--line); font-size: 11px; color: var(--dim); }
.legend .bar { height: 5px; border-radius: 3px; margin: 5px 0 3px; }
.legend .ends { display: flex; justify-content: space-between; }
.legend .gl { display: inline-flex; align-items: center; gap: 5px; margin: 2px 10px 2px 0; color: var(--text-2); }
.filter { width: 100%; height: 32px; border-radius: 9px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.25); padding: 0 10px; margin-bottom: 8px; }
.note-line { color: var(--dim); font-size: 11.5px; margin: 6px 0 10px; }
.row { display: block; width: 100%; text-align: left; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.015); border-radius: var(--radius-sm); padding: 8px 10px; margin-bottom: 5px; transition: border-color 0.15s, background 0.15s; }
.row:hover { border-color: var(--line-strong); background: rgba(232, 237, 244, 0.04); }
.row .r1 { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.row .r2 { color: var(--dim); font-size: 11.5px; margin-top: 2px; }
.row.agree { border-color: rgba(240, 244, 249, 0.3); background: rgba(240, 244, 249, 0.03); }
.h { font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); font-weight: 600; margin: 14px 0 7px; }
.vid { font: 500 12.5px Inter, system-ui, sans-serif; color: var(--text); font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.muted { color: var(--dim); }
.num { font-variant-numeric: tabular-nums; color: var(--text-2); font-size: 11.5px; }

/* inspector */
.inspector { position: fixed; top: calc(var(--top) + 16px); right: 12px; bottom: calc(var(--strip) + 24px); width: 410px; z-index: 15; display: flex; flex-direction: column; transform: translateX(0); transition: transform 0.3s var(--ease), opacity 0.25s; }
.inspector[hidden] { display: flex; transform: translateX(440px); opacity: 0; pointer-events: none; }
.insp-head { display: flex; gap: 6px; align-items: center; padding: 10px 10px 8px; border-bottom: 1px solid var(--line); }
.insp-nav { display: flex; gap: 4px; margin-right: auto; }
.insp-body { flex: 1; overflow: auto; padding: 14px 16px 18px; scrollbar-width: thin; scrollbar-color: rgba(140, 175, 255, 0.2) transparent; }
.kicker { color: var(--accent); font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 600; }
.insp-title { font-size: 26px; font-weight: 300; letter-spacing: -0.01em; margin: 2px 0 2px; font-variant-numeric: tabular-nums; }
.section-name { color: var(--text-2); font-size: 12px; letter-spacing: 0.02em; }
.english { color: #ccd7f2; font-size: 13.5px; line-height: 1.6; }
.footnote { margin-top: 10px; border-left: 1px solid var(--line-strong); padding: 5px 0 5px 12px; color: var(--text-2); font-size: 12px; }
.footnote b { color: var(--text); font-weight: 500; }
details.sec { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 4px; }
details.sec > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); font-weight: 600; padding: 8px 0; }
details.sec > summary::-webkit-details-marker { display: none; }
details.sec > summary::after { content: '›'; font-size: 14px; transform: rotate(90deg); transition: transform 0.2s; }
details.sec:not([open]) > summary::after { transform: rotate(0deg); }
.chip { display: inline-flex; align-items: center; gap: 5px; border-radius: 4px; padding: 1px 7px; margin: 3px 4px 0 0; font-size: 11.5px; border: 1px solid var(--line); background: transparent; color: var(--text-2); cursor: pointer; transition: border-color 0.15s, color 0.15s; }
.chip:hover { border-color: var(--line-strong); color: var(--text); }
.chip.c-index { color: var(--c-index); }
.chip.c-theme { color: var(--c-meaning); }
.chip.c-entity { color: var(--c-entity); }
.chip.plain { cursor: default; }
.facets { display: flex; flex-wrap: wrap; gap: 5px; margin: 2px 0 10px; }
.facet { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); background: none; color: var(--text-2); border-radius: 20px; padding: 2px 9px; font-size: 11px; }
.facet .dot { width: 7px; height: 7px; }
.facet.on { border-color: var(--line-strong); background: rgba(255, 255, 255, 0.05); color: var(--text); }
.conn { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px 11px; margin-bottom: 6px; cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.conn:hover { border-color: var(--line-strong); background: rgba(232, 237, 244, 0.035); }
.conn.agree { border-color: rgba(240, 244, 249, 0.32); background: rgba(240, 244, 249, 0.03); }
.conn .c1 { display: flex; align-items: center; gap: 6px; }
.conn .c1 .sura { color: var(--dim); font-size: 11px; margin-right: auto; }
.badge { width: 8px; height: 8px; border-radius: 50%; box-shadow: 0 0 6px currentColor; background: currentColor; }
.why { font-size: 11.5px; margin-top: 4px; color: var(--text-2); }
.snip { color: var(--dim); font-size: 12px; margin-top: 4px; line-height: 1.45; }
.more { width: 100%; border: 1px dashed var(--line-strong); background: none; color: var(--text-2); border-radius: var(--radius-sm); padding: 7px; }
.bars .b { display: grid; grid-template-columns: 172px 1fr 36px; gap: 8px; align-items: center; font-size: 11.5px; margin: 3px 0; }
.bars .b i { display: block; height: 2px; border-radius: 1px; background: var(--text-2); opacity: 0.7; }
.bars .b span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); cursor: pointer; }

/* book strip */
.strip { position: fixed; left: 12px; right: 12px; bottom: 12px; height: var(--strip); z-index: 14; padding: 6px 12px 4px; }
#stripCanvas { width: 100%; height: 24px; display: block; cursor: pointer; }
.strip-label { font-size: 10.5px; color: var(--dim); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* hover card */
.hovercard { position: fixed; z-index: 40; pointer-events: none; max-width: 330px; padding: 9px 11px; font-size: 12px; background: var(--glass-strong); }
.hovercard .vid { margin-right: 6px; }
.hovercard .meta { color: var(--dim); font-size: 11px; }
.hovercard p { margin: 5px 0 0; color: var(--text-2); }

/* palette */
.palette-back { position: fixed; inset: 0; z-index: 50; background: rgba(1, 3, 10, 0.55); display: grid; justify-items: center; align-items: start; padding-top: 12vh; animation: fade 0.15s; }
.palette-back[hidden] { display: none; }
.palette { width: min(640px, calc(100vw - 32px)); background: var(--glass-strong); overflow: hidden; animation: rise 0.2s var(--ease); }
.pal-input { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); color: var(--dim); }
.pal-input input { flex: 1; border: 0; background: none; outline: none; font-size: 16px; color: var(--text); }
.pal-results { max-height: 52vh; overflow: auto; padding: 6px; }
.pal-group { font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); font-weight: 600; padding: 10px 10px 4px; }
.pal-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.pal-item .t { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal-item .sp { color: var(--dim); font-size: 12px; margin: 0 4px; }
.pal-item .m { color: var(--dim); font-size: 11.5px; white-space: nowrap; }
.pal-item.on { background: rgba(232, 237, 244, 0.12); }
.pal-empty { padding: 22px; text-align: center; color: var(--dim); }
.pal-foot { display: flex; gap: 16px; padding: 9px 14px; border-top: 1px solid var(--line); color: var(--dim); font-size: 11px; }
.pal-foot span:last-child { margin-left: auto; }
.help { padding: 18px; }
.keys { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; margin-bottom: 12px; }
.keys div { display: flex; align-items: center; gap: 6px; color: var(--text-2); }
.keys span { margin-left: auto; color: var(--dim); }

/* loader and toast */
.loader { position: fixed; inset: 0; z-index: 60; display: grid; place-content: center; justify-items: center; gap: 14px; background: var(--bg); transition: opacity 0.5s var(--ease); }
.loader.done { opacity: 0; pointer-events: none; }
.loader-mark { color: #eef2f7; animation: breathe 2.4s infinite ease-in-out; }
@keyframes breathe { 50% { opacity: 0.35; } }
.loader-text { color: var(--text-2); font-size: 12.5px; }
.loader .bar { width: 200px; height: 2px; border-radius: 2px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.loader .bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.2s; }
.toast { position: fixed; bottom: calc(var(--strip) + 32px); left: 50%; transform: translateX(-50%); z-index: 45; background: var(--glass-strong); border: 1px solid var(--line-strong); border-radius: 10px; padding: 7px 14px; font-size: 12px; color: var(--text); }
@keyframes pulse { 50% { transform: scale(0.6); opacity: 0.5; } }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(10px); opacity: 0; } }

@media (max-width: 1100px) { .search-trigger span { display: none; } .search-trigger { flex: 0; } .brand { min-width: 0; } }
@media (max-width: 860px) {
  .sidebar { width: auto; right: 12px; bottom: auto; max-height: 42vh; }
  .inspector { left: 12px; width: auto; top: 45vh; }
  .seg button { padding: 5px 7px; }
  .subtitle, .select-wrap { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* sound */
#soundBtn.on { color: var(--accent); border-color: rgba(232, 237, 244, 0.45); background: rgba(232, 237, 244, 0.1); }
#soundBtn.on #soundWaves { opacity: 1; }
.popover { max-height: calc(100vh - 100px); overflow: auto; }
.chords { display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; margin-top: 6px; font-size: 11.5px; color: var(--text-2); }
.chords b { font: 500 11.5px Inter, system-ui, sans-serif; color: var(--text); text-align: right; }
.chords span { display: inline-flex; align-items: center; gap: 6px; }
.play { border: 0; background: none; color: var(--dim); font-size: 12px; padding: 0 2px; line-height: 1; }
.play:hover { color: var(--text); }
.conn .chord { font: 500 10.5px Inter, system-ui, sans-serif; color: var(--dim); }

/* labels in space */
.labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 2; }
.lbl { position: absolute; left: 0; top: 0; white-space: nowrap; transition: opacity 0.35s var(--ease); will-change: transform; text-shadow: 0 0 10px rgba(2, 4, 11, 0.95), 0 0 2px rgba(2, 4, 11, 1); }
.lbl.sura { font: 400 9px Inter, system-ui, sans-serif; letter-spacing: 0.3em; color: rgba(225, 232, 242, 0.5); text-transform: uppercase; }
.lbl.sura.big { font-size: 10px; color: rgba(225, 232, 242, 0.72); }
.lbl.sura.on { color: #fff; font-size: 11px; font-weight: 500; }
.lbl.vlab { font: 400 10px Inter, system-ui, sans-serif; letter-spacing: 0.06em; color: rgba(240, 244, 249, 0.8); font-variant-numeric: tabular-nums; }
.lbl.focus { font: 500 12px Inter, system-ui, sans-serif; letter-spacing: 0.16em; color: #fff; }

/* title card, numbers as titles */
.titlecard { position: fixed; top: 84px; left: 50%; transform: translateX(-50%); z-index: 12; text-align: center; pointer-events: none; transition: opacity 0.6s var(--ease); max-width: 46vw; }
.titlecard.off { opacity: 0; }
.tc-num { font: 200 46px Inter, system-ui, sans-serif; letter-spacing: 0.02em; color: #f1f4f8; font-variant-numeric: tabular-nums; line-height: 1.1; }
.tc-cap { font: 400 10px Inter, system-ui, sans-serif; letter-spacing: 0.32em; color: rgba(225, 232, 242, 0.55); text-transform: uppercase; margin-top: 6px; }
.tc-cap::before, .tc-cap::after { content: ''; display: inline-block; width: 28px; height: 1px; background: rgba(225, 232, 242, 0.25); vertical-align: middle; margin: 0 12px; }

/* cinematic chrome: warmer, quieter */
body.cine { --glass: rgba(6, 8, 14, 0.62); --line: rgba(225, 232, 242, 0.08); --line-strong: rgba(225, 232, 242, 0.18); --shadow: none; }
body.cine .vid { color: #f1f4f8; }
body.cine .kicker { color: var(--dim); }
body.cine .insp-title { font-weight: 200; font-size: 30px; letter-spacing: 0.01em; }
body.cine .english { font: 300 14px/1.7 Inter, system-ui, sans-serif; color: #d5dce7; }

/* embed mode */
body.embed .sidebar, body.embed .strip, body.embed #openHelp, body.embed .select-wrap { display: none; }
body.embed .inspector { top: auto; bottom: 12px; height: min(46vh, 420px); width: min(400px, calc(100% - 24px)); }
body.embed .topbar { right: auto; max-width: calc(100% - 24px); }
body.embed .brand { min-width: 0; }
body.embed .search-trigger { flex: 0 0 auto; margin: 0; }
body.embed .search-trigger span { display: none; }
body.embed .titlecard { top: 76px; }
body.embed .embed-credit { display: block; }
body.ui-none .topbar, body.ui-none .inspector, body.ui-none .sidebar, body.ui-none .strip { display: none !important; }
body.ui-none .titlecard { top: 20px; }
.embed-credit { display: none; position: fixed; right: 12px; bottom: 10px; z-index: 13; font-size: 10.5px; color: var(--dim); text-decoration: none; }
.embed-credit:hover { color: var(--text); }

/* immersive: the panels step aside while the viewer looks at the network */
.topbar, .sidebar, .strip, .inspector:not([hidden]) { transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
body.immersive .topbar { opacity: 0; transform: translateY(-10px); pointer-events: none; }
body.immersive .sidebar { opacity: 0; transform: translateX(-14px); pointer-events: none; }
body.immersive .strip { opacity: 0; transform: translateY(10px); pointer-events: none; }
body.immersive .inspector:not([hidden]) { opacity: 0; transform: translateX(14px); pointer-events: none; }
body.immersive .hovercard { opacity: 0.85; }
body.immersive.has-sel .inspector:not([hidden]) { opacity: 1; transform: none; pointer-events: auto; }
.help-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; color: #eef2f7; }
.help-brand .title { font-size: 12px; }
.tagline { color: var(--text-2); font-size: 12.5px; margin-top: 2px; }
.tagline span { color: var(--dim); font-size: 11px; margin-left: 6px; letter-spacing: 0.04em; }
.tc-num.verse { font: 200 25px/1.4 Inter, system-ui, sans-serif; letter-spacing: 0.01em; max-width: 44vw; margin: 0 auto; text-wrap: balance; }
.titlecard { transition: opacity 3s ease-in-out; }
.titlecard.fading { opacity: 0; }
.titlecard.clickable .tc-num { pointer-events: auto; cursor: pointer; }
.titlecard.clickable .tc-num:hover { color: #fff; }

/* the welcome (app/intro.js): the bird draws itself, the words rise in, and the map fades in behind.
   Nothing here is shown or hidden at once: every element fades, and the button and the waiting line
   share one slot, so nothing moves when they change. */
.intro { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; background: var(--bg); color: #eef2f7; transition: opacity 2.4s var(--ease); }
.intro.out { opacity: 0; pointer-events: none; }
.intro-box { display: grid; justify-items: center; gap: 26px; padding: 24px; text-align: center; max-width: 560px; transition: transform 2.4s var(--ease), filter 2.4s var(--ease); }
.intro.out .intro-box { transform: scale(1.03); filter: blur(3px); }
.intro-bird { opacity: 0; animation: intro-show 1.6s .2s var(--ease) forwards, intro-float 7s 2s infinite ease-in-out; }
.intro-bird path { stroke-dasharray: 60; stroke-dashoffset: 60; animation: intro-draw 2s .3s var(--ease) forwards; }
.intro-bird path:nth-child(2) { animation-delay: .45s; } .intro-bird path:nth-child(3) { animation-delay: .6s; } .intro-bird path:nth-child(4) { animation-delay: .75s; } .intro-bird path:nth-child(5) { animation-delay: .55s; }
.intro-bird g { opacity: 0; animation: intro-show 1.6s 1.5s var(--ease) forwards; }
@keyframes intro-show { to { opacity: 1; } }
@keyframes intro-draw { to { stroke-dashoffset: 0; } }
@keyframes intro-float { 50% { transform: translateY(-4px); } }
.intro-lines { min-height: 9.5em; display: grid; align-content: start; gap: 14px; }
.intro-line { margin: 0; font-size: 17px; font-weight: 300; letter-spacing: .02em; line-height: 1.5; color: #c9d1dc; }
.intro-line.first { font-size: 21px; font-weight: 200; letter-spacing: .06em; color: #eef2f7; }
.intro-word { display: inline-block; opacity: 0; filter: blur(8px); transform: translateY(6px); animation: intro-word 1.8s var(--ease) both; }
@keyframes intro-word { to { opacity: 1; filter: blur(0); transform: none; } }
.intro-ref { display: block; margin-top: 6px; font-size: 10.5px; letter-spacing: .28em; text-transform: uppercase; color: var(--dim); opacity: 0; animation: intro-show 2.2s .2s var(--ease) forwards; }
.intro-foot { position: relative; display: grid; place-items: center; width: 100%; height: 46px; }
.intro-foot > * { grid-area: 1 / 1; opacity: 0; visibility: hidden; transition: opacity 2s var(--ease), visibility 0s 2s, transform 2s var(--ease), border-color .4s, background .4s; }
.intro-foot > .show { opacity: 1; visibility: visible; transition-delay: 0s; }
.intro-wait { font-size: 11.5px; letter-spacing: .2em; text-transform: uppercase; color: var(--dim); }
.intro-wait.show { animation: breathe 2.4s 2s infinite ease-in-out; }   /* after its fade-in */
.intro-enter { font: inherit; font-size: 12px; font-weight: 400; letter-spacing: .34em; text-transform: uppercase; padding: 12px 30px 12px 34px; border-radius: 999px; border: 1px solid rgba(238, 242, 247, .28); background: transparent; color: #eef2f7; cursor: pointer; transform: translateY(8px) scale(.97); }
.intro-enter.show { transform: none; }
.intro-enter:hover, .intro-enter:focus-visible { border-color: rgba(238, 242, 247, .7); background: rgba(238, 242, 247, .05); outline: none; }
.intro-skip { position: fixed; right: 22px; bottom: 18px; font: inherit; font-size: 11px; letter-spacing: .2em; text-transform: uppercase; background: none; border: 0; color: var(--dim); cursor: pointer; padding: 8px; opacity: 0; animation: intro-show 1.6s 3s var(--ease) forwards; transition: color .3s; }
.intro-skip:hover { color: var(--text); }
.intro-sound { position: fixed; left: 24px; bottom: 26px; font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--dim); opacity: 0; transition: opacity 1.6s var(--ease); pointer-events: none; }
.intro-sound.show { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .intro-word { filter: none; transform: none; } .intro-bird, .intro-box { animation: none; opacity: 1; } }
body.intro-on #stage, body.intro-on .topbar, body.intro-on .sidebar, body.intro-on .strip, body.intro-on .titlecard { opacity: 0; }
body.intro-reveal #stage { animation: intro-rise 2.8s var(--ease) both; }
body.intro-reveal .topbar, body.intro-reveal .sidebar, body.intro-reveal .strip, body.intro-reveal .titlecard { animation: fade 1.8s 1.2s both; }
@keyframes intro-rise { from { opacity: 0; transform: scale(1.04); } to { opacity: 1; transform: none; } }

/* Same subject: one line per subject, then its verses */
.shared { margin: 6px 0 8px; line-height: 1.9; }
.vlink { font-size: 12px; color: var(--text-2); cursor: pointer; margin-right: 6px; font-variant-numeric: tabular-nums; }
.vlink:hover { color: var(--text); text-decoration: underline; }
