:root {
  --ink: #14140f;
  --muted: #6a6a62;
  --faint: #98988f;
  --paper: #fbfbf8;
  --paper-2: #f3f2ec;
  --line: #dedcd2;
  --accent: #8a3a1e;
  --rail-w: 15rem;
  --script-w: 24rem;
  --step: 4px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: ui-serif, Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--paper);
  padding: 10px 16px;
  z-index: 100;
}
.skip-link:focus { left: 0; }

/* ---------- top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar__identity { display: flex; align-items: center; gap: 12px; min-width: 0; }

.topbar__mark {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  border: 1px solid var(--ink);
  padding: 5px 7px;
  line-height: 1;
  flex: none;
}

.topbar__text { display: flex; flex-direction: column; min-width: 0; }
.topbar__text strong {
  font-size: 13px;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar__text span {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.06em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar__actions { display: flex; gap: 8px; flex: none; align-items: center; }

.segmented {
  display: inline-flex;
  border: 1px solid var(--line);
  overflow: hidden;
}
.seg {
  font: inherit;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 7px 11px;
  background: transparent;
  color: var(--muted);
  border: 0;
  border-right: 1px solid var(--line);
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}
.seg:last-child { border-right: 0; }
.seg:hover:not(:disabled) { background: var(--paper-2); color: var(--ink); }
.seg.is-active { background: var(--ink); color: var(--paper); }
/* Deliberately off, not unavailable: same ghosted look and a not-allowed
   cursor, so it reads as a control that exists but will not act. */
.seg:disabled { opacity: 0.4; cursor: not-allowed; }
.seg.is-off,
.seg.is-off:hover { background: transparent; color: var(--muted); }
.seg:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.variant-note {
  font-size: 10px;
  color: var(--faint);
  letter-spacing: 0.06em;
  margin-left: 4px;
}

.btn {
  font: inherit;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  padding: 7px 12px;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease;
}
.btn:hover { border-color: var(--ink); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* ---------- shortcuts ---------- */

.shortcuts {
  border-bottom: 1px solid var(--line);
  background: var(--paper-2);
  padding: 12px 20px;
  font-size: 12px;
}
.shortcuts dl { display: flex; flex-wrap: wrap; gap: 18px 32px; margin: 0; }
.shortcuts dl > div { display: flex; align-items: center; gap: 8px; }
.shortcuts dt { display: flex; gap: 4px; margin: 0; }
.shortcuts dd { margin: 0; color: var(--muted); }
.shortcuts__note {
  margin: 10px 0 0;
  font-size: 11px;
  color: var(--faint);
  letter-spacing: 0.02em;
}
kbd {
  font-family: var(--font);
  font-size: 10px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 3px;
  padding: 2px 5px;
  background: #fff;
}

/* ---------- layout ---------- */

.shell {
  flex: 1;
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr) var(--script-w);
  min-height: 0;
  align-items: stretch;
}

/* ---------- rail ---------- */

.rail {
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--paper);
}

.rail__heading {
  margin: 0;
  padding: 14px 16px 10px;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--faint);
}

