/* =====================================================================
   Save the Story — design system
   Tokens first, then base, layout, components, views.
   Palette: cool ink neutrals + one marigold accent reserved for structure.
   ===================================================================== */

:root {
  color-scheme: light;

  /* Neutrals (cool, slight blue bias) */
  --bg: #eef0f3;
  --surface: #ffffff;
  --surface-2: #f5f6f8;
  --surface-3: #e9ecf0;
  --line: #d8dce3;
  --line-strong: #b8bfc9;
  --text: #171c24;
  --text-2: #4b5563;
  --text-3: #7a8494;
  --text-inverse: #f4f6f9;

  /* Accent: marigold. Used for structure (beats, progress, focus). */
  --accent: #b3720c;         /* text / icon on light surfaces */
  --accent-bright: #e8a33b;  /* fills, markers */
  --accent-soft: #fbefd8;    /* tinted backgrounds */
  --accent-ring: rgba(232, 163, 59, 0.45);

  /* Ink blocks (hero panels, brand) */
  --ink: #1d2942;
  --ink-2: #27365a;
  --ink-text: #f3f5f9;
  --ink-muted: #aeb8cf;

  /* Semantic (separate from accent) */
  --good: #237a53;
  --good-soft: #dcf2e6;
  --attn: #c2413b;
  --attn-soft: #fbe2e0;
  --info: #35639e;
  --info-soft: #e0eaf7;

  /* Acts (beat rail tints) */
  --act1: #dfe6ef;
  --act2: #f4e7cf;
  --act3: #e6e0f0;

  /* Type */
  --font-ui: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Bricolage Grotesque", var(--font-ui);
  --font-read: "Literata", Georgia, "Iowan Old Style", "Times New Roman", serif;
  --font-mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;

  --fs-xs: 0.75rem;
  --fs-sm: 0.8125rem;
  --fs-md: 0.9375rem;
  --fs-lg: 1.0625rem;
  --fs-xl: 1.25rem;
  --fs-2xl: 1.5rem;
  --fs-3xl: 1.875rem;
  --fs-4xl: 2.5rem;

  /* Shape */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-pill: 999px;
  --shadow-1: 0 1px 2px rgba(23, 28, 36, 0.06), 0 1px 1px rgba(23, 28, 36, 0.04);
  --shadow-2: 0 6px 24px rgba(23, 28, 36, 0.10), 0 2px 6px rgba(23, 28, 36, 0.06);

  /* Layout */
  --sidebar-w: 232px;
  --gutter: 24px;
  --measure: 68ch;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e1218;
    --surface: #161c25;
    --surface-2: #1b222d;
    --surface-3: #232c39;
    --line: #2a3442;
    --line-strong: #3b4757;
    --text: #e7eaef;
    --text-2: #aab3c0;
    --text-3: #7c8797;
    --text-inverse: #12161d;

    --accent: #f0b24e;
    --accent-bright: #f0b24e;
    --accent-soft: #2e2716;
    --accent-ring: rgba(240, 178, 78, 0.45);

    --ink: #1a2338;
    --ink-2: #223052;
    --ink-text: #eef1f7;
    --ink-muted: #9fabc7;

    --good: #4fc48c;
    --good-soft: #15301f;
    --attn: #f07a72;
    --attn-soft: #3a1c1a;
    --info: #86aee0;
    --info-soft: #182638;

    --act1: #1d2634;
    --act2: #2e2717;
    --act3: #251f31;

    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-2: 0 8px 28px rgba(0, 0, 0, 0.45);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1218;
  --surface: #161c25;
  --surface-2: #1b222d;
  --surface-3: #232c39;
  --line: #2a3442;
  --line-strong: #3b4757;
  --text: #e7eaef;
  --text-2: #aab3c0;
  --text-3: #7c8797;
  --text-inverse: #12161d;

  --accent: #f0b24e;
  --accent-bright: #f0b24e;
  --accent-soft: #2e2716;
  --accent-ring: rgba(240, 178, 78, 0.45);

  --ink: #1a2338;
  --ink-2: #223052;
  --ink-text: #eef1f7;
  --ink-muted: #9fabc7;

  --good: #4fc48c;
  --good-soft: #15301f;
  --attn: #f07a72;
  --attn-soft: #3a1c1a;
  --info: #86aee0;
  --info-soft: #182638;

  --act1: #1d2634;
  --act2: #2e2717;
  --act3: #251f31;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-2: 0 8px 28px rgba(0, 0, 0, 0.45);
}

