/* ============================================================
   Sprite Atlas · Amazon Selection Workbench
   Premium dark theme, responsive, mobile-first optimization
   ============================================================ */

:root {
  --bg: #0a0e1a;
  --bg-2: #0e1322;
  --surface: #131826;
  --surface-2: #171d2e;
  --surface-3: #1c2336;
  --border: #1f2738;
  --border-2: #2a3349;
  --text: #e8edf5;
  --text-2: #aab3c5;
  --muted: #6b7689;
  --accent: #00d4ff;
  --accent-2: #4f8bff;
  --gold: #ffb800;
  --gold-2: #ffd166;
  --success: #00e5a1;
  --warn: #ff9f43;
  --danger: #ff5470;
  --violet: #8a7dff;
  --pink: #ff7ac6;
  --grad-cyan: linear-gradient(135deg, #00d4ff 0%, #4f8bff 100%);
  --grad-gold: linear-gradient(135deg, #ffd166 0%, #ffb800 100%);
  --grad-success: linear-gradient(135deg, #00e5a1 0%, #00b8d9 100%);
  --shadow-1: 0 1px 0 rgba(255,255,255,0.04) inset, 0 8px 24px rgba(0,0,0,0.35);
  --shadow-glow: 0 0 0 1px rgba(0,212,255,0.25), 0 10px 30px rgba(0,212,255,0.15);
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { overflow-x: hidden; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'PingFang SC', 'Microsoft YaHei', 'Segoe UI', 'Helvetica Neue', sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, rgba(79,139,255,0.08), transparent 50%),
              radial-gradient(900px 500px at -10% 30%, rgba(0,212,255,0.06), transparent 60%),
              var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; color: inherit; }
::selection { background: rgba(0,212,255,0.35); color: #fff; }

/* Unified scrollbar */
* { scrollbar-width: thin; scrollbar-color: var(--border-2) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 99px; }
*::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%);
  background-size: 200% 100%;
  animation: skeletonFlow 1.4s linear infinite;
  border-radius: 8px; height: 16px; margin: 6px 0;
}
.skeleton.lg { height: 32px; }
.skeleton.box { height: 120px; }
@keyframes skeletonFlow { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.module-fade { animation: moduleFade .25s ease-out; }
@keyframes moduleFade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* Cmd+K palette */
.cmdk-mask {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,0.55); backdrop-filter: blur(8px);
  display: grid; place-items: start center; padding-top: 12vh; padding-left: 16px; padding-right: 16px;
  animation: fadeIn .12s ease;
}
.cmdk {
  width: 100%; max-width: 600px;
  background: var(--surface); border: 1px solid var(--border-2);
  border-radius: 14px; overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
}
.cmdk-input-row {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  color: var(--text-2);
}
.cmdk input {
  flex: 1; background: transparent; border: 0; outline: 0;
  font-size: 15px; color: var(--text); font-family: inherit;
}
.cmdk-results { max-height: 60vh; overflow-y: auto; padding: 6px; }
.cmdk-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 8px; cursor: pointer;
}
.cmdk-item.active, .cmdk-item:hover { background: rgba(0,212,255,0.10); }
.cmdk-icon { width: 32px; height: 32px; border-radius: 8px; background: var(--surface-2); display: grid; place-items: center; font-size: 16px; flex-shrink: 0; }
.cmdk-meta { min-width: 0; flex: 1; }
.cmdk-meta .title { font-weight: 600; font-size: 13.5px; }
.cmdk-meta .sub { font-size: 11.5px; color: var(--muted); }
.cmdk-kbd { font-family: ui-monospace, monospace; font-size: 10.5px; color: var(--muted); padding: 2px 6px; background: var(--surface-2); border-radius: 4px; border: 1px solid var(--border-2); }
.cmdk-empty { color: var(--muted); padding: 18px; text-align: center; font-size: 13px; }

/* Favorite star button */
.fav-btn {
  background: none; border: 0; cursor: pointer; padding: 2px 6px;
  color: var(--muted); font-size: 14px; line-height: 1; transition: transform .12s;
}
.fav-btn:hover { transform: scale(1.2); }
.fav-btn.on { color: var(--gold); }

.export-btn {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--surface-2); border: 1px solid var(--border-2);
  color: var(--text); border-radius: 8px; padding: 6px 10px;
  font-size: 12px; font-weight: 600; cursor: pointer;
}
.export-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Improve muted contrast slightly */
:root { --muted: #7b859a; }

/* Print styles */
@media print {
  .sidebar, .topbar, .arena-toolbar, .arena-foot, .head-actions, .head-search { display: none !important; }
  body { background: white !important; color: #111 !important; }
  .panel, .kpi, .case-card { break-inside: avoid; border-color: #ddd !important; }
}

/* ===== Layout ===== */
.app-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
  transition: grid-template-columns .2s ease;
}
/* ============================================================
   极简 · 清新 · 高雅 — 白色主题
   ============================================================ */
body.theme-white {
  --bg: #fbfcfe;
  --bg-2: #ffffff;
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --surface-3: #eef2f7;
  --border: #edf0f4;
  --border-2: #e2e7ee;
  --text: #1f2933;
  --text-2: #52606d;
  --muted: #9aa5b1;
  --accent: #0f766e;
  --accent-2: #0369a1;
  --gold: #b08968;
  --gold-2: #92745a;
  --success: #0f766e;
  --warn: #b45309;
  --danger: #be123c;
  --violet: #5b6ee1;
  --pink: #b06ab3;
  --grad-cyan: linear-gradient(135deg, #14b8a6 0%, #0369a1 100%);
  --grad-gold: linear-gradient(135deg, #d6bfa6 0%, #b08968 100%);
  --grad-success: linear-gradient(135deg, #2dd4bf 0%, #0f766e 100%);
  --shadow-1: 0 1px 2px rgba(16,24,40,0.04), 0 8px 24px rgba(16,24,40,0.05);
  --shadow-glow: 0 0 0 1px rgba(15,118,110,0.16), 0 12px 28px rgba(15,118,110,0.10);
  color: var(--text);
  background:
    radial-gradient(1100px 520px at 85% -12%, rgba(20,184,166,0.06), transparent 55%),
    radial-gradient(820px 460px at -8% 28%, rgba(3,105,161,0.05), transparent 60%),
    var(--bg);
}
body.theme-white ::selection { background: rgba(15,118,110,0.16); color: #0f3a36; }

/* 面板/卡片：柔和漫射阴影 + 极淡描边，去重边框 */
body.theme-white .sidebar {
  background: #ffffff;
  border-right: 1px solid var(--border);
}
body.theme-white .main-head {
  background: linear-gradient(180deg, var(--bg) 62%, transparent);
}
body.theme-white .arena-foot {
  background: linear-gradient(180deg, transparent, #ffffff 38%);
  border-top: 1px solid var(--border);
}
body.theme-white .panel,
body.theme-white .kpi,
body.theme-white .case-card,
body.theme-white .filters,
body.theme-white .arena-side,
body.theme-white .arena-main,
body.theme-white .hero {
  background: #ffffff;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-1);
}
body.theme-white .kpi::before,
body.theme-white .hero-art { display: none; }
body.theme-white .hero {
  background:
    radial-gradient(620px 220px at 88% 0%, rgba(20,184,166,0.08), transparent 60%),
    linear-gradient(160deg, #ffffff, #f7fafc);
}

/* logo / 选中态：克制的青墨色，去发光 */
body.theme-white .logo-dot { box-shadow: 0 4px 12px rgba(15,118,110,0.22); }
body.theme-white .nav-link.active {
  background: rgba(15,118,110,0.08);
  color: #0f5d57;
  box-shadow: inset 0 0 0 1px rgba(15,118,110,0.16);
}
body.theme-white .nav-link.active::before { background: var(--accent); }
body.theme-white .nav-link:hover { background: var(--surface-2); }
body.theme-white .brand-name span { color: var(--accent); }

/* 主按钮：清新青墨渐变，柔和 */
body.theme-white .btn {
  background: var(--grad-cyan); color: #ffffff;
  box-shadow: 0 6px 16px rgba(15,118,110,0.18);
}
body.theme-white .btn-secondary {
  background: #ffffff; color: var(--text); border: 1px solid var(--border-2);
  box-shadow: none;
}
body.theme-white .btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

/* 评分环/进度等深色发光在白底关闭 */
body.theme-white .score { background: conic-gradient(var(--accent) calc(var(--p)*1%), #eef2f7 0); }
body.theme-white .score::after { background: #ffffff; }
body.theme-white .case-card:hover { box-shadow: var(--shadow-glow); border-color: rgba(15,118,110,0.30); }

/* 对战气泡：极浅彩底，雅致 */
body.theme-white .bubble.pro .bubble-body {
  background: linear-gradient(135deg, rgba(20,184,166,0.06), rgba(3,105,161,0.03));
  border-color: rgba(15,118,110,0.20);
}
body.theme-white .bubble.con .bubble-body {
  background: linear-gradient(135deg, rgba(176,106,179,0.06), rgba(180,83,9,0.03));
  border-color: rgba(176,106,179,0.20);
}
body.theme-white .bubble.user .bubble-body {
  background: rgba(15,118,110,0.05); border-color: rgba(15,118,110,0.22);
}
body.theme-white .bubble.judge .bubble-body {
  background: linear-gradient(135deg, rgba(214,191,166,0.14), rgba(176,137,104,0.06)) !important;
  border-color: rgba(176,137,104,0.32) !important;
}
body.theme-white .bubble.judge .av { box-shadow: 0 4px 14px rgba(176,137,104,0.24); }

/* 辩论入口大卡：换为清新浅色，不再深紫 */
body.theme-white .debate-cta {
  background:
    radial-gradient(620px 220px at 90% 0%, rgba(20,184,166,0.12), transparent 60%),
    radial-gradient(620px 220px at 0% 100%, rgba(3,105,161,0.10), transparent 60%),
    linear-gradient(135deg, #ffffff, #f4f9f8);
  border-color: rgba(15,118,110,0.22);
  box-shadow: var(--shadow-1);
}
body.theme-white .debate-cta::before { opacity: 0.5; }
body.theme-white .debate-cta h2 {
  background: linear-gradient(135deg, #134e4a, #0369a1);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
body.theme-white .debate-cta p { color: var(--text-2); }
body.theme-white .debate-input { background: #ffffff; border-color: var(--border-2); color: var(--text); }
body.theme-white .vs-orb { box-shadow: 0 0 22px rgba(20,184,166,0.30); }

/* 状态条 / 浮动按钮 / 输入：白底适配 */
body.theme-white .status-bar,
body.theme-white .arena-toolbar .tb-btn,
body.theme-white .arena-foot textarea,
body.theme-white .head-search,
body.theme-white .market-switch,
body.theme-white .btn-ghost,
body.theme-white .cmdk,
body.theme-white .modal {
  background: #ffffff;
  border-color: var(--border-2);
}
body.theme-white .arena-setup > summary:hover { background: var(--surface-2); }
body.theme-white .pack-card.on,
body.theme-white .agent-card.on {
  background: rgba(15,118,110,0.07);
  border-color: rgba(15,118,110,0.45);
  box-shadow: 0 0 0 1px rgba(15,118,110,0.14);
}
body.theme-white .skeleton {
  background: linear-gradient(90deg,#eef2f7 0%,#f6f8fb 50%,#eef2f7 100%);
  background-size: 200% 100%;
}

body.theme-plain {
  --bg: #f8fafc;
  --bg-2: #ffffff;
  --surface: #ffffff;
  --surface-2: #f3f4f6;
  --surface-3: #e5e7eb;
  --border: #d1d5db;
  --border-2: #cbd5e1;
  --accent: #111827;
  --accent-2: #374151;
  --gold: #6b7280;
  --gold-2: #374151;
  --text: #111827;
  --text-2: #374151;
  --muted: #6b7280;
  background: #f8fafc;
  color: var(--text);
}
body.theme-plain .sidebar,
body.theme-plain .main-head,
body.theme-plain .arena-foot {
  background: #ffffff;
}
body.theme-plain .logo-dot,
body.theme-plain .nav-link.active::before,
body.theme-plain .plan-bar span {
  background: #111827;
  box-shadow: none;
}
body.theme-plain .nav-link.active {
  background: #111827;
  color: #ffffff;
  box-shadow: none;
}
body.theme-plain .panel,
body.theme-plain .kpi,
body.theme-plain .case-card {
  box-shadow: none;
}
body.sidebar-collapsed .app-shell {
  grid-template-columns: 76px 1fr;
}
.sidebar {
  position: sticky; top: 0;
  height: 100vh;
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg) 100%);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 22px 16px 16px;
  overflow-y: auto;
  scrollbar-width: thin;
  z-index: 50;
  transition: padding .2s ease, width .2s ease;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }

.brand {
  display: flex; align-items: center; gap: 12px;
  padding: 4px 8px 22px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
  min-height: 58px;
}
.brand-copy {
  min-width: 0;
  flex: 1;
}
.logo-dot {
  width: 30px; height: 30px;
  background: var(--grad-cyan);
  border-radius: 9px;
  position: relative;
  box-shadow: 0 4px 14px rgba(0,212,255,0.4);
}
.logo-dot::after{
  content:''; position:absolute; inset:5px;
  background: var(--bg);
  border-radius: 6px;
  background-image: radial-gradient(circle at 30% 30%, var(--accent) 0%, transparent 60%);
}
.brand-name {
  font-weight: 800; font-size: 17px; letter-spacing: -0.02em;
}
.brand-name span { color: var(--accent); }
.brand-sub { font-size: 11px; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; margin-top: 2px; }
.sidebar-collapse-btn {
  width: 30px; height: 30px;
  display: inline-grid; place-items: center;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text-2);
  transition: color .15s, border-color .15s, background .15s, transform .2s ease;
}
.sidebar-collapse-btn:hover {
  color: var(--accent);
  border-color: rgba(0,212,255,0.45);
  background: rgba(0,212,255,0.08);
}

.nav-groups { flex: 1; padding: 0 4px; }
.nav-group { margin-bottom: 18px; }
.nav-title {
  font-size: 10.5px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.12em;
  padding: 0 10px 8px; font-weight: 600;
}
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 10px;
  border-radius: var(--r-md);
  color: var(--text-2);
  cursor: pointer;
  position: relative;
  font-weight: 500;
  font-size: 13.5px;
  transition: all .18s;
}
.nav-link span:not(.badge) { flex: 1; }
.nav-link:hover { background: var(--surface); color: var(--text); }
.nav-link.active {
  background: linear-gradient(90deg, rgba(0,212,255,0.16), rgba(79,139,255,0.04));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(0,212,255,0.18);
}
.nav-link.active::before {
  content:''; position:absolute; left:-4px; top:8px; bottom:8px;
  width: 3px; background: var(--grad-cyan); border-radius: 4px;
}
.nav-disabled {
  border-top: 1px solid var(--border);
  margin-top: 10px;
  padding-top: 10px;
}
.nav-disabled summary {
  list-style: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 7px 10px;
  text-transform: uppercase;
}
.nav-disabled summary::-webkit-details-marker { display: none; }
.nav-disabled summary::after {
  content: '+';
  float: right;
  font-size: 14px;
}
.nav-disabled[open] summary::after { content: '-'; }
.nav-disabled-body {
  opacity: .72;
}
.badge {
  font-size: 10.5px; padding: 2px 7px; border-radius: 999px;
  background: rgba(255,184,0,0.14); color: var(--gold-2);
  font-weight: 700;
}
.ico {
  width: 18px; height: 18px;
  background: currentColor;
  -webkit-mask-size: contain; mask-size: contain;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: center; mask-position: center;
  opacity: 0.85;
}
.ico-grid    { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'><rect x='3' y='3' width='7' height='7'/><rect x='14' y='3' width='7' height='7'/><rect x='3' y='14' width='7' height='7'/><rect x='14' y='14' width='7' height='7'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'><rect x='3' y='3' width='7' height='7'/><rect x='14' y='3' width='7' height='7'/><rect x='3' y='14' width='7' height='7'/><rect x='14' y='14' width='7' height='7'/></svg>"); }
.ico-star    { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'><polygon points='12,2 15,9 22,9.3 17,14 18.5,21 12,17.3 5.5,21 7,14 2,9.3 9,9'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'><polygon points='12,2 15,9 22,9.3 17,14 18.5,21 12,17.3 5.5,21 7,14 2,9.3 9,9'/></svg>"); }
.ico-box     { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'><path d='M21 16V8a2 2 0 0 0-1-1.73L13 2.27a2 2 0 0 0-2 0L4 6.27A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z'/><polyline points='3.27 6.96 12 12.01 20.73 6.96'/><line x1='12' y1='22.08' x2='12' y2='12'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'><path d='M21 16V8a2 2 0 0 0-1-1.73L13 2.27a2 2 0 0 0-2 0L4 6.27A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z'/><polyline points='3.27 6.96 12 12.01 20.73 6.96'/><line x1='12' y1='22.08' x2='12' y2='12'/></svg>"); }
.ico-pie     { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'><path d='M21.21 15.89A10 10 0 1 1 8 2.83'/><path d='M22 12A10 10 0 0 0 12 2v10z'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'><path d='M21.21 15.89A10 10 0 1 1 8 2.83'/><path d='M22 12A10 10 0 0 0 12 2v10z'/></svg>"); }
.ico-track   { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'><polyline points='22 12 18 12 15 21 9 3 6 12 2 12'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'><polyline points='22 12 18 12 15 21 9 3 6 12 2 12'/></svg>"); }
.ico-search  { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'><circle cx='11' cy='11' r='7'/><line x1='20' y1='20' x2='16.65' y2='16.65'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'><circle cx='11' cy='11' r='7'/><line x1='20' y1='20' x2='16.65' y2='16.65'/></svg>"); }
.ico-reverse { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'><polyline points='1 4 1 10 7 10'/><path d='M3.51 15a9 9 0 1 0 2.13-9.36L1 10'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'><polyline points='1 4 1 10 7 10'/><path d='M3.51 15a9 9 0 1 0 2.13-9.36L1 10'/></svg>"); }
.ico-ads     { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'><path d='M3 11l18-8v18l-18-8v-2z'/><path d='M11.6 16.8a3 3 0 1 1-5.8-1.6'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'><path d='M3 11l18-8v18l-18-8v-2z'/><path d='M11.6 16.8a3 3 0 1 1-5.8-1.6'/></svg>"); }
.ico-chat    { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'><path d='M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'><path d='M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z'/></svg>"); }
.ico-edit    { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'><path d='M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7'/><path d='M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'><path d='M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7'/><path d='M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z'/></svg>"); }
.ico-calc    { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'><rect x='4' y='2' width='16' height='20' rx='2'/><line x1='8' y1='6' x2='16' y2='6'/><line x1='8' y1='10' x2='10' y2='10'/><line x1='12' y1='10' x2='14' y2='10'/><line x1='8' y1='14' x2='10' y2='14'/><line x1='12' y1='14' x2='14' y2='14'/><line x1='8' y1='18' x2='10' y2='18'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'><rect x='4' y='2' width='16' height='20' rx='2'/><line x1='8' y1='6' x2='16' y2='6'/><line x1='8' y1='10' x2='10' y2='10'/><line x1='12' y1='10' x2='14' y2='10'/><line x1='8' y1='14' x2='10' y2='14'/><line x1='12' y1='14' x2='14' y2='14'/><line x1='8' y1='18' x2='10' y2='18'/></svg>"); }
.ico-tk      { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'><path d='M19.5 6.5a5.5 5.5 0 0 1-4-1.7v9.7a6 6 0 1 1-6-6v3a3 3 0 1 0 3 3V2h3a5.5 5.5 0 0 0 4 4z'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'><path d='M19.5 6.5a5.5 5.5 0 0 1-4-1.7v9.7a6 6 0 1 1-6-6v3a3 3 0 1 0 3 3V2h3a5.5 5.5 0 0 0 4 4z'/></svg>"); }

.sidebar-foot { padding: 8px 4px 0; }
.plan-card {
  background: linear-gradient(135deg, rgba(255,184,0,0.10), rgba(0,212,255,0.06));
  border: 1px solid rgba(255,184,0,0.20);
  border-radius: var(--r-lg);
  padding: 14px;
  position: relative;
}
.plan-tag {
  font-size: 10px; font-weight: 800; letter-spacing: 0.1em;
  background: var(--grad-gold); color: #1a1303;
  padding: 3px 7px; border-radius: 5px; display: inline-block;
}
.plan-title { font-weight: 700; margin-top: 8px; font-size: 13px; }
.plan-sub { color: var(--text-2); font-size: 11.5px; margin-top: 2px; }
.plan-bar {
  height: 4px; background: rgba(255,255,255,0.06); border-radius: 99px;
  margin-top: 10px; overflow: hidden;
}
.plan-bar span { display: block; height: 100%; background: var(--grad-gold); border-radius: 99px; }
.plan-meta { color: var(--muted); font-size: 10.5px; margin-top: 6px; }

body.sidebar-collapsed .sidebar {
  padding: 22px 10px 16px;
  overflow-x: hidden;
}
body.sidebar-collapsed .brand {
  justify-content: center;
  padding: 4px 0 18px;
}
body.sidebar-collapsed .brand-copy,
body.sidebar-collapsed .nav-title,
body.sidebar-collapsed .nav-link span,
body.sidebar-collapsed .sidebar-foot {
  display: none;
}
body.sidebar-collapsed .sidebar-collapse-btn {
  position: absolute;
  left: 52px;
  top: 22px;
  transform: rotate(180deg);
}
body.sidebar-collapsed .nav-groups {
  padding: 0;
}
body.sidebar-collapsed .nav-group {
  margin-bottom: 10px;
}
body.sidebar-collapsed .nav-link {
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  margin: 0 auto 6px;
  gap: 0;
}
body.sidebar-collapsed .nav-link.active::before {
  left: -7px;
  top: 9px;
  bottom: 9px;
}
body.sidebar-collapsed .ico {
  width: 19px;
  height: 19px;
}

/* ===== Main / Top Bar ===== */
.topbar { display: none; }
.main { padding: 22px 28px 60px; min-width: 0; }
.main-head {
  display: flex; gap: 14px; align-items: center;
  margin-bottom: 22px;
  position: sticky; top: 0; z-index: 20;
  padding: 6px 0 12px;
  background: linear-gradient(180deg, var(--bg) 60%, transparent);
  backdrop-filter: blur(6px);
}
.head-search {
  flex: 1; max-width: 560px;
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 9px 14px;
  color: var(--text-2);
  transition: border .15s;
}
.head-search:focus-within { border-color: rgba(0,212,255,0.5); box-shadow: 0 0 0 3px rgba(0,212,255,0.10); }
.head-search input { flex: 1; background: transparent; border: 0; outline: 0; font-size: 13.5px; }
.theme-toggle {
  width: 34px; height: 34px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font-size: 12px; font-weight: 800;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.code-block {
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  color: var(--text-2);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  line-height: 1.55;
  padding: 10px 12px;
  overflow-x: auto;
}
.compact-config,
.run-log-box {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface);
}
.compact-config summary,
.run-log-box summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--text);
}
.mcp-agent-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}
.mcp-agent-toolbar .btn,
.mcp-agent-toolbar .btn-secondary {
  min-width: 118px;
}
.mcp-tool-panel { margin-top: 14px; }
.mcp-tool-hint {
  color: var(--text-2);
  font-size: 12.5px;
  margin-bottom: 10px;
}
.mcp-tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
  max-height: 360px;
  overflow: auto;
}
.mcp-tool-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  text-align: left;
  padding: 10px;
  cursor: pointer;
  min-height: 88px;
  min-width: 0;
}
.mcp-tool-card.on {
  border-color: var(--accent);
  background: rgba(0,212,255,0.10);
}
.mcp-tool-name {
  display: block;
  font-weight: 800;
  font-size: 12.5px;
  margin-bottom: 5px;
  overflow-wrap: anywhere;
}
.mcp-tool-desc {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--text-2);
  font-size: 11.5px;
  line-height: 1.45;
}
.run-log-list {
  display: grid;
  gap: 6px;
  margin-top: 8px;
  max-height: 220px;
  overflow: auto;
}
.run-log-item {
  border-left: 3px solid var(--border-2);
  padding: 6px 8px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12px;
  overflow-wrap: anywhere;
}
.run-log-item.ok { border-left-color: var(--success); }
.run-log-item.error { border-left-color: var(--danger); }
.head-search kbd {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, 'JetBrains Mono', monospace; font-size: 11px;
  background: var(--surface-3); padding: 2px 6px; border-radius: 4px;
  color: var(--text-2);
}
.head-actions { display: flex; align-items: center; gap: 10px; }
.market-switch {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; font-weight: 600; font-size: 13px;
}
.flag { font-size: 16px; }
.btn-ghost {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  padding: 8px 12px; border-radius: 10px; font-weight: 600; font-size: 13px;
  transition: all .15s;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--grad-cyan); color: #001022;
  display: grid; place-items: center; font-weight: 800;
}

/* ===== Module Content ===== */
.module-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 18px; flex-wrap: wrap;
}
.module-title h1 {
  margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -0.02em;
}
.module-title .crumbs { color: var(--muted); font-size: 12px; margin-bottom: 6px; letter-spacing: 0.04em; }
.module-title .sub { color: var(--text-2); margin-top: 6px; font-size: 13.5px; max-width: 720px; }
.actions-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--grad-cyan); color: #001022; font-weight: 700; font-size: 13px;
  border: 0; border-radius: 10px; padding: 9px 14px;
  transition: transform .12s, filter .12s;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.06); }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

/* KPI Cards */
.kpi-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(4, minmax(0,1fr));
  margin-bottom: 22px;
}
.kpi {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 16px;
  position: relative; overflow: hidden;
}
.kpi::before{
  content:''; position:absolute; right:-30px; top:-30px;
  width:120px; height:120px; border-radius:50%;
  background: radial-gradient(circle, rgba(0,212,255,0.10), transparent 70%);
}
.kpi .lbl { color: var(--text-2); font-size: 12.5px; font-weight: 500; }
.kpi .val { font-size: 26px; font-weight: 800; margin-top: 6px; letter-spacing: -0.02em; }
.kpi .delta { font-size: 12px; margin-top: 6px; display: inline-flex; align-items: center; gap: 4px; }
.kpi .delta.up { color: var(--success); }
.kpi .delta.down { color: var(--danger); }
.kpi .spark { position: absolute; right: 12px; bottom: 10px; opacity: 0.65; }

/* Panels */
.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 18px;
  margin-bottom: 18px;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; gap: 10px; flex-wrap: wrap;
}
.panel-head h3 { margin: 0; font-size: 15px; font-weight: 700; }
.panel-head .sub { color: var(--muted); font-size: 12px; }

.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; }
.grid-cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

/* Filters */
.filters {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 16px; margin-bottom: 18px;
}
.filter-grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 11.5px; color: var(--text-2); font-weight: 600; letter-spacing: 0.02em; }
.field-input, select.field-input {
  background: var(--surface-2); border: 1px solid var(--border-2);
  color: var(--text); border-radius: 9px; padding: 9px 11px;
  font-size: 13px; outline: 0; transition: border .12s;
  appearance: none;
}
.field-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,212,255,0.10); }
.range { display: flex; gap: 6px; align-items: center; }
.range .field-input { flex: 1; min-width: 0; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  background: var(--surface-2); border: 1px solid var(--border-2);
  color: var(--text-2);
  padding: 6px 11px; border-radius: 999px; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all .12s;
}
.chip:hover { color: var(--text); border-color: var(--accent); }
.chip.on { background: rgba(0,212,255,0.16); color: var(--accent); border-color: rgba(0,212,255,0.45); }
.filter-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }

/* Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--r-md); max-width: 100%; }
table.data {
  width: 100%; border-collapse: collapse; font-size: 13px;
  min-width: 720px;
}
table.data th, table.data td {
  padding: 12px 12px; text-align: left; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.data th {
  color: var(--text-2); font-weight: 600; font-size: 11.5px;
  text-transform: uppercase; letter-spacing: 0.06em;
  background: var(--surface-2); position: sticky; top: 0;
}
table.data tr:hover td { background: rgba(255,255,255,0.015); }
table.data .num { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, 'JetBrains Mono', monospace; font-weight: 600; }
.tag {
  display: inline-block; padding: 3px 9px; font-size: 11px; font-weight: 700;
  border-radius: 999px; letter-spacing: 0.04em;
}
.tag-cyan { background: rgba(0,212,255,0.14); color: var(--accent); }
.tag-gold { background: rgba(255,184,0,0.14); color: var(--gold-2); }
.tag-success { background: rgba(0,229,161,0.14); color: var(--success); }
.tag-warn { background: rgba(255,159,67,0.14); color: var(--warn); }
.tag-danger { background: rgba(255,84,112,0.14); color: var(--danger); }
.tag-violet { background: rgba(138,125,255,0.14); color: var(--violet); }

.bar {
  width: 80px; height: 6px; background: rgba(255,255,255,0.06);
  border-radius: 99px; overflow: hidden; display: inline-block; vertical-align: middle;
}
.bar > span { display: block; height: 100%; border-radius: 99px; }
.bar.cyan > span { background: var(--grad-cyan); }
.bar.gold > span { background: var(--grad-gold); }
.bar.success > span { background: var(--grad-success); }

/* Score circle */
.score {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; border-radius: 50%;
  font-weight: 800; font-size: 14px;
  background:
    conic-gradient(var(--accent) calc(var(--p) * 1%), rgba(255,255,255,0.06) 0);
  position: relative;
}
.score::after {
  content: attr(data-v);
  position: absolute; inset: 4px;
  background: var(--surface); border-radius: 50%;
  display: grid; place-items: center;
}
.score.gold { background: conic-gradient(var(--gold) calc(var(--p) * 1%), rgba(255,255,255,0.06) 0); }
.score.success { background: conic-gradient(var(--success) calc(var(--p) * 1%), rgba(255,255,255,0.06) 0); }

/* Cards (case product) */
.case-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.case-card:hover { transform: translateY(-3px); border-color: rgba(0,212,255,0.40); box-shadow: var(--shadow-glow); }
.case-thumb {
  height: 160px;
  display: grid; place-items: center; font-size: 64px;
  background: linear-gradient(135deg, var(--surface-2), var(--surface-3));
  position: relative;
  border-bottom: 1px solid var(--border);
}
.case-thumb .ribbon {
  position: absolute; top: 10px; left: 10px;
  background: var(--grad-gold); color: #1a1303;
  font-size: 10.5px; font-weight: 800; padding: 4px 8px; border-radius: 5px;
  letter-spacing: 0.05em;
}
.case-thumb .opp-score {
  position: absolute; top: 10px; right: 10px;
  background: rgba(10,14,26,0.7); backdrop-filter: blur(8px);
  color: var(--accent); font-weight: 800; font-size: 12px;
  padding: 4px 10px; border-radius: 8px;
  border: 1px solid rgba(0,212,255,0.30);
}
.case-body { padding: 14px 16px 16px; flex: 1; display: flex; flex-direction: column; }
.case-body h4 { margin: 0 0 4px; font-size: 15px; font-weight: 700; line-height: 1.35; }
.case-body .cat { font-size: 11.5px; color: var(--muted); }
.case-stats {
  display: grid; grid-template-columns: repeat(3,1fr); gap: 10px;
  margin-top: 12px; padding-top: 12px;
  border-top: 1px dashed var(--border-2);
}
.case-stats .st .lbl { font-size: 10.5px; color: var(--muted); letter-spacing: 0.04em; }
.case-stats .st .val { font-weight: 700; font-size: 13.5px; }
.case-insight {
  margin-top: 12px;
  background: rgba(0,212,255,0.06); border: 1px solid rgba(0,212,255,0.18);
  border-radius: var(--r-sm); padding: 10px 12px; font-size: 12.5px;
  color: var(--text-2); line-height: 1.55;
}
.case-insight strong { color: var(--accent); }

/* Hero (Dashboard) */
.hero {
  position: relative;
  background:
    radial-gradient(800px 300px at 90% -50%, rgba(0,212,255,0.20), transparent 60%),
    radial-gradient(600px 300px at 0% 0%, rgba(255,184,0,0.10), transparent 60%),
    linear-gradient(160deg, rgba(255,255,255,0.04), rgba(255,255,255,0.01));
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 26px 28px;
  margin-bottom: 18px;
  overflow: hidden;
}
.hero h2 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.hero .lead { color: var(--text-2); margin-top: 8px; max-width: 580px; font-size: 13.5px; }
.hero-actions { margin-top: 16px; display: flex; gap: 10px; flex-wrap: wrap; }
.hero-art {
  position: absolute; right: -40px; top: -40px; width: 320px; height: 320px;
  background:
    conic-gradient(from 220deg, rgba(0,212,255,0.25), rgba(79,139,255,0.05), rgba(255,184,0,0.20), rgba(0,212,255,0.25));
  filter: blur(40px); border-radius: 50%; opacity: 0.55; pointer-events: none;
}

/* Heat map / opportunity matrix */
.opp-matrix {
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px;
  margin-top: 12px;
}
.opp-cell {
  aspect-ratio: 1; border-radius: 6px;
  background: rgba(0,212,255, calc(var(--h, 0) * 0.12));
  border: 1px solid rgba(0,212,255,0.08);
  position: relative;
}
.opp-cell[data-h="5"] { background: rgba(0,212,255,0.58); }
.opp-cell[data-h="4"] { background: rgba(0,212,255,0.42); }
.opp-cell[data-h="3"] { background: rgba(0,212,255,0.30); }
.opp-cell[data-h="2"] { background: rgba(0,212,255,0.18); }
.opp-cell[data-h="1"] { background: rgba(0,212,255,0.10); }
.opp-cell[data-h="0"] { background: rgba(255,255,255,0.03); }

/* Charts */
.chart-box { position: relative; height: 240px; }
.chart-box.sm { height: 180px; }
.chart-box.lg { height: 320px; }

/* Star rating */
.stars { color: var(--gold-2); letter-spacing: 1px; font-size: 12px; }

/* Pills nav (Inner module tabs) */
.pills {
  display: flex; gap: 6px; padding: 4px;
  background: var(--surface-2); border: 1px solid var(--border-2);
  border-radius: 999px; width: max-content; max-width: 100%;
  overflow-x: auto;
}
.pill {
  padding: 7px 13px; font-size: 12.5px; font-weight: 600;
  color: var(--text-2); border-radius: 999px; cursor: pointer; white-space: nowrap;
}
.pill.on { background: var(--grad-cyan); color: #001022; }
.pill:not(.on):hover { color: var(--text); }

/* Icon button */
.icon-btn {
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); border-radius: 10px; padding: 7px 9px;
  display: inline-grid; place-items: center;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Word-cloud / keyword cloud */
.kw-cloud { display: flex; flex-wrap: wrap; gap: 8px 10px; }
.kw-cloud .kw {
  background: var(--surface-2); border: 1px solid var(--border-2);
  padding: 6px 11px; border-radius: 999px;
  font-weight: 600; transition: all .12s; cursor: pointer;
}
.kw-cloud .kw[data-w="5"] { font-size: 18px; color: var(--accent); border-color: rgba(0,212,255,0.45); }
.kw-cloud .kw[data-w="4"] { font-size: 16px; color: var(--gold-2); }
.kw-cloud .kw[data-w="3"] { font-size: 14px; color: var(--text); }
.kw-cloud .kw[data-w="2"] { font-size: 13px; color: var(--text-2); }
.kw-cloud .kw[data-w="1"] { font-size: 12px; color: var(--muted); }

/* VOC review */
.voc-list .voc { padding: 12px 0; border-bottom: 1px dashed var(--border-2); }
.voc-list .voc:last-child { border-bottom: 0; }
.voc-meta { display: flex; gap: 8px; align-items: center; font-size: 11.5px; color: var(--muted); margin-bottom: 4px; }
.voc-text { font-size: 13px; color: var(--text); }
.voc-text mark { background: rgba(255,184,0,0.18); color: var(--gold-2); padding: 1px 4px; border-radius: 4px; }

/* Sidebar mask (mobile) */
.sidebar-mask {
  position: fixed; inset: 0; z-index: 49;
  background: rgba(0,0,0,0.55); backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.sidebar-mask.show { opacity: 1; pointer-events: all; }

/* Profit calculator output */
.calc-out {
  display: grid; gap: 10px;
  grid-template-columns: repeat(3, minmax(0,1fr));
}
.calc-line {
  background: var(--surface-2); border: 1px solid var(--border-2);
  border-radius: var(--r-md); padding: 12px 14px;
}
.calc-line .lbl { color: var(--text-2); font-size: 11.5px; }
.calc-line .val { font-weight: 800; font-size: 18px; margin-top: 4px; font-family: ui-monospace, 'SF Mono', Menlo, Consolas, 'JetBrains Mono', monospace; }
.calc-line.profit { background: linear-gradient(135deg, rgba(0,229,161,0.14), rgba(0,212,255,0.06)); border-color: rgba(0,229,161,0.30); }
.calc-line.profit .val { color: var(--success); }
.calc-line.danger .val { color: var(--danger); }

/* TikTok creator card */
.tk-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.tk-card {
  background: linear-gradient(160deg, rgba(255,122,198,0.06), rgba(138,125,255,0.04));
  border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 14px;
}
.tk-head { display: flex; align-items: center; gap: 10px; }
.tk-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: linear-gradient(135deg, #ff7ac6, #8a7dff);
  display: grid; place-items: center; color: #fff; font-weight: 800;
}
.tk-handle { font-weight: 700; }
.tk-meta { font-size: 11.5px; color: var(--muted); }
.tk-stats { display: grid; grid-template-columns: repeat(3,1fr); margin-top: 12px; gap: 8px; text-align: center; }
.tk-stats .v { font-weight: 800; }
.tk-stats .l { font-size: 10.5px; color: var(--muted); }

/* ===== Responsive ===== */
@media (max-width: 1280px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  body.sidebar-collapsed .app-shell { grid-template-columns: 1fr; }
  .topbar {
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 60;
    background: rgba(10,14,26,0.85); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
    padding: 10px 14px;
  }
  .topbar-brand { display: flex; align-items: center; gap: 9px; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 280px;
    transform: translateX(-100%); transition: transform .25s ease;
    border-right: 1px solid var(--border);
  }
  body.sidebar-collapsed .sidebar {
    padding: 22px 16px 16px;
    overflow-x: visible;
  }
  body.sidebar-collapsed .brand {
    justify-content: flex-start;
    padding: 4px 8px 22px;
  }
  body.sidebar-collapsed .brand-copy,
  body.sidebar-collapsed .nav-title,
  body.sidebar-collapsed .nav-link span,
  body.sidebar-collapsed .sidebar-foot {
    display: initial;
  }
  body.sidebar-collapsed .nav-link {
    justify-content: flex-start;
    width: auto;
    height: auto;
    padding: 9px 10px;
    margin: 0;
    gap: 12px;
  }
  body.sidebar-collapsed .sidebar-collapse-btn {
    display: none;
  }
  .sidebar.open { transform: translateX(0); }
  .main { padding: 16px 16px 60px; }
  .main-head { flex-wrap: wrap; }
  .head-search { order: 2; flex-basis: 100%; max-width: 100%; }
  .head-actions { order: 1; width: 100%; justify-content: space-between; }
  .head-search kbd { display: none; }
  .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 12px; }
  .kpi .val { font-size: 20px; }
  .module-title h1 { font-size: 19px; }
  .hero { padding: 20px; }
  .hero h2 { font-size: 19px; }
  .panel { padding: 14px; }
  .calc-out { grid-template-columns: 1fr; }
  .opp-matrix { grid-template-columns: repeat(6, 1fr); }
  .market-switch span:not(.flag) { display: none; }
  .mcp-agent-toolbar .btn,
  .mcp-agent-toolbar .btn-secondary,
  .mcp-agent-toolbar .tag {
    flex: 1 1 100%;
    justify-content: center;
  }
  .mcp-tool-grid {
    grid-template-columns: 1fr;
    max-height: 52vh;
  }
  .mcp-tool-card { min-height: auto; }
  .run-log-list { max-height: 180px; } 
} 
@media (max-width: 380px) {
  .kpi-grid { grid-template-columns: 1fr; }
}

/* ====================================================================
   AI DEBATE ARENA
   ==================================================================== */
.ico-debate { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'><path d='M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'><path d='M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z'/></svg>"); }

.debate-link {
  background: linear-gradient(135deg, rgba(255,122,198,0.10), rgba(138,125,255,0.10));
  border: 1px solid rgba(255,122,198,0.22) !important;
  margin-bottom: 8px;
}
.debate-link.active { background: linear-gradient(135deg, rgba(255,122,198,0.22), rgba(138,125,255,0.14)) !important; }
.badge-hot {
  background: linear-gradient(135deg, #ff7ac6, #8a7dff) !important;
  color: #fff !important;
  animation: pulseHot 1.8s ease-in-out infinite;
  letter-spacing: 0.08em;
}
@keyframes pulseHot { 0%,100% { box-shadow: 0 0 0 0 rgba(255,122,198,0.45); } 50% { box-shadow: 0 0 0 6px rgba(255,122,198,0); } }

/* Big CTA in Dashboard */
.debate-cta {
  position: relative;
  margin-bottom: 18px;
  padding: 22px 24px;
  border-radius: var(--r-xl);
  background:
    radial-gradient(700px 220px at 90% 0%, rgba(255,122,198,0.28), transparent 65%),
    radial-gradient(700px 220px at 0% 100%, rgba(138,125,255,0.28), transparent 65%),
    linear-gradient(135deg, #1a1230 0%, #2a1a4a 50%, #102a3e 100%);
  border: 1px solid rgba(255,122,198,0.30);
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(138,125,255,0.20), inset 0 1px 0 rgba(255,255,255,0.06);
}
.debate-cta::before {
  content: '';
  position: absolute; inset: 0;
  background:
    repeating-linear-gradient(115deg, transparent 0 80px, rgba(255,255,255,0.025) 80px 81px),
    repeating-linear-gradient(25deg, transparent 0 80px, rgba(255,255,255,0.02) 80px 81px);
  pointer-events: none;
}
.debate-cta-grid {
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; align-items: center;
  position: relative; z-index: 1;
}
.debate-cta-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.debate-pill {
  font-size: 10.5px; font-weight: 800; letter-spacing: 0.14em;
  padding: 4px 9px; border-radius: 5px;
  background: linear-gradient(135deg, #ff7ac6, #8a7dff); color: #fff;
}
.debate-cta h2 {
  margin: 8px 0 6px; font-size: 26px; font-weight: 800; letter-spacing: -0.02em;
  background: linear-gradient(135deg, #fff 0%, #ffd6f0 50%, #c8b8ff 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.debate-cta p { color: #cfc8e8; margin: 0 0 14px; font-size: 13.5px; max-width: 540px; }
.debate-input-row {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.debate-input {
  flex: 1; min-width: 200px;
  background: rgba(10,14,26,0.55); border: 1px solid rgba(255,255,255,0.10);
  color: #fff; padding: 12px 14px; border-radius: 12px; font-size: 13.5px; outline: 0;
  backdrop-filter: blur(6px);
}
.debate-input:focus { border-color: #ff7ac6; box-shadow: 0 0 0 3px rgba(255,122,198,0.18); }
.debate-go {
  background: linear-gradient(135deg, #ff7ac6 0%, #8a7dff 100%);
  color: #fff; border: 0; font-weight: 800; font-size: 14px;
  padding: 0 22px; border-radius: 12px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: transform .12s, filter .12s;
}
.debate-go:hover { transform: translateY(-1px); filter: brightness(1.08); }

.debate-vs {
  position: relative; height: 160px;
  display: grid; place-items: center;
}
.vs-orb {
  width: 60px; height: 60px; border-radius: 50%;
  background: linear-gradient(135deg, #ff7ac6, #8a7dff);
  display: grid; place-items: center; color: #fff; font-weight: 900;
  font-size: 22px; letter-spacing: 0.04em;
  box-shadow: 0 0 30px rgba(255,122,198,0.5), 0 0 60px rgba(138,125,255,0.4);
  animation: vsPulse 2.4s ease-in-out infinite;
  position: relative; z-index: 2;
}
@keyframes vsPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.10); } }
.agent-chip {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(10,14,26,0.7); backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 100px; padding: 8px 14px 8px 8px;
  display: flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 12.5px; z-index: 2;
}
.agent-chip.left  { left: 0; }
.agent-chip.right { right: 0; }
.agent-chip .av {
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; font-size: 11px; font-weight: 800; color: #fff;
}
.agent-chip.left  .av { background: linear-gradient(135deg, #00d4ff, #4f8bff); }
.agent-chip.right .av { background: linear-gradient(135deg, #ff7ac6, #ffb800); }
.agent-chip .sub { color: var(--muted); font-weight: 500; font-size: 11px; }

/* ===== Debate Arena page ===== */
.arena {
  display: grid; grid-template-columns: 260px 1fr; gap: 16px;
}
.arena-side {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 14px;
  height: calc(100vh - 130px);
  position: sticky; top: 80px;
  overflow-y: auto;
  display: flex; flex-direction: column;
}
.arena-side h4 { margin: 6px 0 8px; font-size: 13px; color: var(--text-2); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.session-item {
  padding: 10px 12px; border-radius: 10px; cursor: pointer;
  border: 1px solid transparent; margin-bottom: 6px;
  font-size: 12.5px;
}
.session-item:hover { background: var(--surface-2); }
.session-item.active { background: linear-gradient(135deg, rgba(255,122,198,0.10), rgba(138,125,255,0.06)); border-color: rgba(255,122,198,0.30); }
.session-item .t { font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-item .m { color: var(--muted); font-size: 10.5px; margin-top: 3px; display: flex; justify-content: space-between; }
.session-del {
  margin-left: 6px; opacity: 0; transition: opacity .12s;
  background: none; border: 0; color: var(--muted); cursor: pointer;
}
.session-item:hover .session-del { opacity: 1; }

.arena-main {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg);
  display: flex; flex-direction: column;
  min-height: calc(100vh - 130px);
  position: relative; overflow: hidden;
}

.arena-config {
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  display: grid; gap: 10px;
}
.arena-config .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.arena-config .field-input { background: var(--surface-2); border: 1px solid var(--border-2); color: var(--text); border-radius: 9px; padding: 9px 11px; font-size: 13px; outline: 0; }
.arena-config textarea.field-input { width: 100%; min-height: 64px; resize: vertical; font-family: inherit; }
.model-config {
  display: grid;
  grid-template-columns: minmax(130px, .75fr) repeat(3, minmax(160px, 1fr)) auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  background: rgba(0,212,255,0.05);
  border: 1px solid rgba(0,212,255,0.16);
  border-radius: 12px;
}
.model-config.triple-model-config {
  grid-template-columns: repeat(3, minmax(230px, 1fr));
  align-items: stretch;
  overflow: hidden;
}
.triple-model-config .session-title-field {
  grid-column: 1 / -1;
}
.triple-model-config .role-model-row {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  min-width: 0;
  overflow: hidden;
}
.triple-model-config .role-model-row summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.triple-model-config .role-model-row summary::-webkit-details-marker { display: none; }
.triple-model-config .role-model-row summary::after {
  content: '编辑';
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}
.triple-model-config .role-model-row[open] summary::after { content: '收起'; }
.role-edit-grid {
  display: grid;
  grid-template-columns: minmax(120px, .72fr) minmax(170px, 1fr) minmax(120px, .72fr);
  gap: 10px;
  margin-top: 12px;
}
.role-model-title {
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .04em;
}
.role-model-summary {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-2);
  font-size: 12px;
  text-align: right;
}
.model-field { gap: 5px; min-width: 0; }
.model-field label {
  color: var(--text-2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.model-input { width: 100%; min-width: 0; }
.model-source {
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.35;
  margin-top: 3px;
}
.model-save {
  align-self: center;
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
  padding: 8px 10px;
}
.model-save.saved { color: var(--success); }

.seg {
  display: inline-flex; background: var(--surface-2); padding: 3px; border-radius: 999px; border: 1px solid var(--border-2);
}
.seg button {
  background: transparent; border: 0; color: var(--text-2); font-weight: 600; font-size: 12px;
  padding: 6px 14px; border-radius: 999px; cursor: pointer;
}
.seg button.on { background: var(--grad-cyan); color: #001022; }

.role-card {
  background: var(--surface-2); border: 1px solid var(--border-2);
  border-radius: 10px; padding: 9px 11px; display: flex; align-items: center; gap: 8px;
  flex: 1; min-width: 200px;
}
.role-card .av { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 12px; }
.role-card.pro .av { background: linear-gradient(135deg, #00d4ff, #4f8bff); }
.role-card.con .av { background: linear-gradient(135deg, #ff7ac6, #ffb800); }
.role-card .n { font-weight: 700; font-size: 13px; }
.role-card .r { color: var(--muted); font-size: 11px; }
.role-card select { margin-left: auto; background: var(--surface); border: 1px solid var(--border); color: var(--text); border-radius: 7px; padding: 4px 8px; font-size: 12px; }
.swap-btn {
  background: var(--surface-2); border: 1px solid var(--border-2); color: var(--text);
  border-radius: 10px; padding: 9px 12px; cursor: pointer; transition: all .12s;
  display: inline-grid; place-items: center;
}
.swap-btn:hover { color: var(--accent); border-color: var(--accent); transform: rotate(180deg); }

.arena-stream {
  flex: 1; padding: 18px 18px 96px;
  overflow-y: auto;
  position: relative;
}

/* FX overlay */
.fx-layer {
  position: absolute; inset: 0; pointer-events: none; z-index: 0;
  opacity: 0; transition: opacity .35s;
}
.fx-layer.active { opacity: 1; }
.arena-stream > * { position: relative; z-index: 1; }

/* FX 1: neural pulse */
.fx-neural::before, .fx-neural::after {
  content: ''; position: absolute; border-radius: 50%;
  background: radial-gradient(circle, currentColor 0%, transparent 60%);
  filter: blur(40px); opacity: 0.32;
  animation: neuralFloat 6s ease-in-out infinite;
}
.fx-neural::before { width: 280px; height: 280px; color: #00d4ff; left: 10%; top: 20%; }
.fx-neural::after  { width: 320px; height: 320px; color: #ff7ac6; right: 10%; bottom: 20%; animation-delay: -3s; }
@keyframes neuralFloat { 0%,100% { transform: translate(0,0); } 50% { transform: translate(40px,-30px); } }

/* FX 2: matrix rain */
.fx-matrix {
  background-image:
    repeating-linear-gradient(90deg, transparent 0 18px, rgba(0,229,161,0.06) 18px 19px);
}
.fx-matrix::after {
  content: ''; position: absolute; inset: 0;
  background:
    repeating-linear-gradient(180deg, rgba(0,229,161,0.10) 0 2px, transparent 2px 14px);
  animation: matrixRain 8s linear infinite;
}
@keyframes matrixRain { 0% { background-position: 0 0; } 100% { background-position: 0 200px; } }

/* FX 3: lightning */
.fx-lightning::before {
  content: ''; position: absolute; inset: 0;
  background:
    linear-gradient(115deg, transparent 49%, rgba(255,184,0,0.40) 50%, transparent 51%);
  filter: blur(2px); opacity: 0;
  animation: lightning 5s linear infinite;
}
@keyframes lightning {
  0%, 92%, 100% { opacity: 0; }
  93% { opacity: 0.9; transform: translateX(0); }
  94% { opacity: 0.2; }
  95% { opacity: 0.7; transform: translateX(-30px); }
  96% { opacity: 0; }
}

/* FX 4: particles */
.fx-particles {
  background-image:
    radial-gradient(2px 2px at 10% 20%, rgba(0,212,255,0.7), transparent),
    radial-gradient(2px 2px at 30% 80%, rgba(255,122,198,0.7), transparent),
    radial-gradient(1.5px 1.5px at 50% 40%, rgba(138,125,255,0.7), transparent),
    radial-gradient(2px 2px at 70% 60%, rgba(255,184,0,0.7), transparent),
    radial-gradient(1.5px 1.5px at 90% 30%, rgba(0,229,161,0.7), transparent),
    radial-gradient(2px 2px at 20% 70%, rgba(0,212,255,0.5), transparent);
  background-size: 600px 600px;
  animation: particles 30s linear infinite;
}
@keyframes particles { 0% { background-position: 0 0,0 0,0 0,0 0,0 0,0 0; } 100% { background-position: 600px 300px,-600px 200px,400px -400px,-300px 400px,300px 600px,-400px -300px; } }

/* FX 5: scan */
.fx-scan::before {
  content: ''; position: absolute; left: -50%; right: -50%; height: 30%;
  background: linear-gradient(180deg, transparent, rgba(0,212,255,0.20), transparent);
  animation: scan 4s linear infinite;
}
@keyframes scan { 0% { top: -30%; } 100% { top: 100%; } }

/* ===== Bubbles ===== */
.turn-divider {
  text-align: center; margin: 14px 0;
  color: var(--muted); font-size: 11px; letter-spacing: 0.16em;
  position: relative;
}
.turn-divider::before, .turn-divider::after {
  content:''; position: absolute; top: 50%; width: 32%;
  border-top: 1px dashed var(--border-2);
}
.turn-divider::before { left: 0; }
.turn-divider::after  { right: 0; }

.bubble {
  display: flex; gap: 10px; margin: 12px 0;
  max-width: 88%;
}
.bubble.pro { margin-right: auto; }
.bubble.con { margin-left: auto; flex-direction: row-reverse; }
.bubble.user { margin: 14px auto; max-width: 78%; }

.bubble .av {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 12px;
  flex-shrink: 0;
}
.bubble.pro .av { background: linear-gradient(135deg, #00d4ff, #4f8bff); }
.bubble.con .av { background: linear-gradient(135deg, #ff7ac6, #ffb800); }
.bubble.user .av { background: linear-gradient(135deg, #00e5a1, #00d4ff); }

.bubble-body {
  background: var(--surface-2); border: 1px solid var(--border-2);
  border-radius: 14px; padding: 12px 14px;
  position: relative; min-width: 0;
}
.bubble.pro .bubble-body { border-color: rgba(0,212,255,0.22); background: linear-gradient(135deg, rgba(0,212,255,0.06), rgba(79,139,255,0.02)); border-top-left-radius: 4px; }
.bubble.con .bubble-body { border-color: rgba(255,122,198,0.22); background: linear-gradient(135deg, rgba(255,122,198,0.06), rgba(255,184,0,0.02)); border-top-right-radius: 4px; }
.bubble.user .bubble-body { border-color: rgba(0,229,161,0.30); background: rgba(0,229,161,0.06); }

.bubble-head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
  font-size: 11.5px; color: var(--text-2);
}
.bubble-head .name { font-weight: 700; color: var(--text); font-size: 12.5px; }
.bubble-head .meta { color: var(--muted); }
.bubble-head .toolbox { margin-left: auto; display: flex; gap: 4px; }
.bubble-head .tool-btn {
  background: none; border: 0; color: var(--muted); cursor: pointer; padding: 2px 5px; border-radius: 4px;
}
.bubble-head .tool-btn:hover { color: var(--text); background: rgba(255,255,255,0.04); }

.bubble-content {
  font-size: 13.5px; line-height: 1.65; color: var(--text);
  white-space: pre-wrap; word-wrap: break-word;
}
.bubble-content code {
  background: rgba(0,0,0,0.30); padding: 1px 6px; border-radius: 4px;
  font-family: ui-monospace, monospace; font-size: 12px;
}
.thinking-trace {
  margin: 6px 0 8px;
}
.thinking-box {
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.035);
  border-radius: 8px;
  padding: 7px 9px;
  color: var(--text-2);
  font-size: 11.5px;
}
.thinking-box summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 700;
}
.thinking-item { margin-top: 8px; }
.thinking-item p {
  margin: 4px 0 0;
  white-space: pre-wrap;
  line-height: 1.5;
}
.bubble-foot {
  margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border-2);
  color: var(--muted); font-size: 11px;
}
.source-refs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.source-chip {
  position: relative; display: inline-flex; align-items: center;
  border: 1px solid rgba(0,212,255,0.28); background: rgba(0,212,255,0.08);
  color: var(--accent); border-radius: 999px; padding: 3px 8px; font-size: 11px;
}
.source-pop {
  display: none; position: absolute; left: 0; bottom: calc(100% + 8px);
  width: min(320px, 78vw); padding: 10px 12px; z-index: 80;
  background: var(--surface); border: 1px solid var(--border-2); border-radius: 10px;
  color: var(--text); box-shadow: 0 14px 38px rgba(0,0,0,0.28);
}
.source-pop strong { display: block; margin-bottom: 3px; font-size: 12px; }
.source-pop em { display: inline-block; color: var(--muted); font-style: normal; font-size: 10.5px; margin-bottom: 5px; }
.source-pop p { margin: 0; color: var(--text-2); line-height: 1.45; white-space: normal; }
.source-chip:hover .source-pop { display: block; animation: sourceFloat .14s ease-out; }
@keyframes sourceFloat {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.bubble.collapsed .bubble-content {
  max-height: 60px; overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, #000 40%, transparent);
  mask-image: linear-gradient(180deg, #000 40%, transparent);
}
.bubble .tools-trace {
  margin-top: 8px; padding: 8px 10px;
  background: rgba(0,0,0,0.20); border: 1px solid var(--border-2);
  border-radius: 7px; font-size: 11.5px; color: var(--muted);
  display: none;
}
.bubble .tools-trace.show { display: block; }
.bubble .tools-trace strong { color: var(--accent); }
.tool-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  padding: 6px 0;
  border-bottom: 1px dashed rgba(255,255,255,0.08);
}
.tool-row:last-child { border-bottom: 0; }
.tool-row p {
  grid-column: 1 / -1;
  margin: 0;
  line-height: 1.45;
}
.tool-row.done span { color: var(--success); }
.tool-row.error span,
.tool-row .tool-error { color: var(--danger); }
.tool-row.skipped span { color: var(--warn); }

.typing-dots { display: inline-flex; gap: 3px; padding: 2px 0; }
.typing-dots span {
  width: 5px; height: 5px; background: var(--text-2); border-radius: 50%;
  animation: typing 1.2s ease-in-out infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing { 0%,80%,100% { opacity: 0.2; transform: scale(0.8); } 40% { opacity: 1; transform: scale(1); } }

/* Aborted bubble */
.bubble.aborted .bubble-body {
  opacity: 0.65;
  border-style: dashed !important;
}
.bubble.aborted .bubble-body::after {
  content: '已中断'; position: absolute; top: -10px; right: 8px;
  background: var(--warn); color: #1a1303;
  font-size: 10px; font-weight: 800; padding: 2px 7px; border-radius: 99px;
  letter-spacing: 0.05em;
}

/* Session rename inline */
.session-item .t input.rename {
  background: var(--surface-3); border: 1px solid var(--accent);
  color: var(--text); border-radius: 5px; padding: 2px 6px;
  font-size: 12.5px; width: calc(100% - 28px); outline: 0;
}
.session-tools { display: inline-flex; gap: 2px; margin-left: 4px; opacity: 0; transition: opacity .12s; }
.session-item:hover .session-tools { opacity: 1; }
.session-tools button {
  background: none; border: 0; color: var(--muted); cursor: pointer; padding: 1px 4px; border-radius: 3px; font-size: 11px;
}
.session-tools button:hover { color: var(--text); background: rgba(255,255,255,0.06); }

/* Export button */
.export-md-btn {
  background: var(--surface-2); border: 1px solid var(--border-2); color: var(--text);
  border-radius: 8px; padding: 6px 10px; font-size: 11.5px; cursor: pointer; font-weight: 600;
  display: inline-flex; align-items: center; gap: 4px;
}
.export-md-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Floating toolbar */
.arena-toolbar {
  position: fixed; right: 24px; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 6px;
  z-index: 45;
}
.tb-btn {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--border-2);
  color: var(--text); cursor: pointer;
  display: grid; place-items: center;
  transition: all .12s; backdrop-filter: blur(8px);
}
.tb-btn:hover { color: var(--accent); border-color: var(--accent); }

/* Arena footer */
.arena-foot {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 12px 14px; background: linear-gradient(180deg, transparent, rgba(10,14,26,0.85) 40%);
  display: flex; gap: 8px; align-items: stretch;
  backdrop-filter: blur(6px);
  border-top: 1px solid var(--border);
  z-index: 6;
}
.arena-foot textarea {
  flex: 1; min-height: 44px; max-height: 120px; resize: none;
  background: var(--surface); border: 1px solid var(--border-2); color: var(--text);
  border-radius: 12px; padding: 12px 14px; font-size: 13.5px; outline: 0;
  font-family: inherit;
}
.arena-foot textarea:focus { border-color: #ff7ac6; }
.btn-pause {
  background: linear-gradient(135deg, #ffb800, #ff9f43);
  color: #1a1303; font-weight: 800; border: 0; padding: 0 16px; border-radius: 12px; cursor: pointer; font-size: 13px;
}
.btn-resume {
  background: linear-gradient(135deg, #00e5a1, #00d4ff);
  color: #001022; font-weight: 800; border: 0; padding: 0 16px; border-radius: 12px; cursor: pointer; font-size: 13px;
}
.btn-stop {
  background: var(--surface); border: 1px solid var(--danger); color: var(--danger);
  padding: 0 14px; border-radius: 12px; cursor: pointer; font-weight: 700;
}
.btn-join {
  background: linear-gradient(135deg, #00e5a1, #00d4ff);
  color: #001022; font-weight: 800; border: 0; padding: 0 18px; border-radius: 12px; cursor: pointer; font-size: 13px;
  display: inline-flex; align-items: center; gap: 5px;
}

.status-bar {
  position: absolute; left: 18px; top: 14px;
  background: rgba(10,14,26,0.70); backdrop-filter: blur(8px);
  border: 1px solid var(--border-2); border-radius: 999px;
  padding: 5px 12px; font-size: 11.5px; color: var(--text-2);
  display: flex; align-items: center; gap: 8px; z-index: 4;
}
.status-bar .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); animation: pulseHot 1.6s infinite; }
.status-bar.paused .dot { background: var(--warn); }
.status-bar.idle .dot   { background: var(--muted); animation: none; }
.status-bar.stopped .dot{ background: var(--danger); animation: none; }

/* Pending interject hint */
.pending-banner {
  position: absolute; left: 50%; top: 14px; transform: translateX(-50%);
  background: linear-gradient(135deg, rgba(0,229,161,0.18), rgba(0,212,255,0.10));
  border: 1px solid rgba(0,229,161,0.30);
  color: var(--success);
  padding: 6px 14px; border-radius: 999px;
  font-size: 12px; font-weight: 700;
  z-index: 5;
  animation: slideDown .25s ease;
}
@keyframes slideDown { from { transform: translate(-50%,-30px); opacity: 0; } to { transform: translate(-50%,0); opacity: 1; } }

.empty-arena {
  display: grid; place-items: center;
  height: 100%; color: var(--muted); font-size: 13.5px;
  text-align: center; padding: 40px 24px;
}
.empty-arena .big { font-size: 56px; margin-bottom: 14px; opacity: 0.6; }

/* ===== Pack picker ===== */
.pack-picker {
  background: linear-gradient(135deg, rgba(255,122,198,0.05), rgba(138,125,255,0.04));
  border: 1px solid var(--border-2);
  border-radius: 12px; padding: 12px 12px 10px;
}
.pack-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.pack-title { font-weight: 700; font-size: 13px; display: flex; align-items: center; gap: 8px; flex: 1; }
.pack-count {
  background: linear-gradient(135deg, #ff7ac6, #8a7dff); color: #fff;
  font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 99px;
}
.pack-search {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--border-2);
  border-radius: 9px; padding: 6px 10px; color: var(--text-2);
  min-width: 240px; flex: 1; max-width: 340px;
}
.pack-search input { flex: 1; background: transparent; border: 0; outline: 0; color: var(--text); font-size: 12.5px; }
.pack-grid {
  display: grid; gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  max-height: 220px; overflow-y: auto;
  padding: 2px;
}
.pack-card {
  background: var(--surface-2); border: 1px solid var(--border-2);
  border-radius: 10px; padding: 9px 10px; cursor: pointer;
  transition: all .12s; position: relative;
}
.pack-card:hover { border-color: rgba(255,122,198,0.50); transform: translateY(-1px); }
.pack-card.on {
  background: linear-gradient(135deg, rgba(255,122,198,0.14), rgba(138,125,255,0.08));
  border-color: rgba(255,122,198,0.55);
  box-shadow: 0 0 0 1px rgba(255,122,198,0.20);
}
.pc-head { display: flex; align-items: center; gap: 8px; }
.pc-icon { font-size: 18px; }
.pc-name { font-weight: 700; font-size: 12.5px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-check {
  width: 18px; height: 18px; border-radius: 5px;
  border: 1.5px solid var(--border-2);
  display: grid; place-items: center; color: transparent;
  transition: all .12s;
}
.pack-card.on .pc-check {
  background: linear-gradient(135deg, #ff7ac6, #8a7dff);
  border-color: transparent; color: #fff;
}
.pc-tag { font-size: 11px; color: var(--muted); margin-top: 4px; line-height: 1.4; max-height: 30px; overflow: hidden; }
.empty-line { color: var(--muted); font-size: 12px; padding: 16px; text-align: center; grid-column: 1/-1; }

/* ===== Agent picker (inline) ===== */
.agent-picker {
  flex: 1; min-width: 220px;
  background: var(--surface-2); border: 1px solid var(--border-2);
  border-radius: 10px; padding: 10px 12px;
  display: grid; grid-template-columns: 1fr auto; gap: 10px; row-gap: 6px; align-items: center;
}
.agent-picker.pro { border-color: rgba(0,212,255,0.30); }
.agent-picker.con { border-color: rgba(255,122,198,0.30); }
.agent-picker .ap-label { font-size: 10.5px; font-weight: 800; letter-spacing: 0.08em; color: var(--muted); grid-column: 1 / -1; }
.ap-current { display: flex; align-items: center; gap: 9px; min-width: 0; }
.ap-current .av { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 11px; flex-shrink: 0; }
.ap-current .meta { min-width: 0; }
.ap-current .n { font-weight: 700; font-size: 13px; }
.ap-current .r { color: var(--muted); font-size: 10.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-change {
  background: var(--surface); border: 1px solid var(--border-2); color: var(--text);
  border-radius: 8px; padding: 6px 10px; font-size: 11.5px; cursor: pointer; font-weight: 600;
}
.ap-change:hover { border-color: var(--accent); color: var(--accent); }

/* ===== Modal: agent picker grid ===== */
.modal-mask {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.65); backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 20px;
  animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 18px;
  width: 100%; max-width: 880px; max-height: 86vh; overflow-y: auto;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
}
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.modal-sub { color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.modal-close {
  background: none; border: 0; color: var(--text-2); cursor: pointer; font-size: 18px;
  width: 28px; height: 28px; border-radius: 6px;
}
.modal-close:hover { background: var(--surface-2); color: var(--text); }
.agent-grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}
.agent-card {
  background: var(--surface-2); border: 1px solid var(--border-2);
  border-radius: 12px; padding: 12px;
  cursor: pointer; transition: all .12s;
  position: relative;
}
.agent-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.agent-card.on {
  background: linear-gradient(135deg, rgba(0,212,255,0.14), rgba(79,139,255,0.06));
  border-color: rgba(0,212,255,0.55);
}
.agent-card.dim { opacity: 0.5; cursor: not-allowed; }
.agent-card.dim:hover { transform: none; }
.ac-av { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 13px; margin-bottom: 8px; }
.ac-name { font-weight: 700; font-size: 13.5px; }
.ac-vendor { font-size: 10.5px; color: var(--muted); margin-top: 1px; }
.ac-strengths { font-size: 11.5px; color: var(--text-2); margin-top: 6px; line-height: 1.4; min-height: 28px; }
.ac-already { position: absolute; top: 8px; right: 8px; font-size: 10px; background: rgba(255,184,0,0.18); color: var(--gold-2); padding: 2px 7px; border-radius: 99px; font-weight: 700; }

/* ===== Triple Arena (3-way) ===== */
.triple-link {
  background: linear-gradient(135deg, rgba(255,84,112,0.10), rgba(255,184,0,0.10));
  border: 1px solid rgba(255,184,0,0.22) !important;
}
.triple-link.active { background: linear-gradient(135deg, rgba(255,84,112,0.22), rgba(255,184,0,0.16)) !important; }

.triple-row {
  display: grid; gap: 10px;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: stretch;
}
.triple-card {
  background: var(--surface-2); border: 1px solid var(--border-2);
  border-radius: 12px; padding: 12px;
  display: flex; flex-direction: column; gap: 10px;
  position: relative; overflow: hidden;
}
.triple-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--accent);
}
.triple-card.pro { border-color: rgba(0,212,255,0.30); }
.triple-card.pro::before { background: linear-gradient(180deg, #00d4ff, #4f8bff); }
.triple-card.con { border-color: rgba(255,122,198,0.30); }
.triple-card.con::before { background: linear-gradient(180deg, #ff7ac6, #ffb800); }
.triple-card.judge {
  border-color: rgba(255,184,0,0.40);
  background: linear-gradient(135deg, rgba(255,184,0,0.10), rgba(255,122,198,0.04));
}
.triple-card.judge::before { background: linear-gradient(180deg, #ffd166, #ff7ac6); width: 5px; }
.tc-label { font-size: 11px; font-weight: 800; letter-spacing: 0.08em; color: var(--muted); }
.triple-card.judge .tc-label { color: var(--gold-2); }
.tc-current { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tc-current .ac-av { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 12px; flex-shrink: 0; }
.tc-current .meta { min-width: 0; flex: 1; }
.tc-current .n { font-weight: 700; font-size: 14px; line-height: 1.2; }
.tc-current .r { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Judge bubble special look */
.bubble.judge {
  margin: 18px auto;
  max-width: 92%;
  flex-direction: column; align-items: stretch;
}
.bubble.judge .av {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, #ffd166, #ff7ac6) !important;
  box-shadow: 0 0 30px rgba(255,184,0,0.30);
  margin: 0 auto 6px;
}
.bubble.judge .bubble-body {
  background: linear-gradient(135deg, rgba(255,184,0,0.10), rgba(255,122,198,0.04)) !important;
  border: 1px solid rgba(255,184,0,0.40) !important;
  border-radius: 14px !important;
  position: relative;
}
.bubble.judge .bubble-body::before {
  content: '🎖️ 最终裁判'; position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: linear-gradient(135deg, #ffd166, #ffb800); color: #1a1303;
  font-size: 10.5px; font-weight: 800; padding: 3px 10px; border-radius: 99px;
  letter-spacing: 0.06em;
}
.bubble.judge .bubble-head .name { color: var(--gold-2); }

/* Mobile triple */
@media (max-width: 720px) {
  .triple-row { grid-template-columns: 1fr; }
}

/* Responsive arena */
@media (max-width: 1100px) {
  .arena { grid-template-columns: 1fr; }
  .arena-side { position: static; height: auto; max-height: 320px; }
  .debate-cta-grid { grid-template-columns: 1fr; }
  .debate-vs { height: 130px; }
  .model-config { grid-template-columns: 1fr 1fr; }
  .model-config.triple-model-config { grid-template-columns: 1fr; }
  .role-edit-grid { grid-template-columns: 1fr; }
  .model-save { grid-column: 1 / -1; padding: 2px 0 0; }
}
@media (max-width: 560px) {
  .model-config { grid-template-columns: 1fr; }
  .triple-model-config .role-model-row summary {
    align-items: flex-start;
    flex-direction: column;
  }
  .role-model-summary { text-align: left; white-space: normal; }
  .arena-config { padding: 12px; }
  .arena-stream { padding: 12px 12px 100px; }
  .bubble { max-width: 100%; }
  .arena-toolbar { right: 10px; top: 50%; }
  .tb-btn { width: 34px; height: 34px; }
  .arena-foot { padding: 10px; flex-wrap: wrap; }
  .arena-foot textarea { flex-basis: 100%; }
  .debate-cta { padding: 18px; }
  .debate-cta h2 { font-size: 20px; }
}

/* Mobile compact mode */
@media (max-width: 560px) {
  * {
    animation: none !important;
    transition: none !important;
    box-shadow: none !important;
  }
  body {
    background: var(--bg);
  }
  .main {
    padding: 8px 8px 52px;
  }
  .topbar {
    height: 42px;
    padding: 6px 8px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
  }
  .topbar .logo-dot,
  .brand .logo-dot {
    width: 24px;
    height: 24px;
    border-radius: 6px;
  }
  .topbar-brand .brand-sub,
  .module-title .crumbs,
  .module-title .sub,
  .panel-head .sub,
  .hero .lead,
  .hero-art,
  .mcp-tool-hint,
  .model-source,
  .plan-card,
  .badge-hot,
  .debate-vs,
  .empty-arena .big {
    display: none !important;
  }
  .main-head {
    gap: 6px;
    margin-bottom: 8px;
  }
  .head-actions {
    gap: 6px;
  }
  .head-search,
  .panel,
  .kpi,
  .case-card,
  .arena-side,
  .arena-main,
  .compact-config,
  .run-log-box,
  .mcp-tool-card,
  .triple-model-config .role-model-row,
  .bubble-body {
    border-radius: 6px !important;
    background: var(--surface) !important;
    border-color: var(--border) !important;
  }
  .panel,
  .hero,
  .arena-side,
  .arena-config,
  .compact-config,
  .run-log-box {
    padding: 8px !important;
  }
  .panel-head {
    margin-bottom: 8px;
    gap: 6px;
  }
  .module-title h1 {
    font-size: 17px;
    line-height: 1.25;
  }
  .hero {
    margin-bottom: 8px;
    background: var(--surface) !important;
  }
  .hero h2 {
    font-size: 17px;
    line-height: 1.25;
  }
  .hero-actions,
  .actions-row,
  .mcp-agent-toolbar {
    gap: 6px;
    margin-top: 8px;
  }
  .btn,
  .btn-secondary,
  .theme-toggle {
    min-height: 34px;
    padding: 7px 10px;
    border-radius: 6px;
    font-size: 12px;
  }
  input,
  select,
  textarea,
  .arena-config .field-input,
  .arena-foot textarea {
    border-radius: 6px !important;
    font-size: 13px !important;
    padding: 8px 9px !important;
  }
  .grid-2,
  .grid-3,
  .grid-cards,
  .debate-cta-grid {
    gap: 8px;
  }
  .kpi-grid {
    gap: 6px;
  }
  .kpi {
    padding: 8px !important;
  }
  .kpi .lbl {
    font-size: 10.5px;
  }
  .kpi .val {
    font-size: 17px;
    margin-top: 3px;
  }
  .kpi .delta,
  .tag,
  .badge,
  .source-chip {
    font-size: 10.5px;
  }
  .sidebar-mask {
    background: rgba(0,0,0,0.20);
    backdrop-filter: none;
  }
  .sidebar {
    width: min(78vw, 260px);
    padding: 14px 10px;
  }
  .brand {
    min-height: 42px;
    margin-bottom: 8px;
    padding-bottom: 10px;
  }
  .nav-group {
    margin-bottom: 8px;
  }
  .nav-link {
    min-height: 34px;
    padding: 7px 9px;
    border-radius: 6px;
  }
  .mcp-tool-grid {
    gap: 6px;
    max-height: 46vh;
  }
  .mcp-tool-card {
    padding: 7px 8px;
  }
  .mcp-tool-card.on {
    background: var(--surface-2) !important;
    border-color: var(--text-2) !important;
  }
  .mcp-tool-name {
    margin: 0;
    font-size: 12px;
  }
  .mcp-tool-desc {
    -webkit-line-clamp: 1;
    font-size: 10.5px;
    line-height: 1.35;
    margin-top: 3px;
  }
  .run-log-list {
    gap: 4px;
    max-height: 120px;
  }
  .run-log-item {
    padding: 5px 6px;
    font-size: 10.5px;
  }
  .arena {
    gap: 8px;
  }
  .arena-side {
    max-height: 160px;
  }
  .arena-side h4 {
    margin: 2px 0 5px;
    font-size: 11px;
  }
  .session-item {
    padding: 7px 8px;
    border-radius: 6px;
  }
  .arena-main {
    min-height: calc(100vh - 58px);
  }
  .arena-stream {
    padding: 8px 8px 82px;
    background: var(--surface) !important;
  }
  .fx-layer,
  .turn-divider {
    display: none !important;
  }
  .bubble,
  .bubble.user,
  .bubble.judge {
    max-width: 100%;
    margin: 8px 0;
    gap: 6px;
    flex-direction: row;
  }
  .bubble.con {
    flex-direction: row;
  }
  .bubble .av,
  .bubble.judge .av {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    margin: 0;
    background: var(--surface-3) !important;
    color: var(--text) !important;
    font-size: 10px;
  }
  .bubble.judge .bubble-body::before {
    display: none;
  }
  .bubble-body {
    padding: 8px 9px;
    min-width: 0;
  }
  .bubble-head {
    gap: 5px;
    margin-bottom: 4px;
    font-size: 10.5px;
  }
  .bubble-head .name {
    font-size: 11.5px;
  }
  .bubble-content {
    font-size: 12.5px;
    line-height: 1.5;
  }
  .bubble-foot,
  .source-refs,
  .bubble .tools-trace {
    margin-top: 6px;
  }
  .source-chip {
    padding: 3px 6px;
    border-radius: 6px;
  }
  .source-pop {
    display: none !important;
  }
  .arena-toolbar {
    right: 6px;
    gap: 4px;
  }
  .tb-btn {
    width: 30px;
    height: 30px;
    border-radius: 6px;
  }
  .arena-foot {
    padding: 6px;
    gap: 6px;
    background: var(--surface) !important;
    border-top: 1px solid var(--border);
  }
  .arena-foot textarea {
    min-height: 38px;
  }
}

/* ===== Arena primary action + collapsible setup ===== */
.arena-primary {
  display: flex; gap: 10px; align-items: stretch;
  padding: 12px 14px;
}
.arena-primary > #topicInput {
  flex: 1; min-height: 46px; max-height: 120px; resize: vertical;
  font-size: 14px; line-height: 1.5;
}
.arena-primary-actions {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.arena-setup { border-top: 1px solid var(--border); }
.arena-setup > summary {
  list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  font-size: 12.5px;
  transition: background .12s;
}
.arena-setup > summary::-webkit-details-marker { display: none; }
.arena-setup > summary:hover { background: var(--surface-2); }
.setup-icon { font-weight: 700; color: var(--text); white-space: nowrap; }
.setup-summary {
  flex: 1; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.setup-summary em { color: var(--muted); font-style: normal; padding: 0 4px; }
.setup-summary b { color: var(--accent); font-weight: 700; }
.setup-toggle {
  color: var(--muted); font-size: 11.5px; white-space: nowrap;
  border: 1px solid var(--border-2); border-radius: 999px; padding: 3px 10px;
}
.arena-setup[open] > summary .setup-toggle { color: var(--accent); border-color: var(--accent); }
.arena-setup-body { padding: 4px 14px 14px; display: flex; flex-direction: column; gap: 12px; }

@media (max-width: 720px) {
  .arena-primary { flex-direction: column; gap: 8px; padding: 10px; }
  .arena-primary-actions { justify-content: space-between; }
  .arena-primary-actions #startBtn { flex: 1; }
  .setup-summary { font-size: 11.5px; }
  .arena-setup-body { padding: 4px 10px 12px; }
  .role-edit-grid { grid-template-columns: 1fr !important; }
}

/* ============================================================
   移动端 · Claude App 风格（简洁 / 明了 / 清晰）
   纯展示层覆盖，深色与白色主题通用
   ============================================================ */
@media (max-width: 760px) {
  /* —— 顶栏：紧凑居中 app bar —— */
  .topbar {
    height: 52px; padding: 0 8px;
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 60;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
  }
  .topbar .icon-btn {
    background: transparent; border: 0; color: var(--text);
    width: 40px; height: 40px; border-radius: 10px;
  }
  .topbar .icon-btn:active { background: var(--surface-2); }
  .topbar-brand { gap: 8px; font-size: 15px; }
  .topbar-brand .logo-dot { width: 24px; height: 24px; border-radius: 7px; }

  /* —— 主区铺满，无多余留白 —— */
  .app-shell { grid-template-columns: 1fr; }
  .main { padding: 0; }
  .main-head {
    position: sticky; top: 52px; z-index: 18;
    padding: 8px 12px; gap: 8px;
    background: color-mix(in srgb, var(--bg) 90%, transparent);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  }
  /* head：保留主题切换（可发现），其余克制 */
  .main-head .market-switch,
  .main-head .btn-ghost span { display: none; }
  .main-head .btn-ghost { padding: 8px; }
  .main-head .theme-toggle {
    display: inline-flex; align-items: center;
    padding: 7px 10px; font-size: 12px; min-height: 36px;
  }
  .head-search { order: 0; flex: 1 1 100%; max-width: none; padding: 8px 12px; }
  .head-search kbd { display: none; }
  .head-actions { order: 1; width: 100%; justify-content: flex-end; gap: 6px; }

  /* —— 抽屉式侧边导航 —— */
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: min(86vw, 320px);
    transform: translateX(-100%); transition: transform .26s cubic-bezier(.4,0,.2,1);
    border-right: 1px solid var(--border); z-index: 70;
  }
  .sidebar.open { transform: translateX(0); box-shadow: 0 0 60px rgba(0,0,0,0.4); }
  .sidebar-mask { z-index: 65; }

  /* 非对战模块：留出舒适内边距 */
  #module-root > .module-header,
  #module-root > .kpi-grid,
  #module-root > .panel,
  #module-root > .grid-2,
  #module-root > .grid-3,
  #module-root > .grid-cards,
  #module-root > .filters,
  #module-root > .debate-cta,
  #module-root > .hero { margin-left: 12px; margin-right: 12px; }
  #module-root > .module-header { margin-top: 12px; }

  /* —— 对战页 = 全屏聊天 —— */
  .arena { grid-template-columns: 1fr; gap: 0; }
  .arena-side {
    position: static; height: auto; max-height: none;
    flex-direction: row; align-items: center; gap: 8px;
    overflow-x: auto; overflow-y: hidden;
    padding: 8px 12px; border: 0; border-bottom: 1px solid var(--border);
    border-radius: 0; background: var(--bg);
  }
  .arena-side h4 { display: none; }
  .arena-side #newSess { flex: 0 0 auto; padding: 8px 14px; font-size: 13px; }
  .arena-side #sessList {
    display: flex; flex-direction: row; gap: 6px;
    overflow-x: auto; margin: 0; flex: 1;
  }
  .arena-side .session-item {
    flex: 0 0 auto; max-width: 180px; margin: 0; padding: 7px 10px;
  }
  .arena-side .session-item .m { display: none; }
  .arena-side select#fxSel { flex: 0 0 auto; width: auto; max-width: 120px; }

  .arena-main {
    border: 0; border-radius: 0; min-height: calc(100dvh - 52px);
    box-shadow: none; min-width: 0; overflow-x: hidden;
  }
  /* 强制约束 flex 链，杜绝子项撑破视口 */
  .arena-config,
  .arena-primary,
  .arena-primary-actions,
  .arena-setup,
  .arena-setup-body,
  .arena-stream {
    width: 100%; max-width: 100%; min-width: 0; box-sizing: border-box;
  }
  .arena-config { padding: 0; }
  .arena-primary { padding: 10px 12px; gap: 8px; border-bottom: 1px solid var(--border); }
  .arena-primary { flex-direction: column; }
  .arena-primary > #topicInput {
    min-height: 42px; font-size: 15px; border-radius: 12px; width: 100%;
  }
  .arena-primary-actions {
    display: flex; flex-wrap: wrap; width: 100%; gap: 6px;
    box-sizing: border-box;
  }
  .arena-primary-actions .seg {
    order: 3; flex: 1 1 100%; min-width: 0; max-width: 100%;
    overflow-x: auto; justify-content: flex-start;
  }
  .arena-primary-actions .seg button { flex: 0 0 auto; }
  .arena-primary-actions #resetBtn { order: 1; flex: 0 0 auto; }
  .arena-primary-actions #startBtn {
    order: 2; flex: 1 1 auto; min-width: 0;
    padding: 11px 16px !important;
  }
  .arena-setup > summary { padding: 12px; }

  .arena-stream {
    padding: 14px 12px 120px;
    -webkit-overflow-scrolling: touch;
  }

  /* —— 气泡：Claude 风，宽松干净 —— */
  .bubble { max-width: 100%; gap: 8px; margin: 14px 0; }
  .bubble .av { width: 28px; height: 28px; font-size: 10px; }
  .bubble-body { border-radius: 16px; padding: 12px 14px; }
  .bubble.pro .bubble-body,
  .bubble.con .bubble-body { border-top-left-radius: 16px; border-top-right-radius: 16px; }
  .bubble-content { font-size: 14.5px; line-height: 1.7; }
  .bubble.judge { max-width: 100%; }

  /* —— 底部输入：固定 pill + 圆形发送，安全区适配 —— */
  .arena-toolbar { right: 12px; bottom: calc(96px + env(safe-area-inset-bottom)); }
  .arena-foot {
    position: fixed; left: 0; right: 0; bottom: 0;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    gap: 8px; align-items: flex-end;
    background: color-mix(in srgb, var(--bg) 94%, transparent);
    -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
    border-top: 1px solid var(--border);
  }
  .arena-foot textarea {
    flex: 1; min-height: 44px; max-height: 120px;
    border-radius: 22px; padding: 12px 16px; font-size: 15px;
    background: var(--surface-2); border: 1px solid var(--border-2);
  }
  .arena-foot .btn-join {
    width: 44px; height: 44px; padding: 0; border-radius: 50%;
    flex: 0 0 auto; display: grid; place-items: center;
  }
  .arena-foot .btn-join span { display: none; }
  .arena-foot .btn-pause,
  .arena-foot .btn-resume,
  .arena-foot .btn-stop {
    height: 44px; border-radius: 22px; padding: 0 16px; flex: 0 0 auto;
  }
  .status-bar { top: 8px; left: 12px; font-size: 11px; padding: 4px 10px; }
  .pending-banner { top: 8px; font-size: 11px; }

  /* 触摸目标 ≥ 40px，去除 hover 依赖 */
  .nav-link { padding: 12px 12px; }
  .pill, .seg button, .chip { min-height: 36px; }
  .tb-btn { width: 40px; height: 40px; }
}

@media (max-width: 760px) and (display-mode: standalone) {
  .topbar { padding-top: env(safe-area-inset-top); height: calc(52px + env(safe-area-inset-top)); }
}

/* ============================================================
   桌面端 · Claude 风格（居中限宽 / 克制留白 / 对话为主体）
   仅作用于对战页，不影响仪表盘等数据模块；深/白主题通用
   ============================================================ */
@media (min-width: 761px) {
  .arena { max-width: 1180px; margin: 0 auto; }
  .arena-main {
    box-shadow: none;
    background: transparent;
    border: 0;
  }
  .arena-side { background: var(--surface); }

  /* 一条居中阅读栏：对话 / 配置 / 输入 同宽对齐 */
  .arena-stream {
    padding-left: max(20px, calc((100% - 840px) / 2));
    padding-right: max(20px, calc((100% - 840px) / 2));
  }
  .arena-primary,
  .arena-setup > summary,
  .arena-setup-body {
    padding-left: max(16px, calc((100% - 840px) / 2));
    padding-right: max(16px, calc((100% - 840px) / 2));
  }
  .arena-foot {
    padding-left: max(14px, calc((100% - 868px) / 2));
    padding-right: max(14px, calc((100% - 868px) / 2));
    background: linear-gradient(180deg, transparent, var(--bg) 42%);
  }
  .arena-config { border-bottom: 1px solid var(--border); }
  .status-bar { left: max(20px, calc((100% - 840px) / 2)); }

  /* 气泡 Claude 感：圆润、舒适行距、克制描边 */
  .bubble { margin: 16px 0; }
  .bubble-body { border-radius: 16px; padding: 14px 16px; }
  .bubble-content { font-size: 14.5px; line-height: 1.72; }
  .bubble.pro .bubble-body { border-top-left-radius: 6px; }
  .bubble.con .bubble-body { border-top-right-radius: 6px; }

  /* 输入框 pill 化，与对话列同宽居中 */
  .arena-foot textarea {
    border-radius: 22px; padding: 12px 18px;
  }
  .arena-foot .btn-join { border-radius: 22px; }
}

/* ============================================================
   重做外壳 · 极简 appbar + 双区导航（覆盖旧 topbar/main-head）
   ============================================================ */
:root { --appbar-h: 56px; }

.topbar, .main-head { display: none !important; }

.appbar {
  position: sticky; top: 0; z-index: 100;
  height: var(--appbar-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 14px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.appbar-menu { display: none; }
.appbar-brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 16px; letter-spacing: -0.01em; }
.appbar-brand .brand-name span { color: var(--accent); }
.appbar-brand .logo-dot { width: 26px; height: 26px; }

.zone-tabs {
  display: flex; gap: 4px; margin: 0 auto;
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 4px; border-radius: 999px;
}
.zone-tab {
  padding: 7px 18px; border: 0; background: transparent;
  color: var(--text-2); font-weight: 600; font-size: 13px;
  border-radius: 999px; cursor: pointer; transition: all .15s; white-space: nowrap;
}
.zone-tab:hover { color: var(--text); }
.zone-tab.on {
  background: var(--surface); color: var(--accent);
  box-shadow: 0 1px 3px rgba(0,0,0,0.10);
}
.appbar-right { display: flex; align-items: center; gap: 6px; }
.appbar-right .icon-btn {
  width: 38px; height: 38px; display: grid; place-items: center;
  background: transparent; border: 0; color: var(--text-2); border-radius: 10px;
}
.appbar-right .icon-btn:hover { background: var(--surface-2); color: var(--text); }
.appbar-right .avatar { width: 32px; height: 32px; font-size: 13px; }

/* shell 适配 appbar 高度 */
.app-shell { grid-template-columns: 256px 1fr; min-height: calc(100vh - var(--appbar-h)); }
.sidebar {
  position: sticky; top: var(--appbar-h);
  height: calc(100vh - var(--appbar-h));
  padding: 14px 12px; overflow-y: auto;
  display: flex; flex-direction: column;
  background: var(--bg); border-right: 1px solid var(--border);
}
.sidebar .nav-groups { flex: 1; }
.nav-group { margin-bottom: 18px; }
.nav-title {
  font-size: 11px; font-weight: 600; letter-spacing: 0.06em;
  color: var(--muted); padding: 0 10px 6px; text-transform: uppercase;
}
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 10px;
  color: var(--text-2); font-size: 13.5px; font-weight: 500;
  cursor: pointer; transition: background .12s, color .12s;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.active { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); font-weight: 600; }
.nav-link.active::before { display: none; }
.nav-ico { width: 20px; text-align: center; font-size: 15px; flex-shrink: 0; }
.nav-link .badge { margin-left: auto; }
.datasource-note {
  font-size: 11px; color: var(--muted); line-height: 1.55;
  padding: 12px 10px 4px; border-top: 1px solid var(--border);
}

/* 对战页高度跟随 appbar（覆盖旧 100vh-130 / top:80） */
.arena-side { height: calc(100vh - var(--appbar-h) - 32px); top: calc(var(--appbar-h) + 16px); }
.arena-main { min-height: calc(100vh - var(--appbar-h) - 32px); }
@media (min-width: 761px) {
  .arena-main { min-height: calc(100vh - var(--appbar-h) - 24px); }
}

/* 桌面隐藏移动菜单按钮 */
@media (min-width: 901px) { .appbar-menu { display: none; } }

/* —— 移动端 —— */
@media (max-width: 900px) {
  :root { --appbar-h: 52px; }
  .appbar { padding: 0 8px; gap: 8px; }
  .appbar-menu {
    display: grid; place-items: center; width: 38px; height: 38px;
    background: transparent; border: 0; color: var(--text); border-radius: 10px;
  }
  .appbar-brand .brand-name { font-size: 15px; }
  .appbar-brand { gap: 7px; }
  .zone-tabs { margin: 0; padding: 3px; }
  .zone-tab { padding: 6px 12px; font-size: 12px; }
  .appbar-right { gap: 2px; }
  .appbar-right .icon-btn { width: 34px; height: 34px; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; height: 100%;
    width: min(82vw, 300px); z-index: 70;
    transform: translateX(-100%); transition: transform .26s cubic-bezier(.4,0,.2,1);
  }
  .sidebar.open { transform: translateX(0); box-shadow: 0 0 60px rgba(0,0,0,0.4); }
  .sidebar-mask { z-index: 65; }
  .main { padding: 0; }
  .arena-side, .arena-main { height: auto; top: auto; min-height: 0; }
}
@media (max-width: 420px) {
  .appbar-brand .brand-sub { display: none; }
  .zone-tab { padding: 6px 10px; }
}

/* ============================================================
   CLAUDE 清爽收敛层 —— 单色系 / 无渐变 / 无发光 / 无动效装饰
   作用于默认白主题；放最后保证压制一切杂色
   ============================================================ */
body.theme-white {
  --bg: #ffffff;
  --bg-2: #ffffff;
  --surface: #ffffff;
  --surface-2: #f7f7f5;
  --surface-3: #efefec;
  --border: #ececea;
  --border-2: #e4e4e1;
  --text: #1f1e1d;
  --text-2: #5c5b58;
  --muted: #8d8b86;
  --accent: #bd5b3d;          /* 唯一强调色：克制的赤陶，仅用于选中/主按钮 */
  --accent-2: #bd5b3d;
  --gold: #8d8b86; --gold-2: #5c5b58;
  --success: #5c5b58; --warn: #8d8b86; --violet: #5c5b58; --pink: #8d8b86;
  --danger: #b3402f;
  --grad-cyan: #bd5b3d;
  --grad-gold: #8d8b86;
  --grad-success: #5c5b58;
  --shadow-1: 0 1px 2px rgba(20,20,19,0.04);
  --shadow-glow: 0 0 0 1px var(--border-2);
  background: #ffffff;
}

/* 关闭一切动效/渐变/发光背景 */
body.theme-white .fx-layer,
body.theme-white .hero-art,
body.theme-white .debate-cta::before { display: none !important; }
body.theme-white .debate-cta,
body.theme-white .hero,
body.theme-white .vs-orb,
body.theme-white .logo-dot,
body.theme-white .kpi::before { background: #ffffff !important; box-shadow: none !important; }
body.theme-white .logo-dot { background: #1f1e1d !important; }
body.theme-white .vs-orb { color: #fff !important; background: #bd5b3d !important; }

/* 卡片/面板：纯白 + 一根淡线，无阴影无圆角发光 */
body.theme-white .panel,
body.theme-white .kpi,
body.theme-white .case-card,
body.theme-white .filters,
body.theme-white .arena-side,
body.theme-white .arena-main,
body.theme-white .hero,
body.theme-white .debate-cta,
body.theme-white .cmdk,
body.theme-white .modal,
body.theme-white .status-bar,
body.theme-white .pack-card,
body.theme-white .agent-card,
body.theme-white .triple-card,
body.theme-white .arena-foot .btn-join {
  background: #ffffff !important;
  box-shadow: none !important;
  border-color: var(--border) !important;
}
body.theme-white .case-card:hover,
body.theme-white .pack-card:hover { transform: none !important; box-shadow: none !important; }

/* 标题去渐变文字 */
body.theme-white .debate-cta h2,
body.theme-white .hero h2,
body.theme-white .module-title h1,
body.theme-white .brand-name span,
body.theme-white .brand-name {
  background: none !important;
  -webkit-text-fill-color: currentColor !important;
  color: var(--text) !important;
}

/* 主按钮：Claude 黑；次按钮：描边 */
body.theme-white .btn,
body.theme-white #startBtn {
  background: #1f1e1d !important; color: #fff !important;
  box-shadow: none !important; border: 0 !important;
}
body.theme-white .btn-secondary {
  background: #fff !important; color: var(--text) !important;
  border: 1px solid var(--border-2) !important;
}
body.theme-white .btn:hover, body.theme-white #startBtn:hover { filter: none !important; opacity: 0.88; }

/* 选中态：浅灰底深字（Claude 侧栏风），去主色块/彩条 */
body.theme-white .nav-link.active {
  background: var(--surface-2) !important;
  color: var(--text) !important;
  font-weight: 600;
  box-shadow: none !important;
}
body.theme-white .nav-link.active::before { display: none !important; }
body.theme-white .zone-tab.on {
  background: #1f1e1d !important; color: #fff !important; box-shadow: none !important;
}
/* 去掉装饰性 emoji 图标，纯文字导航 */
body.theme-white .nav-ico { display: none !important; }
body.theme-white .nav-link { gap: 0 !important; }

/* badge / tag 全部中性灰，去渐变去动画 */
body.theme-white .badge,
body.theme-white .badge-hot,
body.theme-white .tag,
body.theme-white .tag-cyan, body.theme-white .tag-gold, body.theme-white .tag-success,
body.theme-white .tag-warn, body.theme-white .tag-danger, body.theme-white .tag-violet,
body.theme-white .plan-tag, body.theme-white .debate-pill, body.theme-white .ribbon {
  background: var(--surface-2) !important;
  color: var(--text-2) !important;
  box-shadow: none !important;
  animation: none !important;
  font-weight: 600;
}

/* 进度环/进度条/分数 → 中性 */
body.theme-white .score,
body.theme-white .score.gold,
body.theme-white .score.success {
  background: conic-gradient(#1f1e1d calc(var(--p,0)*1%), #ececea 0) !important;
}
body.theme-white .bar > span,
body.theme-white .bar.cyan > span,
body.theme-white .bar.gold > span,
body.theme-white .bar.success > span { background: #1f1e1d !important; }

/* 对战气泡：Claude 风 —— 去彩色边/底，靠间距与字重区分 */
body.theme-white .bubble-body,
body.theme-white .bubble.pro .bubble-body,
body.theme-white .bubble.con .bubble-body,
body.theme-white .bubble.user .bubble-body,
body.theme-white .bubble.judge .bubble-body {
  background: #ffffff !important;
  border: 1px solid var(--border) !important;
  box-shadow: none !important;
}
body.theme-white .bubble.judge .bubble-body::before {
  background: var(--surface-2) !important; color: var(--text-2) !important;
}
body.theme-white .bubble .av,
body.theme-white .bubble.pro .av,
body.theme-white .bubble.con .av,
body.theme-white .bubble.user .av,
body.theme-white .bubble.judge .av {
  background: var(--surface-3) !important; color: var(--text) !important;
  box-shadow: none !important;
}
/* 对战入口大卡：去彩，纯白卡片 */
body.theme-white .debate-cta { border: 1px solid var(--border) !important; }
body.theme-white .debate-input { background: var(--surface-2) !important; border-color: var(--border-2) !important; }

/* 输入聚焦不要彩色光圈 */
body.theme-white .field-input:focus,
body.theme-white .arena-foot textarea:focus,
body.theme-white .head-search:focus-within {
  border-color: #1f1e1d !important; box-shadow: none !important;
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
