/* ============================================================
   PROBLEMÓMETRO — estilos
   ============================================================ */

:root {
  --magenta: #a01b7a;
  --magenta-dark: #7c1460;
  --slot: #3a3a3a;
  --slot-empty: #2e2e2e;

  /* Colores de tiers (0 = más grave ... 6 = menos grave) */
  --t0: #f0421f;
  --t1: #f7941d;
  --t2: #fbc41c;
  --t3: #23a455;
  --t4: #1ea7f0;
  --t5: #8a4ff0;
  --t6: #e85fd6;

  --ok: #2ecc71;
  --bad: #e74c3c;
}

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

html, body { height: 100%; }

body {
  font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  background: var(--magenta);
  background-image: radial-gradient(circle at 50% 0%, #b2278b 0%, var(--magenta) 45%, var(--magenta-dark) 100%);
  color: #fff;
  min-height: 100%;
}

#app {
  max-width: 760px;
  margin: 0 auto;
  padding: 16px;
  min-height: 100vh;
}

.screen { display: flex; flex-direction: column; }
.hidden { display: none !important; }

/* ---------- Logo / títulos ---------- */
.logo {
  font-size: clamp(2rem, 8vw, 3.6rem);
  font-weight: 900;
  letter-spacing: 1px;
  text-align: center;
  text-shadow: 0 3px 0 rgba(0,0,0,0.18);
}
.logo-sm { font-size: clamp(1.1rem, 4.5vw, 1.6rem); text-align: left; }

/* ---------- Menú ---------- */
#menu {
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  gap: 28px;
  text-align: center;
}
.menu-desc {
  font-size: clamp(0.95rem, 3.5vw, 1.15rem);
  line-height: 1.7;
  opacity: 0.95;
  max-width: 520px;
}

/* ---------- Botones ---------- */
.btn {
  font-family: inherit;
  font-weight: 800;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  padding: 14px 30px;
  font-size: 1.1rem;
  transition: transform 0.1s ease, box-shadow 0.1s ease, filter 0.1s ease;
}
.btn:active { transform: translateY(2px); }
.btn-primary {
  background: #fff;
  color: var(--magenta-dark);
  box-shadow: 0 5px 0 rgba(0,0,0,0.25);
}
.btn-primary:hover { filter: brightness(1.05); }

/* ---------- Topbar juego ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.contador {
  font-weight: 800;
  font-size: 1.05rem;
  background: rgba(0,0,0,0.25);
  padding: 6px 12px;
  border-radius: 999px;
}

/* ---------- Tabla de tiers ---------- */
.tabla { display: flex; flex-direction: column; gap: 8px; }

