:root {
  color-scheme: dark;
  --bg: #0c0f0c;
  --bg-raised: #151b16;
  --bg-sunken: #090c09;
  --nav: #101510;
  --line: #273127;
  --line-strong: #3c4d3c;
  --text: #e7eee4;
  --muted: #9aab9c;
  --faint: #738275;
  --accent: #d6f25c;
  --accent-ink: #17200b;
  --teal: #8ee0c8;
  --danger: #ff8d74;
  --warn: #e7c36a;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  --serif: "Fraunces", "Palatino Linotype", Palatino, serif;
  --sans: Outfit, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", Consolas, monospace;
  --rail: 56px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(900px 420px at 100% -10%, rgba(214, 242, 92, 0.08), transparent 55%),
    radial-gradient(700px 380px at -10% 110%, rgba(142, 224, 200, 0.07), transparent 50%),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.45;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#chat-input:focus,
#chat-input:focus-visible { outline: none; box-shadow: none; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #334033; border-radius: 99px; }

.shell { height: 100%; display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); }
.rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 0;
}
.rail-spacer { flex: 1; }
.rail-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #d5ddd4;
}
.rail-btn svg { width: 20px; height: 20px; }
.rail-btn:hover, .rail-btn[aria-expanded="true"] { background: #1c241c; }
.rail-status { margin-bottom: 6px; }
.mark {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  box-shadow: inset 0 -7px 0 var(--accent);
  flex: none;
}
.spacer { flex: 1; }
.pills { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pill, .status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  background: rgba(0, 0, 0, 0.18);
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
.status-dot.live { background: var(--accent); animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }

.settings-menu {
  position: fixed;
  z-index: 24;
  top: 10px;
  left: calc(var(--rail) + 6px);
  width: min(380px, calc(100vw - var(--rail) - 18px));
  max-height: calc(100vh - 20px);
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #141914;
  box-shadow: var(--shadow);
}
.account-card { display: flex; gap: 12px; align-items: center; padding: 2px 4px 8px; }
.account-card[hidden] { display: none; }
.account-card img, .account-fallback {
  width: 48px; height: 48px; border-radius: 50%; object-fit: cover; flex: none;
}
.account-fallback {
  display: grid; place-items: center;
  background: rgba(214, 242, 92, 0.16); color: #d6f25c;
  font-family: var(--serif); font-size: 22px;
}
.account-fallback[hidden] { display: none; }
.account-card strong { display: block; font-size: 15px; }
.account-card small { color: var(--muted); font-size: 12px; }
.prefs-window {
  width: min(560px, calc(100vw - 28px));
  max-height: min(880px, calc(100vh - 28px));
  padding: 0;
  border: 1px solid rgba(214, 242, 92, 0.28);
  border-radius: 22px;
  background: #101610;
  color: var(--text);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
}
.prefs-window::backdrop { background: rgba(4, 8, 6, 0.72); }
.prefs-card { display: grid; gap: 18px; margin: 0; padding: 22px; overflow: auto; max-height: min(880px, calc(100vh - 28px)); }
.prefs-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.prefs-head h2 { margin: 0; font-family: var(--serif); font-size: 32px; letter-spacing: -0.03em; }
.prefs-head .muted { margin: 6px 0 0; }
.prefs-block { display: grid; gap: 10px; padding-top: 14px; border-top: 1px solid var(--line); }
.prefs-block h3 { margin: 0; font-size: 15px; }
.prefs-block .hint { margin: 0; }
.settings-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--serif);
  font-size: 26px;
  letter-spacing: -0.03em;
  margin-bottom: 12px;
}
.settings-brand small { display: block; font-family: var(--sans); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); margin-top: -4px; }
.settings-label { margin: 14px 4px 6px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); }
.settings-menu nav { display: grid; gap: 2px; }
.settings-menu nav button {
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 12px;
  padding: 8px 10px;
  color: var(--muted);
}
.settings-menu nav button strong { display: block; color: var(--text); font-weight: 560; }
.settings-menu nav button small { color: var(--faint); font-size: 12px; }
.settings-menu nav button:hover { background: #1c2618; }
.settings-menu nav button[aria-current="page"] { background: #1c2618; }
.settings-menu nav button[aria-current="page"] strong { color: var(--accent); }
.settings-meta { display: grid; gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.scrim { position: fixed; inset: 0; z-index: 12; background: rgba(0, 0, 0, 0.28); }
main { min-width: 0; min-height: 0; height: 100%; position: relative; }
.view { display: none; height: 100%; overflow: auto; }
.view.active { display: block; }
#view-chat.active { display: block; overflow: hidden; background: #0c0f0c; }
.wrap { padding: 28px 32px 56px; max-width: 1180px; }
.page-head { display: flex; justify-content: space-between; gap: 18px; align-items: end; margin-bottom: 22px; }
.kicker { margin: 0 0 4px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); }
h1, h2, h3 { font-family: var(--serif); font-weight: 560; letter-spacing: -0.03em; }
h1 { font-size: 40px; line-height: 1; margin: 0; }
h2 { font-size: 26px; margin: 0 0 12px; }
h3 { font-size: 22px; margin: 0; }
.lede { margin: 8px 0 0; max-width: 62ch; color: var(--muted); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.grid-2 { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 18px; }
.metrics-grid, .gauge-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.card {
  background: rgba(21, 27, 22, 0.92);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
}
.gauge { font-family: var(--serif); font-size: 34px; line-height: 1; margin: 8px 0 4px; letter-spacing: -0.03em; }
.banner {
  border: 1px solid rgba(255, 141, 116, 0.45);
  background: rgba(255, 141, 116, 0.08);
  color: #ffd0c6;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
}
.btn {
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: transparent;
  padding: 8px 14px;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
.btn.danger { color: var(--danger); }
.btn.danger-solid { background: var(--danger); color: #2a0d08; border-color: transparent; font-weight: 600; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.input, select.input, textarea.input {
  width: 100%;
  background: var(--bg-sunken);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}
textarea { resize: vertical; }
.stack { display: grid; gap: 10px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.model-card, .conv-item, .list-row {
  border: 1px solid var(--line);
  background: var(--bg-raised);
  border-radius: 16px;
}
.model-card { padding: 14px; display: flex; flex-direction: column; gap: 8px; min-height: 196px; }
.model-card.hot { border-color: rgba(214, 242, 92, 0.55); }
.model-card p { margin: 0; color: var(--muted); }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em; color: var(--teal); border: 1px solid #24584c; border-radius: 999px; padding: 2px 7px; }
.tag.warn { color: var(--warn); border-color: #6a5824; }
.tag.quiet { color: var(--muted); border-color: var(--line); }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.pull-box { margin: 8px 0 18px; }
.track { height: 8px; background: #232a23; border-radius: 99px; overflow: hidden; }
.track > div { height: 100%; width: 0; background: var(--accent); }
.list { display: grid; gap: 8px; }
.list-row, .conv-item { padding: 10px 12px; }
.list-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 22px; }
.openai code { font-family: var(--mono); color: var(--accent); }

.conv-col {
  display: none;
  position: fixed;
  z-index: 14;
  top: 10px;
  bottom: 10px;
  left: calc(var(--rail) + 6px);
  width: min(320px, calc(100vw - var(--rail) - 18px));
  flex-direction: column;
  min-height: 0;
  background: #141914;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.conv-col.open { display: flex; }
.conv-tools { padding: 12px; display: grid; gap: 8px; }
.conv-head { display: flex; align-items: center; justify-content: space-between; }
.conv-head strong { font-weight: 560; }
.conv-scroll { overflow: auto; padding: 0 10px 16px; display: grid; align-content: start; gap: 6px; }
.conv-row { display: grid; gap: 6px; padding: 8px 8px 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: transparent; }
.conv-row.active { background: #1c2618; border-color: #314628; }
.conv-item { width: 100%; text-align: left; color: inherit; border: 0; background: transparent; padding: 4px 0; }
.conv-item strong { display: block; font-weight: 560; }
.conv-ops { display: flex; flex-wrap: wrap; gap: 6px; }
.conv-ops button { border: 0; background: transparent; color: var(--faint); font-size: 12px; padding: 2px 4px; }
.conv-ops button[aria-pressed="true"] { color: var(--accent); }
.model-pick { position: relative; display: flex; align-items: center; gap: 2px; }
.model-info { width: 26px; height: 26px; opacity: 0.72; font-family: var(--serif); font-size: 14px; }
.model-note {
  position: absolute; right: 0; bottom: calc(100% + 8px); z-index: 5;
  width: min(280px, 70vw); padding: 10px 12px; border-radius: 12px;
  background: #141914; border: 1px solid var(--line); box-shadow: var(--shadow);
  color: var(--muted); font-size: 13px;
}
.model-note strong { display: block; color: var(--text); margin-bottom: 4px; }
.snippet { color: var(--faint); font-size: 12px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.chat-main { position: relative; display: flex; flex-direction: column; min-width: 0; height: 100%; }
.chat-float { position: absolute; top: 10px; right: 12px; z-index: 5; display: flex; align-items: center; gap: 8px; }
.chat-float-title { max-width: min(42vw, 360px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--faint); font-size: 13px; }
.chat-main.is-empty .chat-float-title { display: none; }
.float-panel {
  position: absolute;
  top: 42px;
  right: 0;
  width: min(320px, calc(100vw - var(--rail) - 28px));
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #141914;
  box-shadow: var(--shadow);
}
#messages { flex: 1; overflow: auto; padding: 52px 28px 12px; }
#thread { max-width: 820px; margin: 0 auto; display: grid; gap: 16px; }
.chat-main.is-empty { justify-content: center; }
.chat-main.is-empty #messages { flex: 0 0 auto; overflow: visible; padding: 0 28px; }
.empty-chat { max-width: 720px; margin: 0 auto; text-align: center; }
.empty-chat h2 { font-size: clamp(28px, 4vw, 40px); margin: 0; font-weight: 500; }
.suggestions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 18px; }
.msg { max-width: 100%; }
.msg .who, .stats { font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); }
.msg .md { margin-top: 4px; }
.msg.user .md { background: #1c2818; border: 1px solid #314628; border-radius: 14px 14px 4px 14px; padding: 10px 12px; }
.msg.assistant .md { padding-right: 8px; }
.msg.hit { box-shadow: inset 3px 0 0 var(--accent); }
.msg .md p { margin: 0.4em 0; }
.msg .md h3, .msg .md h4, .msg .md h5 { margin: 0.8em 0 0.3em; }
.msg .md ul, .msg .md ol { margin: 0.4em 0; padding-left: 1.2em; }
.msg .md code { font-family: var(--mono); font-size: 0.92em; background: #232a23; padding: 0 4px; border-radius: 4px; }
.codeblock { margin: 8px 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #0b0e0b; }
.codehead { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px; color: var(--faint); font-family: var(--mono); font-size: 12px; border-bottom: 1px solid var(--line); }
.codehead button { background: none; border: 0; color: var(--accent); padding: 0; }
.codeblock pre { margin: 0; padding: 12px 14px; overflow: auto; }
.codeblock code { font-family: var(--mono); font-size: 13px; line-height: 1.55; background: none; padding: 0; white-space: pre; tab-size: 2; }
.tok-k { color: #d6f25c; }
.tok-s { color: #f0c27a; }
.tok-c { color: #8ea184; }
#chat-error { max-width: 820px; margin: 0 auto 8px; color: var(--danger); }
.composer-wrap { padding: 8px 28px 22px; }
.chat-main.is-empty .composer-wrap { width: min(820px, 100%); margin: 0 auto; padding-top: 22px; }
.composer { max-width: 820px; margin: 0 auto; background: #171c17; border: 1px solid #2c382c; border-radius: 28px; padding: 8px 8px 8px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28); }
.composer textarea { min-height: 44px; max-height: 180px; border: 0; background: transparent; padding: 10px 12px; width: 100%; }
.chat-main.is-empty .kbd-hint { display: none; }
.composer-tools, .ajustes { padding: 4px 8px 0; }
.composer-tools { align-items: center; }
.composer-more { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.tools-toggle { display: none; }
.icon-btn.on { color: var(--accent); background: rgba(214, 242, 92, 0.12); }
.talk-stage { display: none; }
body.is-talk .talk-stage {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 18px;
  background:
    radial-gradient(420px 280px at 50% 42%, rgba(214, 242, 92, 0.12), transparent 70%),
    #0c0f0c;
  text-align: center;
}
body.is-talk #messages,
body.is-talk .composer-wrap,
body.is-talk .chat-float,
body.is-talk .player { display: none; }
#talk-caption { margin: 0; font-family: var(--serif); font-size: 28px; letter-spacing: -0.03em; }
#face-video { display: none; width: min(88vw, 420px); max-height: 58vh; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 22px; background: #000; transform: scaleX(-1); border: 3px solid transparent; }
#face-video.face-fixed { position: fixed; z-index: 45; left: 50%; top: 42%; transform: translate(-50%, -50%) scaleX(-1); }
#face-live-status.face-fixed { position: fixed; z-index: 45; left: 0; right: 0; top: calc(42% + 32vh); text-align: center; }
#talk-face { display: none; }
body.is-talk.needs-face #talk-face { display: inline-flex; }
body.is-face #talk-face { display: none; }
body.is-talk.is-face-no #talk-face { display: inline-flex; }
#face-live-status { display: none; margin: 0; color: var(--muted); }
body.is-face #face-video,
body.is-face #face-live-status { display: block; }
body.is-face-wait #face-video { border-color: var(--warn); }
body.is-face-ok #face-video { border-color: var(--accent); }
body.is-face-no #face-video { border-color: var(--danger); }
body.is-face.is-speaking #face-video { animation: talk-pulse 1.3s ease-in-out infinite; }
body.is-face .talk-orb { display: none; }
.talk-orb {
  position: relative;
  width: 148px;
  height: 148px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #3c5430, #121712 68%);
  box-shadow: 0 0 0 1px rgba(214, 242, 92, 0.25);
}
.talk-orb i {
  position: absolute;
  bottom: 52px;
  width: 7px;
  height: 16px;
  border-radius: 99px;
  background: var(--accent);
  opacity: 0.35;
}
.talk-orb i:nth-child(1) { left: 36px; }
.talk-orb i:nth-child(2) { left: 54px; }
.talk-orb i:nth-child(3) { left: 72px; }
.talk-orb i:nth-child(4) { left: 90px; }
.talk-orb i:nth-child(5) { left: 108px; }
body.is-speaking .talk-orb i { animation: talk-bar 0.9s ease-in-out infinite; }
body.is-speaking .talk-orb i:nth-child(2) { animation-delay: 0.12s; }
body.is-speaking .talk-orb i:nth-child(3) { animation-delay: 0.24s; }
body.is-speaking .talk-orb i:nth-child(4) { animation-delay: 0.16s; }
body.is-speaking .talk-orb i:nth-child(5) { animation-delay: 0.32s; }
body.is-thinking .talk-orb { animation: talk-pulse 1.3s ease-in-out infinite; }
@keyframes talk-bar { 50% { height: 48px; opacity: 1; } }
@keyframes talk-pulse { 50% { transform: scale(1.07); box-shadow: 0 0 0 10px rgba(214, 242, 92, 0.08); } }
#shot-video, #shot-preview { width: 100%; max-height: 320px; border-radius: 12px; background: #000; object-fit: cover; }
#face-preview { width: 96px; height: 96px; object-fit: cover; border-radius: 16px; }
#account-inventory { display: grid; gap: 8px; max-height: 280px; overflow: auto; }
.ajustes { display: grid; gap: 8px; margin-bottom: 6px; }
.ajustes summary { cursor: pointer; color: var(--muted); }
.sliders { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
label span { display: block; color: var(--faint); font-size: 12px; margin-bottom: 4px; }
.hint { color: var(--faint); font-size: 12px; margin: 6px 8px 2px; }
.use-balloon { margin: 8px 8px 0; padding: 8px 12px; border-radius: 12px; background: rgba(214, 242, 92, 0.08); border: 1px solid rgba(214, 242, 92, 0.28); color: var(--text); font-size: 13px; }
.use-balloon.warn { background: rgba(255, 141, 116, 0.1); border-color: rgba(255, 141, 116, 0.45); }
.use-balloon strong { display: block; font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); margin-bottom: 2px; }
.use-balloon.warn strong { color: var(--danger); }
.model-card .use-balloon { margin: 0; }
.check { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.msg-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.msg-actions .btn { padding: 4px 10px; font-size: 13px; }
.retry-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.msg-actions .retry-list .btn { display: flex; flex-direction: column; align-items: flex-start; border-radius: 12px; text-align: left; padding: 6px 10px 8px; line-height: 1.2; white-space: normal; }
.retry-list small { display: block; color: var(--faint); font-size: 11px; line-height: 1.25; }
.icon-btn { width: 36px; height: 36px; display: inline-grid; place-items: center; padding: 0; border-radius: 999px; }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.stopping, #mic-btn.live { background: var(--danger); color: #2a0d08; border-color: transparent; }
.model-pill { max-width: 220px; border-radius: 999px; background: #161b16; color: var(--text); padding: 6px 12px; }
.refs { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.refs-count { border: 1px solid var(--line-strong); border-radius: 999px; padding: 4px 10px; color: var(--muted); font-size: 12px; }
.refs-list { display: flex; flex-wrap: wrap; gap: 8px; }
.refs-list a { color: var(--accent); font-size: 12px; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-file { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 999px; padding: 4px 8px 4px 12px; color: var(--muted); font-size: 13px; }
#composer.fluid-live { border-color: rgba(214, 242, 92, 0.7); }
.player { position: fixed; z-index: 40; top: 14px; left: 50%; transform: translateX(-50%); }
.player-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 999px;
  box-shadow: var(--shadow);
}
.player-bar .icon-btn { border: 0; background: transparent; }
.player-voice {
  max-width: min(240px, 46vw);
  border: 0;
  border-radius: 999px;
  background: #2a2a2a;
  color: var(--text);
  padding: 8px 28px 8px 12px;
}
.player-speed {
  min-width: 52px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  padding: 8px 6px;
}
#voice-pick { width: 100%; max-width: none; }
.attach-strip { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 8px 0; }
.attach-card { position: relative; }
.attach-card img, .msg-images img { display: block; max-width: 160px; max-height: 120px; border-radius: 10px; object-fit: cover; border: 1px solid var(--line); }
.attach-card button { position: absolute; top: 4px; right: 4px; padding: 0 6px; border-radius: 999px; }
.msg-images { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.msg-images img { max-width: 280px; max-height: 220px; }
#model-note.warn { color: var(--danger); }

.spark { width: 100%; height: 74px; display: block; }
.spark-card .kicker { margin-bottom: 0; }
.cores { display: grid; gap: 6px; }
.core { display: grid; grid-template-columns: 28px 1fr 52px; gap: 8px; align-items: center; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.core .track { height: 7px; }
.table-scroll { max-height: 420px; overflow: auto; border: 1px solid var(--line); border-radius: 14px; }
table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
table.grid th { text-align: left; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); font-weight: 500; position: sticky; top: 0; background: #121712; }
table.grid td, table.grid th { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.grid tr.ollama td { background: rgba(214, 242, 92, 0.06); }
.mono { font-family: var(--mono); font-size: 12px; }
.filters { display: flex; gap: 10px; align-items: center; margin: 8px 0; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg button { border: 0; background: transparent; color: var(--muted); border-radius: 0; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.days { display: grid; gap: 5px; }
.day { display: grid; grid-template-columns: 52px 1fr 72px; gap: 8px; align-items: center; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.day .track > div { background: var(--teal); }
.section-gap { margin-top: 22px; }
pre.plain { white-space: pre-wrap; word-break: break-word; font-family: var(--mono); font-size: 12px; background: var(--bg-sunken); border-radius: 12px; padding: 12px; max-height: 240px; overflow: auto; }
.term {
  min-height: 320px;
  max-height: calc(100vh - 280px);
  overflow: auto;
  background: #070907;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  font-family: var(--mono);
  font-size: 13px;
  white-space: pre-wrap;
}
.term-form { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.term-form .prompt { font-family: var(--mono); color: var(--accent); }
.term-form input { flex: 1; }
.sim { height: 14px; border-radius: 99px; background: #232a23; overflow: hidden; margin: 8px 0; }
.sim > div { height: 100%; background: linear-gradient(90deg, var(--teal), var(--accent)); }
#drawer, #modal { position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, 0.5); display: flex; }
#drawer { justify-content: flex-end; }
#modal { justify-content: center; align-items: center; padding: 16px; }
.drawer-card { width: min(480px, 100%); height: 100%; overflow: auto; background: var(--bg); border-left: 1px solid var(--line); padding: 20px; }
.drawer-card header, .modal-card .row { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.modal-card { width: min(440px, 100%); background: var(--bg-raised); border: 1px solid var(--line); border-radius: 16px; padding: 18px; box-shadow: var(--shadow); }
#toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 30; background: #222a20; border: 1px solid var(--line-strong); border-radius: 999px; padding: 10px 16px; box-shadow: var(--shadow); }
#toast[data-kind="err"] { border-color: rgba(255, 141, 116, 0.6); color: #ffd0c6; }
mark { background: var(--accent); color: var(--accent-ink); padding: 0 2px; }

@media (max-width: 1100px) {
  .metrics-grid, .gauge-grid, .grid-2, .split { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .wrap { padding: 20px 16px 40px; }
  h1 { font-size: 32px; }
  .metrics-grid, .gauge-grid, .grid-2, .split, .sliders, .filters { grid-template-columns: 1fr; }
  .filters { display: grid; }
  #messages { padding-left: 16px; padding-right: 16px; }
  .composer-wrap, .chat-main.is-empty #messages { padding-left: 12px; padding-right: 12px; }
}
@media (max-width: 720px) {
  .shell { display: block; height: 100%; }
  .rail {
    position: fixed;
    z-index: 16;
    left: 0;
    right: 0;
    bottom: 0;
    flex-direction: row;
    justify-content: center;
    gap: 2px;
    height: calc(48px + env(safe-area-inset-bottom));
    padding: 4px 8px env(safe-area-inset-bottom);
    background: rgba(12, 15, 12, 0.94);
    border-top: 1px solid var(--line);
  }
  .rail-spacer { display: none; }
  .rail-btn { width: 40px; height: 40px; opacity: 0.62; }
  .rail-btn:hover, .rail-btn[aria-expanded="true"] { opacity: 1; }
  .rail-status { margin: 0; }
  main { height: 100%; padding-bottom: calc(48px + env(safe-area-inset-bottom)); }
  #messages { padding: 44px 14px 8px; }
  .chat-main.is-empty #messages, .composer-wrap { padding-left: 12px; padding-right: 12px; }
  .composer-wrap { padding-bottom: 8px; }
  .kbd-hint { display: none; }
  .empty-chat, #thread, .composer, #chat-error { margin-left: auto; margin-right: auto; }
  .chat-float { top: 8px; right: 8px; }
  .chat-float-title { max-width: 46vw; }
  .conv-col, .settings-menu {
    left: 8px;
    right: 8px;
    width: auto;
    bottom: calc(56px + env(safe-area-inset-bottom));
  }
  .composer { position: relative; }
  .composer-tools { flex-wrap: nowrap; }
  .tools-toggle { display: inline-grid; opacity: 0.7; }
  .composer-more {
    display: none;
    position: absolute;
    z-index: 6;
    left: 0;
    right: 0;
    bottom: calc(100% + 8px);
    padding: 8px;
    border: 1px solid #2c382c;
    border-radius: 16px;
    background: #171c17;
    box-shadow: var(--shadow);
  }
  .composer-more.open { display: flex; }
  .model-pill { max-width: 104px; font-size: 12px; padding: 4px 8px; }
  #send-btn { padding: 8px 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .status-dot.live { animation: none; }
}
.gate {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(900px 480px at 15% -10%, rgba(214, 242, 92, 0.16), transparent 55%),
    radial-gradient(700px 500px at 110% 90%, rgba(56, 92, 255, 0.22), transparent 50%),
    #070b12;
  padding: 24px;
}
.gate canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.orb {
  position: absolute;
  width: min(46vw, 520px);
  height: min(46vw, 520px);
  border-radius: 50%;
  filter: blur(46px);
  opacity: 0.55;
  pointer-events: none;
}
.orb-a { background: #1f6a52; top: -12%; left: -8%; }
.orb-b { background: #2436a8; right: -12%; bottom: -16%; }
.gate-card, .gate form {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  padding: 28px 24px;
  background: rgba(12, 18, 16, 0.78);
  border: 1px solid rgba(214, 242, 92, 0.28);
  border-radius: 22px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(16px);
}
.gate h1 { margin: 0; font-family: var(--serif); font-size: 36px; letter-spacing: -0.03em; }
.gate .warn { margin: 0; color: var(--warn); }
.gate-google {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  text-decoration: none; color: #17200b; background: #f4f7ef; border-color: transparent;
  font-weight: 600; padding: 12px 14px;
}
.gate-google[hidden], .gate-split[hidden] { display: none; }
.gate-google svg { width: 18px; height: 18px; flex: none; }
.gate-split {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center;
  margin: 0; color: var(--muted); font-size: 12px;
}
.gate-split::before, .gate-split::after { content: ""; height: 1px; background: rgba(142, 224, 200, 0.28); }
.gate-pending { display: grid; gap: 10px; }
.gate-pending[hidden] { display: none; }
.gate-pending p { margin: 0; }
.gate-card.is-pending > :not(.gate-pending) { display: none; }
.gate label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; }
.gate input {
  width: 100%;
  border: 1px solid rgba(142, 224, 200, 0.28);
  background: rgba(7, 11, 14, 0.72);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
}
.secret { position: relative; display: block; }
.secret input { padding-right: 92px; }
.secret button, .captcha-row .btn {
  border: 0;
  background: transparent;
  color: #d6f25c;
  font-size: 13px;
}
.secret button {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  padding: 6px 8px;
}
.captcha { display: grid; gap: 8px; }
.captcha-row { display: flex; gap: 10px; align-items: center; }
.captcha img { border-radius: 12px; background: #0c1210; }
@media (prefers-reduced-motion: no-preference) {
  .orb-a { animation: drift 18s ease-in-out infinite alternate; }
  .orb-b { animation: drift 24s ease-in-out infinite alternate-reverse; }
}
@keyframes drift { to { transform: translate3d(10%, 8%, 0) scale(1.12); } }
