/* ============================================================
   数智教学资源平台 — 全局样式 (v3 课堂优化版)
   机器学习图像分类原理探究 · 粤教版高中信息技术
   字体大小已针对课堂投屏/远距离观看优化
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;600;700&display=swap');

:root {
  /* 主色调 — 现代靛蓝 */
  --primary: #4F46E5;
  --primary-light: #EEF2FF;
  --primary-dark: #3730A3;
  --primary-gradient: linear-gradient(135deg, #4F46E5, #7C3AED);
  /* 技术标识色 */
  --vr-color: #10B981;
  --ar-color: #F59E0B;
  --mr-color: #8B5CF6;
  --ai-color: #3B82F6;
  /* 功能色 */
  --success: #10B981;
  --success-light: #ECFDF5;
  --warning: #F59E0B;
  --error: #EF4444;
  --error-light: #FEF2F2;
  --info: #3B82F6;
  /* 中性色 */
  --bg: #F8FAFC;
  --bg-secondary: #F1F5F9;
  --surface: #FFFFFF;
  --border: #E2E8F0;
  --border-light: #F1F5F9;
  --text: #1E293B;
  --text-secondary: #64748B;
  --text-muted: #94A3B8;
  /* 间距 */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-xl: 26px;
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 4px 12px rgba(0,0,0,0.07), 0 1px 3px rgba(0,0,0,0.04);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.10), 0 4px 8px rgba(0,0,0,0.04);
  --shadow-glow: 0 0 20px rgba(79,70,229,0.15);
  /* 字体 */
  --font: "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Cascadia Code", Consolas, monospace;
  /* 过渡 */
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== 应用布局：左侧导航 + 右侧内容 ===== */
.app-layout {
  display: flex;
  height: 100vh;
  width: 100%;
  overflow: hidden;
}

/* ===== 左侧导航栏 ===== */
.sidebar {
  width: 290px;
  background: linear-gradient(180deg, #312E81 0%, #4F46E5 50%, #7C3AED 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  box-shadow: 4px 0 20px rgba(79,70,229,0.25);
  z-index: 100;
  height: 100vh;          /* 固定视口高度 */
  overflow-y: auto;        /* 导航过多时可滚动 */
}

.sidebar-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 22px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.2);
  text-align: center;
  background: rgba(0,0,0,0.12);
}

.sidebar-header .logo-text-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  line-height: 1.4;
}

.sidebar-header .logo-text-line1 {
  font-size: 25px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.sidebar-header .logo-text-line2 {
  font-size: 25px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: rgba(255,255,255,0.9);
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.sidebar-header .logo-text-sub {
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.5px;
  color: rgba(255,255,255,0.65);
  margin-top: 6px;
  padding: 3px 10px;
  background: rgba(255,255,255,0.1);
  border-radius: 20px;
  backdrop-filter: blur(4px);
  white-space: nowrap;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 10px;
  flex: 1;
  overflow-y: auto;
}

.sidebar-nav .nav-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.85);
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 16px;
  font-family: var(--font);
  font-weight: 500;
  transition: var(--transition);
  white-space: nowrap;
  text-align: left;
  width: 100%;
}

.sidebar-nav .nav-btn:hover {
  background: rgba(255,255,255,0.18);
  color: #fff;
  transform: translateX(2px);
}

.sidebar-nav .nav-btn.active {
  background: #fff;
  color: var(--primary);
  border-color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}

.sidebar-nav .nav-btn .nav-icon {
  font-size: 22px;
  flex-shrink: 0;
  width: 28px;
  text-align: center;
}

.sidebar-nav .nav-btn .nav-label {
  flex: 1;
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.15);
}

.sidebar-footer .btn-ai-assistant {
  background: linear-gradient(135deg, #F59E0B, #EF4444);
  border: none;
  color: #fff;
  padding: 10px 16px;
  border-radius: 24px;
  cursor: pointer;
  font-size: 15px;
  font-family: var(--font);
  font-weight: 600;
  animation: pulse-ai 2.5s infinite;
  transition: var(--transition);
  box-shadow: 0 2px 10px rgba(239,68,68,0.3);
  white-space: nowrap;
  width: 100%;
}

.sidebar-footer .btn-ai-assistant:hover {
  transform: scale(1.05);
}

/* ===== 右侧内容区 ===== */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;           /* 固定视口高度 */
  overflow: hidden;         /* 只让内部 .main-content 滚动 */
  background: var(--bg);
}

/* 简化顶部栏（仅保留进度条等信息） */
.topbar {
  display: none; /* 隐藏原有顶部栏，功能已移至左侧导航 */
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  height: 100vh;             /* 固定视口高度，避免多余滚动条 */
  overflow: hidden;           /* 滚动仅由 .main-content 处理 */
  display: flex; flex-direction: column;
  overflow-x: hidden;
  font-size: 18px;               /* ↑16→18 课堂投屏优化 */
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== 顶部导航 ===== */
.topbar {
  display: flex; align-items: center;
  padding: 10px 16px;
  background: linear-gradient(135deg, #312E81 0%, #4F46E5 50%, #7C3AED 100%);
  color: #fff;
  gap: 8px;
  flex-shrink: 0;
  box-shadow: 0 4px 20px rgba(79,70,229,0.25);
}
.topbar-left {
  display: flex; align-items: center; gap: 12px;
  min-width: fit-content;
}
.logo-icon { font-size: 36px; }               /* ↑30→36 与标题配套 */
.logo-text {
  font-size: 22px; font-weight: 700;           /* ↑16→22 课堂标题 */
  white-space: nowrap; letter-spacing: 0.5px;
}
.badge-subtitle {
  font-size: 14px;                             /* ↑11→14 */
  background: rgba(255,255,255,0.18);
  padding: 3px 10px; border-radius: 22px; font-weight: 500;
  backdrop-filter: blur(4px);
  white-space: nowrap;
}

/* ===== 进度条 ===== */
.progress-bar-container {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 8px 20px; flex-shrink: 0;
}
.progress-phases {
  display: flex; align-items: center; justify-content: center;
  max-width: 1000px; margin: 0 auto;
}
.phase {
  display: flex; flex-direction: column; align-items: center;
  gap: 4px; opacity: 0.4; transition: var(--transition);
  cursor: pointer;
}
.phase.active { opacity: 1; }
.phase.completed { opacity: 0.7; }
.phase-dot {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--bg-secondary); display: flex; align-items: center;
  justify-content: center;
  font-size: 13px; font-weight: 700;
  color: var(--text-muted); transition: var(--transition);
}
.phase.active .phase-dot {
  background: var(--primary-gradient); color: #fff;
  box-shadow: 0 3px 12px rgba(79,70,229,0.35);
}
.phase.completed .phase-dot {
  background: var(--success); color: #fff;
}
.phase-label {
  font-size: 13px;
  text-align: center; color: var(--text-secondary);
  font-weight: 500; line-height: 1.3;
}
.phase-connector {
  width: 30px; height: 2px; background: var(--border);
  margin: 0 4px; align-self: flex-start; margin-top: 15px;
  border-radius: 1px; transition: var(--transition);
}
.phase.completed + .phase-connector,
.phase.active + .phase-connector { background: var(--primary); }

/* 首页总览进度点 */
.phase-dot-home {
  font-size: 15px;
  background: var(--primary-light);
  border: 2px solid var(--primary);
}
.phase.active .phase-dot-home {
  background: var(--primary-gradient);
  border-color: transparent;
}

/* ===== 主内容区 ===== */
.main-content { flex:1; overflow-y: auto; overflow-x: hidden; padding: 12px 32px 8px; }

.module-panel { display: none; }
.module-panel.active { display: block; animation: fadeIn 0.3s ease; }
/* 课后作业模块：flex 列布局让 iframe 自动撑满 */
#module-homework.active { display: flex; flex-direction: column; height: 100%; min-height: 0; }
/* 作业模式下移除内边距 + 禁止外层滚动，让高度链完整传递 */
.main-content.homework-mode { padding: 0; overflow: hidden; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.module-header {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 14px;
  margin-bottom: 24px;                         /* ↑20→24 */
}
.module-header h2 {
  font-size: 30px; font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}
.module-toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.module-hint {
  font-size: 15px;                             /* ↑14→15 */
  color: var(--text-muted);
  background: var(--bg-secondary);
  padding: 6px 18px; border-radius: 22px;
  font-weight: 500;
}

/* ===== 卡片 ===== */
.card {
  background: var(--surface); border-radius: var(--radius-lg);
  padding: 28px;                               /* ↑24→28 */
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow); }
.card-full { grid-column: 1 / -1; }
.card-title {
  font-size: 22px; font-weight: 700;           /* 教学目标标题调小至22px */
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--primary-light);
  color: var(--text);
}

