/* Pliny The LLM — dark, warm, Roman-red. */

:root {
  --bg: #0b0908;
  --bg-raised: #15110f;
  --surface: #1b1613;
  --surface-hi: #241d19;
  --line: rgba(255, 236, 216, 0.09);
  --line-hi: rgba(255, 236, 216, 0.16);
  --text: #f5ede3;
  --text-soft: #d8cdc0;
  --muted: #9d9186;
  --red: #ff2417;
  --red-hi: #ff4a3a;
  --red-deep: #b90f08;
  --red-wash: rgba(255, 36, 23, 0.14);
  --green: #3ddc84;
  --amber: #ffb547;
  --gold: #e9b85c;
  --gold-wash: rgba(233, 184, 92, 0.13);

  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", system-ui, sans-serif;
  --serif: "New York", ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --col: 780px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--red-hi); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- backdrop ---------- */
.backdrop { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.backdrop::after { /* film grain */
  content: ""; position: absolute; inset: 0; opacity: 0.05; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
.glow { position: absolute; border-radius: 50%; filter: blur(90px); transition: opacity 0.9s var(--ease), transform 1.2s var(--ease); }
.glow-a { width: 820px; height: 820px; left: 50%; top: -230px; margin-left: -410px; background: radial-gradient(circle, rgba(255, 36, 23, 0.34), transparent 68%); }
.glow-b { width: 900px; height: 500px; left: 50%; bottom: -320px; margin-left: -450px; background: radial-gradient(ellipse, rgba(185, 15, 8, 0.22), transparent 70%); }
body:has(.app[data-state="chat"]) .glow-a { opacity: 0.45; transform: translateY(-80px) scale(0.9); }

/* ---------- layout ---------- */
.app { position: relative; z-index: 1; height: 100dvh; display: flex; flex-direction: column; }

.topbar {
  flex: none; display: flex; align-items: center; justify-content: space-between;
  padding: 14px clamp(16px, 3vw, 28px);
  padding-top: max(14px, env(safe-area-inset-top));
}
.brand { display: flex; align-items: center; gap: 12px; border-radius: 12px; padding: 4px 8px 4px 4px; margin-left: -4px;
  opacity: 0; transform: translateY(-6px); pointer-events: none; transition: opacity 0.5s var(--ease), transform 0.5s var(--ease); }
.app[data-state="chat"] .brand { opacity: 1; transform: none; pointer-events: auto; }
.brand img { width: 40px; height: 40px; border-radius: 50%; display: block; box-shadow: 0 0 0 1px rgba(255,255,255,0.06), 0 4px 18px rgba(255, 36, 23, 0.35); }
.brand-name { font-family: var(--serif); font-weight: 700; font-size: 20px; letter-spacing: -0.01em; }
.brand-name em { font-style: italic; font-weight: 500; color: var(--red-hi); padding: 0 1px; }

.topbar-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }

.status {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 13px;
  border-radius: 999px; background: rgba(255,255,255,0.04); border: 1px solid var(--line);
  font-size: 13px; color: var(--text-soft); white-space: nowrap;
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.status[data-state="ready"] .status-dot { background: var(--green); box-shadow: 0 0 0 3px rgba(61, 220, 132, 0.18); }
.status[data-state="mock"] .status-dot { background: var(--amber); box-shadow: 0 0 0 3px rgba(255, 181, 71, 0.16); }
.status[data-state="loading"] .status-dot { background: var(--amber); animation: pulse 1.2s ease-in-out infinite; }
.status[data-state="error"] .status-dot { background: var(--red); box-shadow: 0 0 0 3px var(--red-wash); }

.btn-new {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px 0 11px; border-radius: 999px;
  background: rgba(255,255,255,0.05); border: 1px solid var(--line-hi); font-size: 13.5px; font-weight: 500;
  transition: background 0.2s, border-color 0.2s, transform 0.2s var(--ease);
}
.btn-new:hover { background: var(--red-wash); border-color: rgba(255, 74, 58, 0.5); }
.btn-new:active { transform: scale(0.97); }

/* ---------- scroll area ---------- */
.scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; scroll-behavior: auto; overscroll-behavior: contain; position: relative; }
.scroll::-webkit-scrollbar { width: 10px; }
.scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }

