/* student.css v9 — SAT Student Practice Interface
   Design ref: xiaosaas.com clean style
   5-Tab: Dashboard / Practice / Scores / Wrongs / Report */

:root {
  --primary: #4a6cf7;
  --primary-light: #e8eeff;
  --bg: #f0f2f5;
  --card: #ffffff;
  --correct: #67c23a;
  --correct-bg: #e8f9ed;
  --warning: #e6a23c;
  --warning-bg: #fef3c7;
  --wrong: #f56c6c;
  --wrong-bg: #ffeae9;
  --text: #303133;
  --text-secondary: #909399;
  --text-tertiary: #c0c4cc;
  --border: #e5e7eb;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  --radius: 8px;
  --font:
    -apple-system, BlinkMacSystemFont, "SF Pro", "Segoe UI", system-ui,
    sans-serif;
  /* Aliases for student-exam-style.css compatibility */
  --accent: var(--primary);
  --text2: var(--text-secondary);
  --text3: var(--text-tertiary);
}

[data-theme="dark"] {
  --primary-light: #1e3a5f;
  --bg: #111827;
  --card: #1f2937;
  --text: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-tertiary: #6b7280;
  --border: #374151;
  --correct-bg: #064e2a;
  --warning-bg: #3b2e0e;
  --wrong-bg: #5c1a1a;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
  --accent: var(--primary);
  --text2: var(--text-secondary);
  --text3: var(--text-tertiary);
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ===== Top Bar ===== */
.top-bar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.top-bar h1 {
  font-size: 18px;
  font-weight: 600;
  white-space: nowrap;
}
.top-bar h1 span {
  color: var(--primary);
}

.tab-nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.tab-btn {
  padding: 6px 14px;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font);
  white-space: nowrap;
}
.tab-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
}
.tab-btn.active {
  background: var(--primary);
  color: #fff;
}

.theme-toggle {
  position: fixed;
  bottom: 16px;
  left: 16px;
  z-index: 9999;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
}

/* ===== Tab Panels ===== */
.tab-panel {
  display: none;
}
.tab-panel.active {
  display: flex;
}

/* ===== Dashboard Tab ===== */
.dashboard-layout {
  flex-direction: column;
  padding: 24px;
  gap: 20px;
  overflow-y: auto;
  height: calc(100vh - 53px);
}

.dash-user-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 10px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.dash-user-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}
.dash-logout-btn {
  padding: 5px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text2);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.dash-logout-btn:hover {
  background: #e74c3c;
  color: #fff;
  border-color: #e74c3c;
}

.stat-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.stat-icon.blue {
  background: var(--primary-light);
  color: var(--primary);
}
.stat-icon.green {
  background: var(--correct-bg);
  color: var(--correct);
}
.stat-icon.orange {
  background: var(--warning-bg);
  color: var(--warning);
}
.stat-icon.red {
  background: var(--wrong-bg);
  color: var(--wrong);
}

.stat-info {
  flex: 1;
}
.stat-number {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
}
.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
}

.dash-section {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.dash-section h3 {
  font-size: 15px;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.recent-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.recent-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}
.recent-item:hover {
  background: var(--bg);
}

.recent-source {
  font-weight: 500;
  flex: 1;
}
.recent-stat {
  font-size: 12px;
  color: var(--text-secondary);
}
.recent-date {
  font-size: 11px;
  color: var(--text-tertiary);
}

.weak-skills {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.weak-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  font-size: 13px;
}

.weak-name {
  flex: 1;
}
.weak-rate {
  font-weight: 600;
}

.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* ===== Practice Tab (Three Column) ===== */
.practice-layout {
  height: calc(100vh - 53px);
  gap: 0;
}

/* ===== Score Overview Tab ===== */
.score-layout {
  flex-direction: column;
  padding: 24px;
  gap: 24px;
  overflow-y: auto;
  height: calc(100vh - 53px);
}

.score-top {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.score-ring-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  min-width: 220px;
}

.ring-svg {
  width: 160px;
  height: 160px;
}
.ring-bg {
  fill: none;
  stroke: var(--border);
  stroke-width: 12;
}
.ring-fill {
  fill: none;
  stroke-width: 12;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s;
}
.ring-fill.correct-ring {
  stroke: var(--correct);
}
.ring-fill.wrong-ring {
  stroke: var(--wrong);
}

.ring-center-text {
  font-size: 32px;
  font-weight: 700;
  fill: var(--text);
}
.ring-sub-text {
  font-size: 14px;
  fill: var(--text-secondary);
}

.score-detail {
  text-align: center;
}
.score-detail .big {
  font-size: 28px;
  font-weight: 700;
}
.score-detail .label {
  font-size: 12px;
  color: var(--text-secondary);
}

.score-breakdown {
  flex: 1;
  min-width: 300px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}
.score-breakdown h3 {
  font-size: 15px;
  margin-bottom: 16px;
}

.skill-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  font-size: 13px;
}