/* ===== 首页 ===== */
.dashboard-grid {
  display: grid; grid-template-columns: 3fr 2fr;
  gap: 24px;                                   /* ↑20→24 */
}
@media (max-width: 1100px) {
  .dashboard-grid { grid-template-columns: 1fr; }
}

.goals-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px;  /* 调小间距 */
}
@media (max-width: 900px) {
  .goals-grid { grid-template-columns: repeat(2, 1fr); }
}
.goal-item {
  padding: 28px 22px;                        /* 调小内边距 */
  border-radius: var(--radius); background: var(--bg);
  transition: var(--transition);
  border: 1px solid transparent;
}
.goal-item:hover {
  transform: translateY(-3px);                 /* 调小悬浮效果 */
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}
.goal-icon { font-size: 44px; margin-bottom: 14px; text-align: center; }  /* 图标居中 */
.goal-item h3 {
  font-size: 20px; color: var(--primary);      /* 调小标题 */
  margin-bottom: 12px; font-weight: 600;
  text-align: center;                           /* 标题居中 */
}
.goal-item p {
  font-size: 17px; color: var(--text-secondary); /* 调小正文 */
  line-height: 1.8;                               /* 调小行高 */
  text-align: left;                               /* 正文左对齐 */
}

.tools-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px;  /* 增大间距从14px到18px */
}
.tool-card {
  padding: 28px 22px;                          /* 增大内边距从22px 16px到28px 22px */
  border-radius: var(--radius);
  background: var(--bg); cursor: pointer;
  border: 2px solid transparent; transition: var(--transition);
  text-align: center;
}
.tool-card:hover {
  border-color: var(--primary); background: var(--primary-light);
  transform: translateY(-3px); box-shadow: var(--shadow-sm);
}
.tool-icon { font-size: 44px; margin-bottom: 14px; }  /* 增大图标从38px到44px */
.tool-card h4 {
  font-size: 20px; margin-bottom: 10px;        /* 增大标题从18px到20px */
  font-weight: 600;
}
.tool-card p {
  font-size: 17px; color: var(--text-secondary); /* 增大正文从15px到17px */
  line-height: 1.7;                               /* 添加行高提高可读性 */
}
.tool-tag {
  display: inline-block; padding: 4px 14px; border-radius: 14px;
  font-size: 12px; font-weight: 700;           /* ↑10→12 */
  color: #fff; margin-top: 10px;
  letter-spacing: 0.5px;
}
.tech-vr { background: var(--vr-color); }
.tech-ar { background: var(--ar-color); }
.tech-mr { background: var(--mr-color); }
.tech-ai { background: var(--ai-color); }

.flow-list { display: flex; flex-direction: column; gap: 12px; }
.flow-item {
  display: flex; gap: 16px; padding: 18px 16px;  /* ↑14→18 */
  border-radius: var(--radius); background: var(--bg);
  cursor: pointer; transition: var(--transition);
  border-left: 3px solid transparent;
}
.flow-item:hover { border-left-color: var(--primary); background: var(--primary-light); }
.flow-num {
  min-width: 64px; height: 64px;               /* ↑54→64 */
  border-radius: 50%;
  background: var(--primary-gradient); color: #fff; display: flex;
  align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;           /* ↑12→14 */
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(79,70,229,0.2);
}
.flow-info strong {
  display: block; font-size: 19px;             /* ↑14→19 课堂投屏 */
  margin-bottom: 5px; font-weight: 600;
}
.flow-info span {
  font-size: 16px; color: var(--text-secondary); /* ↑12→16 课堂投屏 */
  line-height: 1.8;
}

.highlights-row {
  display: flex; flex-wrap: wrap; gap: 12px;
  padding-bottom: 5px;  /* 防止阴影截断 */
  overflow-x: auto;        /* 允许横向滚动如果有溢出 */
}
.highlight-badge {
  padding: 12px 22px;
  background: linear-gradient(135deg, #EEF2FF, #F5F3FF);
  border-radius: 24px;
  font-size: 15px; font-weight: 500;           /* ↑13→15 */
  color: var(--primary); border: 1px solid #DDD6FE;
  transition: var(--transition);
  white-space: nowrap;  /* 防止文字换行导致溢出 */
  flex-shrink: 0;       /* 防止badge被压缩 */
}
.highlight-badge:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }

/* ===== 按钮 ===== */
.btn-primary {
  background: var(--primary-gradient); color: #fff; border: none;
  padding: 12px 28px;                          /* ↑10/22→12/28 */
  border-radius: var(--radius);
  cursor: pointer; font-family: var(--font);
  font-size: 18px;                             /* ↑14→18 课堂投屏 */
  font-weight: 600; transition: var(--transition);
  box-shadow: 0 2px 8px rgba(79,70,229,0.25);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(79,70,229,0.3); }
