:root {
  --bg: #1a1714;
  --bg-raised: #221e1a;
  --ink: #f4ece1;
  --ink-soft: #c9bfae;
  --ink-faint: #7a7165;
  --rule: #2e2823;
  --accent: #d4a373;
  --flag: #9c6644;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-press: cubic-bezier(0.2, 0.8, 0.2, 1);
  --dur: 240ms;
  --dur-long: 600ms;
  --dur-press: 120ms;
  --page-gutter: clamp(1.5rem, 5vw, 2.75rem);
  --field-inset-x: 1rem;
  --font-prose: "Lora", Georgia, serif;
  --font-ui: "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  /* Typographic scale — keep all sizes referencing these tokens. */
  --fs-eyebrow: 11px;     /* uppercase labels (PROSE, ARC, OUTLINE, THIS PASSAGE READS AS) */
  --ls-eyebrow: 0.14em;
  --fs-ui-xs: 12px;       /* meta, footers, table cells, captions */
  --fs-ui-sm: 13px;       /* segmented controls, links, ordered list */
  --fs-ui-md: 14px;       /* default UI body */
  --fs-prose-sm: 16px;    /* secondary prose (intro paragraph, outline editor) */
  --fs-prose-md: 18px;    /* main reading prose (textarea, results body) */
  --fs-button: 15px;      /* primary action label */
  --fs-wordmark: 1.375rem;
  --fs-wordmark-hero: clamp(1.85rem, 2.75vw, 2.5rem);
  --lh-ui: 1.5;
  --lh-prose: 1.7;
  --fn-analysis: hsl(0, 30%, 58%);
  --fn-anecdote: hsl(9, 30%, 58%);
  --fn-aside: hsl(18, 30%, 58%);
  --fn-call_to_action: hsl(28, 30%, 58%);
  --fn-character_beat: hsl(37, 30%, 58%);
  --fn-climactic_action: hsl(46, 30%, 58%);
  --fn-concession: hsl(55, 30%, 58%);
  --fn-context: hsl(65, 30%, 58%);
  --fn-counterargument: hsl(74, 30%, 58%);
  --fn-data_point: hsl(83, 30%, 58%);
  --fn-definition: hsl(92, 30%, 58%);
  --fn-delays_climax: hsl(102, 30%, 58%);
  --fn-dialogue_exchange: hsl(111, 30%, 58%);
  --fn-escalation: hsl(120, 30%, 58%);
  --fn-establishes_setting: hsl(129, 30%, 58%);
  --fn-evidence: hsl(138, 30%, 58%);
  --fn-exposition: hsl(148, 30%, 58%);
  --fn-falling_action: hsl(157, 30%, 58%);
  --fn-flashback: hsl(166, 30%, 58%);
  --fn-hook: hsl(175, 30%, 58%);
  --fn-inciting_incident: hsl(185, 30%, 58%);
  --fn-internal_monologue: hsl(194, 30%, 58%);
  --fn-introduces_character: hsl(203, 30%, 58%);
  --fn-mood_shift: hsl(212, 30%, 58%);
  --fn-pivot: hsl(222, 30%, 58%);
  --fn-quoted_authority: hsl(231, 30%, 58%);
  --fn-reflection: hsl(240, 30%, 58%);
  --fn-resolution: hsl(249, 30%, 58%);
  --fn-restates_thesis: hsl(258, 30%, 58%);
  --fn-rising_tension: hsl(268, 30%, 58%);
  --fn-scene_setting: hsl(277, 30%, 58%);
  --fn-sensory_detail: hsl(286, 30%, 58%);
  --fn-subverts_expectation: hsl(295, 30%, 58%);
  --fn-synthesis: hsl(304, 30%, 58%);
  --fn-thematic_echo: hsl(314, 30%, 58%);
  --fn-thesis_statement: hsl(323, 30%, 58%);
  --fn-time_skip: hsl(332, 30%, 58%);
  --fn-transition: hsl(341, 30%, 58%);
  --fn-world_detail: hsl(350, 30%, 58%);
}

@keyframes prose-placeholder-invite {
  0%,
  100% {
    opacity: 0.38;
  }
  50% {
    opacity: 0.9;
  }
}

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

