/* ==========================================================================
   Cinematic Pipeline — design tokens + global styles
   Aesthetic: pro creative tool, neutral dark, single warm-amber accent.
   ========================================================================== */

:root {
  /* Canvas */
  --bg: oklch(0.155 0.004 240);
  --bg-1: oklch(0.185 0.004 240);
  --bg-2: oklch(0.215 0.005 240);
  --bg-3: oklch(0.255 0.006 240);
  --bg-inset: oklch(0.13 0.004 240);

  /* Hairlines */
  --line: oklch(0.28 0.006 240);
  --line-soft: oklch(0.235 0.005 240);
  --line-strong: oklch(0.36 0.008 240);

  /* Text */
  --fg: oklch(0.96 0.003 240);
  --fg-muted: oklch(0.72 0.004 240);
  --fg-dim: oklch(0.54 0.005 240);
  --fg-faint: oklch(0.42 0.005 240);

  /* Accent: warm amber — safelight / projector lamp */
  --accent: oklch(0.80 0.16 70);
  --accent-bright: oklch(0.86 0.18 75);
  --accent-dim: oklch(0.55 0.12 65);
  --accent-ink: oklch(0.18 0.04 60);
  --accent-glow: oklch(0.80 0.16 70 / 0.18);

  /* Semantic */
  --good: oklch(0.78 0.14 155);
  --warn: oklch(0.80 0.15 85);
  --bad:  oklch(0.68 0.18 25);
  --info: oklch(0.78 0.10 230);

  /* Type */
  --font-sans: "Inter Tight", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --font-serif: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --font-script: "IBM Plex Mono", "Courier Prime", ui-monospace, monospace;

  /* Density (driven by tweaks) */
  --pad: 16px;
  --pad-sm: 10px;
  --pad-xs: 6px;
  --row: 36px;
  --radius: 6px;
  --radius-sm: 4px;
}

[data-density="compact"] {
  --pad: 12px;
  --pad-sm: 7px;
  --pad-xs: 4px;
  --row: 30px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.45;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; padding: 0; }
input, textarea, select { font: inherit; color: inherit; }

::selection { background: var(--accent); color: var(--accent-ink); }

/* Scrollbars — slim, grey */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 8px; border: 2px solid var(--bg); }
*::-webkit-scrollbar-thumb:hover { background: var(--line-strong); }

/* ===== App shell ===== */
.app {
  display: grid;
  grid-template-rows: 38px 76px 1fr 28px;
  height: 100vh;
}

/* ===== Title bar ===== */
.titlebar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 14px;
  background: var(--bg-inset);
  border-bottom: 1px solid var(--line-soft);
  font-size: 12px;
  color: var(--fg-muted);
}
.titlebar .traffic { display: flex; gap: 6px; }
.titlebar .traffic span { width: 11px; height: 11px; border-radius: 50%; background: var(--bg-3); }
.titlebar .brand {
  display: flex; align-items: center; gap: 9px;
  padding-right: 12px; margin-right: 4px;
  border-right: 1px solid var(--line-soft);
  flex-shrink: 0;
}
.titlebar .brand svg { display: block; }
.titlebar .brand-name {
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 500;
  color: var(--fg);
  letter-spacing: -0.01em;
  display: inline-flex; align-items: baseline; gap: 6px;
}
.titlebar .brand-sub {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-faint);
}
.titlebar .crumbs { display: flex; align-items: center; gap: 8px; white-space: nowrap; min-width: 0; overflow: hidden; flex: 1; }
.titlebar .crumbs .sep { color: var(--fg-faint); }
.titlebar .crumbs .now { color: var(--fg); font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.titlebar .right { margin-left: auto; display: flex; align-items: center; gap: 8px; white-space: nowrap; flex-shrink: 0; }
.titlebar .pill {
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.02em;
  color: var(--fg-muted);
  white-space: nowrap;
}
.titlebar .pill.live { color: var(--accent); border-color: var(--accent-dim); }
.titlebar .pill.live::before {
  content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); margin-right: 6px; vertical-align: 1px;
  box-shadow: 0 0 8px var(--accent);
}

/* ===== Filmstrip nav ===== */
.filmstrip {
  position: relative;
  display: flex;
  background:
    linear-gradient(to bottom,
      var(--bg-inset) 0,
      var(--bg-inset) 6px,
      var(--bg-1) 6px,
      var(--bg-1) calc(100% - 6px),
      var(--bg-inset) calc(100% - 6px),
      var(--bg-inset) 100%);
  border-bottom: 1px solid var(--line-soft);
}
/* sprocket holes */
.filmstrip::before, .filmstrip::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  height: 6px;
  background-image:
    radial-gradient(circle at 30px 3px, var(--bg) 1.5px, transparent 2px),
    radial-gradient(circle at 30px 3px, var(--bg) 1.5px, transparent 2px);
  background-size: 60px 6px;
  background-repeat: repeat-x;
  opacity: 0.9;
}
.filmstrip::before { top: 0; }
.filmstrip::after { bottom: 0; }