.btn-sm {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border);
  padding: 9px 20px;                           /* ↑7/16→9/20 */
  border-radius: var(--radius-sm);
  cursor: pointer; font-family: var(--font);
  font-size: 16px; font-weight: 500;           /* ↑12→16 课堂投屏 */
  transition: var(--transition);
}
.btn-sm:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.btn-ai-mini {
  background: linear-gradient(135deg, #F59E0B, #EF4444);
  color: #fff; border: none;
  padding: 11px 22px;                          /* ↑9/18→11/22 */
  border-radius: 24px; cursor: pointer; font-family: var(--font);
  font-size: 15px; font-weight: 600;           /* ↑13→15 */
  margin-top: 16px;
  transition: var(--transition);
  box-shadow: 0 2px 8px rgba(239,68,68,0.2);
}
.btn-ai-mini:hover { transform: scale(1.04); }

/* ===== VR模块 ===== */
.vr-body {
  display: flex; gap: 20px;
  height: calc(100vh - 235px);                 /* ↑215→235 */
}
.vr-canvas-container {
  flex: 1; background: #0F0F23;
  border-radius: var(--radius-lg); position: relative;
  overflow: hidden; cursor: grab;
  min-height: 450px;                           /* ↑400→450 */
  border: 1px solid #1E1E3F;
}
.vr-canvas-container:active { cursor: grabbing; }
.vr-info-panel {
  width: 380px; display: flex; flex-direction: column;  /* ↑360→380 */
  gap: 16px; flex-shrink: 0; overflow-y: auto;
}
.vr-info-card {
  background: var(--surface); border-radius: var(--radius-lg);
  padding: 24px; border: 1px solid var(--border);  /* ↑20→24 */
  box-shadow: var(--shadow-sm);
}
.vr-info-card h3 {
  font-size: 19px; color: var(--text);         /* ↑16→19 */
  margin-bottom: 12px; font-weight: 700;
}
.vr-instruction {
  font-size: 14px; color: var(--text-secondary); /* ↑12→14 */
  margin-bottom: 16px; line-height: 1.6;
}
.vr-layer-info { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.layer-detail {
  display: flex; align-items: center; gap: 10px;
  font-size: 15px;
  padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--bg); cursor: pointer; transition: var(--transition);
  border: 2px solid transparent;
}
.layer-detail:hover { border-color: var(--primary); }
.layer-detail.highlight { border-color: var(--primary); background: var(--primary-light); }
.layer-color {
  width: 16px; height: 16px; border-radius: 4px; flex-shrink: 0;
}
.layer-name {
  font-weight: 700; white-space: nowrap; flex-shrink: 0;
  color: var(--text); min-width: 64px;
}
.layer-desc {
  font-size: 16px; color: var(--text-secondary);
  line-height: 1.6; flex: 1; min-width: 0;
}
.layer-desc::before {
  content: '—'; margin-right: 6px; color: var(--text-muted);
}
.vr-animation-display {
  background: var(--bg); border-radius: var(--radius);
  padding: 22px; min-height: 110px;
  margin-bottom: 14px;
  overflow-y: auto;
}
.animation-placeholder {
  display: flex; align-items: center; justify-content: center;
  min-height: 66px; text-align: center;
}
.animation-placeholder p {
  font-size: 15px; color: var(--text-muted);  /* ↑13→15 */
}
.animation-content {
  font-size: 15px; color: var(--text);        /* ↑13→15 */
  line-height: 1.8; text-align: left;
}
.animation-content strong { color: var(--primary); }
.animation-content h4 { color: var(--text); margin-bottom: 10px; font-weight: 700; }

/* VR模块优化（课堂投屏） */
.vr-info-panel {
  width: 420px;                             /* 调宽信息面板 */
}
.vr-info-card {
  padding: 28px;                           /* 增大内边距 */
}
.vr-info-card h3 {
  font-size: 20px;                         /* 调大标题字体 */
}
.vr-instruction {
  font-size: 16px;                         /* 调大提示字体 */
  margin-bottom: 18px;
}
.layer-detail {
  font-size: 16px;                         /* 调大图层信息字体 */
  padding: 14px 16px;
}

/* ===== AR模块 ===== */
.ar-body {
  display: flex; gap: 24px;                    /* 增大左右面板间距 */
  height: calc(100vh - 270px);              /* 调整高度，适应阶段任务条 */
  padding: 0 10px;                         /* 添加水平内边距 */
}
.ar-left-panel { flex: 1; display: flex; flex-direction: column; gap: 16px; }
.ar-image-container {
  flex: 1; background: var(--bg-secondary); border-radius: var(--radius-lg);
  border: 2px dashed var(--border); position: relative;
  overflow: hidden; display: flex; align-items: center;
  justify-content: center; min-height: 350px;
  transition: var(--transition);
}
.ar-image-container canvas { max-width: 100%; max-height: 100%; border-radius: var(--radius); }
.ar-overlay-info {
  position: absolute; inset: 0; display: flex;
  align-items: center; justify-content: center;
  background: rgba(248,250,252,0.9);
  backdrop-filter: blur(4px);
}
.ar-overlay-info p {
  font-size: 16px; color: var(--text-secondary);  /* ↑14→16 */
  font-weight: 500;
}
.ar-filter-controls {
  display: flex; flex-direction: column; gap: 10px;
  padding: 14px 20px; background: var(--surface);
  border-radius: var(--radius); border: 1px solid var(--border);
  font-size: 16px;
  box-shadow: var(--shadow-xs);
}
.ar-filter-row {
  display: flex; align-items: center; gap: 12px;
}
.ar-filter-row label {
  white-space: nowrap; font-weight: 600; color: var(--text);
  display: flex; align-items: center; gap: 6px; min-width: 110px;
}
.filter-label-sub {
  font-size: 12px; font-weight: 500; color: var(--text-secondary);
  background: #F1F5F9; border-radius: 10px;
  padding: 1px 7px;
}
.filter-val {
  min-width: 38px; text-align: right; font-size: 13px;
  color: var(--text-secondary); font-weight: 600;
}
.ar-filter-controls input[type="range"] { flex: 1; height: 6px; cursor: pointer; }
#arFilterSlider  { accent-color: #3B82F6; }
#arFilterSliderY { accent-color: #F59E0B; }
.ar-right-panel {
  width: 420px; display: flex; flex-direction: column;  /* 调宽右侧面板 */
  gap: 20px; flex-shrink: 0; overflow-y: auto;
  padding: 10px 0;                              /* 添加垂直内边距 */
}
.ar-layer-controls, .ar-observation-panel, .ar-discussion {
  background: var(--surface); border-radius: var(--radius);
  padding: 24px; border: 1px solid var(--border);       /* 增大内边距 */
  box-shadow: var(--shadow-xs);
}
.ar-layer-controls h3, .ar-observation-panel h3, .ar-discussion h4 {
  font-size: 20px; color: var(--text);         /* 调大字体，适合课堂投屏 */
  margin-bottom: 16px; font-weight: 700;
}
.layer-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.layer-btn {
  padding: 14px; border-radius: var(--radius-sm);
  border: 2px solid var(--border); background: var(--surface);
  cursor: pointer; font-family: var(--font);
  font-size: 16px; font-weight: 600;           /* 调大字体并加粗 */
  transition: var(--transition); text-align: center;
}
.layer-btn:hover { border-color: var(--ar-color); transform: translateY(-1px); }
.layer-btn.active {
  border-color: var(--ar-color); background: #FEF3C7;
  font-weight: 600;
}
.ar-observation-panel textarea, .ar-discussion textarea {
  width: 100%; border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-family: var(--font);
  font-size: 16px;                             /* 调大字体 */
  resize: vertical; min-height: 100px;          /* 增大最小高度 */
  transition: var(--transition); line-height: 1.8;
  background: #FAFAFA;                         /* 浅灰色背景，提示可输入 */
}
.ar-observation-panel textarea:focus, .ar-discussion textarea:focus {
  border-color: var(--ar-color);
  outline: none;
  box-shadow: 0 0 0 3px rgba(245,158,11,0.15);
  background: #fff;                            /* 聚焦时变为白色 */
}
.ar-discussion p {
  font-size: 16px; color: var(--text); /* 调大字体，颜色加深 */
  margin-bottom: 10px; line-height: 1.7;
  font-weight: 500;
}
/* 嵌套在observation-panel内时去除重复卡片样式 */
.ar-observation-panel .ar-discussion {
  padding: 0; background: transparent;
  border: none; border-radius: 0;
  box-shadow: none; margin-top: 16px;
}

/* ===== MR模块 ===== */
.mr-body {
  display: flex; gap: 16px;
  height: calc(100vh - 235px);
  overflow: hidden;
}
.mr-module-palette {
  width: 185px; background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 14px;
  border: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 8px;
  flex-shrink: 0; box-shadow: var(--shadow-sm);
  overflow-y: auto;
}
.mr-module-palette h3 {
  font-size: 15px; color: var(--text);
  margin-bottom: 2px; font-weight: 700;
}
.mr-module-item {
  padding: 12px 13px; background: var(--bg);
  border-radius: var(--radius); border: 2px dashed var(--border);
  cursor: grab; text-align: center; transition: var(--transition);
  user-select: none;
}
.mr-module-item:hover {
  border-color: var(--mr-color); background: #F5F3FF;
  transform: translateY(-2px); box-shadow: var(--shadow-sm);
}
.mr-module-item.dragging { opacity: 0.5; cursor: grabbing; }
.mr-module-item.preview { border-style: solid; border-color: var(--mr-color); }
.mr-module-icon { display: block; font-size: 25px; margin-bottom: 5px; }
.mr-module-item strong {
  display: block; font-size: 15px;
  margin-bottom: 3px; font-weight: 600;
}
.mr-module-item small {
  font-size: 13px; color: var(--text-secondary);
}

/* MR 建模区 */
.mr-build-area {
  flex: 1; min-width: 0; background: var(--surface); border-radius: var(--radius-lg);
  border: 2px dashed var(--border);
  padding: 20px;
  display: flex; flex-direction: column; align-items: center;
  gap: 8px; min-height: 0;
  transition: var(--transition);
  overflow-y: auto; overflow-x: hidden;
  box-shadow: var(--shadow-sm);
}
.mr-build-area.drag-over {
  border-color: var(--mr-color); background: #FAF5FF;
  border-style: solid;
}

/* 占位符 */
.mr-build-placeholder {
  text-align: center; color: var(--text-muted); margin-top: 40px;
}
.mr-placeholder-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.6; }
.mr-build-placeholder p {
  font-size: 15px; margin-bottom: 6px;
  font-weight: 500;
}
.mr-build-hint {
  font-size: 13px !important;
  color: var(--text-secondary);
  line-height: 1.6;
}
.mr-build-hint .hint-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

