:root {
  --ink: #142638;
  --muted: #637180;
  --paper: #f7f9fb;
  --white: #ffffff;
  --line: #dce3e9;
  --navy: #13283d;
  --navy-2: #1c3a55;
  --copper: #b85f31;
  --copper-soft: #fff2ea;
  --blue-soft: #eaf4fa;
  --shadow: 0 12px 32px rgba(19, 40, 61, .09);
  --radius: 14px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.55;
}
button, a { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #ef9a69; outline-offset: 3px; }

.home-shell { min-height: 100vh; }
.home-top {
  background: var(--navy);
  color: white;
  padding: 20px clamp(22px, 5vw, 72px);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 12px; font-weight: 750; letter-spacing: -.01em; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; background: var(--copper); display: grid; place-items: center; font-weight: 900; }
.home-main { width: min(1120px, calc(100% - 40px)); margin: 0 auto; padding: 76px 0; }
.eyebrow { margin: 0 0 10px; color: var(--copper); font: 750 .78rem/1 ui-monospace, monospace; letter-spacing: .12em; text-transform: uppercase; }
.home-main h1 { margin: 0; font-size: clamp(2.2rem, 5vw, 4.2rem); line-height: 1.02; letter-spacing: -.055em; max-width: 780px; }
.home-intro { max-width: 650px; color: var(--muted); font-size: 1.1rem; margin: 18px 0 45px; }
.library-title { font-size: .82rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin: 0 0 14px; }
.script-card {
  width: min(100%, 760px);
  border: 1px solid var(--line);
  border-left: 5px solid var(--copper);
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 28px;
  align-items: center;
}
.script-card + .script-card { margin-top: 18px; }
.script-card h2 { margin: 0 0 8px; font-size: 1.45rem; letter-spacing: -.025em; }
.script-card p { margin: 0; color: var(--muted); }
.meta { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 17px; }
.pill { background: var(--blue-soft); color: #285370; border-radius: 999px; padding: 6px 10px; font-size: .82rem; font-weight: 650; }
.open-script { border: 0; color: white; background: var(--copper); border-radius: 10px; padding: 13px 18px; font-weight: 750; white-space: nowrap; }
.open-script:hover { background: #984824; }

.viewer { min-height: 100vh; }
.callbar {
  position: sticky; top: 0; z-index: 30;
  background: var(--navy); color: white;
  display: grid; grid-template-columns: minmax(210px, 1fr) minmax(260px, 2fr) auto;
  gap: 20px; align-items: center; padding: 12px 20px;
  box-shadow: 0 2px 12px rgba(0,0,0,.16);
}
.back-home { color: #d7e2eb; text-decoration: none; font-size: .88rem; }
.back-home:hover { color: white; }
.callbar-center { min-width: 0; text-align: center; }
.callbar-label { display: block; color: #9fb0bf; font-size: .68rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.current-title { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 800; }
.progress { display: flex; align-items: center; gap: 10px; color: #d7e2eb; font-size: .86rem; }
.progress-track { width: 86px; height: 5px; border-radius: 6px; background: rgba(255,255,255,.16); overflow: hidden; }
.progress-fill { display: block; height: 100%; background: #ef8a57; transition: width .2s ease; }

.section-rail { position: sticky; top: 61px; z-index: 20; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; padding: 8px max(18px, calc((100vw - 1120px) / 2)); background: rgba(247,249,251,.97); border-bottom: 1px solid var(--line); backdrop-filter: blur(10px); }
.section-rail h2 { display: none; }
.section-link { width: 100%; min-height: 34px; border: 1px solid var(--line); background: white; color: #52606d; text-align: center; padding: 5px 7px; border-radius: 8px; font-size: .72rem; line-height: 1.12; }
.section-link:hover { background: #edf1f4; color: var(--ink); }
.section-link.active { background: var(--copper-soft); border-color: #dba080; color: #7a371c; font-weight: 800; }
.section-number { display: inline-block; margin-right: 4px; color: #8996a2; font-variant-numeric: tabular-nums; }

.viewer-grid { display: block; width: min(860px, calc(100% - 56px)); margin: 0 auto; padding: 32px 0 90px; }

.script-stage { min-width: 0; }
.section-heading { margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.section-heading .eyebrow { margin-bottom: 7px; }
.section-heading h1 { margin: 0; font-size: clamp(1.8rem, 4vw, 2.65rem); line-height: 1.08; letter-spacing: -.04em; }
.script-content { background: white; border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(24px, 5vw, 46px); box-shadow: var(--shadow); }
.script-content h5 { margin: 1.05em 0 .45em; font-size: 1.08rem; line-height: 1.52; font-weight: 650; }
.script-content p { margin: .5em 0 1em; }
.script-content em.text-info { color: #527088; }
.script-content .text-primary { color: #a74820; background: #fff3eb; border-radius: 4px; padding: 0 3px; }
.script-content strong { color: #293f52; }
.decision-card { margin: 0 0 20px; padding: 15px 17px; border: 1px solid #e3b28f; border-left: 5px solid var(--copper); border-radius: 10px; background: var(--copper-soft); }
.decision-card strong { display: block; margin-bottom: 5px; color: #7a371c; font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; }
.decision-card p { margin: 0; color: #653b29; font-weight: 650; }
.compact-note { width: max-content; max-width: 100%; margin: 4px 0 16px; }
.compact-note .panel-title a { padding: 7px 38px 7px 12px; background: #f4f1ec; color: #6e665c; font-size: .7rem; letter-spacing: .1em; }
.compact-note .panel-body { max-width: 680px; padding: 10px; }
.compact-note .decision-card { margin: 0; }
.answer-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 12px 0 18px; }
.answer-grid > .panel, .answer-grid > .panel-group { margin: 0; min-width: 0; }
.answer-option > .panel > .panel-heading .panel-title a, .answer-grid > .panel.answer-positive > .panel-heading .panel-title a { background: #e9f6ee; color: #245d3d; }
.answer-negative > .panel > .panel-heading .panel-title a, .answer-grid > .panel.answer-negative > .panel-heading .panel-title a { background: #fff0ed; color: #8d382f; }
.opener-answers { align-items: start; }
.opener-answers > .panel-group > .panel > .panel-heading .panel-title a { min-height: 48px; display: flex; align-items: center; font-size: 1rem; }
.branch-guide { margin-top: 0; padding: 10px 12px; background: #fff7e8; border-left: 4px solid #d89b36; font-weight: 700; }
.branch-label { margin: 16px 0 8px; color: #72513e; font-size: .7rem; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.nested-objection, .nested-answer { margin: 8px 0; }
.bottom-objection-heading { margin: 28px 0 10px; padding-top: 16px; border-top: 2px solid var(--copper); }
.bottom-objection-heading span { display: block; color: #777; font-size: .72rem; }
.bottom-objection-heading strong { color: #7a371c; font-size: .9rem; text-transform: uppercase; letter-spacing: .08em; }
.exit-call { margin: 14px 0 5px; padding: 13px 15px; border: 1px solid #e7b4b4; border-left: 5px solid #b94848; border-radius: 9px; background: #fff1f1; }
.exit-call strong { display: block; margin-bottom: 5px; color: #952f2f; font-size: .76rem; letter-spacing: .1em; text-transform: uppercase; }
.exit-call h5 { margin: 0; color: #512626; }
.exit-call p { margin: 7px 0 0; color: #8a3939; font-weight: 800; }
.panel-group { margin: 13px 0; }
.panel { border: 1px solid #d9e1e7; border-radius: 10px; overflow: hidden; background: #fbfcfd; }
.panel .panel { background: white; }
.panel-heading { margin: 0; }
.panel-title { margin: 0; font-size: .92rem; line-height: 1.35; }
.panel-title a { position: relative; display: block; color: #21384d; background: #eef3f6; text-decoration: none; padding: 13px 44px 13px 15px; font-weight: 800; }
.panel-title a::after { content: '+'; position: absolute; right: 15px; top: 50%; transform: translateY(-50%); color: var(--copper); font-size: 1.35rem; }
.panel-title a[aria-expanded="true"]::after { content: '\2212'; }
.panel-title a:hover { background: #e4edf2; }
@media (max-width: 620px) { .answer-grid { grid-template-columns: 1fr; } }
.panel-collapse { display: none; }
.panel-collapse.open { display: block; }
.panel-body { padding: 7px 17px 14px; border-top: 1px solid #d9e1e7; }
.panel-body > :first-child { margin-top: .7em; }

.bottom-nav { position: fixed; z-index: 25; inset: 50% 0 auto; transform: translateY(-50%); pointer-events: none; }
.nav-button { position: absolute; top: 0; display: grid; place-items: center; width: 42px; height: 52px; padding: 0; border: 1px solid var(--line); border-radius: 0 12px 12px 0; color: #52606d; background: rgba(255,255,255,.92); box-shadow: 0 5px 18px rgba(19,40,61,.12); font-size: 1.4rem; line-height: 1; pointer-events: auto; backdrop-filter: blur(8px); }
.nav-button[data-move="-1"] { left: 0; }
.nav-button[data-move="1"] { right: 0; border-radius: 12px 0 0 12px; }
.nav-button:hover:not(:disabled) { color: white; background: var(--copper); border-color: var(--copper); }
.nav-button.primary { color: #52606d; background: rgba(255,255,255,.92); }
.nav-button:disabled { opacity: .35; cursor: default; }
.loading, .error { padding: 50px; text-align: center; color: var(--muted); }

@media (max-width: 800px) {
  .callbar { grid-template-columns: auto 1fr; gap: 10px; }
  .callbar-center { text-align: right; }
  .progress { display: none; }
  .section-rail { top: 62px; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; padding: 7px 8px; }
  .section-link { min-height: 31px; padding: 4px; font-size: .66rem; }
  .viewer-grid { width: calc(100% - 28px); padding: 18px 0 80px; }
  .nav-button { width: 34px; height: 46px; opacity: .82; }
  .script-card { grid-template-columns: 1fr; }
  .open-script { width: 100%; }
}

@media (min-width: 801px) and (max-width: 1050px) {
  .section-rail { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media print {
  .callbar, .section-rail, .bottom-nav { display: none; }
  .viewer-grid { display: block; padding: 0; }
  .script-content { border: 0; box-shadow: none; padding: 0; }
}