/* ---------------------------------------------------------------------
   Base
   --------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: var(--fs-md);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
[hidden] { display: none !important; }
img, svg { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.15; margin: 0; text-wrap: balance; letter-spacing: -0.01em; }
h1 { font-size: var(--fs-3xl); font-weight: 700; }
h2 { font-size: var(--fs-2xl); font-weight: 700; }
h3 { font-size: var(--fs-xl); font-weight: 600; }
h4 { font-size: var(--fs-lg); font-weight: 600; }
p { margin: 0; }
small, .small { font-size: var(--fs-sm); }
code, kbd, .mono { font-family: var(--font-mono); font-size: 0.9em; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 2px; border-radius: var(--r-sm); }
::selection { background: var(--accent-soft); }
hr { border: 0; border-top: 1px solid var(--line); margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.tabular { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.eyebrow { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); font-weight: 600; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

/* ---------------------------------------------------------------------
   App shell
   --------------------------------------------------------------------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100%; }
.sidebar {
  position: sticky; top: 0; height: 100vh; height: 100dvh;
  display: flex; flex-direction: column; gap: 8px;
  padding: 18px 14px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; text-decoration: none; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 30px; height: 30px; flex: none; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-lg); letter-spacing: -0.01em; line-height: 1.1; }
.brand-sub { font-size: var(--fs-xs); color: var(--text-3); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--r-md);
  color: var(--text-2); font-weight: 500; text-decoration: none;
  border: 1px solid transparent;
}
.nav-item svg { width: 18px; height: 18px; flex: none; opacity: 0.85; }
.nav-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-item[aria-current="page"] { background: var(--accent-soft); color: var(--text); border-color: transparent; }
.nav-item[aria-current="page"] svg { color: var(--accent); opacity: 1; }
.nav-label { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); font-weight: 600; padding: 12px 10px 4px; }
.sidebar-spacer { flex: 1; }
.sidebar-foot { display: flex; flex-direction: column; gap: 6px; padding-top: 8px; border-top: 1px solid var(--line); }
.sidebar-project { padding: 8px 10px; border-radius: var(--r-md); background: var(--surface-2); }
.sidebar-project .eyebrow { margin-bottom: 2px; }
.sidebar-project-title { font-weight: 600; font-size: var(--fs-sm); }

.main { min-width: 0; }
.view { padding: 28px var(--gutter) 80px; max-width: 1180px; margin: 0 auto; }
.view.wide { max-width: 1400px; }
.view.narrow { max-width: 860px; }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto;
    flex-direction: row; align-items: stretch; gap: 0;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
    border-right: 0; border-top: 1px solid var(--line);
    z-index: 30;
  }
  .brand, .nav-label, .sidebar-spacer, .sidebar-foot, .sidebar-project { display: none; }
  .nav { flex-direction: row; flex: 1; justify-content: space-around; }
  .nav-item { flex-direction: column; gap: 3px; padding: 6px 4px; font-size: 11px; border-radius: var(--r-sm); flex: 1; }
  .nav-item svg { width: 20px; height: 20px; }
  .view { padding: 18px 16px 96px; }
  :root { --gutter: 16px; }
}

/* ---------------------------------------------------------------------
   Page header, toolbars, breadcrumbs
   --------------------------------------------------------------------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.page-head h1 { margin-top: 4px; }
.page-head .lede { color: var(--text-2); max-width: 60ch; margin-top: 6px; font-size: var(--fs-lg); }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--text-3); flex-wrap: wrap; }
.crumbs a { color: var(--text-3); }
.crumbs a:hover { color: var(--text); }
.crumbs .sep { opacity: 0.5; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.toolbar .grow { flex: 1; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------------------------------------------------------------------
   Buttons
   --------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 14px; border-radius: var(--r-sm);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  font-weight: 500; font-size: var(--fs-sm); line-height: 1.2; text-decoration: none;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.05s ease;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--ink); color: var(--ink-text); border-color: var(--ink); }
.btn.primary:hover { background: var(--ink-2); }
.btn.accent { background: var(--accent-bright); color: #1b1408; border-color: transparent; }
.btn.accent:hover { filter: brightness(1.04); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.subtle { background: var(--surface-2); border-color: transparent; }
.btn.danger { color: var(--attn); border-color: transparent; background: transparent; }
.btn.danger:hover { background: var(--attn-soft); }
.btn.sm { padding: 5px 10px; font-size: var(--fs-xs); }
.btn.lg { padding: 11px 18px; font-size: var(--fs-md); }
.btn.icon { padding: 7px; }
.btn.icon.sm { padding: 4px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.5; pointer-events: none; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------------------------------------------------------------
   Form controls
   --------------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); }
.field .hint { font-size: var(--fs-xs); color: var(--text-3); }
.field .hint.q { color: var(--text-2); font-size: var(--fs-sm); font-weight: 400; }
.input, .textarea, .select {
  width: 100%; padding: 9px 11px;
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--accent-bright); box-shadow: 0 0 0 3px var(--accent-ring); }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.textarea { resize: vertical; min-height: 84px; line-height: 1.55; }
.textarea.auto { overflow: hidden; resize: none; }
.textarea.read { font-family: var(--font-read); font-size: 1.0625rem; line-height: 1.7; }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: calc(100% - 16px) 55%, calc(100% - 11px) 55%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
.input.lg { font-size: var(--fs-xl); font-family: var(--font-display); font-weight: 600; padding: 10px 12px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px 20px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; padding: 6px 0; }
.check input { margin: 3px 0 0; accent-color: var(--accent-bright); width: 16px; height: 16px; flex: none; }
.radio-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: var(--r-pill);
  border: 1px solid var(--line-strong); background: var(--surface); font-size: var(--fs-sm); cursor: pointer; user-select: none; position: relative;
}
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip:hover { background: var(--surface-2); }
.chip.on, .chip:has(input:checked) { background: var(--accent-soft); border-color: var(--accent-bright); color: var(--text); }
.range { width: 100%; accent-color: var(--accent-bright); }

/* ---------------------------------------------------------------------
   Surfaces
   --------------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 18px; }
.card.pad-lg { padding: 24px; }
.card.flat { background: var(--surface-2); border-color: transparent; }
.card.ink { background: var(--ink); color: var(--ink-text); border-color: transparent; }
.card.ink .muted, .card.ink .faint, .card.ink .eyebrow { color: var(--ink-muted); }
.card.ink a { color: var(--accent-bright); }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head h3 { font-size: var(--fs-lg); }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack.lg { gap: 20px; }
.stack.sm { gap: 8px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.section { margin-top: 32px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head h2 { font-size: var(--fs-xl); }
.divider { height: 1px; background: var(--line); margin: 20px 0; }

/* Pills & tags */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.01em; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.pill.accent { background: var(--accent-soft); color: var(--accent); }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.attn { background: var(--attn-soft); color: var(--attn); }
.pill.info { background: var(--info-soft); color: var(--info); }
.pill.ink { background: var(--ink); color: var(--ink-text); }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.tag { display: inline-flex; padding: 2px 8px; border-radius: var(--r-sm); font-size: var(--fs-xs); background: var(--surface-3); color: var(--text-2); }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line-strong); flex: none; }
.status-dot.draft { background: var(--accent-bright); }
.status-dot.done { background: var(--good); }

