:root {
  --navy: #001f4d;
  --steel: #2f3840;
  --silver: #c8cdd2;
  --amber: #f5a623;
  --white: #ffffff;
  --black: #050716;
  --green: #5fa321;
  --red: #e31e24;
  --blue: #006db7;
  --bg: #f4f6f9;
  --card: #ffffff;
  --shadow: 0 8px 24px rgba(0, 31, 77, 0.12);
  --radius: 16px;
  --safe-top: env(safe-area-inset-top);
  --safe-bottom: env(safe-area-inset-bottom);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--steel);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

.app {
  max-width: 720px;
  margin: 0 auto;
  padding: calc(16px + var(--safe-top)) 16px calc(24px + var(--safe-bottom));
  min-height: 100vh;
}

/* Full-screen vertical video welcome (mobile-first) */
.welcome-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.welcome-screen video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
.welcome-overlay {
  position: absolute;
  left: 0;
  right: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.welcome-overlay.top {
  top: 0;
  padding: calc(18px + var(--safe-top)) 16px 14px;
  background: linear-gradient(180deg, rgba(0,0,0,0.75), transparent);
}
.welcome-overlay.bottom {
  bottom: 0;
  padding: 24px 16px calc(28px + var(--safe-bottom));
  background: linear-gradient(0deg, rgba(0,31,77,0.95) 20%, transparent);
  pointer-events: auto;
}
.welcome-logo-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.welcome-logo-row img {
  height: 42px;
  width: auto;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
}
.welcome-logo-row span {
  color: #fff;
  font-weight: 800;
  font-size: 1.4rem;
  opacity: 0.9;
}
.welcome-overlay.bottom h1 {
  color: #fff;
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 6px;
}
.welcome-overlay.bottom p {
  color: #fff;
  opacity: 0.92;
  font-size: 1rem;
  margin-bottom: 16px;
}
.welcome-mute-btn {
  position: absolute;
  top: calc(72px + var(--safe-top));
  right: 16px;
  min-width: 44px;
  height: 44px;
  border-radius: 22px;
  border: none;
  background: rgba(0,0,0,0.45);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0 14px;
  cursor: pointer;
  backdrop-filter: blur(6px);
}
.welcome-mute-btn:focus { outline: 2px solid var(--amber); }

.hero {
  background: linear-gradient(135deg, var(--navy), var(--blue));
  color: var(--white);
  border-radius: var(--radius);
  padding: 32px 24px;
  margin-bottom: 24px;
  text-align: center;
  box-shadow: var(--shadow);
}

.hero h1 { font-size: 1.8rem; font-weight: 800; margin-bottom: 8px; }
.hero p { font-size: 1rem; opacity: 0.92; }

.intro-hero {
  background: linear-gradient(135deg, var(--navy), var(--blue));
  color: var(--white);
  border-radius: var(--radius);
  padding: 28px 22px;
  margin-bottom: 20px;
  text-align: center;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.intro-logo-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 14px;
}
.intro-logo-bar img { height: 46px; width: auto; }
.intro-logo-bar span { font-weight: 800; opacity: 0.85; }
.intro-hero h1 { font-size: 2rem; font-weight: 800; margin-bottom: 10px; }
.intro-hero .tagline {
  font-size: 1.05rem;
  opacity: 0.95;
  max-width: 520px;
  margin: 0 auto 18px;
  line-height: 1.45;
}

.intro-image {
  width: 100%;
  max-width: 720px;
  height: auto;
  border-radius: 14px;
  margin-bottom: 18px;
  background: var(--white);
}

.intro-copy {
  background: var(--card);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.intro-copy h2 {
  font-size: 1.2rem;
  color: var(--navy);
  margin-bottom: 10px;
}

.intro-copy p { line-height: 1.6; margin-bottom: 12px; }

.intro-stats {
  display: flex;
  justify-content: space-around;
  gap: 12px;
  flex-wrap: wrap;
  margin: 18px 0;
}

.stat {
  text-align: center;
  min-width: 90px;
}

.stat .number {
  display: block;
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--amber);
}

.stat .label {
  font-size: 0.78rem;
  color: var(--steel);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.cta-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.pulse-badge {
  display: inline-block;
  background: var(--amber);
  color: var(--black);
  font-weight: 700;
  font-size: 0.75rem;
  padding: 6px 12px;
  border-radius: 20px;
  margin-bottom: 12px;
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.05); opacity: 0.85; }
  100% { transform: scale(1); opacity: 1; }
}

