/* ============================================================
   VCE Practice Exam — Dark Theme CSS
   ============================================================ */

/* Design Tokens */
:root {
  --bg:           #1e2130;
  --bg-alt:       #181b27;
  --surface:      #252a3a;
  --surface-2:    #2d3347;
  --surface-3:    #353d55;
  --border:       #3a4260;
  --border-light: #46506e;

  --text:         #dde3f0;
  --text-soft:    #b0bbcf;
  --muted:        #7a88a8;

  --primary:      #6d9eeb;
  --primary-dim:  rgba(109, 158, 235, 0.15);
  --primary-hover: #84b0f0;

  --correct:      #4caf82;
  --correct-dim:  rgba(76, 175, 130, 0.15);
  --correct-border: rgba(76, 175, 130, 0.6);

  --incorrect:    #e06c75;
  --incorrect-dim: rgba(224, 108, 117, 0.15);
  --incorrect-border: rgba(224, 108, 117, 0.6);

  --mark:         #e5a445;
  --mark-dim:     rgba(229, 164, 69, 0.2);

  --danger:       #e06c75;
  --danger-hover: #e88a92;

  --radius-sm:    6px;
  --radius:       10px;
  --radius-lg:    16px;
  --shadow:       0 4px 24px rgba(0,0,0,0.4);
  --shadow-sm:    0 2px 8px rgba(0,0,0,0.3);

  --transition:   150ms ease;
  --transition-med: 250ms ease;
}

/* Base Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans KR', sans-serif;
  background: var(--bg-alt);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
  -webkit-tap-highlight-color: transparent;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* View Transitions */
#app.view-transitioning {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity var(--transition), transform var(--transition);
}
#app.view-enter {
  animation: viewEnter 250ms ease forwards;
}
@keyframes viewEnter {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   Utility
   ============================================================ */
.hidden { display: none !important; }
.fade-in { animation: fadeIn 300ms ease forwards; }
.scale-in { animation: scaleIn 200ms ease forwards; }

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

/* Slide animations for quiz questions */
.slide-out-left  { animation: slideOutLeft 150ms ease forwards; }
.slide-out-right { animation: slideOutRight 150ms ease forwards; }
.slide-in-right  { animation: slideInRight 250ms ease forwards; }
.slide-in-left   { animation: slideInLeft 250ms ease forwards; }

@keyframes slideOutLeft  { to { opacity:0; transform: translateX(-40px); } }
@keyframes slideOutRight { to { opacity:0; transform: translateX(40px); } }
@keyframes slideInRight  { from { opacity:0; transform: translateX(40px); } to { opacity:1; transform:none; } }
@keyframes slideInLeft   { from { opacity:0; transform: translateX(-40px); } to { opacity:1; transform:none; } }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  font-family: inherit;
  transition: background var(--transition), transform var(--transition), opacity var(--transition), box-shadow var(--transition);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn-primary {
  background: var(--primary);
  color: #0d1520;
  font-weight: 600;
}
.btn-primary:hover { background: var(--primary-hover); box-shadow: 0 0 20px rgba(109,158,235,0.3); }

.btn-outline {
  background: transparent;
  color: var(--text-soft);
  border: 1px solid var(--border);
}
.btn-outline:hover { background: var(--surface-2); border-color: var(--border-light); color: var(--text); }

.btn-accent {
  background: var(--incorrect);
  color: #0d1520;
  font-weight: 600;
}
.btn-accent:hover { background: #e88790; box-shadow: 0 0 20px rgba(224,108,117,0.3); }

.btn-ghost {
  background: transparent;
  color: var(--text-soft);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-danger {
  background: var(--danger);
  color: #fff;
  font-weight: 600;
}
.btn-danger:hover { background: var(--danger-hover); }

.btn-lg {
  padding: 14px 28px;
  font-size: 1rem;
  border-radius: var(--radius);
}

.btn-icon { width: 18px; height: 18px; }

.btn.pulse { animation: pulse 0.5s ease; }
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(109,158,235,0.4); }
  70%  { box-shadow: 0 0 0 12px rgba(109,158,235,0); }
  100% { box-shadow: 0 0 0 0 rgba(109,158,235,0); }
}

/* ============================================================
   Back Button
   ============================================================ */
.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--text-soft);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
  font-family: inherit;
}
.btn-back:hover { background: var(--surface-2); color: var(--text); }
.btn-back svg { width: 16px; height: 16px; }