/* Lists */
.list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; background: var(--surface); }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); text-decoration: none; color: inherit; }
.list-row:first-child { border-top: 0; }
.list-row:hover { background: var(--surface-2); text-decoration: none; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row > svg { width: 16px; height: 16px; flex: none; color: var(--text-3); }
.list-row .title { font-weight: 600; }
.list-row .meta { font-size: var(--fs-sm); color: var(--text-3); }

/* Empty state */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-2); border: 1px dashed var(--line-strong); border-radius: var(--r-md); }
.empty-state h3 { margin-bottom: 6px; }

/* Progress */
.progress { height: 6px; background: var(--surface-3); border-radius: var(--r-pill); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent-bright); border-radius: var(--r-pill); transition: width 0.25s ease; }
.progress.good > span { background: var(--good); }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .num { font-family: var(--font-display); font-size: var(--fs-2xl); font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; }
.stat .lbl { font-size: var(--fs-xs); color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }

/* Tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 10px 14px; border: 0; background: none; color: var(--text-2); font-weight: 500; font-size: var(--fs-sm); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab[aria-selected="true"], .tab[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent-bright); }
.tab .count { font-size: var(--fs-xs); background: var(--surface-3); padding: 1px 7px; border-radius: var(--r-pill); color: var(--text-2); }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--r-sm); overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; padding: 6px 12px; font-size: var(--fs-sm); color: var(--text-2); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--text); font-weight: 600; }

/* Toast */
.toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--ink); color: var(--ink-text); padding: 10px 14px; border-radius: var(--r-md); box-shadow: var(--shadow-2); font-size: var(--fs-sm); max-width: 360px; animation: toast-in 0.18s ease; }
.toast.good { background: var(--good); color: #fff; }
.toast.attn { background: var(--attn); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (max-width: 860px) { .toasts { bottom: 84px; left: 16px; right: 16px; } .toast { max-width: none; } }

/* Modal */
.modal-back { position: fixed; inset: 0; background: rgba(10, 13, 18, 0.55); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 90; animation: fade 0.15s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-2); width: 100%; max-width: 560px; max-height: calc(100vh - 40px); overflow: auto; padding: 24px; border: 1px solid var(--line); }
.modal h2 { font-size: var(--fs-xl); margin-bottom: 6px; }
.modal .modal-body { margin: 14px 0 20px; color: var(--text-2); }
.modal .modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.modal.wide { max-width: 760px; }

/* Save indicator */
.save-state { font-size: var(--fs-xs); color: var(--text-3); display: inline-flex; align-items: center; gap: 6px; }
.save-state .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--good); }
.save-state.dirty .dot { background: var(--accent-bright); }

