/* ==========================================================================
   SIMULADO DIGITAL SAS 6º ANO - ESTILO VISUAL GAMIFICADO & DIVERTIDO
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&family=Outfit:wght@400;500;600;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Brand & Subject Colors */
  --primary: #4F46E5;
  --primary-hover: #4338CA;
  --primary-light: #EEF2FF;
  
  --secondary: #06B6D4;
  --accent-amber: #F59E0B;
  --accent-pink: #EC4899;
  --accent-purple: #8B5CF6;
  --accent-green: #10B981;
  --accent-red: #EF4444;

  --mat-color: #4F46E5;
  --port-color: #0284C7;
  --hist-color: #D97706;
  --geo-color: #059669;
  --cie-color: #9333EA;

  /* Neutrals */
  --bg-gradient: linear-gradient(135deg, #F0F4FF 0%, #FDF2F8 50%, #EFF6FF 100%);
  --surface: #FFFFFF;
  --surface-alt: #F8FAFC;
  --text-main: #1E293B;
  --text-muted: #64748B;
  --text-light: #94A3B8;
  --border-color: #E2E8F0;
  --border-focus: #818CF8;

  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.04);
  --shadow-md: 0 8px 16px -4px rgba(79, 70, 229, 0.08), 0 4px 6px -2px rgba(0,0,0,0.03);
  --shadow-lg: 0 16px 32px -8px rgba(79, 70, 229, 0.12), 0 8px 16px -4px rgba(0,0,0,0.04);
  --shadow-card-hover: 0 20px 35px -10px rgba(79, 70, 229, 0.18);

  /* Radius */
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 9999px;

  /* Typography */
  --font-display: 'Fredoka', 'Outfit', sans-serif;
  --font-body: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

body {
  font-family: var(--font-body);
  background: var(--bg-gradient);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Layout Container */
.app-wrapper {
  max-width: 1080px;
  margin: 0 auto;
  padding: 20px 16px 60px;
}

/* Header & Top Bar */
.top-navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  margin-bottom: 24px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-icon {
  font-size: 2rem;
  animation: bounce-gentle 2.5s infinite ease-in-out;
}

.brand-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.5px;
}

.brand-badge {
  background: linear-gradient(135deg, #F59E0B, #EC4899);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  margin-left: 6px;
  text-transform: uppercase;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-icon {
  background: var(--surface-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 8px 14px;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: var(--surface);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

/* Common Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}

.btn:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: var(--shadow-md);
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #6366F1 100%);
  color: #FFFFFF;
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-hover) 0%, #4F46E5 100%);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text-main);
  border: 2px solid var(--border-color);
}

.btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-gold {
  background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
  color: #FFFFFF;
}

.btn-success {
  background: linear-gradient(135deg, #10B981 0%, #059669 100%);
  color: #FFFFFF;
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn-danger-outline {
  background: transparent;
  color: var(--accent-red);
  border: 2px solid #FCA5A5;
}

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

/* Cards */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 28px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  margin-bottom: 24px;
}

/* ==========================================================================
   WELCOME SCREEN
   ========================================================================== */
.welcome-hero {
  text-align: center;
  padding: 36px 20px;
  background: linear-gradient(135deg, rgba(255,255,255,0.9), rgba(238,242,255,0.9));
  border-radius: var(--radius-lg);
  border: 2px solid rgba(255,255,255,0.8);
  box-shadow: var(--shadow-lg);
  margin-bottom: 30px;
  position: relative;
  overflow: hidden;
}

.welcome-hero::before {
  content: '📐 ✨ 📚 🌍 🔬';
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 1.2rem;
  opacity: 0.4;
  letter-spacing: 6px;
}

.welcome-title {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
  line-height: 1.2;
}

.welcome-subtitle {
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 680px;
  margin: 0 auto 16px;
}

/* Subject Highlights Pills */
.subject-chips-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
}

.subject-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  font-weight: 600;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

/* Form Styles */
.form-group {
  margin-bottom: 24px;
}

.form-label {
  display: block;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 10px;
}

.form-input, .form-select {
  width: 100%;
  padding: 14px 18px;
  font-size: 1.05rem;
  font-family: var(--font-body);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--surface);
  transition: all 0.2s ease;
  outline: none;
}

.form-input:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.15);
}

/* Avatar Selector */
.avatar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 14px;
  margin-top: 10px;
}

