/* 双 Agent 辩论 Web —— 蓝白主题 */
:root {
  --bg: #e8effa;        /* 页面浅蓝 */
  --bg-elev: #ffffff;   /* 面板纯白 */
  --bg-elev2: #f4f8fe;  /* 次级浅蓝白（输入框/卡片） */
  --border: #d7e0ee;    /* 浅蓝边框 */
  --text: #16243b;      /* 深蓝黑文字 */
  --text-dim: #5d6b82;  /* 次要文字 */
  --accent: #2563eb;    /* 主蓝 */
  --accent-fade: rgba(37, 99, 235, 0.12);  /* 主蓝浅底 */
  --pro: #2563eb;       /* 正方 蓝 */
  --con: #ea8a2b;       /* 反方 橙（对比点缀） */
  --host: #6b7a90;      /* 主持 灰蓝 */
  --ok: #16a34a;        /* 绿 */
  --err: #dc2626;       /* 红 */
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
}

/* ── 顶栏 ── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 14px; }
.logo {
  width: 42px; height: 42px; flex: none;
  display: grid; place-items: center;
  font-size: 22px; border-radius: 12px;
  background: linear-gradient(135deg, var(--pro), var(--con));
}
.topbar h1 { margin: 0; font-size: 17px; font-weight: 600; }
.sub { margin: 2px 0 0; font-size: 12px; color: var(--text-dim); }
.tokens {
  display: flex; align-items: baseline; gap: 8px;
  padding: 6px 14px; border-radius: 999px;
  background: var(--bg-elev2); border: 1px solid var(--border);
}
.tk-label { font-size: 11px; color: var(--text-dim); text-transform: uppercase; }
.tk-val { font-size: 13px; font-variant-numeric: tabular-nums; }

/* ── 布局 ── */
.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 340px 1fr;
  grid-template-rows: 1fr;
  gap: 18px;
  padding: 18px 24px 40px;
  min-height: 0;
  max-width: 1500px;
  margin: 0 auto;
  width: 100%;
}
.panel {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.panel-title { margin: 0 0 14px; font-size: 14px; font-weight: 600; }

/* ── 配置面板 ── */
.config {
  position: sticky;
  top: 84px;
  align-self: start;
  padding-bottom: 24px;
  margin-bottom: 32px;
}
.apicfg {
  border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px 4px; margin: 0 0 18px;
}
.apicfg legend { padding: 0 6px; font-size: 12px; color: var(--text-dim); }
.apicfg .lock { color: var(--ok); font-size: 11px; margin-left: 4px; }
.apicfg .hint { margin: 2px 0 10px; }
.field { display: block; margin-bottom: 14px; }
.lbl { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 6px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

textarea, input[type="text"], input[type="password"], input[type="number"], select {
  width: 100%; padding: 8px 10px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  font: inherit; resize: vertical;
}
textarea:focus, input[type="text"]:focus, input[type="password"]:focus, input[type="number"]:focus, select:focus {
  outline: none; border-color: var(--accent);
}
.hint { display: block; margin-top: 5px; font-size: 11px; color: var(--text-dim); }

/* API 凭证字段：输入框 + 清空叉号 / 获取列表按钮 */
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap input, .input-wrap select { width: 100%; }
.input-wrap input[type="password"] { padding-right: 34px; }
.input-wrap select#apiModel, .input-wrap input[type="text"]#apiModelInput { padding-right: 92px; }
.input-wrap select#apiModel {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='%235d6b82' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 76px center;
  background-size: 16px 16px;
}
.hidden { display: none !important; }
#apiModelToggle a { color: var(--accent); text-decoration: none; }
#apiModelToggle a:hover { text-decoration: underline; }
.clear-x {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 22px; height: 22px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; background: transparent; color: var(--text-dim);
  border-radius: 50%; cursor: pointer; font-size: 13px;
  transition: background 0.15s ease, color 0.15s ease;
}
.clear-x:hover { background: var(--accent-fade); color: var(--accent); }
.mini-btn {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  padding: 4px 10px; font-size: 12px;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg); color: var(--text);
  cursor: pointer; white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.mini-btn:hover { background: var(--accent-fade); border-color: var(--accent); color: var(--accent); }
.mini-btn:disabled { opacity: 0.6; cursor: default; }

.fairness {
  border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px 4px; margin: 4px 0 12px;
}
.fairness legend { padding: 0 6px; font-size: 12px; color: var(--text-dim); }

.ck {
  display: flex; gap: 8px; align-items: flex-start;
  margin-bottom: 10px; cursor: pointer; font-size: 13px;
}
.ck input { margin-top: 3px; accent-color: var(--accent); flex: none; }
.ck em {
  display: block; font-style: normal;
  font-size: 11px; color: var(--text-dim); margin-top: 1px;
}
.mock { margin-bottom: 14px; }
/* 推理设置卡 / 展开子配置 与下方复选框之间拉开空隙 */
.reasoning-card + .ck, #mainCredGroup + .ck, .subcfg + .ck { margin-top: 18px; }

.actions { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-top: 16px; }
.btn {
  padding: 9px 16px; border-radius: 8px; border: 1px solid transparent;
  font: inherit; font-weight: 600; cursor: pointer;
}
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover:not(:disabled) { filter: brightness(1.1); }
.btn.ghost {
  background: transparent; color: var(--text-dim); border-color: var(--border);
}
.btn.ghost:hover:not(:disabled) { color: var(--text); border-color: var(--text-dim); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.warn {
  margin: 12px 0 0; padding: 8px 10px; border-radius: 8px;
  background: rgba(220, 38, 38, .08);
  border: 1px solid rgba(220, 38, 38, .3);
  color: #b42318; font-size: 12px;
}

/* ── 子配置块（双模型 / 独立评委） ── */
.subcfg {
  margin: 8px 0 14px 22px;
  padding: 10px 12px;
  border-left: 3px solid var(--accent);
  background: var(--bg-elev);
  border-radius: 0 8px 8px 0;
  display: flex; flex-direction: column; gap: 10px;
}
.subcfg[hidden] {
  display: none !important;
}
.sub-title {
  font-size: 12px; font-weight: 600; color: var(--accent);
  margin: 4px 0 2px;
}
.subcfg .field { margin: 0; }
.subcfg .lbl { font-size: 12px; }
.subcfg input { font-size: 12px; padding: 6px 8px; }
#reasoningDesc {
  display: block; margin-top: 4px; font-size: 11px; color: var(--text-dim);
}

/* ── 状态区 ── */
.stage {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
  min-height: 0;
  height: 100%;
}
.status-line { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.dot {
  width: 9px; height: 9px; border-radius: 50%; flex: none;
  background: var(--text-dim);
}
.dot.run { background: var(--accent); animation: pulse 1.2s infinite; }
.dot.ok { background: var(--ok); }
.dot.err { background: var(--err); }
@keyframes pulse { 50% { opacity: .25; } }

.progress {
  height: 5px; margin-top: 12px; border-radius: 99px;
  background: var(--bg); overflow: hidden;
}
.bar {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--pro), var(--con));
  transition: width .35s ease;
}
.bias {
  margin: 12px 0 0; padding: 8px 10px; border-radius: 8px;
  background: var(--bg-elev2); color: var(--text-dim); font-size: 12px;
}

