/* ===== 有理数及其运算交互实验室样式 ===== */
:root {
  --bg-primary: #0a0f1c;
  --bg-secondary: #111827;
  --bg-card: #1f2937;
  --accent: #f59e0b;
  --accent2: #3b82f6;
  --accent3: #10b981;
  --accent4: #8b5cf6;
  --accent5: #ec4899;
  --text-primary: #f9fafb;
  --text-secondary: #9ca3af;
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
}

/* ===== 头部导航 ===== */
.lab-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 1.5rem;
}

.back-btn {
  background: rgba(255,255,255,0.1);
  border: none;
  color: var(--text-primary);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s;
}

.back-btn:hover { background: rgba(255,255,255,0.2); }

.lab-title {
  font-size: 1.5rem;
  font-weight: 700;
}

.mastery-badge {
  background: linear-gradient(135deg, var(--accent3), var(--accent2));
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.9rem;
}

/* ===== 模块标签页 ===== */
.module-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.module-tab {
  background: var(--bg-card);
  border: 2px solid transparent;
  color: var(--text-secondary);
  padding: 0.75rem 1.25rem;
  border-radius: 12px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.module-tab:hover {
  border-color: rgba(255,255,255,0.2);
  color: var(--text-primary);
}

.module-tab.active {
  background: linear-gradient(135deg, var(--accent2), var(--accent4));
  color: white;
  border-color: transparent;
}

.module-tab .tab-icon {
  font-size: 1.1rem;
}

/* ===== 模块内容区 ===== */
.module-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.module-content.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.module-card {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.module-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.module-num {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent2), var(--accent4));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}

.module-title {
  font-size: 1.25rem;
  font-weight: 600;
}

.module-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

/* ===== 交互画布 ===== */
.interactive-canvas {
  background: var(--bg-secondary);
  border-radius: 12px;
  overflow: hidden;
  position: relative;
}

.canvas-toolbar {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
  background: rgba(0,0,0,0.3);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  flex-wrap: wrap;
}

.canvas-btn {
  background: rgba(255,255,255,0.1);
  border: none;
  color: var(--text-primary);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.canvas-btn:hover { background: rgba(255,255,255,0.2); }
.canvas-btn.active { background: var(--accent2); }
.canvas-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.canvas-btn.primary {
  background: linear-gradient(135deg, var(--accent2), var(--accent4));
}

.canvas-btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

/* ===== 参数面板 ===== */
.param-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  padding: 1rem;
  background: rgba(0,0,0,0.2);
  border-radius: 12px;
  margin-top: 1rem;
}

.param-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.param-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.param-value {
  font-weight: 600;
  color: var(--accent);
}

.param-slider {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: rgba(255,255,255,0.1);
  outline: none;
  -webkit-appearance: none;
}

.param-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent2);
  cursor: pointer;
  transition: transform 0.2s;
}

.param-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* ===== 公式展示 ===== */
.formula-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1.5rem;
  background: rgba(0,0,0,0.3);
  border-radius: 12px;
  margin-top: 1rem;
  font-size: 1.5rem;
  font-family: 'Times New Roman', serif;
  flex-wrap: wrap;
}

.formula-term {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.formula-term .value {
  font-size: 2rem;
  font-weight: 700;
}

.formula-term .label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.formula-plus, .formula-eq {
  font-size: 2rem;
  color: var(--text-secondary);
}

.formula-term.a .value { color: var(--accent2); }
.formula-term.b .value { color: var(--accent3); }
.formula-term.c .value { color: var(--accent); }
.formula-term.d .value { color: var(--accent5); }

/* ===== 验证状态 ===== */
.verification-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1rem;
  border-radius: 12px;
  margin-top: 1rem;
  font-weight: 600;
  font-size: 1.1rem;
}

.verification-status.valid {
  background: rgba(16, 185, 129, 0.2);
  color: var(--success);
}

.verification-status.invalid {
  background: rgba(239, 68, 68, 0.2);
  color: var(--error);
}