.frame {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  padding: 8px 12px;
  border-right: 1px solid var(--line-soft);
  cursor: pointer;
  transition: background 120ms ease;
  min-width: 0;
  overflow: hidden;
}
.frame:last-child { border-right: none; }
.frame:hover { background: var(--bg-2); }
.frame .num {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-faint);
  letter-spacing: 0.08em;
  line-height: 1.3;
}
.frame .label {
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-muted);
  letter-spacing: -0.005em;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
  font-family: var(--font-sans);
}
.frame .stat {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-faint);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
.frame.done .stat { color: var(--good); }
.frame.warn .stat { color: var(--warn); }
.frame.active {
  background: var(--bg-2);
}
.frame.active .label { color: var(--fg); }
.frame.active::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px var(--accent), inset 0 0 24px var(--accent-glow);
}
.frame.active .num { color: var(--accent); }

/* ===== Status bar ===== */
.statusbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 14px;
  background: var(--bg-inset);
  border-top: 1px solid var(--line-soft);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-muted);
  letter-spacing: 0.01em;
}
.statusbar .seg { display: flex; align-items: center; gap: 6px; }
.statusbar .seg .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--fg-faint); }
.statusbar .seg.ok .dot { background: var(--good); }
.statusbar .seg.warn .dot { background: var(--warn); }
.statusbar .seg.bad .dot { background: var(--bad); }
.statusbar .right { margin-left: auto; display: flex; gap: 18px; }

/* Edit-impact strip — shows live validation/stale/version/cost after each prompt edit */
.edit-impact {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  padding: 0;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(to bottom, oklch(0.165 0.005 240), var(--bg-1));
}
.edit-impact-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  border-right: 1px solid var(--line-soft);
  min-width: 0;
}
.edit-impact-cell:last-child { border-right: none; }
.edit-impact-cell .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--fg-faint);
  flex: 0 0 auto;
  box-shadow: 0 0 0 3px oklch(0.18 0.005 240);
}
.edit-impact-cell .dot.ok { background: var(--good); box-shadow: 0 0 0 3px oklch(0.18 0.005 240), 0 0 6px oklch(0.65 0.13 155 / 0.5); }
.edit-impact-cell .dot.accent { background: var(--accent); box-shadow: 0 0 0 3px oklch(0.18 0.005 240), 0 0 6px var(--accent-glow); }
.edit-impact-cell.warn .dot { background: var(--warn); box-shadow: 0 0 0 3px oklch(0.18 0.005 240), 0 0 6px oklch(0.7 0.14 75 / 0.4); }
.edit-impact-cell .lbl {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--fg-faint);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.edit-impact-cell .val {
  font-size: 12px;
  color: var(--fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.edit-impact-cell .val.mono { font-family: var(--font-mono); font-size: 11.5px; }
.edit-impact-cell .lk {
  background: none;
  border: none;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
  padding: 0 2px;
  text-decoration: underline;
  text-decoration-color: var(--accent-dim);
  text-underline-offset: 2px;
}
.edit-impact-cell .lk:hover { text-decoration-color: var(--accent); }

/* Inline-edit input — shows on hover when an editable card is in edit mode */
.inline-edit {
  background: var(--bg-inset);
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  padding: 4px 6px;
  color: inherit;
  font: inherit;
  outline: none;
  transition: border-color 120ms ease;
}
.inline-edit:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}
.inline-edit.serif { font-family: var(--font-serif); }
.inline-edit.mono { font-family: var(--font-mono); }

/* Shot list table — Studio-Binder-adjacent inline editor */
.shot-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}
.shot-table thead th {
  position: sticky;
  top: 0;
  background: var(--bg-inset);
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-faint);
  text-align: left;
  padding: 8px 10px;
  z-index: 1;
}
.shot-table tbody tr {
  border-bottom: 1px solid var(--line-soft);
}
.shot-table tbody tr:hover { background: oklch(0.16 0.005 240); }
.shot-table tbody tr.selected { background: var(--bg-2); box-shadow: inset 2px 0 0 var(--accent); }
.shot-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
.shot-table td.thumb-td { padding: 4px 8px; width: 110px; }
.shot-table td.id-td { font-family: var(--font-mono); font-size: 10.5px; color: var(--fg-faint); width: 70px; }
.shot-table td.scene-td { font-family: var(--font-mono); font-size: 10.5px; color: var(--accent); width: 60px; }
.shot-table td.dur-td { font-family: var(--font-mono); font-size: 11px; width: 56px; text-align: right; }
.shot-table td.type-td { font-family: var(--font-mono); font-size: 10.5px; color: var(--fg-muted); width: 130px; }
.shot-table td.vis-td { width: 110px; }
.shot-table td.desc-td { color: var(--fg); }
.shot-table .cell-edit {
  background: transparent;
  border: 1px solid transparent;
  padding: 3px 6px;
  border-radius: 3px;
  color: inherit;
  font: inherit;
  width: 100%;
  outline: none;
}
.shot-table .cell-edit:hover { border-color: var(--line-soft); background: var(--bg-inset); }
.shot-table .cell-edit:focus { border-color: var(--accent); background: var(--bg-inset); box-shadow: 0 0 0 2px var(--accent-glow); }
.shot-table .mini-thumb {
  position: relative;
  width: 92px; height: 52px;
  border-radius: 3px;
  overflow: hidden;
  background: var(--bg-inset);
  border: 1px solid var(--line-soft);
}

