:root {
  --bg-paper: #faf6ee;
  --bg-surface: #fffdf8;
  --bg-elevated: #f3ede0;
  --bg-spotlight: #fffcf5;
  --rule-margin: #e8e0cf;
  --rule-strong: #d5c9b2;
  --ink-primary: #1f1c18;
  --ink-secondary: #5c5347;
  --ink-muted: #847868;
  --accent-indigo: #2b4c7e;
  --accent-crimson: #9b2c2c;
  --accent-gold: #b07d1a;
  --accent-forest: #2c5e3b;
  --shadow-soft: 0 4px 18px rgba(31, 28, 24, 0.06);
  --shadow-modal: 0 18px 48px rgba(20, 17, 13, 0.18);

  --font-serif: "Newsreader", Georgia, "Palatino Linotype", "Book Antiqua", serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --scripture-font-scale: 1;
}

html[data-theme="sepia"] {
  --bg-paper: #f2e6cf;
  --bg-surface: #f7eedb;
  --bg-elevated: #eadbc0;
  --bg-spotlight: #f9f1e1;
  --rule-margin: #dac7a6;
  --rule-strong: #c3ac85;
  --ink-primary: #2b2117;
  --ink-secondary: #5d4c3b;
  --ink-muted: #85725e;
  --accent-indigo: #294a73;
  --accent-crimson: #8f2a24;
  --accent-gold: #9c6a14;
  --accent-forest: #295736;
  --shadow-soft: 0 4px 18px rgba(43, 33, 23, 0.07);
  --shadow-modal: 0 18px 48px rgba(34, 24, 15, 0.2);
}

html[data-theme="dark"] {
  --bg-paper: #161412;
  --bg-surface: #1d1a17;
  --bg-elevated: #26221d;
  --bg-spotlight: #211e1a;
  --rule-margin: #302b25;
  --rule-strong: #453e35;
  --ink-primary: #ebe3d4;
  --ink-secondary: #b9ae9c;
  --ink-muted: #8b8173;
  --accent-indigo: #79a8e8;
  --accent-crimson: #e87878;
  --accent-gold: #e2b24a;
  --accent-forest: #74bd89;
  --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.35);
  --shadow-modal: 0 20px 54px rgba(0, 0, 0, 0.6);
}

html[data-theme="amber"] {
  --bg-paper: #110d09;
  --bg-surface: #18120c;
  --bg-elevated: #221a12;
  --bg-spotlight: #1c150e;
  --rule-margin: #302419;
  --rule-strong: #473626;
  --ink-primary: #e8c996;
  --ink-secondary: #b89b6d;
  --ink-muted: #87704d;
  --accent-indigo: #8ab0e0;
  --accent-crimson: #e07b68;
  --accent-gold: #e6b355;
  --accent-forest: #7eb885;
  --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.45);
  --shadow-modal: 0 20px 54px rgba(0, 0, 0, 0.7);
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-paper);
  color: var(--ink-primary);
  font-family: var(--font-sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

.mobile-only {
  display: none;
}

/* App Shell */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Front-Door Welcome Screen */
.welcome-gate {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 12% 18%, rgba(43, 76, 126, 0.06), transparent 44%),
    radial-gradient(circle at 86% 80%, rgba(176, 125, 26, 0.07), transparent 46%),
    var(--bg-paper);
}

.welcome-topbar {
  padding: 18px 28px 10px;
}

.welcome-topbar-inner {
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.welcome-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 28px 44px;
}

.welcome-grid {
  max-width: 1120px;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 44px;
  align-items: center;
}

.welcome-copy {
  min-width: 0;
}

.welcome-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-indigo);
  margin-bottom: 10px;
}

.welcome-headline {
  font-family: var(--font-serif);
  font-size: clamp(2.35rem, 3.8vw, 3.35rem);
  font-weight: 600;
  line-height: 1.06;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
  color: var(--ink-primary);
}

.welcome-lead {
  font-size: 0.98rem;
  line-height: 1.62;
  color: var(--ink-secondary);
  max-width: 52ch;
  margin: 0 0 22px;
}

.welcome-features {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
  border-top: 1px solid var(--rule-margin);
}

.welcome-features li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 11px 0;
  border-bottom: 1px solid var(--rule-margin);
}

.welcome-features strong {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink-primary);
}

.welcome-features span {
  font-size: 0.83rem;
  line-height: 1.45;
  color: var(--ink-secondary);
}

.welcome-auth-box {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.btn-google-signin {
  min-width: 240px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 24px;
  border-radius: 10px;
  border: 1px solid var(--rule-strong);
  background: var(--ink-primary);
  color: var(--bg-paper);
  font-family: var(--font-sans);
  font-size: 0.93rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: transform 0.12s ease, filter 0.15s ease, opacity 0.15s ease;
}

.btn-google-signin:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.btn-google-signin:disabled {
  opacity: 0.65;
  cursor: wait;
}

.google-g {
  width: 19px;
  height: 19px;
  background: #ffffff;
  border-radius: 50%;
  padding: 2px;
  flex-shrink: 0;
}

.welcome-status {
  font-size: 0.8rem;
  color: var(--ink-secondary);
  max-width: 52ch;
}

.welcome-status.denied {
  color: var(--accent-crimson);
  font-weight: 500;
  background: rgba(155, 44, 44, 0.08);
  border: 1px solid rgba(155, 44, 44, 0.25);
  padding: 9px 12px;
  border-radius: 8px;
}

/* Specimen Study Page */
.welcome-specimen {
  min-width: 0;
}

.specimen-page {
  display: flex;
  background: var(--bg-surface);
  border: 1px solid var(--rule-strong);
  border-radius: 14px;
  box-shadow:
    0 1px 0 var(--rule-margin),
    6px 6px 0 -1px var(--bg-elevated),
    6px 6px 0 0 var(--rule-margin),
    var(--shadow-modal);
  overflow: hidden;
}

.specimen-margin-rule {
  width: 22px;
  flex-shrink: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 27px,
    var(--rule-margin) 27px,
    var(--rule-margin) 28px
  );
  border-right: 2px solid var(--accent-crimson);
  opacity: 0.55;
}

