/* ==========================================================================
   Fijate Tools - Juego de Trivial y Quiz de Cultura General
   Estilos CSS Prémium Responsivos con variables corporativas y modo oscuro
   ========================================================================== */

:root {
  color-scheme: dark;
  --font-main: 'Inter', system-ui, -apple-system, sans-serif;
  --font-heading: 'Outfit', 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Colores del tema oscuro (predeterminado) */
  --bg-body: #080c14;
  --bg-card: #0f172a;
  --bg-card-elevated: #1e293b;
  --bg-input: #1e293b;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-color-hover: rgba(255, 255, 255, 0.16);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  /* Acentos corporativos de marca */
  --primary: #ff8507;
  --primary-hover: #e07300;
  --primary-light: rgba(255, 133, 7, 0.15);
  --accent-cyan: #00e5ff;
  --accent-green: #10b981;
  --accent-red: #ef4444;
  --accent-purple: #a855f7;
  --accent-yellow: #eab308;
  --accent-blue: #3b82f6;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 20px rgba(255, 133, 7, 0.25);
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  color-scheme: light;
  --bg-body: #f1f5f9;
  --bg-card: #ffffff;
  --bg-card-elevated: #f8fafc;
  --bg-input: #f8fafc;
  --border-color: rgba(0, 0, 0, 0.08);
  --border-color-hover: rgba(0, 0, 0, 0.16);

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;

  --primary: #ff8507;
  --primary-hover: #e07300;
  --primary-light: rgba(255, 133, 7, 0.12);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: clip;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Estructura central */
.main-wrapper {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 1.25rem 3rem 1.25rem;
  box-sizing: border-box;
  flex: 1 0 auto;
}

.tool-with-sidebar {
  display: flex;
  gap: 24px;
  width: 100%;
  align-items: flex-start;
}

.tool-main-content {
  flex: 1 1 0%;
  min-width: 0;
}

.tool-ad-sidebar {
  width: 300px;
  flex-shrink: 0;
  position: sticky;
  top: 85px;
  align-self: stretch;
}

.ad-sticky-box {
  position: sticky;
  top: 85px;
}

.ad-unit-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 600px;
}

.ad-label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin-bottom: 6px;
  text-align: center;
}

/* Hero Section */
.tool-hero {
  margin-bottom: 24px;
}

.tool-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  border: 1px solid rgba(255, 133, 7, 0.25);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  margin-bottom: 12px;
}

.tool-hero h2 {
  font-family: var(--font-heading);
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.tool-hero p {
  font-size: 1rem;
  color: var(--text-muted);
  max-width: 820px;
}

/* Contenedor de la Aplicación */
.quiz-app-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 24px;
  position: relative;
  overflow: hidden;
  margin-bottom: 32px;
}

/* ==========================================================================
   VISTA 1: LOBBY Y CONFIGURACIÓN
   ========================================================================== */
.lobby-card {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.lobby-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--primary);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.85rem;
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
}

.lobby-section-title h3 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
}

/* Modos de Juego */
.game-modes-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.mode-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  background: var(--bg-card-elevated);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
}

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

.mode-card.is-selected {
  border-color: var(--primary);
  background: rgba(255, 133, 7, 0.08);
  box-shadow: var(--shadow-glow);
}

.mode-icon-box {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  flex-shrink: 0;
  color: #ffffff;
}

