/* ==========================================================================
   ОХОРОНА ПРАЦІ — ВІННИЦЬКИЙ ЛІЦЕЙ №21
   Сучасний адаптивний інтерфейс електронного тестування (2026)
   ========================================================================== */

:root {
  --primary: #1d4ed8;
  --primary-dark: #1e3a8a;
  --primary-light: #3b82f6;
  --primary-subtle: #eff6ff;
  
  --accent-gold: #d97706;
  --accent-amber: #f59e0b;
  --accent-amber-subtle: #fffbeb;
  
  --success: #16a34a;
  --success-dark: #15803d;
  --success-subtle: #f0fdf4;
  --success-border: #86efac;
  
  --info: #0284c7;
  --info-subtle: #f0f9ff;
  
  --danger: #dc2626;
  --danger-dark: #b91c1c;
  --danger-subtle: #fef2f2;
  --danger-border: #fca5a5;
  
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-subtle: #f1f5f9;
  
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-subtle: #64748b;
  
  --border-light: #e2e8f0;
  --border-focus: #3b82f6;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.08), 0 2px 4px -2px rgb(0 0 0 / 0.06);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.05);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.06);
  
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-serif: 'Georgia', 'Cambria', serif;
}

[data-theme="dark"] {
  --bg-page: #090d16;
  --bg-card: #131b2e;
  --bg-card-subtle: #1c2742;
  
  --text-main: #f8fafc;
  --text-muted: #cbd5e1;
  --text-subtle: #94a3b8;
  
  --border-light: #24324f;
  
  --primary-subtle: #1e293b;
  --success-subtle: #052e16;
  --success-border: #15803d;
  --danger-subtle: #450a0a;
  --danger-border: #991b1b;
  --accent-amber-subtle: #451a03;
  --info-subtle: #082f49;
}

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

html {
  font-family: var(--font-sans);
  font-size: 16px;
  color: var(--text-main);
  background-color: var(--bg-page);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  overflow-x: hidden;
}

/* Top App Bar */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.school-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
  color: inherit;
}

.brand-emblem {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fbbf24;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  box-shadow: 0 4px 10px rgba(29, 78, 216, 0.3);
  flex-shrink: 0;
}

.brand-text h1 {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.brand-text p {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.icon-btn {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: var(--primary-subtle);
  color: var(--primary);
  border-color: var(--primary-light);
}

/* Main Container */
.main-content {
  flex: 1;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3.5rem;
}

/* View Containers */
.view-panel {
  display: none;
  animation: fadeIn 0.3s ease;
}

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

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   WELCOME VIEW
   ========================================================================== */
.welcome-hero {
  background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 50%, #2563eb 100%);
  color: #ffffff;
  border-radius: var(--radius-xl);
  padding: 2.5rem 2rem;
  box-shadow: var(--shadow-xl);
  position: relative;
  overflow: hidden;
  margin-bottom: 2rem;
}

.welcome-hero::after {
  content: '';
  position: absolute;
  top: -60px;
  right: -60px;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(251, 191, 36, 0.25) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.hero-pill {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  backdrop-filter: blur(4px);
}

.hero-pill.gold {
  background: rgba(245, 158, 11, 0.3);
  border-color: rgba(245, 158, 11, 0.5);
  color: #fef3c7;
}

.welcome-hero h2 {
  font-size: 1.85rem;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 0.75rem;
}

.welcome-hero p {
  font-size: 1.05rem;
  opacity: 0.92;
  max-width: 800px;
  line-height: 1.6;
}

.two-attempts-callout {
  margin-top: 1.5rem;
  background: rgba(255, 255, 255, 0.12);
  border-left: 4px solid #fbbf24;
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
}

.callout-icon {
  font-size: 1.6rem;
  flex-shrink: 0;
}

.callout-text h4 {
  font-size: 1rem;
  font-weight: 700;
  color: #fbbf24;
  margin-bottom: 0.2rem;
}

.callout-text p {
  font-size: 0.92rem;
  opacity: 0.95;
}

/* Card Styling */
.academic-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-md);
  margin-bottom: 1.75rem;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 0.75rem;
}

/* Form Styles */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
}