.specimen-body {
  flex: 1;
  padding: 22px 24px 20px;
  min-width: 0;
}

.specimen-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--ink-secondary);
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--rule-margin);
}

.specimen-pill {
  color: var(--accent-indigo);
  background: var(--bg-elevated);
  border: 1px solid var(--rule-margin);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
}

.specimen-canvas {
  position: relative;
  padding-right: 42px;
}

.specimen-arc-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  color: var(--accent-indigo);
  pointer-events: none;
}

.specimen-prior {
  font-family: var(--font-serif);
  font-size: 0.96rem;
  line-height: 1.55;
  color: var(--ink-secondary);
  opacity: 0.78;
  margin: 0 0 12px;
}

.specimen-spotlight {
  border-left: 3px solid var(--accent-indigo);
  background: var(--bg-spotlight);
  padding: 10px 12px 10px 14px;
  border-radius: 0 8px 8px 0;
}

.specimen-verse {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  line-height: 1.68;
  color: var(--ink-primary);
  margin: 0 0 8px;
}

.specimen-verse:last-child {
  margin-bottom: 0;
}

.specimen-vnum {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--accent-indigo);
  background: var(--bg-elevated);
  border: 1px solid var(--rule-margin);
  border-radius: 4px;
  padding: 1px 5px;
  margin-right: 5px;
  vertical-align: 1px;
}

.spec-hl {
  color: inherit;
  border-radius: 3px;
  padding: 1px 3px;
}

.spec-contrast { background: rgba(210, 184, 232, 0.45); }
.spec-gospel { background: rgba(169, 205, 240, 0.48); }
.spec-promise { background: rgba(242, 214, 117, 0.48); }

html[data-theme="dark"] .spec-contrast,
html[data-theme="amber"] .spec-contrast { background: rgba(136, 98, 178, 0.36); }
html[data-theme="dark"] .spec-gospel,
html[data-theme="amber"] .spec-gospel { background: rgba(64, 122, 186, 0.36); }
html[data-theme="dark"] .spec-promise,
html[data-theme="amber"] .spec-promise { background: rgba(196, 158, 42, 0.34); }

.specimen-ring-wrap {
  position: relative;
  display: inline-block;
  padding: 0 6px;
}

.specimen-ring-svg {
  position: absolute;
  inset: -2px -3px;
  width: calc(100% + 6px);
  height: calc(100% + 4px);
  color: var(--accent-gold);
  pointer-events: none;
}

.specimen-note {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  margin-top: 14px;
  padding: 10px 12px;
  background: var(--bg-paper);
  border: 1px solid var(--rule-margin);
  border-radius: 8px;
  font-size: 0.78rem;
  color: var(--ink-secondary);
}

.specimen-note-tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent-indigo);
}

@media (max-width: 920px) {
  .welcome-grid {
    grid-template-columns: 1fr;
    gap: 28px;
    max-width: 620px;
  }
}

@media (max-width: 600px) {
  .welcome-topbar {
    padding: 14px 16px 8px;
  }
  .welcome-stage {
    padding: 12px 16px 32px;
  }
  .specimen-margin-rule {
    width: 12px;
  }
  .specimen-body {
    padding: 16px 16px 14px;
  }
  .specimen-canvas {
    padding-right: 0;
  }
  .specimen-arc-svg {
    display: none;
  }
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--rule-margin);
  flex-wrap: wrap;
}

.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

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

.brand-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
}

.brand-name {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.12rem;
  letter-spacing: -0.01em;
}

.beta-pill {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid var(--rule-strong);
  color: var(--ink-secondary);
  margin-left: 4px;
  vertical-align: middle;
}

.series-picker-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

select, input[type="text"], input[type="date"], input[type="number"], textarea {
  font-family: var(--font-sans);
  font-size: 0.88rem;
  color: var(--ink-primary);
  background: var(--bg-paper);
  border: 1px solid var(--rule-strong);
  border-radius: 7px;
  padding: 6px 10px;
  outline: none;
  transition: border-color 0.15s ease;
}

select:focus, input:focus, textarea:focus {
  border-color: var(--accent-indigo);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.84rem;
  padding: 6px 12px;
  border-radius: 7px;
  border: 1px solid var(--rule-strong);
  background: var(--bg-surface);
  color: var(--ink-primary);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.08s ease;
}

.btn:hover:not(:disabled) {
  background: var(--bg-elevated);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-sm { padding: 5px 10px; font-size: 0.82rem; }
.btn-xs { padding: 4px 8px; font-size: 0.76rem; }

.btn-primary {
  background: var(--accent-indigo);
  border-color: var(--accent-indigo);
  color: #fffdf8;
}
.btn-primary:hover:not(:disabled) {
  filter: brightness(1.08);
  background: var(--accent-indigo);
}

.btn-secondary {
  background: var(--bg-elevated);
  border-color: var(--rule-strong);
}

.btn-ghost {
  background: transparent;
  border-color: var(--rule-margin);
}

.btn-danger-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--accent-crimson);
}
.btn-danger-ghost:hover:not(:disabled) {
  background: rgba(155, 44, 44, 0.1);
}

.sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--rule-margin);
  background: var(--bg-paper);
  color: var(--ink-secondary);
  font-size: 0.76rem;
  cursor: pointer;
}

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink-muted);
}
.sync-dot.synced { background: var(--accent-forest); }
.sync-dot.syncing { background: var(--accent-gold); }
.sync-dot.offline-queued { background: var(--accent-gold); }
.sync-dot.error { background: var(--accent-crimson); }

/* Tier 2: Weekly Sunday Sessions Bar */
.weeks-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 18px;
  background: var(--bg-paper);
  border-bottom: 1px solid var(--rule-margin);
  flex-wrap: wrap;
}

.weeks-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.week-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--rule-margin);
  background: var(--bg-surface);
  color: var(--ink-secondary);
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
}

.week-tab.active {
  background: var(--accent-indigo);
  border-color: var(--accent-indigo);
  color: #fffdf8;
  font-weight: 600;
}

.week-tab-range {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  opacity: 0.85;
}

.weeks-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Week Details Collapsible Panel */
.week-details-panel {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--rule-margin);
  padding: 12px 18px;
}

.week-details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  max-width: 1120px;
}

.week-details-grid label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 0.75rem;
  color: var(--ink-secondary);
  font-weight: 500;
}

.week-details-grid label.span-2 {
  grid-column: span 2;
}

.week-details-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

/* Markup Toolbar */
.markup-toolbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 18px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--rule-strong);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
  overflow-x: auto;
}

.tool-group {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-paper);
  padding: 3px;
  border-radius: 8px;
  border: 1px solid var(--rule-margin);
}

.tool-btn {
  border: none;
  background: transparent;
  color: var(--ink-secondary);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}

.tool-btn.active {
  background: var(--ink-primary);
  color: var(--bg-paper);
}

.tool-suboptions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

.swatch-btn {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.1s ease;
}

.swatch-btn.active {
  border-color: var(--ink-primary);
  transform: scale(1.12);
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--rule-strong);
  background: var(--bg-paper);
  color: var(--ink-primary);
  font-size: 0.75rem;
  cursor: pointer;
  white-space: nowrap;
}

.tag-chip.active {
  border-color: var(--ink-primary);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--ink-primary);
}

.tag-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.tool-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.pill-toggle {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--rule-strong);
  background: var(--bg-paper);
  color: var(--ink-secondary);
  font-size: 0.76rem;
  cursor: pointer;
  white-space: nowrap;
}

.pill-toggle.active {
  border-color: var(--accent-indigo);
  background: rgba(43, 76, 126, 0.12);
  color: var(--ink-primary);
}

.tool-banner {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--rule-strong);
  padding: 6px 18px;
  font-size: 0.82rem;
  color: var(--ink-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* Main Workspace Layout */
.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 365px;
  align-items: start;
  max-width: 1380px;
  width: 100%;
  margin: 0 auto;
}

.workspace.focus-mode {
  grid-template-columns: 1fr;
}

.workspace.focus-mode .margin-pane {
  display: none;
}

.passage-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.font-size-group {
  display: inline-flex;
  gap: 2px;
}

.logos-link {
  text-decoration: none;
}

.scripture-pane {
  padding: 20px 26px 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}

.passage-header {
  width: 100%;
  max-width: 720px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rule-margin);
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.passage-title {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: 600;
  margin: 0;
  line-height: 1.15;
}

.passage-subtitle {
  margin: 4px 0 0;
  font-size: 0.84rem;
  color: var(--ink-secondary);
}

/* Unified Zero-Drift Scripture Column */
.scripture-column {
  position: relative;
  width: 100%;
  max-width: 720px;
  background: var(--bg-surface);
  border: 1px solid var(--rule-margin);
  border-radius: 12px;
  padding: 26px 76px 32px 26px; /* Right gutter reserved for Phrase Arcs */
  box-shadow: var(--shadow-soft);
  touch-action: pan-y;
  user-select: text;
}

.scripture-column[data-ink-touch="draw"] {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.scripture-column[data-tool="highlight"],
.scripture-column[data-tool="wrap"],
.scripture-column[data-tool="arc"] {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.scripture-column[data-span-dragging="true"] {
  touch-action: none;
}

.annotations-overlay-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 4;
  overflow: visible;
}

.annotations-overlay-svg .arc-hit-group {
  pointer-events: auto;
  cursor: pointer;
}

.verses-container {
  position: relative;
  z-index: 2;
}

/* Fold / Spotlight Groups */
.slice-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 12px;
  margin: 4px 0 12px;
  border-radius: 8px;
  background: var(--bg-elevated);
  border: 1px dashed var(--rule-strong);
  font-size: 0.79rem;
  color: var(--ink-secondary);
}

.spotlight-frame {
  position: relative;
  border-left: 3px solid var(--accent-indigo);
  background: var(--bg-spotlight);
  padding: 12px 12px 12px 16px;
  margin: 12px -12px 14px -16px;
  border-radius: 0 10px 10px 0;
}

.spotlight-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-indigo);
  margin-bottom: 8px;
}

.section-heading {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 600;
  font-size: 1.08rem;
  color: var(--ink-secondary);
  margin: 14px 0 6px;
}

/* Verse Row & Per-Verse Zero-Drift SVG Ink Layer */
.verse-row {
  position: relative;
  padding: 8px 6px 10px;
  border-radius: 6px;
  margin-bottom: 6px;
  transition: opacity 0.18s ease, background-color 0.18s ease;
}

.verse-row.verse-prior,
.verse-row.verse-upcoming {
  opacity: 0.54;
}

.verse-row.verse-prior:hover,
.verse-row.verse-prior.verse-unfolded {
  opacity: 0.94;
}

.verse-row.verse-collapsed {
  display: none;
}

.verse-row.verse-focused {
  background: rgba(43, 76, 126, 0.06);
}

.verse-row.verse-pulse {
  animation: versePulse 1.3s ease;
}

