/* ============================================================
   QAQuiz v15 — Sistema de diseno premium dark mode
   Inspirado en Mentimeter. Mobile-first, accesible, animado.
   ============================================================ */

/* --- Variables de diseno --- */
:root {
  --bg-primary: #0f0e17;
  --bg-secondary: #1a1a2e;
  --bg-card: #16213e;
  --bg-card-hover: #1c2a4a;
  --bg-input: #1e2746;
  --border: #2a2d5a;
  --border-focus: #6C5CE7;

  --text-primary: #eaeaea;
  --text-secondary: #a0a0b8;
  --text-muted: #6b6b80;

  --accent-purple: #6C5CE7;
  --accent-teal: #4ECDC4;
  --accent-blue: #45B7D1;
  --accent-green: #96CEB4;
  --accent-yellow: #FFEAA7;
  --accent-red: #FF6B6B;
  --accent-orange: #F39C12;

  --option-colors: #FF6B6B, #4ECDC4, #45B7D1, #6C5CE7, #96CEB4, #FFEAA7;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 8px rgba(0,0,0,.3);
  --shadow-md: 0 4px 20px rgba(0,0,0,.4);
  --shadow-lg: 0 8px 40px rgba(0,0,0,.5);

  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --transition-fast: 150ms ease;
  --transition-normal: 300ms ease;
  --transition-slow: 500ms cubic-bezier(.4,0,.2,1);
}

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

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

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-teal); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--accent-blue); }

img { max-width: 100%; display: block; }

/* --- Tipografia --- */
h1 { font-size: 2rem; font-weight: 700; line-height: 1.2; }
h2 { font-size: 1.5rem; font-weight: 600; line-height: 1.3; }
h3 { font-size: 1.125rem; font-weight: 600; line-height: 1.4; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-accent { color: var(--accent-purple); }
.text-center { text-align: center; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-lg { font-size: 1.25rem; }
.mono { font-family: var(--font-mono); }

/* --- Layout --- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.container-sm { max-width: 640px; margin: 0 auto; padding: 0 1rem; }
.container-lg { max-width: 1600px; margin: 0 auto; padding: 0 1rem; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-xs { gap: .25rem; }
.gap-sm { gap: .5rem; }
.gap-md { gap: 1rem; }
.gap-lg { gap: 1.5rem; }
.gap-xl { gap: 2rem; }

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

@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

.mt-sm { margin-top: .5rem; }
.mt-md { margin-top: 1rem; }
.mt-lg { margin-top: 1.5rem; }
.mt-xl { margin-top: 2rem; }
.mb-md { margin-bottom: 1rem; }
.p-md { padding: 1rem; }
.p-lg { padding: 1.5rem; }

.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.w-full { width: 100%; }
.h-screen { min-height: 100vh; }

/* --- Tarjetas --- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.card:hover {
  border-color: var(--border-focus);
}

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

.card-glass {
  background: rgba(22, 33, 62, 0.7);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(108, 92, 231, 0.2);
  border-radius: var(--radius-lg);
  padding: 2rem;
}

/* --- Botones --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .75rem 1.5rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: .9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--accent-purple);
  color: #fff;
  border-color: var(--accent-purple);
}
.btn-primary:hover:not(:disabled) { background: #5a4bd6; box-shadow: 0 0 20px rgba(108,92,231,.4); }

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border);
}
.btn-secondary:hover:not(:disabled) { border-color: var(--accent-purple); color: var(--accent-purple); }

.btn-success {
  background: var(--accent-green);
  color: #1a1a2e;
  border-color: var(--accent-green);
}
.btn-success:hover:not(:disabled) { background: #7dba9e; }

.btn-danger {
  background: var(--accent-red);
  color: #fff;
  border-color: var(--accent-red);
}
.btn-danger:hover:not(:disabled) { background: #e55555; }

.btn-teal {
  background: var(--accent-teal);
  color: #1a1a2e;
}
.btn-teal:hover:not(:disabled) { background: #3dbdb5; }

.btn-lg {
  padding: 1rem 2.5rem;
  font-size: 1.125rem;
  border-radius: var(--radius-md);
}

.btn-xl {
  padding: 1.25rem 3rem;
  font-size: 1.25rem;
  border-radius: var(--radius-lg);
  min-height: 64px;
}

.btn-icon {
  padding: .625rem;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.btn-icon:hover { border-color: var(--accent-purple); color: var(--accent-purple); }

.btn-block { display: flex; width: 100%; }

/* --- Botones de opcion (participante) --- */
.option-btn {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 1.0625rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
  min-height: 60px;
}

.option-btn:hover:not(:disabled):not(.selected) {
  border-color: var(--accent-purple);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.option-btn.selected {
  border-color: var(--accent-teal);
  background: rgba(78, 205, 196, .12);
  box-shadow: 0 0 16px rgba(78, 205, 196, .2);
}

.option-btn.correct {
  border-color: var(--accent-green);
  background: rgba(150, 206, 180, .15);
}

.option-btn.incorrect {
  border-color: var(--accent-red);
  background: rgba(255, 107, 107, .1);
}

.option-btn:disabled { opacity: .7; cursor: default; transform: none; }

.option-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: .875rem;
  flex-shrink: 0;
}

.option-label-0 { background: rgba(255, 107, 107, .2); color: var(--accent-red); }
.option-label-1 { background: rgba(78, 205, 196, .2); color: var(--accent-teal); }
.option-label-2 { background: rgba(69, 183, 209, .2); color: var(--accent-blue); }
.option-label-3 { background: rgba(108, 92, 231, .2); color: var(--accent-purple); }
.option-label-4 { background: rgba(150, 206, 180, .2); color: var(--accent-green); }
.option-label-5 { background: rgba(255, 234, 167, .2); color: var(--accent-yellow); }

/* --- Inputs --- */
.input, .textarea, .select {
  width: 100%;
  padding: .75rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: .9375rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
}

.input:focus, .textarea:focus, .select:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px rgba(108,92,231,.2);
}

.input::placeholder, .textarea::placeholder {
  color: var(--text-muted);
}

.textarea { resize: vertical; min-height: 100px; }

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b6b80' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

.input-code {
  text-align: center;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: .5rem;
  text-transform: uppercase;
  padding: 1rem;
  background: var(--bg-input);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
}

.input-code:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 4px rgba(108,92,231,.25);
}

