:root {
  /* Paleta oficial extraída de centroaria.com */
  --bg-deep: #081016;
  --bg-mid: #132a3a;
  --panel: #16283a;
  --panel-border: #24445c;
  --lime: #d4ff00;
  --lime-dim: #b8db00;
  --navy-text: #1a2e3e;
  --text: #ffffff;
  --text-muted: #7d93a3;
  --danger: #ff5d5d;
  --success: #4ade80;
  --radius: 18px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg-deep);
  color: var(--text);
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
}

body {
  background: radial-gradient(120% 90% at 50% 0%, var(--bg-mid) 0%, var(--bg-deep) 60%);
  min-height: 100vh;
  overflow-x: hidden;
}

.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(60% 40% at 80% 100%, rgba(212, 255, 0, 0.06) 0%, transparent 70%),
    radial-gradient(50% 30% at 10% 90%, rgba(212, 255, 0, 0.05) 0%, transparent 70%);
  z-index: 0;
}

.app {
  position: relative;
  z-index: 1;
  max-width: 480px;
  margin: 0 auto;
  padding: 28px 20px 48px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Brand header */
.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 28px;
}

.brand-logo-img {
  height: 46px;
  width: auto;
  /* Logo oficial en negro invertido a blanco para el fondo oscuro */
  filter: invert(1);
}

.event-tag {
  margin-top: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 1.4px;
  color: var(--lime);
  padding: 6px 14px;
  border: 1px solid rgba(212, 255, 0, 0.35);
  border-radius: 999px;
  background: rgba(212, 255, 0, 0.06);
}

.event-tag .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 8px var(--lime);
}

/* Screens */
.screen {
  display: none;
  flex-direction: column;
  gap: 16px;
  flex: 1;
  animation: fadeIn 0.25s ease;
}

.screen.active { display: flex; }

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

.title {
  font-size: 26px;
  font-weight: 800;
  text-align: center;
  margin: 4px 0 0;
  letter-spacing: -0.3px;
}

.title .accent { color: var(--lime); }

.subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 14.5px;
  line-height: 1.5;
  margin: 0 0 8px;
}

/* Card */
.card {
  background: linear-gradient(180deg, var(--panel) 0%, rgba(22, 40, 58, 0.7) 100%);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 22px;
}

/* Form */
.form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
}

.field em {
  font-style: normal;
  font-weight: 400;
  color: #5a7286;
}

.field input {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 14px 14px;
  color: var(--text);
  font-size: 16px;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.15s ease;
}

.field input:focus {
  border-color: var(--lime);
}

.field input::placeholder {
  color: #536c80;
}

/* Buttons */
.btn {
  border: none;
  border-radius: 999px;
  padding: 16px 20px;
  font-size: 15.5px;
  font-weight: 800;
  cursor: pointer;
  text-align: center;
  transition: transform 0.1s ease, filter 0.15s ease;
  font-family: var(--font);
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--lime);
  color: var(--navy-text);
}

.btn-primary:hover { filter: brightness(1.05); }

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--panel-border);
}

.btn-ghost:hover { border-color: var(--lime); color: var(--lime); }

/* Play screen */
.play-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 700;
}

#score-live { color: var(--lime); }

.timer-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.timer-bar {
  height: 100%;
  width: 100%;
  background: var(--lime);
  border-radius: 999px;
  transform-origin: left;
  transition: width 0.1s linear, background-color 0.2s ease;
}

.question-card {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 280px;
}

.question-text {
  font-size: 19px;
  font-weight: 700;
  line-height: 1.4;
  margin: 0;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.option-btn {
  text-align: left;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 15px 16px;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.1s ease;
}

.option-btn:active { transform: scale(0.98); }

.option-btn.correct {
  background: rgba(74, 222, 128, 0.15);
  border-color: var(--success);
  color: var(--success);
}

.option-btn.wrong {
  background: rgba(255, 93, 93, 0.15);
  border-color: var(--danger);
  color: var(--danger);
}

.option-btn.selected {
  background: rgba(212, 255, 0, 0.15);
  border-color: var(--lime);
  color: var(--lime);
}

.option-btn.disabled {
  pointer-events: none;
}

.option-btn.dim {
  opacity: 0.45;
}

/* Result screen */
.result-card {
  text-align: center;
}

.result-score {
  font-size: 56px;
  font-weight: 800;
  color: var(--lime);
  line-height: 1;
}

.result-score-label {
  color: var(--text-muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 6px;
}

.result-stats {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-top: 22px;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-value {
  font-size: 20px;
  font-weight: 800;
}

.stat-label {
  font-size: 11.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

/* Leaderboard */
.leaderboard-list {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 55vh;
  overflow-y: auto;
}

.leaderboard-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px;
  border-radius: 12px;
}

.leaderboard-row.you {
  background: rgba(212, 255, 0, 0.1);
  border: 1px solid rgba(212, 255, 0, 0.35);
}

.lb-rank {
  width: 28px;
  flex-shrink: 0;
  font-weight: 800;
  color: var(--text-muted);
  text-align: center;
  font-size: 14px;
}

.leaderboard-row:nth-child(1) .lb-rank { color: #ffd54a; }
.leaderboard-row:nth-child(2) .lb-rank { color: #cfd8dc; }
.leaderboard-row:nth-child(3) .lb-rank { color: #d79a5a; }

.lb-info {
  flex: 1;
  min-width: 0;
}

.lb-name {
  font-weight: 700;
  font-size: 14.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lb-company {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lb-score {
  font-weight: 800;
  color: var(--lime);
  font-size: 15px;
  flex-shrink: 0;
}

.loading, .empty {
  text-align: center;
  color: var(--text-muted);
  padding: 24px 0;
  font-size: 14px;
}

.error-banner {
  background: rgba(255, 93, 93, 0.12);
  border: 1px solid rgba(255, 93, 93, 0.4);
  color: var(--danger);
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13.5px;
  text-align: center;
}

/* Share / QR */
.hidden { display: none !important; }

.share-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.share-qr {
  background: #ffffff;
  padding: 10px;
  border-radius: 12px;
  width: 160px;
  height: 160px;
}

.share-hint {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.share-url {
  font-size: 12.5px;
  color: var(--lime);
  font-weight: 700;
  word-break: break-all;
}

@media (max-width: 360px) {
  .brand-logo-img { height: 38px; }
  .title { font-size: 22px; }
  .result-score { font-size: 46px; }
}
