/* =============================================================================
   COPA CABIN CREW ACADEMY — SISTEMA DE DISEÑO AERONÁUTICO
   ============================================================================= */

:root {
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  
  /* Tema Oscuro (Cockpit Night Mode por defecto) */
  --bg-primary: #09121d;
  --bg-secondary: #0f1e2f;
  --bg-card: rgba(18, 35, 56, 0.75);
  --bg-card-hover: rgba(26, 48, 76, 0.85);
  --border-color: rgba(56, 189, 248, 0.18);
  --border-focus: #38bdf8;
  
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --accent-cyan: #0ea5e9;
  --accent-cyan-glow: rgba(14, 165, 233, 0.25);
  --accent-sky: #38bdf8;
  --accent-gold: #f59e0b;
  --accent-gold-glow: rgba(245, 158, 11, 0.2);
  --accent-emerald: #10b981;
  --accent-emerald-glow: rgba(16, 185, 129, 0.2);
  --accent-ruby: #ef4444;
  --accent-ruby-glow: rgba(239, 68, 68, 0.2);

  --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 20px rgba(14, 165, 233, 0.25);
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 9999px;

  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg-primary: #f0f4f8;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --border-color: #cbd5e1;
  --border-focus: #0284c7;
  
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;

  --accent-cyan: #0284c7;
  --accent-cyan-glow: rgba(2, 132, 199, 0.15);
  --accent-sky: #0369a1;
  --accent-gold: #d97706;
  --accent-gold-glow: rgba(217, 119, 6, 0.15);
  --accent-emerald: #059669;
  --accent-ruby: #dc2626;

  --shadow-card: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-glow: 0 0 15px rgba(2, 132, 199, 0.15);
}

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

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

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(14, 165, 233, 0.04) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(245, 158, 11, 0.03) 0%, transparent 40%);
  background-attachment: fixed;
}

/* APP SHELL / HEADER */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background-color: rgba(9, 18, 29, 0.85);
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 1.5rem;
}

[data-theme="light"] .app-header {
  background-color: rgba(255, 255, 255, 0.9);
}

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

.brand-area {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-wing-logo {
  font-size: 1.6rem;
  background: linear-gradient(135deg, var(--accent-sky), var(--accent-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-text h1 {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

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

.header-gamification-hud {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--bg-card);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-color);
}

.hud-rank-pill {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-sky);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.hud-xp-badge {
  background: var(--accent-gold);
  color: #1e1e1e;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-pill);
}

.hud-progress-mini {
  width: 70px;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.hud-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-gold));
  border-radius: var(--radius-pill);
  transition: width 0.4s ease;
}

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

/* BOTONES DE ACCIÓN */
.btn-util {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition-fast);
}

.btn-util:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-focus);
}

/* NAVEGACIÓN PRINCIPAL (TABS) */
.nav-bar-container {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 60px;
  z-index: 90;
}

.nav-bar-inner {
  max-width: 1300px;
  margin: 0 auto;
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-bar-inner::-webkit-scrollbar { display: none; }

.nav-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.85rem 1.25rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
  transition: var(--transition-fast);
}

.nav-tab-btn:hover {
  color: var(--text-main);
}

.nav-tab-btn.nav-active {
  color: var(--accent-sky);
  border-bottom-color: var(--accent-sky);
  background: rgba(14, 165, 233, 0.05);
}

/* CONTENEDOR PRINCIPAL */
.main-content-layout {
  max-width: 1300px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 4rem 1.5rem;
  width: 100%;
  flex: 1;
}

.hidden {
  display: none !important;
}

/* =============================================================================
   1. GUÍA COMPLETA — ESTILOS Y CONTENIDO VERBATIM
   ============================================================================= */
.guide-layout-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.5rem;
  align-items: start;
}

.guide-sidebar {
  position: sticky;
  top: 125px;
  background: var(--bg-card);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  max-height: calc(100vh - 145px);
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-header h3 {
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.toc-scroll-list {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding-right: 0.3rem;
}

.toc-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.82rem;
  line-height: 1.3;
  transition: var(--transition-fast);
}

.toc-link:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
}

.toc-num {
  font-weight: 800;
  color: var(--accent-sky);
  min-width: 1.2rem;
}