/* ── Tab ── */
.tabs-panel {
  padding: 0;
  overflow: hidden;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.tabs { display: flex; border-bottom: 1px solid var(--border); }
.tab {
  padding: 12px 20px; background: none; border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-dim); font: inherit; font-weight: 600; cursor: pointer;
}
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.tabview {
  display: none;
  padding: 16px;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}
.tabview.active { display: block; }

.empty { color: var(--text-dim); font-size: 13px; text-align: center; padding: 28px 0; }

/* ── 发言卡片 ── */
.speech {
  border: 1px solid var(--border); border-left: 3px solid var(--host);
  border-radius: 8px; padding: 12px 14px; margin-bottom: 12px;
  background: var(--bg-elev2);
}
.speech.pro { border-left-color: var(--pro); }
.speech.con { border-left-color: var(--con); }
.sp-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 8px; font-size: 12px;
  flex-wrap: wrap;
}
.sp-role { font-weight: 700; }
.speech.pro .sp-role { color: var(--pro); }
.speech.con .sp-role { color: var(--con); }
.speech.host .sp-role { color: var(--host); }
.sp-round { color: var(--text-dim); }
.sp-meta {
  margin-left: auto;
  font-size: 11px; color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  background: var(--bg-elev); padding: 2px 8px;
  border-radius: 999px; border: 1px solid var(--border);
}
.sp-body { white-space: pre-wrap; word-break: break-word; font-size: 13.5px; }

/* ── 推理设置卡片 ── */
.model-field { margin-bottom: 12px; }
.model-probe-actions {
  display: flex; align-items: center; gap: 10px;
  margin-top: 10px; flex-wrap: wrap;
}
.model-probe-actions .mini-btn {
  position: static; transform: none;
}
.probe-result {
  font-size: 12px; line-height: 1.45; color: var(--text-dim);
}
.probe-result.ok { color: var(--ok); }
.probe-result.warn { color: var(--warn, #d9a441); }
.probe-result.err { color: var(--err); }
.probe-result .pd { display: block; margin-top: 4px; opacity: .8; font-size: 11px; }

.reasoning-card {
  margin-top: 14px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg-elev2); padding: 14px;
}
.rc-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 12px;
}
.rc-title {
  font-size: 13px; font-weight: 700; color: var(--text);
}
.rc-field { margin-bottom: 10px; }
.model-tip {
  margin-top: 10px;
  border: 1px dashed var(--border); border-radius: 8px;
  padding: 8px 12px; background: var(--bg-elev2);
  font-size: 12px; color: var(--text-dim); line-height: 1.55;
}
.model-tip > summary {
  cursor: pointer; user-select: none; list-style: none;
  color: var(--accent); font-weight: 500;
}
.model-tip > summary::-webkit-details-marker { display: none; }
.model-tip > p { margin: 6px 0 0; }