html {
  scroll-padding-bottom: 7rem;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--fs-ui-md);
  line-height: var(--lh-ui);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern", "liga", "calt", "ss01";
}

/* Prose voice: enable old-style numerals + better punctuation kerning. */
#prose,
#outline,
.col-body-text,
.prose-block,
.result-heading,
.wordmark,
.btn-reflect {
  font-feature-settings: "kern", "liga", "clig", "calt", "onum";
}

/*
 * Fixed footer overlays the viewport bottom — reserve scroll space so tail
 * content (disclosures, last lines) isn’t hidden behind it.
 */
body {
  padding-bottom: max(7.5rem, calc(5rem + env(safe-area-inset-bottom, 0px)));
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

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

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 var(--page-gutter);
  border-bottom: 1px solid var(--rule);
  background: var(--bg);
  z-index: 20;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.02);
}

.wordmark {
  margin: 0;
  font-family: var(--font-prose);
  font-size: var(--fs-wordmark);
  font-style: italic;
  font-weight: 400;
  color: var(--ink);
  letter-spacing: 0.02em;
}

.wordmark-hero {
  font-size: var(--fs-wordmark-hero);
  line-height: 1.15;
}

.mode-fieldset {
  border: none;
  margin: 1.35rem 0 0;
  padding: 0;
}

.mode-legend {
  font-family: var(--font-ui);
  font-size: var(--fs-eyebrow);
  font-weight: 500;
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 10px;
  padding: 0;
}

.mode-segments-row {
  position: relative;
  width: fit-content;
  max-width: 100%;
}

.mode-segments {
  display: flex;
  width: min(22rem, 100%);
  border-radius: 8px;
  border: 1px solid var(--rule);
  overflow: hidden;
  background: var(--bg);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.02);
}

.mode-opt {
  position: relative;
  flex: 1;
  display: flex;
  cursor: pointer;
}

.mode-opt input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.mode-opt-text {
  flex: 1;
  text-align: center;
  padding: 12px 14px;
  font-family: var(--font-ui);
  font-size: var(--fs-ui-sm);
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--ink-soft);
  background: var(--bg);
  border-right: 1px solid var(--rule);
  transition:
    color 320ms var(--ease),
    background 320ms var(--ease),
    box-shadow 320ms var(--ease),
    transform var(--dur-press) var(--ease-press);
}

.mode-opt:active .mode-opt-text {
  transform: scale(0.985);
}

.mode-opt:last-child .mode-opt-text {
  border-right: none;
}

.mode-opt:hover .mode-opt-text {
  color: var(--ink);
  background: var(--bg-raised);
}

.mode-opt input:checked + .mode-opt-text {
  color: var(--accent);
  background: var(--bg-raised);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent);
}

.mode-opt input:focus-visible + .mode-opt-text {
  outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent);
  outline-offset: 2px;
}

@media (max-width: 520px) {
  .mode-segments {
    max-width: none;
    flex-direction: column;
  }

  .mode-opt-text {
    border-right: none;
    border-bottom: 1px solid var(--rule);
  }

  .mode-opt:last-child .mode-opt-text {
    border-bottom: none;
  }
}

/* When there’s prose but no genre yet, draw the eye to Fiction / Nonfiction (not Reflect). */
@keyframes mode-segments-invite {
  0%,
  100% {
    box-shadow:
      0 0 0 1px color-mix(in srgb, var(--accent) 28%, transparent),
      0 0 18px color-mix(in srgb, var(--accent) 14%, transparent),
      0 4px 32px -10px color-mix(in srgb, var(--accent) 20%, transparent);
  }
  50% {
    box-shadow:
      0 0 0 1px color-mix(in srgb, var(--accent) 50%, transparent),
      0 0 32px color-mix(in srgb, var(--accent) 24%, transparent),
      0 6px 40px -8px color-mix(in srgb, var(--accent) 28%, transparent);
  }
}

.input-section.has-prose:not([data-mode]) .mode-segments {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--rule));
  animation: mode-segments-invite 2.4s var(--ease) infinite;
}

@media (prefers-reduced-motion: reduce) {
  .input-section.has-prose:not([data-mode]) .mode-segments {
    animation: none;
    box-shadow:
      0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent),
      0 0 20px color-mix(in srgb, var(--accent) 14%, transparent);
  }
}