.toc-title {
  flex: 1;
}

.toc-check {
  color: var(--accent-emerald);
  font-weight: bold;
}

.guide-main-column {
  min-width: 0;
}

/* BARRA DE HERRAMIENTAS DE LA GUÍA */
.guide-toolbar {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.search-box-wrap {
  flex: 1;
  min-width: 240px;
  position: relative;
}

.search-box-wrap input {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  padding: 0.55rem 0.85rem 0.55rem 2.2rem;
  font-size: 0.88rem;
  outline: none;
  transition: var(--transition-fast);
}

.search-box-wrap input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-cyan-glow);
}

.search-icon-fixed {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
}

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

.font-size-group {
  display: flex;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.btn-font-scale {
  background: transparent;
  border: none;
  color: var(--text-main);
  padding: 0.4rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-font-scale:hover {
  background: var(--bg-card-hover);
  color: var(--accent-sky);
}

/* TARJETAS DE SECCIÓN DE LA GUÍA */
.guide-header-card {
  background: linear-gradient(135deg, rgba(15, 30, 47, 0.95), rgba(9, 18, 29, 0.98));
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 1.5rem;
  text-align: center;
  box-shadow: var(--shadow-card);
}

[data-theme="light"] .guide-header-card {
  background: linear-gradient(135deg, #ffffff, #f1f5f9);
}

.guide-badge-pill {
  display: inline-block;
  background: var(--accent-cyan-glow);
  color: var(--accent-sky);
  border: 1px solid var(--accent-cyan);
  padding: 0.25rem 0.85rem;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

.guide-main-title {
  font-size: 1.8rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  margin-bottom: 0.4rem;
  color: var(--text-main);
}

.guide-main-sub {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.guide-disclaimer-box {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1.2rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  text-align: left;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-main);
}

.guide-section-card {
  background: var(--bg-card);
  backdrop-filter: blur(6px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-card);
  transition: var(--transition-normal);
}

.guide-section-card.section-completed {
  border-left: 4px solid var(--accent-emerald);
}

.section-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.section-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.section-pill {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-sky);
}

.section-heading {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.3;
}

.btn-read-toggle {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-fast);
}

.btn-read-toggle:hover {
  border-color: var(--accent-emerald);
  color: var(--text-main);
}

.btn-read-toggle.is-read {
  background: var(--accent-emerald-glow);
  color: var(--accent-emerald);
  border-color: var(--accent-emerald);
}

/* CUERPO Y FORMATO VERBATIM */
.section-card-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  line-height: 1.65;
  color: var(--text-main);
}

.scale-sm { font-size: 0.88rem; }
.scale-md { font-size: 1rem; }
.scale-lg { font-size: 1.15rem; }

.content-paragraph {
  margin-bottom: 0.25rem;
}

.content-label {
  color: var(--accent-sky);
  font-weight: 700;
}

.content-alert-box {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  font-size: 0.95em;
}

.alert-label {
  color: var(--accent-ruby);
}

.content-quote-box {
  background: rgba(14, 165, 233, 0.06);
  border-left: 4px solid var(--accent-cyan);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 0.85rem 1.25rem;
  font-style: italic;
}

.quote-label {
  font-style: normal;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--accent-sky);
  margin-bottom: 0.25rem;
}

.quote-text {
  font-size: 1.1em;
  font-weight: 600;
  color: var(--text-main);
}

.content-mnemonic-card {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(245, 158, 11, 0.03));
  border: 1px dashed rgba(245, 158, 11, 0.4);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.mnemonic-badge {
  background: var(--accent-gold);
  color: #1e1e1e;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
}

.mnemonic-code {
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--accent-gold);
}

.content-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.content-list li {
  padding-left: 0.5rem;
  border-left: 2px solid var(--border-color);
}

.list-label {
  font-weight: 700;
  color: var(--accent-sky);
  margin-bottom: 0.4rem;
}

/* TABLA CRONOLÓGICA */
.timeline-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.timeline-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9em;
  text-align: left;
}

.timeline-table th {
  background: var(--bg-primary);
  padding: 0.65rem 0.85rem;
  font-weight: 800;
  color: var(--accent-sky);
  border-bottom: 1px solid var(--border-color);
}