.avatar-item {
  background: var(--surface-alt);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.avatar-item:hover {
  transform: translateY(-4px);
  border-color: var(--border-focus);
}

.avatar-item.selected {
  background: var(--primary-light);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

.avatar-emoji {
  font-size: 2.2rem;
}

.avatar-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

/* Resume Alert Box */
.resume-alert {
  background: #EFF6FF;
  border: 2px dashed #93C5FD;
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.resume-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.resume-icon {
  font-size: 2rem;
}

/* ==========================================================================
   TEST SCREEN
   ========================================================================== */
.test-top-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  background: var(--surface);
  padding: 16px 24px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.test-student-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.test-avatar-badge {
  font-size: 1.8rem;
  background: var(--primary-light);
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
}

.test-student-meta h4 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--text-main);
}

.test-student-meta p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.test-timer-badge {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  background: #FEF3C7;
  color: #B45309;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  border: 1px solid #FDE68A;
}

/* Subject Tabs in Test */
.subject-tabs-container {
  display: flex;
  overflow-x: auto;
  gap: 8px;
  padding-bottom: 8px;
  margin-bottom: 16px;
  scrollbar-width: thin;
}

.subject-tab {
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 8px 16px;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.subject-tab:hover {
  background: var(--surface-alt);
  color: var(--text-main);
}

.subject-tab.active {
  background: var(--primary);
  color: #FFFFFF;
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

/* Question Progress Line */
.test-progress-wrapper {
  margin-bottom: 20px;
}

.test-progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.progress-bar-container {
  width: 100%;
  height: 10px;
  background: #E2E8F0;
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #4F46E5, #06B6D4);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

/* Question Card */
.question-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 32px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  margin-bottom: 24px;
}

.question-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.q-meta-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.q-number-pill {
  background: var(--text-main);
  color: #FFFFFF;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--radius-full);
}

.q-subject-tag {
  font-size: 0.85rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--radius-full);
}

.q-topic-tag {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface-alt);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
}

.btn-flag {
  background: #FFFBEB;
  color: #D97706;
  border: 1px solid #FCD34D;
  border-radius: var(--radius-full);
  padding: 6px 14px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-flag:hover {
  background: #FEF3C7;
}

.btn-flag.flagged {
  background: #F59E0B;
  color: #FFFFFF;
  border-color: #D97706;
}

.question-statement {
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--text-main);
  line-height: 1.7;
  margin-bottom: 28px;
}

/* Multiple Choice Options */
.options-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.option-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--surface-alt);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.option-card:hover {
  border-color: var(--border-focus);
  background: #F8FAFC;
  transform: translateX(4px);
}

.option-card.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.12);
}