.rail__list {
  list-style: none;
  margin: 0;
  padding: 0 0 8px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.rail__item { display: block; }

.rail__link {
  display: grid;
  grid-template-columns: 1.9rem 1fr auto;
  align-items: baseline;
  gap: 8px;
  padding: 8px 16px;
  text-decoration: none;
  color: var(--muted);
  border-left: 2px solid transparent;
  font-size: 12px;
  line-height: 1.3;
  transition: background 120ms ease, color 120ms ease;
}
.rail__link:hover { background: var(--paper-2); color: var(--ink); }
.rail__link:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.rail__num {
  font-variant-numeric: tabular-nums;
  font-size: 10px;
  color: var(--faint);
  letter-spacing: 0.06em;
}
.rail__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rail__who {
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.rail__link[aria-current="true"] {
  border-left-color: var(--accent);
  background: var(--paper-2);
  color: var(--ink);
}
.rail__link[aria-current="true"] .rail__num { color: var(--accent); }
.rail__link[aria-current="true"] .rail__who { color: var(--ink); }
.rail__link[aria-current="true"] .rail__label { font-weight: 600; }

.rail__foot {
  border-top: 1px solid var(--line);
  padding: 10px 16px;
  font-size: 10px;
  color: var(--faint);
  letter-spacing: 0.06em;
}
.rail__foot p { margin: 0 0 3px; }
.rail__foot p:last-child { margin-bottom: 0; }

/* ---------- stage ---------- */

.stage {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px 26px;
  min-width: 0;
  min-height: 0;
  background:
    repeating-linear-gradient(45deg, transparent, transparent 9px, rgba(0,0,0,0.012) 9px, rgba(0,0,0,0.012) 10px);
}

.stage__inner {
  width: 100%;
  max-width: 1120px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.slide-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 12px 32px -18px rgba(0,0,0,0.28);
  container-type: inline-size;
  overflow: hidden;
}

.stage__controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.btn--nav { border-color: var(--line); }
.btn--nav:disabled { opacity: 0.35; cursor: default; }
.btn--nav:disabled:hover { border-color: var(--line); }

.stage__progress {
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

/* ---------- slide internals (container-query scaled) ---------- */

.slide {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 5.2cqw 5.6cqw;
  color: var(--ink);
  overflow: hidden;
}

.slide__eyebrow {
  font-size: 1.05cqw;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 0 0 1.4cqw;
  flex: none;
}

.slide__rule {
  height: 1px;
  background: var(--line);
  margin: 0 0 2.4cqw;
  flex: none;
}

.slide__body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.4cqw;
  flex: 1;
  min-height: 0;
  align-content: start;
}
.slide--with-image .slide__body { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
.slide--table .slide__body { grid-template-columns: 1fr; }

.slide__main { min-width: 0; display: flex; flex-direction: column; }

.slide__title {
  font-size: 3.05cqw;
  line-height: 1.14;
  font-weight: 650;
  letter-spacing: -0.015em;
  margin: 0 0 2.2cqw;
  color: var(--ink);
  text-wrap: balance;
}
.slide--title .slide__title { font-size: 5.0cqw; margin-bottom: 1.2cqw; }

.slide__subtitle {
  font-size: 3.1cqw;
  color: var(--muted);
  margin: 0;
  font-weight: 400;
}

.slide__subtopic {
  margin: -1.1cqw 0 1.9cqw;
  font-size: 1.62cqw;
  line-height: 1.4;
  color: var(--muted);
  font-weight: 400;
}

.slide__bullets {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1.35cqw;
}
.slide__bullets li {
  position: relative;
  padding-left: 2.1cqw;
  font-size: 1.72cqw;
  line-height: 1.42;
  color: #26261f;
  transition: color 140ms ease;
}
.slide__bullets li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 1.1cqw;
  height: 1px;
  background: var(--faint);
  transition: background 140ms ease, width 140ms ease;
}

.slide__bullet { cursor: pointer; }
.slide__bullet:hover,
.slide__bullet:focus-visible { outline: none; color: var(--ink); }
.slide__bullet.is-active { color: var(--ink); font-weight: 600; }
.slide__bullet.is-active::before {
  background: var(--accent);
  width: 1.55cqw;
}

/* ---------- cue beats in the script panel ---------- */

.script__beats {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0 0 4px;
}

.beat {
  display: grid;
  grid-template-columns: 1.15rem 1fr;
  column-gap: 8px;
  padding: 7px 8px 7px 6px;
  border-left: 2px solid transparent;
  transition: background 120ms ease, border-color 120ms ease;
}
.beat:hover { background: var(--paper-2); }

.beat__num {
  grid-column: 1;
  font-size: 9.5px;
  font-variant-numeric: tabular-nums;
  color: var(--faint);
  letter-spacing: 0.04em;
  padding-top: 2px;
}

.beat__cue {
  grid-column: 2;
  margin: 0 0 4px;
  font-size: 10px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--faint);
  line-height: 1.35;
  transition: color 120ms ease;
}

.beat__say {
  grid-column: 2;
  margin: 0;
  font-size: 12.6px;
  line-height: 1.62;
  color: #2c2c25;
}

.beat.is-active {
  background: var(--paper-2);
  border-left-color: var(--accent);
}
.beat.is-active .beat__num { color: var(--accent); }
.beat.is-active .beat__cue { color: var(--muted); }
.beat.is-active .beat__say { color: var(--ink); }

.beat.is-flash {
  background: #f0eee6;
  border-left-color: var(--ink);
}

.slide__figure { margin: 0; min-width: 0; display: flex; flex-direction: column; }
.slide__figure-img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--paper-2);
  border: 1px solid var(--line);
  filter: grayscale(1) contrast(1.03);
}
.slide__figure-img--pending {
  display: grid;
  place-items: center;
  font-size: 1cqw;
  letter-spacing: 0.2em;
  color: var(--faint);
  text-transform: uppercase;
}
.slide__figure figcaption {
  margin-top: 0.7cqw;
  font-size: 0.92cqw;
  line-height: 1.35;
  color: var(--faint);
}

