/* Hallmark · shape: app screen · genre: atmospheric · theme: Ribbon (deal 1/3, seed personal-answer-engine-ask-ce6d·f203414c·2026-11-18·r0) · redesign: full
 * nav: sidebar shell (6 destinations plus recent threads), drawer under 60rem · signature: the source rail, numbered sources held beside the answer and lit by each citation · states: loading, empty, error, full on library, discover, threads, spaces, automations · ribbon: dawn by day, two-in-the-morning by night
 * axes: light/grotesk-sans/chromatic-teal · posture: committed · contrast: pass · v2.0.0 */
/* Hallmark · pre-emit critique: P4 H5 E4 S4 R4 V3 · weakest: V, an answer engine has a familiar shape; the source rail beside the answer is what this one is known by */
/* Hallmark · answered F7 · the pill radius sits on chips of state: query tags, citation numbers, a segmented control and loading bars, all controls or tags in an app screen */
/* Hallmark · dropped #app, #openSide · the old shell wrapper and the floating reopen button became the .shell grid and the topbar menu button */
@import url("./tokens.css");
@import url("./base.css");

/* ─── tokens of this page (the token block) ─── */
:root {
  --font-hangul: "Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --font-ui: "Figtree", var(--font-hangul);
  --font-head: "Instrument Sans", var(--font-hangul);
  --font-code: ui-monospace, "Cascadia Mono", Consolas, monospace;
  --shadow-inset: inset 0 1px 2px oklch(20% 0.01 80 / 0.12);
  --sticky-offset: 0px;
  --side-w: 256px;
  --rail-w: 300px;
  --measure: 68ch;
  --control: 36px;
  --control-lg: 44px;
  --text-q: 2.074rem;
  --text-answer: 1.0625rem;
  --color-scrim: oklch(18% 0.02 250 / 0.38);
  --color-hl: oklch(92% 0.028 190 / 0.55);
  --shadow-pop: 0 1px 0 oklch(20% 0.01 80 / 0.12), 0 18px 40px -18px oklch(20% 0.02 80 / 0.4);
  --grad-part: linear-gradient(var(--color-paper), var(--color-paper-2));
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --color-paper: oklch(13.2% 0.022 258); --color-paper-2: oklch(16.4% 0.022 258); --color-paper-3: oklch(20% 0.022 258);
    --color-ink: oklch(93.5% 0.012 85); --color-ink-2: oklch(86% 0.014 85); --color-muted: oklch(72% 0.02 255);
    --color-rule: oklch(27% 0.02 258); --color-rule-2: oklch(22% 0.02 258);
    --color-accent: oklch(82% 0.095 68); --color-accent-soft: oklch(30% 0.045 68); --color-accent-ink: oklch(20% 0.03 62); --color-focus: oklch(82% 0.095 68);
    --metal-hi: oklch(44% 0.012 255); --metal-lo: oklch(25% 0.014 255);
    --edge-light: inset 0 1px 0 oklch(100% 0 0 / 0.07);
    --shadow-part: 0 1px 0 oklch(0% 0 0 / 0.4), 0 10px 18px -6px oklch(0% 0 0 / 0.5);
    --shadow-panel: 0 1px 0 oklch(0% 0 0 / 0.4), 0 24px 48px -16px oklch(0% 0 0 / 0.6);
    --shadow-pop: 0 1px 0 oklch(0% 0 0 / 0.4), 0 18px 40px -18px oklch(0% 0 0 / 0.7);
    --color-scrim: oklch(5% 0.02 258 / 0.6);
    --color-hl: oklch(30% 0.045 68 / 0.7);
    --color-error: oklch(72% 0.15 27); --color-success: oklch(75% 0.12 150);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --color-paper: oklch(13.2% 0.022 258); --color-paper-2: oklch(16.4% 0.022 258); --color-paper-3: oklch(20% 0.022 258);
  --color-ink: oklch(93.5% 0.012 85); --color-ink-2: oklch(86% 0.014 85); --color-muted: oklch(72% 0.02 255);
  --color-rule: oklch(27% 0.02 258); --color-rule-2: oklch(22% 0.02 258);
  --color-accent: oklch(82% 0.095 68); --color-accent-soft: oklch(30% 0.045 68); --color-accent-ink: oklch(20% 0.03 62); --color-focus: oklch(82% 0.095 68);
  --metal-hi: oklch(44% 0.012 255); --metal-lo: oklch(25% 0.014 255);
  --edge-light: inset 0 1px 0 oklch(100% 0 0 / 0.07);
  --shadow-part: 0 1px 0 oklch(0% 0 0 / 0.4), 0 10px 18px -6px oklch(0% 0 0 / 0.5);
  --shadow-panel: 0 1px 0 oklch(0% 0 0 / 0.4), 0 24px 48px -16px oklch(0% 0 0 / 0.6);
  --shadow-pop: 0 1px 0 oklch(0% 0 0 / 0.4), 0 18px 40px -18px oklch(0% 0 0 / 0.7);
  --color-scrim: oklch(5% 0.02 258 / 0.6);
  --color-hl: oklch(30% 0.045 68 / 0.7);
  --color-error: oklch(72% 0.15 27); --color-success: oklch(75% 0.12 150);
}

/* ─── base ─── */
body { font-family: var(--font-ui); color: var(--color-ink); background: var(--color-paper); }
h1, h2, h3 { font-family: var(--font-head); }
button { cursor: pointer; color: inherit; background: none; border: 0; padding: 0; }
button:disabled { cursor: not-allowed; }
kbd { font: 500 var(--text-xs) var(--font-code); color: var(--color-muted); border: var(--rule-hair) solid var(--color-rule); border-radius: var(--radius-part); padding: 0 var(--space-2xs); }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.icon.sm { width: 16px; height: 16px; }