.skill-name {
  width: 160px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.skill-bar-bg {
  flex: 1;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.skill-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s;
}
.skill-bar-fill.good {
  background: var(--correct);
}
.skill-bar-fill.fair {
  background: var(--warning);
}
.skill-bar-fill.weak {
  background: var(--wrong);
}

.skill-pct {
  width: 40px;
  text-align: right;
  font-weight: 600;
}

.skill-grade {
  width: 48px;
  text-align: center;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}
.grade-good {
  background: var(--correct-bg);
  color: var(--correct);
}
.grade-fair {
  background: var(--warning-bg);
  color: #92400e;
}
.grade-weak {
  background: var(--wrong-bg);
  color: var(--wrong);
}

[data-theme="dark"] .grade-fair {
  color: var(--warning);
}

/* ===== Wrong Answers Tab (Table View) ===== */
.wrong-layout {
  flex-direction: column;
  padding: 24px;
  gap: 16px;
  overflow-y: auto;
  height: calc(100vh - 53px);
}

.wrong-header {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.wrong-count {
  font-size: 16px;
  font-weight: 600;
}

.wrong-search {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
  font-size: 13px;
  min-width: 200px;
}
.wrong-search::placeholder {
  color: var(--text-secondary);
}
.wrong-filter {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
  font-size: 13px;
}

.wrong-table-wrap {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.wrong-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.wrong-table th {
  text-align: left;
  padding: 12px 16px;
  background: var(--bg);
  font-weight: 600;
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

.wrong-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.wrong-table tr:nth-child(even) td {
  background: rgba(0, 0, 0, 0.02);
}
[data-theme="dark"] .wrong-table tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.02);
}

.wrong-table tr:hover td {
  background: var(--primary-light);
}

.wrong-table td:last-child {
  text-align: right;
}

.tri-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
}
.tri-icon.tri-blue {
  background: var(--primary-light);
  color: var(--primary);
}
.tri-icon.tri-green {
  background: var(--correct-bg);
  color: var(--correct);
}
.tri-icon.tri-red {
  background: var(--wrong-bg);
  color: var(--wrong);
}

.wrong-detail-btn {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--card);
  color: var(--primary);
  font-size: 12px;
  cursor: pointer;
}
.wrong-detail-btn:hover {
  background: var(--primary-light);
}
.wrong-practice-btn {
  padding: 4px 10px;
  border: 1px solid var(--primary);
  border-radius: 4px;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  cursor: pointer;
}
.wrong-practice-btn:hover {
  opacity: 0.85;
}

/* Wrong card (detail view) */
.wrong-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  border-left: 4px solid var(--wrong);
  margin-bottom: 12px;
}
.wrong-card-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.wrong-left {
  border-right: 1px solid var(--border);
  padding-right: 16px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
}
.wrong-passage {
  white-space: pre-line;
}
.wrong-img {
  max-width: 100%;
  margin-top: 10px;
  border-radius: 4px;
}
.wrong-right {
  font-size: 13px;
}
.wrong-explanation {
  margin-top: 12px;
  padding: 10px;
  background: var(--bg);
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text2);
}
@media (max-width: 768px) {
  .wrong-card-body {
    grid-template-columns: 1fr;
  }
  .wrong-left {
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding-right: 0;
    padding-bottom: 12px;
    margin-bottom: 12px;
  }
}

