:root {
  --bg: #0b0a0a;
  --side: #110f0f;
  --panel: #1a1717;
  --panel-2: #221e1e;
  --line: #2e2828;
  --text: #ece7e6;
  --muted: #8e8584;
  --red: #e5252d;
  --red-soft: rgba(229, 37, 45, .14);
  --mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.6 var(--sans); }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.inert { cursor: not-allowed; opacity: .55; }

.app { display: grid; grid-template-columns: 272px 1fr; height: 100%; }

.side { background: var(--side); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; padding: 10px 8px; }
.side-top { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 10px; }
.brand { display: flex; align-items: center; gap: 9px; font: 600 15px var(--mono); letter-spacing: .22em; color: var(--text); }
.icon { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 8px; color: var(--muted); font-size: 20px; }
.new { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; font-weight: 500; }
.new:hover { background: var(--panel); }
.plus { display: inline-flex; width: 24px; height: 24px; align-items: center; justify-content: center; border-radius: 50%; background: var(--red); color: #fff; font-size: 17px; line-height: 1; }
.dead { display: flex; flex-direction: column; margin: 4px 0 6px; }
.item { display: flex; align-items: center; gap: 11px; padding: 7px 10px; border-radius: 9px; color: var(--muted); }
.recents-head { font-size: 12px; color: var(--muted); padding: 14px 10px 6px; }
.recents { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; min-height: 0; }
.recents a { display: block; padding: 6px 10px; border-radius: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; color: #d6cfce; }
.recents a:hover { background: var(--panel); }
.recents a.on { background: var(--panel-2); color: var(--text); }
.me { display: flex; align-items: center; gap: 10px; padding: 10px; border-top: 1px solid var(--line); margin-top: 6px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: #3a3333; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; }
.who { display: flex; flex-direction: column; line-height: 1.25; font-size: 13px; }
.who small { color: var(--muted); }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100%; }
.top { display: flex; align-items: center; gap: 8px; height: 52px; padding: 0 16px; flex: none; }
.top .title { font-size: 14px; color: #d6cfce; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu { display: none; }

.empty { flex: 1; display: flex; align-items: flex-end; justify-content: center; padding: 0 16px 28px; }
.hello { display: flex; align-items: center; gap: 14px; }
.hello h1 { margin: 0; font: 400 34px/1.2 var(--mono); letter-spacing: -.01em; }

.thread { flex: 1; overflow-y: auto; padding: 8px 16px 24px; display: none; }
.has-thread .thread { display: block; }
.has-thread .empty, .has-thread .chips, .has-thread .empty-gap { display: none; }
.msg { max-width: 760px; margin: 0 auto 22px; }
.msg.human { display: flex; justify-content: flex-end; }
.msg.human .bubble { background: var(--panel-2); padding: 10px 16px; border-radius: 16px; max-width: 80%; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.skynet { display: grid; grid-template-columns: 28px 1fr; gap: 12px; }
.msg.skynet .body p { margin: 0 0 12px; white-space: pre-wrap; overflow-wrap: anywhere; font-family: Georgia, "Iowan Old Style", serif; font-size: 16.5px; line-height: 1.65; }
.msg.skynet .body p:last-child { margin-bottom: 0; }
.msg.skynet img { margin-top: 3px; }
.acts { display: flex; gap: 6px; margin-top: 8px; color: var(--muted); font-size: 12px; align-items: center; }
.acts span { padding: 2px 4px; }
.acts .src { border: 1px solid var(--line); border-radius: 6px; font-family: var(--mono); font-size: 11px; }
.acts .src.mem { color: var(--red); border-color: rgba(229, 37, 45, .4); }
.thinking { color: var(--muted); font-family: var(--mono); font-size: 13px; }
.thinking::after { content: ""; display: inline-block; width: 8px; height: 13px; margin-left: 4px; background: var(--red); vertical-align: -2px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.note { color: var(--muted); font-size: 13px; margin-top: 6px; }

.composer { width: min(760px, calc(100% - 32px)); margin: 0 auto; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 12px 12px 10px 16px; flex: none; }
.composer:focus-within { border-color: #4a3d3d; }
.composer textarea { width: 100%; resize: none; border: 0; outline: 0; background: transparent; color: var(--text); font: 16px/1.5 var(--sans); max-height: 220px; }
.composer textarea::placeholder { color: var(--muted); }
.row { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.row .icon { border: 1px solid var(--line); width: 30px; height: 30px; font-size: 18px; }
.model { margin-left: auto; font: 12px var(--mono); color: var(--muted); border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; letter-spacing: .08em; }
.send { width: 34px; height: 34px; border-radius: 10px; background: var(--red); color: #fff; display: inline-flex; align-items: center; justify-content: center; }
.send:disabled { background: #4a2a2b; color: #a88; cursor: default; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; width: min(760px, calc(100% - 32px)); margin: 16px auto 0; flex: none; }
.chips button { border: 1px solid var(--line); border-radius: 10px; padding: 6px 12px; color: #cfc7c6; font-size: 14px; }
.chips button:hover { background: var(--panel); }
.empty-gap { flex: 1; }
.fine { text-align: center; color: #b9b0af; font-size: 14px; line-height: 1.5; margin: 12px 16px 14px; flex: none; }
.fine a { color: #ff5a60; text-decoration: underline; text-underline-offset: 3px; font-weight: 600; }
.fine a:hover { color: #ff8a8e; }
.has-thread .fine { margin-top: 8px; }
.err { color: #ff8a8a; font-size: 13px; text-align: center; margin: 6px 0 0; }

.scrim { display: none; }
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 20; transform: translateX(-100%); transition: transform .2s; }
  .open .side { transform: none; }
  .open + .scrim, .app.open ~ .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 10; }
  .menu { display: inline-flex; }
  .hello h1 { font-size: 26px; }
}
