/* 法晓 · 普通人法律问答与模拟法庭 */

:root {
  --bg: #faf8f6;
  --surface: #ffffff;
  --text: #1c1917;
  --text-muted: #78716c;
  --primary: #c8281e;
  --primary-dark: #a01e16;
  --primary-light: #fef2f2;
  --primary-lighter: #fee2e2;
  --focus: rgba(200, 40, 30, .22);
  --accent: #b45309;
  --border: #e7e0da;
  --danger: #dc2626;
  --success: #059669;
  --radius: 14px;
  --layout-gutter: 5vw;
  --topbar-height: 68px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);
  --font: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: light; }
body { font-family: var(--font); background: var(--bg); color: var(--text); min-height: 100vh; display: flex; flex-direction: column; overflow-x: hidden; }
body.qa-active { overflow: hidden; }
button, textarea { font: inherit; }
button:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid var(--focus); outline-offset: 3px;
}
button:active:not(:disabled) { transform: translateY(1px); }
::selection { background: var(--primary-lighter); color: var(--text); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---- 顶栏 ---- */
.topbar {
  display: flex; align-items: center; gap: 24px;
  padding: 0 var(--layout-gutter); height: var(--topbar-height); min-height: var(--topbar-height);
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.brand { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 9px;
  background: var(--primary);
  color: #fff; display: grid; place-items: center;
  font-size: 19px; font-weight: 700;
  box-shadow: 0 2px 6px rgba(200,40,30,.3);
}
.brand-name { font-size: 18px; font-weight: 700; letter-spacing: .5px; }
.brand-name small { font-size: 11px; color: var(--text-muted); font-weight: 400; margin-left: 6px; letter-spacing: 0; }

.tabs { display: flex; gap: 4px; margin-left: auto; padding: 4px; background: #f5f0ec; border: 1px solid var(--border); border-radius: 11px; }
.tab {
  min-height: 44px; padding: 8px 18px; border: none; background: none; cursor: pointer;
  font-size: 14px; color: var(--text-muted); border-radius: 8px;
  font-family: var(--font); transition: all .2s; position: relative;
}
.tab:hover { background: var(--surface); color: var(--text); }
.tab.active { background: var(--surface); color: var(--primary); font-weight: 700; box-shadow: var(--shadow); }
.tab.active::after {
  content: ''; position: absolute; bottom: 3px; left: 40%; right: 40%;
  height: 2px; background: var(--primary); border-radius: 2px;
}

/* ---- Tab 面板 ---- */
.tab-panel { display: none; flex: 1; width: auto; margin: 0 var(--layout-gutter); padding: 32px 0; }
.tab-panel.active { display: block; }

/* ==================== 法律问答 ==================== */
.qa-panel { max-width: none; height: calc(100dvh - var(--topbar-height)); padding: 0; overflow: hidden; }
.qa-workspace {
  position: relative; display: grid; grid-template-columns: 248px minmax(0, 1fr) auto;
  width: 100%; height: calc(100dvh - var(--topbar-height)); overflow: hidden;
  background: var(--surface);
}

/* 对话历史 */
.conversation-sidebar {
  min-width: 0; min-height: 0; padding: 18px 12px; background: #f6f3f0;
  border-right: 1px solid var(--border); display: flex; flex-direction: column; overflow: hidden;
}
.conversation-sidebar-head { display: grid; gap: 14px; }
.new-conversation-btn {
  width: 100%; min-height: 44px; padding: 9px 12px; display: flex; align-items: center; gap: 10px;
  border: 1px solid #ecc9c5; border-radius: 10px; background: var(--primary-light);
  color: var(--primary-dark); cursor: pointer; font-weight: 700; text-align: left;
  transition: background .18s, border-color .18s, color .18s;
}
.new-conversation-btn:hover { background: var(--primary-lighter); border-color: #dfa49e; color: var(--primary); }
.new-conversation-btn svg, .conversation-search svg, .workspace-icon-btn svg,
.citations-toggle svg, .close-btn svg {
  width: 19px; height: 19px; flex: 0 0 auto; fill: none; stroke: currentColor;
  stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
}
.conversation-search {
  min-height: 42px; padding: 0 11px; display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text-muted);
}
.conversation-search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus); }
.conversation-search input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: 13px; }
.conversation-list-head { display: flex; justify-content: space-between; margin: 22px 8px 8px; color: var(--text-muted); font-size: 12px; font-weight: 600; }
.conversation-total { font-variant-numeric: tabular-nums; }
.conversation-list { min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; }
.conversation-item {
  width: 100%; min-height: 52px; padding: 9px 10px; border: 0; border-radius: 9px;
  background: transparent; color: var(--text); cursor: pointer; text-align: left;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 8px; align-items: center;
  transition: background .18s, color .18s;
}
.conversation-item:hover { background: rgba(255,255,255,.72); }
.conversation-item.active { background: var(--surface); color: var(--primary-dark); box-shadow: var(--shadow); }
.conversation-item-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 600; }
.conversation-item-time { color: var(--text-muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.conversation-empty { padding: 22px 10px; color: var(--text-muted); font-size: 12px; line-height: 1.7; text-align: center; }
.conversation-backdrop { display: none; }

/* 中央对话区：仅消息滚动，标题与输入框固定 */
.chat-area { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: #fcfbfa; overflow: hidden; }
.chat-head {
  flex: 0 0 auto; min-height: 62px; padding: 10px 24px; display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid var(--border); background: rgba(255,255,255,.96);
}
.chat-title-group { min-width: 0; }
.chat-title-group > span { display: block; margin-bottom: 2px; color: var(--primary); font-size: 10px; font-weight: 700; letter-spacing: .08em; }
.chat-title-group h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; line-height: 1.35; }
.workspace-icon-btn {
  width: 44px; height: 44px; display: none; place-items: center; border: 0; border-radius: 9px;
  background: transparent; color: var(--text-muted); cursor: pointer;
}
.workspace-icon-btn:hover { background: #f5f0ec; color: var(--text); }

.messages {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: 28px max(24px, calc((100% - 820px) / 2)) 30px;
  display: flex; flex-direction: column; gap: 16px; scroll-behavior: smooth;
}
.messages:has(> .welcome:only-child) { justify-content: center; }

.welcome { width: 100%; max-width: 820px; margin: 0 auto; text-align: left; padding: 24px 0 40px; }
.section-kicker { display: block; margin-bottom: 12px; color: var(--primary); font-size: 12px; line-height: 1; font-weight: 700; letter-spacing: .12em; }
.welcome h2 { font-size: 2.25rem; line-height: 1.25; letter-spacing: -.025em; margin-bottom: 14px; color: var(--text); }
.welcome > p { color: var(--text-muted); margin-bottom: 24px; font-size: 15px; line-height: 1.75; }
.question-groups { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; margin-top: 30px; }
.question-group { border-top: 1px solid var(--border); padding-top: 14px; }
.question-group h3 { color: var(--text); font-size: 13px; margin-bottom: 4px; }
.quick-questions { display: flex; flex-direction: column; }
.quick-btn {
  min-height: 40px; padding: 8px 0; border: 0; border-bottom: 1px solid var(--border); border-radius: 0;
  background: transparent; cursor: pointer; font-size: 13px; text-align: left;
  font-family: var(--font); color: var(--text-muted); transition: color .2s, background .2s;
}
.quick-btn:hover { color: var(--primary); background: var(--primary-light); }

.msg { width: min(100%, 760px); max-width: 85%; padding: 14px 18px; border-radius: var(--radius); line-height: 1.8; font-size: 14px; word-break: break-word; }
.msg.user { align-self: flex-end; background: var(--primary); color: #fff; box-shadow: 0 2px 8px rgba(200,40,30,.2); }
.msg.assistant { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.msg.user { white-space: pre-wrap; }
.msg.assistant.loading { color: var(--text-muted); }
.msg.assistant.loading::before {
  content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 9px;
  border-radius: 50%; background: var(--primary); vertical-align: 1px;
  animation: retrievalPulse 1.2s ease-in-out infinite;
}
.msg.assistant.streaming { min-width: 92px; }
.msg.assistant.streaming::after { content: ""; display: inline-block; width: 2px; height: 1.15em; margin-left: 3px; vertical-align: -0.2em; background: var(--primary); animation: answerCursor .8s steps(1) infinite; }
@keyframes answerCursor { 50% { opacity: 0; } }
@keyframes retrievalPulse { 50% { opacity: .28; transform: scale(.72); } }
.msg.assistant h1, .msg.assistant h2, .msg.assistant h3 { line-height: 1.35; color: var(--text); }
.msg.assistant h1 { font-size: 21px; margin: 4px 0 12px; }
.msg.assistant h2 { font-size: 18px; margin: 20px 0 8px; }
.msg.assistant h3 { font-size: 16px; margin: 16px 0 6px; }
.msg.assistant p { margin: 0 0 12px; }
.msg.assistant p:last-of-type { margin-bottom: 0; }
.msg.assistant ul, .msg.assistant ol { margin: 8px 0 14px 1.35em; }
.msg.assistant li + li { margin-top: 5px; }
.msg.assistant blockquote { margin: 12px 0; padding: 8px 12px; color: #57534e; background: #faf8f6; border-bottom: 2px solid var(--primary-lighter); }
.msg.assistant hr { height: 1px; margin: 18px 0; border: 0; background: var(--border); }
.msg.assistant pre { margin: 12px 0; padding: 12px; overflow-x: auto; background: #292524; color: #f5f5f4; border-radius: 8px; line-height: 1.65; white-space: pre; }
.msg.assistant code { padding: 1px 5px; background: #f5f0ec; border-radius: 4px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .9em; }
.msg.assistant pre code { padding: 0; background: transparent; color: inherit; }
.msg.assistant .md-table-wrap { margin: 14px 0; overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
.msg.assistant table { width: 100%; border-collapse: collapse; font-size: 13px; }
.msg.assistant th, .msg.assistant td { min-width: 110px; padding: 9px 11px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.msg.assistant th { background: #faf8f6; font-weight: 700; }
.msg.assistant tbody tr:last-child td { border-bottom: 0; }
.msg.assistant a { color: var(--primary); text-underline-offset: 2px; }
.msg.assistant .citation-ref { color: var(--primary); cursor: pointer; font-weight: 600; border: 0; padding: 0; background: transparent; font: inherit; text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 2px; }
.msg.assistant .citation-ref:hover { color: var(--primary-dark); background: var(--primary-light); border-radius: 3px; padding: 0 2px; }
.msg .msg-notice { font-size: 12px; color: var(--text-muted); margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }

.composer-dock { flex: 0 0 auto; padding: 12px 24px 18px; background: linear-gradient(to bottom, rgba(252,251,250,0), #fcfbfa 18px); }
.composer { width: min(100%, 820px); margin: 0 auto; padding: 12px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-md); }
.composer textarea {
  width: 100%; min-height: 64px; padding: 8px 10px; border: 0; border-radius: 8px;
  font-family: var(--font); font-size: 14px; resize: none; outline: none;
  transition: box-shadow .2s; background: var(--surface); caret-color: var(--primary);
}
.composer:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus), var(--shadow-md); }
.composer-bottom { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.disclaimer { font-size: 12px; color: var(--text-muted); }
.send-btn {
  min-height: 42px; padding: 9px 22px; background: var(--primary); color: #fff; border: none;
  border-radius: 10px; cursor: pointer; font-size: 14px; font-weight: 600; font-family: var(--font);
  transition: all .2s; box-shadow: 0 2px 6px rgba(200,40,30,.25);
}
.send-btn:hover:not(:disabled) { background: var(--primary-dark); box-shadow: 0 4px 12px rgba(200,40,30,.25); }
.send-btn:disabled { opacity: .4; cursor: not-allowed; transform: none; box-shadow: none; }

/* 右侧引用：默认只显示窄栏 */
.citations-rail { min-width: 52px; min-height: 0; display: flex; align-items: flex-start; border-left: 1px solid var(--border); background: var(--surface); overflow: hidden; }
.citations-toggle {
  width: auto; min-width: 52px; min-height: 116px; padding: 14px 10px; border: 0; background: transparent;
  color: var(--primary); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 700; transition: background .18s, color .18s;
}
.citations-toggle span { white-space: nowrap; }
.citations-toggle:hover:not(:disabled) { background: var(--primary-light); }
.citations-toggle:disabled { color: #c9c1bb; cursor: default; }
.citations-count {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--primary);
  color: #fff; display: inline-grid; place-items: center; font-size: 10px; font-variant-numeric: tabular-nums;
}
.citations-count:empty { display: none; }
.citations-rail.open .citations-toggle { display: none; }
.citations-panel {
  width: 360px; height: 100%; min-height: 0; background: var(--surface);
  display: flex; flex-direction: column; overflow: hidden;
}
.citations-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--border); background: #faf8f6; }
.citations-head h3 { font-size: 15px; color: var(--primary); }
.citations-panel-count { margin-left: 5px; color: var(--text-muted); font-size: 11px; font-weight: 500; }
.close-btn { width: 44px; height: 44px; display: grid; place-items: center; background: none; border: none; border-radius: 8px; cursor: pointer; color: var(--text-muted); transition: color .15s, background .15s; }
.close-btn:hover { color: var(--text); background: #f5f0ec; }
.citations-list { flex: 1; min-height: 0; overflow-y: auto; padding: 2px 18px 20px; }
.citation-item { min-width: 0; padding: 17px 0 18px; border-bottom: 1px solid var(--border); transition: background .25s, box-shadow .25s; }
.citation-item:last-child { border-bottom: 0; }

/* 法律原文浏览（资料列表 / 原文阅读） */
.kb-back { display: inline-block; margin: 12px 0 2px; padding: 5px 12px; font-size: 12px; font-weight: 500; color: var(--primary); background: transparent; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; }
.kb-back:hover { background: var(--primary-light); }
.kb-source-btn { display: flex; flex-direction: column; gap: 3px; width: 100%; text-align: left; padding: 10px 12px; margin: 8px -12px 0; background: transparent; border: 0; border-radius: 10px; cursor: pointer; font: inherit; }
.kb-source-btn:hover { background: var(--primary-light); }
.kb-source-title { font-size: 13px; font-weight: 600; color: var(--text); }
.kb-source-meta { font-size: 11px; color: var(--text-muted); }
.kb-notice { padding: 16px 4px; font-size: 13px; color: var(--text-muted); }
.kb-doc { padding-top: 4px; }
.kb-doc-title { margin: 8px 0 10px; font-size: 14px; font-weight: 700; color: var(--primary); }
.kb-chunk-section { margin: 16px 0 5px; font-size: 12.5px; font-weight: 700; color: var(--text); }
.kb-chunk-text { margin: 0 0 9px; font-size: 12.5px; line-height: 1.75; color: var(--text); white-space: pre-wrap; }

.citation-item.highlight { margin: 0 -10px; padding-inline: 10px; background: var(--primary-light); box-shadow: 0 3px 10px rgba(200,40,30,.1); }
.citation-meta { display: flex; align-items: center; gap: 9px; }
.citation-item .label {
  min-width: 30px; height: 24px; padding: 0 7px; display: inline-grid; place-items: center;
  border-radius: 6px; background: var(--primary); color: #fff; font-size: 11px; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.citation-item .article { min-width: 0; color: var(--text); font-size: 14px; line-height: 1.45; }
.citation-source { margin-top: 8px; color: var(--text-muted); font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; }
.citation-item .excerpt { margin-top: 8px; font-size: 13px; line-height: 1.8; color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }
.citation-badge {
  flex: none; margin-left: auto; padding: 2px 7px; border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  color: var(--primary); font-size: 10px; font-weight: 700; letter-spacing: .08em;
}
.citation-link {
  display: inline-block; margin-top: 9px; color: var(--primary);
  font-size: 12px; font-weight: 600; text-decoration: none;
}
.citation-link:hover, .citation-link:focus-visible { text-decoration: underline; }
.conversation-loading { margin: auto; padding: 24px; color: var(--text-muted); font-size: 13px; }
.conversation-loading.error { color: var(--danger); }

/* ==================== 模拟法庭 ==================== */
.court-select { max-width: 800px; padding: 40px 0; }
.court-select h2 { font-size: 2.25rem; line-height: 1.25; letter-spacing: -.025em; margin-bottom: 12px; }
.muted { color: var(--text-muted); font-size: 14px; }
.court-safety { max-width: 620px; margin: 14px 0 0; color: var(--text-muted); font-size: 13px; line-height: 1.65; }

.case-cards { display: grid; grid-template-columns: minmax(0, 560px); gap: 20px; margin-top: 36px; }
.case-card {
  width: 100%; padding: 26px 28px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); cursor: pointer; text-align: left;
  transition: border-color .2s, box-shadow .2s; box-shadow: none; font-family: var(--font); color: var(--text);
}
.case-card:hover { border-color: var(--primary); box-shadow: 0 10px 24px rgba(120, 45, 32, .08); }
.case-card:focus-visible { border-color: var(--primary); }
.case-card h3 { font-size: 19px; margin-bottom: 4px; }
.case-card .subtitle { color: var(--text-muted); font-size: 13px; margin-bottom: 14px; }
.case-card .theme { display: inline-block; padding: 4px 12px; background: var(--primary-light); color: var(--primary); border-radius: 6px; font-size: 12px; font-weight: 600; margin-bottom: 14px; }
.case-card .charge { font-size: 13px; color: var(--accent); margin-bottom: 10px; font-weight: 600; }
.case-card .learning-goal { font-size: 13px; line-height: 1.65; margin-bottom: 12px; }
.case-card .facts-preview { font-size: 13px; color: var(--text-muted); line-height: 1.7; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.case-card .duration { font-size: 12px; color: var(--text-muted); margin-top: 14px; }
.case-card .entry-note { font-size: 12px; color: var(--text-muted); line-height: 1.55; margin-top: 10px; }
.case-card .disclaimer { font-size: 11px; color: var(--text-muted); margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.case-action { display: inline-flex; align-items: center; min-height: 40px; margin-top: 18px; padding: 0 16px; border-radius: 9px; background: var(--primary); color: #fff; font-size: 13px; font-weight: 700; }

/* 角色选择 */
.role-select { max-width: 860px; padding: 28px 0 48px; }
.role-select h2 { margin-bottom: 10px; font-size: 2rem; line-height: 1.3; letter-spacing: -.02em; }
.back-btn {
  min-height: 40px; margin-bottom: 30px; padding: 0; border: 0; background: transparent;
  color: var(--text-muted); cursor: pointer; font-size: 13px;
}
.back-btn:hover { color: var(--primary); }
.role-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 28px; }
.role-option {
  position: relative; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 14px;
  min-height: 104px; padding: 18px; border: 1.5px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text); text-align: left; cursor: pointer;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.role-option:hover { border-color: #d8b1ac; box-shadow: var(--shadow); }
.role-option.selected { border-color: var(--primary); background: var(--primary-light); box-shadow: 0 0 0 3px var(--focus); }
.role-sigil {
  width: 42px; height: 42px; display: inline-grid; place-items: center; border-radius: 50%;
  background: #f5f0ec; color: var(--primary); font-size: 15px; font-weight: 800;
}
.role-option.selected .role-sigil { background: var(--primary); color: #fff; }
.role-option.audience-option { grid-column: 1 / -1; }
.role-copy { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.role-copy strong { font-size: 15px; }
.role-copy small { color: var(--text-muted); font-size: 12px; line-height: 1.6; }
.role-tag {
  position: absolute; top: 12px; right: 12px; padding: 3px 8px; border-radius: 5px;
  background: #f5f0ec; color: var(--text-muted); font-size: 10px; font-weight: 600;
}
.role-start { max-width: 360px; margin-top: 22px; }
.primary-btn:disabled { opacity: .42; cursor: not-allowed; box-shadow: none; }

/* 庭审（法庭式布局） */
.court-trial { display: flex; flex-direction: column; gap: 18px; }
.court-header { border-bottom: 2px solid var(--border); padding-bottom: 14px; }
.court-header-row { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.court-header-row h2 { font-size: 19px; }
.court-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.text-btn { min-height: 44px; padding: 6px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text-muted); cursor: pointer; }
.text-btn:hover { color: var(--primary); border-color: var(--primary); }
.pause-btn { display: inline-flex; align-items: center; gap: 7px; color: var(--text); }
.pause-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pause-btn.paused { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }
.pause-btn:disabled { color: #b8b0a4; background: #faf8f6; cursor: not-allowed; }
.phase-badge { padding: 4px 14px; background: var(--primary); color: #fff; border-radius: 6px; font-size: 12px; font-weight: 600; box-shadow: 0 2px 4px rgba(200,40,30,.2); }
.player-role-badge { padding: 4px 10px; border: 1px solid var(--border); border-radius: 6px; color: var(--text-muted); font-size: 11px; font-weight: 600; }

.phase-steps { display: flex; gap: 6px; list-style: none; flex-wrap: wrap; }
.phase-steps li { padding: 5px 14px; font-size: 12px; border-radius: 16px; background: var(--surface); border: 1.5px solid var(--border); color: var(--text-muted); transition: all .25s; }
.phase-steps li.done { border-color: #fecaca; color: var(--primary); background: var(--primary-light); }
.phase-steps li.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; box-shadow: 0 2px 6px rgba(200,40,30,.2); }

.courtroom-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: stretch; }

/* ---- 法庭场景 ---- */
.court-scene {
  background: #fffdf9;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  padding: 20px; display: flex; flex-direction: column; gap: 16px;
  box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.court-scene::before { content: ''; position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 28px rgba(200,40,30,.035); }

.bench {
  background: var(--surface); border: 2px solid var(--border); border-radius: 12px;
  padding: 10px 16px; display: flex; align-items: center; gap: 10px;
  transition: all .3s; position: relative;
}
.bench .emblem, .speech-sigil {
  width: 30px; height: 30px; display: inline-grid; place-items: center; flex-shrink: 0;
  border-radius: 50%; background: #f5f0ec; color: var(--primary); font-size: 13px; line-height: 1; font-weight: 800;
}
.bench-name { font-size: 13px; font-weight: 700; line-height: 1.35; }
.bench-name small { display: block; font-size: 11px; color: var(--text-muted); font-weight: 400; }

.bench.speaking { transform: translateY(-3px); box-shadow: 0 6px 18px rgba(200,40,30,.18); }
.bench.is-player { border-color: var(--primary); }
.bench.is-player::before {
  content: '你的角色'; position: absolute; right: 8px; bottom: -9px; z-index: 2;
  padding: 2px 7px; border-radius: 5px; background: var(--text); color: #fff;
  font-size: 9px; font-weight: 700; letter-spacing: .04em;
}
.bench.speaking::after {
  content: '发言中'; position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  background: var(--primary); color: #fff; font-size: 10px; padding: 2px 10px;
  border-radius: 10px; letter-spacing: 1px;
}

.scene-top { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; }
.judge-bench { grid-column: 2; border-color: #fde68a; background: #fffbeb; padding: 12px 28px; }
.judge-bench .emblem { width: 36px; height: 36px; font-size: 14px; background: #fef3c7; color: #92400e; }
.bench[data-role="judge"].speaking { border-color: #d97706; box-shadow: 0 6px 18px rgba(217,119,6,.22); }
.bench[data-role="judge"].speaking::after { background: #d97706; }
.juror-bench { justify-self: end; border-style: dashed; border-color: var(--primary-lighter); background: var(--primary-light); }
.juror-bench.speaking, .bench[data-role="juror"].speaking { border-color: var(--primary); border-style: solid; }
.clerk-chip { justify-self: start; border-style: dashed; font-size: 12px; color: var(--text-muted); padding: 6px 12px; }
.bench[data-role="clerk"].speaking { border-color: var(--text-muted); }
.bench[data-role="clerk"].speaking::after { background: var(--text-muted); }

.scene-mid { display: grid; grid-template-columns: 128px minmax(0, 1fr) 128px; gap: 14px; align-items: stretch; flex: 1; }
.side-bench { flex-direction: column; text-align: center; justify-content: center; gap: 8px; padding: 16px 10px; }
.prosecutor-bench { border-color: #fecaca; background: var(--primary-light); }
.bench[data-role="prosecutor"].speaking { border-color: var(--primary); box-shadow: 0 6px 18px rgba(200,40,30,.28); }
.defender-bench { border-color: #a7f3d0; background: #ecfdf5; }
.bench[data-role="defender"].speaking { border-color: #059669; box-shadow: 0 6px 18px rgba(5,150,105,.25); }
.bench[data-role="defender"].speaking::after { background: #059669; }

.speech-zone { min-width: 0; border: 1.5px solid var(--border); border-radius: var(--radius); background: var(--surface); display: flex; flex-direction: column; overflow: hidden; transition: border-color .2s, box-shadow .2s; }
.speech-zone.awaiting-input { border-color: var(--primary); box-shadow: 0 4px 18px rgba(200,40,30,.1); }
.speech-zone.playback-paused { border-color: var(--accent); }
.speech-plate {
  display: flex; align-items: center; gap: 8px; padding: 9px 16px;
  background: #faf8f6; border-bottom: 1px solid var(--border);
  font-weight: 700; font-size: 13.5px; letter-spacing: .5px;
}
.speech-text {
  flex: 1; padding: 18px 22px; font-size: 15.5px; line-height: 2.05;
  overflow-y: auto; min-height: 170px; max-height: 340px; white-space: pre-wrap; overflow-wrap: anywhere;
}
.speech-action { flex: 1; min-height: 250px; max-height: 460px; overflow-y: auto; }

.scene-bottom { display: flex; justify-content: center; }
.defendant-bench { border-color: #fbcfe8; background: #fdf2f8; min-width: 190px; justify-content: center; }
.bench[data-role="defendant"].speaking { border-color: #be185d; box-shadow: 0 6px 18px rgba(190,24,93,.25); }
.bench[data-role="defendant"].speaking::after { background: #be185d; }

/* ---- 卷宗面板 ---- */
.dossier-panel {
  background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius);
  padding: 16px; display: flex; flex-direction: column; gap: 14px;
  overflow-y: auto; max-height: 660px;
}
.dossier-panel h3 { font-size: 13px; color: var(--primary); }
.dossier-panel h3 small { display: block; color: var(--text-muted); font-weight: 400; font-size: 11px; margin-top: 3px; line-height: 1.5; }
.facts-card summary { cursor: pointer; font-size: 13px; font-weight: 700; color: var(--primary); }
.facts-card p { font-size: 12.5px; line-height: 1.8; color: var(--text); margin-top: 8px; }
.dispute-list { list-style: none; display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.dispute-list li {
  font-size: 12.5px; line-height: 1.65; padding: 8px 12px;
  background: var(--primary-light); border: 1px solid var(--primary-lighter); border-radius: 6px;
}

.evidence-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.evidence-card { border: 1.5px solid var(--border); border-radius: 10px; overflow: hidden; transition: all .25s; background: var(--surface); }
.evidence-card .ev-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; cursor: pointer; }
.ev-type { font-size: 12.5px; font-weight: 650; flex: 1; line-height: 1.45; }
.ev-star { border: none; background: none; cursor: pointer; font-size: 16px; color: #d6d0c8; padding: 2px; line-height: 1; min-width: 44px; min-height: 44px; }
.evidence-card.marked .ev-star { color: #f59e0b; }
.ev-body { display: none; padding: 2px 12px 10px; font-size: 12px; line-height: 1.75; color: var(--text); }
.evidence-card.open .ev-body { display: block; }
.evidence-card.cited { border-color: var(--primary); animation: evFlash 1.2s ease; }
.evidence-card.cited .ev-type { color: var(--primary); }
.evidence-card.marked { border-color: #f59e0b; }
@keyframes evFlash { 0% { transform: scale(1.03); box-shadow: 0 0 0 6px rgba(200,40,30,.22); } 100% { box-shadow: none; } }

/* ---- 中央发言区的检查点输入 ---- */
.cp-card {
  width: 100%; padding: 18px 20px 20px; background: var(--surface); animation: cpIn .28s cubic-bezier(.22,1,.36,1);
}
@keyframes cpIn { from { opacity: .2; transform: translateY(7px); } to { opacity: 1; transform: none; } }
.cp-title { font-size: 16px; font-weight: 800; color: var(--primary); margin-bottom: 6px; }
.cp-role-head { display: flex; align-items: flex-start; gap: 14px; }
.cp-role-head .role-sigil { flex: 0 0 auto; }
.role-cp-card .cp-question { position: relative; }
.role-cp-card textarea { min-height: 112px; padding-bottom: 30px; line-height: 1.7; }
.statement-count { position: absolute; right: 12px; bottom: 10px; color: var(--text-muted); font-size: 11px; }
.cp-quote { font-size: 13px; color: var(--text-muted); margin-bottom: 16px; line-height: 1.7; }
.cp-prev { font-size: 12.5px; color: var(--accent); background: #fffbeb; border: 1px dashed #fde68a; padding: 8px 12px; border-radius: 8px; margin-bottom: 10px; }
.cp-label { font-size: 13px; font-weight: 700; margin: 14px 0 8px; }
.cp-label small { color: var(--text-muted); font-weight: 400; }
.cp-options { display: flex; flex-direction: column; gap: 10px; }
.cp-option {
  display: flex; flex-direction: column; gap: 3px; padding: 11px 14px;
  border: 2px solid var(--border); border-radius: 10px; cursor: pointer;
  transition: all .2s; background: var(--surface); text-align: left; font-family: var(--font);
}
.cp-option:hover { border-color: var(--primary); background: var(--primary-light); }
.cp-option.selected { border-color: var(--primary); background: var(--primary-light); box-shadow: 0 0 0 3px rgba(200,40,30,.1); }
.cp-option .cp-opt-label { font-weight: 700; font-size: 14px; }
.cp-option .cp-opt-detail { font-size: 12px; color: var(--text-muted); }
.cp-opt-statement { margin-top: 4px; color: #57534e; font-size: 12px; line-height: 1.65; }
.role-statement-options { gap: 8px; }
.role-statement-option { padding: 10px 12px; }
.custom-statement-option .cp-opt-label { color: var(--primary); }
.custom-statement { position: relative; margin-top: 12px; }
.custom-statement .cp-label { display: block; margin-top: 0; }
.cp-question textarea {
  width: 100%; padding: 11px 14px; border: 1.5px solid var(--border); border-radius: 10px;
  font-family: var(--font); font-size: 13.5px; resize: none; outline: none;
  transition: all .2s; background: var(--surface);
}
.cp-question textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(200,40,30,.1); }
.cp-target { display: flex; gap: 16px; margin-top: 10px; font-size: 13px; align-items: center; }
.cp-target label { cursor: pointer; }
.cp-target input[type="radio"] { accent-color: var(--primary); margin-right: 4px; }
#cp-submit { margin-top: 20px; }

/* ---- 庭审记录 ---- */
.court-log { background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius); }
.court-log summary { cursor: pointer; padding: 12px 18px; font-size: 13px; font-weight: 600; color: var(--text-muted); user-select: none; }
.court-log[open] summary { border-bottom: 1px solid var(--border); color: var(--text); }
.court-log-list { padding: 14px 18px; display: flex; flex-direction: column; gap: 10px; max-height: 320px; overflow-y: auto; }
.log-line { font-size: 13px; line-height: 1.8; color: var(--text); }
.log-line b { margin-right: 4px; }
.log-line.judge b { color: #b45309; }
.log-line.prosecutor b { color: var(--primary); }
.log-line.defender b { color: #059669; }
.log-line.defendant b { color: #be185d; }
.log-line.clerk b { color: var(--text-muted); }
.log-line.player-line { padding: 10px 12px; border: 1px solid var(--primary-lighter); border-radius: 8px; background: var(--primary-light); }

/* ---- 预判轨迹 ---- */
.delib-traj, .verdict-trajectory { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; margin-bottom: 22px; }
.traj-chip { padding: 6px 14px; border-radius: 16px; font-size: 12.5px; background: var(--primary-light); color: var(--primary); border: 1px solid #fecaca; font-weight: 600; }
.traj-chip.final { background: var(--primary); color: #fff; border-color: var(--primary); }
.traj-chip.real { background: #f0fdf4; color: var(--success); border-color: #bbf7d0; }
.traj-arrow { color: var(--text-muted); font-size: 12px; }

.court-status { padding: 10px 18px; display: flex; align-items: center; gap: 10px; }
.typing-indicator { color: var(--primary); animation: blink 1.2s infinite; font-size: 12px; letter-spacing: 3px; }
@keyframes blink { 0%, 100% { opacity: .3; } 50% { opacity: 1; } }

/* 评议 */
.deliberation { max-width: 620px; margin: 40px auto; padding: 36px; background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow-md); }
.deliberation h2 { text-align: center; margin-bottom: 10px; }
.deliberation .muted { text-align: center; margin-bottom: 28px; }

.delib-options { display: flex; flex-direction: column; gap: 14px; margin-bottom: 24px; }
.delib-option {
  display: block; padding: 16px 18px; border: 2px solid var(--border); border-radius: var(--radius);
  cursor: pointer; transition: all .2s;
}
.delib-option:hover { border-color: var(--primary); background: var(--primary-light); }
.delib-option input[type="radio"] { margin-right: 10px; accent-color: var(--primary); }
.delib-option .option-label { font-weight: 600; font-size: 15px; }
.delib-option .option-detail { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.delib-option.selected { border-color: var(--primary); background: var(--primary-light); box-shadow: 0 0 0 3px rgba(200,40,30,.1); }

.delib-years { margin-bottom: 24px; }
.delib-years label { display: block; font-size: 14px; margin-bottom: 10px; font-weight: 600; }
.delib-years input[type="range"] { width: 100%; accent-color: var(--primary); }
.years-range { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted); }

.primary-btn {
  width: 100%; min-height: 48px; padding: 14px; background: var(--primary); color: #fff; border: none;
  border-radius: 10px; cursor: pointer; font-size: 15px; font-weight: 700;
  font-family: var(--font); transition: all .2s; box-shadow: 0 2px 8px rgba(200,40,30,.25);
}
.primary-btn:hover:not(:disabled) { background: var(--primary-dark); box-shadow: 0 4px 14px rgba(200,40,30,.28); }

/* 判决对照 */
.verdict { max-width: 820px; margin: 0 auto; padding: 28px; }
.verdict h2 { text-align: center; margin-bottom: 28px; }

.verdict-cards { display: flex; gap: 18px; margin-bottom: 28px; }
.verdict-card { flex: 1; padding: 22px; border-radius: var(--radius); border: 1.5px solid var(--border); }
.verdict-card h3 { font-size: 14px; margin-bottom: 10px; }
.verdict-card p { font-size: 14px; line-height: 1.8; }
.verdict-card.yours { background: var(--primary-light); border-color: #fecaca; }
.verdict-card.yours h3 { color: var(--primary); }
.verdict-card.real { background: #f0fdf4; border-color: #bbf7d0; }
.verdict-card.real h3 { color: var(--success); }

.verdict-reasoning { padding: 22px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 28px; box-shadow: var(--shadow); }
.verdict-reasoning h3 { font-size: 14px; margin-bottom: 10px; color: var(--accent); }
.verdict-reasoning p { font-size: 14px; line-height: 1.9; margin-bottom: 18px; }

.verdict-analysis { padding: 22px; background: #fffbeb; border: 1px solid #fde68a; border-radius: var(--radius); margin-bottom: 28px; }
.verdict-analysis h3 { font-size: 14px; margin-bottom: 14px; }
.analysis-content { font-size: 14px; line-height: 1.9; white-space: pre-wrap; }

.outline-btn {
  display: block; margin: 0 auto; padding: 12px 36px; background: none;
  border: 2px solid var(--primary); color: var(--primary); border-radius: 10px;
  cursor: pointer; font-size: 14px; font-weight: 600; font-family: var(--font); transition: all .2s;
}
.outline-btn:hover { background: var(--primary); color: #fff; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(200,40,30,.3); }

/* Toast */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  padding: 12px 28px; background: var(--text); color: #fff; border-radius: 10px;
  font-size: 14px; z-index: 240; animation: fadeIn .25s; box-shadow: var(--shadow-md);
}
@keyframes fadeIn { from { opacity: 0; transform: translateX(-50%) translateY(10px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* 设置与诊断抽屉 */
.settings-button {
  width: 44px; height: 44px; flex: 0 0 auto; display: grid; place-items: center;
  background: none; border: none; border-radius: 10px; cursor: pointer;
  color: var(--text-muted); transition: color .15s, background .15s;
}
.settings-button:hover { color: var(--primary); background: var(--primary-light); }
.settings-button svg { width: 21px; height: 21px; }
.settings-backdrop {
  position: fixed; inset: 0; z-index: 210; display: block;
  border: 0; background: rgba(28,25,23,.28); cursor: default;
}
.settings-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 220;
  width: min(92vw, 380px); display: flex; flex-direction: column;
  background: var(--surface); border-left: 1px solid var(--border);
  box-shadow: -12px 0 34px rgba(28,25,23,.14);
  animation: drawerIn .28s cubic-bezier(.22,1,.36,1);
}
@keyframes drawerIn { from { transform: translateX(24px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.settings-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border); flex: 0 0 auto;
}
.settings-head h2 { font-size: 16px; letter-spacing: .3px; }
.settings-body { flex: 1; min-height: 0; overflow-y: auto; padding: 6px 18px 20px; }
.settings-section { padding: 14px 0; }
.settings-section + .settings-section { border-top: 1px solid var(--border); }
.settings-section h3 {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; color: var(--text-muted); letter-spacing: 1px; margin-bottom: 4px;
}
.logs-refresh {
  border: 1px solid var(--border); background: var(--surface); color: var(--text-muted);
  font-size: 12px; padding: 4px 12px; border-radius: 999px; cursor: pointer;
  transition: color .15s, border-color .15s;
}
.logs-refresh:hover { color: var(--primary); border-color: #dfa49e; }
.settings-hint { font-size: 12px; color: var(--text-muted); line-height: 1.6; margin-bottom: 8px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 0; }
.setting-row + .setting-row { border-top: 1px solid var(--border); }
.setting-info { display: grid; gap: 3px; min-width: 0; }
.setting-info strong { font-size: 14px; }
.setting-info small { font-size: 12px; color: var(--text-muted); line-height: 1.55; }
.setting-row.unavailable .setting-info strong { color: var(--text-muted); }
.setting-toggle { position: relative; flex: 0 0 auto; display: inline-flex; }
.setting-toggle input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.setting-toggle input:disabled { cursor: not-allowed; }
.setting-track {
  display: block; width: 44px; height: 26px; border-radius: 13px;
  background: #d9d2cb; position: relative; transition: background .18s;
}
.setting-track::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25);
  transition: transform .18s;
}
.setting-toggle input:checked + .setting-track { background: var(--success); }
.setting-toggle input:checked + .setting-track::after { transform: translateX(18px); }
.setting-toggle input:disabled + .setting-track { opacity: .45; }
.setting-toggle input:focus-visible + .setting-track { outline: 3px solid var(--focus); outline-offset: 2px; }
.settings-log {
  max-height: 340px; overflow-y: auto; padding: 10px 12px;
  background: #faf7f4; border: 1px solid var(--border); border-radius: 10px;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Courier New", monospace;
  font-size: 11px; line-height: 1.75; color: #57534e;
}
.log-line { display: block; padding: 5px 0; }
.log-line + .log-line { border-top: 1px dashed #ece5de; }
.log-time { display: block; color: #a8a29e; white-space: nowrap; }
.log-msg { display: block; white-space: pre-wrap; word-break: break-word; }
.log-warning { color: var(--accent); }
.log-error { color: var(--danger); font-weight: 600; }

/* 滚动条 */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d6d0c8; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #b8b0a4; }

/* 响应式 */
@media (max-width: 1024px) {
  .qa-workspace { grid-template-columns: minmax(0, 1fr) auto; }
  .conversation-menu { display: grid; }
  .conversation-sidebar {
    position: fixed; inset: var(--topbar-height) auto 0 0; z-index: 170;
    width: min(84vw, 300px); transform: translateX(-102%);
    box-shadow: 12px 0 34px rgba(28,25,23,.14);
    transition: transform .24s cubic-bezier(.22,1,.36,1);
  }
  .conversation-sidebar.open { transform: translateX(0); }
  .conversation-backdrop {
    position: fixed; inset: var(--topbar-height) 0 0; z-index: 165;
    display: block; border: 0; background: rgba(28,25,23,.28); cursor: default;
  }
}
@media (max-width: 960px) {
  .courtroom-wrap { grid-template-columns: 1fr; }
  .dossier-panel { max-height: none; }
  .scene-mid { grid-template-columns: 1fr; }
  .side-bench { flex-direction: row; justify-content: center; padding: 10px; }
  .scene-top { grid-template-columns: 1fr; justify-items: center; gap: 8px; }
  .judge-bench { grid-column: 1; }
  .juror-bench, .clerk-chip { justify-self: center; }
}
@media (max-width: 768px) {
  .tab-panel.qa-panel { height: calc(100dvh - var(--topbar-height)); padding: 0; }
  .chat-head { min-height: 58px; padding: 8px 14px; }
  .messages { padding: 20px 18px 24px; }
  .messages:has(> .welcome:only-child) { justify-content: flex-start; }
  .welcome, .court-select { padding: 24px 0; }
  .welcome h2, .court-select h2 { font-size: 1.75rem; }
  .question-groups { grid-template-columns: 1fr; gap: 18px; }
  .msg { max-width: 94%; }
  .composer-dock { padding: 8px 12px 12px; }
  .citations-rail { min-width: 48px; }
  .citations-toggle { width: 48px; min-height: 108px; }
  .citations-panel {
    position: fixed; inset: auto 12px 12px; z-index: 180;
    width: auto; max-height: min(72dvh, 620px);
    border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: 0 18px 48px rgba(28,25,23,.2), 0 4px 12px rgba(28,25,23,.1);
  }
  .verdict-cards { flex-direction: column; }
  .case-cards { grid-template-columns: minmax(0, 1fr); }
  .role-options { grid-template-columns: 1fr; }
  .role-option.audience-option { grid-column: auto; }
  .role-select { padding: 20px 0 36px; }
  .role-select h2 { font-size: 1.75rem; }
  .topbar { gap: 12px; padding: 0 var(--layout-gutter); }
  .tab { padding: 6px 14px; font-size: 13px; }
  .tab-panel:not(.qa-panel) { padding: 16px 0; }
}
@media (max-width: 520px) {
  :root { --topbar-height: 60px; }
  .topbar { height: var(--topbar-height); min-height: var(--topbar-height); flex-wrap: nowrap; padding: 8px var(--layout-gutter); gap: 8px; }
  .brand { gap: 8px; }
  .brand-mark { width: 34px; height: 34px; font-size: 17px; }
  .brand-name { font-size: 16px; }
  .brand-name small { display: none; }
  .tabs { flex: 1; min-width: 0; }
  .tab { min-width: 0; min-height: 40px; padding: 6px 8px; flex: 1; font-size: 12px; white-space: nowrap; }
  .court-header-row { align-items: flex-start; flex-wrap: wrap; }
  .court-actions { width: 100%; margin-left: 0; }
  .court-actions .text-btn { flex: 1; }
  .player-role-badge { order: 4; }
  .speech-action { max-height: 520px; }
  .cp-card { padding: 16px; }
  .composer-bottom { align-items: flex-end; gap: 12px; }
  .disclaimer { flex: 1; min-width: 0; max-width: 180px; line-height: 1.5; }
  .send-btn { flex: 0 0 auto; padding-inline: 16px; }
  .composer textarea { min-height: 56px; font-size: 16px; }
  .chat-title-group h2 { max-width: 185px; }
  .case-card { padding: 22px 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .quick-btn, .case-card, .bench, .evidence-card, .cp-option, .delib-option,
  .primary-btn, .outline-btn, .text-btn { transition: none; }
  .evidence-card.cited, .cp-card, .typing-indicator, .toast,
  .msg.assistant.loading::before, .msg.assistant.streaming::after { animation: none; }
  .conversation-sidebar { transition: none; }
  .settings-drawer { animation: none; }
  .setting-track, .setting-track::after { transition: none; }
}