.wrong-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

.wrong-q-text {
  font-weight: 500;
  margin-bottom: 8px;
  font-size: 13px;
}

.wrong-choices {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
}

.wrong-choice {
  padding: 4px 8px;
  border-radius: 4px;
}
.wrong-choice.user-wrong {
  background: var(--wrong-bg);
  text-decoration: line-through;
}
.wrong-choice.is-correct {
  background: var(--correct-bg);
  font-weight: 600;
}

/* ===== Report Tab ===== */
.report-layout {
  flex-direction: column;
  padding: 24px;
  gap: 20px;
  overflow-y: auto;
  height: calc(100vh - 53px);
}

.report-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}
.report-card h3 {
  font-size: 15px;
  margin-bottom: 16px;
}

.trend-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 160px;
  padding-top: 8px;
}

.trend-bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
  justify-content: flex-end;
}

.trend-bar {
  width: 100%;
  max-width: 40px;
  border-radius: 4px 4px 0 0;
  transition: height 0.5s;
}

.trend-bar-label {
  font-size: 10px;
  color: var(--text-tertiary);
}
.trend-bar-val {
  font-size: 10px;
  font-weight: 600;
}

.skill-progress-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.skill-progress-item {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.sp-name {
  width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sp-bar-bg {
  flex: 1;
  height: 10px;
  background: var(--border);
  border-radius: 5px;
  overflow: hidden;
}
.sp-bar-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.6s;
}
.sp-count {
  width: 60px;
  text-align: right;
  font-size: 12px;
  color: var(--text-secondary);
}
.sp-rate {
  width: 48px;
  text-align: right;
  font-weight: 600;
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-secondary);
}
.empty-state .icon {
  font-size: 48px;
  margin-bottom: 16px;
}
.empty-state h3 {
  font-size: 18px;
  margin-bottom: 8px;
  color: var(--text);
}
.empty-state p {
  font-size: 13px;
}

/* ===== Exam Mode Embedded Overrides ===== */
#examApp .exam-topbar {
  top: 0;
}
#examApp .exam-passage-pane {
  max-height: calc(100vh - 200px);
}
#examApp .exam-question-pane {
  max-height: calc(100vh - 200px);
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .practice-layout {
    flex-direction: column;
    height: auto;
  }
  .score-top {
    flex-direction: column;
  }
  .top-bar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 16px;
  }
  .tab-nav {
    margin-left: 0;
    order: 10;
    width: 100%;
    overflow-x: auto;
  }
  .stat-cards {
    grid-template-columns: repeat(2, 1fr);
  }
  .dash-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .top-bar h1 {
    font-size: 15px;
  }
  .stat-cards {
    grid-template-columns: 1fr;
  }
}

/* ===== Modules Tab ===== */
.modules-layout.active {
  display: block;
  padding: 20px;
  overflow-y: auto;
}

.mod-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 20px;
}
.mod-header h2 {
  margin: 0;
  color: var(--text);
}
.mod-total {
  color: var(--text2);
  font-size: 14px;
}

.mod-group {
  margin-bottom: 28px;
}
.mod-group-title {
  color: var(--text2);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.mod-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.mod-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  transition:
    box-shadow 0.15s,
    border-color 0.15s;
}
.mod-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
}

.mod-card-name {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  font-size: 14px;
}
.mod-card-count {
  color: var(--text2);
  font-size: 12px;
  margin-bottom: 8px;
}

.mod-diff-bar {
  display: flex;
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
  background: var(--border);
  margin-bottom: 6px;
}
.mod-diff-seg {
  height: 100%;
  transition: width 0.3s;
}
.mod-diff-seg.easy {
  background: var(--correct);
}
.mod-diff-seg.medium {
  background: var(--warning);
}
.mod-diff-seg.hard {
  background: var(--wrong);
}
.mod-diff-seg.killer {
  background: #dc2626;
}

