/* ==========================================================================
   自考通 - 智能模拟考试与练习系统 - 核心样式表 (style.css)
   设计风格：现代毛玻璃 (Glassmorphism) + 暗黑/明亮双色主题 + 科技感微动效
   ========================================================================== */

/* 1. 主题变量定义 */
:root[data-theme="dark"] {
  --bg-primary: #0a0c16;
  --bg-secondary: #121528;
  --glass-bg: rgba(18, 21, 40, 0.6);
  --glass-bg-hover: rgba(26, 31, 58, 0.8);
  --glass-border: rgba(255, 255, 255, 0.08);
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-contrast: #ffffff;
  
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.3);
  
  --secondary: #d946ef;
  --secondary-hover: #c084fc;
  --secondary-glow: rgba(217, 70, 239, 0.3);

  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.25);
  --danger: #ef4444;
  --danger-glow: rgba(239, 68, 68, 0.25);
  --warning: #f59e0b;
  --warning-glow: rgba(245, 158, 11, 0.25);
  
  --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
  --btn-shadow: 0 4px 12px 0 rgba(99, 102, 241, 0.2);
  --nav-bg: rgba(99, 102, 241, 0.15);
}

:root[data-theme="light"] {
  --bg-primary: #f1f5f9;
  --bg-secondary: #e2e8f0;
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-bg-hover: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(99, 102, 241, 0.12);
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-contrast: #1e293b;
  
  --primary: #4f46e5;
  --primary-hover: #3730a3;
  --primary-glow: rgba(79, 70, 229, 0.15);
  
  --secondary: #c084fc;
  --secondary-hover: #a855f7;
  --secondary-glow: rgba(192, 132, 252, 0.15);

  --success: #059669;
  --success-glow: rgba(5, 150, 105, 0.15);
  --danger: #dc2626;
  --danger-glow: rgba(220, 38, 38, 0.15);
  --warning: #d97706;
  --warning-glow: rgba(217, 119, 6, 0.15);
  
  --card-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.05);
  --btn-shadow: 0 4px 12px 0 rgba(79, 70, 229, 0.15);
  --nav-bg: rgba(79, 70, 229, 0.06);
}

/* 2. 基础重置 & 全局样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* 隐藏滚动条但保持滚动 (针对主要自定义滚动) */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--glass-border);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* 3. 动态流光极光背景 */
.aurora-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
}

.aurora-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.45;
  mix-blend-mode: screen;
  animation: floatOrb 25s infinite alternate ease-in-out;
}

.orb-1 {
  width: 50vw;
  height: 50vw;
  background: radial-gradient(circle, rgba(99,102,241,0.5) 0%, rgba(168,85,247,0.1) 70%);
  top: -10%;
  left: -10%;
}

.orb-2 {
  width: 45vw;
  height: 45vw;
  background: radial-gradient(circle, rgba(236,72,153,0.4) 0%, rgba(217,70,239,0) 70%);
  bottom: -10%;
  right: -5%;
  animation-duration: 30s;
  animation-delay: -5s;
}

.orb-3 {
  width: 35vw;
  height: 35vw;
  background: radial-gradient(circle, rgba(16,185,129,0.3) 0%, rgba(99,102,241,0) 70%);
  top: 40%;
  left: 35%;
  animation-duration: 20s;
  animation-delay: -10s;
}

.grid-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 40px 40px;
  z-index: -1;
}

:root[data-theme="light"] .aurora-orb {
  opacity: 0.15;
  mix-blend-mode: multiply;
}

@keyframes floatOrb {
  0% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(8%, 5%) scale(1.15);
  }
  100% {
    transform: translate(-5%, -8%) scale(0.9);
  }
}

/* 4. 毛玻璃拟态面板通用类 */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  box-shadow: var(--card-shadow);
  transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), 
              box-shadow 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), 
              background-color 0.3s;
}

/* 5. 整体框架布局 */
.app-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  gap: 1.5rem;
  position: relative; /* 为 nav 绝对定位提供参考 */
}

/* 6. 顶部导航栏样式 */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1.5rem;
  height: 70px;
  z-index: 10;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.logo-icon {
  width: 38px;
  height: 38px;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-glow);
  border-radius: 10px;
  padding: 7px;
}