.page-flow {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  padding-top: 80px;
  box-sizing: border-box;
}

.page-flow > .mobile-desktop-hint {
  order: -1;
}

.mobile-desktop-hint {
  display: none;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 10px var(--page-gutter);
  box-sizing: border-box;
  background: color-mix(in srgb, var(--bg-raised) 92%, var(--accent));
  border-bottom: 1px solid var(--rule);
  font-family: var(--font-ui);
  font-size: var(--fs-ui-xs);
  line-height: 1.45;
  color: var(--ink-soft);
}

.mobile-desktop-hint__text {
  margin: 0;
  flex: 1;
  min-width: 0;
}

.mobile-desktop-hint__dismiss {
  flex-shrink: 0;
  padding: 0;
  margin-top: 1px;
}

html.mobile-desktop-hint-dismissed .mobile-desktop-hint {
  display: none !important;
}

@media (max-width: 720px) {
  .mobile-desktop-hint {
    display: flex;
  }

  html.mobile-desktop-hint-dismissed .mobile-desktop-hint {
    display: none !important;
  }
}

.page-flow > #input-section {
  order: 1;
}

.page-flow > .main {
  order: 2;
}

.page-flow > .site-footer {
  order: 3;
}

.main {
  padding: 0 var(--page-gutter) 100px;
  max-width: 1200px;
  margin: 0 auto;
}

.main:has(#result-section:not([hidden])) {
  max-width: min(1760px, 92vw);
}

html.is-results .main {
  max-width: min(1760px, 92vw);
}

.input-section {
  display: grid;
  grid-template-columns: 1fr min(720px, 100%) 1fr;
  align-items: stretch;
  column-gap: 2.5rem;
  position: relative;
  isolation: isolate;
  box-sizing: border-box;
  width: 100%;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--page-gutter);
  padding-right: var(--page-gutter);
}

.input-section[hidden] {
  display: none !important;
}

.input-inner {
  grid-column: 2;
  position: relative;
  z-index: 2;
  background: var(--bg);
  isolation: isolate;
}

.input-gutter {
  position: relative;
  z-index: 1;
  overflow: hidden;
  align-self: stretch;
  min-height: 480px;
  pointer-events: none;
}

.input-gutter-left {
  grid-column: 1;
}

.input-gutter-right {
  grid-column: 3;
}

@media (max-width: 1080px) {
  .input-section {
    grid-template-columns: 1fr min(720px, 100%) 1fr;
    column-gap: 1rem;
  }
}

@media (max-width: 900px) {
  .input-section {
    display: block;
  }
  .input-gutter-right {
    display: none;
  }
  .input-gutter-left {
    display: block;
    min-height: 0;
    margin-bottom: 0.75rem;
  }
  .gutter-stack {
    position: static;
    inset: auto;
    align-items: center;
    text-align: center;
    max-width: none;
    margin-left: auto;
    margin-right: auto;
    padding-left: 0;
    padding-right: 0;
  }
  .marginalia {
    display: none;
  }
  .input-inner {
    max-width: 720px;
    margin: 0 auto;
  }
}

.field {
  position: relative;
  display: block;
}

#prose {
  width: 100%;
  min-height: 280px;
  padding: 4px var(--field-inset-x) 10px var(--field-inset-x);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--rule);
  border-radius: 2px;
  color: var(--ink);
  font-family: var(--font-prose);
  font-size: var(--fs-prose-md);
  line-height: var(--lh-prose);
  resize: vertical;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

#prose::placeholder {
  color: var(--ink-soft);
  font-style: italic;
}

/* Gentle pulse on empty field only — stops once user types */
#prose:placeholder-shown::placeholder {
  animation: prose-placeholder-invite 2.4s var(--ease) infinite;
}

@media (prefers-reduced-motion: reduce) {
  #prose:placeholder-shown::placeholder {
    animation: none;
    opacity: 0.72;
  }
}

/* Empty field: accent glow on load before click — invites paste */
#prose:placeholder-shown {
  border-bottom-color: color-mix(in srgb, var(--accent) 42%, var(--rule));
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--accent) 14%, transparent),
    0 0 28px color-mix(in srgb, var(--accent) 12%, transparent),
    0 8px 36px -10px color-mix(in srgb, var(--accent) 18%, transparent);
}