.timeline-table td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

[data-theme="light"] .timeline-table td {
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.year-cell {
  font-weight: 700;
  color: var(--accent-gold);
  white-space: nowrap;
  width: 130px;
}

.search-highlight {
  background-color: #fef08a;
  color: #854d0e;
  font-weight: bold;
  padding: 0 2px;
  border-radius: 2px;
}

/* =============================================================================
   2. PRÁCTICA DE RECUPERACIÓN ACTIVA (FLASHCARDS)
   ============================================================================= */
.flashcards-layout {
  max-width: 760px;
  margin: 0 auto;
}

.flashcard-deck-wrap {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.flashcards-top-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  text-align: center;
  box-shadow: var(--shadow-card);
}

.stat-card.stat-accent {
  border-color: var(--accent-sky);
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.1), transparent);
}

.stat-num {
  display: block;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-main);
}

.stat-card.stat-accent .stat-num {
  color: var(--accent-sky);
}

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

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

.filter-pills-group {
  display: flex;
  gap: 0.4rem;
}

.btn-filter-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-filter-pill.filter-active {
  background: var(--accent-sky);
  color: #09121d;
  border-color: var(--accent-sky);
}

.flashcard-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
}

.card-section-tag {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-pill);
}

.badge-mastered {
  color: var(--accent-emerald);
}

.badge-pending {
  color: var(--accent-gold);
}

.flashcard-main-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.2rem;
  box-shadow: var(--shadow-card);
  min-height: 280px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  transition: var(--transition-normal);
  position: relative;
}

.card-q-number {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--accent-sky);
  margin-bottom: 0.5rem;
}

.card-question-text {
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.4;
  color: var(--text-main);
  margin-bottom: 1rem;
}

.card-prompt-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.btn-reveal {
  background: linear-gradient(135deg, var(--accent-sky), var(--accent-cyan));
  color: #09121d;
  font-weight: 800;
  font-size: 0.95rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius-pill);
  cursor: pointer;
  align-self: center;
  box-shadow: var(--shadow-glow);
  transition: var(--transition-fast);
}

.btn-reveal:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

.flashcard-back {
  text-align: left;
  border-top: 1px solid var(--border-color);
  padding-top: 1.5rem;
  margin-top: 1.5rem;
  animation: fadeIn 0.3s ease;
}

.answer-badge {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--accent-gold);
  letter-spacing: 0.05em;
}

.official-answer-text {
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.6;
  color: var(--text-main);
  margin: 0.5rem 0 1rem 0;
  background: rgba(14, 165, 233, 0.05);
  border-left: 3px solid var(--accent-gold);
  padding: 0.85rem 1rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

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

.flashcard-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.card-grade-buttons {
  display: flex;
  gap: 0.75rem;
}

.btn-grade-review {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid var(--accent-ruby);
  color: var(--accent-ruby);
  font-weight: 700;
  font-size: 0.88rem;
  padding: 0.65rem 1.1rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-grade-review:hover {
  background: var(--accent-ruby);
  color: #ffffff;
}

.btn-grade-known {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid var(--accent-emerald);
  color: var(--accent-emerald);
  font-weight: 700;
  font-size: 0.88rem;
  padding: 0.65rem 1.1rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-grade-known:hover {
  background: var(--accent-emerald);
  color: #ffffff;
}

.btn-nav-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-weight: 600;
  padding: 0.65rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}

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

.keyboard-hints {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.75rem;
  margin-top: 0.5rem;
}

/* =============================================================================
   3. SIMULACRO OFICIAL (20 MIN, 15 PREGUNTAS, NOTA MÍNIMA 85%)
   ============================================================================= */
.sim-layout {
  max-width: 860px;
  margin: 0 auto;
}

.sim-briefing-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: var(--shadow-card);
  text-align: center;
}

.briefing-header {
  margin-bottom: 2rem;
}

.briefing-icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

.briefing-header h2 {
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--text-main);
}

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

.briefing-rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.rule-box {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem 1rem;
  text-align: center;
}

.rule-box.rule-highlight {
  border-color: var(--accent-gold);
  background: rgba(245, 158, 11, 0.05);
}

.rule-icon {
  font-size: 1.8rem;
  display: block;
  margin-bottom: 0.5rem;
}