.logo-text {
  font-size: 1.35rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--text-main) 30%, var(--primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.badge-tech {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-text-fill-color: #ffffff;
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
  letter-spacing: 0.05em;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.header-nav {
  display: flex;
  gap: 0.5rem;
  background: var(--nav-bg);
  padding: 0.35rem;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  
  /* PC端将导航菜单通过绝对定位无缝贴回顶部卡片中 */
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: calc(1.5rem + (70px - 43px) / 2); /* 1.5rem为padding-top，70px为header高，43px为nav高 */
  z-index: 100;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.nav-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.5rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.nav-btn svg {
  width: 16px;
  height: 16px;
}

.nav-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.nav-btn.active {
  color: #ffffff;
  background: var(--primary);
  box-shadow: var(--btn-shadow);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* 科目选择下拉框 */
.subject-selector-wrapper {
  position: relative;
}

.subject-select-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 1rem;
  border-radius: 10px;
  background: var(--glass-bg);
  color: var(--text-main);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--glass-border);
}

.subject-label {
  color: var(--text-muted);
  font-weight: 400;
}

.arrow-icon {
  width: 16px;
  height: 16px;
  transition: transform 0.3s ease;
}

.subject-select-btn:hover {
  background: var(--glass-bg-hover);
}

.subject-selector-wrapper.open .arrow-icon {
  transform: rotate(180deg);
}

.subject-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 260px;
  padding: 0.5rem;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.2s, transform 0.2s;
}

.subject-dropdown.hidden {
  display: none;
  opacity: 0;
  transform: translateY(-10px);
}

.dropdown-item {
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.15s ease;
}

.dropdown-item:hover {
  background: var(--primary-glow);
  color: var(--text-main);
}

.dropdown-item.active {
  background: var(--primary);
  color: #ffffff;
}

.subject-badge {
  font-size: 0.72rem;
  padding: 0.1rem 0.3rem;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

/* 错题数微标 */
.mistake-count-badge {
  background: var(--danger);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 10px;
  min-width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* 主题切换按钮 */
.theme-toggle-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  background: var(--glass-bg);
}

.theme-toggle-btn:hover {
  background: var(--glass-bg-hover);
}

.sun-icon { display: none; width: 18px; height: 18px; }
.moon-icon { display: block; width: 18px; height: 18px; }

:root[data-theme="light"] .sun-icon { display: block; }
:root[data-theme="light"] .moon-icon { display: none; }

/* 7. 主视图切换机制 */
.app-main {
  flex: 1;
  position: relative;
}

.view-section {
  display: none;
  animation: viewFadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.view-section.active-view {
  display: block;
}

@keyframes viewFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ================= 仪表盘视图样式 ================= */
.welcome-header {
  margin-bottom: 2rem;
}

.welcome-header h1 {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, var(--text-main) 40%, var(--secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.welcome-header p {
  color: var(--text-muted);
  font-size: 1.05rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
}

.dashboard-main-col,
.dashboard-side-col {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.dash-card {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
}

.card-large {
  grid-column: span 1;
}

.card-medium {
  grid-column: span 1;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 2rem;
  gap: 0.8rem;
}

.card-full {
  grid-column: span 2;
}

.card-header {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 0.8rem;
}

.card-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
}

.sub-header-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* 进度列表 */
.subject-progress-list {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  flex: 1;
  justify-content: center;
}

.progress-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.progress-info {
  width: 180px;
}

.progress-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.3rem;
  color: var(--text-main);
}

.progress-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.progress-bar-outer {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--glass-border);
}

.progress-bar-inner {
  height: 100%;
  border-radius: 10px;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  box-shadow: 0 0 8px var(--primary-glow);
  transition: width 1s cubic-bezier(0.1, 0.8, 0.1, 1);
}

.progress-percent-val {
  font-family: 'Outfit', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  width: 60px;
  text-align: right;
  background: linear-gradient(135deg, var(--text-main), var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* 错题引导卡与启动卡 */
.card-icon-wrap {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.5rem;
}

.card-icon-wrap svg {
  width: 32px;
  height: 32px;
}

.card-icon-wrap.warn {
  background: var(--danger-glow);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.card-icon-wrap.primary {
  background: var(--primary-glow);
  color: var(--primary);
  border: 1px solid rgba(99, 102, 241, 0.2);
}

.highlight-count {
  font-family: 'Outfit', sans-serif;
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--danger);
  vertical-align: baseline;
  padding: 0 0.2rem;
  display: inline-block;
  line-height: 1;
}

/* 双按钮组合 */
.dual-btn-group {
  display: flex;
  width: 100%;
  gap: 0.8rem;
  margin-top: 0.5rem;
}

.dual-btn-group .btn {
  flex: 1;
}

/* 模拟图表区域 */
.chart-wrapper {
  position: relative;
  width: 100%;
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chart-empty {
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
}

#history-chart-svg {
  display: none; /* 仅在有数据时显示 */
}

/* ================= 答题区视图样式 ================= */
.quiz-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1.5rem;
  align-items: stretch;
  height: calc(100vh - 70px - 4.5rem);
}

.quiz-content-panel {
  padding: 1.5rem;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 0;
}

.quiz-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--glass-border);
  margin-bottom: 1.5rem;
}

.tag-mode {
  background: var(--primary-glow);
  color: var(--primary);
  border: 1px solid rgba(99, 102, 241, 0.2);
  padding: 0.25rem 0.65rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
}

.quiz-progress-text {
  font-size: 0.95rem;
  font-weight: 500;
}

.tag-type {
  background: var(--secondary-glow);
  color: var(--secondary);
  border: 1px solid rgba(217, 70, 239, 0.2);
  padding: 0.25rem 0.65rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
}

.question-body-scrollable {
  flex: 1;
  overflow-y: auto;
  max-height: none;
  padding-right: 0.5rem;
  margin-bottom: 1.5rem;
}

/* 材料选择题样式 */
.material-panel {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  padding: 0.6rem 1rem;
  border-radius: 12px;
  margin-bottom: 0.8rem;
  font-size: 0.95rem;
  line-height: 1.6;
  /* white-space: pre-wrap; */
}

.material-label {
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.3rem;
}

.question-title-wrap {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}

.question-index-label {
  font-family: 'Outfit', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary);
}

.question-title-text {
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text-main);
}

