:root {
  --bg: #17181a; --panel: #1f2124; --line: #2d3035; --paper: #ecebe8; --muted: #9a9b9e; --amber: #f2a33a; --coral: #e8715a;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: light) {
  :root { --bg: #f6f5f2; --panel: #ffffff; --line: #dcdad4; --paper: #1d1e20; --muted: #62646a; --amber: #b86a00; --coral: #b3412c; }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--paper); font: 16px/1.5 var(--font); }
body { display: grid; grid-template-rows: auto 1fr auto; }
.top { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.brand { font-weight: 650; letter-spacing: 0.01em; display: flex; align-items: center; gap: 8px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--amber); display: inline-block; }
.meter { margin-left: auto; font-size: 13px; color: var(--muted); }
.meter b { color: var(--paper); font-weight: 600; }
.meter .saving { color: var(--amber); }
.meter .out { color: var(--coral); }
.col { overflow-y: auto; padding: 18px 16px 8px; max-width: 760px; width: 100%; margin: 0 auto; }
.empty h1 { font-size: 28px; margin: 40px 0 6px; letter-spacing: -0.01em; }
.empty p { color: var(--muted); margin: 0; max-width: 46ch; }
.you { background: var(--panel); border: 1px solid var(--line); border-radius: 14px 14px 4px 14px; padding: 10px 14px; margin: 14px 0 6px auto; width: fit-content; max-width: 88%; white-space: pre-wrap; }
.bot { border: 1px solid var(--line); border-radius: 14px 14px 14px 4px; background: var(--panel); padding: 12px 14px; margin: 6px 0 14px; max-width: 94%; }
.bot p { margin: 0 0 8px; white-space: pre-wrap; }
.bot .where { font-size: 12px; color: var(--muted); margin-top: 6px; display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); border-radius: 999px; padding: 0 9px; font-size: 12px; color: var(--muted); }
.chip.amber { border-color: var(--amber); color: var(--paper); }
.sources { margin: 8px 0 0; padding: 0; list-style: none; font-size: 13px; }
.sources li { margin: 3px 0; color: var(--muted); }
.sources a { color: var(--paper); text-decoration-color: var(--amber); text-underline-offset: 3px; }
.notes { margin: 8px 0 0; padding: 8px 10px; border-left: 3px solid var(--amber); font-size: 13px; color: var(--muted); }
.busy { border-left-color: var(--coral); }
.thinking { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; margin: 8px 0 14px; }
/* The model runs on the same GPU that draws the screen. A 60 fps animation on top of that makes the page stutter while
   it generates, so the indicators move in a few steps a second: still clearly "working", and cheap to draw. */
.orbit { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--amber); animation: spin 1.2s steps(8) infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .orbit { animation: none; border-top-color: var(--amber); } }
.pulse { animation: pulse 2s steps(2, jump-none) infinite; }
@keyframes pulse { 50% { opacity: 0.45; } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }
.composer { max-width: 760px; width: 100%; margin: 0 auto; padding: 8px 16px 14px; }
.live { font-size: 13px; color: var(--muted); padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; }
.row { display: flex; gap: 8px; align-items: flex-end; }
textarea { flex: 1; resize: none; background: var(--panel); color: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font: inherit; max-height: 180px; }
textarea:focus-visible, button:focus-visible, input:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
button { font: inherit; cursor: pointer; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--paper); padding: 9px 14px; }
button.primary { background: var(--amber); border-color: var(--amber); color: #1a1100; font-weight: 600; }
button.ghost { background: transparent; }
button:disabled { opacity: 0.5; cursor: default; }
.fine { font-size: 12px; color: var(--muted); margin: 8px 0 0; }
.panel { max-height: calc(100vh - 64px); overflow-y: auto; position: fixed; top: 52px; right: 12px; z-index: 5; background: var(--panel); color: var(--paper); border: 1px solid var(--line); border-radius: 14px; max-width: 460px; width: calc(100% - 24px); padding: 4px 16px 14px; box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35); }
.panel[hidden] { display: none; }
.settings label { display: block; margin: 10px 0; font-size: 14px; }
.settings input { width: 100%; margin-top: 4px; background: var(--bg); color: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font: inherit; }
.settings fieldset { border: 1px solid var(--line); border-radius: 10px; margin: 12px 0; }
.actions { display: flex; gap: 8px; justify-content: space-between; margin-top: 12px; }