.logo-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.logo-row img {
  height: 56px;
  width: auto;
  object-fit: contain;
  background: var(--white);
  border-radius: 12px;
  padding: 6px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.card h2 {
  font-size: 1.25rem;
  color: var(--navy);
  margin-bottom: 12px;
}

.card p { line-height: 1.55; margin-bottom: 12px; }

label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--navy);
}

input[type="text"], input[type="number"] {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid #dbe2ea;
  border-radius: 12px;
  font-size: 1rem;
  margin-bottom: 16px;
  transition: border-color 0.2s;
}

input[type="text"]:focus, input[type="number"]:focus {
  outline: none;
  border-color: var(--blue);
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 20px;
}

.checkbox-row input { margin-top: 3px; width: 20px; height: 20px; flex-shrink: 0; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  min-width: 48px;
  padding: 12px 20px;
  border: none;
  border-radius: 12px;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.2s;
  touch-action: manipulation;
}

.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--amber); color: var(--black); }
.btn-secondary { background: #e6ebf2; color: var(--navy); }
.btn-success { background: var(--green); color: var(--white); }
.btn-danger { background: var(--red); color: var(--white); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-block { width: 100%; }

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
}

.module-card {
  background: var(--card);
  border: 2px solid #e6ebf2;
  border-radius: 14px;
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.1s, border-color 0.2s;
}

.module-card:hover, .module-card:focus {
  border-color: var(--blue);
  transform: translateY(-2px);
}

.module-card .mod-id {
  display: inline-block;
  background: var(--navy);
  color: var(--white);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  margin-bottom: 8px;
}

.module-card h3 {
  font-size: 0.92rem;
  color: var(--navy);
  line-height: 1.25;
}

.module-card.locked { opacity: 0.55; pointer-events: none; }

.question-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}

.question-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  background: #e6ebf2;
  color: var(--navy);
}

.scenario {
  background: #eef6ff;
  border-left: 4px solid var(--blue);
  padding: 14px;
  border-radius: 0 12px 12px 0;
  margin-bottom: 16px;
  font-size: 0.95rem;
}

.question-text {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 18px;
  line-height: 1.45;
}

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

.choice {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border: 2px solid #dbe2ea;
  border-radius: 12px;
  cursor: pointer;
  background: var(--white);
  transition: border-color 0.15s, background 0.15s;
  min-height: 48px;
}