/* comparison table */

.slide__table { width: 100%; border-collapse: collapse; font-size: 1.16cqw; }
.slide__table th, .slide__table td {
  text-align: left;
  padding: 0.72cqw 0.9cqw;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  line-height: 1.35;
}
.slide__table thead th {
  font-size: 0.95cqw;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 600;
  border-bottom: 1px solid var(--ink);
}
.slide__table tbody th {
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}
.slide__table tbody td { color: var(--muted); }

/* title slide */

.slide--title { justify-content: flex-start; }
.slide--title .slide__eyebrow { color: var(--muted); }

/* Title slide as a poster: headline block left, roster list right. */
.slide--title .slide__main {
  width: 58%;
  text-align: center;
  align-self: flex-start;
}

.slide--title .slide__title {
  text-align: center;
  margin-bottom: 1.1cqw;
}

.slide--title .slide__subtitle { text-align: center; }

/* Match the deck: the system name leads, the qualifier follows smaller. */
.title-primary { display: block; }
.title-tail {
  display: block;
  margin-top: 0.45cqw;
  font-size: 0.68em;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: -0.005em;
}

.slide__assigned {
  margin: 1.6cqw 0 0;
  font-size: 1.02cqw;
  font-style: italic;
  color: var(--faint);
  text-align: center;
}

.slide--title .slide__meta-grid {
  grid-template-columns: auto 1fr;
  gap: 0.5cqw 1.4cqw;
  margin: 2.4cqw auto 0;
  max-width: 26cqw;
  text-align: left;
  justify-items: start;
}

.slide--title .slide__meta-grid dt { text-align: right; }

.slide--title .slide__roster {
  position: absolute;
  top: 6.2%;
  right: 5.4%;
  bottom: 12%;
  width: 32%;
  border-left: 1px solid var(--line);
  padding-left: 2.2cqw;
  display: flex;
  flex-direction: column;
}

.slide__roster-head {
  margin: 0 0 1.1cqw;
  font-size: 0.95cqw;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 0.4cqw;
}

.slide__roster-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 1;
}

.slide__roster-list li {
  display: flex;
  align-items: baseline;
  gap: 0.8cqw;
  padding: 0.42cqw 0;
  border-bottom: 1px solid #eceae2;
  font-size: 1.02cqw;
  line-height: 1.25;
}
.slide__roster-list li:last-child { border-bottom: 0; }

.roster-num {
  font-size: 0.82cqw;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  width: 1.6cqw;
  flex: none;
}
.roster-name { font-weight: 600; color: var(--ink); flex: 1; }
.roster-roll {
  font-size: 0.86cqw;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.slide__meta-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.55cqw 2.4cqw;
  margin: 3cqw 0 0;
  font-size: 1.02cqw;
  align-items: baseline;
}
.slide__meta-grid dt {
  font-size: 0.86cqw;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
}
.slide__meta-grid dd { margin: 0; color: var(--ink); }
.slide__meta-grid dd.is-todo { color: #b42318; font-weight: 600; }
.slide__colophon {
  margin-top: auto;
  font-size: 0.9cqw;
  letter-spacing: 0.1em;
  color: var(--faint);
  text-transform: uppercase;
}

/* ---------- script panel ---------- */

.script {
  border-left: 1px solid var(--line);
  padding: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--paper);
}