/* 选项列表 */
.options-container {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin-bottom: 1.5rem;
}

.option-card {
  display: flex;
  align-items: center;
  padding: 1rem 1.25rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.option-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--primary);
  transform: translateY(-2px);
}

.option-card.selected {
  background: var(--primary-glow);
  border-color: var(--primary);
}

.option-card.correct {
  background: var(--success-glow) !important;
  border-color: var(--success) !important;
  color: var(--success) !important;
}

.option-card.wrong {
  background: var(--danger-glow) !important;
  border-color: var(--danger) !important;
  color: var(--danger) !important;
}

.option-prefix {
  font-weight: 700;
  margin-right: 0.8rem;
  font-family: 'Outfit', sans-serif;
}

.option-text {
  font-size: 0.95rem;
  line-height: 1.4;
}

/* 选项状态图标 */
.option-status-icon {
  margin-left: auto;
  display: flex;
  align-items: center;
}

.option-status-icon svg {
  width: 20px;
  height: 20px;
}

/* 解析面板 */
.explanation-panel {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 1.2rem;
  margin-top: 1.5rem;
  animation: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.exp-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.8rem;
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 0.6rem;
}

.exp-status {
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}

.explanation-panel.correct-panel .exp-status { color: var(--success); }
.explanation-panel.wrong-panel .exp-status { color: var(--danger); }

.correct-answer-text {
  font-size: 0.95rem;
}

.correct-answer-text strong {
  font-size: 1.1rem;
  color: var(--success);
}

.exp-body {
  font-size: 0.9rem;
  line-height: 1.5;
}

.exp-label {
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

.exp-content {
  color: var(--text-main);
}

/* 答题面板底部 */
.quiz-panel-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--glass-border);
  padding-top: 1.25rem;
}

.quiz-panel-footer .btn {
  width: 120px;
  justify-content: center;
}

/* 收藏按钮 */
#btn-toggle-collect {
  color: var(--text-muted);
}

#btn-toggle-collect.collected {
  color: var(--warning);
}

#btn-toggle-collect.collected svg {
  fill: var(--warning);
}

.star-icon {
  width: 16px;
  height: 16px;
}

/* 侧边栏面板 */
.quiz-sidebar-panel {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  height: 100%;
  min-height: 0;
}

/* 计时器组件 */
.timer-card {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1rem;
  background: var(--nav-bg);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  transition: all 0.3s ease;
}

.timer-simple-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.timer-icon {
  color: var(--primary);
  width: 16px;
  height: 16px;
}

.time-label {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.time-val {
  font-family: 'Outfit', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  min-width: 48px;
}

/* 答题卡卡片 */
.answer-sheet-card {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.answer-sheet-card h3 {
  font-size: 1rem;
  font-weight: 700;
}

.sheet-status-info {
  display: flex;
  gap: 0.8rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.status-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.status-item .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.dot.done { background: var(--primary); }
.dot.current { background: var(--secondary); box-shadow: 0 0 6px var(--secondary); }
.dot.todo { border: 1px solid var(--glass-border); background: transparent; }

.answer-sheet-scroll {
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 0.25rem;
  margin-top: 0.4rem;
}

.answer-sheet-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
}

.sheet-btn {
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--glass-border);
  background: rgba(255,255,255,0.02);
  color: var(--text-muted);
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.sheet-btn:hover {
  border-color: var(--primary);
  color: var(--text-main);
  background: rgba(255,255,255,0.05);
}

.sheet-btn.done {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.sheet-btn.current {
  background: var(--glass-bg);
  border-color: var(--secondary);
  color: var(--secondary);
  box-shadow: 0 0 8px var(--secondary-glow);
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

/* ================= 成绩报告视图样式 ================= */
.result-container {
  max-width: 800px;
  margin: 2rem auto;
  padding: 2.5rem;
  text-align: center;
}

.result-header {
  margin-bottom: 2rem;
}

.celebration-icon {
  font-size: 3.5rem;
  margin-bottom: 0.8rem;
  animation: bounceIcon 1.5s infinite alternate ease-in-out;
}

@keyframes bounceIcon {
  0% { transform: translateY(0) scale(1); }
  100% { transform: translateY(-8px) scale(1.05); }
}

.result-header h1 {
  font-size: 1.85rem;
  font-weight: 800;
  margin-bottom: 0.3rem;
}

#result-subject-title {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.result-stats-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.stat-score-circle {
  position: relative;
  width: 140px;
  height: 140px;
}

.stat-score-circle svg {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}

.score-circle-bg {
  fill: none;
  stroke: rgba(255,255,255,0.05);
  stroke-width: 7;
}

.score-circle-progress {
  fill: none;
  stroke: var(--primary);
  stroke-width: 7;
  stroke-linecap: round;
  stroke-dasharray: 251.2; /* 2 * PI * r (r=40) */
  stroke-dashoffset: 251.2;
  transition: stroke-dashoffset 1.5s cubic-bezier(0.1, 0.8, 0.1, 1);
}

.score-val-wrap {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: baseline;
  justify-content: center;
}

.score-num {
  font-family: 'Outfit', sans-serif;
  font-size: 2.8rem;
  font-weight: 800;
}

.score-total {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-left: 0.1rem;
}

.result-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 160px);
  gap: 1rem;
}

.meta-item {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--glass-border);
  padding: 0.6rem 1rem;
  border-radius: 10px;
  text-align: left;
}

