:root {
  --bg: #FDF9F3;
  --bg-elevated: #F7F1E8;
  --bg-card: #ffffff;
  --text: #1a2433;
  --ink: #1a2433;
  --paper: #FDF9F3;
  --text-muted: #3d4a59;
  --accent: #612A8A;
  --accent-hover: #4B2E6F;
  --cyan: #612A8A;
  --border: #e4ddd2;
  --danger: #b42318;
  --radius: 12px;
  --font: "Manrope", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --max: 72ch;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  max-width: 100%;
}

body {
  background: var(--bg);
}

a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }

.hidden { display: none !important; }

/* ---- Gate ---- */
#gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.gate-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 1.75rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.gate-label {
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 0.5rem;
}

.gate-card h1 {
  margin: 0 0 0.35rem;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.gate-card .sub {
  margin: 0 0 1.5rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.gate-card label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.gate-card input[type="password"] {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  outline: none;
}

.gate-card input[type="password"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(97, 42, 138, 0.35);
}

.gate-card button {
  width: 100%;
  margin-top: 1rem;
  padding: 0.8rem 1rem;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.gate-card button:hover { background: var(--accent-hover); }

.gate-error {
  margin: 0.75rem 0 0;
  color: var(--danger);
  font-size: 0.9rem;
  min-height: 1.3em;
}

/* ---- App shell ---- */
#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 100%;
  overflow-x: hidden;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.5rem;
  background: rgba(10, 36, 55, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.brand strong {
  font-size: 1rem;
  letter-spacing: -0.01em;
}

.brand span {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.nav {
  display: flex;
  gap: 1.25rem;
  align-items: center;
}

.nav a {
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  opacity: 0.85;
}

.nav a:hover { opacity: 1; color: var(--cyan); text-decoration: none; }

main {
  flex: 1;
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

main.main-wide {
  max-width: 1400px;
  padding: 1.5rem 1.25rem 4rem;
}

/* ---- Index ---- */
.page-title {
  margin: 0 0 0.35rem;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.page-dek {
  margin: 0 0 2rem;
  color: var(--text-muted);
}

.doc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.85rem;
}

.doc-card {
  display: block;
  padding: 1.15rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s;
}

.doc-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  text-decoration: none;
  color: inherit;
}

.doc-card h2 {
  margin: 0 0 0.25rem;
  font-size: 1.15rem;
  font-weight: 650;
}

.doc-card .meta {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.badge {
  display: inline-block;
  margin-right: 0.4rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: rgba(97, 42, 138, 0.45);
  color: #e8d9f5;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
}

/* ---- Viewer ---- */
.viewer-nav {
  margin-bottom: 1.25rem;
}

.viewer-nav a {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.viewer-nav a:hover { color: var(--cyan); }

.viewer-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1.1rem;
  border-bottom: 1px solid var(--border);
}

.viewer-header h1 {
  margin: 0.35rem 0 0.4rem;
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.25;
}

.main-wide .viewer-header h1 {
  max-width: none;
}

.viewer-header .meta {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.prose {
  max-width: var(--max);
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--text);
}

.prose h1, .prose h2, .prose h3, .prose h4 {
  line-height: 1.3;
  letter-spacing: -0.02em;
  margin-top: 1.75em;
  margin-bottom: 0.55em;
}

.prose h1 { font-size: 1.55rem; }
.prose h2 { font-size: 1.3rem; color: #fff; }
.prose h3 { font-size: 1.12rem; color: #f0e8ff; }
.prose p { margin: 0 0 1em; }
.prose ul, .prose ol { margin: 0 0 1em; padding-left: 1.35em; }
.prose li { margin: 0.3em 0; }
.prose hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2em 0;
}
.prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: rgba(0, 0, 0, 0.35);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}
.prose pre {
  background: rgba(0, 0, 0, 0.4);
  padding: 1rem 1.1rem;
  border-radius: 8px;
  overflow-x: auto;
  border: 1px solid var(--border);
}
.prose pre code { background: none; padding: 0; }
.prose blockquote {
  margin: 0 0 1em;
  padding: 0.4em 0 0.4em 1em;
  border-left: 3px solid var(--accent);
  color: var(--text-muted);
}
.prose a { color: var(--cyan); }
.prose strong { color: #fff; font-weight: 650; }

.loading, .error-msg {
  color: var(--text-muted);
  padding: 2rem 0;
}

.error-msg { color: var(--danger); }

/* ---- Outline three-column shell ---- */
.outline-shell {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  align-items: start;
  width: 100%;
  max-width: 100%;
}

.rail-label {
  margin: 0 0 0.75rem;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #e8eef4;
  font-weight: 700;
}

.outline-toc-desktop,
.outline-meta-desktop {
  display: none;
}

.outline-center {
  min-width: 0;
  max-width: 100%;
}

.outline-toc-mobile {
  position: sticky;
  top: 3.4rem;
  z-index: 15;
  margin-bottom: 1rem;
  padding: 0.75rem 0.85rem;
  background: rgba(14, 47, 70, 0.94);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.25);
}

.toc-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  max-width: 100%;
}

.toc-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 550;
  text-decoration: none;
  line-height: 1.3;
  max-width: 100%;
}

.toc-chip em {
  font-style: normal;
  color: #d4b8ef;
  font-weight: 600;
  font-size: 0.68rem;
}

.toc-chip:hover {
  border-color: var(--accent);
  text-decoration: none;
  color: #fff;
}

.details-toggle {
  margin-top: 0.65rem;
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(97, 42, 138, 0.35);
  color: var(--text);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.details-toggle:hover {
  background: rgba(97, 42, 138, 0.55);
}

.outline-meta-mobile {
  display: none;
  margin-top: 1.75rem;
  padding-top: 0.5rem;
}

.outline-meta-mobile.is-open {
  display: block;
}

.section-stack {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.section-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem 1.35rem 1.15rem;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.22);
  scroll-margin-top: 5.5rem;
  max-width: 100%;
}

.section-head {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  margin-bottom: 0.65rem;
}

.section-num {
  flex: 0 0 auto;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #c9a6e8;
  background: rgba(97, 42, 138, 0.35);
  border: 1px solid rgba(97, 42, 138, 0.45);
  border-radius: 8px;
  padding: 0.35rem 0.45rem;
  line-height: 1;
  margin-top: 0.2rem;
}

.section-head-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.75rem;
}

.section-head h2 {
  margin: 0;
  font-size: 1.28rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: #fff;
}

.time-badge {
  display: inline-block;
  padding: 0.22rem 0.65rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.section-dek {
  margin: 0 0 0.85rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.section-note {
  margin: 0 0 0.85rem;
  padding: 0.55rem 0.75rem;
  border-left: 3px solid rgba(46, 196, 214, 0.55);
  background: rgba(46, 196, 214, 0.06);
  border-radius: 0 8px 8px 0;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-style: italic;
  line-height: 1.5;
}

.section-beats {
  font-size: 1.12rem;
  line-height: 1.75;
  color: var(--ink);
  font-weight: 500;
}

.beat-list {
  margin: 0 0 0.65rem;
  padding-left: 1.25em;
}

.beat-list > li {
  margin: 0.4em 0;
}

.beat-sub {
  margin: 0.35em 0 0.45em;
  padding-left: 1.15em;
  list-style: circle;
}

.beat-group {
  margin: 1rem 0 0.4rem;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #e8d9f5;
}

.beat-prose {
  margin: 0 0 0.75rem;
  color: var(--ink);
  font-size: 1.08rem;
  font-weight: 500;
  line-height: 1.7;
}

.section-sources {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.chip-label {
  display: inline-block;
  margin-right: 0.35rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.3);
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 650;
  color: #c9a6e8;
}

/* Meta cards */
.meta-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  margin-bottom: 0.75rem;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}

.meta-card-title {
  margin: 0 0 0.55rem;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #d4b8ef;
  font-weight: 700;
}

.meta-card-body {
  font-size: 0.88rem;
  line-height: 1.55;
  color: #f3f6f8;
}

.meta-card-body ul {
  margin: 0;
  padding-left: 1.1em;
}

.meta-card-body li {
  margin: 0.3em 0;
}

.meta-lead {
  margin: 0 0 0.55rem;
  color: var(--text);
  font-size: 0.86rem;
  line-height: 1.55;
}

.meta-kv {
  display: grid;
  gap: 0.15rem;
  margin-bottom: 0.7rem;
}

.meta-kv:last-child { margin-bottom: 0; }

.meta-k {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #c5d0da;
  font-weight: 700;
}

.meta-v {
  color: var(--text);
  font-size: 0.84rem;
  line-height: 1.45;
  word-break: break-word;
}

.meta-v a { color: var(--cyan); }

.runtime-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.runtime-list li {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
}

.runtime-list li:last-child { border-bottom: none; padding-bottom: 0; }
.runtime-list li:first-child { padding-top: 0; }

.runtime-list strong {
  color: #fff;
  font-size: 0.84rem;
}

.runtime-list span {
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* Desktop TOC */
.toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.toc-list a {
  display: flex;
  gap: 0.55rem;
  padding: 0.5rem 0.55rem;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  border: 1px solid transparent;
  transition: background 0.12s, border-color 0.12s;
}

.toc-list a:hover {
  background: rgba(97, 42, 138, 0.25);
  border-color: rgba(97, 42, 138, 0.4);
  text-decoration: none;
}

.toc-num {
  flex: 0 0 auto;
  font-size: 0.68rem;
  font-weight: 700;
  color: #c9a6e8;
  margin-top: 0.15rem;
}

.toc-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.toc-title {
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
}

.toc-time {
  font-size: 0.68rem;
  color: var(--text-muted);
}

/* Desktop ≥1100px three columns */
@media (min-width: 1100px) {
  main.main-wide {
    padding: 1.75rem 1.5rem 4rem;
  }

  .outline-shell {
    grid-template-columns: 220px minmax(520px, 1fr) 290px;
    gap: 1.35rem;
  }

  .outline-toc-desktop {
    display: block;
    position: sticky;
    top: 4.25rem;
    max-height: calc(100vh - 5rem);
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0.25rem;
    scrollbar-width: thin;
  }

  .outline-meta-desktop {
    display: block;
    position: sticky;
    top: 4.25rem;
    max-height: calc(100vh - 5rem);
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0.15rem;
    scrollbar-width: thin;
  }

  .outline-toc-mobile,
  .outline-meta-mobile,
  .outline-meta-mobile.is-open {
    display: none !important;
  }

  .section-card {
    scroll-margin-top: 4.5rem;
    padding: 1.4rem 1.5rem 1.25rem;
  }

  .section-head h2 {
    font-size: 1.35rem;
  }

  .section-beats {
    font-size: 1.08rem;
  }
}

/* Mid tablets: stack meta below, keep chips */
@media (max-width: 1099px) {
  .section-card {
    scroll-margin-top: 7.5rem;
  }
}

@media (max-width: 900px) {
  main.main-wide {
    padding: 1.25rem 0.9rem 3rem;
  }

  .viewer-header h1 {
    font-size: 1.45rem;
  }

  .section-head h2 {
    font-size: 1.12rem;
  }

  .section-beats {
    font-size: 1rem;
  }

  .outline-toc-mobile {
    top: 3.2rem;
  }
}

@media (max-width: 600px) {
  .topbar { padding: 0.75rem 1rem; }
  main { padding: 1.5rem 1rem 3rem; }
  main.main-wide { padding: 1.15rem 0.75rem 3rem; }
  .viewer-header h1 { font-size: 1.35rem; }
  .prose { font-size: 1rem; }
  .section-card { padding: 1rem 0.95rem; }
}


html, body {
  height: 100%;
}
/* ---- Studio three-pane shell ---- */
#app {
  min-height: 100vh;
  min-height: 100dvh;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 100%;
  overflow: hidden;
}
.studio {
  flex: 1 1 auto;
  min-height: 70vh;
  display: grid;
  grid-template-columns: 1fr;
  width: 100%;
  max-width: 100%;
  overflow: auto;
}
.left-rail,
.right-rail {
  display: none;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
}
.center-col {
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
}
#reader {
  max-width: 68ch;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
}
.spoken-prose {
  font-size: 1.2rem;
  line-height: 1.8;
  color: var(--ink);
  font-weight: 500;
}
.spoken-prose p { margin: 0 0 1.15em; }
.spoken-chapter,
.section-card { scroll-margin-top: 6.5rem; }

.channel-pills {
  display: flex;
  gap: 0.45rem;
  margin: 0 0 1rem;
}
.channel-pill {
  flex: 1;
  text-align: center;
  padding: 0.7rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
  line-height: 1.2;
}
.channel-pill:hover { text-decoration: none; border-color: var(--cyan); color: #fff; }
.channel-pill.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.script-list { display: flex; flex-direction: column; gap: 0.4rem; }
.script-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.7rem 0.75rem;
  border-radius: 10px;
  border: 1px solid transparent;
  background: var(--bg-card);
  color: inherit;
  text-decoration: none;
}
.script-row:hover { border-color: var(--accent); text-decoration: none; color: inherit; }
.script-row.is-active {
  border-color: var(--cyan);
  background: rgba(46, 196, 214, 0.1);
  box-shadow: inset 3px 0 0 var(--cyan);
}
.script-row-title { font-size: 0.9rem; font-weight: 650; line-height: 1.3; }
.script-row-meta {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  font-size: 0.72rem;
  color: var(--text-muted);
}
.type-chip {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: rgba(97, 42, 138, 0.45);
  color: #e8d9f5;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.mobile-chrome {
  position: sticky;
  top: 0;
  z-index: 16;
  padding: 0.75rem 0.9rem 0.7rem;
  background: rgba(14, 47, 70, 0.96);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.mobile-actions {
  display: flex;
  gap: 0.5rem;
}
.scripts-toggle,
.details-toggle {
  flex: 1;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 650;
  cursor: pointer;
  text-align: left;
}
.scripts-toggle span { color: var(--cyan); font-size: 0.72rem; margin-left: 0.35rem; }
.details-toggle { flex: 0 0 auto; text-align: center; background: rgba(97, 42, 138, 0.4); }
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 30;
}
.slide-drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  width: min(360px, 92vw);
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--bg-elevated);
  z-index: 40;
  padding: 1rem;
  box-shadow: 0 0 40px rgba(0,0,0,0.4);
}
#script-drawer { left: 0; }
#details-drawer { right: 0; }
.drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}
.drawer-close {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: 8px;
  padding: 0.35rem 0.65rem;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
}
.cue-list { margin: 0; padding-left: 1.1em; }
.cue-list li { margin: 0.4em 0; }
.cue-sec { display: block; font-size: 0.7rem; color: #9aaabb; margin-top: 0.15rem; }

@media (min-width: 1100px) {
  .studio { grid-template-columns: 270px minmax(0, 1fr) 300px; }
  .left-rail, .right-rail {
    display: block;
    padding: 1.15rem 1rem 2rem;
    max-height: 100%;
  }
  .left-rail { border-right: 1px solid var(--border); }
  .right-rail { border-left: 1px solid var(--border); }
  .mobile-chrome { display: none; }
  #reader { padding: 1.75rem 1.5rem 4rem; }
  .spoken-chapter, .section-card { scroll-margin-top: 1.25rem; }
}
@media (max-width: 1099px) {
  .right-rail, .left-rail { display: none; }
}



/* ---- One-palette lock: cream, ink, purple ---- */
html, body, #app, .studio, .center-col, .left-rail, .right-rail, .topbar, .slide-drawer, .mobile-chrome {
  background: var(--paper);
  color: var(--ink);
}
.topbar {
  background: var(--paper);
  border-bottom: 1px solid var(--border);
  backdrop-filter: none;
}
.brand strong, .brand span, .nav a { color: var(--ink); opacity: 1; }
.nav a:hover { color: var(--accent); }
.left-rail, .right-rail {
  background: #F7F1E8;
  color: var(--ink);
}
.rail-label, .meta-card-title, .meta-k, .cue-sec, .toc-time, .script-row-meta {
  color: #3d4a59;
}
.channel-pill {
  color: var(--ink);
  border-color: var(--border);
  background: #fff;
}
.channel-pill:hover { color: var(--accent); border-color: var(--accent); }
.channel-pill.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
.script-row {
  background: #fff;
  color: var(--ink);
  border-color: var(--border);
}
.script-row-title { color: var(--ink); }
.script-row.is-active {
  border-color: var(--accent);
  background: #f3eaf8;
  box-shadow: inset 3px 0 0 var(--accent);
}
.type-chip, .badge, .section-num, .time-badge {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.section-card, .spoken-chapter, .meta-card, .gate-card {
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: none;
  color: var(--ink);
}
.section-head h2, .viewer-header h1, .toc-title, .prose h1, .prose h2, .prose h3 {
  color: var(--ink);
}
.spoken-prose, .beat-prose, .section-beats, .prose, .prose p, .meta-card-body, .meta-v, .meta-lead {
  color: var(--ink);
}
.section-dek, .section-note, .section-sources, .viewer-header .meta {
  color: #3d4a59;
}
.section-note {
  background: #F7F1E8;
  border-left-color: var(--accent);
}
.beat-group { color: var(--ink); }
.toc-list a, .toc-num, a { color: var(--ink); }
.toc-list a:hover, a:hover { color: var(--accent); }
.mobile-chrome {
  background: var(--paper);
  border-bottom: 1px solid var(--border);
}
.scripts-toggle, .details-toggle, .drawer-close {
  background: #fff;
  color: var(--ink);
  border-color: var(--border);
}
.scripts-toggle span { color: var(--accent); }
.slide-drawer { background: var(--paper); color: var(--ink); box-shadow: none; }