.choice:hover { border-color: var(--blue); background: #f7fbff; }
.choice.selected { border-color: var(--navy); background: #e8f0ff; }
.choice.correct { border-color: var(--green); background: #e9f6e0; }
.choice.incorrect { border-color: var(--red); background: #ffe9e9; }

.choice-index {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--navy);
  color: var(--white);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.85rem;
}

.feedback {
  border-radius: 12px;
  padding: 18px;
  margin-top: 18px;
}

.feedback.correct { background: #e9f6e0; border-left: 4px solid var(--green); color: #2b5a14; }
.feedback.incorrect { background: #ffe9e9; border-left: 4px solid var(--red); color: #7a1b1b; }

.result-box {
  text-align: center;
  padding: 32px 24px;
}

.result-score {
  font-size: 3rem;
  font-weight: 800;
  color: var(--navy);
  margin: 16px 0;
}

.impact-box {
  background: #fff8e6;
  border: 2px solid var(--amber);
  border-radius: 14px;
  padding: 18px;
  margin: 18px 0;
}

.impact-box h3 { color: var(--black); margin-bottom: 8px; }

.prize-placeholder {
  background: #fffbed;
  border: 2px dashed var(--amber);
  border-radius: 14px;
  padding: 16px;
  margin: 18px 0;
  color: #6b4c00;
}

.minigame-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  z-index: 100;
  display: flex;
  flex-direction: column;
}

.minigame-header {
  padding: 16px;
  background: var(--navy);
  color: var(--white);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.minigame-frame {
  flex: 1;
  width: 100%;
  border: none;
}

.toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

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

@media (min-width: 720px) {
  .app { padding-top: 32px; }
  .hero h1 { font-size: 2.2rem; }
}

/* Module video gate and slide player */
button:disabled, .btn.disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

.btn-sm { padding: 8px 12px; font-size: 0.85rem; }

.module-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  justify-content: center;
}

.gate-status {
  border-radius: 8px;
  padding: 10px 14px;
  margin: 12px 0 16px;
  font-weight: 700;
  text-align: center;
}

.gate-status.locked {
  background: #fff3cd;
  color: #856404;
}

.gate-status.ok {
  background: #d4edda;
  color: #155724;
}

.video-player {
  background: var(--card);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  max-width: 720px;
  margin: 0 auto;
}

.video-player h2 {
  color: var(--navy);
  margin-bottom: 12px;
}

.slide-progress {
  font-size: 0.8rem;
  color: var(--steel);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.slide-body {
  font-size: 1.1rem;
  line-height: 1.55;
  margin-bottom: 22px;
  min-height: 80px;
}

.slide-controls {
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

/* ── Lock brand banner: always-visible upper bar ── */
.lock-brand-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: calc(env(safe-area-inset-top, 0px) + 46px);
  padding-top: env(safe-area-inset-top, 0px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(7, 10, 18, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 50;
}

.lock-brand-topbar img {
  height: 26px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.4));
}

.lock-brand-topbar span {
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  opacity: 0.85;
}

.brand-offset {
  padding-top: calc(env(safe-area-inset-top, 0px) + 54px);
}

/* ── Termómetro de recaudación Círculo de Vida ── */
.thermo-card {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 14px 0;
  padding: 16px;
  border-radius: 18px;
  background: linear-gradient(135deg, #001f4d, #0b3d91);
  border: 1px solid rgba(245, 185, 33, 0.55);
  box-shadow: 0 8px 24px rgba(0, 31, 77, 0.25);
}

.thermo-visual {
  flex: 0 0 auto;
  filter: drop-shadow(0 4px 10px rgba(233, 30, 140, 0.35));
}

.thermo-fill {
  transition: y 1.1s cubic-bezier(0.22, 1, 0.36, 1), height 1.1s cubic-bezier(0.22, 1, 0.36, 1);
}

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

.thermo-kicker {
  display: block;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: #f5b921;
}

.thermo-raised {
  font-size: 1.9rem;
  font-weight: 800;
  line-height: 1.1;
  color: #ffffff;
  text-shadow: 0 2px 8px rgba(233, 30, 140, 0.45);
}

.thermo-goal {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 8px;
}

.thermo-bar {
  height: 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
  margin-bottom: 8px;
}

.thermo-bar-fill {
  height: 100%;
  width: 0;
  border-radius: 6px;
  background: linear-gradient(90deg, #e91e8c, #f5b921);
  transition: width 1.1s cubic-bezier(0.22, 1, 0.36, 1);
}

.thermo-impact {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.75);
  margin: 0 0 8px;
  line-height: 1.4;
}

.sound-toggle {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
}

.sound-toggle:hover {
  background: rgba(255, 255, 255, 0.16);
}

/* Flash estático accesible (prefers-reduced-motion) */
.celebration-flash {
  animation: celebrationFlash 1.6s ease-out;
}

@keyframes celebrationFlash {
  0% { box-shadow: inset 0 0 0 0 rgba(245, 185, 33, 0); }
  25% { box-shadow: inset 0 0 0 6px rgba(245, 185, 33, 0.8); }
  100% { box-shadow: inset 0 0 0 0 rgba(245, 185, 33, 0); }
}

/* ── Tarjeta de invitación QR: multiplicar el impacto ── */
.invite-card {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 14px 0;
  padding: 16px;
  border-radius: 18px;
  background: linear-gradient(135deg, #001f4d, #14505a);
  border: 1px solid rgba(46, 196, 182, 0.55);
  box-shadow: 0 8px 24px rgba(0, 31, 77, 0.25);
}

.invite-qr {
  flex: 0 0 auto;
  background: #ffffff;
  padding: 8px;
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.invite-qr img {
  display: block;
  width: 96px;
  height: 96px;
}

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

.invite-text {
  font-size: 0.82rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.85);
  margin: 4px 0 10px;
}

.invite-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.invite-url {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.5);
  margin: 8px 0 0;
  word-break: break-all;
}

/* Botón dorado de la ruleta */
.btn-warning {
  background: linear-gradient(120deg, var(--amber), #ffd166, var(--amber));
  color: var(--navy);
  font-weight: 800;
}