.meta-item .label {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: block;
}

.meta-item .val {
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
}

.divider {
  border: none;
  border-top: 1px solid var(--glass-border);
  margin: 1.5rem 0;
}

.wrong-questions-section {
  text-align: left;
  margin-bottom: 2rem;
}

.wrong-questions-section h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
}

.wrong-questions-section .desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.result-sheet-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 0.5rem;
}

.result-sheet-btn {
  height: 36px;
  border-radius: 8px;
  border: none;
  color: #ffffff;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
}

.result-sheet-btn:hover {
  transform: scale(1.08);
}

.result-sheet-btn.correct { background: var(--success); }
.result-sheet-btn.wrong { background: var(--danger); }
.result-sheet-btn.unanswered { background: var(--glass-border); color: var(--text-muted); }

.result-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 2rem;
}

/* ================= 错题本视图样式 ================= */
.mistakes-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.mistakes-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mistakes-header h1 {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 0.2rem;
}

.mistakes-header p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.mistakes-filter {
  display: flex;
  align-items: center;
  padding: 0.75rem 1.25rem;
  gap: 1rem;
}

.filter-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
}

.filter-tabs {
  display: flex;
  gap: 0.5rem;
}

.filter-tab {
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  padding: 0.35rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-tab:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.filter-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

/* 自定义高雅下拉选择框 */
.subject-select-custom {
  appearance: none;
  -webkit-appearance: none;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  padding: 0.5rem 2.2rem 0.5rem 1rem;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236366f1' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.8rem center;
  background-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.3s;
}

.subject-select-custom:hover {
  background-color: var(--glass-bg-hover);
  border-color: var(--primary);
}

.subject-select-custom:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* 暗色模式适配 */
:root[data-theme="dark"] .subject-select-custom {
  background-color: rgba(255, 255, 255, 0.03);
  color: var(--text-main);
}
:root[data-theme="dark"] .subject-select-custom option {
  background-color: var(--bg-secondary);
  color: var(--text-main);
}
:root[data-theme="light"] .subject-select-custom option {
  background-color: #ffffff;
  color: var(--text-main);
}

.mistakes-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.mistake-card {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.mistake-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 0.6rem;
}

.mistake-subject-tag {
  font-size: 0.75rem;
  background: var(--primary-glow);
  color: var(--primary);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-weight: 600;
}

.mistake-type-tag {
  font-size: 0.75rem;
  background: var(--secondary-glow);
  color: var(--secondary);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-weight: 600;
}

.mistake-card-actions {
  display: flex;
  gap: 0.6rem;
  margin-left: auto;
}

.mistake-card-body {
  font-size: 0.95rem;
  line-height: 1.5;
}

.mistakes-empty {
  text-align: center;
  padding: 4rem 2rem;
}

.empty-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.mistakes-empty h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.mistakes-empty p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

/* ================= 按钮与基础控制类 ================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-glow-primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #ffffff;
  box-shadow: var(--btn-shadow);
}

.btn-glow-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--primary-glow);
}

.btn-glow-secondary {
  background: linear-gradient(135deg, var(--secondary), #ec4899);
  color: #ffffff;
}

.btn-glow-secondary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--secondary-glow);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--text-main);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--text-muted);
}

.btn-outline-danger {
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--danger);
}

.btn-outline-danger:hover {
  background: var(--danger-glow);
}

.btn-danger-text {
  background: transparent;
  color: var(--danger);
  font-size: 0.8rem;
}

.btn-danger-text:hover {
  background: var(--danger-glow);
}

.w-full { width: 100%; }
.w-4 { width: 1rem !important; }
.h-4 { height: 1rem !important; }
.w-5 { width: 1.25rem !important; }
.h-5 { height: 1.25rem !important; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.hidden { display: none !important; }

/* ================= 模态弹窗样式 ================= */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: modalFadeIn 0.25s ease forwards;
}