.mod-card-legend {
  display: flex;
  gap: 8px;
  font-size: 11px;
}
.mod-legend-item {
  color: var(--text3);
}
.mod-legend-item.easy {
  color: var(--correct);
}
.mod-legend-item.medium {
  color: var(--warning);
}
.mod-legend-item.hard {
  color: var(--wrong);
}
.mod-legend-item.killer {
  color: #dc2626;
}

.mod-card-coverage {
  color: var(--text3);
  font-size: 11px;
  margin-top: 4px;
}

/* Module list view */
.mod-list-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.mod-list-header h2 {
  margin: 0;
  color: var(--text);
}
.mod-list-count {
  color: var(--text2);
  font-size: 13px;
}

.mod-back-btn {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 14px;
  cursor: pointer;
  color: var(--text);
  font-size: 13px;
}
.mod-back-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.mod-filters {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}
.mod-filter-select,
.mod-filter-input {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
  color: var(--text);
  font-size: 13px;
}
.mod-filter-input {
  flex: 1;
  max-width: 260px;
}
.mod-filter-select:focus,
.mod-filter-input:focus {
  outline: none;
  border-color: var(--primary);
}

.mod-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.mod-chip {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 3px 10px;
  font-size: 12px;
  color: var(--text2);
  cursor: pointer;
  transition: all 0.15s;
}
.mod-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.mod-chip.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Question cards */
.mod-question-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mod-q-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}
/* Split layout: left passage + right question (SAT style) */
.mod-q-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}
.mod-q-split .mod-q-header {
  grid-column: 1 / -1;
}
.mod-q-split .mod-q-left {
  max-height: 70vh;
  overflow-y: auto;
  border-right: 2px solid var(--border);
  padding-right: 14px;
}
.mod-q-split .mod-q-left .mod-q-passage {
  margin-bottom: 0;
}
.mod-q-split .mod-q-right {
  display: flex;
  flex-direction: column;
}
@media (max-width: 768px) {
  .mod-q-split {
    grid-template-columns: 1fr;
  }
  .mod-q-split .mod-q-left {
    border-right: none;
    padding-right: 0;
    border-bottom: 2px solid var(--border);
    padding-bottom: 10px;
    max-height: 40vh;
  }
}

.mod-q-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.mod-q-num {
  font-weight: 700;
  color: var(--text3);
  font-size: 12px;
}

.mod-diff-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}
.mod-diff-badge.easy {
  background: var(--correct-bg);
  color: var(--correct);
}
.mod-diff-badge.medium {
  background: var(--warning-bg);
  color: var(--warning);
}
.mod-diff-badge.hard {
  background: var(--wrong-bg);
  color: var(--wrong);
}
.mod-diff-badge.killer {
  background: #fecaca;
  color: #dc2626;
  font-weight: 700;
}

.mod-q-skill {
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
}
.mod-q-topic {
  color: var(--text3);
  font-size: 12px;
}

.mod-conf {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: 600;
}
.mod-conf.high {
  background: var(--correct-bg);
  color: var(--correct);
}
.mod-conf.med {
  background: var(--warning-bg);
  color: var(--warning);
}
.mod-conf.low {
  background: var(--wrong-bg);
  color: var(--wrong);
}

.mod-q-text {
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 6px;
}