/* 主模型被双模型/评委配置覆盖时，凭证区置灰且禁用输入 */
#mainCredGroup.shielded {
  position: relative;
  opacity: .5;
  filter: grayscale(.4);
}
#mainCredGroup.shielded::after {
  content: ""; position: absolute; inset: 0; cursor: not-allowed;
}
.shield-note {
  margin: 0 0 10px; padding: 8px 10px;
  border: 1px dashed var(--accent); border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  font-size: 12px; color: var(--accent); line-height: 1.5;
}

/* 子配置块内的推理卡片：更紧凑 */
.subcfg .reasoning-card.sub-reasoning {
  margin-top: 8px; padding: 10px;
}
.subcfg .reasoning-card.sub-reasoning .rc-title { font-size: 12px; }
.subcfg .reasoning-card.sub-reasoning .rc-field {
  display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
}
.subcfg .reasoning-card.sub-reasoning .rc-field .lbl { margin: 0; }
.subcfg .reasoning-card.sub-reasoning select { flex: 1; }
.reasoning-card .hint {
  display: block; margin-top: 4px; font-size: 11px; color: var(--text-dim);
}

/* ── 思考过程（流式 reasoning，可折叠）── */
.sp-reasoning {
  margin: 0 0 10px;
  border: 1px dashed var(--border); border-radius: 8px;
  background: var(--bg-elev); overflow: hidden;
}
.sp-reasoning > summary {
  cursor: pointer; padding: 7px 12px; font-size: 12px; color: var(--text-dim);
  user-select: none; list-style: none;
}
.sp-reasoning > summary::-webkit-details-marker { display: none; }
.sp-reasoning > summary:hover { color: var(--text); }
.sp-reasoning-body {
  max-height: 280px; overflow-y: auto;
  padding: 0 12px 10px;
  white-space: pre-wrap; word-break: break-word;
  font-size: 12px; line-height: 1.55; color: var(--text-dim);
  border-top: 1px dashed var(--border);
}

/* ── 裁定与报告 ── */
.ruling {
  padding: 14px 16px; margin-bottom: 16px;
  border: 1px solid rgba(37, 99, 235, .35); border-radius: 8px;
  background: rgba(37, 99, 235, .06);
  white-space: pre-wrap; font-size: 13.5px;
}
.rep-card {
  border: 1px solid var(--border); border-radius: 8px;
  margin-bottom: 16px; overflow: hidden; background: var(--bg-elev2);
}
.rep-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 10px 12px; background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
}
.rep-name { font-weight: 700; font-size: 13px; }
.rep-acts { display: flex; gap: 8px; }
/* 报告区按钮在 flex 头部里，必须改回 static，否则继承 .mini-btn 的 absolute 会漂移 */
.rep-acts .mini-btn { position: static; transform: none; }
.rep-card .report { padding: 12px 14px; }
.report { font-size: 13.5px; }
.report h1, .report h2, .report h3 {
  margin: 20px 0 8px; font-size: 15px; color: var(--accent);
}
.report h1 { font-size: 17px; }
.report ul { padding-left: 20px; }
.report li { margin: 4px 0; }
.report p { margin: 8px 0; }
.report code {
  background: var(--bg); padding: 1px 5px; border-radius: 4px; font-size: 12.5px;
}
.report hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* ── 报告下载侧边栏 ── */
.report-layout {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 18px;
  align-items: start;
}
.report-main { min-width: 0; }
.report-side {
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elev2);
  padding: 14px;
  font-size: 12.5px;
}
.side-title { margin: 0 0 10px; font-size: 14px; color: var(--text); }
.dl-list { list-style: none; margin: 0; padding: 0; }
.dl-item {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border);
}
.dl-item:last-child { border-bottom: none; }
.dl-name {
  flex: 1; min-width: 0; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; color: var(--text-dim);
}
.dl-btn {
  flex-shrink: 0; padding: 4px 8px; font-size: 12px;
  border: 1px solid var(--accent); background: var(--bg-elev);
  color: var(--accent); border-radius: 6px; cursor: pointer;
}
.dl-btn:hover { background: var(--accent); color: #fff; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .config { position: static; }
  .report-layout { grid-template-columns: 1fr; }
  .report-side { position: static; }
}