.modal-content {
  width: 90%;
  max-width: 650px;
  padding: 1.8rem;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  background: #ffffff !important;
  border: 1px solid var(--glass-border);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  border-radius: 20px;
}

:root[data-theme="dark"] .modal-content {
  background: var(--bg-secondary) !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.modal-content .option-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 0.9rem 1.2rem;
  border-radius: 12px;
  margin-bottom: 0.2rem;
}

:root[data-theme="dark"] .modal-content .option-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-content .option-card:hover {
  background: #f1f5f9;
  border-color: var(--primary);
  transform: translateY(-2px);
}

:root[data-theme="dark"] .modal-content .option-card:hover {
  background: rgba(255, 255, 255, 0.05);
}

.modal-content .option-card.selected {
  background: var(--primary-glow) !important;
  border-color: var(--primary) !important;
  box-shadow: 0 0 10px var(--primary-glow);
}

.modal-content .option-card.correct {
  background: var(--success-glow) !important;
  border-color: var(--success) !important;
  color: var(--success) !important;
}

.modal-content .option-card.wrong {
  background: var(--danger-glow) !important;
  border-color: var(--danger) !important;
  color: var(--danger) !important;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 0.8rem;
  margin-bottom: 1.2rem;
}

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
}

.btn-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
}

.btn-close:hover {
  color: var(--text-main);
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 1.2rem;
}

.modal-material-panel {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  padding: 0.5rem 0.8rem;
  border-radius: 8px;
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-wrap;
  margin-bottom: 0.8rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.8rem;
  border-top: 1px solid var(--glass-border);
  padding-top: 1rem;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* 子 Tab 切换 */
.sub-view-tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.25rem;
  border-radius: 10px;
  background: var(--nav-bg);
  border: 1px solid var(--glass-border);
}

.sub-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.4rem 1.1rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sub-tab-btn:hover {
  color: var(--text-main);
}

.sub-tab-btn.active {
  background: var(--primary);
  color: #ffffff !important;
  box-shadow: var(--btn-shadow);
}

/* 收藏按钮专属样式 */
.btn-warning {
  background: var(--warning);
  color: #ffffff;
}
.btn-warning:hover {
  background: var(--warning);
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--warning-glow);
}

