:root {
  --verde: #2bb673;
  --verde-oscuro: #1f8f59;
  --azul: #2d7ff9;
  --azul-oscuro: #1b5fd1;
  --amarillo: #ffc233;
  --rojo: #ff5a5a;
  --morado: #7c4dff;
  --fondo: #eef4ff;
  --tarjeta: #ffffff;
  --texto: #20304a;
  --gris: #8a98ad;
  --sombra: 0 10px 30px rgba(30, 60, 120, 0.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Nunito', system-ui, sans-serif;
  color: var(--texto);
  background:
    radial-gradient(circle at 12% 18%, #d9e8ff 0, transparent 38%),
    radial-gradient(circle at 88% 12%, #d7f5e6 0, transparent 36%),
    var(--fondo);
  min-height: 100vh;
  overflow-x: hidden;
}

h1, h2, .logo, .balon-grande, .btn { font-family: 'Baloo 2', sans-serif; }

#confeti {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 999;
}

/* ---- PANTALLAS ---- */
.pantalla { display: none; min-height: 100vh; }
.pantalla.activa { display: block; }

.tarjeta {
  background: var(--tarjeta);
  border-radius: 22px;
  box-shadow: var(--sombra);
  padding: 26px;
}

/* ---- BOTONES ---- */
.btn {
  border: none;
  border-radius: 16px;
  background: linear-gradient(180deg, var(--azul), var(--azul-oscuro));
  color: #fff;
  font-weight: 800;
  font-size: 1.05rem;
  padding: 14px 22px;
  cursor: pointer;
  box-shadow: 0 6px 0 var(--azul-oscuro);
  transition: transform .06s ease, box-shadow .06s ease, filter .15s ease;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--azul-oscuro); }
.btn-grande { width: 100%; font-size: 1.2rem; padding: 16px; }
.btn-jugar { background: linear-gradient(180deg, var(--verde), var(--verde-oscuro)); box-shadow: 0 6px 0 var(--verde-oscuro); }
.btn-jugar:active { box-shadow: 0 2px 0 var(--verde-oscuro); }
.btn-secundario {
  background: #fff; color: var(--azul-oscuro);
  border: 2px solid #d7e3ff; box-shadow: 0 6px 0 #d7e3ff;
}
.btn-secundario:active { box-shadow: 0 2px 0 #d7e3ff; }
.btn-texto {
  background: none; border: none; color: var(--gris);
  font-weight: 700; cursor: pointer; font-size: .95rem;
}
.btn-texto:hover { color: var(--texto); }
.oculto { display: none !important; }

/* ---- PANTALLAS CENTRADAS (bienvenida, formularios, perfil, lobby) ---- */
#pantalla-bienvenida, #pantalla-crear-perfil, #pantalla-login, #pantalla-perfil, #pantalla-lobby,
#pantalla-recuperar, #pantalla-admin-login {
  display: none; place-items: center; min-height: 100vh; padding: 20px;
}
#pantalla-bienvenida.activa, #pantalla-crear-perfil.activa, #pantalla-login.activa,
#pantalla-perfil.activa, #pantalla-lobby.activa,
#pantalla-recuperar.activa, #pantalla-admin-login.activa { display: grid; }

/* ---- DEPORTE ---- */
.deporte-picker { display: flex; gap: 12px; margin-bottom: 16px; }
.deporte-opt { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 2rem; padding: 14px; border-radius: 16px; border: 2px solid #d7e3ff; background: #fff; cursor: pointer; transition: transform .06s, border-color .1s, background .1s; }
.deporte-opt span { font-size: .95rem; font-weight: 800; color: var(--azul-oscuro); font-family: 'Baloo 2'; }
.deporte-opt:hover { border-color: var(--azul); }
.deporte-opt.sel { background: #e7f0ff; border-color: var(--azul-oscuro); transform: scale(1.03); }

/* ---- PERFIL ---- */
.tarjeta-perfil { max-width: 520px; width: 100%; text-align: center; }
.perfil-cabecera { display: flex; align-items: center; gap: 14px; text-align: left; margin-bottom: 8px; }
.perfil-escudo { font-size: 2.6rem; background: #eef5ff; border-radius: 16px; width: 64px; height: 64px; display: grid; place-items: center; }
.perfil-deporte { color: var(--gris); font-weight: 700; margin: 0; }
.perfil-sub { text-align: left; margin: 16px 0 8px; color: var(--azul-oscuro); }
.lista-ligas { display: flex; flex-direction: column; gap: 8px; }
.lista-vacia { color: var(--gris); font-weight: 600; background: #f5f9ff; border-radius: 12px; padding: 14px; }
.liga-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #f3f7ff; border: 2px solid #e1ebff; border-radius: 14px; padding: 14px 16px; font-weight: 800; font-family: 'Baloo 2'; cursor: pointer; transition: transform .06s, border-color .1s; color: var(--azul-oscuro); }
.liga-item:hover { border-color: var(--azul); transform: translateX(3px); }
.liga-cod { font-size: .85rem; letter-spacing: .15em; background: #fff; padding: 3px 10px; border-radius: 20px; color: var(--gris); }
.liga-item-nombre { display: flex; align-items: center; gap: 8px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.liga-item-acciones { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.liga-entrar { color: var(--azul); font-size: 1.1rem; }
.liga-btn {
  border: none; cursor: pointer; font-family: 'Baloo 2', sans-serif; font-weight: 800;
  border-radius: 12px; padding: 7px 11px; font-size: .9rem; line-height: 1;
  transition: transform .06s, filter .15s;
}
.liga-btn:hover { filter: brightness(1.04); }
.liga-btn:active { transform: translateY(1px); }
.liga-btn-archivar { background: #fff; color: var(--gris); border: 2px solid #e1ebff; }
.liga-btn-archivar:hover { color: var(--azul-oscuro); border-color: var(--azul); }
.liga-btn-restaurar { background: #e7f6ee; color: var(--verde-oscuro); border: 2px solid #bce6cf; }
.liga-btn-eliminar { background: #ffe9e9; color: #c63333; border: 2px solid #ffc7c7; }

/* Ligas archivadas */
.bloque-archivadas { margin-top: 6px; }
.archivadas-nota { text-align: left; color: var(--gris); font-size: .9rem; font-weight: 600; margin: 0 0 8px; }
.liga-item-archivada { background: #fbfbfd; border-color: #e7e7ef; color: var(--gris); cursor: default; }
.liga-item-archivada:hover { border-color: #e7e7ef; transform: none; }
.liga-item-archivada .liga-item-nombre { color: var(--texto); }
.liga-nota-archivada { color: var(--gris); font-weight: 600; }

/* Botón de archivar en el lobby */
.btn-archivar { display: block; margin: 12px auto 0; color: var(--gris); }
.btn-archivar:hover { color: #c63333; }
.perfil-acciones { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 18px 0 10px; }
.accion-bloque { background: #fafcff; border: 1.5px solid #e1ebff; border-radius: 16px; padding: 14px; }
.accion-bloque h3 { margin: 0 0 10px; font-size: 1rem; color: var(--azul-oscuro); }
.accion-bloque input {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 2px solid #d7e3ff;
  font-size: 1.05rem; font-family: inherit; margin-bottom: 10px; outline: none; background: #fff;
}
.accion-bloque input:focus { border-color: var(--azul); }
@media (max-width: 520px) { .perfil-acciones { grid-template-columns: 1fr; } }

.menu-inicio { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; }
.btn-atras { display: block; text-align: left; margin-bottom: 6px; }
.form-error { background: #fff0f0; color: #c43030; border: 1.5px solid var(--rojo); border-radius: 12px; padding: 8px 12px; font-weight: 700; margin-bottom: 8px; }
.form-ok { background: #eafff3; color: var(--verde-oscuro); border: 1.5px solid var(--verde); border-radius: 12px; padding: 8px 12px; font-weight: 700; margin-bottom: 8px; }
.admin-link { display: block; margin: 14px auto 0; opacity: .55; font-size: .85rem; }
.admin-link:hover { opacity: 1; }
.tarjeta-admin { max-width: 920px; }
.tabla-admin-cont { overflow-x: auto; margin: 10px 0 16px; }
.tabla-admin { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tabla-admin th, .tabla-admin td { padding: 8px 10px; text-align: left; border-bottom: 1px solid #e3eaff; white-space: nowrap; }
.tabla-admin th { color: var(--azul); font-family: 'Baloo 2'; }
.tabla-admin tbody tr:nth-child(even) { background: #f6f9ff; }
.admin-acciones { white-space: nowrap; display: flex; gap: 6px; flex-wrap: wrap; }
.btn-admin-mini { border-radius: 8px; padding: 5px 9px; font-family: 'Baloo 2'; font-weight: 700; cursor: pointer; font-size: .82rem; border: 1px solid transparent; }
.btn-editar-perfil { background: #e7f0ff; color: var(--azul-oscuro); border-color: #c7dcff; }
.btn-editar-perfil:hover { background: #d6e6ff; }
.btn-progreso-perfil { background: #eafff3; color: var(--verde-oscuro); border-color: #b7e6cd; }
.btn-progreso-perfil:hover { background: #d6f7e4; }
.btn-borrar-perfil { background: #ffe3e3; color: #c0392b; border-color: #f5b7b1; }
.btn-borrar-perfil:hover { background: #ffd0d0; }

/* Formulario dentro de un modal (editar perfil) */
.modal-form-caja { max-width: 420px; text-align: left; max-height: 86vh; overflow-y: auto; }
.modal-form-caja h2 { font-family: 'Baloo 2'; color: var(--azul-oscuro); text-align: center; margin-bottom: 12px; }
.modal-form-caja label { display: block; font-weight: 700; margin: 10px 0 4px; color: var(--azul-oscuro); }
.modal-form-caja input, .modal-form-caja select {
  width: 100%; padding: 11px 12px; border-radius: 12px; border: 2px solid #d7e3ff;
  font-family: 'Nunito', sans-serif; font-size: 1rem; outline: none;
}
.modal-form-caja input:focus, .modal-form-caja select:focus { border-color: var(--azul); }
.modal-form-caja .btn { margin-top: 12px; }

/* Progreso por liga */
.prog-liga { background: #f6f9ff; border: 2px solid #e3eaff; border-radius: 14px; padding: 12px 14px; }
.prog-liga-nom { font-family: 'Baloo 2'; font-weight: 800; color: var(--azul-oscuro); margin-bottom: 8px; }
.prog-cod { font-weight: 700; color: var(--gris); font-size: .85rem; letter-spacing: .1em; }
.prog-stats { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; font-size: .95rem; color: var(--texto); }
.prog-pos { font-size: 1.2rem; font-weight: 800; color: var(--azul); }

/* Informe para padres */
.btn-informe-perfil { background: #fff4e0; color: #b9770e; border-color: #f3d79a; }
.btn-informe-perfil:hover { background: #ffe9c7; }
.informe-resumen { background: #f6f9ff; border: 2px solid #e3eaff; border-radius: 14px; padding: 12px 14px; margin-bottom: 4px; }
.informe-global { font-size: 1.05rem; color: var(--azul-oscuro); }
.informe-sub { color: var(--gris); font-weight: 600; font-size: .9rem; }
.informe-consejo { margin-top: 6px; color: #b9770e; font-weight: 700; }
.informe-consejo.informe-bien { color: var(--verde-oscuro); }
.informe-item { padding: 6px 2px; }
.informe-tema-cab { display: flex; justify-content: space-between; align-items: baseline; }
.informe-tema-nom { font-weight: 700; color: var(--texto); }
.informe-pct { font-weight: 800; }
.informe-pct.informe-ok { color: var(--verde-oscuro); }
.informe-pct.informe-medio { color: #b9770e; }
.informe-pct.informe-bajo { color: #c0392b; }
.informe-barra { height: 10px; background: #eef2f7; border-radius: 6px; overflow: hidden; margin: 4px 0; }
.informe-barra-fill { height: 100%; border-radius: 6px; }
.informe-barra-fill.informe-ok { background: #2ecc71; }
.informe-barra-fill.informe-medio { background: #f39c12; }
.informe-barra-fill.informe-bajo { background: #e74c3c; }
.informe-detalle { font-size: .82rem; color: var(--gris); }

/* Medallas */
.btn-medallas { margin: 0 0 14px; }
.medallas-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; max-height: 56vh; overflow-y: auto; padding: 2px; margin-bottom: 16px; }
.medalla { text-align: center; border-radius: 14px; padding: 12px 8px; border: 2px solid #e3eaff; background: #f6f9ff; }
.medalla-ok { border-color: #ffd86b; background: linear-gradient(180deg, #fff8e6, #fff0c4); box-shadow: 0 4px 0 #f0c64b; }
.medalla-bloq { opacity: .65; filter: grayscale(.4); }
.medalla-emoji { font-size: 2rem; line-height: 1; }
.medalla-nom { font-family: 'Baloo 2'; font-weight: 800; color: var(--azul-oscuro); margin-top: 6px; font-size: .95rem; }
.medalla-desc { font-size: .78rem; color: var(--gris); margin-top: 2px; }
.medalla-niv { margin-top: 4px; font-size: .9rem; }
.medalla-estrella { color: #d9d9d9; }
.medalla-estrella.on { color: #ffb01f; }
.medalla-frac { font-family: 'Baloo 2'; font-weight: 800; color: var(--azul-oscuro); font-size: .82rem; margin-left: 2px; }
.medalla.nivel-3 { border-color: #ffc233; background: linear-gradient(180deg, #fff3cf, #ffe49a); box-shadow: 0 4px 0 #e8ab1f; }
.medalla-barra { height: 8px; background: #e3eaff; border-radius: 6px; overflow: hidden; margin: 6px 2px 4px; }
.medalla-barra-relleno { height: 100%; background: linear-gradient(90deg, #34c46f, #2bb673); border-radius: 6px; transition: width .4s ease; }
.medalla.nivel-3 .medalla-barra-relleno { background: linear-gradient(90deg, #ffce4d, #ffb01f); }

/* Aviso flotante de medalla nueva */
.toast-logro {
  position: fixed; top: 26px; left: 50%;
  transform: translateX(-50%) translateY(-24px);
  background: linear-gradient(180deg, #ffce4d, #ffb01f); color: #5a3b00;
  font-family: 'Baloo 2'; padding: 14px 26px; border-radius: 24px;
  box-shadow: 0 12px 34px rgba(240, 170, 30, .5);
  z-index: 1100; opacity: 0; pointer-events: none; text-align: center;
  transition: opacity .25s ease, transform .25s ease;
}
.toast-logro.mostrar { opacity: 1; transform: translateX(-50%) translateY(0); animation: toast-pop .45s ease; }
.toast-logro-tit { font-weight: 800; font-size: 1.2rem; margin-bottom: 4px; }
.toast-logro-item { font-size: 1rem; }
.toast-logro-emoji { font-size: 1.2rem; }
/* Selector de idioma (pantalla de bienvenida) */
.selector-idioma { display: flex; justify-content: center; gap: 8px; margin-bottom: 12px; }
.idioma-opt {
  border: 2px solid #d7e3ff; background: #fff; border-radius: 12px;
  padding: 6px 10px; font-family: 'Baloo 2'; font-weight: 700; font-size: .9rem;
  color: var(--azul-oscuro); cursor: pointer; transition: border-color .15s ease, background .15s ease;
}
.idioma-opt:hover { border-color: var(--azul); }
.idioma-opt.sel { border-color: var(--azul); background: #eaf2ff; }

/* Cambiar de deporte dentro de la liga */
.cambiar-deporte-fila { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 4px 0 14px; flex-wrap: wrap; }
.cambiar-deporte-fila label { font-weight: 700; color: var(--gris); font-size: .9rem; }
.sel-deporte {
  border: 2px solid #d7e3ff; background: #fff; border-radius: 12px;
  padding: 8px 12px; font-family: 'Baloo 2'; font-weight: 700; font-size: .95rem;
  color: var(--azul-oscuro); cursor: pointer;
}
.sel-deporte:hover { border-color: var(--azul); }
/* Separación entre el botón de entrenar y el de jugar */
.tarjeta-partido #btn-entrenar { margin-bottom: 14px; }

/* Tutorial / cómo se juega */
.modal-tutorial-caja { max-width: 560px; width: 100%; }
.tutorial-cuerpo { text-align: left; max-height: 62vh; overflow-y: auto; padding: 4px 6px 4px 2px; margin-bottom: 12px; }
.tuto-bloque { padding: 12px 14px; border-radius: 14px; background: #f6f9ff; border: 2px solid #e3eaff; margin-bottom: 10px; }
.tuto-bloque h3 { font-family: 'Baloo 2'; color: var(--azul-oscuro); margin: 0 0 6px; font-size: 1.05rem; }
.tuto-bloque p { margin: 6px 0; line-height: 1.4; color: #2b3550; }
.tuto-bloque ul { margin: 6px 0; padding-left: 20px; }
.tuto-bloque li { margin: 6px 0; line-height: 1.4; color: #2b3550; }
.tuto-destacado { background: linear-gradient(180deg, #fff8e6, #fff0c4); border-color: #ffd86b; }
.tuto-formula { font-family: 'Baloo 2'; font-weight: 800; text-align: center; font-size: 1.1rem; color: var(--azul-oscuro); background: #fff; border-radius: 12px; padding: 10px; margin: 8px 0; }
.tuto-nota { font-size: .9rem; color: var(--gris); }

/* Botón instalar app (PWA) */
.btn-instalar { background: linear-gradient(180deg, #34c46f, #1fa85a); box-shadow: 0 5px 0 #178a48; }
.btn-instalar:hover { filter: brightness(1.03); }
.instalar-pasos { text-align: left; color: var(--azul-oscuro); }
.instalar-pasos ol { margin: 8px 0 8px 4px; padding-left: 20px; }
.instalar-pasos li { margin: 8px 0; line-height: 1.35; }
.instalar-nota { font-size: .85rem; color: var(--gris); margin-top: 6px; }
.ios-share { display: inline-block; transform: translateY(2px); }

.input-codigo { text-transform: uppercase; letter-spacing: .22em; text-align: center; font-family: 'Baloo 2'; font-weight: 800; }

.escudo-picker { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 16px; }
.escudo-opt { font-size: 1.5rem; width: 46px; height: 46px; border-radius: 12px; border: 2px solid #d7e3ff; background: #fff; cursor: pointer; transition: transform .06s, border-color .1s; }
.escudo-opt:hover { border-color: var(--azul); }
.escudo-opt.sel { background: var(--azul); border-color: var(--azul-oscuro); transform: scale(1.05); }

/* ---- LOBBY ---- */
.tarjeta-lobby { max-width: 480px; text-align: center; }
.codigo-grande {
  font-family: 'Baloo 2'; font-weight: 800; font-size: 2.6rem; letter-spacing: .25em;
  color: var(--azul-oscuro); background: #eef5ff; border: 2px dashed var(--azul);
  border-radius: 16px; padding: 14px; margin: 8px 0 12px;
}
.lobby-sub { margin: 18px 0 10px; color: var(--azul-oscuro); }
.lobby-roster { display: flex; flex-direction: column; gap: 6px; text-align: left; }
.lobby-jugador { display: flex; align-items: center; gap: 8px; background: #f3f7ff; border-radius: 12px; padding: 9px 12px; font-weight: 700; }
.lobby-jugador.lobby-yo { outline: 2px solid var(--azul); background: #e7f0ff; }
.lobby-esc { font-size: 1.4rem; }
.lobby-nom { flex: 1; }
.lobby-tag { font-size: .75rem; font-weight: 800; color: var(--gris); background: #fff; padding: 2px 8px; border-radius: 20px; }
.lobby-tag.bot { color: #8a6a00; background: #fff2cc; }
.lobby-nota { color: var(--gris); font-weight: 600; font-size: .82rem; margin: 12px 0; }

.cal-badge.pend { background: #eef5ff; color: var(--azul-oscuro); }
.tarjeta-registro { max-width: 440px; text-align: center; }
.balon-grande { font-size: 4.5rem; animation: bote 1.6s ease-in-out infinite; }
@keyframes bote { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-14px)} }
.tarjeta-registro h1 { font-size: 2.1rem; color: var(--azul-oscuro); margin-top: 6px; }
.subtitulo { color: var(--gris); margin: 8px 0 22px; font-weight: 600; }
.tarjeta-registro label { display: block; font-weight: 700; margin-bottom: 8px; text-align: left; }
#nombre-input,
.tarjeta-registro input,
.tarjeta-registro select {
  width: 100%; padding: 14px 16px; border-radius: 14px;
  border: 2px solid #d7e3ff; font-size: 1.1rem; font-family: inherit;
  margin-bottom: 18px; outline: none; background: #fff; color: var(--texto);
}
#nombre-input:focus,
.tarjeta-registro input:focus,
.tarjeta-registro select:focus { border-color: var(--azul); }
.select-curso { font-weight: 700; cursor: pointer; appearance: auto; }
.ayuda-curso { margin: -10px 0 16px; color: var(--gris); font-weight: 600; font-size: .85rem; text-align: left; }
.check-recordar { display: flex; align-items: center; gap: 10px; text-align: left; font-weight: 700; margin: -4px 0 16px; cursor: pointer; }
.check-recordar input {
  width: auto; height: auto; margin: 0; padding: 0; border: none; flex: none;
  transform: scale(1.35); accent-color: var(--azul); cursor: pointer;
}
.check-recordar span { font-size: .95rem; color: var(--texto); }

/* ---- CABECERA ---- */
.cabecera {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 16px 24px; padding-top: max(16px, env(safe-area-inset-top));
  background: #fff; box-shadow: var(--sombra);
  position: sticky; top: 0; z-index: 10;
}
.logo { font-size: 1.4rem; color: var(--azul-oscuro); font-weight: 800; }
.info-jugador { display: flex; align-items: center; gap: 14px; font-weight: 700; }
.badge-puntos {
  background: linear-gradient(180deg, #fff2cc, #ffe08a);
  padding: 8px 14px; border-radius: 30px; color: #8a6a00;
}

/* ---- CONTENIDO INICIO ---- */
.contenido {
  max-width: 1100px; margin: 0 auto; padding: 24px;
  display: grid; grid-template-columns: 1.2fr 1fr; gap: 22px;
  align-items: start;
}
.columna-principal { display: flex; flex-direction: column; gap: 22px; }

.tarjeta-bienvenida { display: flex; gap: 18px; align-items: center; }
.mascota { font-size: 3.6rem; animation: saludo 2.4s ease-in-out infinite; }
@keyframes saludo { 0%,100%{transform:rotate(-6deg)} 50%{transform:rotate(8deg)} }
.bienvenida-texto h2 { color: var(--verde-oscuro); font-size: 1.6rem; }
.bienvenida-texto p { color: var(--gris); font-weight: 600; margin-top: 2px; }
.aviso-asistencia {
  margin-top: 10px; background: #eafff3; color: var(--verde-oscuro);
  border: 1.5px dashed var(--verde); border-radius: 12px;
  padding: 8px 12px; font-weight: 800;
}

.estado-deberes { margin: 14px 0; font-weight: 700; }
.estado-deberes.completado { color: var(--verde-oscuro); }

.aviso-falta {
  margin-top: 10px; background: #fff0f0; color: #c43030;
  border: 1.5px solid var(--rojo); border-radius: 12px;
  padding: 10px 12px; font-weight: 700; font-size: .92rem;
}

/* ---- ENFRENTAMIENTO ---- */
.tarjeta-partido { text-align: center; }
.enfrentamiento {
  display: flex; align-items: center; justify-content: center; gap: 18px;
  background: linear-gradient(180deg, #f3f7ff, #e9f1ff);
  border-radius: 16px; padding: 16px; margin-bottom: 4px;
}
.equipo-vs { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 1; }
.escudo-vs { font-size: 2.6rem; }
.nombre-vs { font-weight: 800; color: var(--texto); }
.vs-texto { font-family: 'Baloo 2'; font-weight: 800; color: var(--rojo); font-size: 1.4rem; }

/* ---- ROL / MARCADOR ---- */
.rol-banner {
  font-family: 'Baloo 2'; font-weight: 800; font-size: 1.05rem;
  padding: 6px 16px; border-radius: 30px; color: #fff;
  background: var(--azul);
}
.rol-banner.rol-ataque { background: linear-gradient(180deg, #ff8a3d, #f4691f); }
.rol-banner.rol-defensa { background: linear-gradient(180deg, var(--azul), var(--azul-oscuro)); }
.marcador-mini { font-weight: 800; color: var(--texto); font-size: .95rem; }

.fila-rol { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 10px; flex-wrap: wrap; }
.contador-tiros { background: #f3f7ff; padding: 6px 14px; border-radius: 30px; font-weight: 700; color: var(--azul-oscuro); }

.marcador-grande {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  flex-wrap: wrap; margin: 8px 0 16px;
}
.marcador-grande .m-equipo { font-weight: 800; font-size: 1.05rem; }
.marcador-grande .m-goles {
  font-family: 'Baloo 2'; font-weight: 800; font-size: 2.4rem; color: var(--azul-oscuro);
  background: #f3f7ff; border-radius: 12px; min-width: 54px; padding: 4px 10px;
}
.marcador-grande .m-sep { font-size: 1.6rem; color: var(--gris); font-weight: 800; }

.tabla-scroll { overflow-x: auto; }

/* ---- NAV ---- */
.btn-nav {
  border: 2px solid #d7e3ff; background: #fff; color: var(--azul-oscuro);
  font-weight: 800; font-family: 'Nunito'; border-radius: 30px;
  padding: 8px 16px; cursor: pointer; font-size: .95rem;
  transition: background .12s, color .12s;
}
.btn-nav:hover { background: var(--azul); color: #fff; border-color: var(--azul); }

/* ---- CALENDARIO ---- */
.contenido-cal { max-width: 720px; margin: 0 auto; padding: 20px; }
.cal-leyenda { color: var(--gris); font-weight: 600; margin-bottom: 16px; text-align: center; }
.cal-tag-tu { background: #e7f0ff; color: var(--azul-oscuro); padding: 1px 8px; border-radius: 8px; font-weight: 800; }

.cal-temporada {
  text-align: center; font-family: 'Baloo 2'; font-weight: 800;
  color: var(--azul-oscuro); background: linear-gradient(180deg, #fff2cc, #ffe08a);
  border-radius: 14px; padding: 10px 14px; margin-bottom: 16px;
}

.cal-jornada {
  background: #fff; border-radius: 18px; box-shadow: var(--sombra);
  padding: 14px 16px; margin-bottom: 16px; border-left: 6px solid #e3ebfa;
}
.cal-jornada.cal-proxima { border-left-color: var(--verde); }
.cal-jornada.cal-pasada { border-left-color: var(--gris); }
.cal-jornada.cal-futura { border-left-color: #cdd8ec; opacity: .96; }

.cal-cab { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.cal-jnum { font-family: 'Baloo 2'; font-weight: 800; font-size: 1.15rem; color: var(--azul-oscuro); }
.cal-estado {
  font-size: .72rem; text-transform: uppercase; font-weight: 800; letter-spacing: .03em;
  color: var(--gris); background: #f2f5fa; padding: 3px 10px; border-radius: 20px;
}
.cal-proxima .cal-estado { background: #eafff3; color: var(--verde-oscuro); }
.cal-badge { margin-left: auto; font-weight: 800; padding: 3px 12px; border-radius: 20px; font-size: .82rem; }
.cal-badge.v { background: #eafff3; color: var(--verde-oscuro); }
.cal-badge.e { background: #fff6e0; color: #9a7400; }
.cal-badge.d { background: #fff0f0; color: #c43030; }

.cal-partido {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  gap: 8px; padding: 7px 6px; border-top: 1px solid #f2f5fa; font-weight: 700;
}
.cal-partido:first-of-type { border-top: none; }
.cal-tuyo { background: linear-gradient(90deg, #eef5ff, #f6faff); border-radius: 10px; }
.cal-eq-izq { text-align: right; }
.cal-eq-der { text-align: left; }
.cal-esc { font-size: 1.2rem; vertical-align: middle; }
.cal-sede-ico { font-size: .85rem; opacity: .75; }
.cal-marc { display: inline-flex; align-items: center; gap: 6px; justify-content: center; min-width: 64px; }
.cal-goles {
  font-family: 'Baloo 2'; font-weight: 800; font-size: 1.2rem; color: var(--azul-oscuro);
  background: #f3f7ff; border-radius: 8px; min-width: 28px; text-align: center; padding: 0 6px;
}
.cal-sep { color: var(--gris); font-weight: 800; }
.cal-vs { color: var(--gris); font-weight: 800; font-size: .95rem; }

.cal-pista { font-size: .78rem; color: var(--gris); font-weight: 700; margin-bottom: 6px; }
.cal-clickable { cursor: pointer; border-radius: 10px; transition: background .12s; }
.cal-clickable:hover { background: #f3f7ff; }

.cal-detalle {
  background: #f5f9ff; border-radius: 10px;
  margin: 0 0 4px; padding: 8px 12px; font-weight: 600; color: var(--texto);
  border-left: 3px solid var(--azul);
}
.cal-det-linea { font-size: .9rem; padding: 2px 0; }

.cal-btn-tabla {
  margin-top: 10px; width: 100%; border: 1.5px solid #d7e3ff; background: #fff;
  color: var(--azul-oscuro); font-weight: 800; font-family: 'Nunito'; cursor: pointer;
  border-radius: 12px; padding: 9px; font-size: .9rem; transition: background .12s, color .12s;
}
.cal-btn-tabla:hover { background: var(--azul); color: #fff; border-color: var(--azul); }

.cal-tabla-wrap { margin-top: 10px; }
.cal-tabla { width: 100%; border-collapse: collapse; }
.cal-tabla th { font-size: .72rem; text-transform: uppercase; color: var(--gris); padding: 4px; border-bottom: 2px solid #eef2f9; }
.cal-tabla th.cal-th-jug, .cal-tabla td.cal-td-jug { text-align: left; }
.cal-tabla td { text-align: center; padding: 5px 4px; font-weight: 700; border-bottom: 1px solid #f2f5fa; font-size: .9rem; }
.cal-td-pts { color: var(--azul-oscuro); font-family: 'Baloo 2'; }
.cal-tabla tr.cal-tr-tu { background: #e7f0ff; }
.cal-tabla tr.cal-tr-tu td { color: var(--azul-oscuro); }

@media (max-width: 560px) {
  .cal-eq { font-size: .88rem; }
  .cal-esc { font-size: 1rem; }
}

.mini-stats { display: flex; gap: 12px; margin-top: 16px; }
.mini-stat {
  flex: 1; background: #f3f7ff; border-radius: 14px; padding: 12px;
  text-align: center;
}
.mini-stat span { display: block; font-size: 1.6rem; font-weight: 800; color: var(--azul-oscuro); font-family: 'Baloo 2'; }
.mini-stat small { color: var(--gris); font-weight: 700; }

/* ---- CLASIFICACIÓN ---- */
.tarjeta-clasificacion h2 { margin-bottom: 14px; color: var(--azul-oscuro); }
.tabla-liga { width: 100%; border-collapse: collapse; }
.tabla-liga th {
  text-align: center; font-size: .8rem; color: var(--gris);
  text-transform: uppercase; padding: 6px 4px; border-bottom: 2px solid #eef2f9;
}
.tabla-liga th.th-jugador { text-align: left; }
.tabla-liga td { padding: 9px 4px; text-align: center; font-weight: 700; border-bottom: 1px solid #f2f5fa; }
.tabla-liga td.td-jugador { text-align: left; }
.fila-pos { display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 8px; background: #eef2f9; font-weight: 800; }
.tabla-liga tr.campeon .fila-pos { background: var(--verde); color: #fff; }
.tabla-liga tr.tu {
  background: linear-gradient(90deg, #e7f0ff, #f3f8ff);
  outline: 2px solid var(--azul); outline-offset: -2px;
}
.tabla-liga tr.tu td { color: var(--azul-oscuro); }
.td-pts { color: var(--azul-oscuro); font-family: 'Baloo 2'; font-size: 1.05rem; }
.escudo { margin-right: 6px; }
.leyenda-liga { margin-top: 12px; font-size: .82rem; color: var(--gris); font-weight: 700; }
.punto-verde, .punto-azul { display:inline-block; width:10px; height:10px; border-radius:50%; vertical-align:middle; }
.punto-verde { background: var(--verde); }
.punto-azul { background: var(--azul); }

.pie { text-align: center; padding: 10px 0 30px; }

/* ---- DEBERES ---- */
.barra-superior {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 22px; background: #fff; box-shadow: var(--sombra);
}
.progreso-info { font-weight: 800; color: var(--texto); }
.puntos-sesion { font-weight: 800; color: var(--verde-oscuro); }
.barra-progreso { height: 10px; background: #e3ebfa; }
#barra-progreso-relleno { height: 100%; width: 0; background: linear-gradient(90deg, var(--verde), var(--amarillo)); transition: width .3s ease; }

.zona-ejercicio { max-width: 640px; margin: 16px auto; padding: 0 16px; }
.tarjeta-ejercicio { text-align: center; }

/* ---- TEMPORIZADOR (15 s por pregunta) ---- */
.temporizador { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.temporizador-icono { font-size: 1.3rem; }
.temporizador-barra { flex: 1; height: 12px; background: #e3ebfa; border-radius: 30px; overflow: hidden; }
.temporizador-relleno {
  height: 100%; width: 100%;
  background: linear-gradient(90deg, var(--verde), var(--amarillo));
  border-radius: 30px; transition: width 1s linear, background .3s ease;
}
.temporizador-num {
  font-family: 'Baloo 2'; font-weight: 800; font-size: 1.25rem; color: var(--azul-oscuro);
  min-width: 28px; text-align: right;
}
.temporizador.urgente .temporizador-relleno { background: linear-gradient(90deg, var(--rojo), #ff8a3d); }
.temporizador.urgente .temporizador-num { color: var(--rojo); animation: latido .6s ease-in-out infinite; }
@keyframes latido { 0%,100%{ transform: scale(1); } 50%{ transform: scale(1.18); } }

/* Aviso flotante "¡Se acabó el tiempo!" */
.toast-tiempo {
  position: fixed; top: 26px; left: 50%;
  transform: translateX(-50%) translateY(-24px);
  background: linear-gradient(180deg, var(--rojo), #e23b3b); color: #fff;
  font-family: 'Baloo 2'; font-weight: 800; font-size: 1.3rem;
  padding: 14px 28px; border-radius: 30px;
  box-shadow: 0 12px 34px rgba(220, 60, 60, .4);
  z-index: 1000; opacity: 0; pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
.toast-tiempo.mostrar {
  opacity: 1; transform: translateX(-50%) translateY(0);
  animation: toast-pop .45s ease;
}
@keyframes toast-pop {
  0%   { transform: translateX(-50%) translateY(0) scale(.8); }
  55%  { transform: translateX(-50%) translateY(0) scale(1.1); }
  100% { transform: translateX(-50%) translateY(0) scale(1); }
}
/* Ventana modal (recordatorio de papel y lápiz antes del partido) */
.modal-fondo {
  position: fixed; inset: 0; z-index: 2000; padding: 20px;
  background: rgba(20, 30, 60, .5); display: grid; place-items: center;
}
.modal-fondo.oculto { display: none; }
.modal-caja {
  background: var(--tarjeta); border-radius: 22px; padding: 28px 24px;
  max-width: 380px; width: 100%; text-align: center; box-shadow: var(--sombra);
  animation: modal-pop .28s ease;
}
.modal-emoji { font-size: 3rem; line-height: 1; margin-bottom: 6px; }
.modal-caja h2 { font-family: 'Baloo 2'; color: var(--azul-oscuro); margin: 4px 0 10px; }
.modal-caja p { color: var(--gris); font-weight: 600; margin-bottom: 18px; }
.modal-caja .btn { margin-top: 8px; }
@keyframes modal-pop { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* Botón de sonido (silenciar/activar) en la barra del partido */
.btn-sonido {
  background: #fff; border: 2px solid #d7e3ff; border-radius: 12px;
  font-size: 1.2rem; line-height: 1; padding: 6px 10px; cursor: pointer;
}
.btn-sonido:hover { border-color: var(--azul); }

/* Repaso de fallos */
.modal-repaso-caja { max-width: 460px; text-align: left; }
.modal-repaso-caja h2 { font-family: 'Baloo 2'; color: var(--azul-oscuro); text-align: center; margin-bottom: 4px; }
.modal-repaso-sub { color: var(--gris); font-weight: 600; text-align: center; margin-bottom: 14px; }
.repaso-lista { max-height: 50vh; overflow-y: auto; margin-bottom: 16px; display: flex; flex-direction: column; gap: 12px; }
.repaso-item { background: #f6f9ff; border: 2px solid #e3eaff; border-radius: 14px; padding: 12px 14px; }
.repaso-tema { font-family: 'Baloo 2'; font-weight: 800; color: var(--azul); font-size: .95rem; margin-bottom: 4px; }
.repaso-enunciado { font-weight: 700; color: var(--texto); margin-bottom: 6px; }
.repaso-correcta { color: var(--verde-oscuro); font-weight: 700; margin-bottom: 4px; }
.repaso-explica { color: var(--gris); font-weight: 600; font-size: .92rem; }

.tema-ejercicio {
  display: inline-flex; align-items: center; gap: 8px;
  background: #f3f7ff; padding: 6px 16px; border-radius: 30px;
  font-weight: 800; color: var(--azul-oscuro); margin-bottom: 18px;
}
.tema-ejercicio span:first-child { font-size: 1.3rem; }
.enunciado { font-size: 1.6rem; font-weight: 800; line-height: 1.5; margin-bottom: 22px; }
.enunciado .num { color: var(--azul-oscuro); }

.zona-respuesta { margin-bottom: 18px; }
.input-respuesta {
  width: 220px; max-width: 80%; text-align: center;
  font-size: 2rem; font-weight: 800; font-family: 'Baloo 2';
  padding: 12px; border-radius: 16px; border: 3px solid #d7e3ff; outline: none;
  color: var(--azul-oscuro);
}
.input-respuesta:focus { border-color: var(--azul); }

/* ---- OPERACIÓN EN COLUMNA (suma / resta por cifras) ---- */
.op-columna { width: fit-content; margin: 4px auto 2px; }
.op-fila { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.op-fila + .op-fila { margin-top: 4px; }
.op-signo { width: 28px; text-align: center; font-size: 1.9rem; font-weight: 800; font-family: 'Baloo 2'; color: var(--azul); }
.op-digito {
  width: 46px; height: 54px; display: grid; place-items: center;
  font-size: 2rem; font-weight: 800; font-family: 'Baloo 2'; color: var(--azul-oscuro);
}
.op-linea { border-bottom: 4px solid var(--azul-oscuro); border-radius: 4px; margin: 6px 0; }
.casilla {
  width: 46px; height: 54px; text-align: center; padding: 0;
  font-size: 2rem; font-weight: 800; font-family: 'Baloo 2'; color: var(--azul-oscuro);
  border: 2px solid #d7e3ff; border-radius: 10px; outline: none; background: #fff;
}
.casilla:focus { border-color: var(--azul); background: #f1f7ff; transform: scale(1.04); }
.op-pista { text-align: center; color: var(--gris); font-weight: 700; font-size: .85rem; margin: 10px auto 0; max-width: 320px; }
@media (max-width: 480px) {
  .op-digito, .casilla { width: 34px; height: 44px; font-size: 1.5rem; }
  .op-signo { width: 20px; font-size: 1.5rem; }
  .op-fila { gap: 4px; }
}

.opciones { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.opcion-btn {
  font-size: 2rem; font-family: 'Baloo 2'; font-weight: 800;
  width: 88px; height: 72px; border-radius: 16px;
  border: 3px solid #d7e3ff; background: #fff; cursor: pointer;
  color: var(--azul-oscuro); transition: transform .06s, border-color .1s, background .1s;
}
.opcion-btn:hover { border-color: var(--azul); }
.opcion-btn.elegida { background: var(--azul); color: #fff; border-color: var(--azul-oscuro); }

.feedback { border-radius: 16px; padding: 16px; margin-bottom: 18px; font-weight: 700; text-align: left; }
.feedback.bien { background: #eafff3; border: 2px solid var(--verde); color: var(--verde-oscuro); }
.feedback.mal { background: #fff0f0; border: 2px solid var(--rojo); color: #c43030; }
.feedback h3 { font-family: 'Baloo 2'; margin-bottom: 6px; font-size: 1.2rem; }
.feedback .explicacion { color: var(--texto); font-weight: 600; margin-top: 8px; }

/* La barra de botones (Comprobar / Siguiente) queda fija en la parte baja de la
   tarjeta para que siempre sea visible sin tener que usar la barra de scroll. */
.botones-ejercicio {
  display: flex; flex-direction: column; gap: 10px;
  position: sticky; bottom: 0; z-index: 5;
  margin: 10px -26px -26px; padding: 12px 26px 18px;
  background: var(--tarjeta); border-radius: 0 0 22px 22px;
}

/* ---- RESULTADOS ---- */
#pantalla-resultados, #pantalla-transicion { display: none; place-items: center; min-height: 100vh; padding: 20px; }
#pantalla-resultados.activa, #pantalla-transicion.activa { display: grid; }
.tarjeta-resultados { max-width: 460px; text-align: center; }
.trofeo-resultado { font-size: 4.5rem; animation: bote 1.6s ease-in-out infinite; }
.tarjeta-resultados h1 { color: var(--azul-oscuro); margin: 6px 0; }
#mensaje-resultado { color: var(--gris); font-weight: 600; margin-bottom: 20px; }
.resumen-grid { display: flex; gap: 12px; margin-bottom: 22px; }
.resumen-item { flex: 1; background: #f3f7ff; border-radius: 14px; padding: 14px; }
.resumen-item span { display: block; font-size: 1.7rem; font-weight: 800; color: var(--azul-oscuro); font-family: 'Baloo 2'; }
.resumen-item small { color: var(--gris); font-weight: 700; }
.tarjeta-resultados .btn { margin-top: 10px; }

/* ---- ENTRENAMIENTO (Banderas) ---- */
.rol-banner.rol-entreno { background: linear-gradient(180deg, #ffc233, #f4a300); color: #5a3d00; }
.bandera-pregunta { display: grid; place-items: center; margin: 2px 0 8px; }
.bandera-img {
  width: auto; height: auto; max-width: 60%; max-height: clamp(84px, 16vh, 150px);
  border-radius: 12px;
  border: 3px solid #e3eaff; box-shadow: 0 6px 18px rgba(0,0,0,.15); background: #f4f7ff;
}
.bandera-texto { text-align: center; font-weight: 800; font-size: 1.05rem; color: var(--azul-oscuro); margin-bottom: 4px; }
.ent-opciones { display: grid; gap: 10px; margin-bottom: 4px; }
.ent-opcion {
  font-family: 'Nunito', sans-serif; font-weight: 700; font-size: 1.05rem;
  padding: 11px 16px; border-radius: 14px; border: 3px solid #d7e3ff;
  background: #fff; color: var(--azul-oscuro); cursor: pointer; text-align: center;
  transition: transform .06s, border-color .1s, background .1s;
}
.ent-opcion:hover:not(:disabled) { border-color: var(--azul); transform: translateY(-1px); }
.ent-opcion:disabled { cursor: default; }
.ent-opcion.correcta { background: #eafff3; border-color: var(--verde); color: var(--verde-oscuro); }
.ent-opcion.incorrecta { background: #fff0f0; border-color: var(--rojo); color: #c43030; }

/* ---- RESPONSIVE ---- */
@media (max-width: 860px) {
  .contenido { grid-template-columns: 1fr; }
  .logo { font-size: 1.1rem; }
  .enunciado { font-size: 1.35rem; }
}

/* Móviles: la cabecera y la barra del partido se reordenan para que
   todo quepa sin scroll lateral y los botones sean fáciles de tocar. */
@media (max-width: 600px) {
  .cabecera { flex-wrap: wrap; padding: 12px 14px; padding-top: max(12px, env(safe-area-inset-top)); }
  .logo { font-size: 1.05rem; width: 100%; }
  .info-jugador { width: 100%; flex-wrap: wrap; gap: 8px; }
  #saludo-jugador { flex: 1 1 100%; }
  .btn-nav { flex: 1; text-align: center; padding: 10px 8px; font-size: .9rem; }

  .contenido { padding: 16px 14px; gap: 16px; }
  .tarjeta { padding: 18px 16px; }
  .tarjeta-bienvenida { gap: 12px; }
  .mascota { font-size: 2.8rem; }
  .bienvenida-texto h2 { font-size: 1.35rem; }

  .barra-superior { flex-wrap: wrap; gap: 8px; padding: 12px 14px; padding-top: max(12px, env(safe-area-inset-top)); }
  .barra-superior #btn-volver { order: 1; }
  .rol-banner { order: 3; flex: 1 1 100%; text-align: center; }
  .marcador-mini { order: 2; margin-left: auto; }

  .zona-ejercicio { margin: 12px auto; padding: 0 12px; }
  .botones-ejercicio { margin: 8px -16px -18px; padding: 10px 16px 14px; border-radius: 0 0 18px 18px; }
  .enunciado { font-size: 1.25rem; }
  .opcion-btn { width: 72px; height: 64px; font-size: 1.6rem; }
  .mini-stat span { font-size: 1.35rem; }
  .tabla-liga th, .tabla-liga td { padding: 7px 3px; font-size: .92rem; }
}