.mod-q-passage {
  color: var(--text2);
  font-size: 13px;
  line-height: 1.5;
  background: var(--bg);
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 8px;
  position: relative;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Show Answer / Hide Answer button */
.mod-reveal-btn {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 5px 14px;
  font-size: 12px;
  cursor: pointer;
  margin-top: 6px;
  margin-bottom: 6px;
}
.mod-reveal-btn:hover {
  opacity: 0.85;
}

/* Choices — ALWAYS visible */
.mod-q-choices {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mod-q-choice {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
  border: 1px solid transparent;
  transition: all 0.2s;
}
.mod-q-choice:not(.correct) {
  cursor: pointer;
}
.mod-q-choice:not(.correct):hover {
  background: var(--bg);
  border-color: var(--border);
}

/* Correct answer — hidden until .revealed */
.mod-q-choice.correct {
  background: transparent;
  border-color: transparent;
}
.mod-q-choices.revealed .mod-q-choice.correct {
  background: var(--correct-bg);
  border-color: var(--correct);
}

/* Choice labels */
.mod-q-choice-label {
  font-weight: 700;
  min-width: 18px;
  color: var(--text-secondary);
}
.mod-q-choices.revealed .mod-q-choice.correct .mod-q-choice-label {
  color: var(--correct);
}

/* Eliminated choices — strikethrough */
.mod-q-choice.eliminated {
  opacity: 0.45;
  position: relative;
}
.mod-q-choice.eliminated .mod-q-choice-text {
  text-decoration: line-through;
  text-decoration-color: var(--wrong);
  text-decoration-thickness: 2px;
}
.mod-q-choice.eliminated .mod-q-choice-label::after {
  content: "×";
  color: var(--wrong);
  font-size: 16px;
  margin-left: 2px;
}

/* Passage line highlighting */
.mod-passage-line {
  display: inline;
  cursor: pointer;
  border-radius: 2px;
  transition: background 0.15s;
}
.mod-passage-line:hover {
  background: rgba(74, 108, 247, 0.08);
}
.mod-passage-line.highlighted {
  background: #fff3bf;
  box-shadow: 0 1px 0 #f0d060;
}
[data-theme="dark"] .mod-passage-line.highlighted {
  background: rgba(255, 213, 0, 0.2);
  box-shadow: 0 1px 0 rgba(255, 213, 0, 0.3);
}
.mod-passage-collapse {
  display: block;
  text-align: center;
  font-size: 12px;
  color: var(--primary);
  cursor: pointer;
  padding: 4px;
  margin-top: 4px;
  font-weight: 600;
}
.mod-passage-collapse:hover {
  opacity: 0.7;
}

.mod-q-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}
.mod-tag {
  background: var(--primary-light);
  color: var(--primary);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
}

.mod-q-rationale {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text2);
}
.mod-q-rationale summary {
  cursor: pointer;
  color: var(--primary);
  font-weight: 600;
}
.mod-q-rationale p {
  margin: 6px 0 0;
  line-height: 1.5;
}

.mod-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
  padding: 12px 0;
}
.mod-page-btn {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 16px;
  cursor: pointer;
  color: var(--text);
  font-size: 13px;
}
.mod-page-btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}
.mod-page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.mod-page-info {
  color: var(--text2);
  font-size: 13px;
}

/* Timer bar */
.mod-timer-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 12px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.mod-timer-display {
  font-family: "Courier New", monospace;
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
  min-width: 90px;
}
.mod-timer-display.warning {
  color: var(--warning);
}
.mod-timer-display.expired {
  color: var(--wrong);
  animation: timer-blink 1s infinite;
}
@keyframes timer-blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}
.mod-timer-btn {
  padding: 4px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card-bg);
  color: var(--text1);
  cursor: pointer;
  font-size: 13px;
}
.mod-timer-btn.start {
  border-color: var(--accent);
  color: var(--accent);
}
.mod-timer-btn:hover {
  background: var(--hover-bg);
}
.mod-timer-label {
  color: var(--text3);
  font-size: 12px;
  margin-left: auto;
}

.mod-error {
  color: var(--wrong);
  padding: 40px;
  text-align: center;
  font-size: 16px;
}

@media (max-width: 640px) {
  .mod-grid {
    grid-template-columns: 1fr;
  }
  .mod-filters {
    flex-direction: column;
  }
  .mod-filter-input {
    max-width: 100%;
  }
}

/* ===== Error Book Tab ===== */
.errorbook-layout {
  flex-direction: column;
  padding: 20px;
  max-width: 960px;
  margin: 0 auto;
  overflow-y: auto;
}

/* ===== Adaptive Practice Tab ===== */
.adaptive-layout.active {
  display: block;
  padding: 0;
  overflow-y: auto;
}

