:root {
  --bg: #ffffff;
  --bg-sidebar: #f6f7f6;
  --surface: #ffffff;
  --surface-2: #f2f4f3;
  --surface-hover: #eaedeb;
  --border: #e2e6e4;
  --border-strong: #cfd5d2;
  --text: #17201c;
  --text-2: #4c5852;
  --text-3: #7b8781;
  --accent: #0f766e;
  --accent-hover: #0b5f58;
  --accent-soft: #e6f3f1;
  --on-accent: #ffffff;
  --user-bubble: #eef2f0;
  --ok: #15803d;
  --warn: #b45309;
  --danger: #b91c1c;
  --danger-soft: #fdf0ef;
  --code-bg: #f3f5f4;
  --shadow: 0 1px 2px rgba(16, 24, 20, 0.04), 0 4px 16px rgba(16, 24, 20, 0.06);
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111513;
    --bg-sidebar: #0c0f0e;
    --surface: #171c1a;
    --surface-2: #1d2321;
    --surface-hover: #252c29;
    --border: #262e2b;
    --border-strong: #35403b;
    --text: #e7ece9;
    --text-2: #b0bab5;
    --text-3: #7f8a85;
    --accent: #2dd4bf;
    --accent-hover: #5eead4;
    --accent-soft: #12302c;
    --on-accent: #06201c;
    --user-bubble: #1f2724;
    --ok: #4ade80;
    --warn: #fbbf24;
    --danger: #f87171;
    --danger-soft: #2a1716;
    --code-bg: #1b2120;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

.app { display: flex; height: 100dvh; overflow: hidden; }

/* Sidebar */
.sidebar {
  width: 272px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  padding: 14px 10px 12px;
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 6px 14px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 650; font-size: 15.5px; letter-spacing: -0.01em; }
.brand-mark { width: 24px; height: 24px; color: var(--accent); stroke-width: 1.9; }

.new-chat {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  font-weight: 550;
  transition: background 0.15s, border-color 0.15s;
}
.new-chat:hover { background: var(--surface-hover); }

.conv-heading { font-size: 12px; color: var(--text-3); padding: 18px 8px 6px; font-weight: 550; }
.conv-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 1px; margin: 0 -2px; padding: 0 2px; }
.conv-empty { font-size: 13px; color: var(--text-3); padding: 6px 8px; }
.conv-item {
  position: relative;
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  padding: 8px 8px 8px 10px;
  border: 0; border-radius: 8px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: var(--text-2);
  font-size: 13.5px;
}
.conv-item:hover { background: var(--surface-hover); color: var(--text); }
.conv-item[aria-current="true"] { background: var(--surface-hover); color: var(--text); font-weight: 550; }
.conv-item svg { width: 15px; height: 15px; color: var(--text-3); }
.conv-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-delete {
  display: grid; place-items: center;
  width: 26px; height: 26px;
  border: 0; border-radius: 6px;
  background: transparent; color: var(--text-3);
  cursor: pointer;
  opacity: 0;
}
.conv-item:hover .conv-delete, .conv-item[aria-current="true"] .conv-delete, .conv-delete:focus-visible { opacity: 1; }
.conv-delete:hover { color: var(--danger); background: var(--danger-soft); }
.conv-delete svg { width: 15px; height: 15px; }

.sidebar-foot { border-top: 1px solid var(--border); margin-top: 8px; padding: 12px 8px 0; font-size: 12.5px; color: var(--text-2); }
.status { display: flex; align-items: center; gap: 8px; }
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex-shrink: 0; }
.status[data-state="ok"] .dot { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 20%, transparent); }
.status[data-state="error"] .dot { background: var(--danger); }
.status[data-state="checking"] .dot { background: var(--warn); animation: pulse 1.2s ease-in-out infinite; }
.model { color: var(--text-3); margin-top: 4px; font-family: var(--mono); font-size: 11.5px; padding-left: 16px; }