/* ─── shell ─── */
.shell { min-height: 100dvh; padding-left: var(--side-w); }
body.side-collapsed .shell { padding-left: 0; }
.side { position: fixed; inset: 0 auto 0 0; width: var(--side-w); height: 100dvh; display: flex; flex-direction: column; gap: var(--space-2xs); padding: var(--space-md) var(--space-sm); background: var(--color-paper-2); border-right: var(--rule-hair) solid var(--color-rule); z-index: var(--z-sticky); }
body.side-collapsed .side { display: none; }
.brand { display: flex; align-items: center; justify-content: space-between; padding: 0 var(--space-xs) var(--space-sm); }
.wordmark { display: inline-flex; align-items: center; gap: var(--space-xs); text-decoration: none; font: 500 var(--text-lg) var(--font-head); letter-spacing: -0.02em; color: var(--color-ink); }
.wordmark .icon { color: var(--color-accent); width: 20px; height: 20px; }
.new-btn { display: flex; align-items: center; gap: var(--space-xs); min-height: var(--control-lg); padding: 0 var(--space-md); border: var(--rule-hair) solid var(--color-rule); border-radius: var(--radius-pill); background: var(--grad-part); box-shadow: var(--edge-light), var(--shadow-part); font-weight: 500; }
.new-btn kbd { margin-left: auto; }
.nav { display: flex; flex-direction: column; margin-top: var(--space-sm); }
.nav a { display: flex; align-items: center; gap: var(--space-sm); min-height: var(--control); padding: 0 var(--space-sm); border-radius: var(--radius-part); text-decoration: none; color: var(--color-muted); }
.nav a.on { color: var(--color-ink); background: var(--color-paper-3); }
.nav .count { margin-left: auto; font-size: var(--text-xs); color: var(--color-accent); font-weight: 500; }
.side-head { margin: var(--space-lg) var(--space-sm) var(--space-2xs); font-size: var(--text-sm); color: var(--color-muted); }
.recent { flex: 1; overflow-y: auto; display: flex; flex-direction: column; margin-inline: calc(var(--space-2xs) * -1); padding-inline: var(--space-2xs); }
.recent a { display: block; padding: var(--space-xs) var(--space-sm); border-radius: var(--radius-part); font-size: var(--text-sm); color: var(--color-ink-2); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent a.on { background: var(--color-paper-3); color: var(--color-ink); }
.recent .empty-note { padding: var(--space-xs) var(--space-sm); font-size: var(--text-sm); color: var(--color-muted); }
.side-foot { display: flex; flex-direction: column; gap: var(--space-3xs); padding: var(--space-sm) var(--space-sm) 0; border-top: var(--rule-hair) solid var(--color-rule); font-size: var(--text-xs); color: var(--color-muted); }
.side-foot b { font-weight: 500; color: var(--color-ink-2); }
.warn-text { color: var(--color-error); }

.topbar { display: none; position: sticky; top: 0; z-index: var(--z-sticky-nav); align-items: center; gap: var(--space-xs); min-height: 56px; padding: 0 var(--space-sm); background: var(--color-paper); border-bottom: var(--rule-hair) solid var(--color-rule); }
body.side-collapsed .topbar { display: flex; }
body.side-collapsed { --sticky-offset: 56px; }
.topbar .wordmark { font-size: var(--text-md); }
.topbar .spacer { flex: 1; }
.scrim { display: none; }

.main { min-width: 0; }

/* ─── buttons ─── */
.icon-btn { display: inline-grid; place-items: center; width: var(--control); height: var(--control); border-radius: var(--radius-part); color: var(--color-muted); position: relative; }
.icon-btn::after { content: ""; position: absolute; inset: -4px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-xs); min-height: var(--control); padding: 0 var(--space-md); border: var(--rule-hair) solid var(--color-rule); border-radius: var(--radius-pill); background: var(--grad-part); box-shadow: var(--edge-light), var(--shadow-part); font-size: var(--text-sm); font-weight: 500; color: var(--color-ink); white-space: nowrap; position: relative; }
.btn::after { content: ""; position: absolute; inset: -4px 0; }
.btn.primary { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-accent-ink); }
.btn.quiet { background: none; box-shadow: none; border-color: transparent; color: var(--color-muted); }
.btn.danger { color: var(--color-error); }
.btn:disabled, .icon-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-row { display: flex; gap: var(--space-xs); flex-wrap: wrap; align-items: center; }