@keyframes versePulse {
  0% { background: rgba(176, 125, 26, 0.28); }
  100% { background: transparent; }
}

.verse-content {
  position: relative;
  z-index: 2;
  font-family: var(--font-serif);
  font-size: calc(1.24rem * var(--scripture-font-scale, 1));
  line-height: 1.82;
  color: var(--ink-primary);
}

.verse-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--accent-indigo);
  background: var(--bg-elevated);
  border: 1px solid var(--rule-margin);
  border-radius: 5px;
  padding: 1px 6px;
  margin-right: 7px;
  vertical-align: 2px;
  cursor: pointer;
}

.verse-badge.has-note::after {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-gold);
}

.word-token {
  display: inline;
  padding: 2px 1px;
  border-radius: 3px;
  cursor: inherit;
  transition: background-color 0.12s ease;
}

.word-token.token-pending {
  outline: 2px dashed var(--accent-indigo);
  background: rgba(43, 76, 126, 0.14);
}

.word-token.token-holding {
  outline: 2px dotted var(--accent-gold);
  background: rgba(176, 125, 26, 0.22);
}

.word-token.token-pulse {
  background: rgba(176, 125, 26, 0.35) !important;
}

.verse-ink-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 5;
  pointer-events: none;
  overflow: visible;
}

.scripture-column[data-ink-hidden="true"] .verse-ink-svg {
  display: none;
}

.collapsed-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 10px;
}

.collapsed-verse-chip {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--rule-margin);
  background: var(--bg-surface);
  color: var(--ink-secondary);
  cursor: pointer;
}

.collapsed-verse-chip:hover {
  border-color: var(--accent-indigo);
  color: var(--ink-primary);
}

/* Right Margin Notes Pane */
.margin-pane {
  position: sticky;
  top: 52px;
  height: calc(100vh - 56px);
  overflow-y: auto;
  background: var(--bg-surface);
  border-left: 1px solid var(--rule-margin);
  padding: 14px 16px 32px;
}

.pane-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--rule-margin);
  padding-bottom: 8px;
  margin-bottom: 12px;
}

.pane-tab {
  flex: 1;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-secondary);
  font-family: var(--font-sans);
  font-size: 0.76rem;
  font-weight: 500;
  padding: 6px 6px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}

.pane-tab.active {
  background: var(--bg-elevated);
  border-color: var(--rule-margin);
  color: var(--ink-primary);
  font-weight: 600;
}

.pane-content {
  display: none;
}
.pane-content.active {
  display: block;
}

.focused-verse-box {
  background: var(--bg-paper);
  border: 1px solid var(--rule-margin);
  border-radius: 9px;
  padding: 12px;
  margin-bottom: 14px;
}

.focused-verse-box h4 {
  margin: 0 0 6px;
  font-size: 0.88rem;
  color: var(--accent-indigo);
}

.focused-verse-quote {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.92rem;
  color: var(--ink-secondary);
  margin: 0 0 8px;
  border-left: 2px solid var(--rule-strong);
  padding-left: 8px;
}

.focused-verse-box textarea {
  width: 100%;
  resize: vertical;
}

.notes-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-secondary);
  margin-bottom: 8px;
}

.filter-check {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 400;
  cursor: pointer;
}

.notes-list, .connections-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.note-card, .conn-card {
  background: var(--bg-paper);
  border: 1px solid var(--rule-margin);
  border-radius: 8px;
  padding: 9px 10px;
  font-size: 0.83rem;
  cursor: pointer;
}

.note-card:hover, .conn-card:hover {
  border-color: var(--accent-indigo);
}

.note-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 4px;
}

.note-ref {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--accent-indigo);
}

.week-chip {
  font-size: 0.7rem;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--ink-secondary);
}

.series-notes-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.series-notes-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-secondary);
}

.sermon-week-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  margin-bottom: 10px;
  background: var(--bg-paper);
  border: 1px solid var(--rule-margin);
  border-radius: 8px;
}

.sermon-week-badge {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent-indigo);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.label-with-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.outline-quick-btns {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.summary-pre {
  white-space: pre-wrap;
  margin: 4px 0 8px;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  line-height: 1.55;
}

.connections-section h4 {
  margin: 10px 0 6px;
  font-size: 0.8rem;
  color: var(--ink-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Modals */
dialog.modal {
  border: none;
  padding: 0;
  background: transparent;
  max-width: 96vw;
  color: var(--ink-primary);
}

dialog.modal::backdrop {
  background: rgba(20, 17, 13, 0.55);
  backdrop-filter: blur(2px);
}

.modal-card {
  width: 560px;
  max-width: 94vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--rule-strong);
  border-radius: 14px;
  box-shadow: var(--shadow-modal);
  overflow: hidden;
}

.modal-card.modal-lg { width: 740px; }
.modal-card.modal-xl { width: 920px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--rule-margin);
}

.modal-header h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.28rem;
}

.modal-subtitle {
  margin: 2px 0 0;
  font-size: 0.8rem;
  color: var(--ink-secondary);
}

.modal-body {
  padding: 16px 18px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--rule-margin);
}

.form-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.form-row label, .full-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--ink-secondary);
}

.form-row label.grow { flex: 1; min-width: 200px; }
.form-row label.narrow { width: 84px; }
.full-label { width: 100%; margin-bottom: 10px; }

.passage-source-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.source-tab {
  flex: 1;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--rule-margin);
  background: var(--bg-paper);
  color: var(--ink-secondary);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
}

.source-tab.active {
  background: var(--accent-indigo);
  border-color: var(--accent-indigo);
  color: #fffdf8;
}

.source-pane { display: none; }
.source-pane.active { display: block; }