/* ===== 步骤控制条 ===== */
.step-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1rem;
  background: rgba(0,0,0,0.3);
  border-radius: 12px;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.step-btn {
  background: rgba(255,255,255,0.1);
  border: none;
  color: var(--text-primary);
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.step-btn:hover:not(:disabled) { background: rgba(255,255,255,0.2); }
.step-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.step-btn.play-btn {
  background: linear-gradient(135deg, var(--accent2), var(--accent4));
  padding: 0.75rem 2rem;
}

.step-btn.play-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.step-dots {
  display: flex;
  gap: 0.5rem;
}

.step-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  cursor: pointer;
  transition: all 0.2s;
}

.step-dot:hover { background: rgba(255,255,255,0.4); }
.step-dot.active { background: var(--accent2); transform: scale(1.3); }
.step-dot.done { background: var(--success); }

/* ===== 字幕条 ===== */
.subtitle-bar {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(139, 92, 246, 0.2));
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 12px;
  padding: 1rem 1.5rem;
  margin-top: 1rem;
  font-size: 1.1rem;
  line-height: 1.6;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.subtitle-bar.speaking {
  animation: subtitlePulse 1s ease infinite;
}

@keyframes subtitlePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4); }
  50% { box-shadow: 0 0 0 10px rgba(59, 130, 246, 0); }
}

.proof-explanation {
  margin-top: 1rem;
  padding: 1.25rem;
  background: rgba(0,0,0,0.2);
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.06);
}

.proof-explanation h4 {
  font-size: 1.05rem;
  margin-bottom: 0.75rem;
  color: var(--accent);
}

/* ===== 练习题区 ===== */
.practice-container {
  max-width: 800px;
  margin: 0 auto;
}

.practice-progress {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.practice-card {
  background: var(--bg-secondary);
  border-radius: 16px;
  padding: 2rem;
  margin-bottom: 1rem;
}

.practice-question {
  font-size: 1.25rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.practice-options {
  display: grid;
  gap: 0.75rem;
}

.practice-option {
  background: rgba(255,255,255,0.05);
  border: 2px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.practice-option:hover {
  border-color: var(--accent2);
  background: rgba(59, 130, 246, 0.1);
}

.practice-option.selected {
  border-color: var(--accent2);
  background: rgba(59, 130, 246, 0.2);
}

.practice-option.correct {
  border-color: var(--success);
  background: rgba(16, 185, 129, 0.2);
}

.practice-option.wrong {
  border-color: var(--error);
  background: rgba(239, 68, 68, 0.2);
}

.option-letter {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
}

.practice-option.correct .option-letter { background: var(--success); }
.practice-option.wrong .option-letter { background: var(--error); }

.practice-feedback {
  padding: 1rem 1.25rem;
  border-radius: 12px;
  margin-top: 1rem;
  display: none;
}

.practice-feedback.show { display: block; }

.practice-feedback.correct {
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid var(--success);
}

.practice-feedback.wrong {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid var(--error);
}

.practice-hint {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.practice-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.practice-btn {
  flex: 1;
  padding: 1rem;
  border-radius: 12px;
  border: none;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.practice-btn.submit {
  background: linear-gradient(135deg, var(--accent2), var(--accent4));
  color: white;
}

.practice-btn.submit:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.practice-btn.submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.practice-btn.next {
  background: rgba(255,255,255,0.1);
  color: var(--text-primary);
}

.practice-btn.next:hover { background: rgba(255,255,255,0.2); }

/* ===== 练习游戏化 ===== */
.game-header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.game-stat {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 0.6rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  color: var(--text-secondary);
  flex: 1;
  justify-content: center;
  min-width: 120px;
}

.game-stat-icon { font-size: 1.1rem; }
.game-stat b { color: var(--text-primary); }

.level-progress-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.level-progress-bar {
  flex: 1;
  height: 10px;
  background: rgba(255,255,255,0.1);
  border-radius: 5px;
  overflow: hidden;
}

.level-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent2), var(--accent3));
  border-radius: 5px;
  transition: width 0.4s ease;
}

.level-progress-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.badges-panel {
  background: var(--bg-secondary);
  border-radius: 16px;
  padding: 1.25rem;
  margin-top: 1rem;
}

.badges-panel h4 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

.badges-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.badge {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.3s;
}

.badge.earned {
  background: linear-gradient(135deg, rgba(245,158,11,0.2), rgba(245,158,11,0.05));
  border-color: var(--accent);
  color: #fbbf24;
  box-shadow: 0 0 12px rgba(245,158,11,0.2);
  animation: badgePop 0.5s ease-out;
}

@keyframes badgePop {
  0% { transform: scale(0.7); opacity: 0; }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}

.game-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 1rem;
  backdrop-filter: blur(4px);
}

.game-modal-content {
  background: var(--bg-card);
  border-radius: 20px;
  padding: 2rem;
  max-width: 420px;
  width: 100%;
  text-align: center;
  border: 1px solid rgba(255,255,255,0.1);
  animation: modalIn 0.4s ease-out;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.game-modal-icon { font-size: 3.5rem; margin-bottom: 0.5rem; }
.game-modal-content h3 { font-size: 1.4rem; margin-bottom: 0.5rem; }
.game-modal-content p { color: var(--text-secondary); margin-bottom: 1rem; }

.game-modal-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.game-modal-stat {
  background: rgba(0,0,0,0.2);
  border-radius: 12px;
  padding: 0.75rem;
}

.game-modal-stat .value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent);
  display: block;
}