/* 数据来源 */
.mr-pipeline-source {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  margin-bottom: 2px;
}
.mr-source-badge {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #F59E0B, #F97316);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  box-shadow: 0 3px 10px rgba(245,158,11,0.3);
}
.mr-source-label {
  font-size: 12px; color: var(--text-secondary); font-weight: 500;
}

/* 流水线容器 */
.mr-pipeline {
  display: flex; flex-direction: column; align-items: center;
  gap: 0; width: 100%; max-width: 320px;
}

/* 模块节点 */
.mr-pipeline-node {
  width: 100%; max-width: 290px;
  border-radius: var(--radius); overflow: hidden;
  border: 2px solid var(--node-color, var(--primary));
  background: var(--surface);
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  animation: nodeAppear 0.3s ease;
  position: relative;
}
@keyframes nodeAppear {
  from { opacity: 0; transform: scale(0.92) translateY(-10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.mr-node-header {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 12px;
  background: var(--node-color, var(--primary));
  color: #fff;
}
.mr-node-icon { font-size: 16px; }
.mr-node-name { font-size: 14px; font-weight: 700; flex: 1; }
.mr-node-remove {
  width: 20px; height: 20px; border-radius: 50%;
  background: rgba(255,255,255,0.2); border: none; cursor: pointer;
  color: #fff; font-size: 12px;
  display: flex; align-items: center;
  justify-content: center; transition: var(--transition);
}
.mr-node-remove:hover { background: rgba(255,255,255,0.35); }

.mr-node-body {
  padding: 10px 12px; background: var(--surface);
}
.mr-node-step {
  font-size: 11px; color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px;
}
.mr-node-transform {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.mr-transform-input, .mr-transform-output {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.mr-transform-label {
  font-size: 11px; color: var(--text-muted); font-weight: 600;
}
.mr-transform-data {
  font-size: 12px; color: var(--text); font-weight: 500;
}
.mr-transform-arrow {
  font-size: 15px; color: var(--node-color, var(--primary));
  font-weight: 700;
}
.mr-node-shape {
  margin-top: 6px; text-align: center;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  background: var(--bg);
  padding: 4px 10px; border-radius: var(--radius-xs);
}

/* 模块发光 */
.mr-node-glow {
  position: absolute; inset: 0; border-radius: var(--radius);
  box-shadow: 0 0 20px var(--node-color, var(--primary));
  opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.mr-pipeline-node:hover .mr-node-glow { opacity: 0.15; }

/* 连接线 + 粒子 */
.mr-flow-connector {
  display: flex; flex-direction: column; align-items: center;
  height: 36px; position: relative;
}
.mr-flow-svg {
  width: 32px; height: 100%;
}
.mr-flow-line {
  stroke-dasharray: 6 4;
  animation: flowDash 0.6s linear infinite;
}
.mr-flow-line.flowing {
  animation: flowDash 0.4s linear infinite;
}
@keyframes flowDash {
  to { stroke-dashoffset: -10; }
}
.mr-flow-data-label {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  background: var(--surface); padding: 1px 8px; border-radius: 10px;
  font-size: 11px; color: var(--text-muted);
  font-weight: 500; white-space: nowrap;
  pointer-events: none;
}

/* 数据输出 */
.mr-pipeline-output {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  margin-top: 4px; opacity: 0.4; transition: var(--transition);
}
.mr-pipeline-output.active { opacity: 1; }
.mr-output-badge {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--bg-secondary);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  transition: var(--transition);
}
.mr-pipeline-output.active .mr-output-badge {
  background: linear-gradient(135deg, #10B981, #059669);
  box-shadow: 0 3px 12px rgba(16,185,129,0.35);
  animation: outputPulse 1.5s ease infinite;
}
@keyframes outputPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}
.mr-output-label {
  font-size: 13px; color: var(--text-secondary); font-weight: 500;
}

/* 数据流信息面板 */
.mr-flow-info-panel {
  width: 100%; max-width: 420px; margin-top: 10px;
  padding: 14px 16px; background: var(--bg);
  border-radius: var(--radius); border: 1px solid var(--border);
}
.mr-flow-chain {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  justify-content: center;
}
.mr-flow-chain-item {
  padding: 5px 12px; border-radius: 16px;
  font-size: 13px; font-weight: 600;
  border: 1.5px solid var(--border);
  background: var(--surface);
}
.mr-flow-chain-item.source { border-color: #F59E0B; color: #F59E0B; }
.mr-flow-chain-item.output { border-color: #10B981; color: #10B981; }
.mr-flow-arrow-mini {
  font-size: 13px; color: var(--text-muted);
}
.mr-flow-dimensions {
  margin-top: 10px; text-align: center;
  font-size: 13px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}
.mr-dim-label { font-weight: 600; color: var(--text); }
.mr-flow-empty {
  text-align: center; color: var(--text-muted);
  font-size: 13px;
}

/* MR 右侧面板 */
.mr-info-panel {
  width: 290px; display: flex; flex-direction: column;
  gap: 12px; flex-shrink: 0; overflow-y: auto;
}
.mr-status, .mr-collab-notes {
  background: var(--surface); border-radius: var(--radius);
  padding: 16px; border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}
.mr-status h3, .mr-collab-notes h3 {
  font-size: 19px; color: var(--text);
  margin-bottom: 10px; font-weight: 700;
}
.mr-status p {
  font-size: 16px; color: var(--text-secondary);
  line-height: 1.7;
}
.mr-status.success p { color: var(--success); }
.mr-status.error p { color: var(--error); }
.mr-status.success { border-color: var(--success); background: var(--success-light); }
.mr-status.error { border-color: var(--error); background: var(--error-light); }
.collab-roles {
  display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px;
  font-size: 15px; color: var(--text-secondary);
}
.mr-collab-notes textarea {
  width: 100%; border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-family: var(--font);
  font-size: 16px;
  resize: vertical; min-height: 140px;
  transition: var(--transition); line-height: 1.8;
  box-sizing: border-box;
}
.mr-collab-notes textarea:focus {
  border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

/* ===== AI训练模块 ===== */
.ai-train-body {
  display: flex; flex-direction: column; gap: 14px;
  min-height: 600px;
  padding-bottom: 4px;
}

/* ---- 实验任务区（ABC三组 + 结论） ---- */
.train-task-section {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 14px 22px;
  flex-shrink: 0;
}
.train-task-groups {
  display: flex; gap: 12px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.train-task-group {
  flex: 1; min-width: 220px;
  padding: 10px 14px;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.train-task-group .group-label { font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.train-task-group .group-setting { font-size: 13px; color: var(--text); margin-bottom: 4px; }
.train-task-group .group-setting strong { color: var(--primary-dark); }
.train-task-group .group-predict { font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; }
.train-task-group .group-record { font-size: 13px; color: var(--text); margin-top: 4px; }
.group-record-input {
  width: 90px; padding: 3px 8px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: 13px; font-family: var(--font);
  background: var(--bg);
}

/* 实验结论 - 填空 */
.train-task-conclusion {
  padding: 12px 0 0;
  border-top: 1px solid var(--border);
}
.conclusion-label {
  display: block; font-size: 15px; font-weight: 700;
  color: var(--primary-dark); margin-bottom: 8px;
}
.conclusion-fill {
  font-size: 15px; color: var(--text);
  line-height: 2;
}
.conclusion-input {
  width: 75px; padding: 3px 8px;
  border: none; border-bottom: 2px dashed var(--primary);
  font-size: 15px; font-family: var(--font);
  text-align: center; color: var(--primary-dark);
  background: transparent; outline: none;
  transition: border-color var(--transition), background var(--transition);
  font-weight: 600;
}
.conclusion-input:focus {
  border-bottom-color: var(--primary-dark);
  background: rgba(79,70,229,0.04);
}
.conclusion-inline-btn {
  padding: 2px 8px;
  font-size: 14px; font-weight: 600;
  border: 1.5px solid var(--primary);
  border-radius: 12px;
  background: #fff;
  color: var(--primary);
  cursor: pointer;
  vertical-align: middle;
  transition: all var(--transition);
  line-height: 1.4;
}
.conclusion-inline-btn:hover {
  background: var(--primary);
  color: #fff;
}
.conclusion-reveal-btn {
  margin-top: 10px;
  padding: 6px 18px;
  font-size: 13px; font-weight: 600;
  border: 1.5px solid var(--primary);
  border-radius: 20px;
  background: #fff;
  color: var(--primary);
  cursor: pointer;
  transition: all var(--transition);
}
.conclusion-reveal-btn:hover {
  background: var(--primary);
  color: #fff;
}
.conclusion-answer {
  margin-top: 10px; padding: 10px 16px;
  background: linear-gradient(135deg, #F0FDF4, #DCFCE7);
  border-left: 3px solid #22C55E;
  border-radius: var(--radius-sm);
  font-size: 14px; color: var(--text);
  line-height: 1.9;
  animation: fadeInDown 0.35s ease;
}
.conclusion-answer .answer-icon {
  margin-right: 4px;
}
@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---- 参数控制栏 ---- */
.train-param-bar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 14px 22px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}
.param-bar-group {
  display: flex; align-items: center; gap: 10px;
}
.param-bar-label {
  font-size: 16px; font-weight: 600; color: var(--text);
  white-space: nowrap;
}
.param-bar-select {
  padding: 10px 38px 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-family: var(--font);
  font-size: 16px;
  background: var(--bg);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%23666' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  min-width: 170px;
  transition: var(--transition);
}
.param-bar-select-sm { min-width: 140px; }
.param-bar-select:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}
.btn-train-start {
  padding: 12px 28px; font-size: 18px; font-weight: 700;
  white-space: nowrap; margin-left: 4px;
}
#aiStartTrain.training-active {
  background: linear-gradient(135deg, #FF9800, #F57C00);
  animation: trainPulse 1s ease-in-out infinite;
  cursor: wait; pointer-events: none;
}
@keyframes trainPulse {
  0%, 100% { box-shadow: 0 4px 14px rgba(255,152,0,0.3); }
  50% { box-shadow: 0 4px 24px rgba(255,152,0,0.6); transform: scale(1.02); }
}
.param-bar-hint {
  margin-left: auto;
  font-size: 15px; color: var(--text-secondary);
  font-style: italic;
}
.param-bar-compare {
  display: flex; align-items: center; gap: 8px;
  padding-left: 16px; border-left: 2px solid var(--border);
}
.param-compare-badge {
  font-size: 13px; font-weight: 600; color: #8B5CF6;
  background: #F5F3FF; padding: 4px 12px;
  border-radius: 14px; white-space: nowrap;
  animation: compareBadgePulse 2s infinite;
}
@keyframes compareBadgePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(139,92,246,0.3); }
  50% { box-shadow: 0 0 0 8px rgba(139,92,246,0); }
}

/* ---- 主工作区：Grid 双栏布局（左侧面板 + 右侧图表） ---- */
.train-workspace {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 20px;
  min-height: 480px;
  align-items: start;
}

/* 左侧面板：日志 + 阶段状态 + 实时指标 */
.train-log-panel {
  display: flex; flex-direction: column; gap: 14px;
  min-width: 0;
}

/* 右侧：图表区 — 视觉主角 */
.train-chart-area {
  min-width: 0;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  position: relative;
  min-height: 480px;
}
.train-chart-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}
.train-chart-header h3 {
  font-size: 21px; color: var(--text); font-weight: 700; margin: 0;
}
.chart-legend-inline {
  display: flex; align-items: center; gap: 10px;
  font-size: 15px; color: var(--text-secondary);
}
.legend-dot {
  display: inline-block; width: 12px; height: 12px; border-radius: 3px;
  margin-right: 2px;
}
.legend-acc { background: #4F46E5; }
.legend-loss { background: #EA4335; border-radius: 1px; transform: rotate(45deg); }
.legend-compare { background: #F59E0B; border: 2px dashed #B45309; border-radius: 1px; }

.train-chart-canvas-wrap {
  flex: 1;
  position: relative;
  background: #fafbfc;
  min-height: 360px;
  overflow: hidden;
}
.train-chart-canvas-wrap canvas {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  display: block;
}

/* 图表内联提示条（底部半透明） */
.train-chart-hint {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  z-index: 5;
  text-align: center;
  padding: 8px 20px;
  font-size: 15px; color: var(--text-secondary);
  background: linear-gradient(90deg, rgba(79,70,229,0.06), rgba(79,70,229,0.12), rgba(79,70,229,0.06));
  border-top: 1px dashed rgba(79,70,229,0.2);
  transition: opacity 0.3s;
}

/* 训练进度条 */
.train-progress-strip {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 22px 12px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.train-progress-bar {
  flex: 1; height: 8px;
  border-radius: 4px;
  background: #E2E8F0;
  position: relative; overflow: hidden;
}
.train-progress-bar::after {
  content: '';
  position: absolute; inset: 0;
  background: var(--primary-gradient);
  width: var(--progress, 0%);
  border-radius: 4px;
  transition: width 0.15s linear;
}
.train-progress-text {
  font-size: 15px; font-weight: 700; color: var(--primary);
  white-space: nowrap; min-width: 100px;
}

/* ======== 🔒 图表区浮动结果面板 ======== */
.chart-stat-overlay {
  display: flex; gap: 10px;
  padding: 10px 18px 12px;
  background: linear-gradient(135deg, rgba(79,70,229,0.025), rgba(124,58,237,0.025));
  border-top: 1px solid rgba(79,70,229,0.08);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  flex-shrink: 0;
  /* 入场动画 */
  animation: statOverlayIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes statOverlayIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.chart-stat-mini {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px 6px 8px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  min-width: 100px;
  transition: var(--transition);
  flex-shrink: 0;
}
.chart-stat-mini:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.chart-stat-icon {
  font-size: 22px; width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px; flex-shrink: 0;
}
.stat-accuracy .chart-stat-icon { background: rgba(79,70,229,0.08); }
.stat-error    .chart-stat-icon { background: rgba(234,67,53,0.06); }
.stat-fit      .chart-stat-icon { background: rgba(52,168,83,0.07); }

.chart-stat-body {
  display: flex; flex-direction: column; gap: 1px;
  min-width: 0;
}
.chart-stat-label {
  font-size: 12px; color: var(--text-secondary); font-weight: 500;
  line-height: 1.2; white-space: nowrap;
}
.chart-stat-val {
  font-size: 22px; font-weight: 800; line-height: 1.15;
  color: var(--primary);
}
.stat-fit-value { font-size: 16px; }

/* ---- 信息面板（已移至左侧主工作区） ---- */

/* 训练日志卡片 */
.train-log-section {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  display: flex; flex-direction: column;
}
.train-log-section h4 {
  font-size: 18px; font-weight: 700; color: var(--text);
  padding: 12px 16px 8px;
  margin: 0;
  display: flex; align-items: center; gap: 8px;
}
.train-log-list {
  flex: 1; max-height: 160px; overflow-y: auto;
  padding: 0 8px 8px;
}
.train-log-empty {
  text-align: center; color: var(--text-muted);
  font-size: 15px; padding: 20px 0;
}
.train-log-entry {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; font-size: 14px;
  border-radius: 6px;
  transition: background 0.15s;
  font-family: var(--font-mono);
}
.train-log-entry:nth-child(odd) { background: var(--bg); }
.train-log-entry .log-epoch {
  font-weight: 700; color: var(--text); min-width: 56px;
}
.train-log-entry .log-acc {
  font-weight: 600; color: #4F46E5; min-width: 52px;
}
.train-log-entry .log-loss {
  font-weight: 600; color: #EA4335; min-width: 48px;
}
.train-log-entry .log-phase-tag {
  font-size: 11px; padding: 2px 8px; border-radius: 10px;
  font-weight: 600;
  font-family: var(--font);
}
.log-phase-fast    { background: #EEF2FF; color: #4F46E5; }
.log-phase-stable  { background: #ECFDF5; color: #10B981; }
.log-phase-slow    { background: #FEF3C7; color: #F59E0B; }
.log-phase-final   { background: #F5F3FF; color: #8B5CF6; }

/* 阶段状态卡片 */
.train-phase-section {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  padding: 12px 16px;
}
.train-phase-indicator {
  display: flex; align-items: center; gap: 10px; margin-bottom: 8px;
}
.phase-dot-icon { font-size: 26px; }
.phase-dot-text {
  font-size: 18px; font-weight: 700;
}
.train-phase-detail {
  font-size: 15px; color: var(--text-secondary);
  line-height: 1.7;
}

/* 实时指标行（横排卡片） */
.train-live-metrics {
  display: flex; gap: 10px; flex-wrap: wrap;
}
.live-metric-item {
  flex: 1;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  padding: 14px 10px; text-align: center;
}
.live-label {
  display: block; font-size: 13px; color: var(--text-secondary);
  margin-bottom: 6px; font-weight: 500;
}
.live-value {
  display: block; font-size: 22px; font-weight: 800;
  color: var(--primary);
  transition: color 0.3s;
}

/* ---- 结果指标卡片行 ---- */
.train-stats-row {
  display: flex; gap: 14px; flex-shrink: 0;
}
.stat-card {
  flex: 1;
  display: flex; align-items: center; gap: 14px;
  padding: 20px 22px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.stat-icon {
  font-size: 38px; flex-shrink: 0;
  width: 56px; height: 56px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 14px;
}
.stat-accuracy .stat-icon { background: rgba(79,70,229,0.08); }
.stat-error .stat-icon    { background: rgba(234,67,53,0.06); }
.stat-fit .stat-icon       { background: rgba(52,168,83,0.07); }
.stat-insight .stat-icon   { background: rgba(245,158,11,0.08); }

.stat-info {
  display: flex; flex-direction: column; gap: 2px;
  min-width: 0;
}
.stat-label {
  font-size: 15px; color: var(--text-secondary); font-weight: 500;
}
.stat-value {
  font-size: 34px; font-weight: 800; line-height: 1.15;
  color: var(--primary);
  transition: color 0.3s;
}
.stat-sub {
  font-size: 13px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.stat-fit-value { font-size: 21px; }
.stat-insight-text {
  font-size: 17px !important; font-weight: 600 !important;
  line-height: 1.4 !important; color: #B45309 !important;
}

/* ---- 实验记录表 ---- */
.ai-train-experiment-log {
  margin-top: 0; flex-shrink: 0;
}
.ai-train-experiment-log h3 {
  font-size: 21px; margin-bottom: 10px;
  color: var(--text); font-weight: 700;
  display: flex; align-items: center; gap: 10px;
}
.table-row-count {
  font-size: 14px; font-weight: 500; color: var(--text-secondary);
  background: var(--bg-secondary);
  padding: 2px 14px; border-radius: 14px;
}
.experiment-table-wrap {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.experiment-table {
  width: 100%; border-collapse: collapse;
}
.experiment-table th {
  background: var(--primary-gradient); color: #fff;
  padding: 14px 12px;
  font-size: 16px; font-weight: 600;
  text-align: left; white-space: nowrap;
}
.experiment-table th.col-id       { width: 70px; text-align: center; }
.experiment-table th.col-data     { width: 150px; }
.experiment-table th.col-iter     { width: 140px; }
.experiment-table th.col-acc      { width: 105px; text-align: center; }
.experiment-table th.col-acc-bar  { width: 130px; text-align: center; }
.experiment-table th.col-fit      { width: 170px; }
.experiment-table th.col-conclusion { width: auto; }

.experiment-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  font-size: 16px;
}
.experiment-table td.col-id,
.experiment-table td.col-acc,
.experiment-table td.col-acc-bar {
  text-align: center;
}
.experiment-table tbody tr {
  transition: background 0.2s;
}
.experiment-table tbody tr:hover {
  background: rgba(79,70,229,0.04);
}
.experiment-table tbody tr:last-child td {
  border-bottom: none;
}
.experiment-table .empty-hint {
  text-align: center; color: var(--text-secondary);
  padding: 36px; font-size: 17px;
}

/* 实验记录柱状图 */
.exp-bar-wrap {
  display: flex; align-items: center; gap: 8px; justify-content: center;
}
.exp-bar-track {
  width: 80px; height: 10px;
  background: #E2E8F0; border-radius: 5px;
  overflow: hidden;
}
.exp-bar-fill {
  height: 100%; border-radius: 5px;
  transition: width 0.5s ease;
}
.exp-bar-fill.high   { background: linear-gradient(90deg, #34A853, #10B981); }
.exp-bar-fill.medium { background: linear-gradient(90deg, #F59E0B, #FBBC04); }
.exp-bar-fill.low    { background: linear-gradient(90deg, #EA4335, #F97316); }
.exp-bar-val {
  font-size: 13px; font-weight: 700; color: var(--text);
  min-width: 44px;
}

/* ---- 响应式 ---- */
@media (max-width: 1100px) {
  .train-workspace {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .train-log-panel {
    flex-direction: row; flex-wrap: wrap;
    gap: 12px;
  }
  .train-log-panel > * {
    flex: 1; min-width: 240px;
  }
  .train-chart-area {
    min-height: 420px;
  }
}
@media (max-width: 900px) {
  .train-log-panel {
    flex-direction: column; flex-wrap: nowrap;
    overflow-y: auto;
  }
  .train-log-panel > * {
    min-width: 0; flex: none;
  }
  .train-chart-canvas-wrap {
    min-height: 300px;
  }
  .chart-stat-overlay {
    gap: 6px; padding: 8px 12px 10px;
  }
  .chart-stat-mini {
    padding: 6px 10px 6px 8px; min-width: 90px;
  }
  .chart-stat-icon { font-size: 18px; width: 28px; height: 28px; }
  .chart-stat-val { font-size: 17px; }
  .stat-fit-value { font-size: 13px; }
}
@media (max-width: 640px) {
  .train-param-bar {
    gap: 10px; padding: 10px 14px;
    flex-direction: column; align-items: stretch;
  }
  .train-param-bar-hint { margin-left: 0; }
  .train-stats-row {
    flex-wrap: wrap;
  }
  .stat-card {
    flex: 1 1 45%; min-width: 160px;
  }
  .train-chart-canvas-wrap {
    padding: 6px 4px 4px;
    min-height: 240px;
  }
  .chart-stat-overlay {
    gap: 4px; padding: 6px 10px 8px;
    flex-wrap: wrap; justify-content: center;
  }
  .chart-stat-mini {
    flex: 1 1 auto; min-width: 70px;
    padding: 5px 8px; gap: 4px;
  }
  .chart-stat-icon { font-size: 16px; width: 24px; height: 24px; border-radius: 5px; }
  .chart-stat-label { font-size: 10px; }
  .chart-stat-val { font-size: 15px; }
  .stat-fit-value { font-size: 12px; }
  .train-chart-header {
    padding: 10px 14px;
  }
  .train-chart-header h3 {
    font-size: 16px;
  }
}

/* ===== 习题模块 ===== */
.exercise-body {
  display: flex; flex-direction: column; gap: 16px;
  height: calc(100vh - 235px);
}

/* ---- 顶部得分统计栏 ---- */
.exercise-score-bar {
  display: flex; align-items: center; gap: 24px;
  padding: 16px 24px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}
.score-circle-mini {
  width: 88px; height: 88px;
  border-radius: 50%;
  border: 5px solid var(--border);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  flex-shrink: 0; transition: var(--transition);
}
.score-circle-mini .score-number {
  font-size: 26px; font-weight: 800; color: var(--primary); line-height: 1;
}
.score-circle-mini .score-label {
  font-size: 11px; color: var(--text-secondary); margin-top: 2px;
}
.score-stats-grid {
  display: flex; gap: 16px; flex: 1;
}
.score-stat-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  flex: 1; min-width: 0;
  transition: var(--transition);
}
.score-stat-item:hover { transform: translateY(-1px); box-shadow: var(--shadow-xs); }
.score-stat-icon {
  font-size: 26px; width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px; flex-shrink: 0;
}
.score-stat-correct .score-stat-icon   { background: rgba(52,168,83,0.08); }
.score-stat-wrong .score-stat-icon      { background: rgba(234,67,53,0.06); }
.score-stat-unanswered .score-stat-icon { background: rgba(251,188,4,0.08); }
.score-stat-body {
  display: flex; flex-direction: column; gap: 1px;
}
.score-stat-num {
  font-size: 28px; font-weight: 800; line-height: 1.1;
}
.score-stat-correct .score-stat-num   { color: #34A853; }
.score-stat-wrong .score-stat-num      { color: #EA4335; }
.score-stat-unanswered .score-stat-num { color: #FBBC04; }
.score-stat-lbl {
  font-size: 13px; color: var(--text-secondary); font-weight: 500;
}

/* ---- 内容行：习题 + 侧栏 ---- */
.exercise-content-row {
  display: flex; gap: 20px;
  flex: 1; min-height: 0;
}
.exercise-main {
  flex: 1; overflow-y: auto; padding-right: 6px;
}
.exercise-sidebar {
  width: 340px; display: flex; flex-direction: column;
  gap: 14px; flex-shrink: 0; overflow-y: auto;
}
.mistake-panel, .ai-report-panel {
  background: var(--surface); border-radius: var(--radius-lg);
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}
.mistake-panel h3, .ai-report-panel h3 {
  font-size: 18px; color: var(--text);
  margin-bottom: 12px; font-weight: 700;
}

.exercise-question {
  background: var(--surface); border-radius: var(--radius);
  padding: 24px;                               /* ↑20→24 */
  margin-bottom: 16px; border: 1px solid var(--border);
  transition: var(--transition); box-shadow: var(--shadow-xs);
}
.exercise-question:hover { box-shadow: var(--shadow-sm); }
.exercise-question.correct { border-color: var(--success); background: var(--success-light); }
.exercise-question.wrong { border-color: var(--error); background: var(--error-light); }
.question-header {
  display: flex; align-items: center; gap: 12px; margin-bottom: 14px;
}
.question-num {
  width: 36px; height: 36px;                   /* ↑30→36 */
  border-radius: 50%;
  background: var(--primary-gradient); color: #fff; display: flex;
  align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700;           /* ↑13→16 */
  box-shadow: 0 2px 6px rgba(79,70,229,0.2);
}
.question-type {
  font-size: 13px;                             /* ↑11→13 */
  padding: 4px 14px; border-radius: 14px;
  background: var(--primary-light); color: var(--primary); font-weight: 600;
}
.question-text {
  font-size: 19px; line-height: 1.9;           /* ↑14→19 课堂投屏 */
  margin-bottom: 14px; color: var(--text);
}
.question-options { display: flex; flex-direction: column; gap: 10px; }
.option-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;                          /* ↑10/14→12/16 */
  border-radius: var(--radius-sm);
  border: 1px solid var(--border); cursor: pointer;
  transition: var(--transition);
  font-size: 17px;                             /* ↑13→17 课堂投屏 */
  background: var(--surface); line-height: 1.6;
}
.option-item:hover {
  border-color: var(--primary); background: var(--primary-light);
  transform: translateX(2px);
}
.option-item.selected { border-color: var(--primary); background: var(--primary-light); font-weight: 500; }
.option-letter {
  width: 30px; height: 30px;                   /* ↑26→30 */
  border-radius: 50%;
  background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;           /* ↑12→14 */
  flex-shrink: 0; transition: var(--transition);
}
.option-item.selected .option-letter { background: var(--primary); color: #fff; }
.question-input {
  width: 100%;
  padding: 12px 16px;                          /* ↑10/14→12/16 */
  border-radius: var(--radius-sm);
  border: 1px solid var(--border); font-family: var(--font);
  font-size: 16px;                             /* ↑13→16 */
  transition: var(--transition);
}
.question-input:focus {
  border-color: var(--primary); outline: none;
  box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}
.question-textarea {
  width: 100%;
  padding: 14px 16px;                          /* ↑12→14/16 */
  border-radius: var(--radius-sm);
  border: 1px solid var(--border); font-family: var(--font);
  font-size: 16px;                             /* ↑13→16 */
  resize: vertical; min-height: 90px;
  transition: var(--transition); line-height: 1.7;
}
.question-textarea:focus {
  border-color: var(--primary); outline: none;
  box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}
.exercise-feedback {
  margin-top: 14px; padding: 14px 16px;        /* ↑12→14/16 */
  border-radius: var(--radius-sm);
  font-size: 14px; display: none;              /* ↑12→14 */
  line-height: 1.8;
}
.exercise-feedback.show { display: block; animation: fadeIn 0.3s ease; }
.exercise-feedback.correct-fb { background: var(--success-light); color: #047857; }
.exercise-feedback.wrong-fb { background: var(--error-light); color: #B91C1C; }

/* ===== AI答疑弹窗 ===== */
.ai-assistant-overlay {
  position: fixed; inset: 0; background: rgba(15,15,35,0.5);
  z-index: 1000; display: none; align-items: center;
  justify-content: center; backdrop-filter: blur(4px);
}
.ai-assistant-overlay.show { display: flex; }
.ai-assistant-dialog {
  width: 600px; max-height: 80vh;              /* ↑540→600 */
  background: var(--surface);
  border-radius: var(--radius-xl); display: flex;
  flex-direction: column; box-shadow: var(--shadow-lg);
  animation: slide-up 0.3s ease;
}
@keyframes slide-up {
  from { transform: translateY(30px) scale(0.97); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}
.ai-dialog-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px;                          /* ↑16/22→18/24 */
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, #312E81, #4F46E5);
  color: #fff; border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}
.ai-dialog-header h3 { font-size: 18px; font-weight: 700; }  /* ↑16→18 */
.btn-close {
  background: rgba(255,255,255,0.15); border: none; color: #fff;
  font-size: 20px; cursor: pointer;            /* ↑18→20 */
  width: 34px; height: 34px;                   /* ↑32→34 */
  border-radius: 50%; display: flex; align-items: center;
  justify-content: center; transition: var(--transition);
}
.btn-close:hover { background: rgba(255,255,255,0.25); }
.ai-dialog-body {
  display: flex; flex-direction: column; flex: 1;
  overflow: hidden;
}
.ai-chat-messages {
  flex: 1; overflow-y: auto; padding: 20px;    /* ↑18→20 */
  display: flex; flex-direction: column; gap: 14px;
  max-height: 440px;                           /* ↑420→440 */
}
.ai-message { display: flex; gap: 12px; }
.ai-message-user { flex-direction: row-reverse; }
.ai-avatar {
  width: 38px; height: 38px;                   /* ↑34→38 */
  border-radius: 50%;
  background: var(--primary-light); display: flex; align-items: center;
  justify-content: center;
  font-size: 20px; flex-shrink: 0;             /* ↑18→20 */
}
.ai-message-user .ai-avatar {
  background: var(--primary-gradient); color: #fff;
  font-size: 16px;                             /* ↑14→16 */
}
.ai-bubble {
  max-width: 80%;
  padding: 14px 18px;                          /* ↑12/16→14/18 */
  border-radius: 18px;
  background: var(--bg);
  font-size: 16px; line-height: 1.8;           /* ↑13→16 课堂投屏 */
}
.ai-message-user .ai-bubble {
  background: var(--primary-gradient); color: #fff;
}
.ai-bubble p { margin-bottom: 6px; }
.ai-bubble p:last-child { margin-bottom: 0; }
.ai-hint {
  font-size: 13px !important;                  /* ↑11→13 */
  color: var(--text-muted) !important;
}
.ai-chat-input {
  padding: 16px 20px;                          /* ↑14/18→16/20 */
  border-top: 1px solid var(--border);
}
.ai-chat-input textarea {
  width: 100%; border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;                          /* ↑12→14/16 */
  font-family: var(--font);
  font-size: 16px;                             /* ↑13→16 课堂投屏 */
  resize: none; transition: var(--transition);
}
.ai-chat-input textarea:focus {
  border-color: var(--primary); outline: none;
  box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}
.ai-input-actions {
  display: flex; gap: 10px; justify-content: flex-end;
  margin-top: 12px;                            /* ↑10→12 */
}

/* ===== 状态栏 ===== */
.statusbar {
  background: linear-gradient(135deg, #312E81, #4F46E5);
  color: rgba(255,255,255,0.85);
  padding: 6px 20px;
  display: flex; gap: 20px;
  font-size: 13px;
  flex-shrink: 0;
}
.statusbar strong { color: #fff; font-weight: 700; }

.empty-hint {
  color: var(--text-muted);
  font-size: 16px; text-align: center;
  padding: 20px;
}

/* ===== 滚动条 ===== */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94A3B8; }

/* ===== 响应式布局 ===== */
@media (max-width: 900px) {
  .app-layout {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    flex-direction: row;
    align-items: center;
    padding: 10px 16px;
    box-shadow: 0 4px 20px rgba(79,70,229,0.25);
  }
  .sidebar-header {
    padding: 0;
    border-bottom: none;
    border-right: 1px solid rgba(255,255,255,0.15);
    padding-right: 16px;
    margin-right: 16px;
    flex-direction: column;
    gap: 4px;
  }
  .sidebar-header .logo-text-line1 {
    font-size: 18px;
  }
  .sidebar-header .logo-text-line2 {
    font-size: 16px;
  }
  .sidebar-header .logo-text-sub {
    font-size: 11px;
    margin-top: 4px;
    padding: 2px 8px;
  }
  .sidebar-nav {
    flex-direction: row;
    flex: 1;
    padding: 0;
    overflow-x: auto;
  }
  .sidebar-nav .nav-btn {
    width: auto;
    padding: 10px 14px;
    font-size: 14px;
  }
  .sidebar-footer {
    padding: 0;
    border-top: none;
    border-left: 1px solid rgba(255,255,255,0.15);
    padding-left: 16px;
    margin-left: 16px;
  }
  .main-content {
    padding: 16px 20px;
  }
}

@media (max-width: 600px) {
  .sidebar-nav .nav-btn .nav-label {
    display: none;
  }
  .sidebar-nav .nav-btn {
    padding: 10px 12px;
  }
  .sidebar-nav .nav-btn .nav-icon {
    font-size: 24px;
    width: auto;
  }
}
@media (max-width: 1100px) {
  .mr-body {
    flex-wrap: wrap;
  }
  .mr-module-palette {
    width: 100%; flex-direction: row; flex-wrap: wrap;
  }
  .mr-module-palette h3 { width: 100%; }
  .mr-module-item { flex: 1 1 140px; }
  .mr-build-area { flex: 1 1 100%; min-height: 300px; }
  .mr-info-panel { width: 100%; flex-direction: row; flex-wrap: wrap; }
  .mr-status, .mr-collab-notes { flex: 1 1 280px; }
}
@media (max-width: 768px) {
  .vr-body, .ar-body, .mr-body, .exercise-body {
    flex-direction: column; height: auto;
  }
  .exercise-content-row { flex-direction: column; }
  .vr-info-panel, .ar-right-panel, .mr-info-panel,
  .mr-module-palette, .exercise-sidebar { width: 100%; }
  .exercise-score-bar { flex-direction: column; gap: 12px; }
  .score-stats-grid { flex-wrap: wrap; }
  .score-stat-item { flex: 1 1 40%; min-width: 120px; }
  .topbar { flex-wrap: wrap; }
  .topbar-nav { order: 3; width: 100%; justify-content: flex-start; }
  .goals-grid { grid-template-columns: 1fr; }
  .tools-grid { grid-template-columns: 1fr 1fr; }
  .mr-info-panel { flex-direction: column; }
  .mr-pipeline { max-width: 100%; }
  .mr-pipeline-node { max-width: 100%; }
  .mr-flow-info-panel { max-width: 100%; }
}