#prose:placeholder-shown:focus {
  outline: none;
  border-bottom-color: color-mix(in srgb, var(--accent) 78%, var(--bg));
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent),
    0 0 36px color-mix(in srgb, var(--accent) 18%, transparent),
    0 10px 44px -8px color-mix(in srgb, var(--accent) 26%, transparent);
}

/* After there’s text: calm chrome; subtle glow only when focused */
#prose:not(:placeholder-shown) {
  border-bottom-color: var(--rule);
  box-shadow: none;
}

#prose:not(:placeholder-shown):focus {
  outline: none;
  border-bottom-color: color-mix(in srgb, var(--accent) 55%, var(--rule));
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--accent) 12%, transparent),
    0 0 24px color-mix(in srgb, var(--accent) 10%, transparent),
    0 6px 32px -10px color-mix(in srgb, var(--accent) 14%, transparent);
}

.word-count {
  position: absolute;
  right: 0;
  bottom: -20px;
  font-family: var(--font-mono);
  font-size: var(--fs-ui-xs);
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  opacity: 0.85;
  font-feature-settings: "tnum";
}

.outline-toggle-wrap {
  margin: 20px 0 0;
}

.outline-field {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transform: translateY(-4px);
  transition:
    max-height 380ms var(--ease),
    opacity 320ms var(--ease),
    transform 380ms var(--ease),
    margin 320ms var(--ease);
  margin: 0;
}

.outline-field.is-open {
  max-height: 400px;
  opacity: 1;
  transform: translateY(0);
  margin-top: 12px;
}

#outline {
  width: 100%;
  min-height: 100px;
  padding: 12px;
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  border-radius: 4px;
  color: var(--ink);
  font-family: var(--font-prose);
  font-size: var(--fs-prose-sm);
  line-height: 1.6;
  resize: vertical;
}

#outline:focus {
  outline: 1px solid var(--ink-faint);
  outline-offset: 2px;
}

.field-label {
  display: block;
  font-family: var(--font-ui);
  font-size: var(--fs-eyebrow);
  font-weight: 500;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: var(--ls-eyebrow);
  margin-bottom: 6px;
}

.text-link {
  background: none;
  border: none;
  color: var(--ink-soft);
  font-family: var(--font-ui);
  font-size: var(--fs-ui-sm);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  padding: 0;
  transition:
    color var(--dur) var(--ease),
    text-underline-offset var(--dur) var(--ease),
    transform var(--dur-press) var(--ease-press),
    opacity var(--dur) var(--ease);
}

.text-link:hover {
  color: var(--ink);
  text-underline-offset: 3px;
}

.text-link:active {
  transform: translateY(0.5px) scale(0.98);
  opacity: 0.85;
}

/* --- Prose actions: mode, reflect, outline (shown once prose has text) --- */
.prose-actions-panel {
  max-height: 0;
  opacity: 0;
  transform: translateY(-6px);
  overflow: hidden;
  pointer-events: none;
  transition:
    max-height 460ms var(--ease),
    opacity 340ms var(--ease),
    transform 460ms var(--ease);
}

.input-section.has-prose .prose-actions-panel {
  max-height: min(960px, 92vh);
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  /* Mascots sit outside `.mode-segments-row`; hidden overflow was clipping them. */
  overflow: visible;
}

@media (prefers-reduced-motion: reduce) {
  .prose-actions-panel {
    transition:
      max-height 200ms linear,
      opacity 160ms linear,
      transform 200ms linear;
  }
}

/* --- Mode + Reflect row (below the textarea) --- */
.mode-actions-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.25rem;
  margin-top: 1.35rem;
  flex-wrap: wrap;
}

.mode-actions-row .mode-fieldset {
  margin: 0;
  flex: 0 1 auto;
}

.mode-actions-row .reflect-wrap {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.kbd-hint {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--ink-faint);
  font-family: var(--font-ui);
  font-size: var(--fs-ui-xs);
  user-select: none;
}

.kbd-hint kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: var(--bg-raised);
  color: var(--ink-soft);
  font-family: var(--font-ui);
  font-size: 11px;
  line-height: 1;
}

@media (max-width: 520px) {
  .kbd-hint {
    display: none;
  }
}