.passage-preview-box {
  margin-top: 12px;
  padding: 12px;
  border-radius: 8px;
  background: var(--bg-paper);
  border: 1px solid var(--rule-margin);
  max-height: 220px;
  overflow-y: auto;
  font-family: var(--font-serif);
  font-size: 0.96rem;
}

/* Summary Sheet */
.summary-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-paper);
  border: 1px solid var(--rule-margin);
  border-radius: 9px;
  margin-bottom: 14px;
}

.summary-scope-group, .summary-export-btns {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.inline-radio, .inline-check {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8rem;
  cursor: pointer;
}

.summary-sheet {
  background: var(--bg-paper);
  border: 1px solid var(--rule-margin);
  border-radius: 10px;
  padding: 22px 24px;
}

.summary-sheet h3 {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  margin: 0 0 4px;
}

.summary-sheet h4 {
  margin: 16px 0 6px;
  font-size: 0.9rem;
  color: var(--accent-indigo);
  border-bottom: 1px solid var(--rule-margin);
  padding-bottom: 3px;
}

.summary-snapshot-img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--rule-margin);
  margin: 8px 0;
}

.memo-checklist {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 6px;
  margin-top: 8px;
}

.code-preview {
  background: var(--bg-paper);
  border: 1px solid var(--rule-margin);
  border-radius: 8px;
  padding: 10px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  max-height: 180px;
  overflow: auto;
  margin-top: 10px;
}

.divider {
  border: none;
  border-top: 1px solid var(--rule-margin);
  margin: 16px 0;
}

.hint-text, .empty-hint {
  font-size: 0.8rem;
  color: var(--ink-secondary);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 99;
  background: var(--ink-primary);
  color: var(--bg-paper);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.82rem;
  box-shadow: var(--shadow-modal);
}

/* Responsive Tablet Portrait & Phone */
@media (max-width: 980px) {
  .mobile-only {
    display: inline-flex;
  }

  .desktop-only {
    display: none !important;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .scripture-pane {
    padding: 14px 12px 84px;
  }

  .scripture-column {
    padding: 18px 54px 24px 16px;
  }

  .verse-content {
    font-size: calc(1.12rem * var(--scripture-font-scale, 1));
    line-height: 1.78;
  }

  .margin-pane {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    height: 62vh;
    z-index: 50;
    border-left: none;
    border-top: 1px solid var(--rule-strong);
    border-radius: 16px 16px 0 0;
    box-shadow: var(--shadow-modal);
    transform: translateY(105%);
    transition: transform 0.22s ease;
  }

  .margin-pane.open {
    transform: translateY(0);
  }

  .drawer-mobile-handle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    font-size: 0.9rem;
    padding-bottom: 8px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--rule-margin);
  }
}

@media (max-width: 600px) {
  .topbar, .weeks-bar, .markup-toolbar {
    padding: 8px 12px;
  }
  .week-details-grid label.span-2 {
    grid-column: span 1;
  }
  .scripture-column {
    padding: 14px 44px 20px 12px;
  }
}

/* Print / Save-to-PDF Stylesheet */
@media print {
  .no-print {
    display: none !important;
  }
  body, html {
    background: #ffffff !important;
    color: #000000 !important;
  }
  .workspace {
    display: block;
  }
  .scripture-column {
    box-shadow: none;
    border: none;
    max-width: 100%;
    padding: 0 40px 0 0;
  }
  .verse-prior, .verse-upcoming {
    opacity: 0.78 !important;
  }
  dialog.modal[open] {
    position: static;
    width: 100%;
    max-width: 100%;
  }
  .modal-card {
    box-shadow: none;
    border: none;
    width: 100%;
    max-height: none;
  }
}

/* ============================================================================
 * Full Screen Mode (Whole-Experience Full Width & Native Fullscreen Theme Fix)
 * ============================================================================ */

html:fullscreen,
html:-webkit-full-screen {
  background: var(--bg-paper);
  color: var(--ink-primary);
  width: 100%;
  height: 100%;
  overflow-y: auto;
}

html::backdrop,
html::-webkit-backdrop {
  background: var(--bg-paper);
}

.app-shell.is-fullscreen .workspace {
  max-width: 100%;
}

@media (min-width: 981px) {
  .app-shell.is-fullscreen .workspace {
    grid-template-columns: minmax(0, 1fr) minmax(380px, 440px);
  }
  .app-shell.is-fullscreen .workspace.focus-mode {
    grid-template-columns: 1fr;
  }
}

.app-shell.is-fullscreen .passage-header,
.app-shell.is-fullscreen .scripture-column {
  max-width: 960px;
}

.app-shell.is-fullscreen .scripture-pane {
  padding: 16px 24px 56px;
}

#btnFullScreen[aria-pressed="true"] {
  border-color: var(--accent-indigo);
  color: var(--accent-indigo);
  background: rgba(43, 76, 126, 0.12);
  font-weight: 600;
}

/* ============================================================================
 * Phone Mode (One-Handed Navigation & Full-Height Typing)
 * ============================================================================ */

.phone-topbar,
.phone-bottom-dock,
.phone-verse-quickbar {
  display: none;
}

.phone-topbar .phone-done-btn.hidden {
  display: none;
}

.app-shell.phone-mode {
  padding-bottom: calc(66px + env(safe-area-inset-bottom, 0px));
}

.app-shell.phone-mode.phone-keyboard-open {
  padding-bottom: 12px;
}

.app-shell.phone-mode .phone-topbar {
  position: sticky;
  top: 0;
  z-index: 42;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 46px;
  padding: max(6px, env(safe-area-inset-top)) 10px 6px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--rule-margin);
}