/* Signed-in account, admin link, logout */
.side-account { display: flex; align-items: center; gap: 8px; margin: 12px -4px 0; padding-top: 10px; border-top: 1px solid var(--border); }
.side-account[hidden] { display: none; }
.side-avatar {
  width: 28px; height: 28px; flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  font-size: 12.5px; font-weight: 650;
}
.side-account-text { flex: 1; min-width: 0; line-height: 1.3; }
.side-account-name { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-account-email { font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-account .icon-btn { width: 30px; height: 30px; }
.side-account .icon-btn svg { width: 16px; height: 16px; }
.side-admin-link {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 6px 8px; border-radius: 8px;
  color: var(--text-2); text-decoration: none; font-size: 13px; font-weight: 550;
}
.side-admin-link:hover { background: var(--surface-hover); color: var(--text); }
.side-admin-link svg { width: 16px; height: 16px; color: var(--accent); }
.legacy-box {
  margin: 10px 2px 0; padding: 10px 11px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  font-size: 12.5px; color: var(--text-2); line-height: 1.5;
}
.legacy-box[hidden] { display: none; }
.legacy-actions { display: flex; gap: 6px; margin-top: 8px; }
.legacy-btn {
  height: 28px; padding: 0 10px; border-radius: 7px; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-size: 12.5px;
}
.legacy-btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.legacy-btn:disabled { opacity: 0.5; cursor: default; }
.legacy-status { margin-top: 6px; font-size: 12px; color: var(--text-3); }
.legacy-status:empty { display: none; }
.thread-status { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 48px 16px; color: var(--text-3); font-size: 14px; }
.thread-status svg { color: var(--warn); }
.side-copy { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 10.5px; line-height: 1.5; color: var(--text-3); }

/* Copyright footer (login, developer guide, admin) */
.site-foot {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 8px;
  padding: 18px 16px 22px;
  font-size: 12px; color: var(--text-3); text-align: center;
}
@media (max-width: 600px) { .site-foot-sep { display: none; } .site-foot { flex-direction: column; } }

/* Main */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }
.topbar {
  display: flex; align-items: center; gap: 8px;
  height: 52px; flex-shrink: 0;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
}
.topbar h1 { margin: 0; font-size: 14.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-link {
  margin-left: auto; flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 9px;
  color: var(--text-2); text-decoration: none; font-size: 13px; font-weight: 550;
}
.topbar-link:hover { background: var(--surface-hover); color: var(--text); }
.topbar-link svg { width: 16px; height: 16px; color: var(--accent); }

.icon-btn {
  display: grid; place-items: center;
  width: 34px; height: 34px;
  border: 0; border-radius: 8px;
  background: transparent; color: var(--text-2);
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-hover); color: var(--text); }
.only-mobile { display: none; }

.thread { flex: 1; overflow-y: auto; scroll-behavior: auto; }
.messages { max-width: 1240px; margin: 0 auto; padding: 28px 24px 24px; display: flex; flex-direction: column; gap: 26px; }
/* Answers from before comparison mode keep a readable single-column width. */
.messages > .msg-assistant { max-width: 860px; }
.messages:empty { display: none; }

/* Empty state */
.empty { max-width: 720px; margin: 0 auto; padding: 9vh 24px 24px; text-align: center; }
.empty[hidden] { display: none; }
.empty-mark { width: 44px; height: 44px; color: var(--accent); stroke-width: 1.5; }
.empty h2 { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; margin: 14px 0 8px; }
.empty p { color: var(--text-2); margin: 0 auto 28px; max-width: 520px; }
.examples { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; text-align: left; }
.example {
  display: flex; flex-direction: column; gap: 4px;
  padding: 13px 15px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
  font-size: 14px;
  line-height: 1.45;
  transition: border-color 0.15s, background 0.15s;
}
.example:hover { border-color: var(--accent); background: var(--accent-soft); }
.example-kicker { font-size: 12px; font-weight: 600; color: var(--accent); }

/* Messages */
.msg-user { align-self: flex-end; max-width: min(82%, 720px); }
.msg-user .bubble {
  background: var(--user-bubble);
  padding: 10px 15px;
  border-radius: 18px 18px 4px 18px;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg-assistant { display: flex; gap: 14px; }
.avatar {
  width: 30px; height: 30px; flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  margin-top: 1px;
}
.avatar svg { width: 18px; height: 18px; stroke-width: 2; }
.msg-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }

.msg-actions { display: flex; gap: 2px; margin-left: -6px; }
.msg-actions .icon-btn { width: 30px; height: 30px; color: var(--text-3); }
.msg-actions .icon-btn svg { width: 16px; height: 16px; }

/* Comparison: the same question answered with and without Minerva MCP */
.pair { display: flex; flex-direction: column; gap: 10px; }
.pair-tabs { display: none; }
.pair-lanes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.lane {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  padding: 14px 18px 12px;
}
.lane[data-mode="mcp"] { border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.lane-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 12px; padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.lane-head svg { width: 16px; height: 16px; color: var(--text-3); }
.lane[data-mode="mcp"] .lane-head svg { color: var(--accent); }
.lane-title { font-weight: 650; color: var(--text); }
.lane-hint { margin-left: auto; color: var(--text-3); font-size: 12px; text-align: right; }
.lane .avatar { display: none; }
.lane .msg-assistant { gap: 0; }

.pair-tab {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border: 0; border-radius: 7px;
  background: transparent; color: var(--text-2);
  font-size: 13px; cursor: pointer;
}
.pair-tab svg { width: 15px; height: 15px; }
.pair-tab[aria-selected="true"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }
.pair-tab.busy::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }

@media (max-width: 1100px) {
  .pair-tabs {
    display: flex; gap: 2px;
    width: fit-content; padding: 3px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
  }
  .pair-lanes { grid-template-columns: minmax(0, 1fr); }
  .pair[data-active="mcp"] .lane[data-mode="plain"],
  .pair[data-active="plain"] .lane[data-mode="mcp"] { display: none; }
}

/* Markdown */
.md { overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p, .md ul, .md ol, .md blockquote, .md pre, .md .table-wrap { margin: 0 0 12px; }
.md h1, .md h2, .md h3, .md h4 { line-height: 1.35; margin: 20px 0 8px; font-weight: 650; letter-spacing: -0.01em; }
.md h1 { font-size: 20px; } .md h2 { font-size: 18px; } .md h3 { font-size: 16px; } .md h4 { font-size: 15px; }
.md ul, .md ol { padding-left: 22px; }
.md li { margin: 3px 0; }
.md li > ul, .md li > ol { margin: 3px 0 0; }
.md a { color: var(--accent); text-decoration: none; border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); }
.md a:hover { border-bottom-color: var(--accent); }
.md strong { font-weight: 650; }
.md em { font-style: italic; }
.md code { font-family: var(--mono); font-size: 0.88em; background: var(--code-bg); padding: 1px 5px; border-radius: 5px; }
.md pre { background: var(--code-bg); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; overflow-x: auto; }
.md pre code { background: none; padding: 0; font-size: 13px; }
.md blockquote { border-left: 3px solid var(--border-strong); padding: 2px 0 2px 14px; color: var(--text-2); }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
.md .table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
.md table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
.md th, .md td { padding: 8px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.md th { background: var(--surface-2); font-weight: 600; white-space: nowrap; }
.md tr:last-child td { border-bottom: 0; }
.md td { font-variant-numeric: tabular-nums; }

/* Message sections */
.texts, .extras { display: flex; flex-direction: column; gap: 10px; }
.texts:empty, .extras:empty, .msg-actions:empty { display: none; }
.spinner {
  width: 13px; height: 13px; flex-shrink: 0;
  border: 2px solid color-mix(in srgb, var(--accent) 25%, transparent);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Minerva badge */
.msg-head { display: flex; align-items: center; min-height: 30px; }
.msg-head:empty { display: none; }
.msg-head + .texts { margin-top: -2px; }
.mcp-badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 9px 0 9px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
  font-size: 12.5px; font-weight: 600; line-height: 1;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
button.mcp-badge:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent-soft) 70%, var(--accent) 12%); }
.mcp-badge svg { width: 14px; height: 14px; }
.mcp-badge .badge-count { color: var(--text-2); font-weight: 500; }
.mcp-badge .badge-fail { color: var(--danger); font-weight: 600; }
.mcp-badge .badge-chevron { width: 13px; height: 13px; margin-left: -1px; opacity: 0.8; }
.mcp-badge.muted { background: var(--surface-2); color: var(--text-3); border-color: var(--border); font-weight: 500; cursor: default; }