/* Keyboard hints */
kbd { display: inline-block; padding: 1px 6px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; background: var(--surface-2); font-size: 11px; color: var(--text-2); }

/* Callouts */
.callout { display: grid; grid-template-columns: 4px 1fr; gap: 12px; padding: 12px 14px 12px 0; background: var(--surface-2); border-radius: var(--r-md); overflow: hidden; }
.callout::before { content: ""; background: var(--accent-bright); border-radius: 2px 0 0 2px; }
.callout.good::before { background: var(--good); }
.callout.attn::before { background: var(--attn); }
.callout.info::before { background: var(--info); }
.callout .callout-title { font-weight: 600; font-size: var(--fs-sm); margin-bottom: 2px; }
.callout p { font-size: var(--fs-sm); color: var(--text-2); }

/* ---------------------------------------------------------------------
   Beat rail — the signature component
   --------------------------------------------------------------------- */
.beat-rail { position: relative; user-select: none; padding: 2px 6px 0; }
/* moments: dots above the act bar */
.beat-rail .marks { position: relative; height: 30px; }
.beat-rail .mark {
  position: absolute; bottom: 0; transform: translateX(-50%);
  display: flex; flex-direction: column-reverse; align-items: center; gap: 3px;
  text-decoration: none; color: var(--text-3); width: 28px;
}
.beat-rail .mark .tick { width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--line-strong); background: var(--surface); transition: transform 0.12s ease; }
.beat-rail .mark .n { font-size: 10px; font-weight: 600; font-variant-numeric: tabular-nums; }
.beat-rail .mark.draft .tick { border-color: var(--accent-bright); background: var(--accent-soft); }
.beat-rail .mark.done .tick { border-color: var(--good); background: var(--good); }
.beat-rail .mark.current .tick { transform: scale(1.35); border-color: var(--accent-bright); background: var(--accent-bright); box-shadow: 0 0 0 4px var(--accent-ring); }
.beat-rail .mark.current, .beat-rail .span.current { color: var(--text); }
.beat-rail .mark:hover .tick { transform: scale(1.25); }
.beat-rail .mark:hover, .beat-rail .span:hover { text-decoration: none; color: var(--text); }
/* act bar */
.beat-rail .acts { display: grid; grid-template-columns: 20fr 60fr 20fr; height: 14px; border-radius: var(--r-pill); overflow: hidden; border: 1px solid var(--line); }
.beat-rail .acts > div { display: flex; align-items: center; justify-content: center; font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 700; color: var(--text-3); }
.beat-rail .acts .a1 { background: var(--act1); }
.beat-rail .acts .a2 { background: var(--act2); }
.beat-rail .acts .a3 { background: var(--act3); }
/* stretches: spans below the act bar */
.beat-rail .spans { position: relative; height: 26px; margin-top: 5px; }
.beat-rail .span { position: absolute; top: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; text-decoration: none; color: var(--text-3); min-width: 10px; }
.beat-rail .span .bar { display: block; width: 100%; height: 7px; border-radius: 4px; background: var(--surface-3); border: 1px solid var(--line-strong); transition: filter 0.12s ease; }
.beat-rail .span .n { font-size: 10px; font-weight: 600; font-variant-numeric: tabular-nums; }
.beat-rail .span.draft .bar { border-color: var(--accent-bright); background: var(--accent-soft); }
.beat-rail .span.done .bar { background: var(--good); border-color: var(--good); }
.beat-rail .span.current .bar { background: var(--accent-bright); border-color: var(--accent-bright); box-shadow: 0 0 0 3px var(--accent-ring); }
.beat-rail .span:hover .bar { filter: brightness(0.93); }
/* tooltips */
.beat-rail .tip {
  position: absolute; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--ink-text); padding: 5px 9px; border-radius: var(--r-sm);
  font-size: var(--fs-xs); white-space: nowrap; pointer-events: none; display: none; z-index: 5;
}
.beat-rail .mark .tip { bottom: calc(100% + 4px); }
.beat-rail .span .tip { top: calc(100% + 4px); }
.beat-rail .mark:hover .tip, .beat-rail .mark:focus-visible .tip, .beat-rail .span:hover .tip, .beat-rail .span:focus-visible .tip { display: block; animation: fade 0.12s ease; }
.beat-rail .mark:first-child { transform: translateX(-6px); }
.beat-rail .mark:last-child { transform: translateX(calc(-100% + 6px)); }
.beat-rail .mark:first-child .tip { left: 0; transform: none; }
.beat-rail .mark:last-child .tip { left: auto; right: 0; transform: none; }
.beat-rail .span:first-child .tip { left: 0; transform: none; }
.beat-rail .span:last-child .tip { left: auto; right: 0; transform: none; }
.beat-rail.compact .marks { height: 13px; }
.beat-rail.compact .mark .n, .beat-rail.compact .span .n { display: none; }
.beat-rail.compact .mark .tick { width: 9px; height: 9px; }
.beat-rail.compact .acts { height: 8px; }
.beat-rail.compact .acts > div { font-size: 0; }
.beat-rail.compact .spans { height: 9px; margin-top: 3px; }
.beat-rail.compact .span .bar { height: 6px; }
@media (max-width: 600px) { .beat-rail .mark .n, .beat-rail .span .n { display: none; } .beat-rail .marks { height: 14px; } .beat-rail .spans { height: 10px; } }