.phone-topbar-title {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.phone-top-passage {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ink-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.phone-top-week {
  font-size: 0.72rem;
  color: var(--ink-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.phone-topbar-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.app-shell.phone-mode .phone-topbar .btn[aria-pressed="true"] {
  background: rgba(43, 76, 126, 0.14);
  border-color: var(--accent-indigo);
  color: var(--accent-indigo);
  font-weight: 600;
}

.app-shell.phone-mode:not(.phone-show-menu) .topbar {
  display: none;
}

.app-shell.phone-mode.phone-show-menu .topbar {
  padding: 10px 12px;
  gap: 8px;
}

.app-shell.phone-mode.phone-show-menu .series-picker-wrap {
  width: 100%;
  flex-wrap: wrap;
}

.app-shell.phone-mode.phone-show-menu #seriesSelect {
  flex: 1;
  min-width: 150px;
}

.app-shell.phone-mode:not(.phone-show-tools) .markup-toolbar,
.app-shell.phone-mode:not(.phone-show-tools) .tool-banner {
  display: none;
}

.app-shell.phone-mode .weeks-bar {
  flex-wrap: nowrap;
  overflow-x: auto;
  padding: 6px 10px;
  gap: 6px;
  -webkit-overflow-scrolling: touch;
}

.app-shell.phone-mode .weeks-tabs {
  flex: 1;
  min-width: 0;
  flex-wrap: nowrap;
}

.app-shell.phone-mode .weeks-actions {
  flex-shrink: 0;
  display: flex;
  gap: 4px;
}

.app-shell.phone-mode.phone-view-verses .weeks-bar,
.app-shell.phone-mode.phone-view-series .weeks-bar {
  display: none;
}

.app-shell.phone-mode .workspace {
  display: block;
  grid-template-columns: 1fr;
  max-width: 720px;
  margin: 0 auto;
  min-height: calc(100vh - 114px);
}

.app-shell.phone-mode #btnOpenMobileDrawer,
.app-shell.phone-mode #btnFocusMode,
.app-shell.phone-mode .drawer-mobile-handle {
  display: none !important;
}

.app-shell.phone-mode .scripture-pane {
  display: none;
  padding: 10px 10px 24px;
}

.app-shell.phone-mode.phone-view-passage .scripture-pane {
  display: block;
}

.app-shell.phone-mode .passage-header {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  margin-bottom: 10px;
}

.app-shell.phone-mode .passage-header-actions {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 6px;
  padding-bottom: 2px;
}

.app-shell.phone-mode .scripture-column {
  padding: 14px 22px 22px 14px;
  border-radius: 10px;
}

.app-shell.phone-mode .margin-pane {
  display: none;
  position: static;
  transform: none;
  height: auto;
  min-height: calc(100vh - 122px);
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  padding: 12px 12px 28px;
}

.app-shell.phone-mode.phone-view-sermon .margin-pane,
.app-shell.phone-mode.phone-view-verses .margin-pane,
.app-shell.phone-mode.phone-view-series .margin-pane {
  display: block;
}

.app-shell.phone-mode .pane-tabs {
  display: none;
}

.app-shell.phone-mode.phone-view-series .pane-tabs {
  display: flex;
  margin-bottom: 10px;
}

.app-shell.phone-mode.phone-view-series .pane-tab[data-pane="verse-notes"],
.app-shell.phone-mode.phone-view-series .pane-tab[data-pane="sermon-notes"] {
  display: none;
}

.app-shell.phone-mode .phone-verse-quickbar {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding: 2px 0 10px;
  margin-bottom: 6px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.phone-vchip {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--rule-margin);
  background: var(--bg-surface);
  color: var(--ink-secondary);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.phone-vchip.has-note {
  border-color: var(--accent-indigo);
  color: var(--ink-primary);
}

.phone-vchip.active {
  background: var(--accent-indigo);
  border-color: var(--accent-indigo);
  color: #ffffff;
}

.app-shell.phone-mode textarea,
.app-shell.phone-mode input[type="text"],
.app-shell.phone-mode select {
  font-size: 16px;
  line-height: 1.5;
}

.app-shell.phone-mode #focusedNoteInput {
  min-height: 180px;
}

.app-shell.phone-mode #wkSermonOutline {
  min-height: 205px;
}

.app-shell.phone-mode #wkSermonNotes {
  min-height: 235px;
}

.app-shell.phone-mode .series-notes-form textarea {
  min-height: 130px;
}

.app-shell.phone-mode .phone-topbar .btn,
.app-shell.phone-mode .outline-quick-btns .btn {
  min-height: 36px;
  padding: 6px 11px;
}

.app-shell.phone-mode .phone-bottom-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 48;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--bg-surface);
  border-top: 1px solid var(--rule-strong);
  padding: 4px 6px calc(6px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.08);
}

.phone-dock-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 48px;
  padding: 4px 2px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-secondary);
  font-family: inherit;
  font-size: 0.74rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}

.phone-dock-icon {
  font-size: 1.05rem;
  line-height: 1.1;
}

.phone-dock-btn.active {
  background: rgba(43, 76, 126, 0.14);
  color: var(--accent-indigo);
  font-weight: 700;
}

.app-shell.phone-mode.phone-keyboard-open .phone-bottom-dock {
  display: none;
}

.app-shell.phone-mode.is-fullscreen .workspace {
  display: block;
  max-width: 100%;
}

/* ============================================================================
 * Interactive Welcome Guide & Tool Wizard
 * ============================================================================ */

.guide-modal-card {
  width: 780px;
}

.guide-modal-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.guide-modal-footer {
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.guide-footer-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.guide-step-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  overflow: visible;
  padding-bottom: 2px;
  flex-shrink: 0;
}

.guide-step-pills::-webkit-scrollbar {
  display: none;
}