/* ─── composer ─── */
.composer { position: relative; display: flex; flex-direction: column; gap: var(--space-xs); padding: var(--space-sm); border: var(--rule-hair) solid var(--color-rule); border-radius: var(--radius-card); background: var(--grad-part); box-shadow: var(--edge-light), var(--shadow-part); }
.composer:focus-within { border-color: var(--color-muted); }
.composer textarea { width: 100%; min-height: 56px; max-height: 260px; resize: none; border: 0; outline: 0; background: transparent; color: var(--color-ink); font: 400 var(--text-lg)/1.5 var(--font-ui); padding: var(--space-2xs) var(--space-xs); }
.composer textarea::placeholder { color: var(--color-muted); }
.composer.compact textarea { min-height: 28px; font-size: var(--text-md); }
.bar { display: flex; align-items: center; gap: var(--space-2xs); flex-wrap: wrap; }
.bar .spacer { flex: 1; }
.chip { display: inline-flex; align-items: center; gap: var(--space-2xs); min-height: 32px; padding: 0 var(--space-sm); border-radius: var(--radius-pill); font-size: var(--text-sm); color: var(--color-ink-2); white-space: nowrap; position: relative; }
.chip::after { content: ""; position: absolute; inset: -6px 0; }
.chip.outline { border: var(--rule-hair) solid var(--color-rule); }
.chip[aria-pressed="true"], .chip.on { background: var(--color-accent-soft); color: var(--color-ink); }
.chip .icon { width: 16px; height: 16px; }
.seg { display: inline-flex; padding: var(--space-3xs); gap: var(--space-3xs); border-radius: var(--radius-pill); background: var(--color-paper-3); box-shadow: var(--shadow-inset); }
.seg button { min-height: 28px; padding: 0 var(--space-sm); border-radius: var(--radius-pill); font-size: var(--text-sm); color: var(--color-muted); white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--grad-part); box-shadow: var(--edge-light), var(--shadow-part); color: var(--color-ink); font-weight: 500; }
.send { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--color-accent); color: var(--color-accent-ink); box-shadow: var(--edge-light), var(--shadow-part); }
.send.stop { background: var(--color-ink); color: var(--color-paper); }
.send:disabled { opacity: 0.55; cursor: not-allowed; background: var(--color-paper-3); color: var(--color-muted); }
.attach-list { display: flex; gap: var(--space-2xs); flex-wrap: wrap; padding: 0 var(--space-xs); }
.attach-list:empty { display: none; }
.file-tag { display: inline-flex; align-items: center; gap: var(--space-2xs); min-height: 28px; padding: 0 var(--space-2xs) 0 var(--space-xs); border-radius: var(--radius-part); background: var(--color-paper-3); font-size: var(--text-sm); }
.file-tag button { display: grid; place-items: center; width: 22px; height: 22px; border-radius: var(--radius-part); color: var(--color-muted); }
.hint-row { display: flex; gap: var(--space-md); flex-wrap: wrap; justify-content: center; margin-top: var(--space-sm); font-size: var(--text-xs); color: var(--color-muted); }
.drop-note { position: absolute; inset: 0; display: grid; place-items: center; border-radius: var(--radius-card); background: var(--color-accent-soft); color: var(--color-ink); font-weight: 500; pointer-events: none; }

.suggest { position: absolute; left: 0; right: 0; top: calc(100% + var(--space-2xs)); z-index: var(--z-dropdown); padding: var(--space-2xs); border: var(--rule-hair) solid var(--color-rule); border-radius: var(--radius-part); background: var(--color-paper); box-shadow: var(--shadow-pop); }
.suggest button { display: flex; align-items: center; gap: var(--space-xs); width: 100%; min-height: var(--control); padding: 0 var(--space-sm); border-radius: var(--radius-part); text-align: left; color: var(--color-ink-2); }
.suggest button[aria-selected="true"] { background: var(--color-paper-2); color: var(--color-ink); }

/* ─── popover ─── */
.pop { position: fixed; z-index: var(--z-dropdown); min-width: 280px; max-width: min(360px, calc(100vw - 2 * var(--space-md))); max-height: 70dvh; overflow-y: auto; padding: var(--space-2xs); border: var(--rule-hair) solid var(--color-rule); border-radius: var(--radius-part); background: var(--color-paper); box-shadow: var(--shadow-pop); }
.pop-label { padding: var(--space-xs) var(--space-sm) var(--space-2xs); font-size: var(--text-xs); color: var(--color-muted); }
.opt { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: var(--space-xs); align-items: start; width: 100%; padding: var(--space-xs) var(--space-sm); border-radius: var(--radius-part); text-align: left; }
.opt .t { display: block; font-size: var(--text-sm); font-weight: 500; color: var(--color-ink); }
.opt .d { display: block; font-size: var(--text-xs); color: var(--color-muted); line-height: 1.4; }
.mono-area { font-family: var(--font-code); font-size: var(--text-sm); }
.row-link { text-decoration: none; min-width: 0; }
.space-composer { margin: var(--space-lg) 0 var(--space-md); }
.disc-item button.tt { text-align: left; }
.noscript { padding: var(--space-lg); }
.login { min-height: 100dvh; display: grid; place-items: center; padding: var(--space-lg) var(--space-md); }
.login-card { width: min(400px, 100%); display: flex; flex-direction: column; gap: var(--space-sm); padding: var(--space-xl) var(--space-lg); }
.login-card h1 { font-size: var(--text-2xl); margin-top: var(--space-md); }
.login-card .field small { color: var(--color-error); }
.login-card .btn { min-height: var(--control-lg); }
.opt .ck { color: var(--color-accent); padding-top: var(--space-3xs); }
.opt[aria-disabled="true"] .t { color: var(--color-muted); }
.pop hr { border: 0; border-top: var(--rule-hair) solid var(--color-rule); margin: var(--space-2xs) var(--space-xs); }
.pop .row { display: flex; gap: var(--space-2xs); flex-wrap: wrap; padding: 0 var(--space-xs) var(--space-xs); }
.pop .field { margin: 0; padding: 0 var(--space-sm) var(--space-xs); }

