/* ============================================================
   Phy-Agent 视觉升级版 v3 - 清新明亮 + 物理元素
   ============================================================ */

/* ============ 背景 ============ */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', sans-serif;
  background: #f0f4ff;
  min-height: 100vh;
  overflow: hidden;
  position: relative;
}

.physics-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
}

.physics-particles {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

/* 浮动的物理公式 */
.phy-float {
  position: absolute;
  font-size: 20px;
  opacity: 0;
  animation: phyFloat linear infinite;
  pointer-events: none;
  white-space: nowrap;
  text-shadow: none;
  font-weight: 400;
}

@keyframes phyFloat {
  0%   { opacity: 0; transform: translateY(100vh) rotate(0deg); }
  5%   { opacity: 0.55; }
  90%  { opacity: 0.4; }
  100% { opacity: 0; transform: translateY(-10vh) rotate(360deg); }
}

/* 轨道电子 */
.electron-orbit {
  position: absolute;
  border: 1.5px solid rgba(102, 126, 234, 0.25);
  border-radius: 50%;
  animation: orbitSpin linear infinite;
  pointer-events: none;
}

.electron-orbit::before {
  content: '';
  position: absolute;
  width: 7px; height: 7px;
  background: rgba(102, 126, 234, 0.85);
  border-radius: 50%;
  top: -3.5px; left: 50%;
  transform: translateX(-50%);
  box-shadow: 0 0 10px rgba(102, 126, 234, 0.8);
}

@keyframes orbitSpin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* 极光背景 */
.aurora-bg {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 90% 60% at 10% 20%, rgba(102, 126, 234, 0.12) 0%, transparent 60%),
    radial-gradient(ellipse 70% 50% at 90% 10%, rgba(167, 139, 250, 0.10) 0%, transparent 55%),
    radial-gradient(ellipse 80% 40% at 50% 90%, rgba(118, 75, 162, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse 60% 50% at 80% 80%, rgba(102, 126, 234, 0.07) 0%, transparent 50%);
  animation: auroraShift 15s ease-in-out infinite alternate;
}

@keyframes auroraShift {
  0%   { opacity: 1; }
  50%  { opacity: 0.7; }
  100% { opacity: 1; }
}

/* ============ 主容器 ============ */
body {
  display: flex;
  justify-content: center;
  align-items: center;
}

.chat-container {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 1200px;
  height: 100vh;
  max-height: 100dvh;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(102, 126, 234, 0.15);
}

/* ============ 头部 ============ */
.chat-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  border-bottom: none;
  position: relative;
  overflow: hidden;
}

.chat-header::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg,
    rgba(255,255,255,0) 0%,
    rgba(255,255,255,0.6) 30%,
    rgba(255,255,255,0.6) 70%,
    rgba(255,255,255,0) 100%);
}

.socratic-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}

.socratic-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
}

.socratic-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.socratic-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #ccc;
  transition: 0.3s;
  border-radius: 26px;
}

.socratic-slider::before {
  content: '';
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

.socratic-switch input:checked + .socratic-slider {
  background: linear-gradient(135deg, #667eea, #764ba2);
}

.socratic-switch input:checked + .socratic-slider::before {
  transform: translateX(22px);
}

#socraticLabel {
  font-size: 13px;
  color: rgba(255,255,255,0.85);
  font-weight: 500;
  white-space: nowrap;
}

.avatar {
  width: 40px; height: 40px;
  background: rgba(255,255,255,0.25);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.4);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  animation: none;
}

.info h1 {
  font-size: 16px;
  font-weight: 700;
  color: white;
  -webkit-text-fill-color: white;
  animation: none;
  background: none;
}
.info p {
  font-size: 11px;
  opacity: 0.9;
  color: rgba(255,255,255,0.9);
}

/* ============ 年级选择器 ============ */
.grade-btn {
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.35);
  color: rgba(255,255,255,0.95);
  padding: 5px 10px;
  border-radius: 14px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.3s;
}
.grade-btn.active {
  background: white;
  color: #667eea;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.grade-btn:hover:not(.active) {
  background: rgba(255,255,255,0.35);
  border-color: rgba(255,255,255,0.5);
}

