/* ============================================
   Go Play Donate — Employee Test App
   Clean Minimal Theme
   ============================================ */

:root {
  /* Brand colors — used sparingly */
  --gold: #ffc814;
  --gold2: #ffe566;
  --gold-dark: #e6b000;
  --gold-glow: rgba(255,200,20,.08);
  --gold-border: rgba(255,200,20,.20);

  /* Light backgrounds */
  --bg-page: #F5F5F7;
  --bg-card: #FFFFFF;
  --bg-surface: #F0F0F3;
  --bg-elevated: #E8E8EC;
  --bg-dark: #141418;
  --bg-dark2: #1f1f28;

  /* Borders */
  --border-color: #E0E0E4;
  --border-light: #EBEBEF;

  /* Text */
  --text-primary: #141418;
  --text-secondary: #555555;
  --text-muted: #888899;
  --text-dim: #AAAABB;

  /* Status */
  --green: #22C55E;
  --green-bg: #ECFDF5;
  --green-border: #86EFAC;
  --red: #EF4444;
  --red-bg: #FEF2F2;
  --red-border: #FECACA;

  /* Shadows — very subtle */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 1px 4px rgba(0,0,0,0.06);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-gold: none;

  /* Layout */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --safe-top: env(safe-area-inset-top);
  --safe-bottom: env(safe-area-inset-bottom);

  /* Gradients — toned down */
  --gradient: linear-gradient(135deg, #141418, #2a2a35);
  --gradient-dark: linear-gradient(135deg, #141418, #1f1f28);
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---- Screens ---- */
.screen {
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.screen.active {
  display: flex;
  flex-direction: column;
  opacity: 1;
  min-height: 100dvh;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 44px;
  text-decoration: none;
  letter-spacing: 0.01em;
}

.btn:active {
  transform: scale(0.98);
}

/* Primary — clean dark button, white text */
.btn-primary {
  background: var(--bg-dark);
  color: #FFFFFF;
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}

.btn-primary:hover {
  background: var(--bg-dark2);
  box-shadow: var(--shadow);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background: var(--bg-surface);
  border-color: #ccc;
}

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

.btn-outline:hover {
  background: var(--bg-surface);
  border-color: #ccc;
}

.btn-danger {
  background: var(--red);
  color: white;
}

.btn-danger:hover {
  background: #DC2626;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 8px;
  min-height: auto;
}

.btn-ghost:hover {
  color: var(--red);
}

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

.btn-sm {
  padding: 8px 16px;
  font-size: 0.82rem;
  min-height: 36px;
}

.btn-icon {
  background: transparent;
  border: none;
  padding: 8px;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.btn-icon:hover {
  background: var(--bg-surface);
  color: var(--text-secondary);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
}

/* (btn-finish removed — auto-finish) */

/* (force-finish button removed — auto-finish when all answered) */

/* ---- Input ---- */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.input-group input {
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 1rem;
  color: var(--text-primary);
  background: var(--bg-card);
  transition: border-color 0.15s;
  min-height: 48px;
  font-weight: 500;
}

.input-group input:focus {
  outline: none;
  border-color: var(--text-muted);
}

.input-group input::placeholder {
  color: var(--text-dim);
  font-weight: 400;
}

/* ---- PIN Input ---- */
.pin-container {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.pin-input {
  width: 56px;
  height: 64px;
  text-align: center;
  font-size: 1.6rem;
  font-weight: 700;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-primary);
  transition: all 0.15s;
  font-family: inherit;
  caret-color: var(--text-primary);
}

.pin-input:focus {
  outline: none;
  border-color: var(--text-secondary);
}

.pin-input.filled {
  border-color: var(--text-secondary);
  background: var(--bg-surface);
}

/* ============================================
   Screen 1: Registration
   ============================================ */
.register-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 40px 24px;
  padding-top: calc(40px + var(--safe-top));
  max-width: 440px;
  margin: 0 auto;
  width: 100%;
  position: relative;
}

/* Background decorations — removed / invisible */
.register-bg-decor {
  display: none;
}

.register-bg-decor2 {
  display: none;
}

.register-logo {
  margin-bottom: 16px;
  position: relative;
}

.logo-img {
  height: 100px;
  width: auto;
  object-fit: contain;
}

.register-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.register-info {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 4px;
  margin-bottom: 32px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.register-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.register-form .btn-lg {
  margin-top: 8px;
  width: 100%;
}

.pin-label {
  text-align: center;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

/* ============================================
   Screen 2: Test
   ============================================ */
.test-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(245,245,247,0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 10px 16px;
  padding-top: calc(10px + var(--safe-top));
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border-light);
}

.progress-section {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
}

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

/* Progress fill — simple gray-to-dark, no gold */
.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--bg-dark);
  border-radius: 2px;
  transition: width 0.4s ease;
}

.progress-text {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 38px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.timer {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  background: var(--bg-surface);
  padding: 4px 10px;
  border-radius: 8px;
}

/* Streak + XP bar */
.gamification-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 0 4px;
}

/* Streak badge — subtle by default, gold only when active */
.streak-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 20px;
  background: var(--bg-surface);
  color: var(--text-muted);
  transition: all 0.3s;
}

.streak-badge.active {
  background: linear-gradient(135deg, #ffc814, #ffe566);
  color: var(--bg-dark);
  box-shadow: var(--shadow);
  animation: streakPulse 0.5s ease;
}

@keyframes streakPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

/* Answer timeline — colored segments for each answer */
.answer-timeline {
  flex: 1;
  display: flex;
  align-items: center;
  height: 6px;
  background: var(--bg-elevated);
  border-radius: 3px;
  overflow: hidden;
  gap: 1px;
}

.answer-timeline .seg {
  height: 100%;
  flex: 1;
  border-radius: 1px;
  transition: background 0.3s ease;
  background: transparent;
}

.answer-timeline .seg.correct {
  background: var(--green);
}

.answer-timeline .seg.wrong {
  background: var(--red);
}

.answer-timeline .seg.current {
  background: var(--bg-dark);
  opacity: 0.25;
  animation: segPulse 1.2s ease infinite;
}

@keyframes segPulse {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 0.4; }
}

/* ---- Footer confirm button ---- */
.btn-confirm-footer {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  min-height: 44px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--bg-surface);
  color: var(--text-dim);
}

.btn-confirm-footer:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Active = option selected, ready to confirm — green */
.btn-confirm-footer.active {
  background: var(--green);
  color: #FFFFFF;
  border-color: var(--green);
  box-shadow: var(--shadow-sm);
}

.btn-confirm-footer.active:active {
  transform: scale(0.98);
}

/* Answered = show "Далее" style — dark */
.btn-confirm-footer.answered {
  background: var(--bg-dark);
  color: #FFFFFF;
  border-color: var(--bg-dark);
  box-shadow: var(--shadow-sm);
}

.btn-confirm-footer.answered:active {
  transform: scale(0.98);
}

/* ---- Show explanation hint button ---- */
.btn-show-explanation {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding: 8px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-show-explanation:hover {
  border-color: #ccc;
  color: var(--text-secondary);
}

.btn-show-explanation svg {
  flex-shrink: 0;
}

/* ---- Feedback popup overlay ---- */
.feedback-overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(20,20,24,0);
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  transition: background 0.25s ease, backdrop-filter 0.25s ease;
}

.feedback-overlay.active {
  background: rgba(20,20,24,0.35);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.feedback-overlay.closing {
  background: rgba(20,20,24,0);
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
}

.feedback-popup {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 28px 24px 24px;
  max-width: 360px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  text-align: center;
  position: relative;
  opacity: 0;
  transform: scale(0.92) translateY(12px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.feedback-overlay.active .feedback-popup {
  opacity: 1;
  transform: scale(1) translateY(0);
}

.feedback-overlay.closing .feedback-popup {
  opacity: 0;
  transform: scale(0.95) translateY(8px);
}

.feedback-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg-surface);
  border-radius: 50%;
  font-size: 1.3rem;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  line-height: 1;
}

.feedback-close:hover {
  background: var(--bg-elevated);
  color: var(--text-secondary);
}

.feedback-icon {
  margin-bottom: 8px;
}

.feedback-title {
  font-size: 1.2rem;
  font-weight: 800;
  margin-bottom: 12px;
}

.feedback-popup.correct .feedback-title {
  color: var(--green);
}

.feedback-popup.wrong .feedback-title {
  color: var(--red);
}

.feedback-correct-answer {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 14px;
  background: var(--green-bg);
  border: 1px solid var(--green-border);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  text-align: left;
}

.feedback-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.feedback-answer-text {
  font-size: 0.88rem;
  font-weight: 600;
  color: #166534;
  line-height: 1.5;
}

.feedback-explanation {
  padding: 10px 14px;
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  color: var(--text-secondary);
  line-height: 1.6;
  text-align: left;
  border-left: 3px solid var(--green);
}

.test-content {
  flex: 1;
  padding: 16px;
  padding-top: calc(68px + var(--safe-top));
  padding-bottom: calc(80px + var(--safe-bottom));
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
}

.question-card {
  animation: cardIn 0.25s ease;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes cardOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(-16px); }
}

.question-meta {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.question-number {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.question-text {
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.6;
  margin-bottom: 20px;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background: var(--bg-card);
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 48px;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  overflow: hidden;
}

.option:hover {
  border-color: #ccc;
  background: var(--bg-surface);
}

/* Selected option — subtle light gray, no gold glow */
.option.selected {
  border-color: var(--text-muted);
  background: #F0F0F3;
}

.option-letter {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--bg-surface);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 700;
  flex-shrink: 0;
  transition: all 0.15s;
  position: relative;
  z-index: 1;
}

/* Selected option letter — dark bg, white text, no gold */
.option.selected .option-letter {
  background: var(--bg-dark);
  color: #FFFFFF;
}

.option-text {
  flex: 1;
  font-size: 0.92rem;
  line-height: 1.5;
  padding-top: 3px;
  position: relative;
  z-index: 1;
  font-weight: 500;
  color: var(--text-secondary);
}

.option.selected .option-text {
  color: var(--text-primary);
}

/* Locked state — after answer submitted */
.option.locked {
  pointer-events: none;
  cursor: default;
  opacity: 0.7;
}

.option.locked:hover {
  border-color: var(--border-color);
  background: var(--bg-card);
}

/* Correct answer — green */
.option.locked.correct {
  border-color: var(--green-border);
  background: var(--green-bg);
  opacity: 1;
}

.option.locked.correct .option-letter {
  background: var(--green);
  color: #FFFFFF;
}

.option.locked.correct .option-text {
  color: #166534;
  font-weight: 600;
}

/* Wrong answer — red */
.option.locked.wrong {
  border-color: var(--red-border);
  background: var(--red-bg);
  opacity: 1;
}

.option.locked.wrong .option-letter {
  background: var(--red);
  color: #FFFFFF;
}

.option.locked.wrong .option-text {
  color: #B91C1C;
  font-weight: 600;
}

/* (inline explanation removed — now shown in popup) */

.test-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(245,245,247,0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 12px 16px;
  padding-bottom: calc(12px + var(--safe-bottom));
  display: flex;
  justify-content: center;
  border-top: 1px solid var(--border-light);
}

.test-footer-inner {
  display: flex;
  gap: 12px;
  width: 100%;
  max-width: 640px;
}

.test-footer-inner .btn {
  flex: 1;
}

/* ---- Minimap ---- */
.minimap-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(20,20,24,0.4);
  display: none;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s;
  backdrop-filter: blur(4px);
}

.minimap-overlay.active {
  display: flex;
  opacity: 1;
}

.minimap-sheet {
  background: var(--bg-card);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  width: 100%;
  max-width: 640px;
  max-height: 75vh;
  padding: 16px 20px;
  padding-bottom: calc(20px + var(--safe-bottom));
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.3s ease;
  box-shadow: var(--shadow-lg);
}

.minimap-overlay.active .minimap-sheet {
  transform: translateY(0);
}

.minimap-handle {
  width: 40px;
  height: 4px;
  background: var(--bg-elevated);
  border-radius: 2px;
  margin: 0 auto 12px;
}

.minimap-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 16px;
  text-align: center;
  color: var(--text-secondary);
}