/* ─── home ─── */
.home { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: var(--space-2xl) var(--space-lg) 14dvh; }
.home-inner { width: min(760px, 100%); margin-inline: auto; }
.home h1 { max-width: none; font-size: clamp(2rem, 4vw, 2.6rem); line-height: 1.08; margin-bottom: var(--space-lg); }
.home-meta { display: flex; justify-content: space-between; align-items: center; gap: var(--space-sm); flex-wrap: wrap; margin-bottom: var(--space-sm); font-size: var(--text-sm); color: var(--color-muted); }
.starters { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); gap: var(--space-xs); margin-top: var(--space-xl); }
.starter { display: flex; flex-direction: column; gap: var(--space-3xs); padding: var(--space-sm) var(--space-md); border-top: var(--rule-hair) solid var(--color-rule); text-align: left; }
.starter .t { font-weight: 500; color: var(--color-ink); }
.starter .d { font-size: var(--text-sm); color: var(--color-muted); }

/* ─── thread ─── */
.thread-bar { position: sticky; top: calc(var(--sticky-offset) + var(--space-3xs) * 0); z-index: var(--z-sticky); display: flex; align-items: center; gap: var(--space-xs); min-height: 56px; padding: 0 var(--space-lg); background: var(--color-paper); border-bottom: var(--rule-hair) solid var(--color-rule-2); }
.thread-bar .title { flex: 1; min-width: 0; font-size: var(--text-sm); color: var(--color-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.incog { display: flex; align-items: center; justify-content: center; gap: var(--space-xs); min-height: 32px; background: var(--color-band); color: var(--color-band-ink); font-size: var(--text-sm); }
.thread { width: min(1180px, 100%); margin-inline: auto; padding: var(--space-xl) var(--space-lg) 200px; }
.entry { display: grid; grid-template-columns: minmax(0, 1fr) var(--rail-w); column-gap: var(--space-xl); padding-block: var(--space-xl); border-top: var(--rule-hair) solid var(--color-rule); scroll-margin-top: 72px; }
.entry:first-child { border-top: 0; padding-top: 0; }
.entry-main { min-width: 0; grid-column: 1; }
.rail { grid-column: 2; grid-row: 1 / span 2; }
.q { max-width: none; font-size: var(--text-q); line-height: 1.12; margin-bottom: var(--space-sm); word-break: keep-all; }
.q-meta { display: flex; flex-wrap: wrap; gap: var(--space-2xs) var(--space-md); margin-bottom: var(--space-md); font-size: var(--text-sm); color: var(--color-muted); }
.tabs { display: flex; gap: var(--space-2xs); margin-bottom: var(--space-lg); border-bottom: var(--rule-hair) solid var(--color-rule); overflow-x: auto; scrollbar-width: none; }
.tabs button { display: inline-flex; align-items: center; gap: var(--space-2xs); min-height: 40px; padding: 0 var(--space-sm); border-bottom: 2px solid transparent; margin-bottom: -1px; color: var(--color-muted); white-space: nowrap; font-size: var(--text-sm); }
.tabs button[aria-selected="true"] { color: var(--color-ink); border-bottom-color: var(--color-accent); font-weight: 500; }
.tabs .n { font-size: var(--text-xs); color: var(--color-muted); font-variant-numeric: tabular-nums; }

.progress { display: flex; flex-direction: column; gap: var(--space-xs); margin-bottom: var(--space-lg); }
.progress summary { display: flex; align-items: center; gap: var(--space-xs); min-height: var(--control); cursor: pointer; list-style: none; font-size: var(--text-sm); color: var(--color-ink-2); }
.progress summary::-webkit-details-marker { display: none; }
.progress summary .icon { color: var(--color-accent); }
.steps { list-style: none; margin: 0; padding: 0 0 0 var(--space-md); border-left: var(--rule-hair) solid var(--color-rule); display: flex; flex-direction: column; gap: var(--space-xs); font-size: var(--text-sm); color: var(--color-muted); }
.steps li.warn { color: var(--color-error); }
.qs { display: flex; flex-wrap: wrap; gap: var(--space-2xs); margin-top: var(--space-2xs); }
.qs span { padding: 0 var(--space-xs); border-radius: var(--radius-pill); background: var(--color-paper-2); color: var(--color-ink-2); font-size: var(--text-xs); line-height: 1.9; }
.spin { width: 16px; height: 16px; border: 2px solid var(--color-rule); border-top-color: var(--color-accent); border-radius: 50%; animation: spin 0.9s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.answer { max-width: var(--measure); font-size: var(--text-answer); line-height: 1.75; color: var(--color-ink-2); }
.answer > :first-child { margin-top: 0; }
.answer h1, .answer h2, .answer h3 { color: var(--color-ink); line-height: 1.3; margin: var(--space-xl) 0 var(--space-xs); max-width: none; }
.answer h1 { font-size: var(--text-2xl); } .answer h2 { font-size: var(--text-xl); } .answer h3 { font-size: var(--text-lg); }
.answer p, .answer ul, .answer ol, .answer table, .answer pre, .answer blockquote { margin: 0 0 var(--space-md); }
.answer ul, .answer ol { padding-left: var(--space-lg); }
.answer li { margin-bottom: var(--space-2xs); }
.answer strong { color: var(--color-ink); font-weight: 600; }
.answer a { color: var(--color-ink); }
.answer code { font: 0.9em var(--font-code); background: var(--color-paper-2); padding: 0 var(--space-2xs); border-radius: var(--radius-part); }
.answer pre { padding: var(--space-md); border-radius: var(--radius-part); background: var(--color-paper-2); overflow-x: auto; }
.answer pre code { background: none; padding: 0; }
.answer table { display: block; overflow-x: auto; border-collapse: collapse; font-size: var(--text-sm); max-width: 100%; }
.answer th, .answer td { padding: var(--space-xs) var(--space-sm); border-bottom: var(--rule-hair) solid var(--color-rule); text-align: left; vertical-align: top; font-variant-numeric: tabular-nums; }
.answer th { color: var(--color-ink); font-weight: 600; white-space: nowrap; }
.answer blockquote { padding: var(--space-sm) var(--space-md); border: var(--rule-hair) solid var(--color-rule); border-radius: var(--radius-part); color: var(--color-ink-2); }
.answer hr { border: 0; border-top: var(--rule-hair) solid var(--color-rule); }
.cite { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 var(--space-2xs); margin: 0 var(--space-3xs); border-radius: var(--radius-pill); background: var(--color-paper-3); color: var(--color-ink-2); font: 500 var(--text-xs)/1 var(--font-ui); font-variant-numeric: tabular-nums; vertical-align: 0.15em; text-decoration: none; cursor: pointer; }
.cite.lit { background: var(--color-accent); color: var(--color-accent-ink); }
.caret { display: inline-block; width: 8px; height: 1.1em; vertical-align: -0.2em; background: var(--color-accent); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.skeleton { display: flex; flex-direction: column; gap: var(--space-sm); max-width: var(--measure); }
.skeleton span { height: 14px; border-radius: var(--radius-pill); background: var(--color-paper-3); animation: pulse 1.4s var(--ease-in-out) infinite; }
.skeleton span:nth-child(3n) { width: 72%; } .skeleton span:nth-child(4n) { width: 88%; }
@keyframes pulse { 50% { opacity: 0.45; } }

/* the source rail: the signature */
.rail-inner { position: sticky; top: 72px; display: flex; flex-direction: column; max-height: calc(100dvh - 96px); }
.rail-head { display: flex; justify-content: space-between; align-items: baseline; padding-bottom: var(--space-xs); font-size: var(--text-sm); color: var(--color-muted); border-bottom: var(--rule-hair) solid var(--color-rule); }
.rail-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; }
.src { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: var(--space-xs); width: 100%; padding: var(--space-sm) var(--space-2xs); border-bottom: var(--rule-hair) solid var(--color-rule-2); text-align: left; border-radius: var(--radius-part); }
.src .num { font-size: var(--text-xs); color: var(--color-muted); font-variant-numeric: tabular-nums; padding-top: var(--space-3xs); }
.src .tt { font-size: var(--text-sm); font-weight: 500; color: var(--color-ink); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.src .dm { display: flex; align-items: center; gap: var(--space-2xs); margin-top: var(--space-3xs); font-size: var(--text-xs); color: var(--color-muted); }
.src .dm img { width: 14px; height: 14px; border-radius: var(--radius-part); }
.src.lit { background: var(--color-hl); }
.src .sn { margin-top: var(--space-2xs); font-size: var(--text-xs); color: var(--color-muted); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.rail-empty { padding: var(--space-md) 0; font-size: var(--text-sm); color: var(--color-muted); }
.tag { font-size: var(--text-xs); color: var(--color-muted); }
.tag.read { color: var(--color-accent); }

.media-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-xs); margin-bottom: var(--space-lg); max-width: var(--measure); }
.media-strip a { display: block; aspect-ratio: 4 / 3; border-radius: var(--radius-part); overflow: hidden; background: var(--color-paper-2); }
.media-strip img { width: 100%; height: 100%; object-fit: cover; }

.actions { display: flex; align-items: center; gap: var(--space-3xs); flex-wrap: wrap; margin-top: var(--space-md); }
.actions .gap { flex: 1; }
.act { display: inline-flex; align-items: center; gap: var(--space-2xs); min-height: 32px; padding: 0 var(--space-xs); border-radius: var(--radius-part); font-size: var(--text-sm); color: var(--color-muted); position: relative; }
.act::after { content: ""; position: absolute; inset: -6px 0; }
.related { margin-top: var(--space-xl); max-width: var(--measure); }
.related h2 { font-size: var(--text-lg); margin-bottom: var(--space-xs); }
.related button { display: flex; justify-content: space-between; align-items: center; gap: var(--space-md); width: 100%; min-height: 48px; padding: var(--space-xs) 0; border-top: var(--rule-hair) solid var(--color-rule); text-align: left; color: var(--color-ink-2); }
.related button .icon { color: var(--color-muted); }
.notice { display: flex; gap: var(--space-sm); align-items: flex-start; max-width: var(--measure); margin-top: var(--space-md); padding: var(--space-sm) var(--space-md); border: var(--rule-hair) solid var(--color-error); border-radius: var(--radius-part); color: var(--color-ink); font-size: var(--text-sm); }
.notice .icon { color: var(--color-error); }
.muted { color: var(--color-muted); font-size: var(--text-sm); }

.src-table { width: 100%; max-width: var(--measure); }
.src-table .src { grid-template-columns: 32px minmax(0, 1fr); padding: var(--space-md) var(--space-2xs); }
.img-grid { columns: 3 200px; column-gap: var(--space-xs); }
.img-grid a { display: block; margin-bottom: var(--space-xs); border-radius: var(--radius-part); overflow: hidden; background: var(--color-paper-2); break-inside: avoid; }
.vid-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: var(--space-md); }
.vid-grid a { text-decoration: none; font-size: var(--text-sm); color: var(--color-ink); }
.vid-grid img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius-part); background: var(--color-paper-2); margin-bottom: var(--space-xs); }
.council details { padding: var(--space-sm) 0; border-top: var(--rule-hair) solid var(--color-rule); }
.council summary { cursor: pointer; font-weight: 500; min-height: var(--control); display: flex; align-items: center; }

