/* ---------- Tokens ---------- */
:root {
  --bg: #f6f3ee;
  --bg-2: #efeae2;
  --surface: #fffdf9;
  --surface-2: #f8f5f0;
  --ink: #1c1917;
  --ink-2: #44403c;
  --muted: #78716c;
  --line: #e7e1d8;
  --line-2: #d6cec2;
  --accent: #c2410c;
  --accent-ink: #fff;
  --accent-soft: #fbe9df;
  --focus: #ea580c;
  --shadow-sm: 0 1px 2px rgba(28, 25, 23, 0.06);
  --shadow: 0 1px 2px rgba(28, 25, 23, 0.05), 0 8px 24px -12px rgba(28, 25, 23, 0.18);
  --shadow-lg: 0 24px 60px -20px rgba(28, 25, 23, 0.35);
  --tile: #ddd5c9;

  --left: #2563eb;
  --lean-left: #60a5fa;
  --center: #8b8b9a;
  --lean-right: #f87171;
  --right: #dc2626;
  --unknown: #c8c2b8;

  --radius: 16px;
  --radius-sm: 10px;
  --serif: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #12110f;
    --bg-2: #1a1816;
    --surface: #1c1a17;
    --surface-2: #23201c;
    --ink: #f5f1ea;
    --ink-2: #d6d0c6;
    --muted: #a39b8f;
    --line: #2e2a25;
    --line-2: #3d3832;
    --accent: #fb923c;
    --accent-ink: #1c1009;
    --accent-soft: #3a2416;
    --tile: #2b2722;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 30px -14px rgba(0, 0, 0, 0.7);
    --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, 0.8);
    color-scheme: dark;
  }
}

:root[data-theme='dark'] {
    --bg: #12110f;
    --bg-2: #1a1816;
    --surface: #1c1a17;
    --surface-2: #23201c;
    --ink: #f5f1ea;
    --ink-2: #d6d0c6;
    --muted: #a39b8f;
    --line: #2e2a25;
    --line-2: #3d3832;
    --accent: #fb923c;
    --accent-ink: #1c1009;
    --accent-soft: #3a2416;
    --tile: #2b2722;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 30px -14px rgba(0, 0, 0, 0.7);
    --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, 0.8);
    color-scheme: dark;
  }

/* Logo: light-ink version in dark mode */
.brand-logo.dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .brand-logo.light { display: none; }
  :root:not([data-theme='light']) .brand-logo.dark { display: block; }
}
:root[data-theme='dark'] .brand-logo.light { display: none; }
:root[data-theme='dark'] .brand-logo.dark { display: block; }

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; overflow-x: clip; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.serif { font-family: var(--serif); }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1320px; margin: 0 auto; padding: 12px 24px;
  display: flex; align-items: center; gap: 20px;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; flex: none; }
.brand-logo { height: 52px; width: auto; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; padding-left: 14px; border-left: 1px solid var(--line-2); }
.brand-tagline { font-size: 11px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-2); }
.brand-date { font-size: 12px; color: var(--muted); }
.search {
  flex: 1; max-width: 460px; margin-left: auto;
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 0 14px;
  box-shadow: var(--shadow-sm);
}
.search svg { color: var(--muted); width: 16px; height: 16px; }
.search input { border: 0; background: transparent; outline: 0; padding: 9px 0; width: 100%; }
.top-actions { display: flex; gap: 8px; align-items: center; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  padding: 8px 14px; border-radius: 999px; cursor: pointer; font-weight: 500; font-size: 14px;
  transition: background 0.15s, border-color 0.15s, transform 0.1s, box-shadow 0.15s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.primary:hover { background: color-mix(in srgb, var(--ink) 85%, var(--accent)); }
.btn.accent { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.accent:hover { filter: brightness(1.06); background: var(--accent); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--bg-2); border-color: var(--line); }
.btn.icon { padding: 8px; }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.danger:hover { color: #dc2626; border-color: #dc2626; }
.spin svg, svg.spin { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Layout ---------- */
.app { max-width: 1320px; margin: 0 auto; padding: 28px 24px 80px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 8px 0 18px; flex-wrap: wrap; }
.page-head h1 { font-family: var(--serif); font-weight: 600; font-size: clamp(30px, 4vw, 44px); letter-spacing: -0.02em; line-height: 1.05; margin: 0; }
.page-head .sub { color: var(--muted); margin-top: 6px; font-size: 14px; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 22px; }
.chip {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  padding: 5px 12px; border-radius: 999px; font-size: 13px; cursor: pointer; font-weight: 500;
}
.chip:hover { border-color: var(--line-2); }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip .n { color: var(--muted); margin-left: 4px; font-weight: 400; }
.chip.on .n { color: inherit; opacity: 0.7; }

/* ---------- Event grid & cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.card {
  position: relative; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; text-decoration: none; box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s;
  animation: rise 0.4s ease both;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--line-2); }
.card:hover .patch img { transform: scale(1.04); }
.card.featured { grid-column: span 2; }
.card.featured .card-title { font-size: 28px; }
.card.featured .patchwork { height: 260px; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.kicker { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); font-weight: 500; letter-spacing: 0.02em; }
.kicker .cat { color: var(--accent); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; font-size: 11px; }
.kicker .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--line-2); }
.card-title { font-family: var(--serif); font-weight: 600; font-size: 20px; line-height: 1.2; letter-spacing: -0.01em; margin: 0; text-wrap: balance; }
.card-summary { color: var(--ink-2); font-size: 14px; margin: 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-foot { margin-top: auto; padding-top: 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--muted); }
.badges { display: flex; gap: 6px; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; background: var(--bg-2); color: var(--ink-2); font-size: 12px; font-weight: 500; }
.badge svg { width: 13px; height: 13px; }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.pin-flag { position: absolute; top: 10px; right: 10px; z-index: 2; background: var(--surface); border-radius: 999px; padding: 4px 8px; font-size: 11px; font-weight: 600; box-shadow: var(--shadow-sm); }

/* ---------- Patchwork (headline-image mosaic) ---------- */
.patchwork {
  position: relative; display: grid; gap: 3px; height: 170px; background: var(--surface);
  grid-template-columns: repeat(6, 1fr); grid-template-rows: repeat(4, 1fr); padding: 3px 3px 0;
}
.patch { position: relative; overflow: hidden; background: var(--tile); border-radius: 8px; }
.patch img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.6s ease, opacity 0.4s; opacity: 0; }
.patch img.ok { opacity: 1; }
.patch .src { position: absolute; left: 6px; bottom: 6px; font-size: 10px; font-weight: 600; color: #fff; background: rgba(0, 0, 0, 0.45); padding: 1px 6px; border-radius: 4px; opacity: 0; transition: opacity 0.2s; backdrop-filter: blur(4px); }
.patchwork:hover .src { opacity: 1; }
/* Tile layouts by image count — quilt-like, uneven spans */
.pw-1 .patch:nth-child(1) { grid-area: 1 / 1 / 5 / 7; }
.pw-2 .patch:nth-child(1) { grid-area: 1 / 1 / 5 / 5; }
.pw-2 .patch:nth-child(2) { grid-area: 1 / 5 / 5 / 7; }
.pw-3 .patch:nth-child(1) { grid-area: 1 / 1 / 5 / 4; }
.pw-3 .patch:nth-child(2) { grid-area: 1 / 4 / 3 / 7; }
.pw-3 .patch:nth-child(3) { grid-area: 3 / 4 / 5 / 7; }
.pw-4 .patch:nth-child(1) { grid-area: 1 / 1 / 5 / 4; }
.pw-4 .patch:nth-child(2) { grid-area: 1 / 4 / 3 / 7; }
.pw-4 .patch:nth-child(3) { grid-area: 3 / 4 / 5 / 5; }
.pw-4 .patch:nth-child(4) { grid-area: 3 / 5 / 5 / 7; }
.pw-5 .patch:nth-child(1) { grid-area: 1 / 1 / 4 / 4; }
.pw-5 .patch:nth-child(2) { grid-area: 1 / 4 / 3 / 7; }
.pw-5 .patch:nth-child(3) { grid-area: 4 / 1 / 5 / 4; }
.pw-5 .patch:nth-child(4) { grid-area: 3 / 4 / 5 / 6; }
.pw-5 .patch:nth-child(5) { grid-area: 3 / 6 / 5 / 7; }
.pw-6 .patch:nth-child(1) { grid-area: 1 / 1 / 3 / 3; }
.pw-6 .patch:nth-child(2) { grid-area: 1 / 3 / 5 / 5; }
.pw-6 .patch:nth-child(3) { grid-area: 1 / 5 / 3 / 7; }
.pw-6 .patch:nth-child(4) { grid-area: 3 / 1 / 5 / 2; }
.pw-6 .patch:nth-child(5) { grid-area: 3 / 2 / 5 / 3; }
.pw-6 .patch:nth-child(6) { grid-area: 3 / 5 / 5 / 7; }
.pw-7 .patch:nth-child(1) { grid-area: 1 / 1 / 3 / 3; }
.pw-7 .patch:nth-child(2) { grid-area: 1 / 3 / 5 / 5; }
.pw-7 .patch:nth-child(3) { grid-area: 1 / 5 / 2 / 7; }
.pw-7 .patch:nth-child(4) { grid-area: 2 / 5 / 5 / 7; }
.pw-7 .patch:nth-child(5) { grid-area: 3 / 1 / 5 / 2; }
.pw-7 .patch:nth-child(6) { grid-area: 3 / 2 / 4 / 3; }
.pw-7 .patch:nth-child(7) { grid-area: 4 / 2 / 5 / 3; }
/* The empty state: a quiet typographic quilt */
.patchwork.empty { background: var(--surface); }
.patchwork.empty .patch { background: repeating-linear-gradient(135deg, var(--bg-2) 0 8px, var(--tile) 8px 9px); }
.patchwork.empty .patch:nth-child(2) { background: var(--accent-soft); }
.patch.initial { display: grid; place-items: center; font-family: var(--serif); font-size: 40px; font-weight: 700; color: var(--accent); background: var(--accent-soft) !important; }
.patch.fallback { display: grid; place-items: center; text-align: center; padding: 8px; font-family: var(--serif); font-size: 12px; line-height: 1.2; color: var(--ink-2); background: var(--bg-2); }

/* ---------- Lean spectrum ---------- */
.spectrum { display: flex; align-items: center; gap: 3px; }
.spectrum i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.lean-left-bg, .spectrum i.lean-left { background: var(--lean-left); }
.spectrum i.left { background: var(--left); }
.spectrum i.center { background: var(--center); }
.spectrum i.lean-right { background: var(--lean-right); }
.spectrum i.right { background: var(--right); }
.lean { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--muted); font-weight: 500; text-transform: capitalize; }
.lean::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--unknown); }
.lean.left::before { background: var(--left); }
.lean.lean-left::before { background: var(--lean-left); }
.lean.center::before { background: var(--center); }
.lean.lean-right::before { background: var(--lean-right); }
.lean.right::before { background: var(--right); }
.coverage { display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: var(--bg-2); gap: 2px; }
.coverage span { display: block; }
.coverage .left { background: var(--left); }
.coverage .lean-left { background: var(--lean-left); }
.coverage .center { background: var(--center); }
.coverage .lean-right { background: var(--lean-right); }
.coverage .right { background: var(--right); }
.coverage .unknown { background: var(--unknown); }
.coverage-legend { display: flex; flex-wrap: wrap; gap: 10px 14px; margin-top: 8px; }