.tier {
  display: flex;
  align-items: stretch;
  min-height: 56px;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.15s ease, outline-color 0.15s ease;
  outline: 3px solid transparent;
}
.tier.clickable:hover { transform: scale(1.01); }
.tier.clickable:hover .tier-slot { background: #454545; }

.tier-label {
  flex: 0 0 48%;
  display: flex;
  align-items: center;
  padding: 8px 12px;
  font-weight: 800;
  font-size: clamp(0.72rem, 2.8vw, 0.95rem);
  line-height: 1.15;
  color: #1a1a1a;
}
.tier-slot {
  flex: 1;
  background: var(--slot);
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  gap: 5px;
  padding: 6px 8px;
  transition: background 0.15s ease;
}

/* Tier colors */
.tier[data-tier="0"] .tier-label { background: var(--t0); color: #fff; }
.tier[data-tier="1"] .tier-label { background: var(--t1); }
.tier[data-tier="2"] .tier-label { background: var(--t2); }
.tier[data-tier="3"] .tier-label { background: var(--t3); color: #fff; }
.tier[data-tier="4"] .tier-label { background: var(--t4); color: #fff; }
.tier[data-tier="5"] .tier-label { background: var(--t5); color: #fff; }
.tier[data-tier="6"] .tier-label { background: var(--t6); color: #fff; }

/* Chips colocados */
.chip {
  background: #fff;
  color: #1a1a1a;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 999px;
  max-width: 100%;
  animation: pop 0.18s ease;
}
@keyframes pop {
  from { transform: scale(0.6); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.chip.ok  { background: var(--ok); color: #fff; box-shadow: 0 0 0 2px rgba(255,255,255,0.4); }
.chip.bad { background: var(--bad); color: #fff; opacity: 0.85; }
.chip.ghost { outline: 2px dashed #fff; background: transparent; color: #fff; }

/* Resaltado tier durante reveal */
.tier.highlight { outline-color: #fff; box-shadow: 0 0 18px rgba(255,255,255,0.5); }

/* ---------- Tarjeta activa ---------- */
.zona-tarjeta { margin-top: 18px; }
.tarjeta {
  background: #fff;
  color: #1d1d1d;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  animation: cardIn 0.22s ease;
}
@keyframes cardIn {
  from { transform: translateY(14px) scale(0.98); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}
.tarjeta-titulo {
  font-size: 1.25rem;
  font-weight: 900;
  margin-bottom: 10px;
  color: var(--magenta-dark);
}
.tarjeta-historia { font-size: 1rem; line-height: 1.6; }
.tarjeta-hint {
  margin-top: 14px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #888;
  text-align: center;
}

/* botón revelar centrado */
#btn-revelar { margin: 18px auto 0; }

/* ---------- Final ---------- */
#final {
  min-height: 100vh;
  align-items: center;
  gap: 12px;
  text-align: center;
  padding-top: 24px;
}
.score-label { font-size: 1.1rem; opacity: 0.85; letter-spacing: 2px; text-transform: uppercase; }
.score { font-size: clamp(2.4rem, 13vw, 4rem); font-weight: 900; line-height: 1; }
.score-msg { font-size: 1.05rem; opacity: 0.95; max-width: 460px; margin-bottom: 6px; }

/* ---------- Comparación lado a lado ---------- */
.comparacion {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 8px 0 18px;
}
.cmp-head {
  display: grid;
  grid-template-columns: 38% 1fr 1fr;
  gap: 6px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 1px;
  opacity: 0.85;
}
.cmp-head-cell { text-align: center; padding: 2px 0; }

.cmp-row {
  display: grid;
  grid-template-columns: 38% 1fr 1fr;
  gap: 6px;
  align-items: stretch;
  border-radius: 8px;
  padding: 4px;
  background: rgba(0,0,0,0.18);
  min-height: 70px;
  transition: opacity 0.35s ease, transform 0.35s ease, background 0.3s ease;
}
.cmp-row.ok { background: rgba(46,204,113,0.18); }

.cmp-tier-label {
  display: flex;
  align-items: center;
  padding: 6px 8px;
  border-radius: 6px;
  font-weight: 800;
  font-size: clamp(0.6rem, 2.4vw, 0.8rem);
  line-height: 1.1;
  color: #1a1a1a;
  text-align: left;
  overflow: hidden;
}
.cmp-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: clamp(0.68rem, 2.6vw, 0.85rem);
  font-weight: 700;
  background: #2e2e2e;
  color: #fff;
  overflow: hidden;
}
/* Texto clampeado a 3 líneas para que ninguna celda agrande la fila */
.cmp-txt {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
}
.cmp-cell.given.ok  { background: var(--ok); }
.cmp-cell.given.bad { background: var(--bad); }
.cmp-cell.correct   { background: #fff; color: #1a1a1a; }

/* Colores de label reusables en la comparación */
.tier-color-0 { background: var(--t0); color: #fff; }
.tier-color-1 { background: var(--t1); }
.tier-color-2 { background: var(--t2); }
.tier-color-3 { background: var(--t3); color: #fff; }
.tier-color-4 { background: var(--t4); color: #fff; }
.tier-color-5 { background: var(--t5); color: #fff; }
.tier-color-6 { background: var(--t6); color: #fff; }

/* ---------- Reto Diario: extras en la pantalla final ---------- */
#final { overflow-y: auto; }

.reto-racha {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 900;
  font-size: 1.05rem;
  background: rgba(0, 0, 0, 0.28);
  border: 2px solid rgba(255, 255, 255, 0.35);
  padding: 6px 16px;
  border-radius: 999px;
}

.reto-puesto {
  font-size: 0.95rem;
  font-weight: 700;
  opacity: 0.95;
}

.reto-histograma {
  width: 100%;
  max-width: 460px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 4px 0 6px;
}
.hist-row {
  display: grid;
  grid-template-columns: 18px 1fr;
  align-items: center;
  gap: 8px;
}
.hist-label {
  font-weight: 800;
  font-size: 0.8rem;
  text-align: right;
  opacity: 0.85;
}
.hist-bar-wrap {
  background: rgba(0, 0, 0, 0.22);
  border-radius: 6px;
  overflow: hidden;
  min-height: 20px;
  display: flex;
}
.hist-bar {
  background: rgba(255, 255, 255, 0.45);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 7px;
  border-radius: 6px;
  min-width: 0;
  transition: width 0.4s ease;
}
.hist-row.mine .hist-bar {
  background: #fff;
  color: var(--magenta-dark);
}
.hist-row.mine .hist-label { opacity: 1; }

/* ---------- Transición entre pantallas ---------- */
@keyframes screenIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}
.screen-in { animation: screenIn 0.28s ease; }

/* ---------- Botón de sonido ---------- */
.btn-sonido {
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
  padding: 6px 10px;
  font-size: 1rem;
  line-height: 1;
}
.btn-sonido.muted { opacity: 0.55; }

/* ---------- Feedback: colocar carta ---------- */
@keyframes tierReceive {
  0%   { transform: scale(1);    box-shadow: 0 0 0 rgba(255,255,255,0); }
  35%  { transform: scale(1.04); box-shadow: 0 0 22px rgba(255,255,255,0.75); }
  100% { transform: scale(1);    box-shadow: 0 0 0 rgba(255,255,255,0); }
}
.tier.receiving { animation: tierReceive 0.45s ease; }

/* Tarjeta que vuela hacia el slot elegido */
.tarjeta.volando {
  transition: transform 0.32s cubic-bezier(0.5, 0, 0.7, 1), opacity 0.32s ease;
  pointer-events: none;
}

/* Arrastre de la tarjeta del juego */
#tarjeta { cursor: grab; touch-action: none; }
/* Mientras se arrastra, el contenedor no debe recortar la tarjeta
   (en mobile tiene overflow:hidden) y debe quedar por encima de los tiers. */
.zona-tarjeta.arrastrando {
  overflow: visible;
  position: relative;
  z-index: 10;
}
#tarjeta.dragging {
  cursor: grabbing;
  position: relative;
  z-index: 5;
  transition: none !important;
  animation: none !important;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.5);
}

/* ---------- Reveal de resultados ---------- */
.cmp-pending { opacity: 0; transform: translateY(18px) scale(0.97); }

@keyframes hitFlash {
  0%   { box-shadow: 0 0 0 rgba(46,204,113,0); }
  30%  { box-shadow: 0 0 24px rgba(46,204,113,0.85); transform: scale(1.03); }
  100% { box-shadow: 0 0 0 rgba(46,204,113,0); transform: scale(1); }
}
.cmp-hit { animation: hitFlash 0.55s ease; }

@keyframes missShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}
.cmp-miss { animation: missShake 0.4s ease; }

@keyframes scorePop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.35); }
  100% { transform: scale(1); }
}

/* ---------- Racha del reto: pulso al aparecer ---------- */
@keyframes rachaPop {
  0%   { transform: scale(0.7); opacity: 0; }
  55%  { transform: scale(1.18); opacity: 1; }
  100% { transform: scale(1); }
}
.reto-racha.pulse { animation: rachaPop 0.5s ease; }

/* Botón en estado de carga */
.btn.cargando { opacity: 0.7; cursor: progress; }
.btn.cargando::after {
  content: "";
  display: inline-block;
  width: 0.9em; height: 0.9em;
  margin-left: 8px;
  vertical-align: -0.1em;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Confeti (7/7) ---------- */
.confeti { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.confeti i {
  position: absolute;
  top: -12vh;
  width: 9px; height: 14px;
  background: var(--c, #fff);
  border-radius: 2px;
  animation-name: confetiFall;
  animation-timing-function: ease-in;
  animation-fill-mode: forwards;
}
@keyframes confetiFall {
  to { transform: translateY(120vh) rotate(720deg); opacity: 0.85; }
}

@media (prefers-reduced-motion: reduce) {
  .tier.receiving, .cmp-hit, .cmp-miss, .screen-in, .reto-racha.pulse { animation: none; }
  .cmp-pending { opacity: 1; transform: none; }
  .tarjeta.volando { transition: none; }
}

/* ---------- Modal confirmar ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.55);
  animation: modalFade 0.18s ease;
}
@keyframes modalFade { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  background: #fff;
  color: #1d1d1d;
  border-radius: 16px;
  padding: 22px 20px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
  animation: modalPop 0.22s ease;
}
@keyframes modalPop {
  from { transform: translateY(14px) scale(0.96); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
.modal-msg {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.45;
  margin-bottom: 18px;
  text-align: center;
}
.modal-acciones {
  display: flex;
  gap: 10px;
}
.modal-acciones .btn {
  flex: 1 1 0;
  padding: 12px 14px;
  font-size: 1rem;
}
.modal-acciones .btn-ghost {
  background: rgba(0, 0, 0, 0.08);
  color: #1d1d1d;
  border-color: rgba(0, 0, 0, 0.2);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.12);
}
@media (prefers-reduced-motion: reduce) {
  .modal, .modal-card { animation: none; }
}

/* ---------- Tutorial / onboarding ---------- */
.tutorial {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.6);
  animation: modalFade 0.18s ease;
}
.tutorial-card {
  background: #fff;
  color: #1d1d1d;
  border-radius: 16px;
  padding: 24px 22px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
  animation: modalPop 0.22s ease;
}
.tutorial-titulo {
  margin: 0 0 16px;
  text-align: center;
  color: var(--magenta);
  font-size: 1.3rem;
  font-weight: 800;
}
.tutorial-pasos {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.tutorial-pasos li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 0.98rem;
  line-height: 1.4;
}
.tut-emoji {
  font-size: 1.5rem;
  line-height: 1.2;
  flex: 0 0 auto;
}
.tutorial-card .btn { width: 100%; }
@media (prefers-reduced-motion: reduce) {
  .tutorial, .tutorial-card { animation: none; }
}

/* ---------- Tutorial guiado (coach-marks) ---------- */
/* El spot ilumina un elemento oscureciendo el resto con un box-shadow
   gigante. Es sólo visual (pointer-events:none), así que el juego sigue
   siendo jugable debajo. */
.coach-spot {
  position: fixed;
  z-index: 200;
  border-radius: 14px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.62);
  pointer-events: none;
  transition: top 0.25s ease, left 0.25s ease, width 0.25s ease, height 0.25s ease;
}
.coach-bubble {
  position: fixed;
  z-index: 201;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 360px;
  background: #fff;
  color: #1d1d1d;
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  text-align: center;
}
.coach-txt {
  margin: 0 0 10px;
  font-size: 0.95rem;
  line-height: 1.4;
  font-weight: 600;
}
.coach-bubble .coach-next { width: 100%; }
.coach-bubble .coach-txt:only-child { margin-bottom: 0; }
@media (prefers-reduced-motion: reduce) {
  .coach-spot { transition: none; }
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(10px);
  background: #1a1a1a;
  color: #fff;
  font-weight: 800;
  font-size: 0.95rem;
  padding: 12px 22px;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 50;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- Menú: botonera ---------- */
.menu-botones {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 320px;
}
.menu-botones .btn { width: 100%; }

.btn-ghost {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.55);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.2); }

.btn-small {
  padding: 8px 14px;
  font-size: 0.9rem;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.2);
}
.btn-volver { background: rgba(0, 0, 0, 0.25); color: #fff; }

/* ---------- Cargar problema ---------- */
.cargar-desc,
.fast-desc {
  font-size: 0.95rem;
  line-height: 1.5;
  opacity: 0.92;
  margin-bottom: 16px;
}

.form-cargar { display: flex; flex-direction: column; gap: 16px; }
.campo { display: flex; flex-direction: column; gap: 6px; border: none; }
.campo-label {
  font-weight: 800;
  font-size: 0.9rem;
  letter-spacing: 0.5px;
}
.form-cargar input,
.form-cargar textarea {
  font-family: inherit;
  font-size: 1rem;
  padding: 12px 14px;
  border-radius: 10px;
  border: none;
  background: #fff;
  color: #1d1d1d;
  resize: vertical;
}
.form-cargar input:focus,
.form-cargar textarea:focus {
  outline: 3px solid rgba(255, 255, 255, 0.7);
}

.cat-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.cat-opcion {
  font-family: inherit;
  font-weight: 800;
  font-size: 0.78rem;
  line-height: 1.15;
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  border: 3px solid transparent;
  cursor: pointer;
  color: #1a1a1a;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.cat-opcion:hover { transform: scale(1.02); }
.cat-opcion.sel {
  border-color: #fff;
  box-shadow: 0 0 14px rgba(255, 255, 255, 0.6);
}

.form-msg { font-weight: 700; font-size: 0.95rem; min-height: 1.2em; }
.form-msg.ok { color: var(--ok); }
.form-msg.error { color: #ffd2cc; }

/* ---------- Problemómetro Fast ---------- */
#fast-zona { display: flex; flex-direction: column; }
.fast-votos {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 18px;
}
.fast-voto {
  font-family: inherit;
  font-weight: 800;
  font-size: clamp(0.8rem, 3vw, 0.98rem);
  text-align: left;
  padding: 14px 16px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  color: #1a1a1a;
  transition: transform 0.1s ease, filter 0.1s ease;
}
.fast-voto:hover { transform: scale(1.01); filter: brightness(1.05); }
.fast-voto:disabled { opacity: 0.5; cursor: default; }

.btn-descartar {
  margin-top: 12px;
  background: rgba(0, 0, 0, 0.3);
  color: #fff;
  border: 2px dashed rgba(255, 255, 255, 0.5);
  box-shadow: none;
}
.btn-descartar:hover { background: rgba(0, 0, 0, 0.4); }
.btn-descartar:disabled { opacity: 0.5; cursor: default; }

.fast-vacio {
  text-align: center;
  font-size: 1.1rem;
  font-weight: 700;
  margin-top: 40px;
  opacity: 0.95;
}

/* ---------- Indicador de cuenta (menú) ---------- */
.cuenta {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 2;
}
.cuenta-estado {
  font-weight: 700;
  font-size: 0.85rem;
  opacity: 0.9;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#menu { position: relative; }

/* ---------- Login ---------- */
.auth-desc {
  font-size: 0.95rem;
  line-height: 1.5;
  opacity: 0.92;
  margin-bottom: 16px;
}
.auth-zona {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 380px;
  width: 100%;
  margin: 0 auto;
}
.auth-google { width: 100%; }

.auth-sep {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  font-weight: 700;
  opacity: 0.8;
}
.auth-sep::before,
.auth-sep::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.35);
}

.form-auth { display: flex; flex-direction: column; gap: 14px; }
.form-auth input {
  font-family: inherit;
  font-size: 1rem;
  padding: 12px 14px;
  border-radius: 10px;
  border: none;
  background: #fff;
  color: #1d1d1d;
}
.form-auth input:focus { outline: 3px solid rgba(255, 255, 255, 0.7); }
.form-auth .btn-primary { width: 100%; }

.auth-toggle {
  font-size: 0.9rem;
  text-align: center;
  opacity: 0.95;
}
.link-btn {
  font-family: inherit;
  font-weight: 800;
  font-size: 0.9rem;
  background: none;
  border: none;
  color: #fff;
  text-decoration: underline;
  cursor: pointer;
  padding: 0 2px;
}

/* ---------- Desktop: tarjeta y tabla lado a lado opcional ---------- */
@media (min-width: 900px) {
  #app { max-width: 920px; }
  .cat-selector { grid-template-columns: repeat(3, 1fr); }
}

/* ============================================================
   MOBILE: cada pantalla entra completa, sin scroll (100dvh)
   ============================================================ */
@media (max-width: 640px) {
  html, body { height: 100%; overflow: hidden; }

  #app {
    height: 100dvh;
    min-height: 0;
    padding: 10px;
    display: flex;
    flex-direction: column;
  }

  /* La pantalla visible ocupa todo el alto disponible */
  .screen { height: 100%; min-height: 0; flex: 1; }

  .logo { font-size: clamp(1.8rem, 9vw, 2.6rem); }
  .topbar { margin-bottom: 8px; flex: 0 0 auto; }

  /* ---------- Menú ---------- */
  #menu { min-height: 0; gap: 18px; }
  .menu-desc { line-height: 1.45; margin-bottom: 4px; }

  /* ---------- Juego ---------- */
  .tabla {
    flex: 1 1 auto;
    min-height: 0;
    gap: 5px;
    justify-content: space-between;
  }
  .tier { min-height: 0; flex: 1 1 0; }
  .tier-label { padding: 4px 10px; }
  .tier-slot { padding: 4px 6px; }

  .zona-tarjeta { flex: 0 0 auto; min-height: 0; margin-top: 10px; overflow: hidden; }
  .tarjeta { padding: 12px 14px; }
  .tarjeta-titulo { font-size: 1rem; margin-bottom: 6px; }
  .tarjeta-historia { font-size: 0.86rem; line-height: 1.35; }
  .tarjeta-hint { margin-top: 8px; font-size: 0.74rem; }
  #btn-revelar { margin-top: 10px; flex: 0 0 auto; }

  /* ---------- Cargar ---------- */
  .cargar-desc, .fast-desc { font-size: 0.85rem; line-height: 1.4; margin-bottom: 8px; flex: 0 0 auto; }
  .form-cargar { flex: 1 1 auto; min-height: 0; gap: 9px; }
  .form-cargar input, .form-cargar textarea { padding: 9px 12px; font-size: 0.95rem; }
  .form-cargar textarea { flex: 1 1 auto; min-height: 52px; }
  .campo-label { font-size: 0.82rem; }
  .cat-selector { gap: 5px; }
  .cat-opcion { padding: 7px 9px; font-size: 0.72rem; }
  #btn-enviar { flex: 0 0 auto; }
  .form-msg { min-height: 0; }

  /* ---------- Fast ---------- */
  #fast-zona { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
  #fast-tarjeta { flex: 0 1 auto; min-height: 0; overflow: hidden; }
  .fast-votos { flex: 1 1 auto; min-height: 0; gap: 5px; margin-top: 10px; justify-content: space-between; }
  .fast-voto { flex: 1 1 0; min-height: 0; padding: 6px 12px; display: flex; align-items: center; }
  .btn-descartar { margin-top: 8px; padding: 9px; flex: 0 0 auto; }
  .fast-vacio { margin-top: 24px; }

  /* ---------- Login ---------- */
  .auth-desc { font-size: 0.85rem; line-height: 1.4; margin-bottom: 8px; flex: 0 0 auto; }
  .auth-zona { flex: 1 1 auto; min-height: 0; overflow-y: auto; gap: 10px; }

  /* ---------- Final ---------- */
  #final { min-height: 0; padding-top: 10px; gap: 6px; justify-content: flex-start; }
  .score-label { font-size: 0.9rem; }
  .score { font-size: clamp(2rem, 11vw, 3rem); }
  .score-msg { font-size: 0.92rem; margin-bottom: 2px; }
  .comparacion { flex: 1 1 auto; min-height: 0; gap: 4px; margin: 4px 0 8px; }
  .cmp-row { flex: 1 1 0; min-height: 0; padding: 3px; }
  #btn-replay { flex: 0 0 auto; }

  /* Reto Diario en mobile: extras compactos y final scrolleable */
  #final { overflow-y: auto; }
  .reto-racha { font-size: 0.92rem; padding: 5px 12px; flex: 0 0 auto; }
  .reto-puesto { font-size: 0.82rem; flex: 0 0 auto; }
  .reto-histograma { flex: 0 0 auto; gap: 3px; margin: 2px 0 4px; }
  .hist-bar-wrap { min-height: 16px; }
  .hist-bar { font-size: 0.66rem; }
  #btn-compartir { flex: 0 0 auto; }

  /* Reto diario: demasiado contenido para una sola pantalla en celulares
     bajos. En vez de aplastar las filas (ilegibles), dejamos alto legible
     y permitimos que #final scrollee. */
  #final.reto { justify-content: flex-start; }
  #final.reto .comparacion { flex: 0 0 auto; }
  #final.reto .cmp-row { flex: 0 0 auto; min-height: 54px; }
  #final.reto #btn-replay,
  #final.reto #btn-compartir { flex: 0 0 auto; }
}

/* ============================================================
   MONETIZACIÓN: legal, consentimiento, anuncios, video premiado
   ============================================================ */

/* Link de política de privacidad en el menú */
.menu-legal { margin-top: 14px; text-align: center; }
.menu-legal a {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.78rem;
  text-decoration: underline;
}
.menu-legal a:hover { color: #fff; }

/* Botón de video premiado (reacomodar tarjeta) */
.btn-rewarded {
  margin-top: 8px;
  font-size: 0.9rem;
  border-style: dashed;
}

/* Modo swap: chips intercambiables */
.swap-mode .chip {
  cursor: pointer;
  outline: 2px dashed rgba(255, 255, 255, 0.55);
  outline-offset: 1px;
}
.chip.swap-sel {
  outline: 2px solid #fff;
  transform: scale(1.06);
  box-shadow: 0 0 0 3px var(--magenta-dark);
}

/* Anuncio en la pantalla de resultados */
.ad-resultado { width: 100%; margin: 8px 0; min-height: 0; }
.ad-resultado:empty { display: none; }

/* Banner de consentimiento de cookies */
.consent {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  background: rgba(20, 8, 18, 0.96);
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  padding: 12px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  justify-content: center;
}
.consent.hidden { display: none; }
.consent-txt { font-size: 0.85rem; line-height: 1.35; max-width: 560px; }
.consent-txt a { color: #fff; text-decoration: underline; }
.consent-acc { display: flex; gap: 8px; flex: 0 0 auto; }

/* Banner de instalación PWA */
.pwa-banner {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 70;
  background: var(--magenta-dark, rgba(20, 8, 18, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 520px;
  margin: 0 auto;
}
.pwa-banner.hidden { display: none; }
.pwa-banner-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 auto;
  min-width: 0;
}
.pwa-banner-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  flex: 0 0 auto;
}
.pwa-banner-txt {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.pwa-banner-txt strong { font-size: 0.9rem; line-height: 1.2; }
.pwa-banner-txt span { font-size: 0.78rem; opacity: 0.85; line-height: 1.25; }
.pwa-banner-acc {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

/* Overlay del video premiado simulado (demo, ADS_TEST_MODE) */
.ad-fake {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
}
.ad-fake-card {
  text-align: center;
  padding: 28px 36px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  background: var(--magenta-dark);
}
.ad-fake-tag {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  opacity: 0.7;
  margin-bottom: 10px;
}
.ad-fake-cuenta { font-size: 3rem; font-weight: 700; line-height: 1; }
.ad-fake-msg { margin-top: 10px; font-size: 0.85rem; opacity: 0.85; }

/* Página de política de privacidad */
.legal { align-items: stretch; }
.legal-cuerpo {
  overflow-y: auto;
  line-height: 1.5;
  font-size: 0.92rem;
}
.legal-cuerpo h2 { margin: 18px 0 6px; font-size: 1.05rem; }
.legal-cuerpo p { margin-bottom: 10px; }
.legal-cuerpo ul { margin: 0 0 10px 18px; }
.legal-cuerpo li { margin-bottom: 6px; }
.legal-cuerpo a { color: #fff; text-decoration: underline; }
.legal-fecha { opacity: 0.7; font-size: 0.8rem; margin-bottom: 14px; }