.label {
  display: block;
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: .375rem;
}

.form-group { margin-bottom: 1.25rem; }

/* --- Badges y chips --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .25rem .75rem;
  border-radius: var(--radius-full);
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.badge-purple { background: rgba(108,92,231,.2); color: var(--accent-purple); }
.badge-teal { background: rgba(78,205,196,.2); color: var(--accent-teal); }
.badge-green { background: rgba(150,206,180,.2); color: var(--accent-green); }
.badge-red { background: rgba(255,107,107,.2); color: var(--accent-red); }
.badge-yellow { background: rgba(255,234,167,.2); color: #d4a800; }
.badge-blue { background: rgba(69,183,209,.2); color: var(--accent-blue); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  padding: .375rem .75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: .8125rem;
  color: var(--text-secondary);
}

/* --- Topbar --- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .875rem 1.5rem;
  background: rgba(15, 14, 23, .9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-brand {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--accent-purple);
}

.topbar-nav { display: flex; align-items: center; gap: 1rem; }
.topbar-nav a { color: var(--text-secondary); font-size: .875rem; font-weight: 500; }
.topbar-nav a:hover { color: var(--accent-teal); }

/* --- Sidebar (admin) --- */
.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: calc(100vh - 56px);
}

@media (max-width: 1024px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .sidebar.open { display: block; position: fixed; top: 56px; left: 0; width: 280px; height: calc(100vh - 56px); z-index: 200; }
}

.sidebar {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  padding: 1.25rem;
  overflow-y: auto;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
}

.sidebar-title {
  font-size: .6875rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-muted);
  margin: 1rem 0 .5rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .625rem .875rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: .875rem;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.sidebar-link:hover { background: rgba(108,92,231,.08); color: var(--text-primary); }
.sidebar-link.active { background: var(--accent-purple); color: #fff; }

.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: .75rem 0;
}

/* --- Moderador: split panel --- */
.mod-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.5rem;
  padding: 1.5rem;
  min-height: calc(100vh - 56px);
}

@media (max-width: 1024px) {
  .mod-layout { grid-template-columns: 1fr; }
}

.mod-main { min-width: 0; }
.mod-side {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* --- Tablas --- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-md); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .75rem 1rem; text-align: left; border-bottom: 1px solid var(--border); }
th { background: var(--bg-secondary); font-size: .8125rem; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .04em; }
td { font-size: .875rem; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(108,92,231,.04); }

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn .2s ease;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  width: 90%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp .3s ease;
}

.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.modal-title { font-size: 1.25rem; font-weight: 600; }
.modal-close {
  background: none; border: none; color: var(--text-muted); font-size: 1.5rem; cursor: pointer;
  padding: .25rem; line-height: 1;
}
.modal-close:hover { color: var(--text-primary); }