/* One-line source note under the answer */
.sources-line {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px;
  margin-top: 4px; padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 12.5px; color: var(--text-3);
}
.sources-line:empty { display: none; }
.sources-line-label { font-weight: 600; color: var(--text-2); }
.link-btn { border: 0; background: none; padding: 0; font: inherit; font-weight: 550; color: var(--accent); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

/* Call drawer */
.drawer-scrim {
  position: fixed; inset: 0; z-index: 30;
  background: rgba(10, 16, 14, 0.28);
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}
.app.drawer-open .drawer-scrim { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 31;
  width: min(460px, 100vw);
  display: flex; flex-direction: column;
  background: var(--bg);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.12);
  transform: translateX(100%);
  visibility: hidden;
  transition: transform 0.22s ease, visibility 0s linear 0.22s;
}
.drawer.open { transform: none; visibility: visible; transition: transform 0.22s ease; }
.drawer-head { display: flex; align-items: flex-start; gap: 10px; padding: 16px 12px 14px 20px; border-bottom: 1px solid var(--border); }
.drawer-head-text { flex: 1; min-width: 0; }
.drawer-title { display: flex; align-items: center; gap: 8px; margin: 4px 0 0; font-size: 15.5px; font-weight: 650; letter-spacing: -0.01em; }
.drawer-title svg { color: var(--accent); }
.drawer-question {
  margin: 6px 0 0; color: var(--text-2); font-size: 13px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.drawer-question[data-kind="question"]::before { content: "질문 · "; color: var(--text-3); }
.drawer-stats { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); font-size: 12px; }
.chip.strong { background: var(--accent-soft); border-color: transparent; color: var(--accent); font-weight: 600; }
.chip.danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); font-weight: 600; }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px 16px 24px 20px; }
.drawer-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.drawer-note { margin: 16px 2px 0; font-size: 12px; color: var(--text-3); }