.game-modal-stat .label {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.game-modal-actions {
  display: flex;
  gap: 0.75rem;
}

/* ===== 掌握度面板 ===== */
.mastery-panel {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 1.5rem;
}

.mastery-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.mastery-title {
  font-size: 1.1rem;
  font-weight: 600;
}

.mastery-level {
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.9rem;
}

.mastery-level.beginner { background: rgba(239, 68, 68, 0.2); color: var(--error); }
.mastery-level.learning { background: rgba(245, 158, 11, 0.2); color: var(--warning); }
.mastery-level.proficient { background: rgba(59, 130, 246, 0.2); color: var(--accent2); }
.mastery-level.mastered { background: rgba(16, 185, 129, 0.2); color: var(--success); }

.mastery-bar {
  height: 12px;
  background: rgba(255,255,255,0.1);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.mastery-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--error), var(--warning), var(--accent2), var(--success));
  border-radius: 6px;
  transition: width 0.5s ease;
}

.mastery-stats {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.skill-list {
  margin-top: 1.5rem;
  display: grid;
  gap: 0.75rem;
}

.skill-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: rgba(0,0,0,0.2);
  border-radius: 12px;
}

.skill-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.skill-icon.concept { background: rgba(59, 130, 246, 0.2); }
.skill-icon.calculation { background: rgba(16, 185, 129, 0.2); }
.skill-icon.application { background: rgba(245, 158, 11, 0.2); }
.skill-icon.proof { background: rgba(139, 92, 246, 0.2); }

.skill-info {
  flex: 1;
}

.skill-name {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.skill-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.skill-mastery {
  text-align: right;
}

.skill-percent {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent2);
}

.skill-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* ===== 学习路径 ===== */
.learning-path {
  position: relative;
  padding-left: 2rem;
}

.path-line {
  position: absolute;
  left: 0.75rem;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, var(--success), var(--accent2), var(--accent4));
}

.path-node {
  position: relative;
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: 12px;
  margin-bottom: 1rem;
  margin-left: 1rem;
}

.path-node::before {
  content: '';
  position: absolute;
  left: -1.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--text-secondary);
}

.path-node.completed::before {
  background: var(--success);
  border-color: var(--success);
}

.path-node.current::before {
  background: var(--accent2);
  border-color: var(--accent2);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.3);
}

.path-node.locked::before {
  background: var(--bg-card);
  border-color: rgba(255,255,255,0.2);
}

.path-node.locked {
  opacity: 0.6;
}

.path-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.path-title {
  font-weight: 600;
}

.path-status {
  font-size: 0.8rem;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
}

.path-status.completed { background: rgba(16, 185, 129, 0.2); color: var(--success); }
.path-status.current { background: rgba(59, 130, 246, 0.2); color: var(--accent2); }
.path-status.locked { background: rgba(255,255,255,0.1); color: var(--text-secondary); }

.path-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .module-tabs {
    overflow-x: auto;
    padding-bottom: 0.5rem;
  }
  
  .module-tab {
    white-space: nowrap;
  }
  
  .formula-display {
    font-size: 1.1rem;
  }
  
  .formula-term .value {
    font-size: 1.5rem;
  }

  .step-controls {
    gap: 0.5rem;
  }

  .step-btn {
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
  }
}