@media (max-width: 520px) {
  .mode-actions-row {
    flex-direction: column;
    align-items: stretch;
  }
  .mode-actions-row .reflect-wrap {
    justify-content: stretch;
  }
}

/* --- Reflect button: same voice as the wordmark (Lora italic), quiet chrome --- */
.btn-reflect {
  min-width: 10rem;
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 0 1.35rem;
  font-family: var(--font-prose);
  font-size: clamp(1.05rem, 1.25vw, 1.25rem);
  font-weight: 400;
  font-style: italic;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: none;
  transition:
    color var(--dur) var(--ease),
    border-color var(--dur) var(--ease),
    background-color var(--dur) var(--ease),
    transform var(--dur-press) var(--ease-press);
}

.btn-reflect:not(:disabled):hover {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--rule));
  background: color-mix(in srgb, var(--bg-raised) 85%, transparent);
}

.btn-reflect:not(:disabled):active {
  transform: translateY(0.5px);
}

.btn-reflect:focus {
  outline: none;
}

.btn-reflect:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 55%, var(--ink-faint));
  outline-offset: 3px;
}

.btn-reflect:disabled {
  cursor: not-allowed;
  color: var(--ink-faint);
  border-color: color-mix(in srgb, var(--rule) 70%, var(--bg));
  opacity: 0.55;
}

.btn-reflect-label {
  display: block;
  white-space: nowrap;
  line-height: 1.2;
}

/* --- Giant backdrop mascots (viewport-fixed; shown only when genre matches data-mode) --- */
.mascot-backdrop {
  position: fixed;
  top: 56px;
  bottom: 80px;
  width: 65vw; /* 50vw × 1.3 */
  z-index: 0;
  pointer-events: none;
  user-select: none;
  opacity: 0;
  transition:
    opacity 700ms var(--ease),
    transform 700ms var(--ease);
}

.mascot-backdrop img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

/* Single viewport-right slot: fiction + nonfiction swap here at identical size */
.mascot-backdrop.mascot-fiction,
.mascot-backdrop.mascot-nonfiction {
  left: auto;
  right: 0;
  transform: scale(0.97) translateX(22%);
}

.mascot-backdrop.mascot-fiction img {
  transform: scaleX(-1);
  object-position: right center;
}

.mascot-backdrop.mascot-nonfiction img {
  object-position: right center;
}

.input-section[data-mode="fiction"] .mascot-backdrop.mascot-fiction,
.input-section[data-mode="nonfiction"] .mascot-backdrop.mascot-nonfiction {
  opacity: 0.14;
  transform: scale(1) translateX(22%);
}

@media (max-width: 720px) {
  .input-section[data-mode="fiction"] .mascot-backdrop.mascot-fiction,
  .input-section[data-mode="nonfiction"] .mascot-backdrop.mascot-nonfiction {
    opacity: 0.1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mascot-backdrop {
    transition: opacity 200ms linear;
  }

  .mascot-backdrop.mascot-fiction,
  .mascot-backdrop.mascot-nonfiction {
    transform: translateX(22%);
  }

  .input-section[data-mode="fiction"] .mascot-backdrop.mascot-fiction,
  .input-section[data-mode="nonfiction"] .mascot-backdrop.mascot-nonfiction {
    transform: translateX(22%);
  }
}

/* --- Marginalia: ambient editorial copy in the left gutter --- */
@keyframes marg-fade-in {
  from {
    opacity: 0;
    transform: translateX(-6px);
  }
  to {
    opacity: 0.32;
    transform: translateX(0);
  }
}

@keyframes marg-breathe {
  0%, 100% { opacity: 0.28; }
  50% { opacity: 0.4; }
}

.gutter-stack {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem;
  box-sizing: border-box;
  width: 100%;
  max-width: 320px;
}

.marginalia {
  position: static;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  text-align: left;
  padding: 0;
  margin: 0;
  width: 100%;
}

.marg-line {
  margin: 0;
  font-family: var(--font-prose);
  font-size: clamp(1rem, 1.25vw, 1.35rem);
  line-height: 1.4;
  color: var(--ink);
  opacity: 0;
  font-feature-settings: "kern", "liga", "clig", "calt", "onum";
  animation:
    marg-fade-in 1100ms var(--ease) forwards,
    marg-breathe 9s var(--ease) infinite;
  animation-delay: var(--d, 0ms), calc(var(--d, 0ms) + 1100ms);
}

.marg-line em {
  font-style: italic;
  color: var(--accent);
  opacity: 0.9;
}

@media (prefers-reduced-motion: reduce) {
  .marg-line {
    animation: none;
    opacity: 0.32;
  }
}

.stats-strip {
  max-width: min(1760px, 92vw);
  margin: 0 auto 20px;
  padding: 12px 14px;
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  border-radius: 4px;
  font-size: var(--fs-ui-xs);
  line-height: 1.5;
  color: var(--ink-soft);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.02);
}