/* ============================================================
   HOME VIEW
   ============================================================ */
.home-view {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.home-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  box-shadow: var(--shadow);
}

.home-logo svg {
  width: 72px;
  height: 72px;
}

.home-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
}

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

/* File Drop Area */
.file-drop-area {
  width: 100%;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 36px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.file-drop-area:hover,
.file-drop-area.drag-over {
  border-color: var(--primary);
  background: var(--primary-dim);
}
.file-drop-area.has-file {
  border-color: var(--correct-border);
  background: var(--correct-dim);
}
.file-drop-icon svg {
  width: 40px;
  height: 40px;
  color: var(--muted);
  transition: color var(--transition);
}
.file-drop-area:hover .file-drop-icon svg { color: var(--primary); }
.file-drop-text {
  color: var(--text-soft);
  font-size: 0.95rem;
}
.file-drop-sub {
  color: var(--muted);
  font-size: 0.8rem;
}

/* File Info */
.file-info {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.file-info-content {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.file-info-icon {
  width: 20px;
  height: 20px;
  color: var(--correct);
  flex-shrink: 0;
  margin-top: 2px;
}
.file-info-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
}
.file-info-meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 2px;
}
.file-info-error {
  color: var(--incorrect);
  font-size: 0.85rem;
}

.previous-session-area {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  text-align: center;
}
.previous-session-hint {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 10px;
}

/* ============================================================
   CONFIG VIEW
   ============================================================ */
.config-view {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
}

.config-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 24px 0;
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-alt);
  padding-bottom: 12px;
}

.config-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

.config-body {
  padding: 16px 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

.config-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.config-section-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 14px;
}

/* Exam Checkboxes */
.exam-checkboxes { display: flex; flex-direction: column; gap: 10px; }

.exam-checkbox-label {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.exam-checkbox-label:hover { background: var(--surface-2); }

.exam-checkbox-label input[type="checkbox"] { display: none; }

.checkbox-custom {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-radius: 5px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), border-color var(--transition);
}
.exam-checkbox-label input:checked + .checkbox-custom {
  background: var(--primary);
  border-color: var(--primary);
}
.exam-checkbox-label input:checked + .checkbox-custom::after {
  content: '';
  width: 5px;
  height: 9px;
  border: 2px solid #0d1520;
  border-top: none;
  border-left: none;
  transform: rotate(45deg) translateY(-1px);
}

.exam-check-text { display: flex; flex-direction: column; }
.exam-check-name { font-weight: 500; font-size: 0.95rem; }
.exam-check-count { font-size: 0.8rem; color: var(--muted); }

/* Range mode tabs */
.range-mode-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}
.range-mode-tab {
  flex: 1;
  padding: 8px 12px;
  font-size: 0.82rem;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-soft);
  cursor: pointer;
  transition: all var(--transition);
}
.range-mode-tab:hover { border-color: var(--border-light); color: var(--text); }
.range-mode-tab.active {
  background: var(--primary-dim);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}

.range-count-desc {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 4px;
  margin-left: 4px;
}

/* Range */
.range-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.range-field { display: flex; flex-direction: column; gap: 4px; }
.range-label { font-size: 0.78rem; color: var(--muted); }
.range-input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 8px 12px;
  font-size: 0.9rem;
  font-family: inherit;
  width: 100px;
  transition: border-color var(--transition);
  outline: none;
}
.range-input:focus { border-color: var(--primary); }
.range-separator { color: var(--muted); font-size: 1.2rem; margin-top: 20px; }
.range-hint { font-size: 0.8rem; color: var(--muted); margin-top: 8px; }

/* Toggle */
.toggle-list { display: flex; flex-direction: column; gap: 4px; }
.toggle-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
  gap: 12px;
}
.toggle-label:hover { background: var(--surface-2); }
.toggle-text { font-size: 0.95rem; color: var(--text-soft); }