/* ===== 工具提示 ===== */
.tooltip {
  position: fixed;
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  pointer-events: none;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.2s;
}

.tooltip.show { opacity: 1; }

/* ===== 苏格拉底对话 ===== */
.socratic-container {
  margin-top: 1rem;
}

.depth-meter {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: rgba(255,255,255,0.03);
  border-radius: 12px;
  flex-wrap: wrap;
}

.depth-dot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  position: relative;
  transition: all 0.3s;
  flex-shrink: 0;
}

.depth-dot .depth-label {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 0.3rem;
  font-size: 0.7rem;
  font-weight: 400;
  white-space: nowrap;
  color: var(--text-secondary);
}

.depth-dot.active {
  background: linear-gradient(135deg, var(--accent), #f97316);
  color: #fff;
  box-shadow: 0 0 20px rgba(245,158,11,0.4);
  transform: scale(1.15);
}

.depth-dot.done {
  background: var(--success);
  color: #fff;
}

.depth-connector {
  width: 40px;
  height: 3px;
  background: rgba(255,255,255,0.1);
  flex-shrink: 0;
  margin-top: -18px;
  transition: background 0.3s;
}

.depth-connector.done {
  background: var(--success);
}

.socrates-chat {
  max-height: 500px;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  background: rgba(0,0,0,0.2);
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.06);
}

.chat-bubble {
  display: flex;
  gap: 0.6rem;
  max-width: 85%;
  animation: bubbleIn 0.4s ease-out;
}

@keyframes bubbleIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-bubble.teacher { align-self: flex-start; }
.chat-bubble.student { align-self: flex-end; flex-direction: row-reverse; }
.chat-bubble.system { align-self: center; max-width: 95%; }

.chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
  background: rgba(255,255,255,0.1);
}

.chat-bubble.teacher .chat-avatar { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.chat-bubble.student .chat-avatar { background: linear-gradient(135deg, #10b981, #059669); }

.chat-content {
  padding: 0.7rem 1rem;
  border-radius: 12px;
  line-height: 1.6;
  font-size: 0.95rem;
}

.chat-bubble.teacher .chat-content {
  background: rgba(59,130,246,0.15);
  border: 1px solid rgba(59,130,246,0.2);
  border-top-left-radius: 4px;
}

.chat-bubble.student .chat-content {
  background: rgba(16,185,129,0.15);
  border: 1px solid rgba(16,185,129,0.2);
  border-top-right-radius: 4px;
}

.chat-bubble.system .chat-content {
  background: rgba(245,158,11,0.1);
  border: 1px solid rgba(245,158,11,0.2);
  border-radius: 8px;
  text-align: center;
  font-size: 0.9rem;
}

.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 4px 0;
}

.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  animation: typingPulse 1.2s infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingPulse {
  0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); }
  30% { opacity: 1; transform: scale(1); }
}

.socrates-visual {
  margin: 0.5rem 0;
  display: flex;
  justify-content: center;
}

.socrates-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.6rem;
}

.socrates-opt-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--text-primary);
  padding: 0.6rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  text-align: left;
  transition: all 0.2s;
}

.socrates-opt-btn:hover:not(:disabled) {
  background: rgba(59,130,246,0.2);
  border-color: var(--accent2);
}

.socrates-opt-btn:disabled { cursor: default; opacity: 0.6; }
.socrates-opt-btn.selected { background: rgba(239,68,68,0.2); border-color: var(--error); }
.socrates-opt-btn.correct { background: rgba(16,185,129,0.25); border-color: var(--success); }

.socrates-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.8rem;
  flex-wrap: wrap;
}

.socrates-action-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--text-primary);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.socrates-action-btn:hover:not(:disabled) {
  background: rgba(59,130,246,0.2);
  border-color: var(--accent2);
}

.socrates-action-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.socrates-action-btn.hint { border-color: rgba(139,92,246,0.3); }
.socrates-action-btn.explain { border-color: rgba(59,130,246,0.3); }
.socrates-action-btn.skip { border-color: rgba(239,68,68,0.3); }