.guide-pill {
  flex: 0 0 auto;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--rule-margin);
  background: var(--bg-paper);
  color: var(--ink-secondary);
  font-family: var(--font-sans);
  font-size: 0.76rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.guide-pill:hover {
  background: var(--bg-elevated);
  color: var(--ink-primary);
}

.guide-pill.active {
  background: color-mix(in srgb, var(--accent-indigo) 16%, var(--bg-surface));
  border-color: var(--accent-indigo);
  color: var(--ink-primary);
  font-weight: 600;
}

.guide-step-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}

.guide-step-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.18rem;
  color: var(--ink-primary);
}

.guide-step-desc {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink-secondary);
}

.guide-demo-card {
  background: var(--bg-paper);
  border: 1px solid var(--rule-strong);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}

.guide-demo-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.guide-demo-badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--rule-margin);
  color: var(--accent-indigo);
}

.guide-demo-stage {
  min-height: 112px;
}

.guide-demo-caption {
  font-size: 0.78rem;
  color: var(--ink-secondary);
  border-top: 1px dashed var(--rule-margin);
  padding-top: 7px;
}

/* Preview specimens inside stage */
.guide-specimen {
  background: var(--bg-surface);
  border: 1px solid var(--rule-margin);
  border-radius: 10px;
  padding: 12px 14px;
  position: relative;
}

.guide-specimen[data-demo-theme="light"] {
  background: #fffdf8;
  color: #1f1c18;
  border-color: #e8e0cf;
}
.guide-specimen[data-demo-theme="sepia"] {
  background: #f7eedb;
  color: #2b2117;
  border-color: #dac7a6;
}
.guide-specimen[data-demo-theme="dark"] {
  background: #1d1a17;
  color: #ebe3d4;
  border-color: #302b25;
}
.guide-specimen[data-demo-theme="amber"] {
  background: #18120c;
  color: #e8c996;
  border-color: #302419;
}

.guide-specimen-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.guide-meta-pill {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--rule-strong);
  background: var(--bg-elevated);
  color: var(--ink-secondary);
}

.guide-meta-pill.accent {
  border-color: var(--accent-gold);
  color: var(--ink-primary);
}

.guide-specimen-verses {
  font-family: var(--font-serif);
  line-height: 1.72;
}

.guide-specimen-verses mark {
  color: inherit;
  padding: 1px 3px;
  border-radius: 4px;
}

.guide-inline-wrap {
  display: inline-block;
  padding: 0 5px;
  border: 2px solid var(--accent-gold);
  border-radius: 999px;
}

.guide-mini-verse {
  margin: 0 0 6px;
  font-family: var(--font-serif);
  font-size: 0.98rem;
  line-height: 1.65;
  padding: 5px 8px;
  border-radius: 7px;
  transition: opacity 0.2s ease, background-color 0.2s ease;
}

.guide-mini-verse:last-child {
  margin-bottom: 0;
}

.guide-mini-verse.spotlight {
  background: var(--bg-spotlight);
}

.guide-mini-verse.dimmed {
  opacity: 0.56;
  background: var(--bg-elevated);
}

.guide-mini-verse.unfolded {
  background: var(--bg-paper);
  border-left: 3px solid var(--accent-indigo);
}

.guide-mini-verse.appended-glow {
  border-left: 3px solid var(--accent-forest);
}

.guide-vnum {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--accent-indigo);
  margin-right: 6px;
}

.guide-vnum-note {
  color: var(--accent-gold);
}

.guide-week-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.guide-week-chip {
  font-size: 0.74rem;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--rule-margin);
  background: var(--bg-paper);
  color: var(--ink-secondary);
}

.guide-week-chip.active {
  border-color: var(--accent-indigo);
  background: color-mix(in srgb, var(--accent-indigo) 14%, var(--bg-surface));
  color: var(--ink-primary);
  font-weight: 600;
}

.guide-week-chip.added {
  border-color: var(--accent-forest);
  color: var(--accent-forest);
  font-weight: 600;
}

.guide-chip-fold, .guide-badge-mini {
  display: inline-block;
  margin-left: 6px;
  font-family: var(--font-sans);
  font-size: 0.7rem;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--rule-strong);
  color: var(--accent-indigo);
}

/* Interactive highlight sandbox */
.guide-sandbox-verse {
  font-family: var(--font-serif);
  font-size: 1.04rem;
  line-height: 1.85;
  margin-bottom: 10px;
}

.guide-sandbox-tokens {
  display: inline;
}

.guide-sandbox-word {
  appearance: none;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  padding: 1px 4px;
  margin: 0 1px;
  border-radius: 5px;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.12s ease;
}

.guide-sandbox-word:hover {
  box-shadow: inset 0 -2px 0 var(--accent-indigo);
}

.guide-tag-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--rule-margin);
}

.guide-tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--rule-margin);
  background: var(--bg-paper);
  color: var(--ink-primary);
  font-size: 0.74rem;
  cursor: pointer;
}

.guide-tag-pill.active {
  border-color: var(--accent-indigo);
  background: color-mix(in srgb, var(--accent-indigo) 14%, var(--bg-surface));
  font-weight: 600;
}

.guide-tag-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}

/* Step 3: Circles & Phrase Arcs */
.guide-phrase-svg-wrap {
  position: relative;
  display: inline-block;
  padding: 0 5px;
}

.guide-phrase-svg {
  position: absolute;
  inset: -2px -3px;
  width: calc(100% + 6px);
  height: calc(100% + 4px);
  pointer-events: none;
}

.guide-arc-stage {
  padding-right: 84px;
}

.guide-arc-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.guide-arc-anchor {
  padding: 1px 4px;
  border-radius: 4px;
}

.guide-arc-anchor.active-anchor {
  border-bottom: 2px solid var(--accent-indigo);
  background: color-mix(in srgb, var(--accent-indigo) 14%, transparent);
}