.script__now, .script__all { overflow-y: auto; padding: 16px 18px 24px; min-height: 0; flex: 1 1 auto; }
.script__all { padding-top: 0; }

.script__who {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--ink);
  margin-bottom: 14px;
}
.script__initials {
  font-size: 15px;
  letter-spacing: 0.1em;
  font-weight: 700;
}
.script__duration {
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}
.script__section {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 0 0 12px;
}
.script__empty { color: var(--faint); font-size: 12px; line-height: 1.6; }

.script__opening {
  font-size: 13.5px;
  line-height: 1.62;
  margin: 0 0 12px;
  color: var(--ink);
  font-style: italic;
}
.script__body p {
  font-size: 12.6px;
  line-height: 1.66;
  margin: 0 0 11px;
  color: #2c2c25;
}
.script__transition {
  margin: 16px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  line-height: 1.5;
  letter-spacing: 0.02em;
  color: var(--muted);
  text-transform: none;
}
.script__transition::before {
  content: "→ ";
  color: var(--accent);
  font-weight: 700;
}

.script__sources { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 10px; }
.script__sources h3 {
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 0 0 7px;
  font-weight: 600;
}
.script__sources ol { margin: 0; padding-left: 16px; }
.script__sources li {
  font-size: 10px;
  line-height: 1.5;
  color: var(--muted);
  margin-bottom: 5px;
}

/* full script mode */

.script-all__part { margin-bottom: 26px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.script-all__part:last-child { border-bottom: 0; }
.script-all__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.script-all__id {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.1em;
  margin: 0;
}
.script-all__slide {
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--faint);
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}
.script-all__title {
  font-size: 11px;
  color: var(--muted);
  margin: 3px 0 10px;
}

/* ---------- footer ---------- */

.footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 20px;
  border-top: 1px solid var(--line);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--faint);
}

/* ---------- responsive ---------- */

@media (max-width: 1180px) {
  :root { --script-w: 20rem; --rail-w: 13rem; }
}

@media (max-width: 1000px) {
  .shell { grid-template-columns: var(--rail-w) minmax(0, 1fr); }
  .script {
    position: fixed;
    inset: 0 0 0 auto;
    width: min(30rem, 92vw);
    border-left: 1px solid var(--line);
    box-shadow: -12px 0 40px -20px rgba(0,0,0,0.4);
    transform: translateX(100%);
    transition: transform 220ms ease;
    z-index: 40;
  }
  .script.is-open { transform: translateX(0); }
  body.script-open::after {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(20,20,15,0.24);
    z-index: 30;
  }
}

@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .rail {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    order: 2;
  }
  .rail__list {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 8px 8px;
  }
  .rail__heading, .rail__foot { display: none; }
  .rail__link {
    grid-template-columns: auto auto;
    border-left: 0;
    border-bottom: 2px solid transparent;
    padding: 8px 10px;
    white-space: nowrap;
  }
  .rail__link[aria-current="true"] { border-bottom-color: var(--accent); }
  .rail__label { display: none; }
  .stage { order: 1; padding: 14px; }
  .footer { flex-direction: column; gap: 4px; }
  .topbar__text span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

@media print {
  .topbar, .rail, .script, .stage__controls, .footer, .shortcuts { display: none !important; }
  .shell { display: block; }
  .slide-frame { box-shadow: none; border: 0; }
}

/* ---------- design variant: rendered slide images ---------- */

.slide--image {
  padding: 0;
  display: block;
  background: #0e2a18;
}

.slide__design-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #0e2a18;
}

.slide__empty {
  margin: 0;
  padding: 2.4cqw;
  font-size: 1.2cqw;
  color: #b9c7ba;
}