/* ---------- hero (empty state) ---------- */
.hero {
  min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 80px 20px 24px;
  transition: opacity 0.45s var(--ease), transform 0.45s var(--ease);
}
.app[data-state="chat"] .hero { display: none; }
.hero-logo { position: relative; width: min(300px, 62vw, 36vh); aspect-ratio: 1; animation: rise 0.9s var(--ease) backwards; }
.hero-logo img { width: 100%; height: 100%; display: block; border-radius: 50%; user-select: none;
  animation: breathe 5s ease-in-out infinite;
  box-shadow: 0 0 36px 2px rgba(255, 36, 23, 0.5), 0 0 64px 6px rgba(255, 36, 23, 0.22); }
.hero-tag { font-family: var(--serif); font-size: clamp(26px, 4.4vw, 38px); font-weight: 500; letter-spacing: -0.02em; margin: clamp(18px, 4vh, 30px) 0 8px; animation: rise 0.9s var(--ease) 0.12s backwards; }
.hero-sub { margin: 0; color: var(--muted); font-size: 15.5px; max-width: 46ch; animation: rise 0.9s var(--ease) 0.2s backwards; }

.chips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: clamp(18px, 4vh, 34px); width: min(680px, 100%); animation: rise 0.9s var(--ease) 0.3s backwards; }
.chip {
  text-align: left; padding: 14px 16px; border-radius: 14px; font-size: 14.5px; line-height: 1.4; color: var(--text-soft);
  background: linear-gradient(180deg, rgba(255,255,255,0.045), rgba(255,255,255,0.02)); border: 1px solid var(--line);
  transition: transform 0.25s var(--ease), border-color 0.2s, background 0.2s, color 0.2s;
}
.chip:hover { transform: translateY(-2px); border-color: rgba(255, 74, 58, 0.55); background: var(--red-wash); color: var(--text); }
.chip:active { transform: translateY(0) scale(0.99); }

/* ---------- thread ---------- */
.thread { width: min(var(--col), 100%); margin: 0 auto; padding: 8px clamp(16px, 3vw, 24px) 36px; display: flex; flex-direction: column; gap: 30px; }

.msg { display: flex; gap: 14px; animation: msg-in 0.45s var(--ease) both; }
.msg.user { justify-content: flex-end; }
.msg.user .bubble {
  max-width: min(84%, 620px); padding: 11px 17px; border-radius: 20px 20px 6px 20px; font-size: 16px; line-height: 1.55;
  background: linear-gradient(180deg, #ff3527, #d9160c); color: #fff; white-space: pre-wrap; overflow-wrap: anywhere;
  box-shadow: 0 8px 28px rgba(255, 36, 23, 0.22), inset 0 1px 0 rgba(255,255,255,0.22);
}

.msg.pliny .avatar { flex: none; width: 34px; height: 34px; border-radius: 50%; margin-top: 2px; box-shadow: 0 0 0 1px rgba(255,255,255,0.07), 0 3px 14px rgba(255, 36, 23, 0.3); }
.msg.pliny .body { min-width: 0; flex: 1; }
.msg.pliny .who { font-size: 12.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 5px 0 7px; }

.prose { font-family: var(--serif); font-size: 18.5px; line-height: 1.72; color: var(--text); overflow-wrap: anywhere; }
.prose > :first-child { margin-top: 0; }
.prose p { margin: 0 0 1.05em; }
.prose > :last-child { margin-bottom: 0; }
.prose strong { font-weight: 700; }
.prose em { font-style: italic; }
.prose ul, .prose ol { margin: 0 0 1.05em; padding-left: 1.4em; }
.prose li { margin: 0.25em 0; }
.prose li::marker { color: var(--red-hi); }
.prose h3, .prose h4 { font-size: 1.08em; margin: 1.3em 0 0.5em; letter-spacing: -0.01em; }
.prose code { font-family: var(--mono); font-size: 0.82em; padding: 2px 6px; border-radius: 6px; background: rgba(255,255,255,0.08); }
.prose pre { margin: 0 0 1.05em; padding: 14px 16px; border-radius: 12px; overflow-x: auto; background: var(--bg-raised); border: 1px solid var(--line); }
.prose pre code { background: none; padding: 0; font-size: 0.8em; line-height: 1.6; }
.prose blockquote { margin: 0 0 1.05em; padding-left: 16px; border-left: 3px solid var(--red-deep); color: var(--text-soft); }

.caret { display: inline-block; width: 0.55em; height: 1.05em; margin-left: 3px; vertical-align: -0.16em; border-radius: 2px; background: var(--red); box-shadow: 0 0 12px rgba(255, 36, 23, 0.75); animation: blink 1s steps(2, start) infinite; }

.waiting { display: inline-flex; align-items: center; gap: 10px; font-family: var(--serif); font-style: italic; font-size: 17px; color: var(--muted); padding-top: 2px; }
.waiting .txt { background: linear-gradient(90deg, var(--muted) 30%, var(--text) 50%, var(--muted) 70%); background-size: 250% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 2.2s linear infinite; }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--red-hi); animation: bounce 1.2s ease-in-out infinite; }
.dots i:nth-child(2) { animation-delay: 0.15s; } .dots i:nth-child(3) { animation-delay: 0.3s; }