.mode-solo { background: linear-gradient(135deg, #ff8507, #f59e0b); }
.mode-party { background: linear-gradient(135deg, #00e5ff, #3b82f6); }
.mode-classic { background: linear-gradient(135deg, #a855f7, #ec4899); }
.mode-survival { background: linear-gradient(135deg, #ef4444, #f97316); }

.mode-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mode-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
}

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

/* Configuración de Jugadores (Party Mode) */
.lobby-players-box {
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.players-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.player-item-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
}

.player-item-row .p-avatar {
  font-size: 1.25rem;
  user-select: none;
}

.player-item-row input {
  flex: 1 1 0%;
  min-width: 0;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 600;
  outline: none;
}

.btn-remove-player {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: var(--transition);
}

.btn-remove-player:hover {
  color: var(--accent-red);
  background: rgba(239, 68, 68, 0.1);
}

/* Grilla de Ajustes */
.lobby-settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  height: 44px;
  min-height: 44px;
  background-color: var(--bg-input);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  transition: var(--transition);
}

.form-select:hover, .form-select:focus {
  border-color: var(--primary);
}

.form-select option {
  background-color: var(--bg-card);
  color: var(--text-main);
}

/* Botón de inicio */
.lobby-footer {
  display: flex;
  justify-content: center;
  padding-top: 12px;
}

.btn-start-game {
  width: 100%;
  max-width: 440px;
  height: 52px;
  min-height: 44px;
  font-size: 1.15rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.btn-spinner {
  width: 22px;
  height: 22px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}

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

/* Loading Overlay Prémium */
.quiz-loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(8px);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 24px;
  text-align: center;
  border-radius: var(--radius-lg);
  animation: fadeIn 0.2s ease;
}

.quiz-loading-overlay.is-active {
  display: flex;
}

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

.loading-spinner-ring {
  width: 58px;
  height: 58px;
  border: 4px solid var(--border-color);
  border-top-color: var(--primary);
  border-right-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 0.9s cubic-bezier(0.5, 0, 0.5, 1) infinite;
  margin-bottom: 18px;
}

.loading-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 6px;
}

.loading-subtext {
  font-size: 0.9rem;
  color: var(--text-muted);
  max-width: 320px;
}

/* ==========================================================================
   VISTA 2: GAMEPLAY EN CURSO
   ========================================================================== */
.game-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 18px;
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
}

.hud-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hud-badge-round {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light);
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.hud-player-turn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 0.95rem;
}

.hud-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.hud-timer-box {
  position: relative;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.timer-track {
  fill: none;
  stroke: var(--border-color);
  stroke-width: 3.5;
}

.timer-progress {
  fill: none;
  stroke: var(--primary);
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-dasharray: 100.5;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.8s linear, stroke 0.3s ease;
}

.timer-number {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text-main);
}

.hud-timer-box.timer-warning .timer-progress {
  stroke: var(--accent-red);
}

.hud-timer-box.timer-warning .timer-number {
  color: var(--accent-red);
}

.hud-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.hud-stat-box {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.hud-stat-box .stat-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
}

.hud-stat-box .stat-val {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-main);
}

.streak-fire {
  color: var(--primary) !important;
}

.btn-hud-quit {
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.btn-hud-quit:hover {
  color: var(--accent-red);
  border-color: var(--accent-red);
  background: rgba(239, 68, 68, 0.1);
}

/* Barra de Progreso Lineal */
.game-progress-bar-wrap {
  width: 100%;
  height: 6px;
  background: var(--border-color);
  border-radius: var(--radius-full);
  margin-bottom: 20px;
  overflow: hidden;
}

.game-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent-cyan));
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

/* HUD Modo Clásico (Quesitos) */
.classic-wedges-hud {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.wedges-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
}

.wedges-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.wedge-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: var(--bg-input);
  color: var(--text-dim);
  border: 1px solid var(--border-color);
  opacity: 0.45;
  transition: var(--transition);
}

.wedge-chip.is-earned {
  opacity: 1;
  color: var(--text-main);
  border-color: currentColor;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.15);
}

.w-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.dot-blue { background: #3b82f6; }
.dot-yellow { background: #eab308; }
.dot-green { background: #10b981; }
.dot-purple { background: #a855f7; }
.dot-pink { background: #ec4899; }
.dot-orange { background: #f97316; }

/* Tarjeta de Pregunta */
.question-card {
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 18px;
}

.question-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.cat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light);
  padding: 4px 12px;
  border-radius: var(--radius-full);
}

.diff-pill {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.question-text {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.4;
  letter-spacing: -0.01em;
}

/* Grilla de Opciones */
.answers-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.btn-answer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  min-height: 52px;
  background: var(--bg-input);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.95rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
  outline: none;
  width: 100%;
}

.btn-answer:hover:not(:disabled) {
  border-color: var(--primary);
  background: rgba(255, 133, 7, 0.08);
  transform: translateY(-2px);
}

.ans-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
  color: var(--text-muted);
}

.ans-text {
  flex: 1 1 0%;
  min-width: 0;
  word-break: break-word;
}

/* Estados de Respuesta */
.btn-answer.is-correct {
  background: rgba(16, 185, 129, 0.2) !important;
  border-color: var(--accent-green) !important;
  color: #ffffff !important;
}

.btn-answer.is-correct .ans-letter {
  background: var(--accent-green) !important;
  color: #ffffff !important;
  border-color: var(--accent-green) !important;
}

.btn-answer.is-wrong {
  background: rgba(239, 68, 68, 0.2) !important;
  border-color: var(--accent-red) !important;
  color: #ffffff !important;
  animation: shake 0.4s ease;
}

.btn-answer.is-wrong .ans-letter {
  background: var(--accent-red) !important;
  color: #ffffff !important;
  border-color: var(--accent-red) !important;
}

.btn-answer.is-dimmed {
  opacity: 0.35;
  pointer-events: none;
}

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

/* Panel de Comodines */
.lifelines-panel {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 16px;
}

.btn-lifeline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  min-height: 40px;
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.btn-lifeline:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: scale(1.04);
}

.btn-lifeline:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* Banner de Feedback */
.feedback-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-top: 12px;
  animation: slideUp 0.3s ease;
}

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

.feedback-msg-box {
  display: flex;
  align-items: center;
  gap: 12px;
}

.feedback-icon {
  font-size: 1.8rem;
}

.feedback-texts {
  display: flex;
  flex-direction: column;
}

.feedback-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 800;
}

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

.btn-next-q {
  min-width: 180px;
  height: 46px;
  min-height: 44px;
}

/* ==========================================================================
   VISTA 3: RESULTADOS Y PODIO
   ========================================================================== */
.results-card {
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: relative;
}

.confetti-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