/* ---------- Event page ---------- */
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500; margin-bottom: 14px; }
.back:hover { color: var(--ink); }
.hero { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; box-shadow: var(--shadow-sm); }
.hero .patchwork { height: clamp(130px, 17vw, 210px); }
.hero-text { padding: 18px 26px 20px; display: flex; flex-direction: column; gap: 10px; }
.hero-title { font-family: var(--serif); font-weight: 600; font-size: clamp(28px, 3.6vw, 42px); line-height: 1.08; letter-spacing: -0.02em; margin: 0; text-wrap: balance; outline: none; border-radius: 6px; }
.hero-title[contenteditable='true'] { box-shadow: 0 0 0 2px var(--accent-soft); padding: 0 4px; margin: 0 -4px; }
.hero-summary { font-size: 16.5px; color: var(--ink-2); margin: 0; max-width: 78ch; }
.hero-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 24px; margin-top: 24px; align-items: start; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tab { border: 0; background: none; padding: 10px 14px; cursor: pointer; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--ink); border-bottom-color: var(--accent); }
.tab .n { font-size: 12px; background: var(--bg-2); padding: 0 7px; border-radius: 999px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); }
.panel + .panel { margin-top: 16px; }
.panel h3 { font-family: var(--serif); font-size: 18px; font-weight: 600; margin: 0 0 12px; }
.section-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; font-weight: 600; color: var(--muted); margin: 0 0 10px; }