/* ============ 标签页 ============ */
.chat-tabs {
  display: flex;
  background: #f8f9ff;
  border-bottom: 2px solid rgba(102, 126, 234, 0.1);
  flex-shrink: 0;
}
.tab-btn {
  flex: 1;
  padding: 10px;
  background: none;
  border: none;
  font-size: 13px;
  color: #999;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.3s;
  margin-bottom: -2px;
}
.tab-btn.active {
  color: #667eea;
  border-bottom-color: #667eea;
  background: white;
  font-weight: 600;
}
.tab-btn:hover:not(.active) {
  color: #667eea;
  background: rgba(102, 126, 234, 0.04);
}

.tab-content {
  display: none;
  flex: 1;
  overflow: hidden;
}
.tab-content.active {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

/* ============ 聊天消息区 ============ */
.chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  -webkit-overflow-scrolling: touch;
  background: #fafbff;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: rgba(102, 126, 234, 0.2); border-radius: 2px; }

.message {
  max-width: 88%;
  padding: 14px 18px;
  border-radius: 18px;
  font-size: 16px;
  line-height: 1.7;
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: pre-wrap;
  animation: msgIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.message.bot {
  background: white;
  color: #333;
  align-self: flex-start;
  border-bottom-left-radius: 6px;
  border: 1px solid rgba(102, 126, 234, 0.15);
  box-shadow: 0 2px 12px rgba(102, 126, 234, 0.08);
}
.message.bot::before {
  content: '';
  display: inline-block;
  width: 8px; height: 8px;
  background: #667eea;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
  box-shadow: 0 0 6px rgba(102, 126, 234, 0.6);
  animation: onlinePulse 2s ease-in-out infinite;
}
@keyframes onlinePulse {
  0%, 100% { box-shadow: 0 0 4px rgba(102,126,234,0.5); }
  50%       { box-shadow: 0 0 10px rgba(102,126,234,0.9), 0 0 4px rgba(102,126,234,0.5); }
}

.message.user {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 6px;
  box-shadow: 0 4px 16px rgba(102, 126, 234, 0.35);
}

/* 打字指示器 */
.typing-indicator .dot { background: rgba(102, 126, 234, 0.6); }
@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30%           { transform: translateY(-6px); opacity: 1; }
}

.msg-time { color: #bbb; }
.message.bot .msg-time { color: #bbb; }

/* ============ 欢迎语气泡 ============ */
.message.bot:first-child {
  background: linear-gradient(135deg, rgba(102,126,234,0.08) 0%, rgba(118,75,162,0.06) 100%);
  border: 1px solid rgba(102, 126, 234, 0.2);
  box-shadow: 0 4px 20px rgba(102, 126, 234, 0.1);
}

/* ============ 公式工具栏 ============ */
.formula-toolbar {
  padding: 6px 12px;
  background: white;
  border-top: 1px solid rgba(102, 126, 234, 0.1);
  flex-shrink: 0;
  display: none;  /* 默认隐藏，由 JS 控制显示 */
}
.formula-toolbar.visible { display: block; }
.formula-select {
  background: #f5f5f5;
  border: 1px solid #ddd;
  color: #555;
  border-radius: 8px;
  font-size: 13px;
  padding: 5px 10px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath fill='%23999' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
  width: 100%;
  outline: none;
}
.formula-select:focus { border-color: #667eea; background-color: #fff; }
.toolbar-toggle-btn {
  background: #f0f0f0;
  border: 1px solid #ddd;
  color: #666;
  border-radius: 8px;
  font-size: 14px;
  padding: 7px 12px;
}
.toolbar-toggle-btn:hover, .toolbar-toggle-btn.active {
  background: #667eea;
  color: white;
  border-color: #667eea;
}

/* ============ 数学键盘（折叠）============ */
.math-keyboard { display: none; }

/* ============ 快捷问题 ============ */
.quick-section {
  padding: 6px 12px;
  background: white;
  border-top: 1px solid rgba(102, 126, 234, 0.1);
  flex-shrink: 0;
}
.quick-label { font-size: 11px; color: #bbb; margin-bottom: 4px; font-weight: 500; letter-spacing: 0.5px; }
.quick-row   { display: flex; flex-wrap: wrap; gap: 4px; }
.quick-btn {
  background: linear-gradient(135deg, rgba(102,126,234,0.1) 0%, rgba(118,75,162,0.08) 100%);
  border: 1.5px solid rgba(102, 126, 234, 0.2);
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.3s;
  color: #667eea;
  font-weight: 500;
  line-height: 1.4;
}
.quick-btn:hover {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(102, 126, 234, 0.4);
  transform: translateY(-2px);
}
.quick-btn:active { transform: scale(0.95); }

/* ============ 输入区 ============ */
.chat-input-area {
  padding: 8px 12px;
  border-top: 1px solid rgba(102, 126, 234, 0.1);
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
  background: white;
}
.chat-input {
  flex: 1;
  border: 2px solid rgba(102, 126, 234, 0.2);
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 16px;
  outline: none;
  min-height: 44px;
  background: #f8f9ff;
  color: #333;
  transition: border-color 0.3s, background 0.3s;
}
.chat-input:focus {
  border-color: #667eea;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}
.chat-input::placeholder { color: #bbb; }

.chat-send {
  background: linear-gradient(135deg, #667eea, #764ba2);
  border: none;
  color: white;
  width: 44px; height: 44px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(102, 126, 234, 0.4);
  transition: all 0.3s;
}
.chat-send:hover {
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
  transform: scale(1.05);
}
.chat-send:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.chat-send:active { transform: scale(0.92); }

.chat-img-btn {
  background: rgba(102, 126, 234, 0.08);
  border: 1.5px solid rgba(102, 126, 234, 0.2);
  color: #667eea;
  width: 38px; height: 38px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.3s;
}
.chat-img-btn:hover { background: rgba(102, 126, 234, 0.15); border-color: rgba(102, 126, 234, 0.35); }

/* ============ 图片预览 ============ */
.image-preview-bar { background: white; }
.image-preview-item img { border: 2px solid rgba(102, 126, 234, 0.2); }
.image-remove-btn  { background: rgba(239, 68, 68, 0.85); }

/* ============ 状态栏 ============ */
.status-bar { background: #f8f9ff; font-size: 11px; color: #bbb; }
.connected    { color: #667eea; }
.disconnected { color: #e53935; }

/* ============ 答疑回复公式样式 ============ */
.qa-text-line {
  font-size: 14px;
  color: #333;
  line-height: 1.7;
  margin-bottom: 4px;
}
.qa-formula-item {
  background: white;
  border: 1px solid #eee;
  border-radius: 10px;
  padding: 12px 14px;
  margin: 8px 0;
  box-shadow: 0 1px 4px rgba(102,126,234,0.08);
  border-left: 3px solid #667eea;
}
.qa-formula-name {
  font-size: 12px;
  color: #667eea;
  font-weight: 600;
  margin-bottom: 4px;
}
.qa-formula-expr {
  font-size: 18px;
  font-weight: 700;
  color: #222;
  margin-bottom: 4px;
  background: #f8f9ff;
  padding: 6px 10px;
  border-radius: 8px;
  text-align: center;
  letter-spacing: 1px;
}
.qa-formula-line {
  font-size: 12px;
  color: #888;
  font-style: italic;
}

/* LaTeX 渲染样式 */
.latex-frac {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  font-size: 1.1em;
}
.latex-num {
  border-bottom: 2px solid #667eea;
  padding: 0 4px 2px;
  display: block;
  text-align: center;
}
.latex-bar {
  margin: 0 2px;
  color: #667eea;
  font-weight: bold;
}
.latex-den {
  border-top: 2px solid #667eea;
  padding: 2px 4px 0;
  display: block;
  text-align: center;
}
sub, sup {
  font-size: 0.75em;
  vertical-align: baseline;
  position: relative;
  top: -0.4em;
}
sub { top: 0.2em; }
.latex-inline {
  padding: 2px 6px;
  background: #f0f0ff;
  border-radius: 4px;
  font-size: 0.95em;
}


/* ============ 公式Tab ============ */
.formula-search-wrap {
  padding: 12px 16px 8px;
  border-bottom: 1px solid #eee;
  flex-shrink: 0;
}
.formula-search {
  width: 100%;
  padding: 10px 16px;
  border: 2px solid #e8e8e8;
  border-radius: 20px;
  font-size: 14px;
  outline: none;
  background: #fafafa;
  box-sizing: border-box;
  color: #333;
}
.formula-search:focus { border-color: #667eea; background: #fff; box-shadow: 0 0 0 3px rgba(102,126,234,0.1); }
.formula-search::placeholder { color: #bbb; }

.formula-section {
  padding: 12px;
  overflow-y: auto;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}
.formula-category {
  margin-bottom: 18px;
}
.formula-category-title {
  font-size: 13px;
  font-weight: 700;
  color: white;
  margin-bottom: 10px;
  padding: 6px 14px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.cat-title-text { color: white; }
.cat-title-count {
  background: rgba(255,255,255,0.25);
  color: white;
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 10px;
  font-weight: 600;
}
.formula-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.formula-item {
  background: white;
  border: 1px solid #eee;
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 1px 4px rgba(102,126,234,0.08);
  transition: all 0.2s;
  border-left: 4px solid #667eea;
}
.formula-item:hover {
  box-shadow: 0 4px 16px rgba(102,126,234,0.14);
}
.formula-name {
  font-size: 15px;
  color: #667eea;
  font-weight: 700;
  margin-bottom: 8px;
}
.formula-expression {
  font-size: 22px;
  font-weight: 800;
  color: #222;
  margin-bottom: 12px;
  line-height: 1.3;
  background: #f8f9ff;
  padding: 10px 14px;
  border-radius: 10px;
  text-align: center;
  letter-spacing: 1px;
}
.formula-expression sub {
  font-size: 14px;
  vertical-align: sub;
  color: #764ba2;
  font-weight: 700;
}
.formula-usage {
  font-size: 13px;
  color: #555;
  line-height: 1.7;
  margin-bottom: 10px;
  padding: 10px 12px;
  background: #fff;
  border-radius: 8px;
  border: 1px solid #f0f0f0;
}
.formula-usage-label {
  font-size: 11px;
  font-weight: 700;
  color: #764ba2;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.formula-symbols {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed #eee;
}
.symbol-tag {
  font-size: 12px;
  color: #444;
  background: #f0f4ff;
  padding: 4px 10px;
  border-radius: 8px;
  white-space: nowrap;
  cursor: default;
}
.symbol-key {
  font-weight: 700;
  color: #667eea;
  font-size: 13px;
}
.symbol-key sub {
  font-size: 10px;
}
.sym-unit {
  color: #764ba2;
  font-weight: 600;
}
.formula-condition {
  font-size: 12px;
  color: #888;
  margin-top: 8px;
  padding: 6px 10px;
  background: #fafafa;
  border-radius: 6px;
  display: inline-block;
}

.physical-category-name { color: #333; border-left-color: #764ba2; }
.physical-table th { background: linear-gradient(135deg, #667eea, #764ba2); }
.physical-table td { color: #555; background: white; border-bottom-color: rgba(102,126,234,0.08); }
.physical-table tr:hover { background: rgba(102,126,234,0.04) !important; }

/* ============ 章节Tab ============ */
.topic-grid { background: transparent; }
.topic-card {
  background: white;
  border: 1px solid rgba(102,126,234,0.12);
  box-shadow: 0 1px 4px rgba(102,126,234,0.06);
}
.topic-card:hover {
  background: linear-gradient(135deg, rgba(102,126,234,0.08), rgba(118,75,162,0.06));
  border-color: rgba(102,126,234,0.3);
  color: #667eea;
  box-shadow: 0 4px 14px rgba(102,126,234,0.12);
  transform: translateY(-2px);
}
.topic-points { background: #f8f9ff; color: #555; }
.point-item:hover { color: #667eea; }

.grade-tabs { background: #f0f4ff; }
.grade-tab {
  background: white;
  border: 2px solid rgba(102,126,234,0.15);
  color: #667eea;
}
.grade-tab.active {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border-color: transparent;
}
.grade-title { background: linear-gradient(135deg, #667eea, #764ba2); }
.chapter-card { background: white; border-color: rgba(102,126,234,0.12); }
.chapter-title { color: #333; }
.chapter-points { background: #f8f9ff; border-top-color: rgba(102,126,234,0.08); }
.point-item { color: #555; border-bottom-color: rgba(102,126,234,0.06); }
.point-item:hover { color: #667eea; }

/* ============ 学习Tab ============ */
.study-container { background: #f0f4ff; }
.study-section { background: white; border: 1px solid rgba(102,126,234,0.1); box-shadow: none; }
.study-section-title { color: #333; }
.tasks-count { background: rgba(102,126,234,0.1); color: #667eea; }
.study-card { background: #f8f9ff; border-color: rgba(102,126,234,0.1); }
.study-stat-num {
  background: linear-gradient(135deg, #667eea, #764ba2);
  -webkit-background-clip: text;
  background-clip: text;
}
.study-stat-label { color: #999; }
.study-progress { background: rgba(102,126,234,0.1); }
.study-progress-fill { background: linear-gradient(90deg, #667eea, #764ba2); }

.study-hero {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  box-shadow: 0 4px 20px rgba(102,126,234,0.35);
}
.study-hero-greeting { color: white; }
.study-hero-streak, .study-hero-points, .study-hero-week { color: rgba(255,255,255,0.85); }
.study-ring-label { color: rgba(255,255,255,0.7); }
#ringNum, .study-ring-num { color: white; }

.reminder-switch input:checked + .reminder-slider {
  background: linear-gradient(135deg, #667eea, #764ba2);
}
.reminder-desc { color: #999; }

.task-card { background: #f8f9ff; border-color: rgba(102,126,234,0.1); }
.task-card.task-done { background: rgba(34,197,94,0.06); border-color: rgba(34,197,94,0.2); }
.task-name { color: #333; }
.task-done .task-name { color: #999; }
.task-progress { color: #999; }
.task-mini-progress { background: rgba(102,126,234,0.1); }
.task-mini-bar { background: linear-gradient(90deg, #667eea, #764ba2); }
.task-badge { color: #999; }
.task-btn { background: linear-gradient(135deg, #667eea, #764ba2); }

.badge-item { background: #f8f9ff; border-color: rgba(102,126,234,0.1); }
.badge-item.badge-earned { background: rgba(102,126,234,0.08); border-color: rgba(102,126,234,0.25); }
.badge-item.badge-locked { opacity: 0.45; }
.badge-name { color: #333; }
.badge-date { color: #bbb; }

.points-display { background: #f8f9ff; border-color: rgba(102,126,234,0.1); }
.points-desc { color: #999; }

.report-textarea { background: #f8f9ff; border-color: rgba(102,126,234,0.2); color: #333; }
.report-textarea::placeholder { color: #bbb; }

/* ============ 空状态 ============ */
.empty-state { color: #bbb; }
.empty-state .title { color: #666; }

/* ============ 内容样式 ============ */
.message strong { color: #333; }
.message em     { color: #764ba2; }
.message code   { background: rgba(102,126,234,0.1); color: #667eea; border-radius: 4px; }

/* ============ 进度条 ============ */
.progress-section { background: #f8f9ff; border-bottom-color: rgba(102,126,234,0.1); }
.progress-title   { color: #888; }
.progress-bar     { background: rgba(102,126,234,0.1); }
.progress-fill    { background: linear-gradient(90deg, #667eea, #764ba2); }
.progress-stats    { color: #bbb; }

/* ============ 桌面端 ============ */
@media (min-width: 600px) {
  .chat-container {
    height: 90vh;
    max-height: 850px;
    border-radius: 24px;
    box-shadow: 0 8px 40px rgba(102,126,234,0.18), 0 0 0 1px rgba(102,126,234,0.1);
    margin: 20px;
  }
}

/* ============ 公式检测 Quiz ============ */
.quiz-container {
  padding: 16px;
  max-height: calc(100vh - 180px);
  overflow-y: auto;
}

/* ---- 欢迎页 ---- */
.quiz-welcome {
  text-align: center;
  padding: 32px 16px;
}
.quiz-welcome-icon { font-size: 64px; margin-bottom: 8px; }
.quiz-welcome h2 { margin: 0 0 8px; font-size: 22px; color: #333; }
.quiz-desc { color: #888; font-size: 14px; margin: 0 0 24px; }

.quiz-filters {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.quiz-filter-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
}
.quiz-filter-item label { font-size: 12px; color: #888; font-weight: bold; }
.quiz-filter-item select {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #ddd;
  font-size: 13px;
  background: #fff;
  min-width: 130px;
}

.quiz-stats-row {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 28px;
}
.quiz-stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.quiz-stat-item .qi { font-size: 24px; font-weight: bold; color: #667eea; }
.quiz-stat-item .ql { font-size: 11px; color: #aaa; margin-top: 2px; }

.quiz-start-btn {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  border: none;
  padding: 14px 40px;
  border-radius: 30px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(102,126,234,0.35);
  transition: transform 0.15s;
}
.quiz-start-btn:hover { transform: scale(1.05); }

/* ---- 进度条 ---- */
.quiz-progress { margin-bottom: 16px; }
.quiz-progress-bar {
  height: 6px;
  background: rgba(102,126,234,0.12);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 4px;
}
.quiz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #667eea, #764ba2);
  border-radius: 3px;
  transition: width 0.4s ease;
}
.quiz-progress-text { font-size: 12px; color: #aaa; text-align: right; }

/* ---- 题目卡片 ---- */
.quiz-card {
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  margin-bottom: 12px;
}
.quiz-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
.quiz-type-badge {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  color: #fff;
  font-weight: bold;
}
.quiz-category { font-size: 12px; color: #aaa; }

.quiz-question {
  font-size: 15px;
  color: #333;
  line-height: 1.7;
  margin-bottom: 16px;
  font-weight: 500;
}

/* ---- 填空题 ---- */
.quiz-fill-area { display: flex; flex-direction: column; gap: 10px; }
.quiz-fill-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1.5px solid #ddd;
  font-size: 14px;
  box-sizing: border-box;
  transition: border-color 0.2s;
  font-family: inherit;
}
.quiz-fill-input:focus { border-color: #667eea; outline: none; }
.quiz-textarea { resize: vertical; min-height: 80px; }

.quiz-submit-btn {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  border: none;
  padding: 11px 28px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  align-self: flex-start;
  box-shadow: 0 3px 10px rgba(102,126,234,0.3);
}

/* ---- 选择题 ---- */
.quiz-choices { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.quiz-choice-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1.5px solid #e8e8e8;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 14px;
  color: #333;
}
.quiz-choice-item:hover { border-color: #667eea; background: rgba(102,126,234,0.04); }
.quiz-choice-item.selected { border-color: #667eea; background: rgba(102,126,234,0.08); }
.quiz-choice-item.correct { border-color: #10b981; background: rgba(16,185,129,0.08); }
.quiz-choice-item.wrong { border-color: #ef4444; background: rgba(239,68,68,0.06); }
.quiz-choice-radio {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #ddd;
  flex-shrink: 0;
  transition: all 0.15s;
}
.quiz-choice-item.selected .quiz-choice-radio {
  border-color: #667eea;
  background: #667eea;
  box-shadow: inset 0 0 0 3px #fff;
}

/* ---- 情境题提示 ---- */
.quiz-hint {
  background: #fffbeb;
  border-left: 3px solid #f59e0b;
  padding: 10px 14px;
  border-radius: 0 8px 8px 0;
  font-size: 13px;
  color: #92400e;
  margin-bottom: 12px;
  line-height: 1.6;
}

/* ---- 反馈 ---- */
.quiz-feedback {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  font-size: 14px;
  line-height: 1.7;
}
.feedback-correct { color: #10b981; font-weight: bold; margin-bottom: 6px; }
.feedback-wrong { color: #ef4444; font-weight: bold; margin-bottom: 6px; }
.feedback-answer { color: #333; margin-top: 4px; }
.feedback-explanation { color: #555; margin-top: 8px; padding-top: 8px; border-top: 1px solid #eee; }
.feedback-ref { color: #888; font-size: 12px; margin-top: 6px; }

/* ---- 下一题按钮 ---- */
.quiz-next-btn-wrap { text-align: center; margin-bottom: 12px; }
.quiz-next-btn {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  border: none;
  padding: 12px 36px;
  border-radius: 24px;
  font-size: 15px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(102,126,234,0.3);
}

/* ---- 结果页 ---- */
.quiz-result { text-align: center; padding: 32px 16px; }
.quiz-result-icon { font-size: 72px; margin-bottom: 8px; }
.quiz-result h2 { margin: 0 0 16px; font-size: 22px; color: #333; }
.quiz-score-big { font-size: 48px; font-weight: bold; color: #667eea; }
.quiz-score-pct { font-size: 18px; color: #888; margin-bottom: 24px; }
.quiz-all-correct { color: #10b981; font-size: 16px; margin-bottom: 24px; font-weight: bold; }

.quiz-wrong-title { text-align: left; font-size: 15px; font-weight: bold; color: #333; margin-bottom: 12px; }
.quiz-wrong-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.quiz-wrong-item {
  display: flex;
  gap: 10px;
  background: #fff;
  border-radius: 10px;
  padding: 12px;
  text-align: left;
  box-shadow: 0 1px 6px rgba(0,0,0,0.05);
}
.quiz-wrong-item .qw-num {
  width: 22px;
  height: 22px;
  background: #ef4444;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: bold;
  flex-shrink: 0;
}
.quiz-wrong-item .qw-type { font-size: 11px; color: #aaa; margin-bottom: 4px; }
.quiz-wrong-item .qw-q { font-size: 13px; color: #333; line-height: 1.5; margin-bottom: 4px; }
.quiz-wrong-item .qw-a { font-size: 12px; color: #10b981; }

.quiz-back-btn {
  background: #f3f4f6;
  color: #666;
  border: none;
  padding: 11px 28px;
  border-radius: 20px;
  font-size: 14px;
  cursor: pointer;
  margin-left: 10px;
}

/* ============ 填空横线样式 ============ */
.quiz-blanks-area {
  display: inline;
  line-height: 2.4;
}
.qb-text { font-size: 15px; color: #333; vertical-align: middle; }

.qb-blank-wrap {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  vertical-align: middle;
  margin: 0 2px;
}

.quiz-blank-input {
  display: inline-block;
  border: none;
  border-bottom: 2px solid #667eea;
  background: transparent;
  padding: 2px 4px;
  font-size: 14px;
  color: #333;
  text-align: center;
  outline: none;
  transition: border-color 0.2s;
  border-radius: 0;
  vertical-align: bottom;
  min-width: 3em;
}
.quiz-blank-input:focus {
  border-bottom-color: #764ba2;
  background: rgba(102,126,234,0.06);
  border-radius: 4px 4px 0 0;
}
.quiz-blank-input.blank-correct {
  border-bottom-color: #10b981;
  color: #10b981;
  background: rgba(16,185,129,0.06);
  border-radius: 4px 4px 0 0;
}
.quiz-blank-input.blank-wrong {
  border-bottom-color: #ef4444;
  color: #ef4444;
  background: rgba(239,68,68,0.06);
  border-radius: 4px 4px 0 0;
}
.quiz-blank-input:disabled {
  cursor: default;
}

.qb-correct-hint {
  font-size: 12px;
  color: #10b981;
  margin-left: 2px;
  vertical-align: middle;
}

.quiz-submit-row {
  margin-top: 14px;
}