.results-hero {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.results-trophy-box {
  font-size: 3.5rem;
  margin-bottom: 4px;
  animation: bounce 1s infinite alternate ease-in-out;
}

@keyframes bounce {
  from { transform: translateY(0); }
  to { transform: translateY(-8px); }
}

.results-headline {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-main);
}

.results-subheadline {
  font-size: 1rem;
  color: var(--text-muted);
}

/* Podio Multijugador */
.podium-section {
  margin: 12px 0;
}

.podium-grid {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 12px;
  min-height: 190px;
  padding-top: 20px;
}

.podium-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 110px;
}

.podium-player-name {
  font-size: 0.85rem;
  font-weight: 700;
  text-align: center;
  word-break: break-word;
}

.podium-block {
  width: 100%;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 800;
  font-family: var(--font-mono);
  box-shadow: var(--shadow-sm);
}

.podium-1 { height: 130px; background: linear-gradient(180deg, #f59e0b, #d97706); }
.podium-2 { height: 95px; background: linear-gradient(180deg, #94a3b8, #64748b); }
.podium-3 { height: 70px; background: linear-gradient(180deg, #b45309, #78350f); }

/* Métricas */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metric-card {
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.metric-num {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 800;
}

.metric-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.text-orange { color: var(--primary); }
.text-cyan { color: var(--accent-cyan); }
.text-green { color: var(--accent-green); }
.text-purple { color: var(--accent-purple); }

/* Desglose por categorías */
.categories-breakdown {
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
}

.categories-breakdown h4 {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 12px;
}

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

.breakdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.9rem;
}

.breakdown-cat-name {
  font-weight: 600;
  color: var(--text-main);
  flex: 1 1 0%;
  min-width: 0;
}

.breakdown-bar-bg {
  width: 140px;
  height: 8px;
  background: var(--border-color);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.breakdown-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: var(--radius-full);
}

.breakdown-score {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-muted);
  width: 50px;
  text-align: right;
}

/* Botones de acción */
.results-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 8px;
}

/* ==========================================================================
   BOTONES Y COMPONENTES GLOBALES
   ========================================================================== */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0 20px;
  font-family: var(--font-main);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  min-height: 44px;
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: var(--shadow-glow);
  transform: translateY(-1px);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--bg-card-elevated);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0 18px;
  font-family: var(--font-main);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  min-height: 44px;
}

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

.btn-share {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #25d366;
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0 18px;
  font-family: var(--font-main);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  min-height: 44px;
}

.btn-share:hover {
  background: #20bd5a;
  transform: translateY(-1px);
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent-red);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0 18px;
  font-family: var(--font-main);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  min-height: 44px;
}

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

.btn-sm {
  min-height: 36px !important;
  font-size: 0.85rem !important;
  padding: 0 12px !important;
}

/* ==========================================================================
   SECCIÓN EDUCATIVA Y SEO
   ========================================================================== */
.quiz-edu-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 32px;
}

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

.edu-card h4 {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
}

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

/* ==========================================================================
   MODALES Y TOAST
   ========================================================================== */
.quiz-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
}

.quiz-modal-backdrop.is-open {
  display: flex;
}

.quiz-modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: scaleIn 0.25s ease;
}

.modal-large {
  max-width: 580px !important;
}

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

.modal-icon-alert {
  font-size: 2.2rem;
  text-align: center;
}

.modal-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  text-align: center;
}

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

.modal-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
}

.modal-header-row .modal-title {
  text-align: left;
}

.btn-modal-close {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-modal-close:hover {
  color: var(--text-main);
  background: var(--bg-card-elevated);
}

.modal-body-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 380px;
  overflow-y: auto;
}

.rule-block h4 {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
}

.rule-block p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.modal-actions-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  padding-top: 8px;
}

.modal-actions-row button {
  flex: 1 1 0%;
}

/* Toast */
.quiz-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-card-elevated);
  color: var(--text-main);
  border: 1px solid var(--primary);
  border-radius: var(--radius-full);
  padding: 10px 20px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* ==========================================================================
   RESPONSIVIDAD Y REGLAS MÓVILES (Regla 10)
   ========================================================================== */
@media (max-width: 1024px) {
  .tool-with-sidebar {
    flex-direction: column;
  }
  .tool-ad-sidebar {
    width: 100%;
    position: static;
    margin-top: 24px;
  }
  .ad-unit-card {
    min-height: 250px;
  }
}

@media (max-width: 768px) {
  .quiz-app-container {
    padding: 16px;
  }

  .game-modes-grid {
    grid-template-columns: 1fr;
  }

  .lobby-settings-grid {
    grid-template-columns: 1fr;
  }

  .players-list {
    grid-template-columns: 1fr;
  }

  .answers-grid {
    grid-template-columns: 1fr;
  }

  .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .quiz-edu-grid {
    grid-template-columns: 1fr;
  }

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

  .btn-answer {
    min-height: 48px;
    padding: 12px 14px;
  }

  .results-actions {
    flex-direction: column;
    width: 100%;
  }

  .results-actions button {
    width: 100%;
  }

  .feedback-banner {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .btn-next-q {
    width: 100%;
  }
}