.form-group label span.req {
  color: var(--danger);
}

.form-control {
  background: var(--bg-card);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  color: var(--text-main);
  font-family: inherit;
  transition: all 0.2s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-hint {
  font-size: 0.78rem;
  color: var(--text-subtle);
}

/* Mode Selection Cards */
.mode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.mode-card {
  border: 2px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--bg-card);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.mode-card:hover {
  border-color: var(--primary-light);
  transform: translateY(-2px);
}

.mode-card.selected {
  border-color: var(--primary);
  background: var(--primary-subtle);
  box-shadow: 0 0 0 2px var(--primary);
}

.mode-card .mode-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--accent-gold);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 9999px;
  text-transform: uppercase;
}

.mode-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-main);
}

.mode-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Primary Button */
.btn-primary-large {
  background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  padding: 1.1rem 2rem;
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  cursor: pointer;
  width: 100%;
  margin-top: 1.5rem;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
  transition: all 0.2s ease;
}

.btn-primary-large:hover {
  background: linear-gradient(135deg, #1e40af 0%, #1d4ed8 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.45);
}

.btn-primary-large:active {
  transform: translateY(0);
}

/* ==========================================================================
   TESTING VIEW
   ========================================================================== */

/* Progress & Live Stats Header */
.test-top-bar {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.top-bar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.user-tag {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-main);
}

.stat-counters {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.stat-chip {
  padding: 0.3rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.stat-chip.try1 {
  background: var(--success-subtle);
  color: var(--success-dark);
  border: 1px solid var(--success-border);
}

.stat-chip.try2 {
  background: var(--info-subtle);
  color: var(--info);
  border: 1px solid #7dd3fc;
}

.stat-chip.failed {
  background: var(--danger-subtle);
  color: var(--danger-dark);
  border: 1px solid var(--danger-border);
}

.stat-chip.total {
  background: var(--bg-card-subtle);
  color: var(--text-main);
  border: 1px solid var(--border-light);
}

/* Progress bar */
.progress-container {
  width: 100%;
  height: 8px;
  background: var(--bg-card-subtle);
  border-radius: 9999px;
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #10b981);
  width: 0%;
  transition: width 0.3s ease;
  border-radius: 9999px;
}

/* Question Card */
.question-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 2rem;
  box-shadow: var(--shadow-lg);
  margin-bottom: 1.5rem;
  position: relative;
}

.question-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.question-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.q-badge {
  background: var(--primary);
  color: #fff;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 700;
}

.category-badge {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

/* Attempt Status Banner (Teacher's 2 Attempts Rule!) */
.attempt-status-banner {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 700;
  transition: all 0.3s ease;
}

.attempt-status-banner.state-fresh {
  background: var(--primary-subtle);
  color: var(--primary-dark);
  border: 1px solid #bfdbfe;
}

.attempt-status-banner.state-retry {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  animation: pulseWarning 1.5s infinite;
}

@keyframes pulseWarning {
  0% { transform: scale(1); }
  50% { transform: scale(1.03); }
  100% { transform: scale(1); }
}

.attempt-status-banner.state-pass1 {
  background: var(--success-subtle);
  color: var(--success-dark);
  border: 1px solid var(--success-border);
}

.attempt-status-banner.state-pass2 {
  background: var(--info-subtle);
  color: #0369a1;
  border: 1px solid #7dd3fc;
}

.attempt-status-banner.state-fail {
  background: var(--danger-subtle);
  color: var(--danger-dark);
  border: 1px solid var(--danger-border);
}

.question-text {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.5;
  color: var(--text-main);
  margin-bottom: 1.75rem;
}

/* Options List */
.options-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

.option-btn {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
  text-align: left;
  background: var(--bg-card);
  border: 2px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.option-btn:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--primary-subtle);
  transform: translateX(4px);
}

.option-letter {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bg-card-subtle);
  border: 1.5px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.option-btn:hover:not(:disabled) .option-letter {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.option-text {
  flex: 1;
  line-height: 1.45;
  font-weight: 500;
}

.option-feedback-icon {
  font-size: 1.2rem;
  display: none;
}

/* Option States: Correct 1st try */
.option-btn.state-correct-first {
  background: var(--success-subtle);
  border-color: var(--success);
  color: var(--success-dark);
  font-weight: 600;
}

.option-btn.state-correct-first .option-letter {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}

.option-btn.state-correct-first .option-feedback-icon {
  display: block;
  color: var(--success);
}

/* Option States: Correct 2nd try */
.option-btn.state-correct-second {
  background: var(--info-subtle);
  border-color: var(--info);
  color: #0369a1;
  font-weight: 600;
}

.option-btn.state-correct-second .option-letter {
  background: var(--info);
  color: #fff;
  border-color: var(--info);
}

.option-btn.state-correct-second .option-feedback-icon {
  display: block;
  color: var(--info);
}

/* Option States: Wrong 1st try */
.option-btn.state-wrong-first {
  background: var(--danger-subtle);
  border-color: var(--danger);
  color: var(--danger-dark);
  opacity: 0.65;
  cursor: not-allowed;
  text-decoration: line-through;
  animation: shake 0.4s ease;
}

.option-btn.state-wrong-first .option-letter {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.option-btn.state-wrong-first .option-feedback-icon {
  display: block;
  color: var(--danger);
}

/* Option States: Wrong 2nd try */
.option-btn.state-wrong-second {
  background: var(--danger-subtle);
  border-color: var(--danger);
  color: var(--danger-dark);
  opacity: 0.7;
  cursor: not-allowed;
  text-decoration: line-through;
  animation: shake 0.4s ease;
}

.option-btn.state-wrong-second .option-letter {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.option-btn.state-wrong-second .option-feedback-icon {
  display: block;
  color: var(--danger);
}

/* Option States: Reveal Correct after both failed */
.option-btn.state-reveal-correct {
  background: #f0fdf4;
  border: 2px dashed #16a34a;
  color: #14532d;
  font-weight: 700;
}

.option-btn.state-reveal-correct .option-letter {
  background: #16a34a;
  color: #fff;
  border-color: #16a34a;
}

.option-btn.state-reveal-correct .option-feedback-icon {
  display: block;
  color: #16a34a;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

/* Second Try Prompt Callout */
.retry-callout {
  display: none;
  background: #fffbeb;
  border: 1.5px solid #fde68a;
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  margin-bottom: 1.25rem;
  animation: fadeIn 0.3s ease;
}

.retry-callout.active {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.retry-icon {
  font-size: 1.5rem;
  color: #d97706;
}

.retry-text h5 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #92400e;
}

.retry-text p {
  font-size: 0.85rem;
  color: #b45309;
}

/* Explanation & Normative Base Block */
.explanation-box {
  display: none;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-top: 1.25rem;
  animation: fadeIn 0.3s ease;
}

.explanation-box.active {
  display: block;
}

.explanation-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.explanation-norm {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-gold);
  margin-bottom: 0.4rem;
}

.explanation-text {
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--text-muted);
}

/* Question Action Buttons */
.question-nav-buttons {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-light);
  flex-wrap: wrap;
}

.btn-nav {
  padding: 0.75rem 1.35rem;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-light);
  background: var(--bg-card);
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.btn-nav:hover:not(:disabled) {
  background: var(--bg-card-subtle);
  border-color: var(--text-muted);
}

.btn-nav:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-finish-test {
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
  color: #fff;
  border: none;
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
}

.btn-finish-test:hover {
  background: linear-gradient(135deg, #15803d 0%, #166534 100%);
  transform: translateY(-1px);
}

/* Question Map Drawer / Section */
.question-map-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 2rem;
}

.map-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.map-header h4 {
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.map-legend {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.legend-dot.unanswered { background: var(--bg-card-subtle); border: 1px solid var(--border-light); }
.legend-dot.pass1 { background: var(--success); }
.legend-dot.pass2 { background: var(--info); }
.legend-dot.failed { background: var(--danger); }
.legend-dot.current { border: 2px solid var(--accent-gold); }

/* The 50 Question Grid */
.questions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
  gap: 0.45rem;
}

.q-chip {
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-light);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.q-chip:hover {
  border-color: var(--primary);
  transform: scale(1.08);
}

.q-chip.active {
  box-shadow: 0 0 0 2.5px var(--accent-gold);
  border-color: var(--accent-gold);
  transform: scale(1.1);
  z-index: 2;
}

.q-chip.status-pass1 {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}

.q-chip.status-pass2 {
  background: var(--info);
  color: #fff;
  border-color: var(--info);
}

.q-chip.status-failed {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.q-chip.status-retry {
  background: #fde68a;
  color: #92400e;
  border-color: #f59e0b;
}

/* ==========================================================================
   RESULTS VIEW
   ========================================================================== */
.results-hero {
  background: linear-gradient(135deg, #064e3b 0%, #065f46 50%, #047857 100%);
  color: #fff;
  border-radius: var(--radius-xl);
  padding: 3rem 2rem;
  box-shadow: var(--shadow-xl);
  text-align: center;
  position: relative;
  overflow: hidden;
  margin-bottom: 2rem;
  transition: background 0.4s ease;
}

.results-hero.failed {
  background: linear-gradient(135deg, #7f1d1d 0%, #991b1b 50%, #b91c1c 100%);
}

.results-hero::before {
  content: '🏆';
  font-size: 8rem;
  position: absolute;
  top: -20px;
  right: 20px;
  opacity: 0.12;
  pointer-events: none;
}

.results-hero.failed::before {
  content: '⚠️';
}

.results-hero.failed .big-score {
  color: #fca5a5;
}

.cert-not-passed-box {
  display: none;
  background: #fef2f2;
  border: 2px dashed #ef4444;
  border-radius: var(--radius-lg);
  padding: 2rem 1.5rem;
  margin: 1.5rem 0;
  text-align: center;
}

.cert-not-passed-box.active {
  display: block;
}

.cert-not-passed-box h4 {
  font-size: 1.25rem;
  font-weight: 800;
  color: #991b1b;
  margin-bottom: 0.5rem;
}

.cert-not-passed-box p {
  color: #b91c1c;
  font-size: 0.95rem;
  max-width: 650px;
  margin: 0 auto;
  line-height: 1.5;
}

.results-badge-top {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  display: inline-block;
  padding: 0.35rem 1rem;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 1rem;
}

.results-hero h2 {
  font-size: 2.2rem;
  font-weight: 900;
  margin-bottom: 0.5rem;
  line-height: 1.2;
}

.results-user-info {
  font-size: 1.15rem;
  opacity: 0.95;
  margin-bottom: 1.5rem;
}

.score-display-box {
  background: rgba(255, 255, 255, 0.15);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  min-width: 280px;
  backdrop-filter: blur(8px);
}

.big-score {
  font-size: 3.5rem;
  font-weight: 900;
  line-height: 1;
  color: #fbbf24;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.score-subtitle {
  font-size: 1.1rem;
  font-weight: 700;
  margin-top: 0.4rem;
}

/* Breakdown Cards */
.results-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.res-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.res-stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  flex-shrink: 0;
}

.res-stat-icon.green { background: #dcfce7; color: #15803d; }
.res-stat-icon.blue { background: #e0f2fe; color: #0369a1; }
.res-stat-icon.red { background: #fee2e2; color: #b91c1c; }
.res-stat-icon.gold { background: #fef3c7; color: #b45309; }

.res-stat-info h5 {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text-main);
}

.res-stat-info p {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Certificate Preview & Action Buttons */
.cert-section {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 2rem;
  box-shadow: var(--shadow-md);
  margin-bottom: 2rem;
  text-align: center;
}

.cert-canvas-container {
  max-width: 100%;
  overflow: auto;
  margin: 1.5rem 0;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  background: #f1ede0;
}

#preview-canvas {
  width: 100%;
  max-width: 850px;
  height: auto;
  display: block;
  margin: 0 auto;
}

.results-action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  margin-top: 1.5rem;
}

.btn-action-primary {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 0.95rem 1.6rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.3);
  transition: all 0.2s ease;
}

.btn-action-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(217, 119, 6, 0.4);
}

.btn-action-blue {
  background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 0.95rem 1.6rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 12px rgba(29, 78, 216, 0.3);
  transition: all 0.2s ease;
}

.btn-action-blue:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(29, 78, 216, 0.4);
}

.btn-action-outline {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.95rem 1.4rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.btn-action-outline:hover {
  background: var(--bg-card-subtle);
  border-color: var(--text-muted);
}

/* Detailed Answers Accordion */
.review-section {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 2rem;
  box-shadow: var(--shadow-md);
  margin-bottom: 2rem;
}

.review-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.25rem;
}

.review-item {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  background: var(--bg-card);
}

.review-item.status-pass1 { border-left: 5px solid var(--success); }
.review-item.status-pass2 { border-left: 5px solid var(--info); }
.review-item.status-failed { border-left: 5px solid var(--danger); }

.review-q-num {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.3rem;
}

.review-q-text {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.review-answers-box {
  background: var(--bg-card-subtle);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.review-answers-box p {
  margin-bottom: 0.35rem;
}

.review-norm {
  font-size: 0.85rem;
  color: var(--accent-gold);
  font-weight: 600;
}

/* Footer */
.app-footer {
  margin-top: auto;
  border-top: 1px solid var(--border-light);
  background: var(--bg-card);
  padding: 1.5rem 1.25rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Toast Notification */
.toast-notice {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #0f172a;
  color: #fff;
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  z-index: 9999999;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ==========================================================================
   PRINT STYLES FOR OFFICIAL A4 PROTOCOL
   ========================================================================== */
#print-container {
  display: none;
}

@media print {
  body * {
    visibility: hidden;
  }

  #print-container, #print-container * {
    visibility: visible;
  }

  #print-container {
    display: block !important;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    background: #fff;
    color: #000;
    font-family: 'Times New Roman', Times, serif;
    font-size: 13pt;
    line-height: 1.4;
    padding: 20mm;
  }

  .protocol-document {
    width: 100%;
  }

  .proto-header {
    text-align: center;
    margin-bottom: 15px;
  }

  .proto-emblem {
    font-size: 24pt;
    margin-bottom: 5px;
  }

  .proto-header h3 {
    font-size: 12pt;
    font-weight: normal;
    margin: 2px 0;
  }

  .proto-header h4 {
    font-size: 12pt;
    font-weight: normal;
    margin: 2px 0;
  }

  .proto-header h2 {
    font-size: 14pt;
    font-weight: bold;
    margin: 5px 0;
  }

  .proto-hr {
    border: none;
    border-top: 2px solid #000;
    margin: 10px auto;
    width: 90%;
  }

  .proto-title {
    text-align: center;
    margin: 18px 0;
  }

  .proto-title h1 {
    font-size: 18pt;
    font-weight: bold;
    margin-bottom: 4px;
  }

  .proto-title h3 {
    font-size: 13pt;
    font-weight: bold;
    margin-bottom: 10px;
  }

  .proto-date {
    font-size: 12pt;
    margin: 8px 0 16px;
  }

  .proto-body p {
    text-indent: 25px;
    margin-bottom: 8px;
    text-align: justify;
  }

  .proto-commission {
    list-style: none;
    padding-left: 25px;
    margin-bottom: 12px;
  }

  .proto-table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 11pt;
  }

  .proto-table th, .proto-table td {
    border: 1px solid #000;
    padding: 6px 8px;
    vertical-align: middle;
  }

  .proto-table th {
    background: #f0f0f0 !important;
    text-align: center;
    font-weight: bold;
  }

  .proto-summary {
    margin: 15px 0;
  }

  .proto-signatures {
    margin-top: 30px;
  }

  .sig-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 25px;
  }

  .sig-col {
    width: 48%;
  }

  .proto-stamp-box {
    margin-top: 20px;
    text-align: left;
    font-style: italic;
    color: #444;
  }
}

/* Question Map Filter Buttons */
.map-filter-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.map-filter-btn {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.map-filter-btn:hover {
  background: var(--bg-card-subtle);
  color: var(--text-main);
}

.map-filter-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Domain Mastery Section in Results */
.domains-section {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 2rem;
  box-shadow: var(--shadow-md);
  margin-bottom: 2rem;
}

.domains-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-top: 1.25rem;
}

.domain-card {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.domain-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 0.95rem;
}

.domain-percent-badge {
  font-size: 0.85rem;
  font-weight: 800;
  padding: 0.2rem 0.5rem;
  border-radius: 9999px;
  background: var(--success-subtle);
  color: var(--success-dark);
}

.domain-bar-bg {
  width: 100%;
  height: 8px;
  background: var(--border-light);
  border-radius: 9999px;
  overflow: hidden;
}

.domain-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #10b981);
  border-radius: 9999px;
  transition: width 0.6s ease;
}

.domain-questions-count {
  font-size: 0.78rem;
  color: var(--text-subtle);
}

/* Toggle Switch Styling */
.switch-label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.switch-label input {
  cursor: pointer;
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

/* Print certificate specific styles */
@media print {
  .cert-print-container {
    display: block !important;
    position: absolute;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
  }
}
@media (max-width: 768px) {
  .welcome-hero {
    padding: 1.75rem 1.25rem;
  }

  .welcome-hero h2 {
    font-size: 1.45rem;
  }

  .question-card {
    padding: 1.25rem;
  }

  .question-text {
    font-size: 1.1rem;
  }

  .option-btn {
    padding: 0.85rem 1rem;
    font-size: 0.95rem;
  }

  .question-nav-buttons {
    flex-direction: column;
    gap: 0.75rem;
  }

  .question-nav-buttons .btn-nav {
    width: 100%;
    justify-content: center;
  }
}

/* ==========================================================================
   CATEGORY SELECTOR (PEDAGOGICAL VS TECHNICAL STAFF)
   ========================================================================== */
.category-select-block {
  margin-bottom: 1.5rem;
}

.category-block-label {
  display: block;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
  margin-bottom: 0.6rem;
}

.category-toggle-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.cat-toggle-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.25rem;
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  cursor: pointer;
  position: relative;
  transition: all 0.25s ease;
  user-select: none;
}

.cat-toggle-card:hover {
  border-color: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.cat-toggle-card.active {
  border-color: var(--primary);
  background: linear-gradient(145deg, rgba(30, 58, 138, 0.05), rgba(16, 185, 129, 0.05));
  box-shadow: 0 0 0 1px var(--primary), var(--shadow-md);
}

.cat-toggle-icon {
  font-size: 2.2rem;
  flex-shrink: 0;
  line-height: 1;
}

.cat-toggle-body {
  flex: 1;
}

.cat-toggle-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.2rem;
}

.cat-toggle-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.35;
  margin-bottom: 0.45rem;
}

.cat-toggle-badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  background: var(--primary);
  color: #fff;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.cat-toggle-radio {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  flex-shrink: 0;
  position: relative;
  transition: all 0.2s ease;
}

.cat-toggle-card.active .cat-toggle-radio {
  border-color: var(--primary);
  background: var(--primary);
}

.cat-toggle-card.active .cat-toggle-radio::after {
  content: '';
  position: absolute;
  top: 5px;
  left: 5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ffffff;
}
