/* ========== 全局重置与基础 ========== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-primary: #e8e8e8;
  --bg-sidebar: #d4d4d4;
  --bg-card: #ffffff;
  --bg-input: #f5f5f5;
  --bg-hover: #e0e0e0;
  --bg-active: #cccccc;
  --text-primary: #2c2c2c;
  --text-secondary: #666666;
  --text-muted: #999999;
  --accent: #4a90d9;
  --accent-hover: #357abd;
  --accent-light: #e8f0fe;
  --border: #d0d0d0;
  --border-light: #e5e5e5;
  --success: #52c41a;
  --warning: #faad14;
  --error: #ff4d4f;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 4px 24px rgba(0, 0, 0, 0.12);
  --transition: 0.2s ease;
  --sidebar-width: 240px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", "Helvetica Neue", sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

/* ========== 布局 ========== */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* ========== 侧边栏 ========== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-header {
  padding: 20px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-header .logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-header .logo-icon {
  font-size: 28px;
}

.sidebar-header .subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 2px;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent);
  color: #ffffff;
}

.nav-item .nav-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
}

/* 侧边栏底部设置区 */
.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.grade-selector {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.grade-selector label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.grade-selector select {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-input);
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition);
}

.grade-selector select:focus {
  border-color: var(--accent);
}

.api-key-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.api-key-section label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.api-key-input-wrap {
  display: flex;
  gap: 6px;
}

.api-key-input-wrap input {
  flex: 1;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-input);
  font-size: 12px;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition);
}

.api-key-input-wrap input:focus {
  border-color: var(--accent);
}

.api-key-input-wrap button {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--accent);
  color: white;
  font-size: 12px;
  cursor: pointer;
  transition: background var(--transition);
  white-space: nowrap;
}

.api-key-input-wrap button:hover {
  background: var(--accent-hover);
}

/* ========== AI 个性化设置 ========== */
.ai-settings-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  margin-top: 4px;
}

.ai-settings-section .section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ai-name-row {
  display: flex;
  gap: 6px;
}

.ai-name-row input {
  flex: 1;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-input);
  font-size: 12px;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition);
}

.ai-name-row input:focus {
  border-color: var(--accent);
}

.ai-name-row button {
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--accent);
  color: white;
  font-size: 11px;
  cursor: pointer;
  transition: background var(--transition);
  white-space: nowrap;
}

.ai-name-row button:hover {
  background: var(--accent-hover);
}

.ai-avatar-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-avatar-preview {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  flex-shrink: 0;
  background: var(--bg-input);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  overflow: hidden;
}

.ai-avatar-row .btn-sm {
  font-size: 11px;
  padding: 5px 10px;
}

.ai-avatar-row .btn-reset {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11px;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}

.ai-avatar-row .btn-reset:hover {
  border-color: var(--error);
  color: var(--error);
}

.voice-selector {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.voice-selector label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

.voice-selector select {
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-input);
  font-size: 12px;
  color: var(--text-primary);
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition);
}

.voice-selector select:focus {
  border-color: var(--accent);
}

/* ========== TTS 语音按钮 ========== */
.speak-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border-light);
  background: var(--bg-card);
  cursor: pointer;
  font-size: 13px;
  transition: all var(--transition);
  flex-shrink: 0;
  opacity: 0;
  margin-top: 4px;
}

.message:hover .speak-btn {
  opacity: 1;
}

.speak-btn:hover {
  background: var(--accent-light);
  border-color: var(--accent);
}

.speak-btn.speaking {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  animation: pulse 0.8s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

.message-bubble-wrapper {
  display: flex;
  flex-direction: column;
}

.message-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}

/* 消息头部（AI名称） */
.message-sender-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 2px;
  padding-left: 4px;
}

.message.user .message-sender-name {
  text-align: right;
  padding-right: 4px;
  padding-left: 0;
}

/* ========== 主内容区 ========== */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 24px;
  min-height: 100vh;
}

.panel {
  display: none;
  animation: fadeIn 0.3s ease;
}

.panel.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.panel-header {
  margin-bottom: 20px;
}

.panel-header h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-header .panel-desc {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ========== 卡片 ========== */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}

/* ========== 聊天面板 ========== */
.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 180px);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.message {
  display: flex;
  gap: 12px;
  animation: fadeIn 0.3s ease;
}

.message.user {
  flex-direction: row-reverse;
}

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.message.user .message-avatar {
  background: var(--accent-light);
}

.message.assistant .message-avatar {
  background: #e6f7e6;
}

.message-bubble {
  max-width: 75%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.7;
  word-break: break-word;
}

.message.user .message-bubble {
  background: var(--accent);
  color: white;
  border-bottom-right-radius: 4px;
}