.msg-foot { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; animation: fade-in 0.5s var(--ease) both; }
.msg-foot .stat b { color: var(--text-soft); font-weight: 600; }
.msg-foot .stat.hot b { color: var(--red-hi); }
.msg-foot .sep { width: 3px; height: 3px; border-radius: 50%; background: var(--line-hi); }
.icon-btn { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 9px; margin-left: 4px; border-radius: 8px; font-size: 12.5px; color: var(--muted); transition: background 0.2s, color 0.2s; }
.icon-btn:hover { background: rgba(255,255,255,0.07); color: var(--text); }

.error-box { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border-radius: 12px; font-family: var(--sans); font-size: 14.5px;
  color: #ffd2cd; background: var(--red-wash); border: 1px solid rgba(255, 74, 58, 0.35); }
.error-box button { padding: 5px 12px; border-radius: 8px; background: rgba(255,255,255,0.1); font-size: 13px; font-weight: 500; }
.error-box button:hover { background: rgba(255,255,255,0.18); }


/* ---------- RAG lab (settings popover) ---------- */
.lab-wrap { position: relative; }
.btn-lab {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px 0 11px; border-radius: 999px;
  background: rgba(255,255,255,0.05); border: 1px solid var(--line-hi); font-size: 13.5px; font-weight: 500;
  transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.2s var(--ease);
}
.btn-lab:hover, .btn-lab[aria-expanded="true"] { background: var(--gold-wash); border-color: rgba(233, 184, 92, 0.5); }
.btn-lab.active { border-color: rgba(233, 184, 92, 0.55); color: var(--gold); background: var(--gold-wash); }
.btn-lab:active { transform: scale(0.97); }
.lab-badge { white-space: nowrap; font-style: normal; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; padding: 2px 7px; margin-right: -4px; border-radius: 999px; color: #1a1207; background: var(--gold); }

.lab-panel {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 30; width: 360px; padding: 8px;
  border-radius: 18px; background: rgba(27, 22, 19, 0.96); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--line-hi); box-shadow: 0 24px 70px rgba(0,0,0,0.6), 0 0 0 1px rgba(0,0,0,0.3);
  animation: pop 0.22s var(--ease) both; transform-origin: top right;
}
.lab-panel[hidden] { display: none; }
.lab-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 12px 12px 12px 14px; border-radius: 12px; }
.lab-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.lab-text b { font-size: 14.5px; font-weight: 600; }
.lab-text span { font-size: 12.5px; line-height: 1.45; color: var(--muted); }
.switch { flex: none; position: relative; width: 44px; height: 26px; margin-top: 2px; border-radius: 999px; background: rgba(255,255,255,0.12); transition: background 0.25s; }
.switch i { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,0.4); transition: transform 0.25s var(--ease); }
.switch[aria-checked="true"] { background: var(--gold); }
.switch[aria-checked="true"] i { transform: translateX(18px); }
.switch:disabled { opacity: 0.4; cursor: not-allowed; }
.lab-opts { display: flex; flex-direction: column; gap: 6px; margin: 0 6px 6px; padding: 8px; border-radius: 12px; background: rgba(0,0,0,0.25); border: 1px solid var(--line); }
.opt-row { display: flex; align-items: flex-start; gap: 6px; }
.opt-row .opt { flex: 1; min-width: 0; }
.mini { flex: none; margin-top: 9px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.03em; color: var(--muted); border: 1px solid var(--line-hi); transition: background 0.2s, color 0.2s, border-color 0.2s; }
.mini:hover:not(:disabled) { border-color: rgba(233, 184, 92, 0.6); color: var(--gold); }
.mini[aria-checked="true"] { background: var(--gold); color: #1a1207; border-color: var(--gold); }
.mini:disabled { opacity: 0.35; cursor: not-allowed; }
.opt { display: flex; align-items: flex-start; gap: 12px; padding: 8px 8px; border-radius: 9px; cursor: pointer; }
.opt:hover { background: rgba(255,255,255,0.04); }
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.opt-box { flex: none; width: 18px; height: 18px; margin-top: 2px; border-radius: 6px; border: 1.5px solid var(--line-hi); display: grid; place-items: center; transition: background 0.2s, border-color 0.2s; }
.opt-box::after { content: ""; width: 9px; height: 5px; margin-top: -2px; border-left: 2px solid #1a1207; border-bottom: 2px solid #1a1207; transform: rotate(-45deg) scale(0); transition: transform 0.2s var(--ease); }
.opt input:checked + .opt-box { background: var(--gold); border-color: var(--gold); }
.opt input:checked + .opt-box::after { transform: rotate(-45deg) scale(1); }
.opt input:focus-visible + .opt-box { outline: 2px solid var(--red-hi); outline-offset: 2px; }
.opt input:disabled ~ .opt-text { opacity: 0.45; }
.opt input:disabled ~ .opt-box { opacity: 0.45; }
.opt-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.opt-text b { font-size: 13.5px; font-weight: 600; }
.opt-text em { font-style: normal; font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.opt-text small { font-size: 11.5px; color: var(--gold); opacity: 0.85; line-height: 1.4; }
.opt-text small:empty { display: none; }
.lab-foot { margin: 4px 14px 10px; font-size: 12px; line-height: 1.45; color: #786c62; }

/* search-memory slider */
.lab-sub { margin: 0 6px 6px; padding: 12px 14px 12px; border-radius: 12px; background: rgba(0,0,0,0.25); border: 1px solid var(--line); }
.mem-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.mem-head b { font-size: 13.5px; font-weight: 600; }
.mem-head output { font-size: 12.5px; font-weight: 600; color: var(--gold); }
#memRange { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; margin: 0; background: transparent; cursor: pointer; }
#memRange::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--gold) var(--fill, 25%), rgba(255,255,255,0.14) var(--fill, 25%)); }
#memRange::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -7px; border-radius: 50%; background: #fff; border: 3px solid var(--gold); box-shadow: 0 2px 8px rgba(0,0,0,0.5); }
#memRange::-moz-range-track { height: 4px; border-radius: 4px; background: rgba(255,255,255,0.14); }
#memRange::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--gold); }
#memRange::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 3px solid var(--gold); }
#memRange:focus-visible { outline: 2px solid var(--red-hi); outline-offset: 4px; border-radius: 6px; }
.mem-scale { display: flex; justify-content: space-between; margin-top: 2px; font-size: 11px; color: #786c62; }
.mem-check { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 12.5px; color: var(--text-soft); cursor: pointer; }
.mem-check input { position: absolute; opacity: 0; pointer-events: none; }
.mem-check input:checked + .opt-box { background: var(--gold); border-color: var(--gold); }
.mem-check input:checked + .opt-box::after { transform: rotate(-45deg) scale(1); }
.mem-check input:focus-visible + .opt-box { outline: 2px solid var(--red-hi); outline-offset: 2px; }
.mem-check .opt-box { margin-top: 0; }
.mem-check input:disabled ~ span { opacity: 0.4; }
.mem-hint { margin: 10px 0 0; font-size: 12px; line-height: 1.45; color: var(--muted); }

/* ---------- lane tags + sources ---------- */
.who { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.msg.pliny .who { margin: 5px 0 9px; }
.who-name { font-size: 12.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.tag { font-size: 11px; font-weight: 600; letter-spacing: 0.03em; padding: 2px 8px; border-radius: 999px; border: 1px solid transparent; white-space: nowrap; }
.tag-ft { color: #ff9a90; background: var(--red-wash); border-color: rgba(255, 74, 58, 0.3); }
.tag-base { color: #b9b1a8; background: rgba(255,255,255,0.07); border-color: var(--line-hi); }
.tag-rag { color: var(--gold); background: var(--gold-wash); border-color: rgba(233, 184, 92, 0.4); }
.tag-plain { color: var(--muted); border-color: var(--line); }

.src-slot:empty { display: none; }
.sources { margin: 0 0 14px; border-radius: 12px; background: var(--gold-wash); border: 1px solid rgba(233, 184, 92, 0.28); animation: fade-in 0.4s var(--ease) both; }
.sources > summary { display: flex; align-items: center; gap: 9px; padding: 9px 12px; cursor: pointer; list-style: none; font-size: 13px; color: var(--text-soft); user-select: none; }
.sources > summary::-webkit-details-marker { display: none; }
.sources > summary svg { flex: none; color: var(--gold); }
.sources > summary b { color: var(--gold); font-weight: 600; white-space: nowrap; }
.src-meta { color: var(--muted); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.src-cites { flex: 1; min-width: 0; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sources .chev { flex: none; margin-left: auto; color: var(--muted); transition: transform 0.25s var(--ease); }
.sources[open] .chev { transform: rotate(180deg); }
.src-list { list-style: none; margin: 0; padding: 2px 12px 12px; display: flex; flex-direction: column; gap: 10px; }
.src-list li { padding: 10px 12px; border-radius: 10px; background: rgba(0,0,0,0.28); border-left: 2px solid var(--gold); cursor: pointer; }
.src-cite { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: var(--gold); margin-bottom: 5px; }
.src-rank { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; font-size: 10.5px; color: #1a1207; background: var(--gold); }
.src-list p { margin: 0; font-family: var(--serif); font-size: 14px; line-height: 1.6; color: var(--text-soft); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.src-list li.open p { -webkit-line-clamp: unset; }
.src-query { margin: 0 12px 10px; padding: 8px 10px; border-radius: 8px; font-size: 12px; line-height: 1.5; color: var(--muted); background: rgba(0,0,0,0.22); }
.src-query b { color: var(--gold); font-weight: 600; }
.src-none { margin: 0 0 12px; font-size: 12.5px; color: var(--muted); font-style: italic; }

/* ---------- compare (side-by-side lanes) ---------- */
.msg.compare { display: block; align-self: center; width: min(1180px, calc(100vw - 2 * clamp(16px, 3vw, 28px))); }
.lanes { display: grid; grid-template-columns: repeat(var(--n, 2), minmax(0, 1fr)); gap: 16px; align-items: start; }
.lanes[style*="--n: 4"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.lane { min-width: 0; padding: 16px 18px 14px; border-radius: 20px; background: linear-gradient(180deg, rgba(255,255,255,0.045), rgba(255,255,255,0.015)); border: 1px solid var(--line); }
.lane.primary { border-color: rgba(255, 74, 58, 0.32); box-shadow: 0 0 0 1px rgba(255, 74, 58, 0.06), 0 12px 40px rgba(255, 36, 23, 0.07); }
.lane .who { margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.lane .prose { font-size: 17px; line-height: 1.68; }
.lane .waiting { font-size: 16px; }
.lane .src-cites { display: none; }
.lane .sources > summary { padding: 9px 11px; }
.lane .msg-foot { flex-wrap: wrap; }
.lane .skipped { margin: 0; font-size: 14px; font-style: italic; color: var(--muted); }
.lane .waiting.idle .txt { animation: none; background: none; color: var(--muted); }
.lane .waiting.idle .dots { display: none; }

.meter-lane { font-weight: 600; color: var(--text-soft); max-width: 16ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meter-lane:empty { display: none; }

@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(0.97); } to { opacity: 1; transform: none; } }

/* ---------- dock: meter + composer ---------- */
.dock { flex: none; position: relative; padding: 0 clamp(12px, 3vw, 24px); padding-bottom: max(14px, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent, var(--bg) 42%); }
.dock::before { content: ""; position: absolute; left: 0; right: 0; top: -34px; height: 34px; background: linear-gradient(180deg, transparent, var(--bg)); pointer-events: none; }
.dock-inner { width: min(var(--col), 100%); margin: 0 auto; position: relative; }

.meter {
  position: absolute; right: 4px; bottom: calc(100% + 10px); display: flex; align-items: center; gap: 10px;
  height: 34px; padding: 0 14px 0 12px; border-radius: 999px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums;
  background: rgba(21, 17, 15, 0.82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 74, 58, 0.35); box-shadow: 0 8px 30px rgba(0,0,0,0.45), 0 0 24px rgba(255, 36, 23, 0.12);
  opacity: 0; transform: translateY(8px) scale(0.98); pointer-events: none; transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}
.meter.on { opacity: 1; transform: none; }
.meter b { color: var(--text); font-weight: 650; }
.meter-tps b { color: var(--red-hi); font-size: 15px; display: inline-block; min-width: 3.2ch; text-align: right; }
.meter-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); box-shadow: 0 0 10px var(--red); animation: pulse 0.9s ease-in-out infinite; }
.meter-spark { width: 64px; height: 20px; overflow: visible; }
.meter-spark polyline { fill: none; stroke: var(--red-hi); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; filter: drop-shadow(0 0 4px rgba(255, 36, 23, 0.7)); }
.meter-sep { width: 1px; height: 14px; background: var(--line-hi); }

.composer {
  display: flex; align-items: flex-end; gap: 10px; padding: 9px 9px 9px 20px; border-radius: 26px;
  background: linear-gradient(180deg, var(--surface-hi), var(--surface)); border: 1px solid var(--line-hi);
  box-shadow: 0 14px 44px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.05);
  transition: border-color 0.25s, box-shadow 0.25s;
}
.composer:focus-within { border-color: rgba(255, 74, 58, 0.65); box-shadow: 0 14px 44px rgba(0,0,0,0.5), 0 0 0 4px var(--red-wash), 0 0 40px rgba(255, 36, 23, 0.14); }
#input {
  flex: 1; min-width: 0; resize: none; border: 0; outline: 0; background: transparent; padding: 9px 0; max-height: 200px;
  font-size: 16.5px; line-height: 1.5; color: var(--text);
}
#input::placeholder { color: #75695f; }
.send {
  flex: none; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; color: #fff;
  background: linear-gradient(180deg, #ff4131, #d9160c); box-shadow: 0 6px 20px rgba(255, 36, 23, 0.4), inset 0 1px 0 rgba(255,255,255,0.3);
  transition: transform 0.2s var(--ease), opacity 0.2s, box-shadow 0.2s, background 0.2s;
}
.send:hover:not(:disabled) { transform: translateY(-1px) scale(1.04); }
.send:active:not(:disabled) { transform: scale(0.94); }
.send:disabled { opacity: 0.35; cursor: default; box-shadow: none; background: var(--surface-hi); color: var(--muted); }
.send .icon-stop { display: none; }
.app[data-busy="true"] .send { background: linear-gradient(180deg, #3a2f2a, #2a211d); box-shadow: 0 0 0 1px rgba(255, 74, 58, 0.55), 0 0 22px rgba(255, 36, 23, 0.25); }
.app[data-busy="true"] .send:disabled { opacity: 1; cursor: pointer; color: var(--red-hi); }
.app[data-busy="true"] .icon-send { display: none; }
.app[data-busy="true"] .icon-stop { display: block; }

.fineprint { margin: 10px 0 0; text-align: center; font-size: 12px; color: #6e6359; }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%); z-index: 20; max-width: min(520px, 92vw); padding: 11px 18px; border-radius: 12px;
  font-size: 14px; background: var(--surface-hi); border: 1px solid rgba(255, 74, 58, 0.5); box-shadow: 0 12px 40px rgba(0,0,0,0.55); animation: msg-in 0.35s var(--ease) both; }

/* ---------- motion ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes breathe { 0%, 100% { box-shadow: 0 0 36px 2px rgba(255, 36, 23, 0.42), 0 0 64px 6px rgba(255, 36, 23, 0.16); } 50% { box-shadow: 0 0 44px 6px rgba(255, 36, 23, 0.6), 0 0 76px 10px rgba(255, 36, 23, 0.26); } }
@keyframes msg-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes blink { to { visibility: hidden; } }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.45; transform: scale(0.8); } }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: 0.5; } 30% { transform: translateY(-4px); opacity: 1; } }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .lanes { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .btn-lab span { display: none; }
  .btn-lab { padding: 0 11px; }
  .lab-wrap { position: static; }
  .lab-panel { position: fixed; left: 12px; right: 12px; top: 62px; width: auto; }
  .src-cites { display: none; }
  .chips { grid-template-columns: 1fr; margin-top: 26px; }
  .brand-name { display: none; }
  .topbar-right { gap: 8px; }
  .status span { display: none; }
  .status { padding: 0 11px; }
  .btn-new span { display: none; }
  .btn-new { padding: 0 11px; }
  .prose { font-size: 17.5px; }
  .msg.pliny .avatar { width: 28px; height: 28px; }
  .msg { gap: 10px; }
  .meter { right: 0; gap: 8px; padding: 0 11px; }
  .meter-spark, .meter-sep:nth-of-type(2), .meter-stat:last-child { display: none; }
  .fineprint { font-size: 11px; }
}
@media (max-height: 640px) { .hero-logo { width: 180px; } .hero-tag { margin-top: 18px; } .chips { margin-top: 18px; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