.followup { position: fixed; bottom: 0; left: var(--side-w); right: 0; z-index: var(--z-raised); padding: var(--space-lg) var(--space-lg) var(--space-md); background: linear-gradient(transparent, var(--color-paper) 32%); pointer-events: none; }
.followup > * { pointer-events: auto; width: calc(100% - var(--rail-w) - var(--space-xl)); max-width: calc(1180px - var(--rail-w) - var(--space-xl) - 2 * var(--space-lg)); margin-inline: auto; transform: translateX(calc((var(--rail-w) + var(--space-xl)) / -2)); }
body.side-collapsed .followup { left: 0; }

.hovercard { position: fixed; z-index: var(--z-tooltip); width: 320px; padding: var(--space-sm) var(--space-md); border: var(--rule-hair) solid var(--color-rule); border-radius: var(--radius-part); background: var(--color-paper); box-shadow: var(--shadow-pop); font-size: var(--text-sm); pointer-events: none; }
.hovercard .dm { font-size: var(--text-xs); color: var(--color-muted); }
.hovercard .tt { font-weight: 500; margin: var(--space-2xs) 0; }
.hovercard .sn { color: var(--color-muted); display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }

/* ─── pages ─── */
.page { width: min(980px, 100%); margin-inline: auto; padding: var(--space-xl) var(--space-lg) var(--space-3xl); }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--space-md); flex-wrap: wrap; margin-bottom: var(--space-lg); }
.page-head h1 { font-size: var(--text-3xl); max-width: none; }
.page-head p { color: var(--color-muted); margin-top: var(--space-2xs); font-size: var(--text-sm); }
.toolbar { display: flex; gap: var(--space-xs); flex-wrap: wrap; align-items: center; margin-bottom: var(--space-md); }
.search-field { flex: 1; min-width: 220px; display: flex; align-items: center; gap: var(--space-xs); min-height: var(--control-lg); padding: 0 var(--space-md); border: var(--rule-hair) solid var(--color-muted); border-radius: var(--radius-pill); background: var(--color-paper); color: var(--color-muted); }
.search-field input { flex: 1; border: 0; outline: 0; background: transparent; color: var(--color-ink); min-width: 0; }
.search-field:focus-within { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.row-list { display: flex; flex-direction: column; }
.row-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-md); align-items: start; padding: var(--space-md) 0; border-top: var(--rule-hair) solid var(--color-rule); text-decoration: none; }
.row-item .tt { font: 400 var(--text-lg)/1.3 var(--font-head); color: var(--color-ink); }
.row-item .pv { margin-top: var(--space-2xs); font-size: var(--text-sm); color: var(--color-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row-item .mt { margin-top: var(--space-2xs); display: flex; gap: var(--space-md); flex-wrap: wrap; font-size: var(--text-xs); color: var(--color-muted); }
.row-item .side-act { display: flex; gap: var(--space-3xs); }
.state { padding: var(--space-2xl) 0; text-align: center; color: var(--color-muted); }
.state h2 { margin: 0 auto var(--space-xs); color: var(--color-ink); font-size: var(--text-xl); }
.state p { margin: 0 auto var(--space-md); }
.state.error h2 { color: var(--color-error); }
.row-skel { padding: var(--space-md) 0; border-top: var(--rule-hair) solid var(--color-rule); }

.disc-tabs { display: flex; gap: var(--space-2xs); overflow-x: auto; scrollbar-width: none; padding-bottom: var(--space-2xs); margin-bottom: var(--space-lg); }
.disc { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 0 var(--space-xl); }
.disc-item { display: grid; gap: var(--space-2xs); width: 100%; padding: var(--space-md) 0; border-top: var(--rule-hair) solid var(--color-rule); text-align: left; }
.disc-item .tt { font: 400 var(--text-lg)/1.35 var(--font-head); color: var(--color-ink); }
.disc-item.lead .tt { font-size: var(--text-2xl); line-height: 1.2; }
.disc-item .mt { display: flex; gap: var(--space-md); font-size: var(--text-xs); color: var(--color-muted); }
.disc-item .mt a { color: var(--color-muted); }

.spaces { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: var(--space-md); }
.space-card { display: flex; flex-direction: column; gap: var(--space-2xs); min-height: 150px; padding: var(--space-md) var(--space-lg); border: var(--rule-hair) solid var(--color-rule); border-radius: var(--radius-card); background: var(--grad-part); box-shadow: var(--edge-light), var(--shadow-part); text-align: left; text-decoration: none; }
.space-card .mark { font: 400 var(--text-2xl)/1 var(--font-head); color: var(--color-accent); }
.space-card h2 { font-size: var(--text-lg); color: var(--color-ink); }
.space-card p { font-size: var(--text-sm); color: var(--color-muted); }
.space-card.new { align-items: center; justify-content: center; border-style: dashed; background: none; box-shadow: none; color: var(--color-muted); }

.form { width: min(720px, 100%); }
.section-title { font-size: var(--text-xl); margin: var(--space-xl) 0 var(--space-sm); }
.panel { padding: var(--space-md) var(--space-lg); border: var(--rule-hair) solid var(--color-rule); border-radius: var(--radius-card); background: var(--grad-part); box-shadow: var(--edge-light), var(--shadow-part); margin-bottom: var(--space-sm); }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: var(--space-sm); flex-wrap: wrap; }
.panel-head h3 { font-size: var(--text-lg); }
.status-ok { color: var(--color-success); font-size: var(--text-sm); }
.status-no { color: var(--color-muted); font-size: var(--text-sm); }
.field { display: flex; flex-direction: column; gap: var(--space-2xs); margin: var(--space-sm) 0; }
.field > span { font-size: var(--text-sm); font-weight: 500; color: var(--color-ink-2); }
.field small { font-size: var(--text-xs); color: var(--color-muted); min-height: 1lh; }
.field input, .field textarea, .field select { width: 100%; min-height: var(--control-lg); padding: var(--space-xs) var(--space-sm); border: var(--rule-hair) solid var(--color-muted); border-radius: var(--radius-part); background: var(--color-paper); color: var(--color-ink); font-size: var(--text-md); }
.field textarea { min-height: 96px; line-height: 1.5; }
.field input:focus-visible, .field textarea:focus-visible, .field select:focus-visible { outline: 2px solid var(--color-focus); outline-offset: -1px; }
.field input:disabled { opacity: 0.55; cursor: not-allowed; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--space-md); }
.check { display: flex; align-items: center; gap: var(--space-xs); min-height: var(--control-lg); }
.check input { width: 18px; height: 18px; accent-color: var(--color-accent); }
.auto-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-md); padding: var(--space-md) 0; border-top: var(--rule-hair) solid var(--color-rule); }
.auto-row h2 { font-size: var(--text-lg); display: flex; align-items: center; gap: var(--space-xs); }
.auto-row .q2 { margin-top: var(--space-2xs); color: var(--color-ink-2); font-size: var(--text-sm); }
.auto-row .mt { margin-top: var(--space-2xs); display: flex; gap: var(--space-md); flex-wrap: wrap; font-size: var(--text-xs); color: var(--color-muted); }
.pill-state { font-size: var(--text-xs); padding: 0 var(--space-xs); border-radius: var(--radius-pill); background: var(--color-paper-3); color: var(--color-muted); line-height: 1.8; font-family: var(--font-ui); letter-spacing: 0; }
.pill-state.on { background: var(--color-accent-soft); color: var(--color-ink); }