.eb-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 20px;
}
.eb-header h2 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
}
.eb-total {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Global stats */
.eb-global-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}
.eb-stat-section {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  border: 1px solid var(--border);
}
.eb-stat-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

/* Bar chart rows (shared) */
.eb-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
}
.eb-bar-label {
  min-width: 130px;
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}
.eb-bar-track {
  flex: 1;
  height: 8px;
  background: var(--bg);
  border-radius: 4px;
  overflow: hidden;
}
.eb-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s;
}
.eb-bar-num {
  min-width: 30px;
  text-align: right;
  font-size: 0.82rem;
  color: var(--text-secondary);
}
.eb-practice-link {
  padding: 2px 8px;
  border: 1px solid var(--primary);
  border-radius: 3px;
  background: transparent;
  color: var(--primary);
  font-size: 0.75rem;
  cursor: pointer;
  white-space: nowrap;
}
.eb-practice-link:hover {
  background: var(--primary);
  color: #fff;
}

/* Elimination grid */
.eb-elim-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  margin: 8px 0;
}
.eb-elim-card {
  text-align: center;
  padding: 12px 8px;
  border-radius: 10px;
  background: var(--bg);
}
.eb-elim-num {
  font-size: 1.4rem;
  font-weight: 700;
}
.eb-elim-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Student cards grid */
.eb-student-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.eb-student-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}
.eb-student-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
}
.eb-card-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.eb-card-count {
  font-size: 0.9rem;
  color: var(--wrong);
  font-weight: 600;
}
.eb-card-top-module {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 6px;
}
.eb-card-date {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-top: 4px;
}

/* Detail view */
.eb-search-row {
  margin-bottom: 12px;
}
.eb-search {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
  font-size: 13px;
  width: 100%;
  max-width: 400px;
  box-sizing: border-box;
}
.eb-search::placeholder {
  color: var(--text-secondary);
}
.eb-detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.eb-detail-header h2 {
  font-size: 1.3rem;
  font-weight: 700;
}
.eb-detail-count {
  font-size: 0.85rem;
  color: var(--wrong);
  font-weight: 600;
}
.eb-back-btn {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 14px;
  cursor: pointer;
  color: var(--text);
  font-size: 0.85rem;
}
.eb-back-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* Sections */
.eb-section {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 16px;
  margin-bottom: 16px;
}
.eb-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.eb-section-icon {
  font-size: 1.1rem;
}

/* Error cards */
.eb-error-card {
  background: var(--bg);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 12px;
  border-left: 3px solid var(--border);
}
.eb-error-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.eb-error-date {
  font-size: 0.78rem;
  color: var(--text-tertiary);
}
.eb-error-module {
  font-size: 0.75rem;
  background: var(--primary-light);
  color: var(--primary);
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
}
.eb-error-conf {
  font-size: 0.72rem;
  padding: 2px 6px;
  border-radius: 8px;
  font-weight: 500;
}
.eb-conf-high {
  background: var(--correct-bg);
  color: var(--correct);
}
.eb-conf-medium {
  background: var(--warning-bg);
  color: var(--warning);
}
.eb-conf-low {
  background: var(--wrong-bg);
  color: var(--wrong);
}

.eb-error-question {
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text);
  margin-bottom: 8px;
}
.eb-error-answers {
  display: flex;
  gap: 16px;
  margin-bottom: 8px;
  font-size: 0.85rem;
}
.eb-answer-label {
  color: var(--text-secondary);
}
.eb-answer-wrong {
  color: var(--wrong);
  font-weight: 600;
}
.eb-answer-correct {
  color: var(--correct);
  font-weight: 600;
}

.eb-error-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.eb-pill {
  font-size: 0.78rem;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 12px;
  border: 1px solid;
  background: transparent;
}

.eb-error-detail {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 6px;
}
.eb-error-note {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--warning);
  background: var(--warning-bg);
  padding: 8px 10px;
  border-radius: 6px;
  margin-top: 6px;
}
.eb-note-icon {
  font-size: 0.9rem;
}
.eb-error-link {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-top: 6px;
}

