:root {
  --bg: #f4f5f3; --panel: #ffffff; --line: #d6d9d4; --text: #141814; --muted: #5b6259;
  --accent: #0f6b45; --accent-soft: #e2f0e8; --mine: #eef6f1; --error: #a32b20; --radius: 6px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #111412; --panel: #191d1a; --line: #2c322e; --text: #e8ece7; --muted: #9aa49b; --accent: #6fd3a0; --accent-soft: #1d3127; --mine: #17251d; --error: #f08a7e; }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
[hidden] { display: none !important; }
h1 { font-size: 22px; margin: 4px 0 8px; }
.eyebrow, .brand, .label { font: 600 11px/1 ui-monospace, Menlo, monospace; letter-spacing: .12em; color: var(--muted); text-transform: uppercase; }
.label { margin: 16px 0 8px; }
.muted { color: var(--muted); }
.center { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; width: min(460px, 100%); }
.card.wide { width: min(760px, 100%); }
label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
input, textarea, select { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; }
input:focus, textarea:focus, select:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
button { font: 600 14px/1 system-ui, sans-serif; border-radius: var(--radius); border: 1px solid var(--accent); background: var(--accent); color: var(--panel); padding: 10px 16px; cursor: pointer; }
button.quiet { background: transparent; color: var(--muted); border-color: var(--line); }
button:disabled { opacity: .5; cursor: default; }
.actions { display: flex; gap: 8px; margin-top: 16px; }
.error { color: var(--error); min-height: 1.2em; margin: 12px 0 0; font-size: 14px; }
.cyborgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.tile { display: grid; grid-template-columns: 44px 1fr; gap: 8px; align-items: center; text-align: left; padding: 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); color: var(--text); font-weight: 400; }
.tile strong { display: block; font-size: 14px; }
.tile small { display: block; color: var(--muted); font-size: 11px; line-height: 1.3; }
.tile[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.tile img, .avatar { width: 44px; height: 44px; border-radius: 4px; object-fit: cover; }
.avatar.initial { display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.custom { display: grid; gap: 10px; margin-top: 12px; }
.model { margin-top: 12px; max-width: 260px; }
.chat { height: 100%; display: grid; grid-template-rows: auto 1fr; }
.bar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--panel); }
.chip { font: 600 13px/1 ui-monospace, Menlo, monospace; padding: 5px 8px; border-radius: 4px; background: var(--accent-soft); color: var(--accent); }
.spacer { flex: 1; }
.body { min-height: 0; display: grid; grid-template-columns: 1fr 240px; }
.stream { min-height: 0; display: grid; grid-template-rows: 1fr auto auto; }
.messages { list-style: none; margin: 0; padding: 16px; overflow-y: auto; display: grid; gap: 10px; align-content: start; }
.msg { display: grid; grid-template-columns: 44px 1fr; gap: 10px; max-width: 820px; }
.msg .who { font-size: 13px; color: var(--muted); }
.msg .who strong { color: var(--text); }
.msg .text { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.mine .bubble { background: var(--mine); }
.bubble { padding: 6px 10px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); }
.mention { color: var(--accent); font-weight: 600; }
.msg img.shot { display: block; max-width: min(420px, 100%); margin-top: 6px; border-radius: 4px; border: 1px solid var(--line); cursor: zoom-in; }
.system { text-align: center; font-size: 12px; color: var(--muted); }
.thinking { margin: 0; padding: 0 16px 6px; min-height: 1.4em; font-size: 13px; color: var(--muted); }
.composer { display: flex; gap: 8px; padding: 10px 16px 16px; border-top: 1px solid var(--line); background: var(--panel); }
.composer textarea { flex: 1; resize: none; max-height: 160px; }
.people { border-left: 1px solid var(--line); padding: 4px 16px; overflow-y: auto; background: var(--panel); }
.people ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.people li { display: grid; grid-template-columns: 32px 1fr; gap: 8px; align-items: center; font-size: 13px; }
.people li .avatar { width: 32px; height: 32px; }
.people small { display: block; color: var(--muted); }
body.watching .composer { display: none; }
body.watching { font-size: 20px; }
body.watching .msg { grid-template-columns: 64px 1fr; max-width: 1100px; }
body.watching .msg .avatar { width: 64px; height: 64px; }
@media (max-width: 720px) {
  .row { grid-template-columns: 1fr; }
  .body { grid-template-columns: 1fr; }
  .people { display: none; }
}