/* --- Barra de progreso --- */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-input);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--accent-purple), var(--accent-teal));
  transition: width var(--transition-slow);
}

/* --- Chart: barras horizontales --- */
.bar-chart { display: flex; flex-direction: column; gap: .75rem; }

.bar-row {
  display: grid;
  grid-template-columns: 120px 1fr 60px;
  align-items: center;
  gap: .75rem;
}

@media (max-width: 480px) {
  .bar-row { grid-template-columns: 80px 1fr 40px; }
}

.bar-label {
  font-size: .875rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  height: 36px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
}

.bar-fill {
  height: 100%;
  border-radius: var(--radius-sm);
  transition: width 0.6s cubic-bezier(.4,0,.2,1);
  min-width: 4px;
}

.bar-fill-0 { background: linear-gradient(90deg, #FF6B6B, #ff8a8a); }
.bar-fill-1 { background: linear-gradient(90deg, #4ECDC4, #6eddd6); }
.bar-fill-2 { background: linear-gradient(90deg, #45B7D1, #65c7e1); }
.bar-fill-3 { background: linear-gradient(90deg, #6C5CE7, #8c7cf7); }
.bar-fill-4 { background: linear-gradient(90deg, #96CEB4, #a6dEc4); }
.bar-fill-5 { background: linear-gradient(90deg, #FFEAA7, #fff0c0); }

.bar-count {
  font-size: .875rem;
  font-weight: 700;
  text-align: right;
  color: var(--text-secondary);
}

/* --- Ranking animado --- */
.ranking-list { display: flex; flex-direction: column; gap: .5rem; }

.ranking-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all 0.5s cubic-bezier(.4,0,.2,1);
}

.ranking-pos {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: .875rem;
  flex-shrink: 0;
}

.ranking-pos-1 { background: rgba(255,234,167,.2); color: var(--accent-yellow); }
.ranking-pos-2 { background: rgba(192,192,192,.2); color: #c0c0c0; }
.ranking-pos-3 { background: rgba(205,127,50,.2); color: #cd7f32; }

.ranking-name { flex: 1; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ranking-score { font-weight: 700; color: var(--accent-teal); font-family: var(--font-mono); }

/* --- Word Cloud --- */
.word-cloud {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  min-height: 200px;
  padding: 1.5rem;
}

.word-cloud-item {
  display: inline-block;
  padding: .375rem .875rem;
  border-radius: var(--radius-full);
  font-weight: 600;
  transition: all var(--transition-normal);
  animation: fadeIn .5s ease;
}

/* --- Score animado --- */
.score-display {
  font-size: 3rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--accent-teal);
  text-align: center;
}

/* --- Timer --- */
.timer-ring {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 4px solid var(--border);
  font-size: 1.5rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--accent-yellow);
  transition: border-color var(--transition-fast);
}

.timer-ring.warning { border-color: var(--accent-orange); color: var(--accent-orange); }
.timer-ring.danger { border-color: var(--accent-red); color: var(--accent-red); animation: pulse 1s infinite; }

/* --- Skeleton loading --- */
.skeleton {
  background: linear-gradient(90deg, var(--bg-input) 25%, var(--bg-card-hover) 50%, var(--bg-input) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text { height: 1rem; margin-bottom: .5rem; }
.skeleton-title { height: 1.5rem; width: 60%; margin-bottom: 1rem; }
.skeleton-btn { height: 44px; width: 120px; border-radius: var(--radius-sm); }
.skeleton-card { height: 120px; border-radius: var(--radius-md); }

/* --- Toast --- */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.toast {
  padding: .875rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 500;
  color: #fff;
  box-shadow: var(--shadow-md);
  animation: slideIn .3s ease;
  max-width: 360px;
}

.toast-success { background: var(--accent-green); color: #1a1a2e; }
.toast-error { background: var(--accent-red); }
.toast-info { background: var(--accent-blue); color: #1a1a2e; }

/* --- Pagina de entrada (pantalla completa) --- */
.fullscreen-center {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: radial-gradient(ellipse at 50% 20%, rgba(108,92,231,.15) 0%, transparent 60%),
              var(--bg-primary);
}

.hero-logo {
  font-size: 2.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-teal));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: .5rem;
}

@media (max-width: 480px) {
  .hero-logo { font-size: 2rem; }
}

/* --- Participante: contadores --- */
.counter-grid {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.counter-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  min-width: 100px;
}

.counter-value {
  font-size: 1.75rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--accent-teal);
}

.counter-label {
  font-size: .75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* --- Divider --- */
.divider {
  height: 1px;
  background: var(--border);
  margin: 1.5rem 0;
}

/* --- Dots animados (esperando) --- */
.waiting-dots::after {
  content: '';
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0%, 20% { content: ''; }
  40% { content: '.'; }
  60% { content: '..'; }
  80%, 100% { content: '...'; }
}

/* --- Animaciones --- */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .5; }
}

@keyframes barGrow {
  from { width: 0; }
}

@keyframes confetti-fall {
  0% { transform: translateY(-10vh) rotate(0deg); opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

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

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

.anim-fade-in { animation: fadeIn .4s ease; }
.anim-slide-up { animation: slideUp .4s ease; }
.anim-slide-down { animation: slideDown .4s ease; }
.anim-scale-in { animation: scaleIn .3s ease; }

/* --- Confetti overlay --- */
.confetti-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 3000;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  animation: confetti-fall 3s linear forwards;
}

/* --- Pagina de login/auth --- */
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  box-shadow: var(--shadow-lg);
}

/* --- Escala/estrellas --- */
.scale-row {
  display: flex;
  gap: .5rem;
  justify-content: center;
  flex-wrap: wrap;
}

.scale-btn {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-primary);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
}

.scale-btn:hover:not(.selected) { border-color: var(--accent-purple); }
.scale-btn.selected { background: var(--accent-purple); border-color: var(--accent-purple); color: #fff; }

/* --- Lista participantes --- */
.participant-list {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.participant-chip {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  padding: .375rem .75rem;
  background: rgba(108,92,231,.1);
  border: 1px solid rgba(108,92,231,.2);
  border-radius: var(--radius-full);
  font-size: .8125rem;
  color: var(--text-primary);
  animation: scaleIn .3s ease;
}

.participant-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
}

/* --- Scrollbar personalizado --- */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-purple); }

/* --- Timer circular SVG --- */
.circular-timer-wrap {
  position: relative;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.circular-timer-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.circular-timer-svg circle {
  fill: none;
  stroke-width: 4;
}

.circular-timer-svg .timer-bg {
  stroke: var(--border);
}

.circular-timer-svg .timer-fg {
  stroke: var(--accent-green);
  stroke-linecap: round;
  transition: stroke-dashoffset 1s linear, stroke 0.3s ease;
}

.circular-timer-text {
  position: relative;
  z-index: 1;
  font-size: 1.5rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--accent-green);
  transition: color 0.3s ease;
}

.circular-timer-wrap.timer-warning .timer-fg { stroke: var(--accent-orange); }
.circular-timer-wrap.timer-warning .circular-timer-text { color: var(--accent-orange); }

.circular-timer-wrap.timer-danger .timer-fg { stroke: var(--accent-red); }
.circular-timer-wrap.timer-danger .circular-timer-text { color: var(--accent-red); }
.circular-timer-wrap.timer-danger { animation: timerPulse 0.8s infinite; }

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

/* --- Score popup flotante --- */
.score-popup-area {
  position: relative;
  min-height: 0;
  pointer-events: none;
}

.score-popup {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.75rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--accent-teal);
  animation: scorePopup 1.5s ease forwards;
  pointer-events: none;
  white-space: nowrap;
  text-shadow: 0 0 12px rgba(78, 205, 196, 0.5);
}

@keyframes scorePopup {
  0% { opacity: 1; transform: translateX(-50%) translateY(0) scale(0.5); }
  30% { opacity: 1; transform: translateX(-50%) translateY(-20px) scale(1.2); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-60px) scale(1); }
}

/* --- Barras con resaltado de respuesta correcta --- */
.bar-correct .bar-fill {
  box-shadow: 0 0 12px rgba(150, 206, 180, 0.5);
}

.bar-correct .bar-label {
  color: var(--accent-green);
  font-weight: 700;
}

.bar-dimmed {
  opacity: 0.45;
}

/* --- Animaciones adicionales --- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

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

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

.anim-fade-in-up { animation: fadeInUp .4s ease; }

/* --- QR code en lobby --- */
.qr-container {
  display: flex;
  justify-content: center;
  align-items: center;
}

.qr-container img {
  border-radius: var(--radius-md);
  background: #fff;
  padding: 8px;
}

/* --- Fullscreen tweaks --- */
body:fullscreen .topbar { display: none; }
body:-webkit-full-screen .topbar { display: none; }
body:fullscreen .mod-layout { min-height: 100vh; }
body:-webkit-full-screen .mod-layout { min-height: 100vh; }

/* --- Print --- */
@media print {
  .topbar, .sidebar, .btn { display: none !important; }
  body { background: #fff; color: #000; }
  .card, .card-lg { border: 1px solid #ccc; background: #fff; }
}