/* Beat grid (overview cards) */
.beat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.beat-card { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); text-decoration: none; color: inherit; min-height: 96px; position: relative; }
.beat-card:hover { border-color: var(--line-strong); text-decoration: none; background: var(--surface-2); }
.beat-card .top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.beat-card .num { font-family: var(--font-display); font-weight: 700; color: var(--text-3); font-size: var(--fs-sm); }
.beat-card .name { font-weight: 600; font-size: var(--fs-md); }
.beat-card .pos { font-size: var(--fs-xs); color: var(--text-3); font-variant-numeric: tabular-nums; }
.beat-card .summary { font-size: var(--fs-sm); color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.beat-card.act-1 { border-top: 3px solid var(--act1); }
.beat-card.act-2 { border-top: 3px solid var(--act2); }
.beat-card.act-3 { border-top: 3px solid var(--act3); }
.beat-card.current { border-color: var(--accent-bright); box-shadow: 0 0 0 3px var(--accent-ring); }

/* Beat editor layout */
.beat-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.beat-side { position: sticky; top: 20px; display: flex; flex-direction: column; gap: 14px; }
.beat-side .card { padding: 14px 16px; }
.beat-side h4 { font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); margin-bottom: 8px; font-family: var(--font-ui); font-weight: 600; }
.beat-side ul { margin: 0; padding-left: 18px; font-size: var(--fs-sm); color: var(--text-2); display: flex; flex-direction: column; gap: 5px; }
.beat-nav { display: flex; justify-content: space-between; gap: 8px; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); }
.beat-title { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.beat-title .big-num { font-family: var(--font-display); font-size: var(--fs-4xl); font-weight: 800; color: var(--accent-bright); line-height: 1; letter-spacing: -0.03em; }
.question-list { display: flex; flex-direction: column; gap: 18px; }
.question { display: flex; flex-direction: column; gap: 6px; }
.question .q-text { font-weight: 600; font-size: var(--fs-md); }
.question .q-why { font-size: var(--fs-sm); color: var(--text-3); }
@media (max-width: 1000px) { .beat-layout { grid-template-columns: 1fr; } .beat-side { position: static; } }

/* Scene board */
.board { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); align-items: start; }
.board-lane { background: var(--surface-2); border-radius: var(--r-md); padding: 12px; border: 1px solid var(--line); min-height: 120px; }
.board-lane.act-1 { border-top: 3px solid var(--act1); }
.board-lane.act-2 { border-top: 3px solid var(--act2); }
.board-lane.act-3 { border-top: 3px solid var(--act3); }
.board-lane-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.board-lane-head .name { font-weight: 600; font-size: var(--fs-sm); }
.board-cards { display: flex; flex-direction: column; gap: 10px; }
.board-lane-head .name { line-height: 1.2; }
.board-lane-head .row { min-width: 0; flex-wrap: nowrap; }
.scene-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow-1); position: relative; }
.scene-card.dragging { opacity: 0.5; }
.scene-card.drop-target { border-color: var(--accent-bright); }
.scene-card .sc-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.scene-card .sc-title { font-weight: 600; font-size: var(--fs-sm); background: none; border: 0; border-bottom: 1px dashed transparent; padding: 0; width: 100%; }
.scene-card .sc-title:focus { outline: none; border-bottom-color: var(--accent-bright); }
.scene-card .sc-loc { font-size: var(--fs-xs); color: var(--text-3); background: none; border: 0; padding: 0; width: 100%; }
.scene-card .sc-action { font-size: var(--fs-sm); color: var(--text-2); background: none; border: 0; padding: 0; width: 100%; resize: none; line-height: 1.45; min-height: 40px; overflow: hidden; }
.scene-card .sc-action:focus, .scene-card .sc-loc:focus { outline: none; }
.scene-card .sc-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding-top: 6px; border-top: 1px dashed var(--line); }
.scene-card .shift { display: inline-flex; gap: 2px; align-items: center; font-family: var(--font-mono); font-size: var(--fs-xs); }
.scene-card .shift button { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 4px; width: 22px; height: 22px; padding: 0; font-size: 12px; color: var(--text-2); line-height: 1; }
.scene-card .shift button.on.pos { background: var(--good-soft); color: var(--good); border-color: var(--good); }
.scene-card .shift button.on.neg { background: var(--attn-soft); color: var(--attn); border-color: var(--attn); }
.scene-card .conflict { font-size: var(--fs-xs); border: 0; background: none; color: var(--text-3); width: 100%; }
.scene-card .handle { cursor: grab; color: var(--text-3); }
.add-card { border: 1px dashed var(--line-strong); border-radius: var(--r-md); background: transparent; color: var(--text-3); font-size: var(--fs-sm); min-height: 56px; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 12px; text-align: left; }
.add-card svg { width: 16px; height: 16px; flex: none; }
.add-card:hover { background: var(--surface); color: var(--text); }