/* Segmented toggle (filmstrip <-> table) */
.seg-toggle {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg-inset);
}
.seg-btn {
  padding: 5px 12px;
  font-size: 11.5px;
  background: transparent;
  border: none;
  color: var(--fg-muted);
  cursor: pointer;
  font-family: var(--font-sans);
  border-right: 1px solid var(--line);
}
.seg-btn:last-child { border-right: none; }
.seg-btn:hover { color: var(--fg); background: oklch(0.18 0.005 240); }
.seg-btn.active {
  color: var(--accent);
  background: var(--bg-2);
  box-shadow: inset 0 -2px 0 var(--accent);
}

/* ===== Common page ===== */
.page {
  overflow: hidden;
  position: relative;
}
.page-grid {
  display: grid;
  height: 100%;
}

.page-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 18px 24px 14px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--bg);
  position: sticky; top: 0; z-index: 2;
}
.page-header .title {
  font-family: var(--font-serif);
  font-size: 26px;
  font-style: normal;
  font-weight: 500;
  letter-spacing: -0.015em;
}
.page-header .sub {
  font-family: var(--font-mono);
  color: var(--fg-faint);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.page-header .actions { display: flex; gap: 8px; align-items: center; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius);
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--fg);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 120ms, border-color 120ms;
  white-space: nowrap;
}
.btn:hover { background: var(--bg-3); border-color: var(--line-strong); }
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn.primary:hover { background: var(--accent-bright); border-color: var(--accent-bright); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--bg-2); }
.btn.danger { color: var(--bad); border-color: oklch(0.4 0.1 25); }
.btn.icon { padding: 6px 8px; }
.btn[disabled] { opacity: 0.4; cursor: not-allowed; }

/* ===== Tag / chip ===== */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--fg-muted);
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.tag.accent { color: var(--accent); border-color: var(--accent-dim); background: oklch(0.22 0.03 65); }
.tag.good { color: var(--good); border-color: oklch(0.4 0.08 155); }
.tag.warn { color: var(--warn); border-color: oklch(0.4 0.08 85); }
.tag.bad { color: var(--bad); border-color: oklch(0.4 0.1 25); }

.kbd {
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  color: var(--fg-muted);
}

/* ===== Card ===== */
.card {
  background: var(--bg-1);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: var(--pad);
}
.card .card-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-faint);
  margin-bottom: 10px;
}

/* ===== Tabs ===== */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--line-soft);
}
.tab {
  position: relative;
  padding: 9px 14px;
  font-size: 12.5px;
  color: var(--fg-muted);
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex; align-items: center; gap: 8px;
}
.tab:hover { color: var(--fg); }
.tab.active { color: var(--fg); }
.tab.active::after {
  content: "";
  position: absolute;
  left: 8px; right: 8px; bottom: -1px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}
.tab .count {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-faint);
  background: var(--bg-2);
  padding: 1px 5px;
  border-radius: 3px;
}

/* ===== Form fields ===== */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-faint);
}
.input, .textarea, .select {
  background: var(--bg-inset);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  color: var(--fg);
  font-size: 12.5px;
  outline: none;
  width: 100%;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.textarea { font-family: var(--font-sans); resize: vertical; min-height: 60px; line-height: 1.5; }
.textarea.mono { font-family: var(--font-mono); font-size: 12px; }

/* ===== Hairline divider ===== */
.hr { height: 1px; background: var(--line-soft); margin: 0; border: none; }
.vr { width: 1px; background: var(--line-soft); align-self: stretch; }

/* ===== Sidebar / panel ===== */
.panel {
  background: var(--bg);
  border-right: 1px solid var(--line-soft);
  overflow: auto;
  display: flex; flex-direction: column;
}
.panel.right { border-right: none; border-left: 1px solid var(--line-soft); }
.panel-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-soft);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; background: var(--bg); z-index: 1;
}
.panel-header .htitle {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

/* ===== Screenplay typography ===== */
.screenplay {
  font-family: var(--font-script);
  font-size: 14px;
  line-height: 1.7;
  color: var(--fg);
  letter-spacing: 0;
}
.screenplay .slug {
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--fg);
  margin: 18px 0 10px;
}
.screenplay .action { margin: 8px 0; color: oklch(0.88 0.003 240); }
.screenplay .character {
  text-transform: uppercase;
  margin: 12px 0 0 28%;
  letter-spacing: 0.04em;
}
.screenplay .paren { margin: 0 0 0 22%; color: var(--fg-muted); }
.screenplay .dialogue { margin: 0 18% 10px 18%; }