.message.assistant .message-bubble {
  background: var(--bg-input);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

.message-bubble p { margin-bottom: 8px; }
.message-bubble p:last-child { margin-bottom: 0; }
.message-bubble ul, .message-bubble ol { margin: 8px 0; padding-left: 20px; }
.message-bubble li { margin-bottom: 4px; }
.message-bubble code {
  background: rgba(0,0,0,0.08);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
}
.message-bubble pre {
  background: #1e1e1e;
  color: #d4d4d4;
  padding: 12px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 8px 0;
  font-size: 13px;
}
.message-bubble pre code {
  background: none;
  padding: 0;
  color: inherit;
}

.chat-input-area {
  display: flex;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
}

.chat-input-area textarea {
  flex: 1;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-input);
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
  resize: none;
  min-height: 46px;
  max-height: 120px;
  font-family: inherit;
  transition: border-color var(--transition);
}

.chat-input-area textarea:focus {
  border-color: var(--accent);
}

.btn {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-primary:disabled {
  background: #b0c4de;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--bg-active);
}

.btn-danger {
  background: var(--error);
  color: white;
}

.btn-danger:hover {
  background: #e04040;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-primary);
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(74, 144, 226, 0.06);
}

.btn-outline.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(74, 144, 226, 0.1);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 12px;
}

.btn-xs {
  padding: 3px 8px;
  font-size: 11px;
  border-radius: 4px;
}

/* ========== 教材学习面板 ========== */
.textbook-form {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.textbook-form input {
  flex: 1;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-input);
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition);
}

.textbook-form input:focus {
  border-color: var(--accent);
}

.textbook-result {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.result-section h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--accent);
}

.result-section .content {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-primary);
}

.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px;
  color: var(--text-muted);
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border-light);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ========== 拍照解题 ========== */
.photo-upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg-input);
  margin-bottom: 16px;
}

.photo-upload-area:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.photo-upload-area.has-image {
  padding: 12px;
}

.photo-upload-area .upload-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.photo-upload-area .upload-text {
  font-size: 16px;
  font-weight: 600;
}

.photo-upload-area .upload-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.photo-upload-area img {
  max-height: 300px;
  border-radius: var(--radius-sm);
}

/* ========== 错题本 ========== */
.error-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.error-item {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  border-left: 4px solid var(--error);
}

.error-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.error-item-header .subject-tag {
  font-size: 12px;
  padding: 2px 10px;
  border-radius: 12px;
  background: #fff2f0;
  color: var(--error);
  font-weight: 600;
}

.error-item-header .date {
  font-size: 12px;
  color: var(--text-muted);
}

.error-item .question {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
}

.error-item .answer-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 13px;
}

.error-item .wrong-answer {
  color: var(--error);
}

.error-item .right-answer {
  color: var(--success);
}

.error-item .analysis {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-light);
}

.error-item img {
  max-width: 200px;
  border-radius: var(--radius-sm);
  margin: 8px 0;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 64px;
  margin-bottom: 16px;
}

.empty-state .empty-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-state .empty-desc {
  font-size: 14px;
}

/* ========== 历史记录 ========== */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.history-item:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}

.history-item .history-info {
  flex: 1;
}

.history-item .history-type {
  font-size: 12px;
  padding: 2px 10px;
  border-radius: 12px;
  font-weight: 600;
  display: inline-block;
  margin-bottom: 4px;
}

.history-type.chat { background: #e8f0fe; color: var(--accent); }
.history-type.textbook { background: #e6f7e6; color: var(--success); }
.history-type.photo { background: #fff7e6; color: var(--warning); }

.history-item .history-preview {
  font-size: 14px;
  color: var(--text-primary);
}

.history-item .history-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.history-item .history-actions {
  display: flex;
  gap: 6px;
}

/* ========== Toast 提示 ========== */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  color: white;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
  max-width: 360px;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--error); }
.toast.info { background: var(--accent); }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(100px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ========== 滚动条 ========== */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #c0c0c0;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a0a0a0;
}

/* ========== 语音开关 ========== */
.voice-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.voice-toggle-row .toggle-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

.toggle-switch {
  position: relative;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #ccc;
  border-radius: 22px;
  transition: var(--transition);
}

.toggle-slider::before {
  content: "";
  position: absolute;
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: var(--transition);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--accent);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(18px);
}

/* ========== 问答闯关面板 ========== */
.quiz-top-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.quiz-stat-card {
  flex: 1;
  min-width: 120px;
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  text-align: center;
}

.quiz-stat-card .stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
}

.quiz-stat-card .stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.quiz-stat-card.level .stat-value { color: #e8a838; }
.quiz-stat-card.correct .stat-value { color: var(--success); }
.quiz-stat-card.wrong .stat-value { color: var(--error); }

.quiz-progress-wrap {
  margin-bottom: 20px;
}

.quiz-progress-bar {
  width: 100%;
  height: 10px;
  background: var(--bg-input);
  border-radius: 5px;
  overflow: hidden;
  margin-top: 6px;
}

.quiz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #6cb8ff);
  border-radius: 5px;
  transition: width 0.5s ease;
}

.quiz-progress-text {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

.quiz-question-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 16px;
  border-left: 4px solid var(--accent);
}