/* document view */
.doc { width: min(720px, 100%); margin-inline: auto; padding: var(--space-xl) var(--space-lg) var(--space-3xl); }
.doc-tools { display: flex; justify-content: space-between; gap: var(--space-xs); flex-wrap: wrap; margin-bottom: var(--space-xl); }
.doc-meta { font-size: var(--text-sm); color: var(--color-muted); }
.doc h1.title { max-width: none; font-size: clamp(2.2rem, 5vw, 3.2rem); line-height: 1.08; margin: var(--space-xs) 0 var(--space-lg); }
.doc .hero-img { width: 100%; aspect-ratio: 21 / 9; object-fit: cover; border-radius: var(--radius-card); margin-bottom: var(--space-xl); background: var(--color-paper-2); }
.doc section { margin-bottom: var(--space-2xl); }
.doc section > h2 { max-width: none; font-size: var(--text-2xl); padding-top: var(--space-sm); border-top: var(--rule-hair) solid var(--color-ink); margin-bottom: var(--space-md); }
.doc .refs { font-size: var(--text-sm); color: var(--color-muted); padding-left: var(--space-lg); }
.doc .refs li { margin-bottom: var(--space-2xs); overflow-wrap: anywhere; }

/* dialogs */
dialog { border: var(--rule-hair) solid var(--color-rule); border-radius: var(--radius-card); background: var(--color-paper); color: var(--color-ink); padding: 0; width: min(560px, calc(100% - 2 * var(--space-md))); box-shadow: var(--shadow-part); }
dialog::backdrop { background: var(--color-scrim); }
.dlg-body { padding: var(--space-lg); display: flex; flex-direction: column; gap: var(--space-sm); }
.dlg-body h2 { font-size: var(--text-xl); max-width: none; }
.dlg-body p { color: var(--color-muted); font-size: var(--text-sm); }
.dlg-actions { display: flex; justify-content: flex-end; gap: var(--space-xs); padding: var(--space-sm) var(--space-lg) var(--space-lg); }
#palette { width: min(640px, calc(100% - 2 * var(--space-md))); margin-top: 12dvh; }
.pal-field { display: flex; align-items: center; gap: var(--space-sm); padding: 0 var(--space-md); border-bottom: var(--rule-hair) solid var(--color-rule); color: var(--color-muted); }
.pal-field input { flex: 1; min-height: 56px; border: 0; outline: 0; background: transparent; color: var(--color-ink); font-size: var(--text-lg); }
#paletteList { max-height: 50dvh; overflow-y: auto; padding: var(--space-2xs); }
#paletteList a { display: flex; justify-content: space-between; gap: var(--space-md); padding: var(--space-xs) var(--space-sm); border-radius: var(--radius-part); text-decoration: none; font-size: var(--text-sm); }
#paletteList a[aria-selected="true"] { background: var(--color-paper-2); }
#paletteList .when { color: var(--color-muted); white-space: nowrap; }
#viewer { width: min(900px, calc(100% - 2 * var(--space-md))); }
.viewer-head { display: flex; justify-content: space-between; align-items: center; gap: var(--space-sm); padding: var(--space-xs) var(--space-xs) var(--space-xs) var(--space-md); border-bottom: var(--rule-hair) solid var(--color-rule); font-size: var(--text-sm); }
.viewer-head b { font-weight: 500; overflow-wrap: anywhere; }
#viewerBody { margin: 0; padding: var(--space-md) var(--space-lg); max-height: 72dvh; overflow: auto; white-space: pre-wrap; font: var(--text-sm)/1.65 var(--font-code); }
.toast { position: fixed; left: 50%; bottom: var(--space-lg); z-index: var(--z-toast); padding: var(--space-xs) var(--space-md); border-radius: var(--radius-pill); background: var(--color-ink); color: var(--color-paper); font-size: var(--text-sm); transform: translate(-50%, 0); opacity: 1; transition: opacity var(--dur-short) var(--ease-out), transform var(--dur-short) var(--ease-out); }
.toast[hidden] { display: block !important; opacity: 0; transform: translate(-50%, 12px); pointer-events: none; }