/* Story check */
.check-list { display: flex; flex-direction: column; gap: 8px; }
.check-item { display: grid; grid-template-columns: 22px 1fr auto; gap: 12px; align-items: start; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.check-item .ic { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; margin-top: 1px; }
.check-item.pass .ic { background: var(--good-soft); color: var(--good); }
.check-item.warn .ic { background: var(--accent-soft); color: var(--accent); }
.check-item.fail .ic { background: var(--attn-soft); color: var(--attn); }
.check-item.manual .ic { background: var(--surface-3); color: var(--text-3); }
.check-item .ct { font-weight: 600; font-size: var(--fs-sm); }
.check-item .cd { font-size: var(--fs-sm); color: var(--text-2); margin-top: 2px; }
.check-item a { font-size: var(--fs-xs); }

/* ---------------------------------------------------------------------
   Prose (guide reading)
   --------------------------------------------------------------------- */
.prose { font-family: var(--font-read); font-size: 1.0625rem; line-height: 1.72; color: var(--text); max-width: var(--measure); }
.prose > * + * { margin-top: 1em; }
.prose h2 { font-family: var(--font-display); font-size: var(--fs-2xl); margin-top: 2em; padding-top: 0.6em; border-top: 1px solid var(--line); }
.prose h2:first-child { margin-top: 0; border-top: 0; padding-top: 0; }
.prose h3 { font-family: var(--font-display); font-size: var(--fs-xl); margin-top: 1.8em; }
.prose h4 { font-family: var(--font-ui); font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-2); margin-top: 1.6em; }
.prose p { margin-top: 0.9em; }
.prose ul, .prose ol { padding-left: 1.4em; margin-top: 0.6em; }
.prose li { margin-top: 0.35em; }
.prose li::marker { color: var(--accent); }
.prose blockquote { margin: 1.2em 0; padding: 12px 18px; border-left: 3px solid var(--accent-bright); background: var(--surface-2); border-radius: 0 var(--r-md) var(--r-md) 0; font-style: italic; color: var(--text-2); }
.prose blockquote p { margin: 0; }
.prose strong { font-weight: 700; }
.prose code { background: var(--surface-3); padding: 1px 5px; border-radius: 4px; font-size: 0.85em; }
.prose hr { margin: 2em 0; }
.prose table { width: 100%; border-collapse: collapse; font-family: var(--font-ui); font-size: var(--fs-sm); margin-top: 1em; }
.prose th, .prose td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose th { font-weight: 600; color: var(--text-2); background: var(--surface-2); }
.prose .table-wrap { overflow-x: auto; }
.prose .note { font-family: var(--font-ui); font-size: var(--fs-sm); color: var(--text-2); background: var(--surface-2); padding: 12px 14px; border-radius: var(--r-md); }
.prose .lede { font-size: 1.2rem; color: var(--text-2); }

/* Learn layout */
.learn-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 32px; align-items: start; }
.learn-nav { position: sticky; top: 20px; display: flex; flex-direction: column; gap: 14px; max-height: calc(100vh - 40px); overflow: auto; padding-right: 6px; }
.learn-nav .group-title { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); font-weight: 600; margin-bottom: 4px; padding-left: 10px; }
.learn-nav a { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: var(--r-sm); color: var(--text-2); font-size: var(--fs-sm); text-decoration: none; }
.learn-nav a:hover { background: var(--surface-2); color: var(--text); }
.learn-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.learn-nav .bn { font-family: var(--font-mono); font-size: 10px; color: var(--text-3); width: 18px; flex: none; }
.learn-article { min-width: 0; }
.learn-article .art-head { margin-bottom: 20px; }
.learn-article .art-head h1 { font-size: var(--fs-4xl); }
.learn-article .art-head .lede { font-family: var(--font-read); font-size: 1.2rem; color: var(--text-2); margin-top: 10px; max-width: var(--measure); }
.learn-pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--line); max-width: var(--measure); }
.learn-pager a { display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: inherit; max-width: 48%; }
.learn-pager a:hover .t { text-decoration: underline; }
.learn-pager .k { font-size: var(--fs-xs); color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; }
.learn-pager .t { font-weight: 600; }
.learn-pager a.next { text-align: right; margin-left: auto; }
.learn-search { margin-bottom: 8px; }
.meta-strip { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 6px; }
.learn-mobile-nav { display: none; }
.search-results { display: flex; flex-direction: column; gap: 8px; }
.search-hit { display: block; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); text-decoration: none; color: inherit; }
.search-hit:hover { border-color: var(--line-strong); text-decoration: none; }
.search-hit .sh-title { font-weight: 600; }
.search-hit .sh-snip { font-size: var(--fs-sm); color: var(--text-2); margin-top: 2px; }
.search-hit mark { background: var(--accent-soft); color: inherit; padding: 0 2px; border-radius: 2px; }
@media (max-width: 960px) {
  .learn-layout { grid-template-columns: 1fr; gap: 12px; }
  .learn-nav { display: none; }
  .learn-mobile-nav { display: block; margin-bottom: 12px; }
}