/* ================= 10. 响应式布局自适应调整 ================= */
@media (max-width: 992px) {
  /* 整体框架紧凑化：调小内边距与间距，防溢出 */
  .app-container {
    padding: 0.5rem 0.5rem 65px 0.5rem !important; /* 底部留出 65px 给固定 Tab Bar */
    gap: 0.6rem !important;
    padding-top: 0.5rem !important;
    max-width: 100% !important;
    width: 100% !important;
    overflow-x: hidden !important; /* 彻底杜绝水平溢出 */
  }
  
  /* 顶部导航紧凑 */
  .app-header {
    height: 52px !important;
    padding: 0.4rem 0.8rem !important;
    display: flex;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: #ffffff !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05) !important;
  }
  
  :root[data-theme="dark"] .app-header {
    background: var(--bg-secondary) !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3) !important;
  }
  
  .logo-text span {
    display: none; /* 隐藏 Logo Pro 等小徽章 */
  }
  
  .logo-text {
    font-size: 1.05rem !important;
  }
  
  .logo-icon {
    width: 30px !important;
    height: 30px !important;
    padding: 5px !important;
    border-radius: 8px !important;
  }
  
  .subject-select-btn {
    padding: 0.3rem 0.5rem !important;
    font-size: 0.78rem !important;
    border-radius: 8px !important;
  }
  
  .subject-label {
    display: none; /* 隐藏“当前科目”字样 */
  }
  
  .theme-toggle-btn {
    width: 32px !important;
    height: 32px !important;
    border-radius: 8px !important;
  }
  
  /* 底部固定 Tab 导航菜单 */
  .header-nav {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    top: auto !important;
    transform: none !important;
    width: 100% !important;
    height: 60px !important;
    background: var(--bg-secondary) !important;
    border-radius: 0 !important;
    border: none !important;
    border-top: 1px solid var(--glass-border) !important;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.15) !important;
    z-index: 1000 !important;
    display: flex !important;
    justify-content: space-around !important;
    align-items: center !important;
    padding: 0.3rem !important;
  }
  
  .nav-btn {
    position: relative !important;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2px;
    font-size: 0.72rem;
    padding: 0.3rem;
    border-radius: 6px;
    color: var(--text-muted);
  }

  /* 错题数微标移动端悬浮定位 */
  .mistake-count-badge {
    position: absolute !important;
    top: 3px !important;
    left: 50% !important;
    margin-left: 8px !important; /* 精准定位在图标（宽18px）的右上角 */
    min-width: 15px !important;
    height: 15px !important;
    font-size: 0.65rem !important;
    padding: 0 3px !important;
    border-radius: 10px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
  }
  
  .nav-btn svg {
    width: 18px;
    height: 18px;
  }
  
  .nav-btn.active {
    background: transparent;
    color: var(--primary);
    box-shadow: none;
    font-weight: 700;
  }

  /* 仪表盘紧凑设计 */
  .welcome-header {
    margin-bottom: 0.8rem !important;
  }
  
  .welcome-header h1 {
    font-size: 1.35rem !important;
  }
  
  .welcome-header p {
    font-size: 0.85rem !important;
  }
  
  .dashboard-grid {
    grid-template-columns: 1fr !important;
    gap: 0.8rem !important;
  }
  
  .card-full {
    grid-column: span 1 !important;
  }
  
  .dash-card {
    padding: 1rem !important;
    border-radius: 12px !important;
  }
  
  .card-header {
    margin-bottom: 0.8rem !important;
    padding-bottom: 0.5rem !important;
  }
  
  .card-header h2 {
    font-size: 1.05rem !important;
  }
  
  .card-medium {
    padding: 1.2rem 1rem !important;
    gap: 0.5rem !important;
  }
  
  .card-medium h3 {
    font-size: 0.95rem !important;
  }
  
  .card-medium p {
    font-size: 0.8rem !important;
  }
  
  .card-icon-wrap {
    width: 48px !important;
    height: 48px !important;
    border-radius: 12px !important;
    margin-bottom: 0.2rem !important;
  }
  
  .card-icon-wrap svg {
    width: 24px !important;
    height: 24px !important;
  }
  
  .highlight-count {
    font-size: 1.25rem !important;
  }
  
  .progress-item {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 0.4rem 0.8rem !important;
  }
  
  .progress-info {
    flex: 0 0 100% !important;
    width: 100% !important;
  }
  
  .progress-title {
    font-size: 0.85rem !important;
  }
  
  .progress-bar-outer {
    flex: 1 !important;
    margin-top: 0.2rem !important;
  }
  
  .progress-percent-val {
    flex: 0 0 auto !important;
    width: auto !important;
    text-align: right !important;
    font-size: 1.05rem !important;
  }
  
  .dual-btn-group {
    gap: 0.5rem !important;
  }

  /* 答题考试页面 - 高度自适应与紧凑排版 */
  .quiz-layout {
    grid-template-columns: 1fr !important;
    height: auto !important; /* 解除高度写死，使之能够随内容撑开 */
    min-height: auto !important;
    gap: 0.8rem !important;
  }
  
  .quiz-content-panel {
    padding: 1rem !important;
    height: auto !important;
    min-height: auto !important;
    border-radius: 12px !important;
  }
  
  .quiz-panel-header {
    margin-bottom: 0.8rem !important;
    padding-bottom: 0.6rem !important;
  }
  
  .tag-mode, .tag-type {
    padding: 0.2rem 0.5rem !important;
    font-size: 0.72rem !important;
    border-radius: 6px !important;
  }
  
  .quiz-progress-text {
    font-size: 0.85rem !important;
  }
  
  /* 将答题正文区域设为可见并取消限高，整体滚动由页面 window 负责，完美消除底部大白 */
  .question-body-scrollable {
    overflow-y: visible !important;
    max-height: none !important;
    margin-bottom: 0.8rem !important;
    padding-right: 0 !important;
  }
  
  .question-title-wrap {
    margin-bottom: 0.8rem !important;
    gap: 0.4rem !important;
  }
  
  .question-index-label {
    font-size: 1.05rem !important;
  }
  
  .question-title-text {
    font-size: 0.95rem !important;
    line-height: 1.45 !important;
  }
  
  .options-container {
    gap: 0.5rem !important;
    margin-bottom: 0.8rem !important;
  }
  
  .option-card {
    padding: 0.7rem 0.9rem !important;
    border-radius: 10px !important;
  }
  
  .option-card:hover {
    transform: none !important; /* 移动端不需要 hover 位移动效 */
  }
  
  .option-prefix {
    font-size: 0.88rem !important;
    margin-right: 0.5rem !important;
  }
  
  .option-text {
    font-size: 0.85rem !important;
    line-height: 1.35 !important;
  }
  
  .quiz-panel-footer {
    padding-top: 0.8rem !important;
    margin-top: 0.5rem !important;
    gap: 0.4rem !important;
  }
  
  /* 底部操作按钮微型化，防止小屏排版拥挤 */
  .quiz-panel-footer .btn {
    width: auto !important;
    padding: 0.45rem 0.65rem !important;
    font-size: 0.78rem !important;
    border-radius: 8px !important;
  }
  
  .btn-collect-text {
    display: none !important; /* 隐藏“收藏题目”文字 */
  }
  
  #btn-toggle-collect {
    padding: 0.45rem 0.65rem !important;
  }
  
  .mobile-only-btn {
    display: inline-flex !important; /* 显示“答题卡”开关按钮 */
  }

  .quiz-sidebar-panel {
    position: fixed !important;
    top: 52px !important; /* 避开顶部 Header 高度 */
    bottom: 60px !important; /* 避开底部 Tab Bar 高度 */
    right: -100% !important;
    width: 100% !important;
    height: calc(100vh - 52px - 60px) !important; /* 动态高度排除遮挡 */
    z-index: 1001 !important;
    background: #ffffff !important; /* 亮色模式下改用纯白背景，提升亮度与清爽感 */
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
    transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
    display: flex !important;
    flex-direction: column !important;
    padding: 1rem 1rem !important;
  }
  
  :root[data-theme="dark"] .quiz-sidebar-panel {
    background: var(--bg-secondary) !important; /* 暗色模式保持原有深色底色 */
  }
  
  .quiz-sidebar-panel.show-sidebar {
    right: 0 !important;
  }
  
  .sheet-card-header .btn-close-sidebar {
    display: block !important;
  }
  
  .btn-close-sidebar {
    background: transparent !important;
    border: none !important;
    font-size: 0.88rem !important;
    font-weight: 600 !important;
    color: var(--primary) !important;
    cursor: pointer !important;
  }
  
  .answer-sheet-scroll {
    max-height: 70vh !important;
  }
  
  .answer-sheet-grid {
    grid-template-columns: repeat(5, 1fr) !important;
    gap: 0.4rem !important;
  }
  
  .sheet-btn {
    height: 32px !important;
    border-radius: 6px !important;
    font-size: 0.8rem !important;
  }

  /* 成绩结算单紧凑化 */
  .result-container {
    padding: 1.2rem 1rem !important;
    margin: 0.8rem auto !important;
    border-radius: 12px !important;
  }
  
  .result-header h1 {
    font-size: 1.35rem !important;
  }
  
  .result-stats-row {
    flex-direction: column !important;
    gap: 1rem !important;
    margin-bottom: 1rem !important;
  }
  
  .stat-score-circle {
    width: 110px !important;
    height: 110px !important;
  }
  
  .score-num {
    font-size: 2.2rem !important;
  }
  
  .result-meta-grid {
    grid-template-columns: 1fr 1fr !important;
    width: 100% !important;
    gap: 0.5rem !important;
  }
  
  .meta-item {
    padding: 0.4rem 0.6rem !important;
    border-radius: 8px !important;
  }
  
  .meta-item .val {
    font-size: 0.95rem !important;
  }
  
  .result-sheet-grid {
    grid-template-columns: repeat(5, 1fr) !important;
    gap: 0.4rem !important;
  }
  
  .result-sheet-btn {
    height: 32px !important;
    border-radius: 6px !important;
    font-size: 0.8rem !important;
  }
  
  .result-actions {
    flex-wrap: wrap !important;
    gap: 0.5rem !important;
    margin-top: 1rem !important;
  }
  
  .result-actions .btn {
    flex: 1 1 calc(50% - 0.5rem) !important;
    font-size: 0.78rem !important;
    padding: 0.5rem 0.8rem !important;
  }

  /* ================= 错题本极致精简重构 ================= */
  .mistakes-container {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important; /* 严防整体横向溢出 */
  }

  .mistakes-header {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 0.8rem 0.4rem !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    padding: 0.2rem 0.2rem !important;
  }
  
  .mistakes-header > div:first-child {
    flex: 0 0 100% !important;
    width: 100% !important;
  }
  
  .mistakes-header h1 {
    font-size: 1.4rem !important;
    background: linear-gradient(135deg, var(--text-main) 60%, var(--primary) 100%) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
  }

  .mistakes-header p {
    font-size: 0.78rem !important;
    color: var(--text-muted) !important;
    margin-top: 0.25rem !important;
    line-height: 1.4 !important;
  }
  
  .sub-view-tabs {
    background: transparent !important;
    border: none !important;
    display: flex !important;
    gap: 1.2rem !important;
    padding: 0.2rem 0 !important;
    border-radius: 0 !important;
    flex: 0 0 auto !important;
  }
  
  .sub-tab-btn {
    background: transparent !important;
    border: none !important;
    color: var(--text-muted) !important;
    padding: 0.5rem 0.1rem !important;
    font-size: 0.92rem !important;
    font-weight: 600 !important;
    border-radius: 0 !important;
    position: relative !important;
    box-shadow: none !important;
    cursor: pointer;
  }
  
  .sub-tab-btn.active {
    color: var(--primary) !important;
    background: transparent !important;
    box-shadow: none !important;
  }
  
  .sub-tab-btn.active::after {
    content: "" !important;
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 2.5px !important;
    background: var(--primary) !important;
    border-radius: 2px !important;
  }
  
  #btn-clear-all-mistakes {
    background: var(--danger-glow) !important;
    border: 1px solid rgba(239, 68, 68, 0.15) !important;
    color: var(--danger) !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    padding: 0.3rem 0.6rem !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.25rem !important;
    border-radius: 8px !important;
    box-shadow: none !important;
    flex: 0 0 auto !important;
    transition: all 0.2s ease !important;
  }
  
  #btn-clear-all-mistakes span {
    display: none !important; /* 隐藏原长文字 */
  }

  #btn-clear-all-mistakes::after {
    content: "清空" !important; /* 精简为“清空” */
    font-size: 0.72rem !important;
  }
  
  #btn-clear-all-mistakes:hover {
    background: var(--danger) !important;
    color: #ffffff !important;
  }
  
  /* 科目筛选卡片化包覆与防溢出 */
  .mistakes-filter {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin-top: 0.2rem !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    display: block !important;
  }
  
  .filter-label {
    display: none !important;
  }
  
  .subject-select-custom {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  
  .mistake-card {
    padding: 0.8rem !important;
    border-radius: 12px !important;
    gap: 0.6rem !important;
  }
  
  .mistake-card-header {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important; /* 强制单行并排 */
    justify-content: space-between !important;
    align-items: center !important;
    padding-bottom: 0.4rem !important;
    border-bottom: 1px solid var(--glass-border) !important;
  }
  
  .mistake-card-header > div:first-child {
    display: flex !important;
    gap: 0.4rem !important;
    flex-wrap: wrap !important;
    flex: 1 !important;
  }
  
  .mistake-subject-tag {
    font-size: 0.72rem !important;
    padding: 0.15rem 0.4rem !important;
    max-width: 160px !important; /* 限制长科目最大宽度 */
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }
  
  .mistake-type-tag {
    font-size: 0.72rem !important;
    padding: 0.15rem 0.4rem !important;
    white-space: nowrap !important;
  }
  
  .mistake-card-actions {
    margin-left: 0.8rem !important;
    display: flex !important;
    gap: 0.8rem !important;
    align-items: center !important;
    flex-shrink: 0 !important;
  }
  
  .mistake-card-actions .btn {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    color: var(--primary) !important; /* 文字链接 */
    min-height: auto !important;
    height: auto !important;
    line-height: 1 !important;
    border-radius: 0 !important;
    cursor: pointer;
  }
  
  .mistake-card-actions .btn-outline-danger {
    color: var(--text-muted) !important;
  }
  
  .mistake-card-actions .btn-outline-danger:hover {
    color: var(--danger) !important;
  }

  /* 公共控制按钮尺寸收缩 */
  .btn {
    padding: 0.45rem 0.85rem !important;
    font-size: 0.8rem !important;
    border-radius: 8px !important;
  }
  
  .back-to-top {
    bottom: 4.5rem !important; /* 避开底栏 */
    right: 1.5rem !important;
    width: 38px !important;
    height: 38px !important;
  }
  
  .back-to-top svg {
    width: 16px !important;
    height: 16px !important;
  }

  /* ================= 模态弹窗移动端极致紧凑化优化 ================= */
  .modal-content {
    padding: 1.2rem !important;
    border-radius: 16px !important;
    max-height: 85vh !important;
    width: 92% !important;
  }
  
  .modal-header {
    margin-bottom: 0.8rem !important;
    padding-bottom: 0.5rem !important;
  }
  
  .modal-header h3 {
    font-size: 1.05rem !important;
  }
  
  .btn-close {
    font-size: 1.25rem !important;
  }
  
  .modal-body {
    margin-bottom: 0.8rem !important;
  }
  
  .modal-content .option-card {
    padding: 0.65rem 0.85rem !important;
    border-radius: 10px !important;
    margin-bottom: 0.4rem !important;
  }
  
  .modal-content .option-prefix {
    font-size: 0.85rem !important;
    margin-right: 0.5rem !important;
  }
  
  .modal-content .option-text {
    font-size: 0.85rem !important;
    line-height: 1.35 !important;
  }
  
  .modal-footer {
    padding-top: 0.8rem !important;
    gap: 0.5rem !important;
  }
  
  .modal-footer .btn {
    padding: 0.45rem 0.85rem !important;
    font-size: 0.78rem !important;
    border-radius: 8px !important;
  }
}

/* 解析面板对错的底色高亮 */
.explanation-panel.correct-panel {
  background: var(--success-glow) !important;
  border-color: var(--success) !important;
}

.explanation-panel.wrong-panel {
  background: var(--danger-glow) !important;
  border-color: var(--danger) !important;
}

/* 返回顶部悬浮按钮 */
.back-to-top {
  position: fixed;
  bottom: 2.5rem;
  right: 2.5rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transform: translateY(15px);
  transition: opacity 0.3s ease, transform 0.3s ease, background-color 0.3s, border-color 0.3s, color 0.3s;
}

.back-to-top svg {
  width: 20px;
  height: 20px;
  transition: transform 0.3s ease;
}

.back-to-top:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 10px 20px var(--primary-glow);
}

.back-to-top:hover svg {
  transform: translateY(-2px);
}

.back-to-top.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