.minimap-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}

.minimap-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  background: var(--bg-surface);
  color: var(--text-dim);
  border: 1.5px solid transparent;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* Answered cells — simple dark bg, white text, no gold */
.minimap-cell.answered {
  background: var(--bg-dark);
  color: #FFFFFF;
}

/* Current cell — simple dark border, no gold glow */
.minimap-cell.current {
  border-color: var(--bg-dark);
}

.minimap-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.minimap-actions .btn {
  flex: 1;
}

/* ============================================
   Screen 3: Results
   ============================================ */
.results-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 24px;
  padding-top: calc(20px + var(--safe-top));
  padding-bottom: calc(32px + var(--safe-bottom));
  max-width: 500px;
  margin: 0 auto;
  width: 100%;
}

/* Top row: badge + score circle side by side */
.results-top-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-bottom: 8px;
  width: 100%;
}

.results-badge {
  width: 80px;
  height: 80px;
  animation: badgeDrop 0.5s ease;
  position: relative;
  flex-shrink: 0;
}

@keyframes badgeDrop {
  0% { transform: scale(0); opacity: 0; }
  70% { transform: scale(1.05); opacity: 1; }
  100% { transform: scale(1); }
}

.results-badge svg {
  width: 100%;
  height: 100%;
}

.confetti-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
}