.summary-bar {
  position: sticky;
  top: 56px;
  z-index: 8;
  max-width: min(720px, 100%);
  margin: 0 auto 24px;
  padding-top: 4px;
  background: var(--bg);
  box-shadow: 0 8px 16px -8px color-mix(in srgb, var(--bg) 95%, transparent);
}

.summary-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 6px 6px 6px 14px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.02);
  transition: border-color var(--dur) var(--ease);
}

.summary-row:hover {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--rule));
}

.summary-line {
  flex: 1;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--ink-soft);
  font-family: var(--font-ui);
  font-size: var(--fs-ui-sm);
  padding: 6px 0;
  cursor: pointer;
  font-feature-settings: "tnum";
  transition: color var(--dur) var(--ease);
}

.summary-line:hover {
  color: var(--ink);
}

.summary-edit {
  flex: 0 0 auto;
  padding: 6px 10px;
  border-radius: 3px;
}

.summary-edit::before {
  content: "← ";
  margin-right: 1px;
}

.result-section {
  margin-top: 8px;
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity 480ms var(--ease),
    transform 480ms var(--ease);
}

.result-section:not([hidden]) {
  opacity: 1;
  transform: translateY(0);
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
}

@media (min-width: 960px) {
  .result-grid {
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
    gap: 28px 32px;
  }
  .result-arc {
    position: sticky;
    top: 132px;
  }
}

.result-heading {
  margin: 0 0 14px;
  font-family: var(--font-prose);
  font-size: 1.125rem;
  font-weight: 500;
  letter-spacing: 0.005em;
  color: var(--ink);
  text-transform: none;
}

.result-heading em {
  font-style: italic;
  font-weight: 400;
}

.col-body-text {
  font-family: var(--font-prose);
  font-size: var(--fs-prose-md);
  line-height: var(--lh-prose);
  color: var(--ink);
  max-width: 68ch;
  margin: 0;
}

.prose-block {
  display: grid;
  grid-template-columns: 2.75rem 3px 1fr;
  column-gap: 12px;
  margin-bottom: 32px;
  padding: 10px 10px 12px 8px;
  margin-left: -8px;
  border-radius: 4px;
  background: linear-gradient(
    to right,
    color-mix(in srgb, var(--fn, var(--ink-faint)) 10%, transparent),
    transparent 18%
  );
  transition: opacity var(--dur) var(--ease);
}

.prose-block.prose-block--dim {
  opacity: 0.28;
}

.prose-index {
  font-family: var(--font-ui);
  font-size: var(--fs-ui-xs);
  color: var(--ink-faint);
  text-decoration: none;
  padding-top: 2px;
  align-self: start;
}

.prose-index:hover {
  color: var(--ink);
}

.prose-bar {
  min-height: 1em;
  background: var(--fn, var(--ink-faint));
  width: 3px;
  border-radius: 2px;
  align-self: stretch;
  position: relative;
  cursor: default;
}

.prose-bar .prose-tooltip {
  left: 0;
}

.prose-block:hover .prose-tooltip {
  opacity: 1;
  pointer-events: auto;
}

.prose-tooltip,
.drift-tooltip {
  position: absolute;
  z-index: 5;
  left: 0;
  bottom: 100%;
  margin-bottom: 6px;
  min-width: 12rem;
  max-width: 20rem;
  padding: 8px 10px;
  background: var(--bg-raised);
  color: var(--ink-soft);
  font-family: var(--font-ui);
  font-size: var(--fs-ui-xs);
  line-height: var(--lh-ui);
  border: 1px solid var(--rule);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.02);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur) var(--ease);
}