/* Beat position figure */
.pos-figure { display: flex; align-items: center; gap: 14px; padding: 12px 14px; background: var(--surface-2); border-radius: var(--r-md); font-family: var(--font-ui); font-size: var(--fs-sm); }
.pos-figure .pf-bar { flex: 1; height: 8px; border-radius: var(--r-pill); background: linear-gradient(90deg, var(--act1) 0 20%, var(--act2) 20% 80%, var(--act3) 80% 100%); position: relative; }
.pos-figure .pf-range { position: absolute; top: -3px; height: 14px; background: var(--accent-bright); border-radius: 4px; opacity: 0.9; min-width: 4px; }
.pos-figure .pf-label { font-variant-numeric: tabular-nums; color: var(--text-2); white-space: nowrap; }

/* Framework comparison */
.table-wrap { overflow-x: auto; }
.cmp-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.cmp-table th, .cmp-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.cmp-table th { background: var(--surface-2); font-weight: 600; color: var(--text-2); }

/* ---------------------------------------------------------------------
   Write view
   --------------------------------------------------------------------- */
.write-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.write-side { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 12px; max-height: calc(100vh - 32px); overflow: auto; }
.write-side .card { padding: 12px 14px; }
.write-side h4 { font-family: var(--font-ui); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); margin-bottom: 6px; }
.write-side p, .write-side li { font-size: var(--fs-sm); color: var(--text-2); }
.write-side ul { margin: 0; padding-left: 16px; display: flex; flex-direction: column; gap: 4px; }
.manuscript { display: flex; flex-direction: column; gap: 0; }
.ms-section { padding: 8px 0 24px; }
.ms-section + .ms-section { border-top: 1px solid var(--line); padding-top: 20px; }
.ms-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.ms-head .ms-name { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 600; font-size: var(--fs-md); color: var(--text-2); }
.ms-head .ms-name .n { color: var(--accent); font-variant-numeric: tabular-nums; }
.ms-head .ms-meta { display: flex; align-items: center; gap: 10px; font-size: var(--fs-xs); color: var(--text-3); font-variant-numeric: tabular-nums; }
.ms-plan { font-size: var(--fs-sm); color: var(--text-2); background: var(--surface-2); padding: 10px 12px; border-radius: var(--r-md); margin-bottom: 10px; border-left: 3px solid var(--accent-bright); }
.ms-plan .eyebrow { margin-bottom: 2px; }
.ms-text { width: 100%; border: 0; background: transparent; padding: 6px 0; resize: none; overflow: hidden; font-family: var(--font-read); font-size: 1.125rem; line-height: 1.8; color: var(--text); min-height: 120px; }
.ms-text:focus { outline: none; }
.ms-text::placeholder { color: var(--text-3); font-style: italic; }
.write-paper { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 28px 40px; }
.ms-mini-bar { position: relative; height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; flex: 1; min-width: 80px; }
.ms-mini-bar > span { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent-bright); }
.ms-mini-bar > span.over { background: var(--attn); }

body.focus .sidebar, body.focus .write-side, body.focus .page-head, body.focus .beat-rail { display: none; }
body.focus .app { grid-template-columns: 1fr; }
body.focus .write-layout { grid-template-columns: 1fr; max-width: 760px; margin: 0 auto; }
body.focus .write-paper { border: 0; background: transparent; padding: 20px 0; }
body.focus .view { padding-top: 40px; }
.focus-exit { position: fixed; top: 14px; right: 16px; z-index: 40; display: none; }
body.focus .focus-exit { display: inline-flex; }
@media (max-width: 1000px) { .write-layout { grid-template-columns: 1fr; } .write-side { position: static; max-height: none; } .write-paper { padding: 20px; } }

/* ---------------------------------------------------------------------
   Home
   --------------------------------------------------------------------- */
