/* Cairn design system
   Direction: a well-kept field notebook, not a dashboard. Warm paper, ink type, a serif voice for
   headings, hairline rules instead of boxes, and one signal colour (trail orange) used sparingly.
   Psychology notes are in plan/DESIGN.md. */

@font-face { font-family: "Instrument Serif"; src: url("fonts/instrument-serif-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Instrument Serif"; src: url("fonts/instrument-serif-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Geist"; src: url("fonts/geist-normal.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("fonts/geist-mono-normal.woff2") format("woff2"); font-weight: 400 600; font-style: normal; font-display: swap; }

:root {
  --bg: #f4f1ea;
  --surface: #fffdf8;
  --surface-2: #faf7f0;
  --sunken: #ebe6db;
  --line: #e1dbcf;
  --line-strong: #cbc3b3;
  --ink: #1b1a17;
  --ink-2: #4a463e;
  --muted: #8a8377;
  --accent: #d9481f;
  --accent-ink: #a8340f;
  --accent-soft: #f8e3d9;
  --danger: #b3261e;
  --danger-soft: #f6dedb;
  --idea: #b07415;
  --idea-soft: #f4e8cf;
  --task: #2f5b8c;
  --task-soft: #dfe7f1;
  --decision: #6a4c9c;
  --decision-soft: #e9e2f3;
  --note: #6b6a63;
  --note-soft: #e9e6de;
  --journal: #2e7566;
  --journal-soft: #dcece6;
  --shadow-sm: 0 1px 0 rgba(27, 26, 23, 0.04);
  --shadow: 0 1px 2px rgba(27, 26, 23, 0.06), 0 8px 24px -12px rgba(27, 26, 23, 0.16);
  --shadow-lg: 0 30px 70px -20px rgba(27, 26, 23, 0.35);
  --radius: 6px;
  --radius-lg: 10px;
  --sidebar: 232px;
  --display: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #151412;
  --surface: #1c1b18;
  --surface-2: #201f1c;
  --sunken: #191816;
  --line: #2e2c28;
  --line-strong: #403d37;
  --ink: #efebe3;
  --ink-2: #c8c2b6;
  --muted: #8e877b;
  --accent: #f0764d;
  --accent-ink: #ff9a76;
  --accent-soft: #3a2118;
  --danger: #f2867d;
  --danger-soft: #3a1c19;
  --idea: #e2a94d;
  --idea-soft: #33281a;
  --task: #86aee0;
  --task-soft: #1d2836;
  --decision: #b59ae6;
  --decision-soft: #2a2238;
  --note: #b0aca2;
  --note-soft: #282723;
  --journal: #6fc2ad;
  --journal-soft: #18302a;
  --shadow-sm: 0 1px 0 rgba(0, 0, 0, 0.3);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 10px 26px -12px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 30px 70px -20px rgba(0, 0, 0, 0.8);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  font-feature-settings: "ss01", "cv11";
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--ink); text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--accent); }
[hidden] { display: none !important; }
::selection { background: var(--accent-soft); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
code { font-family: var(--mono); font-size: .88em; padding: 1px 5px; border-radius: 4px; background: var(--sunken); }
.icon { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.icon.sm { width: 14px; height: 14px; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ------------------------------------------------------------ shell */

.app { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 4px;
  padding: 20px 14px 16px;
  border-right: 1px solid var(--line);
  overflow-y: auto;
  background: var(--bg);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 18px; font-family: var(--display); font-size: 24px; line-height: 1; letter-spacing: -0.01em; }
.brand svg { width: 26px; height: 26px; }
.project-chip {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  width: 100%; padding: 10px 10px 11px; margin-bottom: 10px;
  background: transparent; border: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  text-align: left; border-radius: 0;
}
.project-chip:hover strong { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
.project-chip strong { font-size: 13.5px; font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-chip span { font-size: 12px; color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-label { margin: 16px 10px 6px; font-family: var(--mono); font-size: 10.5px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.nav button {
  position: relative; display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 6px 10px; border: 0; border-radius: 5px; background: transparent;
  color: var(--ink-2); font-weight: 450; text-align: left;
}
.nav button .icon { color: var(--muted); }
.nav button:hover { color: var(--ink); background: color-mix(in srgb, var(--sunken) 70%, transparent); }
.nav button.active { color: var(--ink); font-weight: 600; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.nav button.active::before { content: ""; position: absolute; left: -14px; top: 7px; bottom: 7px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.nav button.active .icon { color: var(--ink); }
.nav .count { margin-left: auto; font-family: var(--mono); font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding-top: 14px; }
.git-card { padding: 10px 10px 12px; border-top: 1px solid var(--line); font-size: 12.5px; }
.git-card .row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.git-card .branch { display: flex; align-items: center; gap: 6px; color: var(--muted); font-family: var(--mono); font-size: 12px; }
.foot-row { display: flex; gap: 4px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 10px;
  padding: 14px 40px;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar .menu-btn { display: none; }
#capture-icon { display: contents; }
.capture { flex: 1; position: relative; display: flex; align-items: center; max-width: 720px; }
.capture .icon { position: absolute; left: 13px; top: 12px; color: var(--muted); pointer-events: none; }
.capture input {
  width: 100%; height: 42px; padding: 0 200px 0 40px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.capture input:focus { border-color: var(--ink); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ink) 8%, transparent); }
.capture input::placeholder { color: var(--muted); }
.capture .hint { position: absolute; right: 12px; display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); pointer-events: none; }
.capture-type { position: absolute; right: 10px; pointer-events: none; }
kbd {
  font-family: var(--mono); font-size: 10.5px; font-weight: 500;
  padding: 1px 5px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px;
  background: var(--surface); color: var(--ink-2);
}
.view { padding: 40px 40px 80px; max-width: 1240px; width: 100%; }

/* ------------------------------------------------------------ controls */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: 6px;
  background: var(--surface); color: var(--ink); font-weight: 500; white-space: nowrap; text-decoration: none;
  transition: background .12s, border-color .12s, transform .08s;
}
.btn:hover { border-color: var(--ink-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn.primary:hover { background: color-mix(in srgb, var(--ink) 86%, var(--accent)); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--sunken); color: var(--ink); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); border-color: transparent; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn.icon-only { width: 34px; padding: 0; }
.btn.sm.icon-only { width: 28px; }
.btn:disabled { opacity: .45; cursor: default; }
.text-link { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; color: var(--muted); font-size: 12.5px; }
.text-link:hover { color: var(--ink); }
.link-button { padding: 0; border: 0; background: none; font-weight: 600; color: var(--ink); text-align: left; }
.link-button:hover { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
.input, .select {
  height: 34px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 6px;
  background: var(--surface); outline: none;
}
.input:focus, .select:focus { border-color: var(--ink); }
.input:disabled, .select:disabled { opacity: .7; background: transparent; }

/* ------------------------------------------------------------ type & page */

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 28px; padding-bottom: 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.page-head h1 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 44px; line-height: 1; letter-spacing: -0.015em; }
.page-head p { margin: 10px 0 0; color: var(--ink-2); max-width: 620px; font-size: 14.5px; text-wrap: pretty; }
.eyebrow { margin: 0 0 10px !important; font-family: var(--mono); font-size: 11px !important; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--accent) !important; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.section-title { margin: 36px 0 12px; font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

/* ------------------------------------------------------------ today */

.today { display: grid; grid-template-columns: minmax(0, 1fr) 200px; gap: 32px; align-items: end; padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.today h1 { margin: 0; font-family: var(--display); font-weight: 400; font-size: clamp(44px, 5.6vw, 68px); line-height: .98; letter-spacing: -0.02em; }
.today .lede { margin: 14px 0 20px; font-size: 16px; color: var(--ink-2); max-width: 560px; }
.cairn { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.cairn-art { width: 168px; height: auto; }
.cairn figcaption { text-align: center; font-size: 12.5px; color: var(--ink-2); }
.cairn figcaption strong { font-family: var(--display); font-size: 22px; font-weight: 400; margin-right: 4px; color: var(--ink); }
.cairn figcaption span { display: block; color: var(--muted); font-size: 11.5px; }

.figures { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.figure { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 18px 20px 18px 0; border: 0; background: none; text-align: left; }
.figure + .figure { padding-left: 20px; border-left: 1px solid var(--line); }
.figure .value { font-family: var(--display); font-size: 40px; line-height: 1; font-variant-numeric: tabular-nums; }
.figure .label { font-size: 12.5px; color: var(--muted); }
.figure:hover .label { color: var(--ink); }

.columns-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; }
.column-block { padding-top: 22px; }
.column-block > header { display: flex; align-items: baseline; justify-content: space-between; padding-bottom: 8px; border-bottom: 1px solid var(--ink); margin-bottom: 4px; }
.column-block h2 { margin: 0; font-size: 13px; font-weight: 600; }
.rows { display: flex; flex-direction: column; }
.row-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 0; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; }
.row-item:hover .title { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
.row-item .title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.row-item .meta { font-family: var(--mono); font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.empty { padding: 12px 0; margin: 0; color: var(--muted); font-size: 13px; }
.empty-state { padding: 56px 20px; text-align: center; color: var(--muted); }
.empty-state h3 { margin: 12px 0 4px; color: var(--ink); font-family: var(--display); font-weight: 400; font-size: 24px; }

.dot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--note); }
.t-idea { --t: var(--idea); --t-soft: var(--idea-soft); }
.t-task { --t: var(--task); --t-soft: var(--task-soft); }
.t-decision { --t: var(--decision); --t-soft: var(--decision-soft); }
.t-note { --t: var(--note); --t-soft: var(--note-soft); }
.t-journal { --t: var(--journal); --t-soft: var(--journal-soft); }
.dot[class*="t-"] { background: var(--t); }
.pill { display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 7px; border-radius: 4px; font-size: 11.5px; font-weight: 550; white-space: nowrap; background: var(--t-soft, var(--sunken)); color: var(--t, var(--ink-2)); }
.tag { display: inline-flex; align-items: center; height: 19px; padding: 0 6px; border-radius: 4px; font-family: var(--mono); font-size: 11px; color: var(--ink-2); background: var(--sunken); border: 0; white-space: nowrap; }
button.tag:hover, .tag.on { background: var(--ink); color: var(--bg); }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.status-todo { --t: var(--note); --t-soft: var(--note-soft); }
.status-doing, .status-exploring { --t: var(--task); --t-soft: var(--task-soft); }
.status-done, .status-accepted, .status-ready { --t: var(--journal); --t-soft: var(--journal-soft); }
.status-raw { --t: var(--idea); --t-soft: var(--idea-soft); }
.status-proposed { --t: var(--decision); --t-soft: var(--decision-soft); }
.status-parked, .status-superseded { --t: var(--muted); --t-soft: var(--sunken); }

/* guide */
.guide { position: relative; display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.guide-intro h2 { margin: 0 0 6px; font-family: var(--display); font-weight: 400; font-size: 22px; line-height: 1.1; }
.guide-intro p { margin: 0; color: var(--ink-2); font-size: 13px; }
.guide-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.guide-step { display: flex; gap: 10px; }
.guide-step .num { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-family: var(--mono); font-size: 11px; border: 1px solid var(--line-strong); color: var(--ink-2); }
.guide-step.done .num { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.guide-step.done strong { text-decoration: line-through; text-decoration-color: var(--accent); color: var(--muted); }
.guide-step strong { display: block; font-size: 13px; font-weight: 600; }
.guide-step span { font-size: 12.5px; color: var(--muted); }
.guide-close { position: absolute; top: 14px; right: 0; }

/* ------------------------------------------------------------ boards */

.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 1fr); gap: 20px; align-items: start; }
.column { display: flex; flex-direction: column; gap: 8px; min-height: 240px; padding: 0 0 10px; border-radius: 0; transition: background .12s; }
.column.drop { background: color-mix(in srgb, var(--accent-soft) 60%, transparent); outline: 1px dashed var(--accent); outline-offset: 6px; border-radius: 4px; }
.column-head { display: flex; align-items: center; gap: 8px; padding: 0 0 8px; border-bottom: 1px solid var(--ink); }
.column-head h2 { margin: 0; font-size: 13px; font-weight: 600; }
.column-head .count { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.column-hint { margin: 2px 0 2px; font-size: 12px; color: var(--muted); font-style: italic; font-family: var(--display); font-size: 15px; }
.quick-add input { width: 100%; height: 32px; padding: 0 2px; border: 0; border-bottom: 1px dashed var(--line-strong); background: transparent; outline: none; }
.quick-add input:focus { border-bottom: 1px solid var(--ink); }
.quick-add input::placeholder { color: var(--muted); }
.item-card {
  display: flex; flex-direction: column; gap: 6px; width: 100%;
  padding: 12px 13px; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px;
  cursor: grab; position: relative;
  transition: box-shadow .15s, border-color .15s, transform .15s;
}
.item-card::before { content: ""; position: absolute; left: -1px; top: 10px; bottom: 10px; width: 2px; border-radius: 2px; background: var(--t); opacity: .9; }
.item-card[draggable="false"] { cursor: pointer; }
.item-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.item-card.dragging { opacity: .5; transform: rotate(-1deg) scale(.98); }
.item-card .title { font-weight: 560; line-height: 1.35; }
.item-card .snippet { font-size: 12.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item-card .foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); font-family: var(--mono); }
.item-card .foot .grow { flex: 1; }
.item-card .foot span.metric { display: inline-flex; align-items: center; gap: 4px; }
.source-chip { display: inline-flex; align-items: center; gap: 4px; font-family: var(--mono); font-size: 11px; color: var(--ink-2); background: var(--sunken); padding: 1px 6px; border-radius: 4px; }
.move-select { display: none; }
.progress { height: 3px; border-radius: 3px; background: var(--sunken); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--ink); border-radius: 3px; }

/* ------------------------------------------------------------ lists */

.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.segmented { display: inline-flex; max-width: 100%; overflow-x: auto; scrollbar-width: none; gap: 2px; padding: 0; border-bottom: 1px solid var(--line); }
.segmented button { flex: none; height: 32px; padding: 0 10px; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: transparent; color: var(--muted); font-weight: 500; font-size: 13px; border-radius: 0; }
.segmented button:hover { color: var(--ink); }
.segmented button.on { color: var(--ink); border-bottom-color: var(--accent); }
.search-field { position: relative; flex: 1; min-width: 180px; max-width: 320px; margin-left: auto; }
.search-field .icon { position: absolute; left: 10px; top: 9px; color: var(--muted); }
.search-field input { width: 100%; padding-left: 32px; }
.list { border-top: 1px solid var(--ink); }
.list-row { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto auto; gap: 14px; align-items: center; width: 100%; padding: 12px 2px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; }
.list-row:hover .title { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
.list-row .main-col { min-width: 0; }
.list-row .title { font-weight: 560; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .snippet { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .when { font-family: var(--mono); font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.type-icon { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 5px; background: var(--t-soft); color: var(--t); }
.type-icon .icon { width: 13px; height: 13px; }
.group-title { display: flex; align-items: center; gap: 8px; margin: 30px 0 8px; }
.group-title:first-of-type { margin-top: 0; }
.card { background: transparent; }

/* code inbox */
.file-group { margin-bottom: 22px; }
.file-head { display: flex; align-items: center; gap: 8px; padding: 0 0 8px; border-bottom: 1px solid var(--ink); font-family: var(--mono); font-size: 12px; color: var(--ink-2); }
.todo-row { display: grid; grid-template-columns: 70px minmax(0, 1fr) 70px auto; gap: 14px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.todo-row .line { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.tag-TODO { --t: var(--task); --t-soft: var(--task-soft); }
.tag-FIXME { --t: var(--danger); --t-soft: var(--danger-soft); }
.tag-HACK, .tag-XXX { --t: var(--idea); --t-soft: var(--idea-soft); }
.tracked { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--journal); font-weight: 500; }

/* context pack */
.callout, .notice { display: flex; gap: 12px; padding: 14px 16px; border-left: 2px solid var(--accent); background: var(--surface); color: var(--ink-2); font-size: 13.5px; }
.callout .icon, .notice .icon { color: var(--accent); margin-top: 2px; }
.pre-box { margin: 0; padding: 18px 2px; max-height: 560px; overflow: auto; font-family: var(--mono); font-size: 12.5px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; border-top: 1px solid var(--ink); }

/* map */
.map-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.map-wrap { position: relative; height: calc(100vh - 240px); min-height: 460px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  background-image: radial-gradient(color-mix(in srgb, var(--line) 70%, transparent) 1px, transparent 1px); background-size: 22px 22px; }
.map-wrap svg { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; user-select: none; }
.map-wrap svg:focus { outline: none; }
.map-wrap svg.panning { cursor: grabbing; }
.map-legend { position: absolute; left: 12px; bottom: 12px; right: 120px; display: flex; gap: 6px 14px; flex-wrap: wrap; width: max-content; max-width: calc(100% - 132px); padding: 6px 10px; font-size: 12px; color: var(--muted); background: color-mix(in srgb, var(--surface) 92%, transparent); border: 1px solid var(--line); border-radius: 6px; pointer-events: none; }
.map-legend span { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.map-zoom { position: absolute; right: 12px; bottom: 12px; display: flex; gap: 2px; padding: 3px; background: var(--surface); border: 1px solid var(--line); border-radius: 7px; }
.map-chip { position: absolute; top: 12px; right: 12px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; max-width: calc(100% - 24px); padding: 6px 10px; font-size: 12.5px; color: var(--ink-2); background: var(--surface); border: 1px solid var(--line); border-radius: 7px; box-shadow: var(--shadow-sm); }
.map-chip strong { color: var(--ink); font-weight: 600; }
.segs { display: inline-flex; border: 1px solid var(--line); border-radius: 5px; overflow: hidden; }
.segs .seg { height: 24px; min-width: 26px; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 12px; cursor: pointer; }
.segs .seg + .seg { border-left: 1px solid var(--line); }
.segs .seg.on { background: var(--ink); color: var(--bg); }
.link-btn { padding: 0; border: 0; background: none; color: var(--accent-ink); font: inherit; font-size: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.row-link { padding: 0; border: 0; background: none; color: var(--ink); font: inherit; font-weight: 560; text-align: left; cursor: pointer; overflow-wrap: anywhere; }
.row-link:hover { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
.map-card { position: absolute; top: 12px; left: 12px; width: min(320px, calc(100% - 24px)); padding: 12px 14px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; box-shadow: var(--shadow); font-size: 13px; }
.map-card[hidden] { display: none; }
.map-card-head { display: flex; align-items: center; gap: 8px; }
.map-card-head strong { flex: 1; min-width: 0; font-size: 14px; overflow-wrap: anywhere; }
.map-card p { margin: 6px 0 0; }
.map-card .small, .map-side .small { font-size: 12px; }
.map-card .muted.small { font-family: var(--mono); font-size: 11px; overflow-wrap: anywhere; }
.map-card-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.map-node, .map-dot { cursor: pointer; outline: none; }
.map-dot circle, .map-dot rect { stroke: var(--surface); stroke-width: 2px; vector-effect: non-scaling-stroke; transition: opacity .15s; }
.map-ghost circle { fill: var(--surface); stroke: var(--muted); stroke-dasharray: 3 2; }
.map-file rect { fill: var(--sunken); stroke: var(--muted); }
.map-dot text { font-family: var(--font); fill: var(--ink-2); paint-order: stroke; stroke: var(--surface); stroke-width: 3.5px; stroke-linejoin: round; vector-effect: non-scaling-stroke; pointer-events: none; }
.map-ghost text, .map-file text { fill: var(--muted); font-style: italic; }
.map-dot:hover circle, .map-dot:hover rect { stroke: var(--ink); }
.map-dot text.quiet { opacity: 0; }
.map-dot:hover text.quiet, .map-dot:focus text.quiet, .map-dot:focus-visible text.quiet, .map-dot.selected text.quiet { opacity: 1; transition: opacity .12s; }
.map-dot.selected circle, .map-dot:focus-visible circle { stroke: var(--accent); stroke-width: 3px; }
.map-dot.selected text { fill: var(--ink); font-weight: 600; }
.map-edge { stroke: var(--line-strong); stroke-width: 1.1px; vector-effect: non-scaling-stroke; }
.map-edges.arrows .map-edge { marker-end: url(#map-arrow); }
.map-edges.arrows .map-edge.both { marker-start: url(#map-arrow); }
#map-arrow path { fill: var(--line-strong); }
.map-edge-ghost, .map-edge-file { stroke-dasharray: 3 3; }
.map-suggestion { stroke: var(--accent); stroke-width: 1.4px; stroke-dasharray: 5 4; vector-effect: non-scaling-stroke; opacity: .85; pointer-events: none; }
.map-wrap.focus .map-dot:not(.lit) { opacity: .2; }
.map-wrap.focus .map-edge:not(.lit) { opacity: .1; }
.map-wrap.moving .map-dot:not(.lit):not(.selected) text { opacity: 0; }
.map-edge.lit { stroke: var(--accent); stroke-width: 1.8px; }
.map-wrap.pathing .map-dot:not(.on-path) { opacity: .18; }
.map-wrap.pathing .map-edge:not(.on-path) { opacity: .08; }
.map-edge.on-path { stroke: var(--accent); stroke-width: 3px; }
.map-dot.on-path circle { stroke: var(--accent); stroke-width: 3px; }
.map-side { display: flex; flex-direction: column; gap: 0; max-height: calc(100vh - 240px); min-height: 460px; overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.map-section { padding: 14px 16px; border-bottom: 1px solid var(--line); min-width: 0; }
.map-section:last-child { border-bottom: 0; }
.map-section h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.map-section h3 .count.zero { background: var(--sunken); color: var(--muted); }
.map-section h3 .count { margin-left: auto; padding: 0 6px; border-radius: 9px; background: var(--accent-soft); color: var(--accent-ink); font-size: 11px; letter-spacing: 0; }
.map-section .input, .map-section select.input { width: 100%; height: 32px; font-size: 13px; }
.map-section .chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 9px; border: 1px solid var(--line); border-radius: 13px; background: transparent; color: var(--ink-2); font: inherit; font-size: 12px; cursor: pointer; }
.chip:hover { border-color: var(--line-strong); }
.chip.on { border-color: var(--ink); background: var(--ink); color: var(--bg); }
.map-section .checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 10px; margin: 8px 0 4px; }
.map-section .check { margin-top: 6px; font-size: 13px; }
.field-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.field-row select { flex: 1; min-width: 0; }
.facts { margin: 0; display: grid; gap: 10px; font-size: 13px; }
.facts div { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 10px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; min-width: 0; }
.hubs { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.hubs li { display: flex; align-items: baseline; gap: 8px; }
.hubs .row-link { flex: 1; min-width: 0; font-weight: 500; line-height: 1.35; }
.hub-count { flex: none; min-width: 22px; padding: 0 6px; border-radius: 9px; background: var(--sunken); color: var(--ink-2); font-family: var(--mono); font-size: 11px; text-align: center; }
.suggestions { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.suggestion { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 9px 0; border-top: 1px solid var(--line); font-size: 13px; line-height: 1.45; }
.suggestion:first-child { border-top: 0; padding-top: 0; }
.suggestion .context { margin: 4px 0 0; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.suggestion.fix { color: var(--ink-2); }
.path-form { display: grid; gap: 8px; }
.path-actions { display: flex; gap: 8px; }
.path-steps { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 4px; font-size: 13px; }
:root { --g0: #d9481f; --g1: #2f5b8c; --g2: #2e7566; --g3: #b07415; --g4: #6a4c9c; --g5: #b8406e; --g6: #4f7a28; --g7: #2a8199; --g-other: #a9a294; }
:root[data-theme="dark"] { --g0: #f0764d; --g1: #7aa7dc; --g2: #5fbfa8; --g3: #e2a94d; --g4: #b393e6; --g5: #ec7fa9; --g6: #9ccc65; --g7: #5cc4dc; --g-other: #6b665d; }

/* ------------------------------------------------------------ people */

.people-search { position: relative; display: flex; gap: 8px; align-items: center; max-width: 720px; margin-bottom: 28px; }
.people-search .icon { position: absolute; left: 14px; color: var(--muted); }
.people-search input { flex: 1; min-width: 0; height: 46px; padding: 0 14px 0 42px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); outline: none; font-size: 15px; }
.people-search input:focus { border-color: var(--ink); }
.people-search .btn { height: 46px; padding: 0 20px; }
.profile-card { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 24px; padding: 24px 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--line); }
.avatar-lg { width: 96px; height: 96px; border-radius: 50%; background: var(--sunken); object-fit: cover; box-shadow: 0 0 0 1px var(--line); }
.profile-main h2 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 40px; line-height: 1; letter-spacing: -0.015em; }
.profile-main .handle { margin: 8px 0 0; font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.profile-main .bio { margin: 12px 0 0; font-size: 15px; color: var(--ink-2); max-width: 620px; }
.profile-main .actions { margin-top: 18px; }
.skeleton h2 { color: var(--muted); }
.proof { padding: 22px 0 6px; }
.proof-note { margin: 0 0 16px; font-size: 12.5px; color: var(--muted); }
.proof-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 28px; }
.proof-col h3 { margin: 0 0 8px; padding-bottom: 8px; border-bottom: 1px solid var(--ink); font-size: 13px; font-weight: 600; }
.proof-col ul { list-style: none; margin: 0; padding: 0; }
.proof-col li { display: flex; align-items: baseline; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.proof-col li .dot { transform: translateY(-1px); }
.proof-col p { margin: 8px 0 0; font-size: 13px; }
.repo-list { border-top: 1px solid var(--ink); }
.repo-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto auto; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.repo-row img { width: 36px; height: 36px; border-radius: 50%; background: var(--sunken); }
.repo-main p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.repo-meta { font-family: var(--mono); font-size: 11.5px; }
.repo-actions { display: flex; gap: 6px; }
.publish { margin-top: 36px; padding: 20px 22px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.publish h3 { margin: 0 0 6px; font-family: var(--display); font-weight: 400; font-size: 22px; }
.publish p { margin: 0 0 10px; color: var(--ink-2); font-size: 13.5px; }
.publish code { display: inline-block; padding: 6px 10px; }

.ro-banner { display: flex; align-items: center; gap: 12px; margin: -16px 0 28px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 6px; }
.ro-avatar { width: 28px; height: 28px; border-radius: 50%; }
.ro-text { display: flex; flex-direction: column; min-width: 0; }
.ro-text strong { font-size: 13.5px; }
.ro-text span { display: inline-flex; align-items: center; gap: 4px; font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.ro-actions { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }

/* ------------------------------------------------------------ drawer */

.scrim { position: fixed; inset: 0; z-index: 40; background: color-mix(in srgb, var(--ink) 22%, transparent); animation: fade .15s ease; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 41; width: min(660px, 100vw); display: flex; flex-direction: column; background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow-lg); animation: slide .2s cubic-bezier(.2, .8, .2, 1); }
@keyframes slide { from { transform: translateX(28px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.drawer-head .path { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.save-state { font-family: var(--mono); font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.save-state.saving { color: var(--accent); }
.drawer-body { flex: 1; overflow-y: auto; padding: 28px 32px 40px; }
.title-input { width: 100%; border: 0; outline: none; background: transparent; padding: 0; margin: 0 0 16px; font-family: var(--display); font-size: 36px; font-weight: 400; line-height: 1.1; letter-spacing: -0.015em; }
.title-input:disabled { color: var(--ink); }
.props { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 8px 14px; align-items: center; margin-bottom: 20px; padding-bottom: 18px; border-bottom: 1px solid var(--line); font-size: 13px; }
.props label { color: var(--muted); font-family: var(--mono); font-size: 11.5px; }
.props .select, .props .input { height: 30px; font-size: 13px; }
.props .input { width: 100%; }
.editor-tabs { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.editor-tabs .grow { flex: 1; }
.body-input { width: 100%; min-height: 340px; resize: vertical; padding: 16px; outline: none; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); font-family: var(--mono); font-size: 13px; line-height: 1.7; tab-size: 2; }
.body-input:focus { border-color: var(--ink); background: var(--surface); }
.backlinks { margin-top: 26px; }
.backlinks h3 { margin: 0 0 4px; padding-bottom: 8px; border-bottom: 1px solid var(--ink); font-size: 12px; font-weight: 600; }
.spark-card { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 18px; padding: 12px 14px; border-left: 2px solid var(--idea); background: var(--idea-soft); font-size: 13.5px; }
.spark-card strong { font-family: var(--display); font-weight: 400; font-size: 19px; }
.spark-card .icon { color: var(--idea); margin-top: 3px; }

.prose { font-size: 15px; line-height: 1.72; color: var(--ink); overflow-wrap: anywhere; }
.prose h1, .prose h2, .prose h3, .prose h4 { margin: 1.4em 0 .4em; line-height: 1.25; }
.prose h1, .prose h2 { font-family: var(--display); font-weight: 400; letter-spacing: -0.01em; }
.prose h1 { font-size: 30px; } .prose h2 { font-size: 24px; } .prose h3 { font-size: 15px; font-weight: 650; } .prose h4 { font-size: 14px; }
.prose > :first-child { margin-top: 0; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose pre, .prose table { margin: 0 0 .9em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin: .2em 0; }
.prose li::marker { color: var(--muted); }
.prose li.task-item { list-style: none; margin-left: -1.3em; display: flex; gap: 8px; align-items: baseline; }
.prose li.task-item input { accent-color: var(--ink); }
.prose pre { padding: 14px 16px; border-radius: 6px; background: var(--sunken); overflow-x: auto; }
.prose pre code { padding: 0; background: none; }
.prose blockquote { padding: 2px 16px; border-left: 2px solid var(--accent); color: var(--ink-2); font-family: var(--display); font-size: 19px; }
.prose table { border-collapse: collapse; width: 100%; font-size: 13.5px; display: block; overflow-x: auto; }
.prose th, .prose td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.prose th { border-bottom: 1px solid var(--ink); font-weight: 600; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 1.5em 0; }
.wikilink { color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; font-weight: 500; }
.wikilink.missing { color: var(--muted); text-decoration-style: dashed; text-decoration-color: var(--line-strong); }

/* ------------------------------------------------------------ palette, modal, toast */

.palette-wrap { position: fixed; inset: 0; z-index: 60; display: flex; justify-content: center; align-items: flex-start; padding-top: 12vh; background: color-mix(in srgb, var(--ink) 25%, transparent); animation: fade .12s ease; }
.palette { width: min(620px, calc(100vw - 24px)); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); overflow: hidden; }
.palette input { width: 100%; height: 56px; padding: 0 20px; border: 0; border-bottom: 1px solid var(--line); outline: none; background: transparent; font-size: 16px; }
.palette-list { max-height: 380px; overflow-y: auto; padding: 6px; }
.palette-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border: 0; border-radius: 6px; background: transparent; text-align: left; }
.palette-item.on { background: var(--sunken); }
.palette-item .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-item .kind { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.palette-section { padding: 10px 12px 4px; font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

.modal-wrap { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 16px; background: color-mix(in srgb, var(--ink) 28%, transparent); animation: fade .12s ease; }
.modal { width: min(460px, 100%); padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); }
.modal h2 { margin: 0 0 6px; font-family: var(--display); font-weight: 400; font-size: 26px; }
.modal p { margin: 0 0 14px; color: var(--ink-2); font-size: 13.5px; }
.modal .input { width: 100%; }
.modal .actions { justify-content: flex-end; margin-top: 18px; }
.modal ul { margin: 0 0 4px; padding-left: 18px; max-height: 160px; overflow: auto; font-family: var(--mono); font-size: 12px; color: var(--ink-2); }

.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast { display: flex; align-items: center; gap: 12px; max-width: min(440px, calc(100vw - 40px)); padding: 10px 12px 10px 14px; border-radius: 8px; background: var(--ink); color: var(--bg); box-shadow: var(--shadow-lg); font-size: 13.5px; animation: slide .2s ease; }
.toast .btn { height: 26px; background: transparent; color: var(--bg); border-color: color-mix(in srgb, var(--bg) 35%, transparent); }
.toast.error { background: var(--danger); color: #fff; }

/* ------------------------------------------------------------ welcome */

.welcome { min-height: 100vh; display: flex; flex-direction: column; align-items: center; padding: 72px 24px 48px; }
.welcome-inner { width: min(1000px, 100%); }
.welcome .brand { justify-content: center; font-size: 30px; padding-bottom: 40px; }
.welcome .brand svg { width: 34px; height: 34px; }
.welcome h1 { margin: 0 auto 18px; max-width: 820px; text-align: center; font-family: var(--display); font-weight: 400; font-size: clamp(44px, 7vw, 84px); line-height: .95; letter-spacing: -0.025em; text-wrap: balance; }
.welcome h1 em { color: var(--accent); font-style: italic; }
.welcome .lede { margin: 0 auto 44px; max-width: 600px; text-align: center; font-size: 17px; color: var(--ink-2); text-wrap: pretty; }
.choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--ink); border-bottom: 1px solid var(--line); }
.choice { display: flex; flex-direction: column; gap: 10px; padding: 24px 24px 26px 0; text-align: left; }
.choice + .choice { padding-left: 24px; border-left: 1px solid var(--line); }
.choice .badge-icon { display: none; }
.choice h2 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 28px; line-height: 1; }
.choice p { margin: 0; color: var(--ink-2); font-size: 13.5px; flex: 1; }
.choice .btn { align-self: flex-start; }
.choice > code { display: block; padding: 10px 12px; font-size: 12px; line-height: 1.6; white-space: normal; overflow-wrap: anywhere; }
.choice .sub-link { font-size: 12.5px; color: var(--muted); background: none; border: 0; padding: 0; text-decoration: underline; text-underline-offset: 3px; align-self: flex-start; }
.explore-box { margin-top: 32px; }
.explore-box label { display: block; margin-bottom: 8px; font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.explore-row { position: relative; display: flex; gap: 8px; align-items: center; }
.explore-row .icon { position: absolute; left: 14px; color: var(--muted); }
.explore-row input { flex: 1; min-width: 0; height: 46px; padding: 0 14px 0 42px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); outline: none; font-size: 15px; }
.explore-row input:focus { border-color: var(--ink); }
.explore-row .btn { height: 46px; padding: 0 20px; }
.welcome-points { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; margin-top: 44px; }
.welcome-points div { font-size: 13px; color: var(--ink-2); }
.welcome-points strong { display: block; margin-bottom: 4px; font-family: var(--display); font-weight: 400; font-size: 20px; color: var(--ink); }
.welcome-foot { margin-top: 48px; text-align: center; font-size: 12.5px; color: var(--muted); }

/* ------------------------------------------------------------ responsive */

@media (max-width: 1100px) {
  .columns-3, .proof-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .guide { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 50; width: 272px; transform: translateX(-105%); transition: transform .2s ease; box-shadow: var(--shadow-lg); background: var(--bg); }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open::after { content: ""; position: fixed; inset: 0; z-index: 45; background: color-mix(in srgb, var(--ink) 25%, transparent); }
  .topbar .menu-btn { display: inline-flex; }
  .topbar { padding: 10px 14px; }
  .view { padding: 24px 16px 56px; }
  .today { grid-template-columns: minmax(0, 1fr) 96px; gap: 14px; }
  .cairn-art { width: 96px; }
  .cairn figcaption span { display: none; }
  .figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .figure:nth-child(3) { padding-left: 0; border-left: 0; }
  .figure:nth-child(n+3) { border-top: 1px solid var(--line); }
  .columns-3, .proof-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .guide-steps { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .board { grid-auto-flow: row; grid-auto-columns: auto; grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .column { min-height: 0; }
  .move-select { display: block; height: 28px; font-size: 12px; padding: 0 6px; border-radius: 4px; border: 1px solid var(--line); background: var(--surface-2); }
  .choices, .welcome-points { grid-template-columns: minmax(0, 1fr); }
  .choice + .choice { padding-left: 0; border-left: 0; border-top: 1px solid var(--line); }
  .capture .hint { display: none; }
  .capture input { padding-right: 12px; }
  .capture:has(.capture-type:not([hidden])) input { padding-right: 90px; }
  .search-field { flex: 1 1 100%; max-width: none; min-width: 0; margin-left: 0; }
  .toolbar > * { min-width: 0; }
  .list-row { grid-template-columns: 22px minmax(0, 1fr) auto; }
  .list-row .when { display: none; }
  .todo-row { grid-template-columns: 60px minmax(0, 1fr); }
  .todo-row .line { grid-column: 2; }
  .todo-row > :last-child { grid-column: 2; justify-self: start; }
  .props { grid-template-columns: 70px minmax(0, 1fr); }
  .drawer-body { padding: 18px; }
  .map-layout { grid-template-columns: minmax(0, 1fr); }
  .map-wrap { height: 68vh; min-height: 380px; }
  .map-side { max-height: none; min-height: 0; }
  .map-legend { display: none; }
  .page-head h1 { font-size: 36px; }
  .profile-card { grid-template-columns: 64px minmax(0, 1fr); gap: 16px; }
  .avatar-lg { width: 64px; height: 64px; }
  .profile-main h2 { font-size: 30px; }
  .repo-row { grid-template-columns: 36px minmax(0, 1fr); }
  .repo-meta { display: none; }
  .repo-actions { grid-column: 2; }
  .people-search .btn, .explore-row .btn { padding: 0 14px; }
  .ro-banner { flex-wrap: wrap; margin-top: 0; }
  .ro-actions { margin-left: 0; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ------------------------------------------------------------ sign in, account, your brains */

.account-row { display: flex; align-items: center; gap: 8px; padding: 6px 4px 10px; margin-bottom: 6px; border-bottom: 1px solid var(--line); }
.account-row img { width: 22px; height: 22px; border-radius: 50%; background: var(--sunken); }
.account-row .who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: 12px; color: var(--ink-2); }
.account-signin { width: 100%; justify-content: center; margin-bottom: 8px; }

.modal.signin { width: min(500px, 100%); }
.modal .signin-facts { margin: 14px 0 18px; padding: 0; max-height: none; overflow: visible; list-style: none; border-top: 1px solid var(--line); font-family: var(--font); }
.modal .signin-facts li { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }
.signin-facts strong { color: var(--ink); font-weight: 600; }
.btn.wide { width: 100%; justify-content: center; }
.or { display: flex; align-items: center; gap: 10px; margin: 18px 0 12px; font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.device-step { margin-top: 14px; padding: 16px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; text-align: center; }
.device-step p { margin: 0 0 8px; font-size: 13px; }
.device-code { margin: 4px 0 14px; font-family: var(--mono); font-size: 30px; letter-spacing: .14em; color: var(--ink); user-select: all; }
.device-step .waiting { margin-top: 10px; }
.token-form label:not(.check) { display: block; margin-bottom: 6px; font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.token-form .input { width: 100%; font-family: var(--mono); }
.hint { margin: 8px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.hint a { color: var(--ink-2); }
.check { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 13.5px; color: var(--ink); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--ink); }
.form-error { margin: 12px 0 0; padding: 8px 12px; border-left: 2px solid var(--danger); background: var(--danger-soft); color: var(--danger); font-size: 13px; }

.held-card { margin-bottom: 18px; padding: 12px 14px; border-left: 2px solid var(--accent); background: var(--accent-soft); font-size: 13.5px; color: var(--ink-2); }
.held-card p { margin: 0 0 8px; }
.held-card strong { color: var(--ink); }
.held-card summary { cursor: pointer; font-size: 12.5px; color: var(--ink-2); }
.held-card pre { max-height: 200px; overflow: auto; margin: 8px 0 0; padding: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; font-family: var(--mono); font-size: 12px; white-space: pre-wrap; }
.held-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

.signin-cta { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 0 28px; padding: 16px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.signin-cta h3 { margin: 0 0 2px; font-family: var(--display); font-weight: 400; font-size: 22px; }
.signin-cta p { margin: 0; font-size: 13.5px; color: var(--ink-2); }
.my-brains { margin-bottom: 8px; }
.my-brains .section-title { margin-top: 0; }
.create-brain { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.create-brain label { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-right: 6px; }
.create-brain .prefix { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.create-brain .input { width: 180px; font-family: var(--mono); }

.welcome-account { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 28px; padding: 14px 0; border-bottom: 1px solid var(--line); font-size: 14px; color: var(--ink-2); }
.welcome-account img { width: 28px; height: 28px; border-radius: 50%; background: var(--sunken); }
.welcome-account > span { flex: 1; min-width: 200px; }

@media (max-width: 700px) {
  .signin-cta { flex-direction: column; align-items: flex-start; }
  .create-brain { flex-wrap: wrap; }
  .create-brain .input { flex: 1; width: auto; min-width: 0; }
  .create-brain label { width: 100%; }
}

.save-state.unsaved { color: var(--accent); }

/* desktop app: open a brain, settings */
.pick-list { display: grid; gap: 6px; margin: 4px 0 16px; }
.pick-list.compact { max-height: 220px; overflow: auto; }
.pick { display: flex; align-items: flex-start; gap: 12px; width: 100%; padding: 10px 12px; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; color: var(--ink); cursor: pointer; font: inherit; }
.pick:hover, .pick:focus-visible { border-color: var(--ink-2); background: var(--surface-2, var(--surface)); }
.pick svg { flex: none; margin-top: 2px; }
.pick span { display: grid; gap: 2px; min-width: 0; }
.pick strong { font-weight: 600; font-size: 14px; }
.pick small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal.settings .check { margin-top: 12px; flex-wrap: wrap; }
.settings-update { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 18px 0 6px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13.5px; }
.modal .hint { color: var(--muted); font-size: 12.5px; }