.score-circle {
  position: relative;
  width: 120px;
  height: 120px;
  flex-shrink: 0;
}

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

.score-bg {
  fill: none;
  stroke: var(--bg-elevated);
  stroke-width: 8;
}

.score-progress {
  fill: none;
  stroke: url(#scoreGradient);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 339.292;
  stroke-dashoffset: 339.292;
  transition: stroke-dashoffset 1.5s ease;
}

.score-progress.fail {
  stroke: var(--red);
}

.score-value {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.score-percent {
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--text-primary);
  letter-spacing: -1px;
}

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

.result-status {
  font-size: 1.15rem;
  font-weight: 800;
  margin-bottom: 2px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.result-status.passed {
  color: var(--green);
}

.result-status.failed {
  color: var(--red);
}

.result-time {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  font-weight: 500;
}

.block-stats {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.block-stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}

.block-stat-name {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.block-stat-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.block-stat-score {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.block-stat-percent {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

.block-stat-icon {
  width: 18px;
  height: 18px;
}

.block-stat-icon.pass { color: var(--green); }
.block-stat-icon.fail { color: var(--red); }

/* ---- Leaderboard ---- */
.leaderboard-section {
  width: 100%;
  margin-bottom: 16px;
}

.leaderboard-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.leaderboard-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-surface);
  padding: 3px;
  border-radius: 10px;
  margin-bottom: 10px;
}

.lb-tab {
  flex: 1;
  padding: 7px 10px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.lb-tab.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.lb-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lb-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  transition: all 0.15s;
}

/* Highlighted leaderboard item — subtle gray, no gold */
.lb-item.highlight {
  border-color: #ccc;
  background: var(--bg-surface);
}

.lb-rank {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  flex-shrink: 0;
}

.lb-rank svg {
  display: block;
}

.lb-rank-num {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text-dim);
  min-width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
  border-radius: 8px;
}

.lb-name {
  flex: 1;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.lb-value {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
}

.results-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.results-actions .btn-lg {
  width: 100%;
}

/* ============================================
   Screen 4: Errors
   ============================================ */
.errors-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  background: rgba(245,245,247,0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 12px 16px;
  padding-top: calc(12px + var(--safe-top));
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-light);
}

.errors-header h2 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.errors-list {
  padding: 16px;
  padding-top: calc(68px + var(--safe-top));
  padding-bottom: calc(24px + var(--safe-bottom));
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.error-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}

.error-card-num {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.error-card-question {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
  line-height: 1.5;
}

.error-answer {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 6px;
  font-weight: 500;
}

.error-answer.wrong {
  background: var(--red-bg);
  color: #B91C1C;
  border: 1px solid var(--red-border);
}

.error-answer.correct {
  background: var(--green-bg);
  color: #166534;
  border: 1px solid var(--green-border);
}

.error-answer-label {
  font-weight: 700;
  flex-shrink: 0;
}

.error-explanation {
  margin-top: 10px;
  padding: 10px 14px;
  background: var(--bg-surface);
  border-radius: 8px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.6;
  border-left: 3px solid var(--border-color);
}

.error-explanation strong {
  color: var(--text-primary);
}

/* ---- Modals ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(20,20,24,0.4);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  transition: opacity 0.25s;
  backdrop-filter: blur(4px);
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 28px 24px;
  max-width: 380px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95) translateY(10px);
  transition: transform 0.25s ease;
}

.modal-overlay.active .modal {
  transform: scale(1) translateY(0);
}

.modal h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.modal p {
  font-size: 0.92rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  gap: 10px;
}

.modal-actions .btn {
  flex: 1;
}

/* ---- Loading spinner ---- */
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--bg-elevated);
  border-top-color: var(--text-muted);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---- Toast ---- */
.toast {
  position: fixed;
  bottom: calc(80px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-dark);
  color: #fff;
  padding: 10px 20px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 250;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: var(--shadow);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---- Responsive ---- */
@media (min-width: 641px) {
  .test-content {
    padding-left: 24px;
    padding-right: 24px;
  }
  .minimap-grid {
    grid-template-columns: repeat(10, 1fr);
  }
}

@media (max-width: 374px) {
  .minimap-grid {
    grid-template-columns: repeat(5, 1fr);
  }
  .question-text {
    font-size: 0.95rem;
  }
  .pin-input {
    width: 48px;
    height: 56px;
    font-size: 1.4rem;
  }
}