.rule-box strong {
  display: block;
  color: var(--text-main);
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.rule-box p {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* EXAMEN EN CURSO */
.sim-exam-layout {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.sim-hud-bar {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.exam-title-badge {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--accent-sky);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: block;
}

.exam-q-counter {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-main);
}

.hud-timer {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 0.4rem 1rem;
  border-radius: var(--radius-pill);
}

.timer-val {
  font-size: 1.2rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--accent-sky);
}

.timer-warning {
  color: var(--accent-ruby) !important;
  animation: pulseTimer 1s infinite;
}

@keyframes pulseTimer {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.btn-flag {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-flag.flagged {
  border-color: var(--accent-gold);
  color: var(--accent-gold);
  background: var(--accent-gold-glow);
}

.sim-bubbles-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  background: var(--bg-card);
  padding: 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.sim-bubble {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.sim-bubble.bubble-current {
  border-color: var(--accent-sky);
  box-shadow: 0 0 0 2px var(--accent-sky);
}

.sim-bubble.bubble-answered {
  background: var(--accent-cyan);
  color: #09121d;
  border-color: var(--accent-cyan);
}

.sim-bubble.bubble-flagged {
  border-color: var(--accent-gold);
  position: relative;
}
.sim-bubble.bubble-flagged::after {
  content: '';
  position: absolute;
  top: 2px;
  right: 2px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-gold);
}

.sim-question-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-card);
}

.q-source-tag {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--accent-sky);
}

.q-text {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 0.5rem 0 1.5rem 0;
  line-height: 1.4;
}

.sim-options-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.sim-option-btn {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  text-align: left;
  color: var(--text-main);
  cursor: pointer;
  transition: var(--transition-fast);
  font-size: 0.95rem;
  line-height: 1.5;
}

.sim-option-btn:hover {
  border-color: var(--accent-sky);
  background: var(--bg-card-hover);
}

.sim-option-btn.option-selected {
  border-color: var(--accent-sky);
  background: rgba(14, 165, 233, 0.12);
  box-shadow: 0 0 0 2px var(--accent-sky);
}

.opt-letter {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  font-weight: 800;
  font-size: 0.85rem;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.option-selected .opt-letter {
  background: var(--accent-sky);
  color: #09121d;
}

.sim-bottom-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.btn-finish-sim {
  background: var(--accent-gold);
  color: #1e1e1e;
  font-weight: 800;
  font-size: 0.9rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-finish-sim:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

/* RESULTADOS DEL SIMULACRO */
.sim-results-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-card);
}

.results-banner {
  border-radius: var(--radius-md);
  padding: 1.75rem;
  text-align: center;
  margin-bottom: 2rem;
}

.banner-passed {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(16, 185, 129, 0.05));
  border: 2px solid var(--accent-emerald);
}

.banner-failed {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(239, 68, 68, 0.05));
  border: 2px solid var(--accent-ruby);
}

.result-icon {
  font-size: 3.5rem;
  margin-bottom: 0.5rem;
}

.result-status-title {
  font-size: 1.6rem;
  font-weight: 900;
  margin-bottom: 0.4rem;
}

.banner-passed .result-status-title { color: var(--accent-emerald); }
.banner-failed .result-status-title { color: var(--accent-ruby); }

.results-score-metrics {
  display: flex;
  align-items: center;
  justify-content: space-around;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
}

.score-circle-wrap {
  text-align: center;
}

.score-number {
  font-size: 3.5rem;
  font-weight: 900;
  color: var(--text-main);
  line-height: 1;
}

.score-fraction {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

.results-info-pills {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.pill-item {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  display: flex;
  gap: 0.5rem;
}

.results-cta-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 2.5rem;
}

.results-breakdown-section h3 {
  font-size: 1.2rem;
  font-weight: 800;
  margin-bottom: 1rem;
  color: var(--text-main);
}

.breakdown-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.breakdown-item {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.breakdown-item.item-correct {
  border-left: 4px solid var(--accent-emerald);
}

.breakdown-item.item-incorrect {
  border-left: 4px solid var(--accent-ruby);
}

.breakdown-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.breakdown-badge {
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-pill);
}

.item-correct .breakdown-badge {
  background: var(--accent-emerald-glow);
  color: var(--accent-emerald);
}

.item-incorrect .breakdown-badge {
  background: var(--accent-ruby-glow);
  color: var(--accent-ruby);
}

.breakdown-q {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.75rem;
}

.breakdown-ans-user, .breakdown-ans-correct {
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
}

.breakdown-ans-correct {
  color: var(--accent-emerald);
}

.breakdown-explanation {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
}

/* =============================================================================
   4. ZONA DE JUEGOS
   ============================================================================= */
.games-hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.game-hub-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-card);
  transition: var(--transition-normal);
}