.drift-line {
  text-decoration: underline;
  text-decoration-style: dotted;
  text-decoration-color: var(--flag);
  text-underline-offset: 4px;
  cursor: default;
}

.drift-line .drift-tooltip {
  left: 0;
  top: 100%;
  margin-top: 4px;
  bottom: auto;
}
.drift-line:hover .drift-tooltip {
  opacity: 1;
  pointer-events: auto;
}

.prose-caps {
  display: block;
  font-family: var(--font-ui);
  font-size: var(--fs-eyebrow);
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 6px;
  font-style: normal;
  font-weight: 500;
}

.prose-txt {
  position: relative;
  margin: 0;
  white-space: pre-wrap;
}

.column-footer {
  margin: 20px 0 0;
  color: var(--ink-faint);
  font-family: var(--font-ui);
  font-size: var(--fs-ui-sm);
}

.chart-wrap {
  height: 420px;
  position: relative;
}

.arc-tooltip-root {
  position: fixed;
  left: 0;
  top: 0;
  pointer-events: none;
  z-index: 100;
  opacity: 0;
  transition: opacity 120ms linear;
  transform: translate(-8px, -100%);
  margin-top: -8px;
}

.arc-tooltip-card {
  pointer-events: none;
  min-width: 14rem;
  max-width: 22rem;
  padding: 10px 12px;
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  font-family: var(--font-ui);
  font-size: var(--fs-ui-xs);
  line-height: 1.45;
  color: var(--ink-soft);
}

.arc-tooltip-card .arc-tip-n {
  font-family: var(--font-mono);
  color: var(--accent);
  margin-bottom: 4px;
}

.arc-tooltip-card .arc-tip-meta {
  margin-top: 6px;
  color: var(--ink-faint);
}

.arc-tooltip-card .arc-tip-snippet {
  margin-top: 8px;
  font-family: var(--font-prose);
  font-size: var(--fs-prose-sm);
  color: var(--ink);
  opacity: 0.92;
}

.drift-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 10px 0 0;
  font-family: var(--font-ui);
  font-size: var(--fs-ui-xs);
  color: var(--ink-soft);
}

.drift-chip-btn {
  background: none;
  border: 1px solid var(--rule);
  border-radius: 4px;
  color: var(--accent);
  font-family: var(--font-ui);
  font-size: var(--fs-ui-xs);
  padding: 4px 10px;
  cursor: pointer;
}

.drift-chip-btn:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--rule));
}

.arc-legend {
  margin: 14px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  align-items: center;
}

.arc-legend-clear {
  font-family: var(--font-ui);
  font-size: var(--fs-ui-xs);
  color: var(--ink-faint);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  padding: 0;
}

.arc-legend-clear:hover {
  color: var(--ink);
}

.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: color-mix(in srgb, var(--bg-raised) 88%, transparent);
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--ink-soft);
  cursor: pointer;
  transition:
    border-color var(--dur) var(--ease),
    opacity var(--dur) var(--ease);
}

.legend-chip:hover {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--rule));
}

.legend-chip.is-active {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--rule));
  color: var(--ink);
}

.legend-chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--fn, var(--ink-faint));
}

.drift-notes {
  max-width: min(1760px, 92vw);
  margin: 40px auto 0;
  padding: 20px 16px 28px;
  border-top: 1px solid var(--rule);
}

.drift-notes-heading {
  margin: 0 0 14px;
  font-family: var(--font-prose);
  font-size: 1rem;
  font-weight: 500;
  font-style: italic;
  color: var(--ink-soft);
}

.drift-notes-body {
  display: grid;
  gap: 12px;
}

.drift-note-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: start;
  font-family: var(--font-ui);
  font-size: var(--fs-ui-sm);
  color: var(--ink-soft);
  padding: 10px 12px;
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  border-radius: 4px;
}

.drift-note-row .mono {
  color: var(--accent);
}