.socrates-hint {
  padding: 0.6rem 1rem;
  background: rgba(139,92,246,0.1);
  border: 1px solid rgba(139,92,246,0.2);
  border-radius: 8px;
  font-size: 0.88rem;
  color: #c4b5fd;
  margin: 0.3rem 0;
  animation: bubbleIn 0.4s ease-out;
}

.socrates-explain {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 0.9rem;
  color: rgba(255,255,255,0.8);
}

.socrates-revelation {
  background: linear-gradient(135deg, rgba(245,158,11,0.15), rgba(239,68,68,0.1));
  border: 1px solid rgba(245,158,11,0.3);
  border-radius: 12px;
  padding: 1.2rem;
  text-align: center;
  margin-top: 0.5rem;
  animation: bubbleIn 0.6s ease-out;
}

.socrates-revelation h4 {
  color: var(--accent);
  font-size: 1.1rem;
  margin-bottom: 0.8rem;
}

.socrates-revelation p {
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text-secondary);
}

.socratic-score {
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.socratic-badge {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.25rem 0.75rem;
  background: rgba(245,158,11,0.2);
  border-radius: 12px;
  color: #fbbf24;
  font-weight: 600;
}

.revelation-steps {
  text-align: left;
  margin: 0.8rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.rev-step {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.8);
  padding: 0.3rem 0;
}

.rev-num {
  color: var(--accent);
  font-weight: 700;
  margin-right: 0.5rem;
}

.rev-final {
  margin-top: 0.8rem;
  padding: 0.8rem;
  background: rgba(0,0,0,0.2);
  border-radius: 8px;
  font-size: 0.9rem;
  color: #fbbf24;
  font-weight: 600;
}

.socrates-reset-btn {
  margin-top: 1rem;
  background: var(--accent2);
  border: none;
  color: #fff;
  padding: 0.6rem 1.5rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.2s;
}

.socrates-reset-btn:hover { background: #2563eb; transform: translateY(-1px); }

/* ===== 知识拓展 ===== */
.ext-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.ext-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 1.2rem;
  cursor: pointer;
  transition: all 0.3s;
}

.ext-card:hover {
  background: rgba(255,255,255,0.08);
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

.ext-card h4 {
  font-size: 1rem;
  margin-bottom: 0.4rem;
  color: var(--text-primary);
}

.ext-preview {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.ext-detail {
  background: rgba(0,0,0,0.2);
  border-radius: 12px;
  padding: 1.5rem;
  margin-top: 1rem;
  border: 1px solid rgba(255,255,255,0.06);
  animation: bubbleIn 0.3s ease-out;
}

.ext-detail h4 {
  font-size: 1.15rem;
  color: var(--accent);
  margin-bottom: 1rem;
}

.ext-detail p {
  font-size: 0.92rem;
  line-height: 1.8;
  color: rgba(255,255,255,0.8);
  margin-bottom: 0.8rem;
}

.ext-back {
  background: rgba(255,255,255,0.1);
  border: none;
  color: var(--text-primary);
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  margin-bottom: 1rem;
  transition: background 0.2s;
}

.ext-back:hover { background: rgba(255,255,255,0.2); }

.ext-grid-mini {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.6rem;
  margin: 0.8rem 0;
}

.ext-mini-card {
  background: rgba(255,255,255,0.05);
  border-radius: 8px;
  padding: 0.6rem;
  text-align: center;
}

.triple-val {
  display: block;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
}

.triple-desc {
  display: line-block;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.2rem;
}

.formula-box {
  background: rgba(59,130,246,0.1);
  border: 1px solid rgba(59,130,246,0.2);
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
  font-family: 'Courier New', monospace;
  font-size: 1.1rem;
  color: #93c5fd;
  margin: 0.8rem 0;
  line-height: 1.8;
}

.compare-box {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1rem 0;
  flex-wrap: wrap;
  justify-content: center;
}

.compare-item {
  background: rgba(255,255,255,0.05);
  border-radius: 8px;
  padding: 0.8rem 1.2rem;
  text-align: center;
  flex: 1;
  min-width: 140px;
}

.compare-item h5 { color: var(--accent3); margin-bottom: 0.3rem; font-size: 0.95rem; }
.compare-item p { font-size: 0.85rem; color: var(--text-secondary); margin: 0; }

.compare-arrow {
  font-size: 1.5rem;
  color: var(--accent);
  font-weight: 700;
}

.example-box {
  background: rgba(16,185,129,0.1);
  border-left: 3px solid var(--success);
  border-radius: 0 8px 8px 0;
  padding: 0.8rem 1rem;
  margin: 0.8rem 0;
  font-size: 0.9rem;
  color: #6ee7b7;
}

.proof-steps {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0.8rem 0;
}

.proof-step {
  background: rgba(255,255,255,0.04);
  border-radius: 6px;
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
  color: rgba(255,255,255,0.8);
  border-left: 3px solid var(--accent4);
}

/* ===== 深入探索标签页 ===== */
.deep-tabs-container {
  margin-top: 1rem;
}

.deep-tab-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  padding-bottom: 0.5rem;
  flex-wrap: wrap;
}

.deep-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.deep-tab-btn:hover { color: var(--text-primary); background: rgba(255,255,255,0.05); }
.deep-tab-btn.active { background: rgba(245,158,11,0.15); color: var(--accent); font-weight: 600; }

.deep-tab-panel {
  display: none;
  animation: bubbleIn 0.3s ease-out;
}

.deep-tab-panel.active { display: block; }

/* 时间线 */
.timeline {
  position: relative;
  padding-left: 2rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--accent), var(--accent2), var(--accent3));
}