.toggle-switch { position: relative; display: inline-block; }
.toggle-switch input { display: none; }
.toggle-slider {
  display: block;
  width: 44px;
  height: 24px;
  background: var(--surface-3);
  border-radius: 12px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  position: relative;
}
.toggle-slider::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  background: var(--muted);
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: transform var(--transition), background var(--transition);
}
.toggle-switch input:checked + .toggle-slider {
  background: var(--primary-dim);
  border-color: var(--primary);
}
.toggle-switch input:checked + .toggle-slider::after {
  transform: translateX(20px);
  background: var(--primary);
}

/* Mode Options */
.mode-options { display: flex; flex-direction: column; gap: 10px; }
.mode-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}
.mode-option:hover { background: var(--surface-2); }
.mode-option.active { border-color: var(--primary); background: var(--primary-dim); }
.mode-option input { display: none; }
.mode-icon svg {
  width: 24px;
  height: 24px;
  color: var(--muted);
  flex-shrink: 0;
}
.mode-option.active .mode-icon svg { color: var(--primary); }
.mode-name { font-weight: 600; font-size: 0.9rem; }
.mode-desc { font-size: 0.8rem; color: var(--muted); margin-top: 2px; }

/* Time */
.time-options { display: flex; flex-direction: column; gap: 10px; }
.time-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  transition: opacity var(--transition);
}
.time-unit { color: var(--muted); font-size: 0.9rem; }

/* Config Footer */
.config-footer {
  padding: 20px 24px;
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  position: sticky;
  bottom: 0;
}
.config-footer .btn { width: 100%; justify-content: center; }

/* ============================================================
   QUIZ VIEW
   ============================================================ */
.quiz-view {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

/* Quiz Header */
.quiz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 10px;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 12px;
}
.quiz-header-left, .quiz-header-right {
  flex: 1;
  display: flex;
  align-items: center;
}
.quiz-header-right { justify-content: flex-end; }

.btn-home {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted);
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  flex-shrink: 0;
  margin-right: 8px;
}
.btn-home svg { width: 16px; height: 16px; }
.btn-home:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-light); }
.btn-home:active { transform: scale(0.95); }

.training-badge {
  background: var(--mark-dim);
  color: var(--mark);
  border: 1px solid rgba(229,164,69,0.3);
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.quiz-progress-text {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-soft);
  text-align: center;
  flex: 0;
  white-space: nowrap;
}

.timer-display {
  font-family: 'SF Mono', 'Fira Mono', monospace;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-soft);
  transition: color var(--transition);
  letter-spacing: 0.5px;
}
.timer-display.timer-warning { color: var(--mark); }
.timer-display.timer-danger { color: var(--incorrect); animation: timerBlink 1s ease infinite; }
@keyframes timerBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Progress Bar */
.quiz-progress-bar {
  height: 8px;
  display: flex;
  background: var(--surface-2);
  flex-shrink: 0;
  overflow: visible;
  cursor: pointer;
  position: relative;
  user-select: none;
}
.quiz-progress-bar:hover { height: 10px; }
.progress-seg {
  height: 100%;
  background: var(--surface-3);
  transition: background var(--transition-med);
}
.progress-seg.answered { background: var(--primary); opacity: 0.7; }
.progress-seg.marked   { background: var(--mark); }
.progress-seg.current  { background: var(--primary); opacity: 1; }

.progress-tooltip {
  display: none;
  position: absolute;
  top: -26px;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  pointer-events: none;
  white-space: nowrap;
  z-index: 10;
}
.progress-tooltip.visible { display: block; }

/* Quiz Body */
.quiz-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.question-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  min-height: 300px;
}

.question-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.question-exam-tag {
  background: var(--primary-dim);
  color: var(--primary);
  border: 1px solid rgba(109,158,235,0.3);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}
.question-num {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
}
.multi-hint {
  background: var(--mark-dim);
  color: var(--mark);
  border: 1px solid rgba(229,164,69,0.3);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.question-body {
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text);
  margin-bottom: 20px;
  word-break: keep-all;
}
.question-image {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin: 12px 0;
  display: block;
}