/* embedded prompt block */
.prompt-block {
  margin: 14px 0;
  background: oklch(0.20 0.012 60);
  border-left: 2px solid var(--accent);
  border-radius: 3px;
  padding: 10px 14px 10px 14px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.55;
  position: relative;
  cursor: pointer;
}
.prompt-block:hover { background: oklch(0.22 0.014 60); }
.prompt-block.selected { background: oklch(0.24 0.018 60); box-shadow: inset 0 0 0 1px var(--accent-dim); }
.prompt-block .pb-head {
  display: flex; gap: 12px; align-items: center;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 4px;
}
.prompt-block .pb-head .dur { color: var(--fg-muted); font-weight: 400; margin-left: auto; }
.prompt-block .pb-row { color: var(--fg-muted); }
.prompt-block .pb-row b { color: var(--fg); font-weight: 500; }
.prompt-block .pb-end { color: var(--fg-faint); margin-top: 4px; font-size: 10px; }

/* ===== Shot strip ===== */
.shot-strip {
  display: flex;
  gap: 10px;
  padding: 10px;
  overflow-x: auto;
  background: var(--bg-inset);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
}
.shot {
  flex: 0 0 160px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-1);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 120ms;
}
.shot:hover { border-color: var(--line-strong); }
.shot.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-dim); }
.shot .thumb {
  height: 90px;
  background: var(--bg-inset);
  border-bottom: 1px solid var(--line-soft);
  position: relative;
  overflow: hidden;
}
.shot .meta { padding: 7px 9px; font-size: 11px; }
.shot .meta .id { font-family: var(--font-mono); color: var(--fg-faint); font-size: 10px; }
.shot .meta .desc { color: var(--fg); margin-top: 2px; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.shot .meta .row { display: flex; justify-content: space-between; margin-top: 4px;
  font-family: var(--font-mono); font-size: 10px; color: var(--fg-faint); }

/* ===== Generic placeholder swatch (for shot thumbs) ===== */
.thumb-placeholder {
  position: absolute; inset: 0;
  background-image: repeating-linear-gradient(
    135deg,
    oklch(0.20 0.005 240) 0,
    oklch(0.20 0.005 240) 6px,
    oklch(0.18 0.005 240) 6px,
    oklch(0.18 0.005 240) 12px
  );
}
.thumb-placeholder::after {
  content: attr(data-label);
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--fg-faint);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* dim filter for "horror" thumbs to feel sceney */
.thumb-noir {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 60%, transparent 0%, oklch(0 0 0 / 0.6) 100%);
}

/* ===== Tension curve / sparkline shells ===== */
svg.viz { display: block; width: 100%; height: 100%; overflow: visible; }

/* ===== Definition list ===== */
.dl { display: grid; grid-template-columns: 130px 1fr; gap: 6px 14px; font-size: 12px; }
.dl dt { color: var(--fg-faint); font-family: var(--font-mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; padding-top: 1px; }
.dl dd { margin: 0; color: var(--fg); }

/* ===== Validation pill rows ===== */
.check {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--line-soft);
  font-size: 12px;
}
.check:last-child { border-bottom: none; }
.check .ico { width: 14px; height: 14px; border-radius: 50%; flex: 0 0 auto; }
.check.ok .ico { background: var(--good); }
.check.warn .ico { background: var(--warn); }
.check.bad .ico { background: var(--bad); }
.check.muted .ico { background: var(--fg-faint); }

/* ===== Cost approval ===== */
.cost-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
}
.cost-row .label { color: var(--fg-muted); }
.cost-row .v { font-family: var(--font-mono); color: var(--fg); }
.cost-row.total { border-bottom: none; padding-top: 14px; }
.cost-row.total .v { color: var(--accent); font-size: 18px; font-weight: 600; }

.checkbox {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
}
.checkbox input { margin-top: 2px; accent-color: var(--accent); }
.checkbox.checked { border-color: var(--accent-dim); background: oklch(0.22 0.025 70); }

