/* =====================================================================
   Nexora Learning — estilos (mobile y tablet primero)
   Marca: Petróleo #0B2D3D · Oro Nexora #C9A84C · Syne + Plus Jakarta Sans
   ===================================================================== */
:root {
  --petroleo: #0B2D3D;
  --petroleo-2: #134257;
  --oro: #C9A84C;
  --oro-2: #E3C878;
  --oro-osc: #A4852F;
  --fondo: #F6F2E8;
  --papel: #FFFFFF;
  --texto: #10242E;
  --texto-2: #4D6470;
  --linea: #E4DDCB;
  --verde: #23A05A;
  --verde-claro: #DDF5E7;
  --rojo: #D9473B;
  --rojo-claro: #FCE3E0;
  --azul: #2F80ED;
  --materia: #2F80ED;
  --radio: 22px;
  --radio-s: 14px;
  --sombra: 0 2px 0 rgba(11, 45, 61, .06), 0 10px 30px -12px rgba(11, 45, 61, .25);
  --display: 'Syne', 'Trebuchet MS', sans-serif;
  --cuerpo: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  font-family: var(--cuerpo); font-size: 17px; line-height: 1.45; color: var(--texto);
  background: var(--fondo);
  background-image: radial-gradient(circle at 1px 1px, rgba(11,45,61,.07) 1px, transparent 0);
  background-size: 22px 22px;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
h1, h2, h3 { font-family: var(--display); line-height: 1.12; margin: 0 0 .4em; letter-spacing: -.01em; }
a { color: var(--petroleo-2); }
img { max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.contenido {
  width: 100%; max-width: 980px; margin: 0 auto;
  padding: 18px 16px calc(100px + var(--safe-b));
}
.pagina-acceso .contenido { padding-bottom: 40px; }

/* ---------------- Barra superior ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + var(--safe-t)) 14px 10px;
  background: var(--petroleo); color: #fff;
  box-shadow: 0 4px 18px -8px rgba(0,0,0,.4);
}
.marca { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font-family: var(--display); font-weight: 800; font-size: 18px; }
.marca b { color: var(--oro); font-weight: 800; }
.topbar-btn { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; color: #fff; background: rgba(255,255,255,.1); }
.topbar-titulo { flex: 1; font-family: var(--display); font-weight: 800; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.marca + .topbar-titulo { flex: 1; }
.perfil-chip { display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border-radius: 999px; background: rgba(255,255,255,.12); color: #fff; text-decoration: none; font-weight: 700; }
.avatar { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--oro); font-size: 22px; line-height: 1; flex: none; }
.avatar-xl { width: 84px; height: 84px; font-size: 50px; box-shadow: 0 0 0 5px #fff, var(--sombra); }

/* ---------------- Navegación inferior ---------------- */
.navbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 6px 6px calc(6px + var(--safe-b));
  background: rgba(255,255,255,.96); backdrop-filter: blur(10px);
  border-top: 1px solid var(--linea);
}
.navbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border-radius: 14px; color: var(--texto-2); font-size: 12.5px; font-weight: 700; text-decoration: none; }
.navbar a span { font-size: 24px; line-height: 1.1; }
.navbar a.activo { color: var(--petroleo); background: #F3ECD9; }
.pagina-juego .navbar { display: none; }
.pagina-juego .contenido { padding-bottom: calc(30px + var(--safe-b)); }

/* ---------------- Botones ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 12px 22px; border: 0; border-radius: 16px; cursor: pointer;
  font-weight: 800; font-size: 17px; text-decoration: none; text-align: center;
  transition: transform .08s ease, box-shadow .12s ease, filter .12s;
  box-shadow: 0 4px 0 rgba(0,0,0,.18);
  user-select: none; touch-action: manipulation;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.18); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-oro { background: var(--oro); color: var(--petroleo); box-shadow: 0 4px 0 var(--oro-osc); }
.btn-color { background: var(--materia); color: #fff; box-shadow: 0 4px 0 color-mix(in srgb, var(--materia) 70%, #000); }
.btn-claro { background: #fff; color: var(--petroleo); box-shadow: 0 4px 0 var(--linea), inset 0 0 0 2px var(--linea); }
.btn-verde { background: var(--verde); color: #fff; box-shadow: 0 4px 0 #17703F; }
.btn-rojo { background: var(--rojo); color: #fff; box-shadow: 0 4px 0 #9E2C22; }
.btn-texto { background: none; box-shadow: none; color: var(--texto-2); text-decoration: underline; min-height: 44px; }
.btn-grande { min-height: 60px; font-size: 19px; width: 100%; }
.btn-bloque { width: 100%; margin-top: 18px; }
:focus-visible { outline: 3px solid var(--oro); outline-offset: 3px; }

/* ---------------- Tarjetas, formularios ---------------- */
.tarjeta { background: var(--papel); border-radius: var(--radio); padding: 22px; box-shadow: var(--sombra); margin-bottom: 18px; }
.campo { display: block; margin-bottom: 14px; }
.campo > span { display: block; font-weight: 700; font-size: 15px; margin-bottom: 6px; color: var(--petroleo-2); }
.campo input:not([type=radio]):not([type=checkbox]):not([type=file]), .campo select, .campo textarea {
  width: 100%; min-height: 54px; padding: 12px 16px; font-size: 17px;
  border: 2px solid var(--linea); border-radius: var(--radio-s); background: #FDFBF6;
  transition: border-color .15s, box-shadow .15s;
}
.campo input:focus, .campo select:focus, .campo textarea:focus { outline: none; border-color: var(--oro); box-shadow: 0 0 0 4px rgba(201,168,76,.22); background: #fff; }
.campo-error { display: block; color: var(--rojo); font-weight: 600; margin-top: 5px; font-size: 14px; }
fieldset { border: 0; padding: 0; margin: 0 0 10px; }
legend { font-family: var(--display); font-weight: 800; font-size: 18px; margin-bottom: 10px; color: var(--petroleo); }
.fila-2 { display: grid; gap: 0 14px; }
@media (min-width: 640px) { .fila-2 { grid-template-columns: 1fr 1fr; } }
.check { display: flex; gap: 12px; align-items: flex-start; margin: 10px 0 16px; font-size: 15px; cursor: pointer; }
.check input { width: 26px; height: 26px; flex: none; accent-color: var(--oro-osc); margin: 0; }
.sub { color: var(--texto-2); margin-top: 0; }

.alerta { padding: 14px 16px; border-radius: var(--radio-s); margin-bottom: 14px; font-weight: 600; font-size: 15.5px; }
.alerta-error { background: var(--rojo-claro); color: #8A231A; }
.alerta-exito { background: var(--verde-claro); color: #145A33; }
.alerta-info { background: #E3EEF9; color: #1D4F86; }
.alerta-aviso { background: #FBF0D2; color: #6E5410; }

.chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; background: #F1ECE0; font-size: 13px; font-weight: 700; color: var(--texto-2); }
.chip-oro { background: #FBF0D2; color: var(--oro-osc); }
.barra { height: 10px; border-radius: 99px; background: #EEE8DA; overflow: hidden; }
.barra > span { display: block; height: 100%; border-radius: inherit; background: var(--materia); transition: width .4s ease; }
.vacio { text-align: center; padding: 34px 16px; color: var(--texto-2); }
.vacio span { font-size: 54px; display: block; margin-bottom: 6px; }
.cargando { text-align: center; padding: 50px 0; color: var(--texto-2); }

/* ---------------- Acceso ---------------- */
.acceso { display: grid; gap: 22px; align-items: center; min-height: calc(100dvh - 60px); }
@media (min-width: 820px) { .acceso { grid-template-columns: 1.1fr 1fr; gap: 40px; } }
.acceso-hero { text-align: center; padding-top: 10px; }
@media (min-width: 820px) { .acceso-hero { text-align: left; } }
.acceso-hero h1 { font-size: clamp(38px, 8vw, 62px); color: var(--petroleo); margin-top: 12px; }
.acceso-hero h1 span { color: var(--oro-osc); }
.acceso-hero p { font-size: 18px; color: var(--texto-2); max-width: 460px; margin-inline: auto; }
@media (min-width: 820px) { .acceso-hero p { margin-inline: 0; } }
.acceso-logo { filter: drop-shadow(0 8px 16px rgba(11,45,61,.25)); }
.burbujas { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 18px; }
@media (min-width: 820px) { .burbujas { justify-content: flex-start; } }
.burbujas span { display: grid; place-items: center; width: 52px; height: 52px; font-size: 26px; border-radius: 16px; background: #fff; box-shadow: var(--sombra); animation: flotar 3.2s ease-in-out infinite; }
.burbujas span:nth-child(2n) { animation-delay: -1.2s; }
.burbujas span:nth-child(3n) { animation-delay: -2.1s; }
@keyframes flotar { 50% { transform: translateY(-7px) rotate(-3deg); } }
.acceso-form h2 { font-size: 28px; }
.acceso-links { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-top: 16px; font-weight: 700; font-size: 15px; }
.registro { max-width: 680px; margin: 0 auto; }
.registro h1 { font-size: 32px; color: var(--petroleo); }
.volver-link { display: inline-block; margin: 6px 0 14px; font-weight: 700; text-decoration: none; }

.avatar-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 8px; }
.avatar-picker input { position: absolute; opacity: 0; pointer-events: none; }
.avatar-picker span { display: grid; place-items: center; height: 58px; font-size: 32px; border-radius: 16px; background: #F6F1E4; border: 3px solid transparent; cursor: pointer; transition: transform .1s; }
.avatar-picker input:checked + span { border-color: var(--oro); background: #FFF7DF; transform: scale(1.06); }
.avatar-picker input:focus-visible + span { outline: 3px solid var(--petroleo); }

/* ---------------- Inicio ---------------- */
.bienvenida { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 6px 0 18px; }
.bienvenida-saludo { margin: 0; color: var(--texto-2); font-weight: 700; }
.bienvenida h1 { font-size: clamp(32px, 7vw, 46px); margin: 0; color: var(--petroleo); }
.bienvenida-meta { margin: 4px 0 0; color: var(--texto-2); font-size: 15px; }
.ola { display: inline-block; animation: ola 2s ease-in-out 1; transform-origin: 70% 70%; }
@keyframes ola { 20%, 60% { transform: rotate(14deg); } 40%, 80% { transform: rotate(-8deg); } }
.contador-estrellas { display: grid; justify-items: center; padding: 10px 16px; border-radius: 20px; background: var(--petroleo); color: #fff; min-width: 92px; box-shadow: var(--sombra); }
.contador-estrellas .grande { color: var(--oro); font-size: 26px; line-height: 1; }
.contador-estrellas b { font-family: var(--display); font-size: 26px; line-height: 1.1; }
.contador-estrellas small { font-size: 12px; opacity: .8; }

.unirse { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 14px; align-items: center; padding: 16px 18px; border-radius: var(--radio); background: var(--petroleo); color: #fff; margin-bottom: 26px; box-shadow: var(--sombra); }
.unirse-emoji { font-size: 34px; grid-row: span 2; }
.unirse label { font-weight: 700; font-size: 15px; }
.unirse-fila { display: flex; gap: 10px; min-width: 0; }
.unirse-fila .btn { flex: none; padding: 12px 16px; }
.unirse input { flex: 1; min-width: 0; width: 100%; min-height: 52px; padding: 0 14px; border-radius: 14px; border: 0; font-family: var(--display); font-weight: 800; font-size: 22px; letter-spacing: .18em; text-transform: uppercase; color: var(--petroleo); }
.unirse input::placeholder { color: #B9C3C7; }

.seccion-titulo { font-size: 22px; color: var(--petroleo); margin: 26px 0 12px; }
.pagina-titulo { font-size: 30px; color: var(--petroleo); margin: 4px 0 18px; }
.grid-materias { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
@media (min-width: 600px) { .grid-materias { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .grid-materias { grid-template-columns: repeat(4, 1fr); } }
.materia-card {
  position: relative; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px;
  min-height: 150px; padding: 16px; border-radius: var(--radio); overflow: hidden;
  background: var(--c); color: #fff; text-decoration: none;
  box-shadow: 0 6px 0 color-mix(in srgb, var(--c) 65%, #000), var(--sombra);
  transition: transform .1s;
}
.materia-card:active { transform: translateY(4px); box-shadow: 0 2px 0 color-mix(in srgb, var(--c) 65%, #000); }
.materia-card::after { content: ''; position: absolute; right: -30px; top: -30px; width: 120px; height: 120px; border-radius: 50%; background: rgba(255,255,255,.16); }
.materia-icono { position: absolute; top: 14px; left: 14px; font-size: 44px; filter: drop-shadow(0 3px 4px rgba(0,0,0,.2)); }
.materia-nombre { font-family: var(--display); font-weight: 800; font-size: 20px; line-height: 1.1; text-shadow: 0 1px 2px rgba(0,0,0,.18); }
.materia-meta { font-size: 13.5px; font-weight: 700; opacity: .9; }

.lista-recientes { display: grid; gap: 10px; }
@media (min-width: 700px) { .lista-recientes { grid-template-columns: 1fr 1fr; } }
.reciente { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-radius: 18px; background: #fff; color: var(--texto); text-decoration: none; box-shadow: var(--sombra); border-left: 6px solid var(--c); font-weight: 700; min-height: 64px; }
.reciente small { font-weight: 500; color: var(--texto-2); }
.reciente-icono { font-size: 30px; }
.reciente .flecha { margin-left: auto; font-size: 28px; color: var(--texto-2); }

/* ---------------- Materia ---------------- */
.materia-hero { display: flex; align-items: center; gap: 16px; padding: 20px; border-radius: var(--radio); margin-bottom: 18px; background: var(--c); color: #fff; box-shadow: var(--sombra); }
.materia-hero h1 { font-size: 30px; margin: 0; }
.materia-hero p { margin: 4px 0 0; opacity: .92; font-weight: 600; }
.materia-hero-icono { font-size: 56px; }
.lista-practicas { display: grid; gap: 14px; }
@media (min-width: 760px) { .lista-practicas { grid-template-columns: 1fr 1fr; } }
.practica-card { display: grid; grid-template-columns: auto 1fr; gap: 12px 14px; padding: 18px; border-radius: var(--radio); background: #fff; box-shadow: var(--sombra); }
.practica-icono { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 18px; background: color-mix(in srgb, var(--c) 14%, #fff); font-size: 36px; }
.practica-info h3 { font-size: 19px; margin-bottom: 4px; }
.practica-info p { margin: 0 0 8px; color: var(--texto-2); font-size: 15px; }
.practica-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.practica-card .barra > span { background: var(--c); }
.practica-acciones { grid-column: 1 / -1; display: flex; gap: 10px; }
.practica-acciones .btn { flex: 1; }
.practica-card .btn-color { --materia: var(--c); }

/* ---------------- Juego ---------------- */
.juego { max-width: 760px; margin: 0 auto; }
.juego-cabecera { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.juego-cabecera h1 { font-size: 26px; margin: 0; color: var(--petroleo); }
.juego-cabecera p { margin: 2px 0 0; color: var(--texto-2); font-weight: 700; }
.juego-icono { display: grid; place-items: center; width: 70px; height: 70px; flex: none; border-radius: 22px; font-size: 40px; background: #fff; box-shadow: var(--sombra); }

.mapa-niveles { list-style: none; padding: 16px 0 8px; margin: 0; display: grid; gap: 26px; }
.mapa-nodo { display: flex; justify-content: center; }
.nodo-grupo { display: flex; flex-direction: column; align-items: center; gap: 8px; transform: translateX(var(--dx, 0)); }
.mapa-nodo button {
  display: grid; place-items: center; width: 96px; height: 96px; flex: none; border: 0; border-radius: 50%; cursor: pointer;
  background: var(--materia); color: #fff; font-family: var(--display); font-weight: 800; font-size: 38px;
  box-shadow: 0 7px 0 color-mix(in srgb, var(--materia) 65%, #000), 0 0 0 6px #fff, var(--sombra);
  touch-action: manipulation;
}
.mapa-nodo button:active { transform: translateY(5px); box-shadow: 0 2px 0 color-mix(in srgb, var(--materia) 65%, #000), 0 0 0 6px #fff; }
.mapa-nodo.hecho button { background: var(--oro); color: var(--petroleo); box-shadow: 0 7px 0 var(--oro-osc), 0 0 0 6px #fff, var(--sombra); }
.mapa-nodo.actual button { animation: latido 1.6s ease-in-out infinite; }
@keyframes latido { 50% { transform: scale(1.07); } }
.mapa-nodo.bloqueado button { background: #D8D2C3; color: #8C8576; box-shadow: 0 7px 0 #B8B1A1, 0 0 0 6px #fff; cursor: not-allowed; font-size: 32px; }
.mapa-info { display: grid; justify-items: center; gap: 2px; background: #fff; padding: 6px 14px; border-radius: 14px; box-shadow: var(--sombra); font-size: 15px; max-width: 200px; text-align: center; }
.mapa-nodo.actual .mapa-info { box-shadow: 0 0 0 3px var(--materia), var(--sombra); }
@media (max-width: 420px) { .mapa-nodo button { width: 84px; height: 84px; font-size: 32px; } }

.estrellas { display: inline-flex; gap: 2px; }
.estrella { color: #DCD5C3; font-size: 18px; line-height: 1; }
.estrella.on { color: var(--oro); text-shadow: 0 1px 0 var(--oro-osc); }
.estrellas.grandes .estrella { font-size: 58px; }
.estrellas.animar .estrella.on { animation: estrella .5s cubic-bezier(.3,1.6,.5,1) both; }
.estrellas.animar .estrella:nth-child(2) { animation-delay: .25s; }
.estrellas.animar .estrella:nth-child(3) { animation-delay: .5s; }
@keyframes estrella { from { transform: scale(0) rotate(-90deg); } }

.nivel-titulo { text-align: center; color: var(--petroleo); font-size: 22px; margin: 0 0 10px; }
.nivel-cabeza { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.nivel-cabeza .barra { flex: 1; height: 16px; }
.btn-cerrar { width: 44px; height: 44px; flex: none; border: 0; border-radius: 50%; background: #fff; font-size: 20px; font-weight: 800; color: var(--texto-2); box-shadow: var(--sombra); cursor: pointer; }
.contador { font-weight: 800; color: var(--texto-2); min-width: 48px; text-align: right; font-size: 15px; }
.barra-tiempo > span { background: var(--verde); transition: width .1s linear; }
.barra-tiempo.urgente > span { background: var(--rojo); }

.zona-pregunta { background: #fff; border-radius: var(--radio); padding: 22px 18px; box-shadow: var(--sombra); }
.pregunta-media { display: grid; place-items: center; margin-bottom: 14px; }
.pregunta-media.emoji { font-size: clamp(64px, 16vw, 110px); line-height: 1.1; }
.pregunta-media img { max-height: 220px; border-radius: 16px; object-fit: contain; }
.pregunta-cabeza { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.pregunta-texto { flex: 1; font-family: var(--display); font-weight: 800; font-size: clamp(22px, 5vw, 30px); line-height: 1.2; color: var(--petroleo); }
.btn-voz { flex: none; width: 52px; height: 52px; border: 0; border-radius: 50%; background: #F2EAD3; font-size: 24px; cursor: pointer; }
.btn-voz:active { transform: scale(.94); }

.opciones { display: grid; gap: 12px; }
@media (min-width: 560px) { .opciones { grid-template-columns: 1fr 1fr; } }
.opcion {
  display: flex; align-items: center; gap: 12px; min-height: 68px; padding: 12px 16px; text-align: left;
  border: 3px solid var(--linea); border-radius: 18px; background: #FDFBF6; cursor: pointer;
  font-size: 19px; font-weight: 700; box-shadow: 0 4px 0 var(--linea);
  transition: transform .08s, background .15s, border-color .15s; touch-action: manipulation;
}
.opcion:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--linea); }
.opcion-letra { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 10px; background: #fff; border: 2px solid var(--linea); font-family: var(--display); font-weight: 800; font-size: 16px; color: var(--texto-2); }
.opcion.elegida { border-color: var(--azul); background: #E8F1FD; }
.opcion.correcta { border-color: var(--verde); background: var(--verde-claro); box-shadow: 0 4px 0 #9ED9B6; animation: rebote .4s; }
.opcion.correcta .opcion-letra { background: var(--verde); border-color: var(--verde); color: #fff; }
.opcion.incorrecta { border-color: var(--rojo); background: var(--rojo-claro); box-shadow: 0 4px 0 #F0B3AC; animation: sacudir .4s; }
.opcion:disabled { cursor: default; }
.opciones-vf { grid-template-columns: 1fr 1fr; }
.opcion-vf { flex-direction: column; justify-content: center; min-height: 130px; font-size: 21px; text-align: center; }
.vf-emoji { font-size: 48px; }
@keyframes rebote { 40% { transform: scale(1.04); } }
@keyframes sacudir { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }
.sacudir { animation: sacudir .4s; border-color: var(--rojo) !important; }

.hueco { display: inline-block; min-width: 90px; padding: 0 8px; margin: 0 4px; border-bottom: 4px solid var(--oro); color: var(--azul); text-align: center; }
.hueco.correcta { color: var(--verde); border-color: var(--verde); }
.hueco.incorrecta { color: var(--rojo); border-color: var(--rojo); text-decoration: line-through; }
.fila-respuesta { display: grid; gap: 12px; }
@media (min-width: 560px) { .fila-respuesta { grid-template-columns: 1fr auto; } .fila-respuesta .btn-grande { width: auto; } }
.campo-respuesta { width: 100%; min-width: 0; min-height: 60px; padding: 0 18px; border: 3px solid var(--linea); border-radius: 16px; font-size: 22px; font-weight: 700; background: #FDFBF6; }
.campo-respuesta:focus { outline: none; border-color: var(--oro); }
.pista { color: var(--texto-2); margin: -6px 0 14px; font-weight: 600; }
.banco-palabras { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.palabra, .ficha, .ficha-par {
  min-height: 54px; padding: 10px 18px; border: 3px solid var(--linea); border-radius: 14px;
  background: #fff; font-weight: 800; font-size: 19px; cursor: pointer; box-shadow: 0 4px 0 var(--linea); touch-action: manipulation;
}
.palabra:active, .ficha:active, .ficha-par:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--linea); }
.respuesta-correcta { margin: 14px 0 0; padding: 12px 14px; border-radius: 14px; background: #FBF0D2; font-weight: 600; }

.ordenar-respuesta { display: flex; flex-wrap: wrap; gap: 10px; min-height: 80px; padding: 12px; margin-bottom: 16px; border: 3px dashed var(--linea); border-radius: 18px; background: #FBF8F0; align-content: flex-start; }
.ordenar-respuesta:empty::before { content: 'Toca las fichas en orden'; color: #A9A190; font-weight: 600; align-self: center; margin: auto; }
.ordenar-respuesta .ficha { border-color: var(--azul); background: #E8F1FD; }
.ordenar-respuesta.correcta { border-color: var(--verde); background: var(--verde-claro); }
.ordenar-respuesta.incorrecta { border-color: var(--rojo); background: var(--rojo-claro); }
.ordenar-banco { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; min-height: 58px; }

.emparejar { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.col-emparejar { display: grid; gap: 10px; align-content: start; }
.ficha-par { width: 100%; min-height: 64px; }
.ficha-par.sel { border-color: var(--azul); background: #E8F1FD; transform: scale(1.03); }
.ficha-par.hecho { border-color: transparent; box-shadow: none; color: var(--petroleo); }

.memoria { display: grid; grid-template-columns: repeat(var(--cols, 4), 1fr); gap: 10px; perspective: 900px; }
.carta { position: relative; aspect-ratio: 3 / 4; border: 0; padding: 0; background: none; cursor: pointer; transform-style: preserve-3d; transition: transform .35s; touch-action: manipulation; }
.carta.volteada { transform: rotateY(180deg); }
.carta-cara { position: absolute; inset: 0; display: grid; place-items: center; padding: 6px; border-radius: 16px; backface-visibility: hidden; -webkit-backface-visibility: hidden; font-weight: 800; font-size: clamp(22px, 6vw, 40px); text-align: center; line-height: 1.1; overflow-wrap: anywhere; }
.carta-cara.texto-largo { font-size: clamp(14px, 3.4vw, 20px); }
.carta-dorso { background: var(--petroleo); color: var(--oro); font-family: var(--display); box-shadow: 0 4px 0 #061A24; background-image: radial-gradient(circle at 1px 1px, rgba(201,168,76,.3) 1.5px, transparent 0); background-size: 14px 14px; }
.carta-frente { background: #fff; border: 3px solid var(--linea); transform: rotateY(180deg); color: var(--petroleo); }
.carta.pareja .carta-frente { background: var(--verde-claro); border-color: var(--verde); }

.feedback { position: sticky; bottom: calc(10px + var(--safe-b)); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 18px; padding: 14px 16px; border-radius: 18px; font-weight: 800; font-size: 20px; animation: subir .25s ease-out; z-index: 5; }
.feedback.bien { background: var(--verde-claro); color: #145A33; }
.feedback.mal { background: var(--rojo-claro); color: #8A231A; }
@keyframes subir { from { transform: translateY(20px); opacity: 0; } }

.resultado { text-align: center; padding: 26px 18px; background: #fff; border-radius: var(--radio); box-shadow: var(--sombra); }
.resultado-emoji { font-size: 76px; animation: rebote .6s; }
.resultado h1 { font-size: 34px; color: var(--petroleo); }
.resultado-detalle { font-weight: 700; color: var(--texto-2); font-size: 18px; }
.resultado-estado { font-weight: 700; color: var(--oro-osc); min-height: 1.4em; }
.resultado-botones { display: grid; gap: 12px; margin-top: 18px; }
@media (min-width: 560px) { .resultado-botones { grid-template-columns: 1fr 1fr; } .resultado-botones .btn-grande { grid-column: 1 / -1; } }

.confeti { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.confeti i { position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 3px; animation: caer linear forwards; }
@keyframes caer { to { transform: translateY(110vh) rotate(720deg); } }

/* ---------------- Multijugador ---------------- */
.sala-codigo { text-align: center; }
.sala-codigo p { margin: 0 0 6px; color: var(--texto-2); font-weight: 700; }
.codigo-grande { font-family: var(--display); font-weight: 800; font-size: clamp(44px, 13vw, 72px); letter-spacing: .14em; color: var(--petroleo); margin-bottom: 12px; user-select: all; }
.jugadores { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 8px; }
@media (min-width: 640px) { .jugadores:not(.revelar):not(.final) { grid-template-columns: 1fr 1fr; } }
.jugadores li { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 16px; background: #fff; box-shadow: var(--sombra); font-weight: 700; animation: subir .25s; }
.jugadores li.desconectado { opacity: .5; }
.jugadores li.ok { box-shadow: inset 4px 0 0 var(--verde), var(--sombra); }
.jugadores li.no { box-shadow: inset 4px 0 0 var(--rojo), var(--sombra); }
.jugadores .nombre { flex: 1; }
.jugadores .puntos { font-weight: 800; color: var(--oro-osc); }
.jugadores .total { font-family: var(--display); font-weight: 800; min-width: 54px; text-align: right; }
.jugadores .pos { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--petroleo); color: #fff; font-size: 14px; }
.jugadores.progreso { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)) !important; margin-top: 16px; }
.jugadores.progreso li { padding: 6px 10px; }
.sala-acciones { display: grid; gap: 10px; justify-items: center; }
.esperando { text-align: center; color: var(--texto-2); font-weight: 700; margin: 14px 0; }
.puntitos::after { content: '…'; display: inline-block; width: 1em; animation: puntos 1.2s steps(4) infinite; overflow: hidden; vertical-align: bottom; margin-right: 6px; }
@keyframes puntos { from { width: 0; } to { width: 1.1em; } }
.podio { display: flex; align-items: flex-end; justify-content: center; gap: 10px; margin: 16px 0 22px; }
.podio-lugar { display: grid; justify-items: center; gap: 4px; width: 30%; max-width: 150px; font-size: 14px; }
.podio-lugar .avatar { width: 56px; height: 56px; font-size: 32px; }
.podio-base { display: grid; place-items: center; width: 100%; border-radius: 14px 14px 4px 4px; background: var(--petroleo); font-size: 34px; }
.lugar-1 .podio-base { height: 120px; background: var(--oro); }
.lugar-2 .podio-base { height: 90px; }
.lugar-3 .podio-base { height: 66px; background: var(--petroleo-2); }
.crear-sala-cabeza { display: flex; gap: 14px; align-items: center; }
.crear-sala-cabeza h2 { margin: 0; }
.crear-sala-cabeza p { margin: 2px 0 0; color: var(--texto-2); }
.selector-nivel { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-bottom: 16px; }
.selector-nivel input { position: absolute; opacity: 0; }
.selector-nivel span { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 14px; border: 3px solid var(--linea); cursor: pointer; font-weight: 700; min-height: 56px; }
.selector-nivel b { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--c); color: #fff; flex: none; }
.selector-nivel input:checked + span { border-color: var(--oro); background: #FFF7DF; }

/* ---------------- Perfil ---------------- */
.perfil-cabeza { display: flex; align-items: center; gap: 20px; margin: 10px 0 8px; }
.perfil-cabeza h1 { font-size: 28px; margin: 0; color: var(--petroleo); }
.perfil-cabeza p { margin: 4px 0 0; color: var(--texto-2); }
.grid-logros { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.logro { display: grid; gap: 2px; padding: 16px; border-radius: 18px; background: #fff; box-shadow: var(--sombra); border-top: 6px solid var(--c); }
.logro-icono { font-size: 32px; }
.logro-estrellas { font-family: var(--display); font-weight: 800; color: var(--oro-osc); font-size: 22px; }
.logro small { color: var(--texto-2); }
.plegable summary { cursor: pointer; font-weight: 800; font-size: 17px; min-height: 30px; list-style: none; }
.plegable summary::-webkit-details-marker { display: none; }
.plegable summary::after { content: '›'; float: right; font-size: 24px; line-height: 1; transition: transform .2s; }
.plegable[open] summary::after { transform: rotate(90deg); }
.plegable[open] summary { margin-bottom: 14px; }
.bitacora { list-style: none; padding: 0; margin: 0 0 12px; font-size: 14.5px; }
.bitacora li { display: flex; flex-direction: column; padding: 8px 0; border-bottom: 1px solid var(--linea); }
.bitacora small { color: var(--texto-2); }

/* ---------------- Modal / estado de red ---------------- */
.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px; background: rgba(11,45,61,.65); backdrop-filter: blur(4px); }
.modal-caja { max-width: 400px; width: 100%; text-align: center; background: #fff; border-radius: var(--radio); padding: 28px 22px; box-shadow: var(--sombra); }
.modal-emoji { font-size: 60px; }
.sin-red { position: fixed; left: 12px; right: 12px; top: calc(70px + var(--safe-t)); z-index: 70; padding: 12px 16px; border-radius: 14px; background: var(--petroleo); color: #fff; font-weight: 700; font-size: 14.5px; text-align: center; box-shadow: var(--sombra); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (min-width: 900px) and (orientation: landscape) {
  .zona-pregunta { padding: 28px; }
}

/* ---------------- Registro con hermanos y pago ---------------- */
.check-destacado { padding: 14px 16px; border-radius: 16px; background: #FFF7DF; border: 2px solid var(--oro-2); margin: 18px 0 12px; }
.bloque-estudiante { padding: 0; }
.bloque-estudiante[data-oculto] { display: none; }
#bloque-hermanos .bloque-estudiante { padding: 16px; margin-bottom: 14px; border-radius: 18px; background: #FBF8F0; border: 2px dashed var(--linea); }
.hermano-titulo { font-size: 18px; color: var(--petroleo); margin-bottom: 10px; }
.avatar-picker-mini { grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); }
.avatar-picker-mini span { height: 46px; font-size: 24px; border-radius: 12px; }
.datos-pago { display: grid; gap: 10px; margin: 4px 0 16px; padding: 16px; border-radius: 18px; background: var(--petroleo); color: #fff; }
.pago-total { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; padding-bottom: 10px; border-bottom: 1px solid rgba(255,255,255,.15); }
.pago-total span { opacity: .8; font-weight: 600; }
.pago-total b { font-family: var(--display); font-size: 30px; color: var(--oro); }
.pago-total small { opacity: .8; }
.pago-metodo { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 14px; background: rgba(255,255,255,.08); font-size: 15.5px; line-height: 1.5; }
.pago-icono { font-size: 28px; }
.copiable { font-family: var(--display); font-size: 22px; font-weight: 800; color: var(--oro-2); cursor: copy; }
.copiable.copiado::after { content: ' ✓ copiado'; font-family: var(--cuerpo); font-size: 13px; color: #fff; }
.pago-instrucciones { margin: 0; font-size: 14.5px; opacity: .9; }
.metodos-pago { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.metodos-pago input { position: absolute; opacity: 0; }
.metodos-pago span { display: grid; place-items: center; min-height: 58px; border-radius: 14px; border: 3px solid var(--linea); font-weight: 800; cursor: pointer; background: #fff; }
.metodos-pago input:checked + span { border-color: var(--oro); background: #FFF7DF; }
.metodos-pago input:focus-visible + span { outline: 3px solid var(--petroleo); }
.subir-archivo { position: relative; }
.subir-archivo input[type=file] { position: absolute; inset: auto 0 0 0; height: 100%; opacity: 0; cursor: pointer; z-index: 2; }
.subir-caja { display: flex; align-items: center; gap: 12px; min-height: 84px; padding: 14px 18px; border: 3px dashed var(--oro); border-radius: 18px; background: #FFFBEF; font-weight: 700; color: var(--petroleo-2); }
.subir-icono { font-size: 32px; }
.subir-archivo.con-archivo .subir-caja { border-style: solid; border-color: var(--verde); background: var(--verde-claro); color: #145A33; }
.estado-cuenta { display: flex; gap: 14px; align-items: flex-start; padding: 16px; border-radius: 16px; margin: 10px 0; }
.estado-cuenta > span { font-size: 36px; }
.estado-cuenta.pendiente { background: #FBF0D2; color: #6E5410; }
.estado-cuenta.rechazada { background: var(--rojo-claro); color: #8A231A; }
.lista-simple { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.lista-simple li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.lista-simple small { color: var(--texto-2); }
.elegir { text-align: center; max-width: 720px; }
.elegir h1 { font-size: 34px; color: var(--petroleo); margin-top: 20px; }
.grid-elegir { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; margin: 24px 0; }
.estudiante-card { width: 100%; display: grid; justify-items: center; gap: 8px; padding: 26px 14px; border: 0; border-radius: var(--radio); background: #fff; box-shadow: 0 6px 0 var(--linea), var(--sombra); cursor: pointer; font-size: 19px; }
.estudiante-card:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--linea); }
.estudiante-card small { color: var(--texto-2); font-size: 14px; }
.estudiante-card.en-uso { opacity: .75; }

/* Radios ocultos de selectores visuales: nunca deben ensanchar la página */
.avatar-picker label, .metodos-pago label, .selector-nivel label { position: relative; }
.avatar-picker input, .metodos-pago input, .selector-nivel input { position: absolute; width: 1px; height: 1px; opacity: 0; margin: 0; pointer-events: none; }
html, body { overflow-x: hidden; }
.datos-pago { overflow-wrap: anywhere; }
.estado-cuenta.inactiva { background: #E3EEF9; color: #1D4F86; }
.enlaces-registro { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px 16px; }

/* Centro educativo: logo y lugar */
.centro-chip { display: inline-flex; align-items: center; gap: 10px; margin-top: 8px; padding: 6px 14px 6px 6px; border-radius: 16px; background: #fff; box-shadow: var(--sombra); max-width: 100%; }
.centro-chip img, .centro-chip > span:first-child { width: 34px; height: 34px; flex: none; object-fit: contain; border-radius: 8px; display: grid; place-items: center; font-size: 22px; }
.centro-chip > span:last-child { display: grid; line-height: 1.2; min-width: 0; font-size: 14.5px; }
.centro-chip b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.centro-chip small { color: var(--texto-2); font-size: 12.5px; }
.estado-cuenta.activa { background: var(--verde-claro); color: #145A33; }
.enlace-tarjeta { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--texto); font-size: 26px; }
.enlace-tarjeta span:not(.flecha) { display: grid; font-size: 17px; }
.enlace-tarjeta small { color: var(--texto-2); font-size: 14px; }
.enlace-tarjeta .flecha { margin-left: auto; color: var(--texto-2); }

/* ---------------- Selector de voz ---------------- */
.voz-botones { display: flex; flex-direction: column; gap: 6px; flex: none; }
.btn-voz-config { width: 52px; height: 40px; border: 0; border-radius: 14px; background: #EEF2F4; font-size: 20px; cursor: pointer; }
.btn-voz-config:active { transform: scale(.94); }
.juego-cabecera .btn-voz-mapa { margin-left: auto; min-height: 46px; padding: 8px 14px; font-size: 15px; flex: none; }
.voz-caja { max-width: 460px; text-align: left; max-height: calc(100dvh - 40px); overflow-y: auto; }
.voz-caja h2 { text-align: center; color: var(--petroleo); }
.voz-caja .sub { text-align: center; }
.voces-lista { display: grid; gap: 8px; margin: 14px 0; }
.voz-opcion { display: flex; gap: 8px; align-items: stretch; }
.voz-elegir { flex: 1; display: flex; align-items: center; gap: 12px; min-height: 62px; padding: 10px 14px; border: 3px solid var(--linea); border-radius: 16px; background: #fff; text-align: left; cursor: pointer; min-width: 0; }
.voz-opcion.sel .voz-elegir { border-color: var(--oro); background: #FFF7DF; }
.voz-num { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 50%; background: var(--petroleo); color: #fff; font-weight: 800; }
.voz-texto { display: grid; min-width: 0; }
.voz-texto b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voz-texto small { color: var(--texto-2); font-size: 13px; }
.voz-check { margin-left: auto; color: var(--oro-osc); font-size: 22px; font-weight: 800; }
.voz-probar { width: 56px; flex: none; border: 0; border-radius: 16px; background: var(--petroleo); color: var(--oro); font-size: 20px; cursor: pointer; }
.voz-etiqueta { font-weight: 800; margin: 6px 0 8px; }
.voz-velocidad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 18px; }
.voz-velocidad button { min-height: 50px; border: 3px solid var(--linea); border-radius: 14px; background: #fff; font-weight: 800; cursor: pointer; }
.voz-velocidad button.sel { border-color: var(--oro); background: #FFF7DF; }

/* ---------------- Ver contraseña y errores de formulario ---------------- */
.pass-wrap { position: relative; display: block; }
.pass-wrap input { width: 100%; padding-right: 96px !important; }
.pass-ojo { position: absolute; top: 50%; right: 6px; transform: translateY(-50%); display: inline-flex; align-items: center; gap: 4px; height: 42px; padding: 0 10px; border: 0; border-radius: 10px; background: #F1ECE0; color: var(--petroleo-2); font-weight: 700; font-size: 14px; cursor: pointer; }
.pass-ojo .tachado { display: none; }
.pass-ojo.visible { background: var(--petroleo); color: #fff; }
.pass-ojo.visible .tachado { display: inline; }
.fila-mini .pass-wrap { flex: 1; min-width: 0; }
.fila-mini .pass-wrap input { padding-right: 86px !important; }
.fila-mini .pass-ojo { height: 32px; }
.req { color: var(--rojo); }
.campo input.con-error, .campo select.con-error, .campo-respuesta.con-error { border-color: var(--rojo) !important; background: #FFF6F5 !important; box-shadow: 0 0 0 3px rgba(217,71,59,.15); }
.subir-archivo:has(.con-error) .subir-caja { border-color: var(--rojo); background: #FFF6F5; }
.check:has(.con-error) { outline: 2px solid var(--rojo); outline-offset: 4px; border-radius: 8px; }
.campo-error { display: block; color: #B23A2E; font-weight: 700; margin-top: 6px; font-size: 14.5px; }
.check .campo-error { flex-basis: 100%; }
.check { flex-wrap: wrap; }
.resumen-errores ul { margin: 8px 0 0; padding-left: 20px; }
.resumen-errores li { margin: 4px 0; }
.resumen-errores a { color: #8A231A; font-weight: 600; }
.coincide { display: block; margin-top: 6px; font-weight: 700; font-size: 14.5px; min-height: 1.2em; }
.coincide.ok { color: var(--verde); }
.coincide.no { color: #B23A2E; }
.check > span { flex: 1 1 0; min-width: 0; }