.game-hub-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-sky);
  box-shadow: var(--shadow-glow);
}

.game-card-icon {
  font-size: 2.8rem;
  margin-bottom: 1rem;
}

.game-card-tag {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-sky);
}

.game-hub-card h3 {
  font-size: 1.35rem;
  font-weight: 800;
  margin: 0.35rem 0 0.65rem 0;
  color: var(--text-main);
}

.game-hub-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 1.5rem;
}

.game-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.game-xp-tag {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--accent-gold);
}

.btn-game-play {
  background: linear-gradient(135deg, var(--accent-sky), var(--accent-cyan));
  color: #09121d;
  font-weight: 800;
  font-size: 0.85rem;
  padding: 0.55rem 1.25rem;
  border: none;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-game-play:hover {
  filter: brightness(1.1);
}

/* ARENA DE JUEGO */
.game-arena-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-card);
}

.game-arena-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.game-arena-top h2 {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
}

/* JUEGO 1: MEMORIA GRID */
.memory-grid {
  display: grid;
  gap: 0.85rem;
  perspective: 1000px;
}

.grid-16 {
  grid-template-columns: repeat(4, 1fr);
}

.memory-card {
  height: 110px;
  cursor: pointer;
  position: relative;
}

.memory-card-inner {
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.memory-card.flipped .memory-card-inner,
.memory-card.matched .memory-card-inner {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem;
  text-align: center;
  border: 1px solid var(--border-color);
}

.card-back-design {
  background: linear-gradient(135deg, #0b1f3a, #071324);
  font-size: 2rem;
}

.card-front-text {
  background: var(--bg-secondary);
  transform: rotateY(180deg);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
}

.memory-card.matched .card-front-text {
  border-color: var(--accent-emerald);
  background: rgba(16, 185, 129, 0.15);
  box-shadow: 0 0 10px var(--accent-emerald-glow);
}

/* JUEGO 2: RETO 60S */
.speed-hud-bar {
  display: flex;
  justify-content: space-around;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
}

.speed-metric {
  text-align: center;
}

.speed-metric span {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
}

.speed-metric strong {
  font-size: 1.5rem;
  color: var(--text-main);
}

.metric-score { color: var(--accent-sky) !important; }
.metric-streak { color: var(--accent-gold) !important; }

.speed-question-box {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
}

.speed-prompt {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 1.5rem;
}

.speed-options-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.speed-option-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem 1rem;
  color: var(--text-main);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.speed-option-btn:hover {
  background: var(--accent-sky);
  color: #09121d;
  border-color: var(--accent-sky);
  transform: scale(1.02);
}

/* JUEGO 3: LÍNEA DE TIEMPO */
.timeline-instructions-box {
  background: rgba(14, 165, 233, 0.08);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.timeline-sortable-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.timeline-sort-item {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: var(--transition-fast);
}

.timeline-sort-item.item-order-correct {
  border-left: 4px solid var(--accent-emerald);
  background: rgba(16, 185, 129, 0.05);
}

.timeline-sort-item.item-order-wrong {
  border-left: 4px solid var(--accent-ruby);
  background: rgba(239, 68, 68, 0.05);
}

.sort-handle {
  font-size: 1.2rem;
  color: var(--text-dim);
  cursor: grab;
}

.sort-event-content {
  flex: 1;
}

.event-title-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.event-desc-text {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.order-badge {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-pill);
}

.badge-ok {
  background: var(--accent-emerald-glow);
  color: var(--accent-emerald);
}

.badge-err {
  background: var(--accent-ruby-glow);
  color: var(--accent-ruby);
}

.sort-arrows {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.btn-arrow {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 28px;
  height: 28px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.75rem;
}

.btn-arrow:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.game-victory-card {
  text-align: center;
  padding: 2.5rem 1.5rem;
}

.victory-icon {
  font-size: 3.5rem;
  margin-bottom: 0.75rem;
}

.game-victory-card h2 {
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.game-victory-card p {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.victory-stats {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.v-stat {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
}

.v-stat strong {
  display: block;
  font-size: 1.4rem;
  color: var(--accent-sky);
}

.v-stat span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.victory-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

/* =============================================================================
   5. PERFIL Y LOGROS
   ============================================================================= */
.profile-layout {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.rank-showcase-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  display: flex;
  align-items: center;
  gap: 1.75rem;
  box-shadow: var(--shadow-card);
}

.rank-avatar-large {
  font-size: 4.5rem;
  flex-shrink: 0;
}

.rank-details {
  flex: 1;
}

.rank-pill {
  background: var(--accent-cyan-glow);
  color: var(--accent-sky);
  border: 1px solid var(--accent-cyan);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-pill);
}

.rank-title {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--text-main);
  margin: 0.35rem 0 0.25rem 0;
}

.rank-xp-info {
  font-size: 0.9rem;
  color: var(--accent-gold);
  margin-bottom: 0.75rem;
}

.progress-bar-track {
  width: 100%;
  height: 10px;
  background: var(--bg-primary);
  border-radius: var(--radius-pill);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-sky), var(--accent-gold));
  border-radius: var(--radius-pill);
}

.progress-sub-text {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
}

.profile-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1rem;
}

.metric-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem 1rem;
  text-align: center;
  box-shadow: var(--shadow-card);
}

.metric-ico {
  font-size: 1.8rem;
  display: block;
  margin-bottom: 0.25rem;
}

.metric-val {
  font-size: 1.35rem;
  font-weight: 900;
  color: var(--text-main);
}

.metric-lbl {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.achievements-section h3, .sim-history-section h3 {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 1rem;
  color: var(--text-main);
}

.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.achievement-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  gap: 1rem;
  box-shadow: var(--shadow-card);
  transition: var(--transition-fast);
}

.achievement-card.ach-unlocked {
  border-color: var(--accent-gold);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.08), transparent);
}