/* ===== Render queue rows ===== */
.queue { display: flex; flex-direction: column; gap: 1px; background: var(--line-soft); border: 1px solid var(--line-soft); border-radius: var(--radius); overflow: hidden; }
.qrow {
  display: grid;
  grid-template-columns: 90px 70px 1fr 110px 80px 90px 60px;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-1);
  font-size: 12px;
}
.qrow.head { background: var(--bg-inset); color: var(--fg-faint); font-family: var(--font-mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; }
.qrow .id { font-family: var(--font-mono); color: var(--fg-muted); font-size: 11px; }
.qrow .desc { color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qrow .progress { height: 4px; background: var(--bg-3); border-radius: 2px; overflow: hidden; position: relative; }
.qrow .progress > span { display: block; height: 100%; background: var(--accent); }
.qrow .status { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.04em; }
.qrow .status.queued { color: var(--fg-muted); }
.qrow .status.rendering { color: var(--accent); }
.qrow .status.complete { color: var(--good); }
.qrow .status.failed { color: var(--bad); }

/* ===== Misc ===== */
.scroll { overflow: auto; }
.row { display: flex; align-items: center; gap: 8px; }
.col { display: flex; flex-direction: column; }
.gap-sm { gap: 8px; }
.gap-md { gap: 14px; }
.gap-lg { gap: 22px; }
.muted { color: var(--fg-muted); }
.dim { color: var(--fg-faint); }
.mono { font-family: var(--font-mono); }
.serif { font-family: var(--font-serif); font-style: normal !important; font-weight: 500; letter-spacing: -0.005em; }
/* Inline fontStyle:italic on .serif elements is forced upright for readability */
.serif[style*="italic"] { font-style: normal !important; }
.pad { padding: var(--pad); }
.pad-lg { padding: 22px 24px; }

/* iris/aperture motif */
.iris { width: 22px; height: 22px; border-radius: 50%; position: relative; flex: 0 0 auto;
  background: conic-gradient(from 0deg, var(--bg-3), var(--bg-2), var(--bg-3), var(--bg-2), var(--bg-3), var(--bg-2));
  box-shadow: inset 0 0 0 1px var(--line);
}
.iris::after { content: ""; position: absolute; inset: 6px; background: var(--accent); border-radius: 50%; box-shadow: 0 0 6px var(--accent-glow); }

/* horror vignette overlay for whole page (subtle) */
.app::before {
  content: "";
  position: fixed; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 50%, oklch(0 0 0 / 0.5) 100%);
  z-index: 100;
}

/* ===== Button sizes ===== */
.btn.sm {
  padding: 3px 8px;
  font-size: 11px;
  gap: 4px;
}

/* ===== BIBLE — Builder bar (top of every section) ===== */
.builder-bar {
  display: grid;
  grid-template-columns: minmax(160px, max-content) 1fr minmax(120px, max-content);
  align-items: center;
  gap: 16px;
  padding: 10px 24px;
  background:
    linear-gradient(180deg, var(--bg-1), var(--bg-1)),
    radial-gradient(circle at 0% 50%, var(--accent-glow), transparent 70%);
  background-blend-mode: normal, screen;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 4;
}
.bb-l { display: flex; flex-direction: column; gap: 2px; font-size: 11.5px; color: var(--fg-muted); min-width: 0; }
.bb-sep { display: none; }
.bb-agent {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
}
.bb-sep { color: var(--line-strong); }
.bb-grounded { font-family: var(--font-mono); font-size: 10.5px; color: var(--fg-faint); }

.bb-form {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 4px 4px 4px 12px;
  transition: border-color 120ms, box-shadow 120ms;
}
.bb-form:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.bb-input {
  flex: 1;
  background: transparent;
  border: 0; outline: 0;
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 13px;
  height: 26px;
}
.bb-input::placeholder { color: var(--fg-faint); }

.bb-status {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--fg-muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-1);
}
.bb-status .bb-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--good); }
.bb-status.warn .bb-dot { background: var(--warn); }
.bb-status.bad .bb-dot { background: var(--bad); }

.bb-spin {
  width: 10px; height: 10px;
  border: 1.5px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Section heads ===== */
.bib-section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin: 8px 0 16px;
  gap: 16px;
}