.question-code-image {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin: 12px 0 4px;
  display: block;
  background: #1a1d23;
}

/* Options */
.options-list { display: flex; flex-direction: column; gap: 8px; }

.option-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), transform 80ms ease;
  position: relative;
  user-select: none;
}
.option-item:hover { background: var(--surface-2); border-color: var(--border-light); }
.option-item:active { transform: scale(0.99); }
.option-item.selected { border-color: var(--primary); background: var(--primary-dim); }
.option-item.correct {
  border-color: var(--correct-border);
  background: var(--correct-dim);
  animation: highlightIn 300ms ease;
}
.option-item.incorrect {
  border-color: var(--incorrect-border);
  background: var(--incorrect-dim);
  animation: highlightIn 300ms ease;
}
@keyframes highlightIn {
  from { opacity: 0.5; transform: scale(0.99); }
  to   { opacity: 1; transform: scale(1); }
}

.option-input { display: none; }

.option-letter {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--muted);
  min-width: 20px;
  padding-top: 1px;
  flex-shrink: 0;
  transition: color var(--transition);
}
.option-item.selected .option-letter { color: var(--primary); }
.option-item.correct .option-letter  { color: var(--correct); }
.option-item.incorrect .option-letter { color: var(--incorrect); }

.option-text {
  flex: 1;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-soft);
  word-break: keep-all;
  transition: color var(--transition);
}
.option-item.selected .option-text  { color: var(--text); }
.option-item.correct .option-text   { color: var(--text); }
.option-item.incorrect .option-text { color: var(--text); }

.option-check {
  width: 18px;
  height: 18px;
  color: var(--correct);
  flex-shrink: 0;
  margin-top: 2px;
}

/* Explanation */
.explanation-box {
  margin-top: 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.explanation-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.explanation-icon { width: 16px; height: 16px; }
.explanation-text {
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--text-soft);
  word-break: keep-all;
}

/* Quiz Footer */
.quiz-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  gap: 8px;
}
.quiz-footer-center {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Mark Button */
#markBtn.marked {
  background: var(--mark-dim);
  border-color: rgba(229,164,69,0.4);
  color: var(--mark);
}
#markBtn svg { width: 16px; height: 16px; }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
  backdrop-filter: blur(4px);
}
.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  max-width: 380px;
  text-align: center;
  box-shadow: var(--shadow);
}
.modal-icon {
  margin-bottom: 16px;
  display: flex;
  justify-content: center;
}
.modal-icon svg {
  width: 40px;
  height: 40px;
  color: var(--mark);
}
.modal-message {
  font-size: 0.95rem;
  color: var(--text-soft);
  line-height: 1.7;
  margin-bottom: 24px;
}
.modal-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.modal-buttons .btn { flex: 1; justify-content: center; }

/* ============================================================
   RESULTS VIEW
   ============================================================ */
.results-view {
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
  padding: 0 0 40px;
}

.results-hero {
  padding: 48px 24px 36px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.results-hero.passing { background: linear-gradient(135deg, var(--surface) 60%, rgba(76,175,130,0.08)); }
.results-hero.failing { background: linear-gradient(135deg, var(--surface) 60%, rgba(224,108,117,0.08)); }

.results-status-icon svg {
  width: 56px;
  height: 56px;
  stroke-width: 1.5;
}
.passing .results-status-icon svg { color: var(--correct); }
.failing .results-status-icon svg { color: var(--incorrect); }

.results-status-text {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 2px;
}
.passing .results-status-text { color: var(--correct); }
.failing .results-status-text { color: var(--incorrect); }

.results-score-big {
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.results-pct {
  font-size: 1.1rem;
  color: var(--muted);
}
.results-pct-passing {
  font-size: 0.85rem;
  color: var(--muted);
  opacity: 0.7;
}

/* Score Cards */
.results-cards {
  display: flex;
  gap: 1px;
  background: var(--border);
  border-bottom: 1px solid var(--border);
}
.results-card {
  flex: 1;
  background: var(--surface);
  padding: 20px 16px;
  text-align: center;
}
.results-card-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.results-card-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.results-card-value.value-correct  { color: var(--correct); }
.results-card-value.value-incorrect { color: var(--incorrect); }
.results-card-sub {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 4px;
}

/* Results Progress */
.results-progress-wrap {
  padding: 20px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.results-progress-bar {
  height: 12px;
  background: var(--surface-3);
  border-radius: 6px;
  overflow: hidden;
}
.results-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--correct));
  border-radius: 6px;
  width: 0%;
  transition: width 800ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Wrong Section */
.wrong-section { padding: 24px; }
.wrong-section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-soft);
  margin-bottom: 14px;
}

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