/* MCP tool catalog */
.status-tools { font-size: inherit; font-weight: 600; text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); text-underline-offset: 3px; }
.tool-group {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 8px 2px -4px;
  font-size: 12.5px; font-weight: 650; color: var(--text-2);
}
.tool-group:first-child { margin-top: 0; }
.tool-group-count { font-weight: 500; color: var(--text-3); font-size: 12px; }
.tool-summary { margin: 8px 0 0; color: var(--text-2); }
.tool-desc { margin: 0 0 8px; color: var(--text-2); font-size: 12.5px; white-space: pre-wrap; }
.tool-noparams { margin: 8px 0 0; color: var(--text-3); font-size: 12.5px; }
.param-wrap { margin-top: 10px; overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; }
.param-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.param-table th, .param-table td { padding: 6px 9px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.param-table tr:last-child td { border-bottom: 0; }
.param-table th { background: var(--surface-2); color: var(--text-3); font-weight: 600; font-size: 12px; white-space: nowrap; }
.param-table td { color: var(--text-2); overflow-wrap: anywhere; }
.param-table td:first-child { white-space: nowrap; }
.param-table code { font-family: var(--mono); font-size: 12px; color: var(--text); }
.param-ko { color: var(--text-3); font-size: 11.5px; margin-top: 1px; }
.req {
  display: inline-block; margin-left: 6px; padding: 0 5px;
  border-radius: 4px; background: var(--accent-soft); color: var(--accent);
  font-size: 10.5px; font-weight: 650; vertical-align: 1px;
}
.param-note { color: var(--text-3); font-size: 11.5px; }
.drawer-list > .notice { list-style: none; }

/* One card per Minerva call */
.source {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.5;
}
.source[data-state="error"] { border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.source-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.source-num {
  display: grid; place-items: center;
  width: 20px; height: 20px; flex-shrink: 0;
  border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  font-size: 11.5px; font-weight: 650; font-variant-numeric: tabular-nums;
}
.source-label { font-weight: 600; color: var(--text); }
.source-tool { font-family: var(--mono); font-size: 11.5px; color: var(--text-3); }
.source-meta { margin-left: auto; display: flex; align-items: center; gap: 6px; color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.source-meta svg { width: 14px; height: 14px; }
.source[data-state="error"] .source-meta, .source-err { color: var(--danger); }
.source-rows { display: grid; grid-template-columns: 68px 1fr; gap: 5px 12px; margin: 10px 0 0; }
.source-rows:empty { display: none; }
.source-rows dt { color: var(--text-3); font-size: 12px; padding-top: 1px; }
.source-rows dd { margin: 0; color: var(--text-2); min-width: 0; overflow-wrap: anywhere; }
.source-rows pre, .source-raw pre {
  margin: 0; padding: 8px 10px;
  background: var(--code-bg); border: 1px solid var(--border); border-radius: 8px;
  font-family: var(--mono); font-size: 12px; color: var(--text-2);
  white-space: pre-wrap; word-break: break-word;
}
.source-raw { margin-top: 10px; }
.source-raw summary { cursor: pointer; font-size: 12px; color: var(--text-3); width: fit-content; }
.source-raw summary:hover { color: var(--accent); }
.source-raw[open] summary { margin-bottom: 6px; }

/* Notices */
.notice {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 13px;
  border-radius: 10px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13.5px;
}
.notice svg { margin-top: 2px; width: 16px; height: 16px; }
.notice.muted { background: var(--surface-2); color: var(--text-2); }

.typing { display: flex; gap: 5px; padding: 8px 0; }
.typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); animation: blink 1.2s infinite ease-in-out; }
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }

/* Composer */
.composer { flex-shrink: 0; padding: 8px 24px 14px; padding-bottom: max(14px, env(safe-area-inset-bottom)); }
.composer-box {
  max-width: 752px; margin: 0 auto;
  display: flex; align-items: flex-end; gap: 8px;
  padding: 8px 8px 8px 16px;
  border: 1px solid var(--border-strong);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: border-color 0.15s;
}
.composer-box:focus-within { border-color: var(--accent); }
.composer textarea {
  flex: 1;
  border: 0; outline: 0; resize: none;
  background: transparent; color: var(--text);
  font: inherit; line-height: 1.5;
  padding: 6px 0;
  max-height: 200px;
}
.composer textarea::placeholder { color: var(--text-3); }
.send-btn {
  display: grid; place-items: center;
  width: 36px; height: 36px; flex-shrink: 0;
  border: 0; border-radius: 50%;
  background: var(--accent); color: var(--on-accent);
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}
.send-btn:hover:not(:disabled) { background: var(--accent-hover); }
.send-btn:disabled { opacity: 0.35; cursor: default; }
.send-btn svg { stroke-width: 2.2; }
.send-btn.stop svg { fill: currentColor; stroke-width: 0; }
.hint { max-width: 752px; margin: 7px auto 0; text-align: center; font-size: 11.5px; color: var(--text-3); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: 0.35; } }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }

/* Mobile */
.scrim { display: none; }
@media (max-width: 820px) {
  .only-mobile { display: grid; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 20;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow);
  }
  .app.sidebar-open .sidebar { transform: none; }
  .app.sidebar-open .scrim { display: block; position: fixed; inset: 0; z-index: 10; background: rgba(0, 0, 0, 0.35); }
  .topbar { padding: 0 10px; }
  .topbar-link { padding: 0 9px; }
  .topbar-link span { display: none; }
  .messages { padding: 20px 16px; gap: 22px; }
  .msg-assistant { gap: 10px; }
  .avatar { width: 26px; height: 26px; }
  .msg-user { max-width: 90%; }
  .empty { padding: 6vh 16px 16px; }
  .empty h2 { font-size: 22px; }
  .examples { grid-template-columns: 1fr; }
  .composer { padding-left: 12px; padding-right: 12px; }
  .source-rows { grid-template-columns: 60px 1fr; }
  .lane { padding: 12px 14px 10px; }
  .lane-hint { display: none; }
  .drawer {
    top: auto; left: 0; right: 0; width: 100%;
    max-height: 86dvh;
    border-left: 0; border-top: 1px solid var(--border);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.18);
    transform: translateY(100%);
  }
  .drawer-body { padding: 14px 14px max(20px, env(safe-area-inset-bottom)); }
  .drawer-head { padding: 14px 8px 12px 16px; }
  .hint-keys { display: none; }
}