/* ===== Proposal card ===== */
.proposal {
  position: relative;
  background:
    linear-gradient(180deg, var(--bg-1), var(--bg-1)),
    linear-gradient(135deg, var(--accent-glow), transparent 40%);
  background-blend-mode: normal, screen;
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px 16px 12px;
  margin-bottom: 12px;
}
.prop-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.prop-kind {
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.prop-title {
  font-family: var(--font-serif);
  font-size: 16px;
  color: var(--fg);
  font-weight: 500;
}
.prop-spacer { flex: 1; }
.prop-actions { display: flex; gap: 6px; }
.prop-body {
  font-size: 13px;
  line-height: 1.55;
  color: var(--fg);
  margin: 4px 0 12px;
  max-width: 76ch;
}
.prop-body p { margin: 0; }
.prop-body i, .prop-body em { font-family: var(--font-serif); font-style: normal; color: var(--fg-muted); }
.prop-diff {
  background: var(--bg-inset);
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  padding: 8px 10px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  margin-bottom: 8px;
}
.diff-row { display: grid; grid-template-columns: 12px minmax(80px, max-content) 1fr; gap: 8px; line-height: 1.55; align-items: baseline; }
.cd-right .diff-row { grid-template-columns: 12px 1fr; }
.cd-right .diff-field { grid-column: 2; font-size: 10px; color: var(--accent); margin-top: 4px; }
.cd-right .diff-val { grid-column: 2; }
.diff-row.add .diff-op { color: var(--good); }
.diff-row.del .diff-op { color: var(--bad); }
.diff-row.mod .diff-op { color: var(--warn); }
.diff-op { font-weight: 600; }
.diff-field { color: var(--fg-muted); }
.diff-val { color: var(--fg); white-space: pre-wrap; overflow-wrap: anywhere; }
.prop-refs {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1px dashed var(--line-soft);
  margin-top: 4px;
}
.ref-chip {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--fg-muted);
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  padding: 2px 6px;
}

/* ===== Quick prompts row ===== */
.qp-row {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin: 16px 0 0;
}
.qp-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  background: transparent;
  border: 1px dashed var(--line);
  border-radius: 999px;
  color: var(--fg-muted);
  font-size: 11.5px;
  cursor: pointer;
  transition: all 120ms;
  font-family: var(--font-sans);
}
.qp-chip::before {
  content: "✱";
  color: var(--accent);
  font-size: 10px;
}
.qp-chip:hover { border-color: var(--accent); color: var(--fg); border-style: solid; }

/* ===== Bible: state dots in left rail ===== */
.bib-state-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  display: inline-block;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent-glow);
}

.agent-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  border-radius: 3px;
  background: var(--bg-2);
  color: var(--fg-muted);
}
.agent-pill .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--good); }
.agent-pill.warn .dot { background: var(--warn); }
.agent-pill.bad .dot { background: var(--bad); }

/* ===== CHARACTER GRID (cards in builder) ===== */
.char-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(460px, 1fr));
  gap: 14px;
}
.char-card {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 0;
  text-align: left;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 120ms, transform 120ms;
  font-family: inherit;
  color: inherit;
  padding: 0;
}
.char-card:hover { border-color: var(--accent); }
.char-card-portrait {
  position: relative;
  background: var(--bg-inset);
  border-right: 1px solid var(--line);
  min-height: 220px;
}
.char-card-role {
  position: absolute; top: 8px; left: 8px;
  background: oklch(0 0 0 / 0.6);
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 6px;
  border-radius: 2px;
  z-index: 2;
}
.char-card-body { padding: 14px 16px; display: flex; flex-direction: column; }
.char-card-summary {
  margin: 0 0 10px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--fg-muted);
}
.char-card-strip {
  display: grid; grid-template-columns: 1fr; gap: 6px;
  padding: 8px 0;
  border-top: 1px dashed var(--line-soft);
  border-bottom: 1px dashed var(--line-soft);
  font-size: 12px;
  margin-bottom: 10px;
}
.char-card-strip > div { display: grid; grid-template-columns: 78px 1fr; gap: 8px; align-items: baseline; }
.char-card-strip .lbl {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-faint);
  padding-top: 1px;
}
.char-card-strip > div > span:not(.lbl) { color: var(--fg); }
.char-card-foot {
  display: flex; align-items: center; gap: 6px;
  margin-top: auto;
  flex-wrap: wrap;
}
.char-card-cta {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px;
  color: var(--accent);
}
.char-card.add {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 1px dashed var(--line);
  background: transparent;
  color: var(--fg-muted);
  min-height: 220px;
  padding: 24px;
}
.char-card.add:hover { border-color: var(--accent); color: var(--fg); }

/* ===== CHARACTER DETAIL ===== */
.char-detail {
  display: grid;
  grid-template-rows: auto auto 1fr;
  height: 100%;
  overflow: hidden;
}
.cd-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
}
.cd-id { display: flex; flex-direction: column; }
.cd-eyebrow {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  color: var(--fg-faint);
}

.cd-body {
  display: grid;
  grid-template-columns: 280px 1fr 340px;
  height: 100%;
  overflow: hidden;
}