/* Empty state */
.eb-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}
.eb-empty-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}
.eb-empty h3 {
  font-size: 1.1rem;
  margin-bottom: 8px;
  color: var(--text);
}
.eb-empty p {
  font-size: 0.88rem;
  max-width: 360px;
  margin: 0 auto;
  line-height: 1.5;
}
.eb-empty-hint {
  font-size: 0.85rem;
  color: var(--text-tertiary);
  padding: 8px 0;
}

@media (max-width: 640px) {
  .eb-global-stats {
    grid-template-columns: 1fr;
  }
  .eb-student-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== Theme + Wallpaper Picker ===== */
.theme-wp-container {
  position: fixed;
  bottom: 16px;
  left: 16px;
  z-index: 999;
  display: flex;
  align-items: center;
  gap: 6px;
}
.theme-switcher {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
}
.theme-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0;
}
.theme-btn:hover {
  transform: scale(1.15);
}
.theme-btn.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(74, 108, 247, 0.2);
}
.theme-btn[data-t="light"] {
  background: #ffffff;
  border-color: #ddd;
}
.theme-btn[data-t="dark"] {
  background: #1a1d27;
  border-color: #444;
}
.theme-btn[data-t="eye"] {
  background: #c8ceaa;
  border-color: #a8ae8a;
}

.wp-toggle-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  box-shadow: var(--shadow);
  transition: transform 0.2s;
}
.wp-toggle-btn:hover {
  transform: scale(1.1);
}
.wp-panel {
  position: absolute;
  bottom: 42px;
  right: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  padding: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  min-width: 200px;
}
.wp-btn {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
}
.wp-btn:hover {
  transform: scale(1.15);
}
.wp-btn.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(74, 108, 247, 0.2);
}

/* Skeleton loading screens */
@keyframes ll-shimmer {
  0% {
    background-position: -400px 0;
  }
  100% {
    background-position: 400px 0;
  }
}
.ll-skeleton {
  padding: 24px;
}
.ll-skel-card {
  background: var(--card);
  border-radius: var(--radius, 8px);
  padding: 16px;
  margin-bottom: 12px;
}
.ll-skel-bar {
  background: linear-gradient(
    90deg,
    var(--bg, #f0f2f5) 25%,
    var(--card, #e8e8e8) 50%,
    var(--bg, #f0f2f5) 75%
  );
  background-size: 800px 100%;
  animation: ll-shimmer 1.5s infinite linear;
  border-radius: 4px;
}
.ll-skel-heading {
  height: 24px;
  width: 200px;
  margin-bottom: 16px;
}
.ll-skel-title {
  height: 16px;
  width: 60%;
  margin-bottom: 10px;
}
.ll-skel-text {
  height: 12px;
  width: 90%;
  margin-bottom: 8px;
}
.ll-skel-text.short {
  width: 40%;
}

/* ===== Data Management Panel ===== */
.dm-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 13px;
}
.dm-stat-row.dm-stat-sub {
  padding-left: 12px;
  font-size: 12px;
  color: var(--text-secondary);
}
.dm-stat-label {
  color: var(--text-secondary);
}
.dm-stat-value {
  font-weight: 600;
  color: var(--text);
}
.dm-breakdown {
  border-top: 1px solid var(--border);
  margin: 8px 0;
  padding-top: 6px;
}
.dm-btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.dm-btn {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font);
}
.dm-btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}
.dm-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.dm-btn-accent {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.dm-btn-accent:hover:not(:disabled) {
  opacity: 0.85;
  color: #fff;
}
.dm-danger-row {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.dm-btn-danger {
  background: transparent;
  color: var(--wrong);
  border-color: var(--wrong);
}
.dm-btn-danger:hover:not(:disabled) {
  background: var(--wrong);
  color: #fff;
  border-color: var(--wrong);
}
.dm-offline-badge {
  text-align: center;
  padding: 8px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
  color: var(--correct);
  background: var(--correct-bg);
  margin-top: 12px;
}
.dm-offline-badge.offline {
  color: var(--warning);
  background: var(--warning-bg);
}