.quiz-question-card .question-meta {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.quiz-badge {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 12px;
  font-weight: 600;
}

.quiz-badge.difficulty { background: #fff7e6; color: var(--warning); }
.quiz-badge.subject { background: #e8f0fe; color: var(--accent); }
.quiz-badge.number { background: #e6f7e6; color: var(--success); }

.quiz-question-card .question-text {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.8;
  margin-bottom: 20px;
  color: var(--text-primary);
}

.quiz-answer-area {
  display: flex;
  gap: 10px;
}

.quiz-answer-area input {
  flex: 1;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-input);
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition);
}

.quiz-answer-area input:focus {
  border-color: var(--accent);
}

/* 选择题选项 */
.quiz-choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.quiz-choice-btn {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
  font-size: 14px;
  line-height: 1.6;
}

.quiz-choice-btn:hover:not(:disabled) {
  border-color: var(--accent);
  background: rgba(74, 144, 226, 0.06);
  transform: translateX(4px);
}

.quiz-choice-btn:disabled {
  cursor: default;
  opacity: 0.85;
}

.quiz-choice-btn .choice-letter {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  margin-top: 1px;
}

.quiz-choice-btn .choice-text {
  flex: 1;
  color: var(--text-primary);
}

.quiz-choice-btn.correct-choice {
  border-color: #52c41a;
  background: #f6ffed;
}

.quiz-choice-btn.correct-choice .choice-letter {
  background: #52c41a;
}

.quiz-choice-btn.wrong-choice {
  border-color: #ff4d4f;
  background: #fff2f0;
}

.quiz-choice-btn.wrong-choice .choice-letter {
  background: #ff4d4f;
}

.quiz-result {
  padding: 16px;
  border-radius: var(--radius-sm);
  margin-top: 12px;
  animation: fadeIn 0.3s ease;
}

.quiz-result.correct {
  background: #f0fff0;
  border: 1px solid #b7eb8f;
}

.quiz-result.wrong {
  background: #fff2f0;
  border: 1px solid #ffccc7;
}

.quiz-result .result-header {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
}

.quiz-result.correct .result-header { color: var(--success); }
.quiz-result.wrong .result-header { color: var(--error); }

.quiz-result .result-detail {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.quiz-start-area {
  text-align: center;
  padding: 40px;
}

.quiz-start-area .start-icon {
  font-size: 64px;
  margin-bottom: 16px;
}

.quiz-start-area .start-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}

.quiz-start-area .start-desc {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.6;
}

.quiz-unlock-notice {
  text-align: center;
  padding: 12px;
  background: #fffbe6;
  border-radius: var(--radius-sm);
  color: #ad8b00;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
  animation: fadeIn 0.5s ease;
}

.quiz-history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 4px;
}

.quiz-history-item.correct { background: #f6ffed; }
.quiz-history-item.wrong { background: #fff2f0; }

.quiz-history-item .quiz-idx {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.quiz-history-item.correct .quiz-idx { background: var(--success); color: white; }
.quiz-history-item.wrong .quiz-idx { background: var(--error); color: white; }

.quiz-history-item .quiz-preview {
  flex: 1;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quiz-history-item .quiz-score {
  font-weight: 700;
  font-size: 12px;
}

.quiz-history-item.correct .quiz-score { color: var(--success); }
.quiz-history-item.wrong .quiz-score { color: var(--error); }

/* ========== 实战演练面板 ========== */

.practice-start-area {
  text-align: center;
  padding: 60px 40px;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
}

.practice-filter-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
  padding: 16px 20px;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  margin-bottom: 16px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.filter-group select {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-input);
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
  cursor: pointer;
  min-width: 120px;
}

.filter-group select:focus {
  border-color: var(--accent);
}

.practice-filter-bar .btn {
  height: 38px;
  white-space: nowrap;
}

/* 统计栏 */
.practice-stats-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.practice-stat-item {
  flex: 1;
  min-width: 80px;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  padding: 12px 16px;
  text-align: center;
}

.practice-stat-item .pstat-value {
  font-size: 26px;
  font-weight: 700;
}

.practice-stat-item .pstat-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.practice-stat-item.correct .pstat-value { color: #52c41a; }
.practice-stat-item.wrong .pstat-value { color: #ff4d4f; }
.practice-stat-item.total .pstat-value { color: var(--accent); }
.practice-stat-item.rate .pstat-value { color: #fa8c16; }

/* ========== 响应式 ========== */
@media (max-width: 768px) {
  .sidebar {
    width: 60px;
  }

  .sidebar-header .logo span:not(.logo-icon),
  .sidebar-header .subtitle,
  .nav-item span:not(.nav-icon),
  .sidebar-footer label,
  .sidebar-footer select,
  .sidebar-footer .api-key-input-wrap,
  .sidebar-footer .ai-settings-section,
  .sidebar-footer .voice-toggle-row {
    display: none;
  }

  .nav-item {
    justify-content: center;
    padding: 12px;
  }

  .main-content {
    margin-left: 60px;
    padding: 16px;
  }
}