.cd-left {
  border-right: 1px solid var(--line);
  background: var(--bg-1);
  display: flex; flex-direction: column;
  padding: 16px;
  gap: 14px;
  overflow-y: auto;
}
.cd-portrait {
  position: relative;
  aspect-ratio: 3 / 4;
  background: var(--bg-inset);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.cd-portrait-ovl {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 10px;
  background: linear-gradient(180deg, transparent, oklch(0 0 0 / 0.7));
  z-index: 2;
}
.cd-portrait-meta {
  display: flex; flex-direction: column; gap: 4px;
  padding: 10px 12px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.cd-pm-row { display: flex; flex-direction: column; gap: 2px; font-size: 11.5px; padding: 4px 0; border-bottom: 1px dashed var(--line-soft); }
.cd-pm-row:last-of-type { border-bottom: 0; }
.cd-pm-row .lbl { color: var(--fg-faint); font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.1em; text-transform: uppercase; }
.cd-pm-row .mono { font-size: 11px; overflow-wrap: anywhere; }

.cd-tabs {
  display: flex; flex-direction: column;
  gap: 0;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}
.cd-tab {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 4px;
  text-align: left;
  background: transparent;
  border: 0;
  color: var(--fg-muted);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  border-bottom: 1px solid var(--line-soft);
}
.cd-tab .cd-tab-bar { width: 2px; height: 14px; background: transparent; }
.cd-tab:hover { color: var(--fg); }
.cd-tab.active { color: var(--fg); font-weight: 500; }
.cd-tab.active .cd-tab-bar { background: var(--accent); }

.cd-tags { display: flex; flex-wrap: wrap; gap: 6px; }

.cd-center {
  padding: 22px 28px;
  overflow-y: auto;
}
.cd-tab-pane { display: flex; flex-direction: column; gap: 18px; }

.cd-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.cd-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

.cd-field {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.cd-field-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 6px;
}
.cd-field-lbl {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-faint);
}
.cd-field-hint {
  font-size: 10.5px;
  color: var(--fg-faint);
  font-style: normal;
  font-family: var(--font-serif);
}
.cd-field-val { color: var(--fg); font-size: 13.5px; line-height: 1.55; }

.cd-list { margin: 0; padding-left: 18px; line-height: 1.7; color: var(--fg); font-size: 13px; }
.cd-list.small { font-size: 12px; line-height: 1.65; }
.cd-list.mono { font-family: var(--font-mono); font-size: 11.5px; }
.cd-list .bad-item::marker { color: var(--bad); }

.cd-quote {
  display: inline-flex;
  font-family: var(--font-serif);
  font-size: 14px;
  color: var(--fg);
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  padding: 4px 10px;
}
.cd-quote::before { content: "“"; color: var(--accent); margin-right: 2px; }
.cd-quote::after  { content: "”"; color: var(--accent); margin-left: 2px; }

.cd-codeblock {
  font-family: var(--font-mono);
  font-size: 11.5px;
  background: var(--bg-inset);
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  padding: 10px 12px;
  color: var(--fg);
  white-space: pre-wrap;
}

.cd-voice-card {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.cd-waveform {
  display: flex; align-items: center; gap: 2px;
  height: 36px;
}
.cd-waveform span {
  flex: 1;
  background: linear-gradient(180deg, var(--accent), var(--accent-bright));
  opacity: 0.85;
  border-radius: 1px;
}

.cd-ref-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
.cd-ref-cell {
  position: relative;
  aspect-ratio: 3 / 4;
  background: var(--bg-inset);
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}
.cd-ref-cell.add {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-style: dashed;
  color: var(--fg-muted);
  font-size: 11px;
  gap: 6px;
  cursor: pointer;
}
.cd-ref-cell.add:hover { border-color: var(--accent); color: var(--fg); }

.cd-rel-list { display: flex; flex-direction: column; gap: 8px; }
.cd-rel-row {
  display: grid;
  grid-template-columns: 220px 1fr auto;
  gap: 12px;
  align-items: center;
  background: var(--bg-1);
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  padding: 10px 12px;
}
.cd-rel-with { display: flex; gap: 10px; align-items: center; }
.cd-rel-avatar { width: 36px; height: 36px; border-radius: 50%; overflow: hidden; position: relative; background: var(--bg-inset); }
.cd-rel-note { color: var(--fg-muted); font-size: 12.5px; }
.cd-rel-actions { display: flex; gap: 6px; }

/* RIGHT rail (proposals + canon usage in detail) */
.cd-right {
  border-left: 1px solid var(--line);
  background: var(--bg-1);
  padding: 16px;
  overflow-y: auto;
}
.cd-rail-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 10px;
}
.cd-rail-title {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-muted);
}
.cd-rail-count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 1px 6px;
  border-radius: 3px;
}
.cd-usage { display: flex; flex-direction: column; gap: 6px; font-size: 12px; }
.usage-row { display: flex; justify-content: space-between; }
.usage-row .lbl { color: var(--fg-muted); }