.guide-arc-edge-pill {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--rule-strong);
  background: var(--bg-paper);
}

/* Step 4: Animated ink strip + interactive scratchpad */
.guide-step4-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.guide-anim-slot {
  background: var(--bg-surface);
  border: 1px solid var(--rule-margin);
  border-radius: 9px;
  padding: 8px 12px;
}

.guide-anim-verse-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.guide-anim-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--ink-muted);
}

.guide-anim-text-wrap {
  position: relative;
  flex: 1;
  min-width: 220px;
  padding: 4px 0;
}

.guide-anim-verse {
  font-family: var(--font-serif);
  font-size: 0.96rem;
}

.guide-anim-ink-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.guide-anim-pill {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--rule-margin);
  color: var(--accent-indigo);
}

.guide-scratchpad-wrap {
  background: var(--bg-surface);
  border: 1px dashed var(--rule-strong);
  border-radius: 10px;
  padding: 8px 12px;
}

.guide-scratchpad-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--ink-secondary);
  margin-bottom: 6px;
}

.guide-scratchpad-canvas {
  position: relative;
  height: 92px;
  border-radius: 8px;
  background: var(--bg-spotlight);
  border: 1px solid var(--rule-margin);
  overflow: hidden;
}

.guide-scratchpad-underlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  font-family: var(--font-serif);
  font-size: 1.05rem;
  color: var(--ink-muted);
  opacity: 0.62;
  user-select: none;
  pointer-events: none;
}

.guide-scratchpad {
  position: relative;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: crosshair;
  transition: opacity 0.16s ease;
}

.guide-scratchpad.ink-hidden {
  opacity: 0.12;
}

/* Step 5: Split-pane preview */
.guide-split-preview {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 10px;
}

.guide-split-preview.focus-collapsed {
  grid-template-columns: 1.55fr 0.45fr;
}

.guide-split-left, .guide-split-right {
  background: var(--bg-surface);
  border: 1px solid var(--rule-margin);
  border-radius: 9px;
  padding: 10px;
}

.guide-split-right.dimmed-drawer {
  opacity: 0.78;
  border-style: dashed;
}

.guide-split-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.76rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.guide-logos-chip {
  font-size: 0.7rem;
  padding: 1px 7px;
  border-radius: 6px;
  border: 1px solid var(--rule-strong);
  color: var(--accent-indigo);
}

.guide-pane-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.guide-pane-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent-indigo);
}

.guide-pane-text {
  margin: 0;
  font-size: 0.79rem;
  color: var(--ink-secondary);
  line-height: 1.45;
}

.guide-conn-row {
  font-size: 0.78rem;
  padding: 3px 6px;
  border-radius: 6px;
  background: var(--bg-paper);
  border: 1px solid var(--rule-margin);
}

/* Step Controls */
.guide-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}

.guide-choice-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.guide-choice-label {
  font-size: 0.73rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-secondary);
}

.guide-choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.guide-choice-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 5px 11px;
  border-radius: 8px;
  border: 1px solid var(--rule-strong);
  background: var(--bg-paper);
  color: var(--ink-primary);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease;
}

.guide-choice-btn:hover {
  background: var(--bg-elevated);
}

.guide-choice-btn.selected {
  background: color-mix(in srgb, var(--accent-indigo) 16%, var(--bg-surface));
  border-color: var(--accent-indigo);
  font-weight: 600;
}

.guide-theme-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid var(--rule-strong);
  display: inline-block;
}

/* How-To & Try Box */
.guide-howto-box {
  background: var(--bg-elevated);
  border: 1px solid var(--rule-margin);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  flex-shrink: 0;
}

.guide-howto-copy {
  flex: 1;
  min-width: 240px;
  font-size: 0.81rem;
  color: var(--ink-secondary);
  line-height: 1.48;
}

.guide-howto-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* Step 6: Feature Cards Grid */
.guide-features-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.guide-feature-card {
  background: var(--bg-paper);
  border: 1px solid var(--rule-strong);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}

.guide-feature-card:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.guide-feature-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 4px;
}

.guide-feature-title {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--ink-primary);
}

.guide-feature-badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--rule-margin);
  color: var(--accent-indigo);
  white-space: nowrap;
}

.guide-feature-desc {
  margin: 0;
  font-size: 0.79rem;
  color: var(--ink-secondary);
  line-height: 1.44;
}

/* Animations */
@keyframes guideStrokeDraw {
  from { stroke-dasharray: 220; stroke-dashoffset: 220; }
  to { stroke-dasharray: 220; stroke-dashoffset: 0; }
}

.guide-anim-stroke {
  animation: guideStrokeDraw 0.65s ease-out;
}

@media (prefers-reduced-motion: reduce) {
  .guide-anim-stroke {
    animation: none;
  }
}

html[data-theme="dark"] .btn-primary,
html[data-theme="amber"] .btn-primary {
  color: #12100e;
  font-weight: 600;
}

@media (max-width: 640px) {
  .guide-modal-body {
    padding: 12px 14px;
  }
  .guide-step-pills {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    min-height: 42px;
    align-items: center;
  }
  .guide-pill {
    min-height: 36px;
  }
  .guide-choice-btn {
    min-height: 36px;
    font-size: 0.78rem;
  }
  .guide-split-preview,
  .guide-split-preview.focus-collapsed,
  .guide-features-grid {
    grid-template-columns: 1fr;
  }
  .guide-feature-card:last-child:nth-child(odd) {
    grid-column: auto;
  }
  .guide-arc-stage {
    padding-right: 54px;
    padding-bottom: 32px;
  }
  .guide-arc-edge-pill {
    top: auto;
    bottom: 6px;
    right: 10px;
    transform: none;
  }
}