.achievement-card.ach-locked {
  opacity: 0.5;
  filter: grayscale(0.8);
}

.ach-icon {
  font-size: 2rem;
  flex-shrink: 0;
}

.ach-info {
  flex: 1;
}

.ach-title {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text-main);
}

.ach-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0.2rem 0 0.4rem 0;
}

.ach-reward {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--accent-gold);
}

.history-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  text-align: left;
}

.history-table th {
  background: var(--bg-primary);
  padding: 0.75rem 1rem;
  font-weight: 800;
  color: var(--accent-sky);
  border-bottom: 1px solid var(--border-color);
}

.history-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.badge-sim-pass {
  background: var(--accent-emerald-glow);
  color: var(--accent-emerald);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 800;
}

.badge-sim-fail {
  background: var(--accent-ruby-glow);
  color: var(--accent-ruby);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 800;
}

.profile-danger-zone {
  text-align: center;
  margin-top: 1rem;
}

/* BOTONES GENERALES */
.btn {
  border: none;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: var(--transition-fast);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-sky), var(--accent-cyan));
  color: #09121d;
  padding: 0.7rem 1.4rem;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.7rem 1.4rem;
  border-radius: var(--radius-pill);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-focus);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid var(--accent-ruby);
  color: var(--accent-ruby);
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
}

.btn-danger:hover {
  background: var(--accent-ruby);
  color: #ffffff;
}

.btn-lg {
  padding: 0.9rem 2rem;
  font-size: 1.05rem;
}

/* TOASTS NOTIFICATIONS */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  font-size: 0.88rem;
  font-weight: 700;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: auto;
}

.toast-item.toast-show {
  opacity: 1;
  transform: translateY(0);
}

.toast-xp { border-color: var(--accent-gold); color: var(--accent-gold); }
.toast-achievement { border-color: var(--accent-sky); color: var(--accent-sky); }
.toast-rank-up { border-color: var(--accent-emerald); color: var(--accent-emerald); }

