:root {
  --bg: #f3f1ec;
  --panel: #ffffff;
  --ink: #1f2328;
  --muted: #6b6f76;
  --line: #e3dfd6;
  --zheng: #c0392b;
  --zheng-soft: #fbefed;
  --fan: #2c5fcc;
  --fan-soft: #edf2fc;
  --chair: #9a6b12;
  --chair-soft: #fbf5e7;
  --judge: #6d4c9f;
  --judge-soft: #f4f0fa;
  --debrief: #0b8a78;
  --user: #d9761a;
  --accent: #1f2328;
  --focus: #2c5fcc;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  height: 100vh;
  display: flex;
  flex-direction: column;
}

button, select, textarea { font: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
header, .stepper, footer { flex: 0 0 auto; }

/* ---------- 顶栏 ---------- */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 22px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand h1 { margin: 0; font-size: 20px; letter-spacing: 2px; }
.brand .sub { color: var(--muted); font-size: 13px; }
.header-right, .live-controls { display: flex; align-items: center; gap: 8px; }
.header-right { flex-wrap: wrap; justify-content: flex-end; }
.speed { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.speed select { padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }

button { cursor: pointer; border-radius: 8px; }
button:disabled { cursor: not-allowed; opacity: .5; }
.primary { border: none; background: var(--accent); color: #fff; padding: 9px 22px; font-size: 15px; }
.primary:hover:not(:disabled) { background: #39404a; }
.ghost { border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 6px 12px; font-size: 13px; }
.ghost:hover:not(:disabled) { background: #f6f4ef; }
.ghost.danger { color: var(--zheng); }

/* ---------- 进度条 ---------- */
.stepper {
  display: flex;
  gap: 4px;
  padding: 10px 22px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.stepper .step {
  flex: 1 0 auto;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 999px;
  background: #f1eee7;
  white-space: nowrap;
  transition: background .2s, color .2s;
}
.stepper .step.done { background: #e2ddd1; color: var(--ink); }
.stepper .step.now { background: var(--accent); color: #fff; font-weight: 600; }
/* ---------- 主区域 ---------- */
.workspace { flex: 1 1 auto; display: flex; min-height: 0; }
.arena { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; }
main { flex: 1 1 auto; overflow-y: auto; }

.setup { max-width: 860px; margin: 0 auto; padding: 26px 22px 40px; }
.setup h2 { margin: 0 0 14px; font-size: 18px; }
.setup h3 { margin: 22px 0 10px; font-size: 14px; color: var(--muted); font-weight: 600; }
.setup .note { margin: 8px 0 0; font-size: 12px; color: var(--muted); }
.setup-row { display: grid; grid-template-columns: 3fr 2fr; gap: 24px; margin-bottom: 26px; }
#start-btn { position: sticky; bottom: 16px; box-shadow: 0 4px 14px rgba(0,0,0,.18); padding: 11px 34px; }

.topic-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.topic-cat { grid-column: 1 / -1; font-size: 13px; color: var(--muted); margin: 8px 0 0; }
.topic {
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  line-height: 1.55;
  transition: border-color .15s, box-shadow .15s;
}
.topic:hover { border-color: #c9c2b2; }
.topic[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.topic .t { font-size: 14px; font-weight: 600; display: block; }
.topic .sides { display: block; margin-top: 6px; font-size: 12px; }
.topic .sides .p { color: var(--zheng); }
.topic .sides .n { color: var(--fan); }
.topic .focus { display: block; margin-top: 6px; font-size: 12px; color: var(--muted); }

.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { border: 1px solid var(--line); background: #fff; padding: 7px 12px; font-size: 13px; }
.seg button[aria-checked="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---------- 辩论记录 ---------- */
.transcript { max-width: 960px; margin: 0 auto; padding: 18px 22px 30px; }

.banner { text-align: center; margin: 6px 0 18px; }
.banner .topic-title { font-size: 17px; font-weight: 700; line-height: 1.6; }
.banner .vs { margin-top: 6px; font-size: 13px; }
.banner .vs .p { color: var(--zheng); }
.banner .vs .n { color: var(--fan); }
.banner .seat { margin-top: 4px; font-size: 12px; color: var(--muted); }

.phase { margin: 26px 0 12px; text-align: center; font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 12px; }
.phase::before, .phase::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.phase b { color: var(--ink); font-size: 14px; }
.phase .rule { font-size: 12px; }

.msg { display: flex; flex-direction: column; margin: 12px 0; max-width: 78%; animation: rise .2s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.msg.pos { margin-right: auto; }
.msg.neg { margin-left: auto; align-items: flex-end; }
.msg.chair, .msg.audience { margin-left: auto; margin-right: auto; max-width: 70%; align-items: center; }
.msg.judge { max-width: 100%; }

.msg .who { font-size: 12px; font-weight: 700; margin: 0 4px 4px; display: flex; align-items: center; gap: 6px; }
.msg.pos .who { color: var(--zheng); }
.msg.neg .who { color: var(--fan); }
.msg.chair .who { color: var(--chair); }
.msg.judge .who { color: var(--judge); }
.msg.debrief .who { color: var(--debrief); }
.msg.audience .who, .msg.mine .who { color: var(--user); }

.bubble {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 15px;
  line-height: 1.85;
  font-size: 15px;
  word-break: break-word;
}
.msg.pos .bubble { background: var(--zheng-soft); border-color: #f0d2cd; border-top-left-radius: 4px; }
.msg.neg .bubble { background: var(--fan-soft); border-color: #cfdcf6; border-top-right-radius: 4px; }
.msg.chair .bubble { background: var(--chair-soft); border-color: #eedfb9; font-size: 14px; text-align: center; }
.msg.judge .bubble { background: var(--judge-soft); border-color: #ddd2ee; }
.msg.debrief .bubble { background: #eef8f6; border-color: #c5e7e1; }
.msg.audience .bubble, .msg.mine .bubble { background: #fff6ec; border-color: #f3d3ae; }
.msg.mine.pos .bubble, .msg.mine.neg .bubble { box-shadow: inset 3px 0 0 var(--user); }

.bubble.waiting { color: var(--muted); font-size: 13px; }
.dots::after { content: "…"; display: inline-block; animation: dots 1.2s steps(4) infinite; width: 1.2em; overflow: hidden; vertical-align: bottom; }
@keyframes dots { from { width: 0; } to { width: 1.2em; } }

/* 打字光标：贴在最后一个块元素末尾 */
.msg.typing .bubble > :last-child::after, .msg.typing .bubble:empty::after {
  content: ""; display: inline-block; width: 2px; height: 1.05em; margin-left: 2px;
  background: currentColor; vertical-align: -2px; animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 4px 6px; }
.chip { font-size: 12px; color: var(--muted); background: #fff; border: 1px dashed #cfc8b8; border-radius: 999px; padding: 2px 10px; }
.tag { font-size: 11px; font-weight: 500; color: var(--muted); }

/* markdown */
.bubble p { margin: 4px 0; }
.bubble h2, .bubble h3, .bubble h4 { margin: 12px 0 4px; line-height: 1.4; }
.bubble h2 { font-size: 16px; }
.bubble h3 { font-size: 15px; }
.bubble h4 { font-size: 14px; color: var(--muted); }
.bubble ul, .bubble ol { margin: 4px 0; padding-left: 22px; }
.bubble li { margin: 2px 0; }
.bubble blockquote { margin: 6px 0; padding: 6px 12px; border-left: 3px solid var(--debrief); background: rgba(255,255,255,.6); border-radius: 0 8px 8px 0; }
.bubble hr { border: none; border-top: 1px dashed var(--line); margin: 10px 0; }
.bubble code { background: rgba(0,0,0,.05); padding: 1px 5px; border-radius: 4px; font-size: 13px; }

.warning { font-size: 12px; color: #a85b06; margin: -4px 4px 8px; }
.msg.neg + .warning { text-align: right; }
.quotes { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 4px 10px; }
.quotes.neg { justify-content: flex-end; }
.coach-msg .quotes { margin: 8px 0 0; }
.qc { font-size: 12px; border-radius: 999px; padding: 2px 10px; cursor: help; }
.qc.ok { color: #2f6b3a; background: #eaf4ec; }
.qc.bad { color: #a12d24; background: #fbeceb; }
.sys { text-align: center; font-size: 13px; color: var(--muted); margin: 18px 0; }
.sys.err { color: var(--zheng); }
.sys .primary { margin-top: 10px; }
/* ---------- 输入区 ---------- */
footer {
  background: var(--panel);
  border-top: 1px solid var(--line);
  padding: 10px 22px 16px;
}
footer > * { max-width: 916px; margin-left: auto; margin-right: auto; }
.hint { font-size: 13px; color: var(--muted); margin-bottom: 8px; min-height: 1.4em; }
.hint.turn { color: var(--user); font-weight: 600; }
.hint .task { display: block; font-weight: 400; color: var(--ink); margin-top: 2px; }
footer.turn textarea { border-color: var(--user); box-shadow: 0 0 0 3px rgba(217,118,26,.12); }

.input-row { display: flex; gap: 10px; align-items: stretch; }
textarea {
  flex: 1 1 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 15px;
  resize: vertical;
  min-height: 48px;
  max-height: 40vh;
  line-height: 1.6;
  background: #fff;
}
textarea:focus { outline: none; border-color: var(--accent); }
.input-side { display: flex; flex-direction: column; justify-content: space-between; align-items: flex-end; gap: 4px; }
.counter { font-size: 11px; color: var(--muted); }
.counter.over { color: var(--zheng); }

/* ---------- 场边教练（侧边栏） ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.coach {
  flex: 0 0 340px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--panel);
  border-left: 1px solid var(--line);
  padding: 12px 14px 14px;
  gap: 8px;
}
.coach-head { display: flex; align-items: center; gap: 8px; }
.coach-head h2 { margin: 0; font-size: 15px; color: var(--debrief); }
.coach-quota { font-size: 11px; color: var(--muted); margin-left: auto; }
.icon { border: none; background: none; font-size: 20px; line-height: 1; color: var(--muted); padding: 2px 6px; }
.icon:hover { color: var(--ink); background: #f1eee7; }
.coach-sub { margin: 0; font-size: 12px; color: var(--muted); }
.coach-now { font-size: 13px; line-height: 1.6; background: #eef8f6; border: 1px solid #c5e7e1; border-radius: 10px; padding: 8px 10px; }
.coach-now:empty { display: none; }
.coach-now b { color: var(--debrief); }
.coach-now ul { margin: 4px 0 0; padding-left: 18px; }
.coach-now.turn { background: #fff6ec; border-color: #f3d3ae; }
.coach-now.turn b { color: var(--user); }
.coach-log { flex: 1 1 auto; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 2px; }
.coach-log .empty { white-space: pre-line; font-size: 12px; color: var(--muted); text-align: center; margin: auto 0; line-height: 1.7; }
.cm { font-size: 13px; line-height: 1.7; border-radius: 10px; padding: 7px 10px; max-width: 94%; word-break: break-word; }
.cm.user { align-self: flex-end; background: #f1eee7; white-space: pre-wrap; }
.cm.coach-msg { align-self: flex-start; background: #fff; border: 1px solid var(--line); }
.cm.coach-msg p { margin: 3px 0; }
.cm.coach-msg ul, .cm.coach-msg ol { margin: 3px 0; padding-left: 18px; }
.cm.err { color: var(--zheng); background: var(--zheng-soft); }
.cm .draft-tag { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.coach-quick { display: flex; flex-wrap: wrap; gap: 6px; }
.coach-quick button { border: 1px solid #c5e7e1; background: #f4fbf9; color: #0a6b5d; font-size: 12px; padding: 4px 10px; border-radius: 999px; }
.coach-quick button:hover:not(:disabled) { background: #e3f4f0; }
.coach-form { display: flex; gap: 6px; align-items: stretch; }
.coach-form textarea { min-height: 40px; font-size: 13px; padding: 7px 9px; resize: none; }
.coach-form .primary { padding: 6px 14px; font-size: 14px; background: var(--debrief); }
.coach-form .primary:hover:not(:disabled) { background: #087466; }
#coach-toggle { position: relative; }
#coach-toggle[aria-expanded="true"] { background: #eef8f6; border-color: #c5e7e1; }
.badge { position: absolute; top: -3px; right: -3px; width: 9px; height: 9px; border-radius: 50%; background: var(--user); }

@media (max-width: 1080px) {
  .coach { position: fixed; top: 0; right: 0; bottom: 0; width: min(360px, 92vw); z-index: 20; box-shadow: -6px 0 24px rgba(0,0,0,.14); }
}

/* ---------- 窄屏 ---------- */
@media (max-width: 720px) {
  header { flex-wrap: wrap; padding: 10px 14px; }
  .brand .sub { display: none; }
  .setup-row { grid-template-columns: 1fr; gap: 0; }
  .msg, .msg.chair, .msg.audience { max-width: 94%; }
  .transcript, .setup { padding-left: 14px; padding-right: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- 访问码 / 启动错误 ---------- */
.access-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 18px 0 4px; }
.access-row label { font-weight: 600; }
.access-row input { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 15px; min-width: 200px; }
.setup-error { color: var(--zheng); background: var(--zheng-soft); border-radius: 8px; padding: 8px 12px; margin: 12px 0 0; }
.setup-error { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.retry { border: 1px solid currentColor; border-radius: 6px; background: transparent; color: inherit; padding: 4px 9px; font-size: 12px; cursor: pointer; white-space: nowrap; }
.retry:hover { background: rgba(255,255,255,.65); }

/* ---------- 训练场视觉层 ---------- */
:root {
  --bg: #f4f7f5;
  --panel: #fffefa;
  --ink: #1d2925;
  --muted: #697570;
  --line: #dfe7e2;
  --zheng: #b63d34;
  --zheng-soft: #fbedeb;
  --fan: #3565a6;
  --fan-soft: #edf3fc;
  --chair: #9a6b12;
  --chair-soft: #fbf5e7;
  --judge: #635090;
  --judge-soft: #f4f0fa;
  --debrief: #176b65;
  --user: #c66f1f;
  --accent: #1d2925;
  --focus: #3565a6;
  --radius: 8px;
}

body { background: var(--bg); color: var(--ink); font-family: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif; }
header {
  padding: 15px clamp(18px, 4vw, 52px);
  background: rgba(255, 254, 250, .95);
  border-bottom-color: var(--line);
}
.brand { align-items: center; gap: 12px; }
.brand-mark {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: var(--ink);
  border-radius: 10px 10px 2px 10px;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 17px;
  font-weight: 700;
}
.brand-copy { display: flex; align-items: baseline; gap: 11px; }
.brand h1 { font-size: 18px; letter-spacing: .02em; }
.brand .sub { color: var(--muted); letter-spacing: .02em; }
.header-right { gap: 10px; }
.primary { background: var(--zheng); border-radius: 7px; font-weight: 600; }
.primary:hover:not(:disabled) { background: #96342d; }
.ghost { border-color: var(--line); border-radius: 7px; }
.ghost:hover:not(:disabled) { background: var(--zheng-soft); border-color: #edc6c1; }

.stepper {
  gap: 6px;
  padding: 10px clamp(18px, 4vw, 52px);
  background: rgba(255, 254, 250, .95);
  border-bottom-color: var(--line);
}
.stepper .step {
  border-radius: 6px;
  background: #edf1ef;
  letter-spacing: .01em;
}
.stepper .step.done { background: #dce9e5; color: var(--debrief); }
.stepper .step.now { background: var(--debrief); }

.setup {
  max-width: 1040px;
  padding: clamp(34px, 6vw, 64px) clamp(18px, 4vw, 52px) 56px;
}
.setup-kicker {
  color: var(--debrief);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  margin-bottom: 12px;
}
.setup h2 {
  margin-bottom: 10px;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: clamp(30px, 4vw, 44px);
  font-weight: 600;
  line-height: 1.25;
}
.setup-lede { max-width: 620px; margin: 0; color: var(--muted); line-height: 1.8; }
.setup-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin: 24px 0 30px;
  padding: 13px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}
.setup-metrics span { display: inline-flex; align-items: center; gap: 7px; }
.setup-metrics b { color: var(--zheng); font-family: Georgia, serif; font-size: 13px; }
.topic-list { grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 12px; }
.topic-cat { margin-top: 12px; color: var(--debrief); font-weight: 700; letter-spacing: .03em; }
.topic {
  min-height: 134px;
  padding: 15px 16px;
  border-color: var(--line);
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(31, 48, 42, .03);
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.topic:hover { border-color: #9fc9c0; transform: translateY(-2px); box-shadow: 0 11px 24px rgba(31, 48, 42, .08); }
.topic[aria-checked="true"] { border-color: var(--debrief); box-shadow: 4px 4px 0 #d8e9e4; }
.topic .t { font-size: 15px; line-height: 1.65; }
.topic .focus { margin-top: 10px; }
.setup-row { gap: 34px; margin-top: 4px; }
.setup h3 { color: var(--ink); font-size: 13px; letter-spacing: .02em; }
.seg button { border-color: var(--line); border-radius: 7px; }
.seg button[aria-checked="true"] { background: var(--debrief); border-color: var(--debrief); }
.setup .note { line-height: 1.6; }
#start-btn { position: static; margin-top: 10px; box-shadow: 0 8px 18px rgba(182, 61, 52, .2); }
.usage-note { margin: 10px 0 0; color: var(--muted); font-size: 12px; }
.access-row input { border-color: var(--line); border-radius: 7px; }

.transcript { max-width: 1000px; padding: 24px clamp(18px, 4vw, 52px) 34px; }
.banner { margin: 10px 0 26px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.banner .topic-title { font-family: "Noto Serif SC", "Songti SC", serif; font-size: 21px; }
.phase { margin-top: 34px; }
.msg { animation: rise .18s ease; }
.bubble { box-shadow: 0 5px 16px rgba(31, 48, 42, .04); }
.msg.pos .bubble { border-left: 3px solid var(--zheng); }
.msg.neg .bubble { border-right: 3px solid var(--fan); }
.msg.judge .bubble { border-left: 3px solid var(--judge); }
.msg.debrief .bubble { border-left: 3px solid var(--debrief); }

footer { padding: 12px clamp(18px, 4vw, 52px) 18px; background: rgba(255, 254, 250, .96); border-top-color: var(--line); }
footer > * { max-width: 1000px; }
textarea { border-color: var(--line); border-radius: 8px; }
textarea:focus { border-color: var(--debrief); box-shadow: 0 0 0 3px rgba(23, 107, 101, .12); }
footer.turn textarea { border-color: var(--user); box-shadow: 0 0 0 3px rgba(198, 111, 31, .12); }
.hint.turn { color: var(--user); }

.coach { flex-basis: 360px; background: #fbfdfb; border-left-color: var(--line); }
.coach-head h2 { color: var(--debrief); }
.coach-now { border-radius: 8px; }
.coach-quick button { border-radius: 7px; }

@media (max-width: 720px) {
  header { flex-wrap: wrap; padding: 10px 14px; }
  .header-right { width: 100%; justify-content: flex-start; }
  .live-controls { flex-wrap: wrap; width: 100%; }
  .live-controls .ghost, .live-controls .speed { flex: 1 1 auto; min-height: 40px; }
  #coach-toggle { width: 100%; }
  .brand-copy { display: block; }
  .brand .sub { display: block; margin-top: 2px; }
  .setup-metrics { gap: 11px; }
  .setup-row { gap: 4px; }
  .topic { min-height: 0; }
}

/* ---------- 备赛工作台 ---------- */
.product-nav { display: flex; align-items: center; gap: 4px; }
.product-nav button {
  min-height: 38px; padding: 7px 12px; border: 1px solid transparent; border-radius: 6px;
  background: transparent; color: var(--muted); font-size: 13px;
}
.product-nav button[aria-pressed="true"] { border-color: var(--line); background: #e9f1ee; color: var(--ink); font-weight: 700; }
.studio-view { width: 100%; max-width: 1380px; margin: 0 auto; padding: 30px 42px 48px; }
.studio-heading { margin-bottom: 22px; }
.studio-heading h2 { margin: 4px 0 5px; font-family: "Noto Serif SC", "Songti SC", serif; font-size: 25px; line-height: 1.4; }
.studio-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.studio-context { display: grid; grid-template-columns: 78px minmax(220px, 380px) 1fr; align-items: center; gap: 10px; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.studio-context label, .studio-panel > label, .field-row label, #custom-topic-form label { color: var(--muted); font-size: 12px; font-weight: 700; }
.studio-topic-sides { grid-column: 2 / -1; color: var(--muted); font-size: 12px; line-height: 1.6; }
.studio-context select, .studio-panel select, .studio-panel input, #topic-search, #custom-topic-form input {
  width: 100%; min-height: 40px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); font-size: 14px;
}
.studio-tabs { display: flex; gap: 4px; margin: 16px 0 0; overflow-x: auto; border-bottom: 1px solid var(--line); }
.studio-tabs button { flex: 0 0 auto; min-height: 42px; padding: 9px 14px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; color: var(--muted); font-size: 13px; white-space: nowrap; }
.studio-tabs button[aria-selected="true"] { border-bottom-color: var(--debrief); color: var(--ink); font-weight: 700; }
.studio-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr); gap: 34px; align-items: start; }
.studio-tools { min-width: 0; }
.studio-panel { padding: 22px 0 24px; }
.panel-title, .result-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.panel-title h3, .result-head h3 { margin: 3px 0 0; font-size: 17px; line-height: 1.4; }
.eyebrow { color: var(--debrief); font-size: 10px; font-weight: 800; letter-spacing: .08em; }
.field-row { display: grid; grid-template-columns: auto minmax(150px, 1fr) auto minmax(130px, .75fr); align-items: center; gap: 8px 12px; margin-bottom: 16px; }
.field-row > div { display: grid; gap: 7px; }
.studio-panel > label { display: block; margin: 15px 0 7px; }
.studio-panel textarea { display: block; width: 100%; min-height: 84px; border-radius: 6px; font-size: 14px; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 12px; }
.form-actions .primary, .form-actions .ghost, .studio-panel > .ghost, .sparring-form .primary { min-height: 40px; }
.field-note { color: var(--muted); font-size: 11px; line-height: 1.6; }
.studio-divider { height: 1px; margin: 26px 0 18px; background: var(--line); }
.studio-result { position: sticky; top: 18px; min-width: 0; min-height: 420px; padding: 22px 0 20px 24px; border-left: 1px solid var(--line); }
.result-head { margin-bottom: 10px; }
.result-actions { display: flex; gap: 5px; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); font-size: 17px; }
.icon-button:hover:not(:disabled) { border-color: var(--debrief); color: var(--debrief); }
.studio-status { min-height: 22px; margin: 0 0 14px; color: var(--muted); font-size: 12px; }
.studio-status.busy::before { content: ""; display: inline-block; width: 9px; height: 9px; margin-right: 8px; border: 2px solid #b7cac4; border-top-color: var(--debrief); border-radius: 50%; animation: studio-spin .8s linear infinite; vertical-align: -1px; }
@keyframes studio-spin { to { transform: rotate(360deg); } }
.studio-output { color: var(--ink); font-size: 14px; line-height: 1.8; overflow-wrap: anywhere; }
.studio-output:empty::before { content: "生成结果会显示在这里"; color: #929b97; font-size: 13px; }
.studio-output h2, .studio-output h3, .studio-output h4 { margin: 18px 0 7px; line-height: 1.4; }
.studio-output h2 { font-size: 16px; }
.studio-output h3 { font-size: 15px; }
.studio-output p { margin: 7px 0; }
.studio-output ol, .studio-output ul { padding-left: 22px; }
.studio-output li { margin: 4px 0; }
.studio-output blockquote { margin: 10px 0; padding: 8px 12px; border-left: 3px solid var(--debrief); background: #edf4f1; }
.studio-evidence { margin-top: 18px; }
.evidence-title { margin-bottom: 7px; color: var(--muted); font-size: 11px; font-weight: 700; }
.studio-evidence .quotes { margin: 0 0 12px; }
.evidence-details { border-top: 1px solid var(--line); padding-top: 10px; }
.evidence-details summary { color: var(--debrief); font-size: 12px; cursor: pointer; }
.evidence-item { margin-top: 10px; padding-bottom: 8px; border-bottom: 1px solid #edf0ee; font-size: 12px; line-height: 1.65; }
.evidence-item b { font-weight: 700; }
.evidence-item p { margin: 4px 0 0; color: var(--muted); }
.studio-error { padding: 10px 12px; border-left: 3px solid var(--zheng); background: var(--zheng-soft); color: #8e3029; font-size: 12px; line-height: 1.6; }
.quota-note { margin-top: 22px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.script-options { grid-template-columns: auto minmax(90px, .7fr) auto minmax(110px, 1fr) auto minmax(100px, .8fr); }
.sparring-log { display: flex; flex-direction: column; gap: 9px; max-height: 330px; min-height: 120px; overflow-y: auto; padding: 8px 0; }
.sparring-empty, .empty-list { color: var(--muted); font-size: 12px; }
.sparring-turn { max-width: 92%; padding: 10px 12px; border-left: 3px solid var(--fan); background: var(--fan-soft); font-size: 13px; line-height: 1.7; overflow-wrap: anywhere; }
.sparring-turn.you { align-self: flex-end; border-left: 0; border-right: 3px solid var(--zheng); background: var(--zheng-soft); }
.sparring-turn b { font-size: 11px; }
.sparring-turn p { margin: 5px 0 0; white-space: pre-wrap; }
.sparring-form { display: flex; align-items: stretch; gap: 8px; }
.sparring-form textarea { flex: 1; }
.sparring-form .primary { flex: 0 0 110px; align-self: flex-end; padding: 8px; }
.studio-topic-list { margin-top: 14px; }
.list-heading { margin: 18px 0 4px; color: var(--muted); font-size: 12px; }
.topic-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 0; border-top: 1px solid var(--line); }
.topic-row-copy { min-width: 0; }
.topic-row h4 { margin: 0 0 5px; font-size: 13px; line-height: 1.6; }
.topic-row p { margin: 2px 0; color: var(--muted); font-size: 11px; line-height: 1.6; overflow-wrap: anywhere; }
.topic-focus { display: block; margin-top: 4px; color: var(--debrief); font-size: 11px; line-height: 1.5; }
.topic-row-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 5px; }
.topic-row-actions .ghost { padding: 6px 8px; font-size: 11px; }
.topic-add { margin-top: 18px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.topic-add summary { padding: 12px 0; color: var(--debrief); font-size: 12px; font-weight: 700; cursor: pointer; }
#custom-topic-form { display: grid; gap: 8px; padding: 4px 0 16px; }
#custom-topic-form .field-row { grid-template-columns: 1fr 1fr; align-items: start; margin: 0; }
#custom-topic-form button { justify-self: start; min-height: 38px; }
.studio-panel input:focus, .studio-panel select:focus, .studio-panel textarea:focus, #topic-search:focus, #custom-topic-form input:focus { border-color: var(--debrief); outline: 2px solid rgba(23, 107, 101, .15); }

@media (max-width: 980px) {
  .studio-view { padding: 26px 24px 40px; }
  .studio-layout { grid-template-columns: minmax(0, 1fr) minmax(250px, .82fr); gap: 22px; }
  .field-row { grid-template-columns: auto minmax(130px, 1fr) auto minmax(120px, .8fr); }
  .script-options { grid-template-columns: auto 1fr auto 1fr; }
  .script-options label:nth-of-type(3) { grid-column: 1; }
}

@media (max-width: 720px) {
  .product-nav { order: 3; width: 100%; }
  .product-nav button { flex: 1; }
  .studio-view { padding: 22px 16px 34px; }
  .studio-heading { margin-bottom: 16px; }
  .studio-heading h2 { font-size: 22px; }
  .studio-context { grid-template-columns: 60px minmax(0, 1fr); gap: 7px 9px; }
  .studio-topic-sides { grid-column: 2; }
  .studio-tabs { margin-right: -16px; padding-right: 16px; }
  .studio-tabs button { padding: 9px 11px; }
  .studio-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .studio-panel { padding-top: 19px; }
  .field-row, .script-options { grid-template-columns: 1fr 1fr; align-items: start; gap: 8px; }
  .field-row label { align-self: end; }
  .script-options label:nth-of-type(3) { grid-column: auto; }
  .studio-result { position: static; min-height: 0; padding: 19px 0 10px; border-left: 0; border-top: 1px solid var(--line); }
  .studio-result .result-head { margin-bottom: 10px; }
  .sparring-form { flex-direction: column; }
  .sparring-form .primary { flex: auto; align-self: stretch; }
  .topic-row { align-items: flex-start; }
  .topic-row-actions { flex-direction: column; align-items: stretch; }
  #custom-topic-form .field-row { grid-template-columns: 1fr; }
  .setup, .transcript { padding-left: 14px; padding-right: 14px; }
}