.cd-rights { display: flex; flex-direction: column; gap: 6px; font-size: 12px; }
.check { display: flex; gap: 8px; align-items: flex-start; color: var(--fg-muted); }
.check .ico {
  width: 13px; height: 13px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  flex-shrink: 0;
  margin-top: 2px;
  position: relative;
}
.check.ok { color: var(--fg); }
.check.ok .ico {
  border-color: var(--good);
  background: var(--good);
}
.check.ok .ico::after {
  content: "";
  position: absolute;
  left: 3px; top: 1px;
  width: 4px; height: 7px;
  border: 1.5px solid var(--bg-1);
  border-top: 0; border-left: 0;
  transform: rotate(45deg);
}

/* ===== THREAT BUILDER ===== */
.threat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.threat-cell {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.threat-val {
  font-size: 14px;
  line-height: 1.5;
  color: var(--fg);
  margin: 6px 0 10px;
}
.threat-propose {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 8px;
  background: transparent;
  border: 1px dashed var(--line);
  border-radius: 4px;
  color: var(--fg-muted);
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
}
.threat-propose:hover { border-color: var(--accent); color: var(--fg); }
.threat-propose .dim { color: var(--fg-faint); }

.threat-rungs {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex; flex-direction: column; gap: 8px;
}
.threat-rungs li {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 10px;
  align-items: baseline;
  font-size: 13px;
  line-height: 1.5;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line-soft);
}
.threat-rungs li:last-child { border-bottom: 0; }
.threat-rungs li > span:first-child {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--bg-inset);
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center;
}

/* ===== LOCATION BUILDER ===== */
.loc-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}
.loc-hero {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--bg-inset);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.loc-hero-ovl {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px;
  background: linear-gradient(180deg, transparent, oklch(0 0 0 / 0.7));
  z-index: 2;
}
.loc-side { display: flex; flex-direction: column; gap: 12px; }

.loc-plates {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 24px;
}
.loc-plate {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--bg-inset);
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}
.loc-plate-foot {
  position: absolute; left: 0; bottom: 0; right: 0;
  padding: 4px 8px;
  background: linear-gradient(180deg, transparent, oklch(0 0 0 / 0.7));
  z-index: 2;
}

/* ===== WORLD RULES ===== */
.rule-list {
  list-style: none;
  margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 8px;
}
.rule-list li {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.rule-num {
  font-size: 18px;
  color: var(--fg-faint);
  font-weight: 500;
}
.rule-text {
  font-family: var(--font-serif);
  font-size: 16px;
  color: var(--fg);
  margin-bottom: 4px;
  line-height: 1.4;
}
.rule-meta { display: flex; gap: 8px; align-items: center; font-size: 11px; }
.rule-actions { display: flex; gap: 6px; }

/* ===== MOTIFS ===== */
.motif-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 24px;
}
.motif-card {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  display: flex; flex-direction: column; gap: 8px;
}
.motif-glyph {
  position: relative;
  aspect-ratio: 1;
  background: var(--bg-inset);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--line-soft);
}
.motif-card.add {
  display: flex; align-items: center; justify-content: center;
  border-style: dashed;
  color: var(--fg-muted);
  font-size: 12.5px;
  cursor: pointer;
  min-height: 180px;
}
.motif-card.add:hover { color: var(--fg); border-color: var(--accent); }

.motif-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 24px; }
.motif-row {
  display: grid;
  grid-template-columns: 40px 180px 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg-1);
  border: 1px solid var(--line-soft);
  border-radius: 4px;
}
.motif-wave {
  display: flex; align-items: center; gap: 1.5px;
  height: 22px;
}
.motif-wave span {
  flex: 1;
  background: var(--fg-faint);
  border-radius: 1px;
  opacity: 0.7;
}
.motif-row:hover .motif-wave span { background: var(--accent); opacity: 1; }

/* ===== FORBIDDEN ===== */
.forbid-list { display: flex; flex-direction: column; gap: 8px; }
.forbid-row {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-left: 2px solid var(--bad);
  border-radius: var(--radius);
}
.forbid-mark {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: oklch(from var(--bad) l c h / 0.18);
  color: var(--bad);
  display: inline-flex; align-items: center; justify-content: center;
}
.forbid-text {
  font-family: var(--font-serif);
  font-size: 15px;
  color: var(--fg);
  margin-bottom: 4px;
  line-height: 1.45;
}
.forbid-text b { color: var(--fg); font-weight: 600; }
.forbid-meta { display: flex; gap: 8px; align-items: center; font-size: 11px; }
.forbid-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.forbid-tag {
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-muted);
  background: var(--bg-2);
}
.forbid-tag::before { content: "⌀ "; color: var(--bad); margin-right: 2px; }