.wrong-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color var(--transition);
}
.wrong-item:hover { border-color: var(--border-light); }

.wrong-item-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  flex-wrap: wrap;
}
.wrong-exam-tag {
  background: var(--primary-dim);
  color: var(--primary);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  flex-shrink: 0;
}
.wrong-q-num {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--muted);
  flex-shrink: 0;
}
.wrong-q-body {
  flex: 1;
  font-size: 0.9rem;
  color: var(--text-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.btn-review {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-soft);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background var(--transition), color var(--transition);
}
.btn-review:hover { background: var(--surface-3); color: var(--text); }

.wrong-item-detail {
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg);
}
.wrong-answer-row, .wrong-explanation {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 0.85rem;
}
.wrong-label {
  font-weight: 600;
  font-size: 0.72rem;
  padding: 2px 6px;
  border-radius: 3px;
  flex-shrink: 0;
  margin-top: 1px;
  text-transform: uppercase;
}
.wrong-label-user    { background: var(--incorrect-dim); color: var(--incorrect); }
.wrong-label-correct { background: var(--correct-dim); color: var(--correct); }
.wrong-answer-text { color: var(--text-soft); line-height: 1.5; }
.incorrect-text { color: var(--incorrect); }
.correct-text   { color: var(--correct); }
.wrong-explanation-text { color: var(--muted); line-height: 1.6; }

.perfect-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 48px 24px;
  color: var(--correct);
  font-size: 1.1rem;
  font-weight: 600;
}
.perfect-message svg { width: 48px; height: 48px; }

/* Results Actions */
.results-actions {
  display: flex;
  gap: 12px;
  padding: 0 24px;
  justify-content: center;
  flex-wrap: wrap;
}
.results-actions .btn { flex: 1; justify-content: center; max-width: 200px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Tablet */
@media (max-width: 768px) {
  .quiz-footer-center { gap: 6px; }
  .quiz-footer .btn { padding: 10px 14px; font-size: 0.85rem; }
  .results-cards { flex-wrap: wrap; }
  .results-card { min-width: 50%; flex: none; }
  .home-card { padding: 36px 24px; }
}

/* Mobile */
@media (max-width: 480px) {
  .quiz-header { padding: 10px 14px 8px; }
  .quiz-body { padding: 12px; }
  .question-card { padding: 16px; border-radius: var(--radius); }
  .question-body { font-size: 0.95rem; }
  .option-item { padding: 10px 12px; }
  .option-text { font-size: 0.88rem; }

  .quiz-footer {
    flex-wrap: wrap;
    padding: 10px 14px;
    gap: 8px;
  }
  .quiz-footer-center {
    order: -1;
    width: 100%;
    justify-content: center;
  }
  .quiz-footer #prevBtn, .quiz-footer #nextBtn {
    flex: 1;
    justify-content: center;
  }

  .results-card { min-width: 100%; }
  .results-score-big { font-size: 2rem; }
  .results-hero { padding: 36px 16px 24px; }
  .wrong-item-header { gap: 6px; }
  .wrong-q-body { display: none; }

  .config-header { padding: 14px 16px 10px; }
  .config-body { padding: 12px 16px; }
  .config-footer { padding: 14px 16px; }

  .home-card { padding: 28px 20px; gap: 16px; }
  .home-title { font-size: 1.5rem; }
  .file-drop-area { padding: 28px 16px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