/* =============================================================================
   MODAL DE ACCESO MÓVIL Y CÓDIGO QR
   ============================================================================= */
.btn-mobile-pill {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.15), rgba(56, 189, 248, 0.08));
  border-color: var(--accent-sky);
  color: var(--accent-sky);
  font-weight: 700;
}

.btn-mobile-pill:hover {
  background: var(--accent-sky);
  color: #09121d;
}

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.2s ease;
}

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-card), var(--shadow-glow);
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-icon {
  font-size: 1.4rem;
}

.modal-title-wrap h3 {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
}

.btn-close-modal {
  background: transparent;
  border: none;
  font-size: 1.6rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  padding: 0.2rem;
  transition: var(--transition-fast);
}

.btn-close-modal:hover {
  color: var(--accent-ruby);
}

.modal-body {
  padding: 1.75rem 1.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.modal-instructions {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.qr-code-wrapper {
  background: #ffffff;
  padding: 1rem;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.qr-svg-code {
  display: block;
}

.direct-link-box {
  width: 100%;
  text-align: left;
}

.direct-link-label {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--accent-sky);
  margin-bottom: 0.35rem;
  display: block;
}

.direct-link-input-group {
  display: flex;
  gap: 0.5rem;
}

.direct-link-input-group input {
  flex: 1;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  padding: 0.6rem 0.85rem;
  font-size: 0.9rem;
  font-weight: 700;
  outline: none;
}

.pwa-install-hints {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  font-size: 0.82rem;
}

.pwa-hint-item strong {
  color: var(--text-main);
  display: block;
  margin-bottom: 0.15rem;
}

.pwa-hint-item span {
  color: var(--text-muted);
}

/* =============================================================================
   ESTILOS DE IMPRESIÓN OFICIAL (@MEDIA PRINT)
   ============================================================================= */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }

  .app-header,
  .nav-bar-container,
  .guide-sidebar,
  .guide-toolbar,
  .btn-read-toggle,
  #toast-container,
  .keyboard-hints,
  .btn {
    display: none !important;
  }

  .main-content-layout {
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .guide-layout-grid {
    display: block !important;
  }

  .guide-section-card {
    border: 1px solid #ddd !important;
    background: #ffffff !important;
    color: #000000 !important;
    box-shadow: none !important;
    page-break-inside: avoid;
    margin-bottom: 1.5cm !important;
  }

  .guide-header-card {
    background: #f8fafc !important;
    border: 1px solid #333 !important;
    color: #000000 !important;
    page-break-after: always;
  }

  .section-heading, .content-label, .quote-text, .mnemonic-code {
    color: #000000 !important;
  }

  .content-quote-box {
    border-left-color: #333 !important;
    background: #f1f5f9 !important;
  }

  .timeline-table th {
    background: #e2e8f0 !important;
    color: #000000 !important;
  }

  .timeline-table td {
    border-bottom: 1px solid #ccc !important;
    color: #000000 !important;
  }
}

/* =============================================================================
   RESPONSIVE DESIGN (MÓVIL Y TABLET)
   ============================================================================= */
@media (max-width: 900px) {
  .guide-layout-grid {
    grid-template-columns: 1fr;
  }

  .guide-sidebar {
    display: none; /* En móvil se consulta la guía con scroll fluido y búsqueda */
  }

  .header-gamification-hud .hud-progress-mini {
    display: none;
  }

  .speed-options-grid {
    grid-template-columns: 1fr;
  }

  .memory-grid.grid-16 {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 600px) {
  .app-header {
    padding: 0.6rem 1rem;
  }

  .brand-text h1 {
    font-size: 1rem;
  }

  .nav-tab-btn {
    padding: 0.75rem 0.9rem;
    font-size: 0.82rem;
  }

  .flashcards-top-stats {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .flashcard-action-bar {
    flex-direction: column;
    width: 100%;
  }

  .card-grade-buttons {
    width: 100%;
  }

  .btn-grade-review, .btn-grade-known {
    flex: 1;
    text-align: center;
  }

  .memory-grid.grid-16 {
    grid-template-columns: repeat(2, 1fr);
  }

  .memory-card {
    height: 95px;
  }

  .rank-showcase-card {
    flex-direction: column;
    text-align: center;
  }
}