.timeline-item {
  position: relative;
  margin-bottom: 1.5rem;
  padding-left: 1rem;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -1.55rem;
  top: 0.3rem;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--bg-card);
  box-shadow: 0 0 10px rgba(245,158,11,0.4);
}

.timeline-date {
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.timeline-body h5 {
  font-size: 0.95rem;
  color: var(--text-primary);
  margin-bottom: 0.3rem;
}

.timeline-body p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* 多种证明卡片 */
.deep-proofs-grid {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.deep-proof-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 1rem 1.2rem;
  transition: all 0.2s;
}

.deep-proof-card.highlight {
  border-color: rgba(245,158,11,0.4);
  background: rgba(245,158,11,0.06);
}

.deep-proof-card h5 {
  font-size: 0.95rem;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
}

.deep-proof-card.highlight h5 { color: var(--accent); }

.deep-proof-card p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* 应用卡片网格 */
.deep-apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.deep-app-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 1.2rem;
  text-align: center;
  transition: all 0.3s;
}

.deep-app-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent2);
  background: rgba(59,130,246,0.08);
}

.app-icon {
  font-size: 2.2rem;
  margin-bottom: 0.5rem;
}

.deep-app-card h5 {
  font-size: 0.95rem;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
}

.deep-app-card p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ===== 顶部学习进度条 ===== */
.progress-track {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding: 1rem;
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
}

.progress-step {
  flex: 1;
  height: 8px;
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  position: relative;
  cursor: pointer;
  transition: all 0.3s;
}

.progress-step.completed { background: var(--success); }
.progress-step.active { background: var(--accent); box-shadow: 0 0 12px rgba(245,158,11,0.4); }

.progress-step-label {
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
  color: var(--text-secondary);
}

.progress-step.active .progress-step-label { color: var(--accent); }
.progress-step.completed .progress-step-label { color: var(--success); }

@media (max-width: 768px) {
  .progress-step-label { font-size: 0.6rem; top: -20px; }
  .progress-track { padding: 0.8rem 0.5rem; }
  .depth-meter { gap: 0; padding: 0.6rem; }
  .depth-connector { width: 20px; }
  .depth-dot { width: 28px; height: 28px; font-size: 0.75rem; }
  .depth-dot .depth-label { display: none; }
  .chat-bubble { max-width: 95%; }
  .ext-cards { grid-template-columns: 1fr; }
  .ext-grid-mini { grid-template-columns: repeat(3, 1fr); }
  .deep-apps-grid { grid-template-columns: 1fr 1fr; }
  .compare-box { flex-direction: column; }
  .compare-arrow { transform: rotate(90deg); }
  .socrates-actions { justify-content: center; }
}

.opt-letter {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}