.hero { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 28px; align-items: center; padding: 32px 36px; border-radius: var(--r-lg); background: var(--ink); color: var(--ink-text); overflow: hidden; position: relative; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.07); }
.hero h1 { font-size: clamp(1.8rem, 3.6vw, 2.75rem); font-weight: 800; letter-spacing: -0.02em; }
.hero p { color: var(--ink-muted); font-size: var(--fs-lg); margin-top: 10px; max-width: 48ch; }
.hero .hero-actions { margin-top: 20px; display: flex; gap: 10px; flex-wrap: wrap; }
.hero .btn { border-color: transparent; }
.hero .btn.ghost { color: var(--ink-text); border-color: rgba(255,255,255,0.18); }
.hero .btn.ghost:hover { background: rgba(255,255,255,0.08); }
.hero-rail { display: flex; flex-direction: column; gap: 10px; }
.hero-rail .beat-rail .acts { border-color: rgba(255,255,255,0.15); }
.hero-rail .beat-rail .acts .a1 { background: rgba(255,255,255,0.10); }
.hero-rail .beat-rail .acts .a2 { background: rgba(240,178,78,0.28); }
.hero-rail .beat-rail .acts .a3 { background: rgba(255,255,255,0.10); }
.hero-rail .beat-rail .acts > div { color: var(--ink-muted); }
.hero-rail .beat-rail .mark { color: var(--ink-muted); }
.hero-rail .beat-rail .mark .tick { background: var(--ink); border-color: var(--ink-muted); }
.hero-rail .beat-rail .mark.current .tick { background: var(--accent-bright); border-color: var(--accent-bright); }
.hero-rail .beat-rail .mark:hover, .hero-rail .beat-rail .span:hover { color: var(--ink-text); }
.hero-rail .beat-rail .span { color: var(--ink-muted); }
.hero-rail .beat-rail .span .bar { background: rgba(255,255,255,0.10); border-color: rgba(255,255,255,0.28); }
.hero-rail .beat-rail .tip { background: var(--accent-bright); color: #1b1408; }
.hero-rail .caption { font-size: var(--fs-xs); color: var(--ink-muted); }
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; padding: 24px 20px; } }

.project-card { display: flex; flex-direction: column; gap: 10px; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); text-decoration: none; color: inherit; transition: border-color 0.12s ease; }
.project-card:hover { border-color: var(--line-strong); text-decoration: none; }
.project-card .pc-title { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-xl); }
.project-card .pc-log { color: var(--text-2); font-size: var(--fs-sm); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; }
.project-card .pc-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: var(--fs-xs); color: var(--text-3); margin-top: auto; }
.project-card .pc-actions { display: flex; gap: 6px; }
.new-card { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 18px; border: 1px dashed var(--line-strong); border-radius: var(--r-md); background: transparent; color: var(--text-2); min-height: 160px; text-decoration: none; }
.new-card:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.new-card .plus { width: 36px; height: 36px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: 22px; font-weight: 300; }
.tip-card { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: start; }
.tip-card .tip-ic { width: 36px; height: 36px; border-radius: var(--r-md); background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.tip-card .tip-ic svg { width: 18px; height: 18px; }

/* Analysis */
.analysis-beat { display: grid; grid-template-columns: 200px 1fr; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); }
.analysis-beat:first-child { border-top: 0; }
.analysis-beat .ab-name { font-weight: 600; }
.analysis-beat .ab-pos { font-size: var(--fs-xs); color: var(--text-3); font-variant-numeric: tabular-nums; }
.analysis-beat .ab-hint { font-size: var(--fs-xs); color: var(--text-3); margin-top: 4px; }
.analysis-beat .ab-fields { display: grid; grid-template-columns: 130px 1fr; gap: 8px; }
@media (max-width: 760px) { .analysis-beat, .analysis-beat .ab-fields { grid-template-columns: 1fr; } }

/* Settings */
.settings-section { display: grid; grid-template-columns: 220px 1fr; gap: 24px; padding: 24px 0; border-top: 1px solid var(--line); }
.settings-section:first-of-type { border-top: 0; padding-top: 0; }
.settings-section h3 { font-size: var(--fs-lg); }
.settings-section .desc { font-size: var(--fs-sm); color: var(--text-2); margin-top: 4px; }
@media (max-width: 760px) { .settings-section { grid-template-columns: 1fr; gap: 12px; } }

/* Character cards */
.char-card { padding: 18px; }
.char-card .ch-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.char-card .ch-role { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); font-weight: 700; }

/* Logline builder */
.logline-preview { font-family: var(--font-read); font-size: 1.15rem; line-height: 1.6; padding: 16px 18px; background: var(--surface-2); border-radius: var(--r-md); border-left: 3px solid var(--accent-bright); }
.logline-preview .blank { color: var(--text-3); font-style: italic; }

/* Print */
@media print {
  .sidebar, .toolbar, .beat-nav, .btn, .toasts { display: none !important; }
  .app { grid-template-columns: 1fr; }
  body { background: #fff; color: #000; }
}