.option-badge {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  background: #E2E8F0;
  color: var(--text-main);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.option-card.selected .option-badge {
  background: var(--primary);
  color: #FFFFFF;
}

.option-content {
  font-size: 1.05rem;
  color: var(--text-main);
  flex-grow: 1;
}

.option-radio-circle {
  width: 22px;
  height: 22px;
  border: 2px solid var(--border-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.option-card.selected .option-radio-circle {
  border-color: var(--primary);
}

.radio-inner-dot {
  width: 12px;
  height: 12px;
  background: var(--primary);
  border-radius: 50%;
}

/* Bottom Navigation Bar */
.test-bottom-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  padding: 18px 24px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

/* Question Grid Drawer */
.question-grid-drawer {
  margin-top: 20px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  display: none;
}

.question-grid-drawer.open {
  display: block;
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.drawer-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
}

.drawer-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.85rem;
  font-weight: 500;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

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

.legend-dot.answered { background: var(--primary); }
.legend-dot.unanswered { background: #E2E8F0; }
.legend-dot.flagged { background: #F59E0B; }

.question-grid-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
  gap: 8px;
}

.grid-q-btn {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: #F1F5F9;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.2s ease;
}

.grid-q-btn:hover {
  transform: scale(1.1);
  z-index: 2;
}

.grid-q-btn.answered {
  background: var(--primary);
  color: #FFFFFF;
  border-color: var(--primary);
}

.grid-q-btn.flagged {
  border-color: #F59E0B;
  box-shadow: 0 0 0 2px #FCD34D;
}

.grid-q-btn.current {
  box-shadow: 0 0 0 3px #EC4899;
  font-weight: 800;
}

.grid-star-icon {
  position: absolute;
  top: -4px;
  right: -4px;
  font-size: 0.65rem;
}

/* ==========================================================================
   RESULTS SCREEN
   ========================================================================== */
.results-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.result-hero-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 36px;
  border-radius: var(--radius-lg);
  color: #FFFFFF;
  position: relative;
  overflow: hidden;
}

.result-hero-card.rank-gold {
  background: linear-gradient(135deg, #D97706 0%, #F59E0B 50%, #B45309 100%);
}

.result-hero-card.rank-silver {
  background: linear-gradient(135deg, #0284C7 0%, #38BDF8 50%, #0369A1 100%);
}

.result-hero-card.rank-bronze {
  background: linear-gradient(135deg, #7C3AED 0%, #A855F7 50%, #6D28D9 100%);
}

.result-hero-avatar {
  position: relative;
  display: inline-block;
}

.hero-emoji {
  font-size: 4.5rem;
  background: rgba(255, 255, 255, 0.2);
  width: 100px;
  height: 100px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid rgba(255, 255, 255, 0.4);
}

.hero-medal {
  position: absolute;
  bottom: -6px;
  right: -6px;
  font-size: 2.2rem;
}

.result-hero-info {
  flex: 1;
  min-width: 260px;
}

.hero-badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.25);
  padding: 4px 14px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.hero-title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.hero-student {
  font-size: 1.15rem;
  opacity: 0.95;
  margin-bottom: 10px;
}

.hero-message {
  font-size: 1rem;
  opacity: 0.9;
  line-height: 1.5;
}

.result-hero-score-box {
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(8px);
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: var(--radius-md);
  padding: 20px 28px;
  text-align: center;
  min-width: 190px;
}

.hero-score-number {
  font-family: var(--font-display);
  font-size: 2.8rem;
  font-weight: 800;
  line-height: 1;
}

.hero-score-total {
  font-size: 1.4rem;
  opacity: 0.8;
}

.hero-percentage-pill {
  background: rgba(255, 255, 255, 0.9);
  color: var(--text-main);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  margin: 8px 0;
}

.hero-grade-text {
  font-size: 1.05rem;
  margin-bottom: 4px;
}

.hero-time-text {
  font-size: 0.85rem;
  opacity: 0.85;
}

/* Results Actions Bar */
.results-actions-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

/* Section Cards in Results */
.section-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 28px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}

.section-subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

/* Grid Layouts */
.grid-2-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

/* Subjects Performance Cards */
.subjects-performance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.subject-stat-card {
  background: var(--surface-alt);
  border-radius: var(--radius-md);
  padding: 18px;
  border: 1px solid var(--border-color);
  border-top: 5px solid var(--primary);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.subject-stat-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.subject-stat-icon {
  font-size: 1.4rem;
}

.subject-stat-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
}

.subject-stat-score {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
}

.subject-stat-footer {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Diagnostic Lists */
.diagnostic-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
}

.diagnostic-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--surface-alt);
  border: 1px solid var(--border-color);
}

.diagnostic-item.strength {
  border-left: 4px solid #10B981;
}

.diagnostic-item.need-review {
  border-left: 4px solid #F59E0B;
}

.diagnostic-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
}

.diagnostic-details strong {
  display: block;
  font-size: 0.95rem;
  color: var(--text-main);
}

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

.text-success { color: #059669; }
.text-warning { color: #D97706; }
.empty-state-text { color: var(--text-muted); font-size: 0.95rem; padding: 10px 0; }

/* Gabarito List & Filters */
.gabarito-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.gabarito-filters {
  display: flex;
  gap: 8px;
}

.filter-btn {
  background: var(--surface-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 6px 14px;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

.gabarito-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.gabarito-item {
  border-radius: var(--radius-md);
  padding: 24px;
  background: var(--surface-alt);
  border: 2px solid var(--border-color);
}

.gabarito-item.gabarito-correct {
  border-left: 6px solid #10B981;
}

.gabarito-item.gabarito-error {
  border-left: 6px solid #EF4444;
}

.gabarito-item-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.gabarito-q-info {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.q-badge {
  background: var(--text-main);
  color: #FFFFFF;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

.q-subject-pill {
  background: #E0E7FF;
  color: #3730A3;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

.q-topic-pill {
  background: #F1F5F9;
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 3px 8px;
  border-radius: var(--radius-full);
}

.gabarito-status-badge {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--radius-full);
}

.gabarito-status-badge.gabarito-correct {
  background: #D1FAE5;
  color: #065F46;
}

.gabarito-status-badge.gabarito-error {
  background: #FEE2E2;
  color: #991B1B;
}

.gabarito-statement {
  font-size: 1.05rem;
  font-weight: 500;
  margin-bottom: 16px;
  line-height: 1.6;
}

.gabarito-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}

.gabarito-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  font-size: 0.95rem;
}

.gabarito-opt.opt-is-correct {
  background: #ECFDF5;
  border-color: #6EE7B7;
  font-weight: 600;
}

.gabarito-opt.opt-user-wrong {
  background: #FEF2F2;
  border-color: #FCA5A5;
  color: #991B1B;
}

.opt-id { font-weight: 700; }
.opt-tag {
  margin-left: auto;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.opt-is-correct .opt-tag { background: #10B981; color: #fff; }
.opt-user-wrong .opt-tag { background: #EF4444; color: #fff; }

.gabarito-explanation {
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  border-radius: var(--radius-md);
  padding: 16px;
}

.explanation-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: #92400E;
  margin-bottom: 6px;
}

.explanation-text {
  font-size: 0.95rem;
  color: #78350F;
  line-height: 1.6;
}

/* ==========================================================================
   MODALS (Certificate & Confirmation)
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
}

.modal-content {
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 600px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-close-btn {
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  font-size: 1.8rem;
  color: var(--text-muted);
  cursor: pointer;
}

.finish-confirm-modal {
  text-align: center;
}

.modal-header-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 12px;
}

.modal-warning-text {
  font-size: 1.05rem;
  color: #B45309;
  background: #FEF3C7;
  padding: 12px;
  border-radius: var(--radius-md);
  margin-bottom: 14px;
}

.modal-subtext {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

/* Certificate Modal Frame */
.certificate-modal {
  max-width: 780px;
  padding: 24px;
}

.certificate-frame {
  background: #FCFDFE;
  border: 10px solid #D97706;
  border-radius: var(--radius-md);
  padding: 12px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.cert-border-inner {
  border: 2px dashed #B45309;
  border-radius: var(--radius-sm);
  padding: 32px 24px;
  text-align: center;
}

.cert-logo-badge {
  display: inline-block;
  background: #4F46E5;
  color: #FFFFFF;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 800;
  padding: 4px 14px;
  border-radius: var(--radius-full);
  letter-spacing: 1px;
  margin-bottom: 10px;
}

.cert-main-title {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 800;
  color: #B45309;
  letter-spacing: 1px;
}

.cert-subtitle {
  font-size: 1.05rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.cert-intro {
  font-size: 1.1rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 8px;
}

.cert-student-name {
  font-family: var(--font-display);
  font-size: 2.2rem;
  color: #1E1B4B;
  font-weight: 800;
  text-decoration: underline;
  text-decoration-color: #F59E0B;
  margin-bottom: 16px;
}

.cert-text {
  font-size: 1.05rem;
  color: #334155;
  max-width: 580px;
  margin: 0 auto 32px;
  line-height: 1.7;
}

.cert-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-top: 24px;
}

.cert-sign {
  font-size: 0.85rem;
  color: var(--text-muted);
  flex: 1;
}

.sign-line {
  width: 140px;
  height: 1px;
  background: var(--text-muted);
  margin: 0 auto 6px;
}

.cert-seal {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #FFFBEB;
  border: 2px solid #FCD34D;
  border-radius: 50%;
  width: 80px;
  height: 80px;
  justify-content: center;
}

.seal-emoji { font-size: 1.8rem; }
.seal-text { font-size: 0.65rem; font-weight: 800; color: #92400E; }

.cert-modal-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
}

/* History Screen */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 24px;
}

.history-card {
  background: var(--surface-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
}

.history-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.history-grade-pill {
  background: #ECFDF5;
  color: #065F46;
  font-family: var(--font-display);
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--radius-full);
}

.history-rank {
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 10px;
}

.history-subjects-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.history-sub-tag {
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  font-size: 0.8rem;
  padding: 3px 8px;
  border-radius: var(--radius-full);
}

.history-actions {
  display: flex;
  justify-content: space-between;
}

.empty-history {
  text-align: center;
  padding: 40px 20px;
}

.empty-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 10px;
}

/* Animations */
@keyframes bounce-gentle {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.animate-fade-in {
  animation: fadeIn 0.4s ease-out;
}

.animate-slide-up {
  animation: slideUp 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

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

/* Print Styles */
@media print {
  body {
    background: #FFFFFF !important;
  }
  .top-navbar, .results-actions-bar, .modal-close-btn, .cert-modal-actions, #btn-toggle-sound {
    display: none !important;
  }
  .modal-backdrop {
    position: static;
    background: transparent;
    padding: 0;
  }
  .modal-content {
    box-shadow: none;
    max-width: 100%;
    padding: 0;
  }
}

/* Responsive Breakpoints */
@media (max-width: 768px) {
  .welcome-title { font-size: 1.7rem; }
  .result-hero-card { flex-direction: column; text-align: center; }
  .hero-medal { right: calc(50% - 45px); }
  .test-top-bar, .test-bottom-nav { flex-direction: column; align-items: stretch; }
  .cert-footer { flex-direction: column; align-items: center; }
  .question-card { padding: 20px; }
}