.drift-note-jump {
  flex-shrink: 0;
  font-size: var(--fs-ui-xs);
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.outline-jump {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 4px 0;
  margin: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.outline-jump:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.outline-table caption {
  caption-side: top;
  text-align: left;
  font-family: var(--font-ui);
  font-size: var(--fs-ui-xs);
  color: var(--ink-faint);
  padding-bottom: 10px;
}

.outline-table tr[data-n] {
  cursor: pointer;
}

.outline-table tr[data-n]:hover td {
  background: color-mix(in srgb, var(--bg-raised) 60%, transparent);
}

.outline-table tr.row-match td.actual::before {
  content: "✓ ";
  color: var(--ink-faint);
  margin-right: 4px;
}

.outline-table tr.row-mismatch td.intended {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.outline-table tr.row-mismatch td.mismatch-actual {
  border-left-width: 3px;
}

.outline-table tr.row-mismatch .actual-label {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.chart-wrap.empty::after {
  content: "No pacing map returned.";
  position: absolute;
  left: 0;
  right: 0;
  top: 40%;
  text-align: center;
  color: var(--ink-faint);
  font-family: var(--font-ui);
  font-size: var(--fs-ui-sm);
}

.arc-stats {
  font-size: var(--fs-ui-xs);
  line-height: var(--lh-ui);
  margin: 12px 0 0;
  color: var(--ink-faint);
}

.mono {
  font-family: var(--font-mono);
  font-feature-settings: "tnum";
}

.outline-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-ui);
  font-size: var(--fs-ui-xs);
}

.outline-table th,
.outline-table td {
  padding: 6px 8px;
  vertical-align: top;
  border-bottom: 1px solid var(--rule);
}

.outline-table .intended,
.outline-table .actual {
  color: var(--ink-soft);
}

.outline-table .mismatch-actual {
  border-left: 2px solid var(--flag);
  padding-left: 10px;
  color: var(--ink);
}

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

.outline-list li {
  color: var(--ink-soft);
  font-family: var(--font-ui);
  font-size: var(--fs-ui-sm);
  line-height: var(--lh-ui);
  padding: 4px 0;
  border-bottom: 1px solid var(--rule);
}

.outline-item-index {
  font-family: var(--font-mono);
  color: var(--ink-faint);
  margin-right: 6px;
}

.outline-arrow {
  color: var(--flag);
  margin: 0 4px;
}

.site-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  min-height: 80px;
  padding: 20px var(--page-gutter) max(24px, env(safe-area-inset-bottom, 0px));
  text-align: center;
  background: linear-gradient(to top, var(--bg), var(--bg));
  border-top: 1px solid var(--rule);
  z-index: 10;
}

.footer-links {
  margin: 0;
  color: var(--ink-soft);
  font-family: var(--font-ui);
  font-size: var(--fs-ui-sm);
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-credit {
  margin: 8px 0 0;
  display: flex;
  justify-content: center;
}

.credit-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-faint);
  font-family: var(--font-ui);
  font-size: var(--fs-ui-xs);
  text-decoration: none;
  letter-spacing: 0.02em;
  padding: 4px 6px;
  border-radius: 4px;
  transition:
    color var(--dur) var(--ease),
    background var(--dur) var(--ease),
    transform var(--dur-press) var(--ease-press);
}

.credit-link:hover {
  color: var(--ink);
  background: color-mix(in srgb, var(--bg-raised) 80%, transparent);
  text-decoration: none;
}

.credit-link:active {
  transform: translateY(0.5px) scale(0.98);
}

.credit-linkedin {
  display: block;
  flex-shrink: 0;
}

.disclosure {
  position: relative;
  z-index: 11;
  width: min(560px, calc(100% - 2 * var(--page-gutter)));
  margin: 0 auto 1.5rem;
  padding: 16px 20px 20px;
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  color: var(--ink-soft);
  font-family: var(--font-ui);
  font-size: var(--fs-ui-sm);
  line-height: 1.6;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.02);
  overflow: hidden;
  opacity: 0;
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  margin-top: 0;
  margin-bottom: 0;
  transform: translateY(-4px);
  transition:
    opacity 280ms var(--ease),
    max-height 380ms var(--ease),
    padding 320ms var(--ease),
    margin 320ms var(--ease),
    transform 320ms var(--ease);
}

.disclosure.is-open {
  opacity: 1;
  max-height: 540px;
  padding: 16px 20px 20px;
  margin: 0 auto 1.5rem;
  transform: translateY(0);
}

.disclosure p:last-child {
  margin-bottom: 0;
}

.disclosure p {
  margin: 0 0 0.85em;
}


.outline-tools {
  margin-bottom: 8px;
}

.result-body {
  min-height: 1em;
}