.article-list { display: flex; flex-direction: column; }
.article { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); align-items: start; }
.article:first-child { border-top: 0; padding-top: 0; }
.article .thumb { width: 96px; height: 68px; border-radius: 8px; overflow: hidden; background: var(--tile); }
.article .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.article .meta { display: flex; gap: 10px; align-items: center; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.article .meta b { color: var(--ink); font-weight: 600; }
.article h4 { margin: 3px 0 4px; font-size: 15.5px; line-height: 1.3; font-weight: 600; }
.article h4 a { text-decoration: none; }
.article h4 a:hover { text-decoration: underline; text-underline-offset: 3px; }
.article p { margin: 0; font-size: 13.5px; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.article .row-actions { display: flex; gap: 2px; opacity: 0.5; transition: opacity 0.15s; }
.article:hover .row-actions { opacity: 1; }
.inline-form { display: flex; gap: 8px; margin-top: 14px; }
.inline-form input { flex: 1; }

/* Inputs */
.input, textarea.input, select.input {
  width: 100%; border: 1px solid var(--line-2); background: var(--surface); border-radius: var(--radius-sm);
  padding: 9px 12px; outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.input { resize: vertical; min-height: 80px; line-height: 1.5; }
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
label.field .hint { font-weight: 400; color: var(--muted); font-size: 12px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.check input { margin-top: 3px; accent-color: var(--accent); }

/* Notes */
.notes { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.note { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--surface-2); position: relative; }
.note .note-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; color: var(--accent); }
.note .note-text { white-space: pre-wrap; margin: 2px 0 0; }
.note .note-link { display: flex; gap: 10px; margin-top: 8px; padding: 8px; background: var(--surface); border-radius: 8px; border: 1px solid var(--line); text-decoration: none; font-size: 13px; align-items: center; }
.note .note-link img { width: 48px; height: 36px; object-fit: cover; border-radius: 4px; }
.note .note-foot { font-size: 11.5px; color: var(--muted); margin-top: 6px; display: flex; justify-content: space-between; align-items: center; }
.note-form { display: grid; gap: 10px; }
.note-form .row { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; }

/* Deep dive */
.dive-start { display: grid; gap: 12px; }
.dive-start .row { display: flex; gap: 8px; }
.dive-start .row input { flex: 1; }
.report { margin-top: 18px; }
.report-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); margin-bottom: 10px; flex-wrap: wrap; }
.report-head .focus { color: var(--ink); font-weight: 500; }
.progress { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; font-size: 14px; }
.progress li { display: flex; gap: 10px; align-items: center; color: var(--muted); }
.progress li::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); flex: none; }
.progress li.done::before { background: var(--accent); }
.progress li.now { color: var(--ink); }
.progress li.now::before { background: var(--accent); animation: pulse 1.2s ease infinite; }
@keyframes pulse { 50% { opacity: 0.3; transform: scale(1.4); } }
.sources { display: grid; gap: 6px; margin-top: 8px; }
.source { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; text-decoration: none; font-size: 13.5px; border: 1px solid transparent; }
.source:hover, .source:target { background: var(--surface-2); border-color: var(--line); }
.source .num { font-weight: 600; font-size: 12px; color: var(--muted); text-align: center; background: var(--bg-2); border-radius: 6px; padding: 2px 0; }
.source .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source .tags { display: flex; gap: 6px; align-items: center; }
.tag-neutral { font-size: 10.5px; font-weight: 600; letter-spacing: 0.04em; color: #15803d; background: color-mix(in srgb, #22c55e 14%, transparent); padding: 1px 6px; border-radius: 4px; }
details.more { margin-top: 14px; }
details.more summary { cursor: pointer; font-size: 13px; color: var(--muted); font-weight: 500; }

/* Markdown prose */
.prose { font-size: 15px; line-height: 1.65; }
.prose h2 { font-family: var(--serif); font-size: 19px; font-weight: 600; margin: 22px 0 8px; letter-spacing: -0.01em; }
.prose h2:first-child, .prose h3:first-child { margin-top: 0; }
.prose h3 { font-size: 15.5px; margin: 16px 0 6px; }
.prose p { margin: 0 0 10px; }
.prose ul, .prose ol { margin: 0 0 12px; padding-left: 20px; }
.prose li { margin: 4px 0; }
.prose li::marker { color: var(--muted); }
.prose a.cite { text-decoration: none; font-size: 11px; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 0 5px; border-radius: 4px; margin: 0 1px; vertical-align: 1px; }
.prose code { font-size: 13px; background: var(--bg-2); padding: 1px 5px; border-radius: 4px; }
.prose blockquote { margin: 0 0 12px; padding-left: 12px; border-left: 3px solid var(--line-2); color: var(--ink-2); }

/* Chat */
.chat { position: sticky; top: 84px; display: flex; flex-direction: column; height: calc(100vh - 110px); min-height: 460px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.chat-head { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.chat-head h3 { margin: 0; font-family: var(--serif); font-size: 17px; font-weight: 600; }
.chat-head .sub { font-size: 12px; color: var(--muted); }
.chat-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 92%; font-size: 14px; }
.msg.user { align-self: flex-end; background: var(--ink); color: var(--bg); padding: 9px 13px; border-radius: 16px 16px 4px 16px; white-space: pre-wrap; }
.msg.assistant { align-self: flex-start; }
.msg.assistant .prose { font-size: 14px; }
.msg.assistant .prose p:last-child { margin-bottom: 0; }
.typing { display: inline-flex; gap: 4px; padding: 6px 0; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: 0.15s; }
.typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes blink { 50% { opacity: 0.2; } }
.suggestions { display: flex; flex-wrap: wrap; gap: 6px; }
.suggestions button { border: 1px solid var(--line); background: var(--surface-2); padding: 6px 10px; border-radius: 10px; font-size: 13px; cursor: pointer; text-align: left; }
.suggestions button:hover { border-color: var(--accent); color: var(--accent); }
.chat-empty { margin: auto 0; display: grid; gap: 12px; color: var(--muted); font-size: 14px; }
.chat-form { border-top: 1px solid var(--line); padding: 10px; display: flex; gap: 8px; align-items: flex-end; }
.chat-form textarea { flex: 1; resize: none; min-height: 42px; max-height: 160px; border-radius: 12px; }
.chat-disabled { padding: 14px 16px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); }

/* Modal */
.modal { border: 0; padding: 0; border-radius: 20px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); }
.modal::backdrop { background: rgba(20, 16, 12, 0.45); backdrop-filter: blur(3px); }
.modal-body { padding: 24px; display: grid; gap: 16px; }
.modal h2 { font-family: var(--serif); font-weight: 600; font-size: 24px; margin: 0; letter-spacing: -0.01em; }
.modal .lede { margin: -8px 0 0; color: var(--muted); font-size: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.feed-list { display: flex; flex-wrap: wrap; gap: 6px; }
.feed-list span { font-size: 12px; padding: 3px 8px; border-radius: 999px; background: var(--bg-2); display: inline-flex; gap: 6px; align-items: center; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; z-index: 50; box-shadow: var(--shadow-lg); max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Empty / loading states */
.empty-state { text-align: center; padding: 70px 20px; color: var(--muted); display: grid; gap: 12px; justify-items: center; }
.empty-state h2 { font-family: var(--serif); color: var(--ink); font-weight: 600; margin: 0; font-size: 26px; }
.skeleton { background: linear-gradient(90deg, var(--bg-2), var(--surface-2), var(--bg-2)); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.skel-card { height: 340px; border-radius: var(--radius); }
.status-line { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.status-line .live { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px color-mix(in srgb, #22c55e 20%, transparent); }
.status-line .live.busy { background: var(--accent); animation: pulse 1.2s infinite; }
.banner { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-radius: 12px; background: var(--accent-soft); color: var(--ink); font-size: 14px; margin-bottom: 18px; }

/* ---------- Responsive ---------- */
/* Grid/flex children must be allowed to shrink, or long content pushes the page sideways. */
.layout > *, .article > *, .source > *, .card-body, .hero-text { min-width: 0; }
.chat-head-tools { display: flex; gap: 6px; align-items: center; }
.mobile-only { display: none !important; }
h4, .card-title, .hero-title, .prose, .note-text { overflow-wrap: anywhere; }
.prose pre, .prose code { white-space: pre-wrap; word-break: break-word; }

@media (max-width: 1080px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 16px; margin-top: 16px; }
  /* Phone/tablet: summary (hero) → ask bar & deep dive → sources. Chat opens as a full-screen sheet. */
  .ask-bar { display: flex; order: -1; }
  .chat {
    position: fixed; inset: 0; z-index: 60; top: 0; height: 100vh; height: 100dvh; min-height: 0;
    border: 0; border-radius: 0; box-shadow: none;
    transform: translateY(100%); visibility: hidden;
    transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0s linear 0.28s;
  }
  .chat.open { transform: none; visibility: visible; transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1); }
  .chat-head { padding-top: max(12px, env(safe-area-inset-top)); }
  .chat-log { flex: 1; max-height: none; min-height: 0; padding: 14px 16px; overscroll-behavior: contain; }
  .chat-form { padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .chat-empty { margin: auto 0 0; }
  body.chat-open { overflow: hidden; }
  .chat-fab { display: grid; }
  .mobile-only { display: inline-flex !important; }
  .desktop-only { display: none !important; }
}
@media (max-width: 720px) {
  .topbar-inner { padding: 10px 16px; gap: 10px; flex-wrap: wrap; }
  .search { order: 3; max-width: none; flex-basis: 100%; }
  .top-actions { margin-left: auto; }
  .top-actions .label { display: none; }
  .btn.primary .label, .btn.ghost .label { display: none; }
  .btn { padding: 8px 10px; }
  .brand-text { display: none; }
  .brand-logo { height: 40px; }
  .app { padding: 18px 16px 60px; }
  .card.featured { grid-column: auto; }
  .card.featured .patchwork { height: 190px; }
  .card.featured .card-title { font-size: 22px; }
  .grid { grid-template-columns: 1fr; }
  .article { grid-template-columns: 72px minmax(0, 1fr); gap: 12px; }
  .panel { padding: 16px; }
  .hero-actions .btn { padding: 7px 12px; font-size: 13px; }
  .inline-form { flex-direction: column; }
  .dive-start .row { flex-direction: column; }
  .source { grid-template-columns: 24px minmax(0, 1fr); }
  .source .tags { grid-column: 2; }
  .chat-head { padding: 12px 14px; }
  .chat-head .sub { display: none; }
  .tab { padding: 10px 10px; }
  .article .thumb { width: 72px; height: 54px; }
  .article .row-actions { grid-column: 2; opacity: 1; }
  .hero-text { padding: 18px; }
  .note-form .row { grid-template-columns: 1fr; }
}

/* ---------- Coverage panel extras ---------- */
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-tools { display: flex; align-items: center; gap: 12px; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); font-size: 13.5px; margin-bottom: 14px; }
.notice svg { color: var(--muted); margin-top: 1px; width: 16px; height: 16px; }
.notice div + div { margin-top: 2px; }
.finding { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 12px; background: var(--accent-soft); font-size: 14px; margin-bottom: 14px; }
.finding .live { margin-top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse 1.2s infinite; flex: none; }
.finding .muted { font-size: 13px; margin-top: 2px; }
.empty-mini { display: grid; justify-items: center; gap: 6px; text-align: center; padding: 26px 12px 18px; }
.empty-mini .btn { margin-top: 8px; }
.empty-mini-art { display: grid; grid-template-columns: 22px 14px; grid-template-rows: 12px 12px; gap: 3px; margin-bottom: 6px; }
.empty-mini-art i { border-radius: 4px; background: var(--bg-2); border: 1px dashed var(--line-2); }
.empty-mini-art i:first-child { grid-row: span 2; background: var(--accent-soft); border-color: transparent; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .slider { width: 32px; height: 18px; border-radius: 999px; background: var(--line-2); position: relative; transition: background 0.2s; flex: none; }
.switch .slider::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform 0.2s; }
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::after { transform: translateX(14px); }
.switch input:focus-visible + .slider { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- Theme toggle (one button: system -> light -> dark) ---------- */
.theme-toggle .ti { display: none; }
.theme-toggle[data-mode='system'] .ti-system,
.theme-toggle[data-mode='light'] .ti-light,
.theme-toggle[data-mode='dark'] .ti-dark { display: block; }
.theme-toggle:not([data-mode]) .ti-system { display: block; }
@media (max-width: 720px) {
  .brand-logo { height: 34px; }
  .top-actions { gap: 2px; }
  .top-actions .btn { padding: 8px; }
}
@media (max-width: 720px) {
  .tab svg { display: none; }
  .tabs { gap: 0; }
  .tab { flex: 1; justify-content: center; padding: 10px 6px; font-size: 14px; }
}
@media (max-width: 1180px) and (min-width: 721px) {
  /* Give the search box room on mid-size screens. */
  .brand-text { display: none; }
  .top-actions .btn .label { display: none; }
  .top-actions .btn { padding: 8px 10px; }
}

@media (max-width: 720px) {
  /* iOS zooms into inputs smaller than 16px and leaves the page zoomed (looks "too wide"). */
  input, textarea, select, .input { font-size: 16px !important; }
}
@media (max-width: 380px) {
  .topbar-inner { padding: 10px 12px; gap: 8px; }
  .brand-logo { height: 28px; }
  .top-actions .btn { padding: 6px; }
}

/* ---------- Ask bar & floating chat button (narrow screens only) ---------- */
.ask-bar { display: none; gap: 8px; align-items: stretch; }
.ask-input {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; text-align: left; cursor: text;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 999px; padding: 10px 16px;
  color: var(--muted); font-size: 15px; box-shadow: var(--shadow-sm);
}
.ask-input span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ask-input:hover { border-color: var(--accent); }
.ask-bar .btn { flex: none; }
.chat-fab {
  display: none; place-items: center; position: fixed; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); z-index: 50;
  width: 54px; height: 54px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--ink); color: var(--bg); box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(12px) scale(0.9); pointer-events: none; transition: opacity 0.2s, transform 0.2s;
}
.chat-fab svg { width: 22px; height: 22px; }
.chat-fab.show { opacity: 1; transform: none; pointer-events: auto; }
body.chat-open .chat-fab { opacity: 0; pointer-events: none; }
@media (min-width: 1081px) { .chat-fab { display: none !important; } }
@media (max-width: 380px) { .ask-bar .btn { padding: 8px 12px; } .ask-input { padding: 10px 12px; } }
@media (max-width: 1080px) {
  .ask-bar { display: flex; }
  .chat-fab { display: grid; }
}

/* ---------- Deep dive: evidence option & source kinds ---------- */
.dive-form { display: grid; gap: 10px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; flex: none; }
.src-meta { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.small-note { font-size: 13px; margin: 10px 0 0; }
.kind { font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; white-space: nowrap; border: 1px solid currentColor; }
.kind.k-study, .kind.k-academic { color: #7c3aed; }
.kind.k-gov, .kind.k-official { color: #0f766e; }
.kind.k-factcheck { color: #b45309; }
.kind.k-research, .kind.k-reference { color: #475569; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .kind.k-study, :root:not([data-theme='light']) .kind.k-academic { color: #c4b5fd; }
  :root:not([data-theme='light']) .kind.k-gov, :root:not([data-theme='light']) .kind.k-official { color: #5eead4; }
  :root:not([data-theme='light']) .kind.k-factcheck { color: #fcd34d; }
  :root:not([data-theme='light']) .kind.k-research, :root:not([data-theme='light']) .kind.k-reference { color: #cbd5e1; }
}
:root[data-theme='dark'] .kind.k-study, :root[data-theme='dark'] .kind.k-academic { color: #c4b5fd; }
:root[data-theme='dark'] .kind.k-gov, :root[data-theme='dark'] .kind.k-official { color: #5eead4; }
:root[data-theme='dark'] .kind.k-factcheck { color: #fcd34d; }
:root[data-theme='dark'] .kind.k-research, :root[data-theme='dark'] .kind.k-reference { color: #cbd5e1; }

/* ---------- Chat: web search status & results ---------- */
.chat-status { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.chat-status span { min-width: 0; overflow-wrap: anywhere; }
.web-sources { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; font-size: 13px; }
.web-sources summary { cursor: pointer; color: var(--muted); display: flex; align-items: center; gap: 6px; list-style: none; }
.web-sources summary::-webkit-details-marker { display: none; }
.web-sources summary svg { width: 14px; height: 14px; }
.web-sources a { display: flex; gap: 8px; padding: 6px 0; color: inherit; text-decoration: none; overflow-wrap: anywhere; }
.web-sources a:hover b { text-decoration: underline; }
.web-sources .num { flex: none; font-size: 11px; font-weight: 700; color: var(--accent); min-width: 24px; padding-top: 2px; }

/* ---------- Reality check ---------- */
.verdict { font-size: 10.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; white-space: nowrap; margin-left: auto; color: var(--v); background: color-mix(in srgb, var(--v) 13%, transparent); }
.verdict.v-confirmed { --v: #15803d; }
.verdict.v-developing { --v: #2563eb; }
.verdict.v-disputed { --v: #c2410c; }
.verdict.v-unverified { --v: #a16207; }
.verdict.v-misleading { --v: #b91c1c; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .verdict.v-confirmed { --v: #4ade80; }
  :root:not([data-theme='light']) .verdict.v-developing { --v: #93c5fd; }
  :root:not([data-theme='light']) .verdict.v-disputed { --v: #fdba74; }
  :root:not([data-theme='light']) .verdict.v-unverified { --v: #fcd34d; }
  :root:not([data-theme='light']) .verdict.v-misleading { --v: #fca5a5; }
}
:root[data-theme='dark'] .verdict.v-confirmed { --v: #4ade80; }
:root[data-theme='dark'] .verdict.v-developing { --v: #93c5fd; }
:root[data-theme='dark'] .verdict.v-disputed { --v: #fdba74; }
:root[data-theme='dark'] .verdict.v-unverified { --v: #fcd34d; }
:root[data-theme='dark'] .verdict.v-misleading { --v: #fca5a5; }
.check { margin-top: 18px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg-2); display: grid; gap: 12px; min-width: 0; }
.check-empty { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 14px; }
.check-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.check-head .verdict { margin-left: 0; font-size: 11.5px; padding: 3px 10px; }
.check-label { font-size: 11.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.check-why { flex: 1; min-width: 180px; font-size: 14px; color: var(--ink-2); }
.check-plain { margin: 0; font-size: 15.5px; line-height: 1.55; }
.check-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px 24px; }
.check h4 { margin: 0 0 6px; font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.check h4.ok { color: #15803d; }
.check h4.warn { color: #b45309; }
.check ul { margin: 0; padding-left: 18px; font-size: 14px; color: var(--ink-2); display: grid; gap: 4px; }
.check-spin p { margin: 0 0 6px; font-size: 14px; color: var(--ink-2); }
.check-spin .side { display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; padding: 1px 8px; margin-right: 8px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--ink); }
.check-missing { margin: 0; font-size: 14px; color: var(--ink-2); }
.check-foot { font-size: 12px; color: var(--muted); }
.btn.busy { opacity: 0.6; pointer-events: none; }
@media (max-width: 720px) { .check { padding: 14px; } .check-why { flex-basis: 100%; } }
/* Collapsed by default: one line with the verdict; click to expand. */
details.check { margin-top: 4px; padding: 0; display: block; gap: 0; }
details.check > summary { list-style: none; cursor: pointer; padding: 10px 14px; flex-wrap: nowrap; border-radius: 14px; }
details.check > summary::-webkit-details-marker { display: none; }
details.check > summary:hover { background: color-mix(in srgb, var(--ink) 4%, transparent); }
details.check .check-label { flex: none; }
details.check:not([open]) .check-why { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1 1 0; }
.check-chev { flex: none; margin-left: auto; color: var(--muted); display: grid; place-items: center; transition: transform 0.2s; }
.check-chev svg { width: 16px; height: 16px; }
details.check[open] .check-chev { transform: rotate(180deg); }
details.check[open] > summary { flex-wrap: wrap; }
.check-body { display: grid; gap: 12px; padding: 4px 16px 14px; }
.check-plain { color: var(--ink); }
.check-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
@media (max-width: 720px) {
  details.check > summary { padding: 9px 12px; gap: 8px; }
  details.check .check-label { display: none; }
  details.check .check-why { flex-basis: 0; }
  .hero .patchwork { height: 120px; }
}
.hero .kicker { flex-wrap: wrap; row-gap: 2px; }
.hero .kicker > span:not(.dot) { white-space: nowrap; }

/* ---------- Assistant page ---------- */
body.on-assistant .app { padding-bottom: 0; }
body.on-assistant #assistantBtn { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.assist { max-width: 860px; margin: 0 auto; display: flex; flex-direction: column; height: calc(100vh - 130px); height: calc(100dvh - 130px); min-height: 380px; border-radius: var(--radius); }
.assist.dropping { outline: 2px dashed var(--accent); outline-offset: 6px; }
.assist-head { display: flex; align-items: center; justify-content: space-between; padding-bottom: 8px; }
.assist-log { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; padding: 8px 4px 20px; overscroll-behavior: contain; }
.assist-log .msg { font-size: 15.5px; max-width: 88%; }
.assist-log .msg.assistant { max-width: 100%; display: grid; gap: 10px; justify-items: start; }
.assist-log .msg.assistant .prose { font-size: 15.5px; }
.assist-empty { margin: auto 0; text-align: center; display: grid; gap: 10px; justify-items: center; padding: 20px 0; }
.assist-empty h2 { font-family: var(--serif); font-size: clamp(24px, 4vw, 34px); margin: 0; letter-spacing: -0.01em; }
.assist-empty p { margin: 0; max-width: 52ch; }
.assist-empty .suggestions { justify-content: center; margin-top: 8px; }
.assist-form { border: 1px solid var(--line-2); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-sm); padding: 8px; margin-bottom: 16px; }
.assist-form textarea { border: 0; background: transparent; box-shadow: none; outline: none; }
.assist-form:focus-within { border-color: var(--accent); }
.proposal { border: 1px solid var(--accent); background: var(--accent-soft); border-radius: 14px; padding: 12px 14px; display: grid; gap: 8px; width: min(100%, 520px); }
.proposal.done, .proposal.declined { border-color: var(--line); background: var(--bg-2); }
.proposal-kicker { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.proposal.declined .proposal-kicker, .proposal.done .proposal-kicker { color: var(--muted); }
.proposal-body { display: grid; gap: 3px; font-size: 14px; color: var(--ink-2); overflow-wrap: anywhere; }
.proposal-body b { font-size: 15.5px; color: var(--ink); }
.proposal-actions { display: flex; gap: 8px; flex-wrap: wrap; min-height: 30px; align-items: center; }
.proposal-state { font-size: 13px; color: var(--muted); }
.proposal-state.ok { color: #15803d; font-weight: 600; }
.proposal-state a { color: var(--accent); }
@media (max-width: 720px) {
  .assist { height: calc(100dvh - 150px); }
  .assist-log .msg { max-width: 94%; }
  .assist-form { margin-bottom: max(10px, env(safe-area-inset-bottom)); }
}
.assist-head .back { margin-bottom: 0; }
a.btn { text-decoration: none; }
.assist-form textarea, .assist-form textarea:focus { border: 0 !important; box-shadow: none !important; outline: none !important; background: transparent; }

/* ---------- Assistant: file attachments ---------- */
.assist-form { flex-wrap: wrap; }
.assist-attach { flex-basis: 100%; }
.assist-attach:empty { display: none; }
.file-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.file-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--ink); font-size: 12.5px; }
.file-chip svg { width: 13px; height: 13px; flex: none; }
.file-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 240px; }
.file-chip.loading { opacity: 0.55; animation: blink 1.2s infinite; }
.file-chip button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 16px; line-height: 1; padding: 0 0 0 2px; }
.msg.user .file-chip { background: color-mix(in srgb, var(--bg) 16%, transparent); border-color: color-mix(in srgb, var(--bg) 30%, transparent); color: inherit; }

/* ---------- Accounts ---------- */
body.signed-out .top-actions, body.signed-out .search, body.signed-out #search { display: none !important; }
.auth { min-height: calc(100vh - 220px); display: grid; place-items: center; padding: 16px 0; }
.auth-card { width: min(100%, 420px); background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-sm); padding: 28px; display: grid; gap: 14px; }
.auth-card h1 { font-family: var(--serif); font-size: 28px; margin: 0; letter-spacing: -0.01em; }
.auth-card p { margin: -8px 0 0; font-size: 14px; }
.auth-card form { display: grid; gap: 12px; }
.auth-card form .btn { justify-content: center; padding: 11px; margin-top: 4px; }
.auth-error { color: #dc2626; font-size: 13.5px; }
.auth-error:empty { display: none; }
.auth-links { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.auth-links button { border: 0; background: none; padding: 0; color: var(--accent); font-size: 13.5px; cursor: pointer; }
.auth-links button:hover { text-decoration: underline; }
.acct-box { display: grid; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; }
.acct-box .section-label { margin: 0; }
.user-list { display: grid; gap: 8px; }
.user-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px; min-width: 0; }
.user-row > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.user-tools { display: flex; gap: 6px; flex: none; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- Front page ---------- */
.flags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: -2px; }
.flag { font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; padding: 2px 7px; border-radius: 4px; white-space: nowrap; }
.flag.f-break { background: #dc2626; color: #fff; }
.flag.f-new { background: var(--accent-soft); color: var(--accent); }
.flag.f-devl { background: #fee2e2; color: #b91c1c; }
.breaking-items em { font-style: normal; font-weight: 700; color: #dc2626; }
.flag.f-dev { background: #fef3c7; color: #92400e; }
.flag.f-big { background: var(--bg-2); color: var(--ink-2); border: 1px solid var(--line); }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .flag.f-dev { background: #422006; color: #fcd34d; } }
:root[data-theme='dark'] .flag.f-dev { background: #422006; color: #fcd34d; }

.breaking { display: flex; align-items: stretch; margin-bottom: 20px; border: 1px solid #dc2626; border-radius: 12px; overflow: hidden; background: var(--surface); }
.breaking-label { flex: none; display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: #dc2626; color: #fff; font-weight: 800; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; }
.breaking-label i { width: 8px; height: 8px; border-radius: 50%; background: #fff; animation: pulse 1.2s infinite; }
.breaking-items { flex: 1; min-width: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.breaking-items a { display: grid; gap: 2px; padding: 9px 14px; color: var(--ink); text-decoration: none; border-left: 1px solid var(--line); min-width: 0; }
.breaking-items a:first-child { border-left: 0; }
.breaking-items a:hover b { color: #dc2626; }
.breaking-items b { font-family: var(--serif); font-size: 15px; font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.breaking-items span { font-size: 12px; color: var(--muted); }

.front-top { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 20px; align-items: start; margin-bottom: 8px; }
.front-lead .card.featured { grid-column: auto; }
.front-lead .card.featured .patchwork { height: 340px; }
.front-lead .card.featured .card-title { font-size: clamp(26px, 2.6vw, 34px); }
.latest { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 16px 16px 6px; }
.latest .section-label { display: flex; align-items: center; gap: 8px; color: var(--ink); }
.latest .live { width: 8px; height: 8px; border-radius: 50%; background: #dc2626; animation: pulse 1.6s infinite; }
.latest ol { list-style: none; margin: 0; padding: 0; }
.latest li + li { border-top: 1px solid var(--line); }
.latest a { display: grid; grid-template-columns: 62px minmax(0, 1fr); gap: 10px; padding: 10px 0; color: var(--ink); text-decoration: none; }
.latest time { font-size: 12px; font-weight: 600; color: var(--accent); padding-top: 2px; white-space: nowrap; }
.latest b { display: block; font-family: var(--serif); font-size: 15px; font-weight: 600; line-height: 1.25; }
.latest a:hover b { color: var(--accent); }
.latest small { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 3px; font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.front-h { font-family: var(--serif); font-size: 22px; font-weight: 600; letter-spacing: -0.01em; margin: 28px 0 14px; padding-top: 14px; border-top: 2px solid var(--ink); }
@media (max-width: 900px) {
  .front-top { grid-template-columns: minmax(0, 1fr); }
  .front-lead .card.featured .patchwork { height: 220px; }
  .latest ol li:nth-child(n + 6) { display: none; }
}
@media (max-width: 720px) {
  .breaking { flex-direction: column; }
  .breaking-label { padding: 7px 12px; }
  .breaking-items { grid-template-columns: minmax(0, 1fr); }
  .breaking-items a { border-left: 0; border-top: 1px solid var(--line); }
  .breaking-items a:first-child { border-top: 0; }
  .front-h { font-size: 19px; margin-top: 22px; }
}

/* ---------- Connect-the-dots boards ---------- */
body.on-boards #boardsBtn { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.cork {
  background-color: #b8875a;
  background-image:
    radial-gradient(ellipse at center, transparent 55%, rgba(70, 38, 12, 0.35)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .24 0 0 0 0 .13 0 0 0 0 .05 1.6 0 0 0 -.62'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.55' numOctaves='2' seed='7' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .93 0 0 0 0 .78 0 0 0 0 .58 1.5 0 0 0 -.7'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  border: 14px solid #6b4426;
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25), inset 0 6px 18px rgba(0, 0, 0, 0.35), var(--shadow);
  color: #1c1917;
}
/* Paper pinned to the board stays paper-coloured in dark mode. */
.boards-intro, .index-card, .board-legend {
  --bg: #f6f3ee; --bg-2: #efeae2; --surface: #fffdf9; --surface-2: #f6f1e7; --line: #e2dacb; --line-2: #cfc5b4; --ink: #1c1917; --ink-2: #44403c; --muted: #6f675e;
  --accent: #c2410c; --accent-soft: #fbe9df;
  color: var(--ink);
  color-scheme: light;
}

/* Boards list */
.boards-page { max-width: 1100px; margin: 0 auto; display: grid; gap: 18px; }
.boards-page .back { margin-bottom: 0; }
.boards-hero { padding: clamp(28px, 6vw, 56px) 16px; display: grid; place-items: center; }
.boards-intro { position: relative; background: #fbf9f3; width: min(100%, 640px); padding: 28px 26px 22px; display: grid; gap: 12px; transform: rotate(-0.8deg); box-shadow: 0 2px 3px rgba(0, 0, 0, 0.2), 0 18px 30px -12px rgba(0, 0, 0, 0.5); }
.boards-intro::before { content: ''; position: absolute; top: -12px; left: 50%; width: 110px; height: 26px; transform: translateX(-50%) rotate(2deg); background: rgba(255, 245, 210, 0.75); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15); }
.boards-intro h1 { font-family: 'Permanent Marker', var(--serif); font-weight: 400; font-size: clamp(28px, 5vw, 40px); margin: 0; color: #b3121b; letter-spacing: 0.01em; }
.boards-intro p { margin: 0; color: var(--ink-2); }
.boards-intro .suggestions button { color: var(--ink); }
.boards-form { display: flex; gap: 8px; flex-wrap: wrap; }
.boards-form .input { flex: 1 1 220px; }
.board-list { display: grid; gap: 8px; }
.board-row { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.board-row a { flex: 1; min-width: 0; display: grid; gap: 2px; color: var(--ink); text-decoration: none; }
.board-row a b { font-family: var(--serif); font-size: 17px; font-weight: 600; }
.board-row a span { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-row a:hover b { color: var(--accent); }

/* While it's being made */
.board-working { min-height: 440px; display: grid; place-items: center; padding: 40px 16px; }
.index-card {
  width: min(100%, 480px); padding: 22px 26px 24px; display: grid; gap: 10px; transform: rotate(-1deg);
  font-family: 'Special Elite', ui-monospace, monospace;
  background-color: #fdfcf7;
  background-image: linear-gradient(transparent 46px, #e57373 46px, #e57373 47px, transparent 47px), repeating-linear-gradient(transparent 0 27px, #c9dcf0 27px 28px);
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.2), 0 18px 30px -12px rgba(0, 0, 0, 0.55);
}
.index-head { font-family: 'Permanent Marker', var(--serif); font-size: 26px; color: #b3121b; line-height: 1.1; }
.index-topic { font-family: 'Caveat', cursive; font-weight: 700; font-size: 28px; line-height: 1.1; }
.index-card .progress li { color: #6b645b; font-size: 14px; }
.index-card .progress li.now { color: #111; }
.index-card .progress li::before { background: #c9bfae; }
.index-card .progress li.done::before, .index-card .progress li.now::before { background: #b3121b; }
.index-error { color: #b3121b; margin: 0; font-family: var(--sans); font-size: 14px; }
.index-card .btn { justify-self: start; }

/* The board */
.board-page { display: grid; gap: 12px; }
.board-page .back { margin-bottom: 0; }
.cork-scroll { overflow-x: auto; overscroll-behavior-x: contain; border-radius: 8px; }
.board { position: relative; box-sizing: content-box; }
.board-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(250px, 330px) 210px; gap: 24px; align-items: start; padding: 26px 26px 6px; }
.board-title { position: relative; justify-self: start; background: #f4efe3; padding: 16px 24px 18px; transform: rotate(-1.4deg); box-shadow: 0 2px 3px rgba(0, 0, 0, 0.25), 0 12px 20px -10px rgba(0, 0, 0, 0.5); display: grid; gap: 6px; max-width: 560px; }
.board-title::before, .board-title::after { content: ''; position: absolute; top: -10px; width: 64px; height: 22px; background: rgba(255, 246, 214, 0.7); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15); }
.board-title::before { left: -14px; transform: rotate(-24deg); }
.board-title::after { right: -14px; transform: rotate(20deg); }
.board-title span { font-family: 'Permanent Marker', var(--serif); font-size: 32px; line-height: 1.1; color: #141414; text-transform: uppercase; }
.board-title small { font-family: 'Special Elite', ui-monospace, monospace; font-size: 13px; color: #5c554c; }
.board-verdict { background: #ffe873; padding: 16px 18px 14px; transform: rotate(var(--r)); box-shadow: 0 2px 3px rgba(0, 0, 0, 0.2), 0 14px 22px -10px rgba(0, 0, 0, 0.5); display: grid; gap: 6px; }
.board-verdict b { font-family: 'Permanent Marker', var(--serif); font-weight: 400; font-size: 16px; text-transform: uppercase; color: #3a2e00; }
.board-verdict p { margin: 0; font-family: 'Caveat', cursive; font-size: 21px; line-height: 1.12; color: #1c1917; }
.meter { display: flex; align-items: center; gap: 6px; font-family: 'Special Elite', ui-monospace, monospace; font-size: 11px; color: #5b4b00; margin-top: 4px; }
.meter i { flex: 1; height: 9px; border: 1.5px solid #3a2e00; border-radius: 2px; overflow: hidden; }
.meter em { display: block; height: 100%; background: repeating-linear-gradient(-45deg, #c1121f 0 5px, #e0434e 5px 9px); }
.board-legend { background: #fdfcf7; padding: 12px 14px; transform: rotate(1.6deg); box-shadow: 0 2px 3px rgba(0, 0, 0, 0.2), 0 12px 20px -10px rgba(0, 0, 0, 0.5); font-family: 'Caveat', cursive; font-size: 18px; line-height: 1.25; display: grid; gap: 4px; }
.board-legend div { display: flex; align-items: center; gap: 8px; }
.board-legend svg { flex: none; overflow: visible; width: 34px; height: 8px; }
.board-legend path { fill: none; stroke-linecap: round; }

.board-area { position: relative; }
/* Undo the site-wide 18px icon sizing for the board's own SVGs. */
.board-strings { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; z-index: 2; stroke: none; }
.board-strings path { fill: none; stroke-linecap: round; transition: opacity 0.2s, stroke-width 0.2s; }
.board-strings .shadow { stroke: rgba(40, 15, 0, 0.3); stroke-width: 3; transform: translate(2px, 4px); }
.board-strings .sh-plausible { stroke-dasharray: 10 6; }
.board-strings .sh-stretch { display: none; }
.s-solid { stroke: #c1121f; stroke-width: 2.6; }
.s-plausible { stroke: #c1121f; stroke-width: 2.2; stroke-dasharray: 10 6; }
.s-stretch { stroke: #ffc2c6; stroke-width: 2.2; stroke-dasharray: 1 6; }
.board-area.focus .board-strings path:not(.lit) { opacity: 0.18; }
.board-strings path.lit { stroke-width: 3.6; }

.bcard {
  position: absolute; z-index: 1; transform: rotate(var(--r)); border: 0; margin: 0; padding: 0; font: inherit; color: #1c1917; text-align: left; cursor: pointer;
  display: flex; flex-direction: column;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 20px -8px rgba(30, 10, 0, 0.55);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
button.bcard:hover { transform: rotate(var(--r)) translateY(-3px); box-shadow: 0 2px 3px rgba(0, 0, 0, 0.3), 0 20px 30px -10px rgba(30, 10, 0, 0.6); }
.bcard:focus-visible { outline: 3px solid #ffd54a; outline-offset: 3px; }
.bcard.photo { background: #fbfaf5; padding: 12px 12px 0; }
.photo-img { position: relative; display: block; height: 160px; flex: none; background: #2a2622; overflow: hidden; }
.photo-img img { width: 100%; height: 100%; object-fit: cover; display: block; filter: saturate(0.85) contrast(1.05) sepia(0.12); }
.photo-img i { display: none; }
.photo-img.nophoto i { position: absolute; inset: 0; display: grid; place-items: center; padding: 10px; text-align: center; font-style: normal; font-family: 'Special Elite', ui-monospace, monospace; color: #cfc6b8; font-size: 14px; }
.photo-cap { margin-top: 8px; font-family: 'Caveat', cursive; font-weight: 700; font-size: 22px; line-height: 1.02; color: #1a1a1a; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.photo-meta { margin-top: auto; padding: 4px 0 9px; font-family: 'Special Elite', ui-monospace, monospace; font-size: 11px; color: #7a7268; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bcard.clip { background: #efe9da; padding: 16px 14px 12px; gap: 7px; border-radius: 1px 3px 2px 4px; }
.bcard.clip::after { content: ''; position: absolute; left: 0; right: 0; bottom: -7px; height: 8px; background: linear-gradient(135deg, #efe9da 33.3%, transparent 33.3%) 0 0 / 12px 8px, linear-gradient(225deg, #efe9da 33.3%, transparent 33.3%) 0 0 / 12px 8px; }
.clip-mast { font-family: 'Special Elite', ui-monospace, monospace; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: #3d3833; border-bottom: 3px double #3d3833; padding-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clip-head { font-family: var(--serif); font-weight: 700; font-size: 17px; line-height: 1.15; color: #161412; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.clip-cap { margin-top: auto; font-family: 'Caveat', cursive; font-weight: 700; font-size: 21px; line-height: 1.02; color: #b3121b; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bcard.note { cursor: default; background: linear-gradient(135deg, #ffe066 86%, #e3c445 86%); padding: 26px 14px 14px; display: grid; place-items: center; text-align: center; font-family: 'Permanent Marker', var(--serif); font-size: 18px; line-height: 1.15; color: #1c1917; }

.string-tag {
  position: absolute; z-index: 3; transform: translate(-50%, -50%) rotate(var(--r)); margin: 0; padding: 1px 9px 3px;
  border: 0; border-left: 4px solid #c1121f; background: #fbfaf4; color: #1c1917;
  font-family: 'Caveat', cursive; font-weight: 700; font-size: 19px; line-height: 1.1; white-space: nowrap; cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 10px -4px rgba(0, 0, 0, 0.45);
  transition: opacity 0.2s;
}
.string-tag.t-plausible { border-left-style: dashed; }
.string-tag.t-stretch { background: #f8ecec; color: #6f6863; border-left-color: #f09aa0; }
.string-tag:hover { transform: translate(-50%, -50%) rotate(var(--r)) scale(1.07); }
.string-tag:focus-visible { outline: 3px solid #ffd54a; outline-offset: 2px; }
.board-area.focus .string-tag { opacity: 0.55; }
.board-foot { font-size: 13px; margin: 0; }

/* Detail pop-ups */
.board-detail { display: grid; gap: 12px; }
.board-detail p { margin: 0; }
.board-detail .detail-img { width: 100%; max-height: 240px; object-fit: cover; border-radius: 12px; }
.board-detail .section-label { margin: 4px 0 0; }
.tie-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; font-size: 14px; }
.strength-chip { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.strength-chip.t-solid { background: #c1121f; color: #fff; }
.strength-chip.t-plausible { background: #fde2e2; color: #9b1c1c; }
.strength-chip.t-stretch { background: var(--bg-2); color: var(--muted); }

/* ---------- Boards: dig deeper, add evidence ---------- */
.board-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.job-status { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink-2); min-width: 0; }
.job-status:empty { display: none; }
.job-status.running { padding: 6px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--ink); }
.job-status.error { color: #dc2626; }
.board-count { margin-left: auto; font-size: 13px; }
.drop-panel { display: grid; gap: 10px; padding: 14px; margin-bottom: 12px; border: 1.5px dashed var(--line-2); border-radius: 14px; background: var(--surface); }
.drop-panel[hidden] { display: none; }
.drop-panel p { margin: 0; font-size: 13.5px; }
.drop-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.drop-row .file-chips { flex: 1 1 200px; margin: 0; }
.board-page.dropping .drop-panel, .board-page.dropping .cork-scroll { outline: 3px dashed var(--accent); outline-offset: 4px; }

/* Official records: a manila folder with a stamp */
.bcard.file { background: #e9d3a1; padding: 50px 14px 12px; gap: 7px; border-radius: 3px; }
.bcard.file::before { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(0deg, transparent 0 3px, rgba(120, 80, 20, 0.04) 3px 4px); pointer-events: none; }
.file-tab { position: absolute; top: -14px; left: 14px; max-width: 70%; padding: 3px 10px 2px; background: #e9d3a1; border-radius: 4px 4px 0 0; font-family: 'Special Elite', ui-monospace, monospace; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.05em; color: #5a4520; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-stamp { position: absolute; top: 30px; right: 10px; transform: rotate(4deg); padding: 1px 6px; border: 2px solid rgba(179, 18, 27, 0.75); border-radius: 3px; font-family: 'Special Elite', ui-monospace, monospace; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: rgba(179, 18, 27, 0.85); }
.bcard.file .clip-head { font-size: 15.5px; -webkit-line-clamp: 4; }

/* Word on the street: a printed-out forum post */
.bcard.post { background: #f7f7f4; padding: 0 0 10px; gap: 6px; border-radius: 2px; overflow: visible; }
.bcard.post::before { content: ''; position: absolute; top: -9px; left: 50%; width: 70px; height: 20px; transform: translateX(-50%) rotate(-3deg); background: rgba(255, 246, 214, 0.75); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15); }
.post-head { display: block; padding: 18px 96px 6px 12px; border-bottom: 1px solid #d9d6cf; background: #eceae4; font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 11px; color: #5d5952; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.post-head b { color: #c2410c; font-weight: 700; }
.post-title { padding: 0 12px; font-family: var(--sans); font-weight: 600; font-size: 14.5px; line-height: 1.25; color: #1c1917; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.post-stats { padding: 0 12px; font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 10.5px; color: #7a756d; }
.post-stamp { position: absolute; right: 8px; top: 14px; transform: rotate(-6deg); padding: 0 5px; border: 2px solid rgba(37, 99, 235, 0.7); border-radius: 3px; font-family: 'Special Elite', ui-monospace, monospace; font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(37, 99, 235, 0.85); background: rgba(247, 247, 244, 0.85); }
.bcard.post .clip-cap { margin-top: auto; padding: 0 12px; }
.strength-chip.t-record.k-chatter { background: #dbeafe; color: #1e40af; }

/* Your own tips: torn notebook paper */
.bcard.tip { background-color: #fdfdf8; background-image: linear-gradient(90deg, transparent 22px, #f0a5a5 22px, #f0a5a5 23px, transparent 23px), repeating-linear-gradient(transparent 0 23px, #cfe0f2 23px 24px); padding: 12px 12px 10px 30px; gap: 4px; }
.tip-head { font-family: 'Permanent Marker', var(--serif); font-size: 14px; color: #2a6fdb; text-transform: uppercase; }
.tip-text { font-family: 'Caveat', cursive; font-weight: 500; font-size: 19px; line-height: 24px; color: #1c1917; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.yours { position: absolute; bottom: -9px; right: 10px; padding: 1px 7px; background: #2a6fdb; color: #fff; font-family: 'Special Elite', ui-monospace, monospace; font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; transform: rotate(-3deg); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); }
.strength-chip.t-record { background: #e9d3a1; color: #5a4520; }

/* Case notes under the board */
.case-notes { display: grid; gap: 10px; margin-top: 8px; }
.case-notes .section-label { margin: 0; }
.case-entry { padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); display: grid; gap: 8px; font-size: 14.5px; }
.case-entry p { margin: 0; }
.case-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.case-head .muted { font-size: 12.5px; }
.findings { margin: 0; display: grid; gap: 6px; }
.findings dt { font-weight: 600; }
.findings dd { margin: 0 0 4px; color: var(--ink-2); }
.rejected { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.job-status .live { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse 1.2s infinite; flex: none; }

/* ---------- NIGHTJAR: green-screen secure channel ---------- */
.board-layout { display: grid; gap: 16px; align-items: start; }
.board-layout > #boardMount { min-width: 0; }
/* A single board uses the whole window width, not the news column. */
body.on-board .app { max-width: none; padding-left: clamp(16px, 2vw, 36px); padding-right: clamp(16px, 2vw, 36px); }
@media (min-width: 1240px) {
  .board-layout { grid-template-columns: minmax(0, 1fr) clamp(340px, 24vw, 440px); }
  .board-layout > .terminal { position: sticky; top: 92px; height: calc(100vh - 160px); height: calc(100dvh - 160px); }
  .term-fab, .t-close { display: none !important; }
}
/* Narrower screens: the terminal slides in from the right, opened by a floating button. */
.term-fab {
  position: fixed; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); z-index: 50;
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 10px; cursor: pointer;
  border: 1px solid #1f7a3c; background: #031509; color: #3dff73;
  font-family: 'VT323', ui-monospace, Consolas, monospace; font-size: 21px; letter-spacing: 0.06em; line-height: 1;
  text-shadow: 0 0 6px rgba(61, 255, 115, 0.6); box-shadow: 0 0 0 4px #0c100d, 0 12px 28px -8px rgba(0, 0, 0, 0.6), 0 0 22px rgba(61, 255, 115, 0.18);
  transition: opacity 0.2s, transform 0.2s;
}
.term-fab[hidden] { display: none; }
.term-fab i { width: 8px; height: 8px; border-radius: 50%; background: #1fa84a; }
.term-fab.unread i { background: #3dff73; box-shadow: 0 0 8px #3dff73; animation: t-blink 1s steps(1) infinite; }
.term-fab:focus-visible { outline: 3px solid #ffd54a; outline-offset: 3px; }
body.term-open .term-fab { opacity: 0; pointer-events: none; transform: translateY(10px); }
.t-close { border: 0; background: none; padding: 2px 4px; margin: -2px -4px -2px 0; color: var(--t-green); font: inherit; font-size: 19px; text-shadow: inherit; cursor: pointer; }
.t-close:hover { color: #fff; }
@media (max-width: 1239px) {
  .board-layout > .terminal {
    position: fixed; z-index: 60; top: var(--vv-top, 0px); right: 0; bottom: auto; width: min(100vw, 440px); height: var(--vv-h, 100dvh); min-height: 0;
    border-radius: 0; border-width: 0 0 0 1px; box-shadow: -20px 0 50px -10px rgba(0, 0, 0, 0.6), inset 0 0 70px rgba(61, 255, 115, 0.07);
    transform: translateX(105%); visibility: hidden;
    transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0s linear 0.28s;
  }
  .board-layout > .terminal.open { transform: none; visibility: visible; transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1); }
  .terminal .t-bar { padding-top: max(8px, env(safe-area-inset-top)); }
  .terminal .t-form { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .board-page { padding-bottom: 70px; }
}
@media (max-width: 720px) {
  .board-layout > .terminal { width: 100vw; border: 0; }
  body.term-open { overflow: hidden; }
}

/* Dragging cards */
@media (pointer: fine) { .bcard[data-node] { cursor: grab; } }
.bcard[data-node] { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; touch-action: manipulation; }
.bcard img { -webkit-user-drag: none; pointer-events: none; }
.bcard.dragging { z-index: 6; cursor: grabbing; transition: none; transform: rotate(var(--r)) scale(1.05); box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3), 0 30px 40px -12px rgba(30, 10, 0, 0.65); }
.board-area.dragging .string-tag { pointer-events: none; }
.board-area.dragging { cursor: grabbing; }

/* Phones: the board is laid out wider than the screen, then shrunk to fit (Zoom in to pan at full size). */
.phone-only { display: none !important; }
.area-scroll { overflow-x: auto; overscroll-behavior-x: contain; }
.board.phone .area-scroll { margin: 0 -2px; }
@media (max-width: 720px) {
  .phone-only { display: inline-flex !important; }
  .board-page .back { font-size: 14px; }
  .board-tools { gap: 6px; }
  .board-tools .btn { padding: 8px 12px; }
  .board-count { flex-basis: 100%; margin-left: 0; order: 9; }
  .board-top { grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 18px 14px 4px; }
  .board-title { padding: 12px 16px 14px; max-width: 100%; }
  .board-title span { font-size: 24px; }
  .board-verdict p { font-size: 19px; }
  .board-legend { justify-self: start; font-size: 17px; }
  .case-entry { padding: 12px; }
  .case-head { flex-wrap: wrap; }
}
.terminal[hidden] { display: none; }
.terminal {
  --t-green: #3dff73; --t-dim: #1fa84a; --t-faint: #135f2b; --t-bg: #020c05;
  position: relative; display: flex; flex-direction: column; min-height: 440px; height: 480px; overflow: hidden;
  border-radius: 14px; border: 1px solid #0f4220;
  background: radial-gradient(ellipse 120% 90% at 50% 40%, #06301a 0%, #031509 60%, #010703 100%);
  box-shadow: 0 0 0 5px #0c100d, 0 0 0 6px #1f2a22, 0 24px 50px -20px rgba(0, 0, 0, 0.7), inset 0 0 70px rgba(61, 255, 115, 0.07);
  color: var(--t-green); font-family: 'VT323', ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 19px; line-height: 1.22;
  text-shadow: 0 0 5px rgba(61, 255, 115, 0.55), 0 0 1px rgba(61, 255, 115, 0.9);
  color-scheme: dark;
}
/* Scanlines and a faint flicker, like an old CRT. */
.terminal::after { content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 2;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.28) 0 1px, transparent 1px 3px);
  animation: crt-flicker 6s infinite steps(1); }
.terminal::before { content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 2; border-radius: inherit;
  background: radial-gradient(ellipse at center, transparent 60%, rgba(0, 0, 0, 0.45) 100%); }
@keyframes crt-flicker { 0%, 100% { opacity: 1; } 47% { opacity: 0.85; } 48% { opacity: 1; } 73% { opacity: 0.93; } }

.t-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px dashed var(--t-faint); font-size: 16px; letter-spacing: 0.02em; color: var(--t-dim); flex: none; }
.t-dots { display: inline-flex; gap: 5px; }
.t-dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--t-faint); box-shadow: none; }
.t-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--t-green); }
.t-enc { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; }
.t-enc i { width: 7px; height: 7px; border-radius: 50%; background: var(--t-green); box-shadow: 0 0 8px var(--t-green); animation: t-blink 1.4s steps(1) infinite; }

.t-log { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 14px 8px; display: grid; gap: 7px; align-content: start; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--t-faint) transparent; }
.t-line { white-space: pre-wrap; overflow-wrap: anywhere; }
.t-user { color: #c8ffd8; }
.t-prompt { color: var(--t-dim); }
.t-who { color: #8dffad; }
.t-sys { color: var(--t-dim); }
.t-cursor { animation: t-blink 1s steps(1) infinite; }
@keyframes t-blink { 50% { opacity: 0; } }
.t-pin { border: 0; padding: 0; margin: 0; background: none; font: inherit; color: #b6ffca; text-shadow: inherit; text-decoration: underline dotted; text-underline-offset: 3px; cursor: pointer; }
.t-pin:hover { color: #fff; }
.t-tag { padding: 0 4px; border-radius: 2px; }
.t-solid { background: var(--t-green); color: var(--t-bg); text-shadow: none; }
.t-hunch { color: #ffd84a; text-shadow: 0 0 6px rgba(255, 216, 74, 0.6); outline: 1px solid rgba(255, 216, 74, 0.5); }
.t-tinfoil { color: #ff7a7a; text-shadow: 0 0 6px rgba(255, 122, 122, 0.6); outline: 1px dashed rgba(255, 122, 122, 0.55); }

.t-form { display: flex; align-items: center; gap: 8px; padding: 10px 14px 12px; border-top: 1px dashed var(--t-faint); flex: none; position: relative; z-index: 3; }
.t-form input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--t-green); font: inherit; text-shadow: inherit; caret-color: var(--t-green); padding: 0; }
.t-form input::placeholder { color: var(--t-faint); text-shadow: none; }
.t-form input:disabled { opacity: 0.5; }
.terminal:focus-within { border-color: #1f7a3c; }

/* Status strip, live ops, file drops, leads */
.t-status { display: flex; gap: 14px; flex-wrap: wrap; padding: 4px 14px; border-bottom: 1px dashed var(--t-faint); font-size: 15px; letter-spacing: 0.05em; color: var(--t-dim); flex: none; }
.t-status b { font-weight: 400; color: var(--t-green); }
.t-status b.t-hot { color: #ffd84a; text-shadow: 0 0 6px rgba(255, 216, 74, 0.6); animation: t-blink 1.2s steps(1) infinite; }
.t-dim { color: var(--t-dim); }
.t-ops { flex: none; max-height: 42%; overflow: hidden; margin: 0 10px 8px; padding: 8px 10px; border: 1px solid var(--t-dim); background: rgba(61, 255, 115, 0.05); font-size: 17px; line-height: 1.2; display: grid; gap: 3px; }
.t-ops[hidden] { display: none; }
.t-ops { grid-template-columns: minmax(0, 1fr); }
.t-ops-head { display: flex; align-items: center; gap: 8px; color: #ffd84a; text-shadow: 0 0 6px rgba(255, 216, 74, 0.5); }
.t-ops-head > span:nth-child(2) { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-elapsed { color: var(--t-dim); }
.t-spin::before { content: '|'; display: inline-block; width: 1ch; animation: t-spin 0.6s steps(1) infinite; }
@keyframes t-spin { 0% { content: '|'; } 25% { content: '/'; } 50% { content: '–'; } 75% { content: '\\'; } }
.t-op { color: var(--t-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-op.now { color: var(--t-green); }
.t-flavor { color: var(--t-faint); text-shadow: none; font-style: italic; color: #2c8a4a; }
.t-drop { border: 1px dashed var(--t-dim); padding: 6px 8px; display: grid; gap: 3px; background: rgba(61, 255, 115, 0.04); }
.t-drop-head { color: #ffd84a; text-shadow: 0 0 6px rgba(255, 216, 74, 0.5); }
.t-file { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: baseline; border: 0; padding: 1px 2px; margin: 0; background: none; font: inherit; color: #b6ffca; text-shadow: inherit; text-align: left; cursor: pointer; }
.t-file:hover, .t-file:focus-visible { background: rgba(61, 255, 115, 0.12); outline: none; }
.t-file-id { color: var(--t-green); }
.t-file-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-file-kind { font-size: 14px; color: var(--t-dim); text-transform: uppercase; }
.t-leads { display: grid; gap: 4px; justify-items: start; margin-top: 2px; }
.t-lead { border: 1px solid var(--t-faint); border-radius: 2px; padding: 1px 8px; background: rgba(61, 255, 115, 0.04); font: inherit; color: var(--t-green); text-shadow: inherit; text-align: left; cursor: pointer; }
.t-lead span { color: var(--t-dim); }
.t-lead:hover, .t-lead:focus-visible { background: var(--t-green); color: var(--t-bg); text-shadow: none; outline: none; }
.t-lead:hover span, .t-lead:focus-visible span { color: var(--t-bg); }

/* New pins thump onto the board; pins NIGHTJAR points at light up. */
.bcard.pop { animation: pin-pop 0.55s cubic-bezier(0.2, 1.4, 0.4, 1) both; animation-delay: var(--d, 0ms); }
@keyframes pin-pop { 0% { opacity: 0; transform: rotate(calc(var(--r) - 14deg)) scale(1.5) translateY(-30px); } 100% { opacity: 1; transform: rotate(var(--r)) scale(1); } }
.bcard.flash { animation: pin-flash 1.8s ease; }
@keyframes pin-flash { 0%, 100% { box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 20px -8px rgba(30, 10, 0, 0.55); } 15%, 60% { box-shadow: 0 0 0 4px #3dff73, 0 0 30px 6px rgba(61, 255, 115, 0.7); } }
@media (prefers-reduced-motion: reduce) {
  .terminal::after, .t-enc i, .t-cursor, .t-status b.t-hot, .t-spin::before { animation: none; }
  .bcard.pop { animation: none; }
}