/* ─── states: hover, active, focus ─── */
@media (hover: hover) {
  .nav a:hover, .recent a:hover, .icon-btn:hover, .act:hover, .chip:hover, .opt:hover, .suggest button:hover, .src:hover, #paletteList a:hover { background: var(--color-paper-3); color: var(--color-ink); }
  .btn:hover { border-color: var(--color-muted); }
  .btn.primary:hover { filter: brightness(1.06); }
  .new-btn:hover { border-color: var(--color-muted); }
  .send:not(:disabled):hover { filter: brightness(1.08); }
  .cite:hover { background: var(--color-accent); color: var(--color-accent-ink); }
  .related button:hover, .disc-item:hover .tt, .row-item:hover .tt, .starter:hover .t { color: var(--color-accent); }
  .space-card:hover { border-color: var(--color-muted); }
  .tabs button:hover { color: var(--color-ink); }
  .seg button:hover { color: var(--color-ink); }
  .file-tag button:hover { color: var(--color-ink); background: var(--color-paper-2); }
}
.btn, .new-btn, .send, .chip, .act, .icon-btn, .seg button, .space-card { transition: transform var(--dur-micro) var(--ease-out), background-color var(--dur-micro) var(--ease-out), border-color var(--dur-micro) var(--ease-out), color var(--dur-micro) var(--ease-out); }
.btn:active, .new-btn:active, .send:active, .space-card:active { transform: translateY(1px); }
.chip:active, .act:active, .icon-btn:active, .opt:active, .seg button:active, .related button:active, .src:active { background: var(--color-paper-3); transform: translateY(1px); }
.btn:focus-visible, .chip:focus-visible, .act:focus-visible, .icon-btn:focus-visible, .seg button:focus-visible, .send:focus-visible, .opt:focus-visible, .tabs button:focus-visible, .src:focus-visible, .cite:focus-visible, .related button:focus-visible, .disc-item:focus-visible, .row-item:focus-visible, .space-card:focus-visible, .nav a:focus-visible, .recent a:focus-visible, .new-btn:focus-visible, .starter:focus-visible, .suggest button:focus-visible, .file-tag button:focus-visible, #paletteList a:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }

/* ─── responsive ─── */
@media (max-width: 75rem) {
  .entry { grid-template-columns: minmax(0, 1fr); }
  .rail { grid-column: 1; grid-row: auto; margin-top: var(--space-lg); max-width: var(--measure); }
  .rail-inner { position: static; max-height: none; }
  .followup > * { max-width: var(--measure); transform: none; width: 100%; }
}
@media (max-width: 60rem) {
  .shell { padding-left: 0; }
  .topbar { display: flex; }
  .side { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); box-shadow: var(--shadow-panel); transform: translateX(-104%); transition: transform var(--dur-short) var(--ease-out); z-index: var(--z-modal); }
  body.side-collapsed .side { display: flex; }
  body.side-open .side { transform: none; }
  body.side-open .scrim { display: block; position: fixed; inset: 0; z-index: calc(var(--z-modal) - 1); background: var(--color-scrim); }
  .followup { left: 0; padding: var(--space-sm) var(--space-sm) var(--space-sm); }
  .thread { padding: var(--space-lg) var(--space-md) 200px; }
  .thread-bar { padding: 0 var(--space-md); }
  body { --sticky-offset: 56px; }
  .home { padding: var(--space-xl) var(--space-md) var(--space-2xl); justify-content: flex-start; }
  .page, .doc { padding: var(--space-lg) var(--space-md) var(--space-2xl); }
  .disc, .grid2 { grid-template-columns: minmax(0, 1fr); }
  .q { font-size: var(--text-2xl); }
  .composer textarea { font-size: var(--text-md); }
  .hint-row { display: none; }
}
@media (max-width: 40rem) {
  .composer.compact .model-chip, .composer.compact .chip.outline { display: none; }
  .media-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .media-strip a:nth-child(3) { display: none; }
  .row-item { grid-template-columns: minmax(0, 1fr); }
  .seg button { padding: 0 var(--space-xs); }
}
@media (pointer: coarse) {
  .icon-btn, .chip, .act { min-height: var(--control-lg); }
  .icon-btn { width: var(--control-lg); }
}
@media (prefers-reduced-motion: reduce) {
  .spin, .caret, .skeleton span { animation: none; }
  .side { transition: none; }
  .btn:active, .new-btn:active, .send:active, .chip:active, .act:active, .icon-btn:active, .opt:active, .seg button:active, .related button:active, .src:active, .space-card:active { transform: none; }
}
@media print {
  .side, .topbar, .followup, .actions, .no-print, .thread-bar { display: none !important; }
  .shell { display: block; }
}
