/* =========================================================================
   AJEDREZ · estilos
   Colores en variables (:root). Modo oscuro: automático según el aparato,
   o a mano con data-theme="claro" / "oscuro" en <html>.
   ========================================================================= */
:root {
  --bg: #f4efe6; --sup: #fffaf2; --sup2: #efe6d8; --linea: #e0d4c2;
  --txt: #2a2118; --suave: #76685a; --acento: #1883b8; --acento-txt: #fff; --acento-suave: #d7eefa;
  --peligro: #c2412d; --ok: #2f8a4a; --sombra: 0 6px 20px rgba(60, 40, 20, .12);
  --clara: #f0d9b5; --oscura: #b58863; --c-clara: #b58863; --c-oscura: #f0d9b5;
  --ultima: rgba(255, 210, 40, .5); --elegida: rgba(30, 120, 200, .55); --punto: rgba(20, 30, 50, .3);
  --r: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="claro"]) {
    --bg: #141824; --sup: #1e2433; --sup2: #272f42; --linea: #343e55;
    --txt: #eef1f7; --suave: #9aa3b8; --acento: #3ec5ff; --acento-txt: #07131c; --acento-suave: #18364a;
    --peligro: #ff7a63; --ok: #5fd38a; --sombra: 0 6px 24px rgba(0, 0, 0, .35);
    --clara: #dfe3ea; --oscura: #7d8aa3; --c-clara: #6b7894; --c-oscura: #eef1f6;
    --ultima: rgba(255, 210, 40, .45); --elegida: rgba(62, 197, 255, .6); --punto: rgba(10, 15, 30, .35);
    color-scheme: dark;
  }
}
:root[data-theme="oscuro"] {
  --bg: #141824; --sup: #1e2433; --sup2: #272f42; --linea: #343e55;
  --txt: #eef1f7; --suave: #9aa3b8; --acento: #3ec5ff; --acento-txt: #07131c; --acento-suave: #18364a;
  --peligro: #ff7a63; --ok: #5fd38a; --sombra: 0 6px 24px rgba(0, 0, 0, .35);
  --clara: #dfe3ea; --oscura: #7d8aa3; --c-clara: #6b7894; --c-oscura: #eef1f6;
  --ultima: rgba(255, 210, 40, .45); --elegida: rgba(62, 197, 255, .6); --punto: rgba(10, 15, 30, .35);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--txt); }
body {
  font: 17px/1.45 ui-rounded, "SF Pro Rounded", "Nunito", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent; min-height: 100dvh;
}
button, input { font: inherit; color: inherit; }
img { display: block; }
a { color: var(--acento); }
:focus-visible { outline: 3px solid var(--acento); outline-offset: 2px; }
[hidden] { display: none !important; }
#app { max-width: 1100px; margin: 0 auto; padding: 0 16px 24px; }

/* ---------- botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer; border-radius: 12px;
  padding: 12px 20px; font-weight: 700; background: var(--sup2); text-decoration: none; color: var(--txt); min-height: 46px; }
.btn.pri { background: var(--acento); color: var(--acento-txt); box-shadow: 0 4px 0 color-mix(in srgb, var(--acento) 60%, #000); }
.btn.pri:active { transform: translateY(3px); box-shadow: 0 1px 0 color-mix(in srgb, var(--acento) 60%, #000); }
.btn.pel { background: var(--peligro); color: #fff; }
.btn.ghost { background: transparent; box-shadow: inset 0 0 0 2px var(--linea); }
.btn.peq { padding: 8px 14px; min-height: 40px; font-size: 15px; }
.btn.grande { width: 100%; font-size: 20px; padding: 16px; margin-top: 8px; }
.enlace { background: none; border: 0; padding: 0; color: var(--acento); text-decoration: underline; cursor: pointer; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 2px solid var(--linea); background: var(--sup); border-radius: 999px;
  padding: 8px 14px; cursor: pointer; font-weight: 600; min-height: 42px; }
.chip img { width: 24px; height: 24px; }
.chip.on { border-color: var(--acento); background: var(--acento-suave); }

/* ---------- menú ---------- */
.cab { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0; }
.cab .tit { margin: 0; font-size: 22px; text-align: center; }
.portada { text-align: center; padding: 6px 0 14px; }
.logo { display: flex; justify-content: center; gap: 0; }
.logo img { width: 86px; height: 86px; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .18)); }
.logo img + img { margin-left: -18px; transform: rotate(8deg); }
.portada h1 { margin: 4px 0 0; font-size: clamp(34px, 7vw, 52px); letter-spacing: .01em; }
.firma { margin: 0; color: var(--suave); }
.firma b { color: #1aa6e0; }
.menu { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.tarjeta { display: flex; align-items: center; gap: 14px; text-align: left; border: 0; cursor: pointer; padding: 16px 18px;
  border-radius: var(--r); background: var(--sup); box-shadow: var(--sombra); width: 100%; transition: transform .15s; }
.tarjeta:hover { transform: translateY(-2px); }
.tarjeta .ico { font-size: 34px; line-height: 1; }
.tarjeta b { display: block; font-size: 18px; }
.tarjeta small { display: block; color: var(--suave); font-size: 14px; }
.tarjeta.pronto { opacity: .62; }
.tarjeta.pronto small { font-weight: 700; color: var(--acento); }
.tarjeta.seguir { margin-bottom: 12px; background: var(--acento-suave); box-shadow: inset 0 0 0 2px var(--acento), var(--sombra); }
.centro { text-align: center; margin: 16px 0 0; }
.pie { text-align: center; color: var(--suave); font-size: 14px; margin-top: 26px; }

/* ---------- formulario de 2 jugadores ---------- */
.formu { display: grid; gap: 14px; max-width: 680px; margin: 0 auto; }
.caja { background: var(--sup); border-radius: var(--r); padding: 16px; box-shadow: var(--sombra); }
.caja h2 { margin: 0 0 10px; font-size: 19px; }
.caja h2 small { font-weight: 500; color: var(--suave); font-size: 14px; }
.caja h3 { margin: 14px 0 8px; font-size: 16px; }
.nota { margin: 8px 0 0; color: var(--suave); font-size: 14px; }
.jugs { display: grid; gap: 8px; }
.jug { display: grid; grid-template-columns: 36px 70px 1fr; align-items: center; gap: 8px; }
.jug img { width: 36px; height: 36px; }
.jug span { font-weight: 700; }
.jug input, .num input { border: 2px solid var(--linea); background: var(--bg); border-radius: 10px; padding: 10px 12px; width: 100%; min-width: 0; }
.jugs .btn { justify-self: start; margin-left: 44px; }
.fila-num { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.num { display: inline-flex; align-items: center; gap: 6px; color: var(--suave); }
.num input { width: 78px; text-align: center; color: var(--txt); }
.et { font-weight: 700; min-width: 70px; }
.sinpz { display: grid; grid-template-columns: 70px 1fr; gap: 8px; align-items: start; margin-top: 8px; }
.sinpz .et { padding-top: 10px; }
.check { display: flex; gap: 10px; align-items: center; margin-top: 12px; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--acento); }

/* ---------- pantalla de juego ---------- */
#app.p-juego, #app.p-revisar { padding-bottom: 0; }
.juego { display: grid; height: 100dvh; padding-bottom: max(8px, env(safe-area-inset-bottom));
  grid-template-rows: auto auto auto auto auto; grid-template-columns: minmax(0, 1fr); align-content: center;
  grid-template-areas: "cab" "top" "tab" "bot" "lado"; gap: 6px; }
.p-juego .jcab, .p-revisar .jcab { position: relative; }
.jcab { grid-area: cab; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: max(8px, env(safe-area-inset-top)); }
.turno { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 16px; text-align: center; min-height: 40px; flex-wrap: wrap; }
.turno img { width: 26px; height: 26px; }
.turno small { color: var(--suave); }
.turno .jaq { background: var(--peligro); color: #fff; font-weight: 800; padding: 2px 10px; border-radius: 999px; animation: late .6s ease 2; }
.turno.fin { font-size: 18px; }
.turno .recl { font-size: 13px; font-weight: 700; color: var(--acento); }
.jb.destaca { box-shadow: inset 0 0 0 3px var(--acento), var(--sombra); background: var(--acento-suave); }
@keyframes late { 50% { transform: scale(1.15); } }
#barTop { grid-area: top; } #barBot { grid-area: bot; }
.jtab { grid-area: tab; display: flex; align-items: center; justify-content: center; min-height: 0; min-width: 0; }
.jlado { grid-area: lado; display: grid; gap: 6px; min-width: 0; }

.jbarra { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 12px; background: var(--sup); min-height: 50px;
  box-shadow: inset 0 0 0 2px transparent; transition: box-shadow .2s, background .2s; min-width: 0; }
.jbarra.activo { box-shadow: inset 0 0 0 3px var(--acento); background: var(--acento-suave); }
.jbarra.boca-abajo { transform: rotate(180deg); }
.jbarra .rey { width: 32px; height: 32px; flex: none; }
.jbarra .nom { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40%; }
.caps { display: flex; align-items: center; flex: 1; min-width: 0; overflow: hidden; }
.caps img { width: 20px; height: 20px; margin-right: -6px; }
.caps .mat { margin-left: 10px; font-size: 14px; color: var(--suave); }
.crono { font: 800 22px/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace; padding: 8px 10px; border-radius: 10px; background: var(--sup2); min-width: 86px; text-align: center; font-variant-numeric: tabular-nums; }
.crono.corre { background: var(--txt); color: var(--bg); }
.crono.poco { background: var(--peligro); color: #fff; }

.jugadas { display: flex; gap: 4px; align-items: center; overflow-x: auto; white-space: nowrap; background: var(--sup); border-radius: 12px;
  padding: 6px 10px; min-height: 40px; scrollbar-width: thin; font-size: 15px; }
.jugadas .n { color: var(--suave); margin-left: 6px; }
.jugadas .j { padding: 2px 6px; border-radius: 6px; font-weight: 600; }
.jugadas .j.ult { background: var(--acento-suave); box-shadow: inset 0 0 0 2px var(--acento); }
.jugadas.clic .j { cursor: pointer; }
.jugadas .vacio { color: var(--suave); }
.jbotones { display: flex; gap: 6px; }
.jb { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; border: 0; cursor: pointer; background: var(--sup);
  border-radius: 12px; padding: 6px 4px; font-size: 13px; font-weight: 700; min-height: 54px; min-width: 0; box-shadow: var(--sombra); }
.jb span { font-size: 22px; line-height: 1.1; }
.jb:disabled { opacity: .4; cursor: default; }
.jb:active:not(:disabled) { transform: translateY(2px); }
.nav { align-items: center; }
.nav .jb span { font-size: 24px; }
.cuenta { min-width: 70px; text-align: center; font-weight: 700; color: var(--suave); }

/* horizontal (tablet tumbada, ordenador, móvil tumbado): tablero a la izquierda */
@media (min-aspect-ratio: 5/4) {
  .juego { grid-template-columns: minmax(0, 1fr) minmax(250px, 340px); grid-template-rows: auto auto minmax(0, 1fr) auto;
    grid-template-areas: "tab cab" "tab top" "tab lado" "tab bot"; column-gap: 16px; padding-top: 8px; align-content: stretch; }
  .jcab { padding-top: 0; }
  .jlado { grid-template-rows: minmax(0, 1fr) auto; min-height: 0; }
  .jugadas { display: grid; grid-template-columns: auto 1fr 1fr; align-content: start; white-space: normal; overflow-y: auto; overflow-x: hidden; }
  .jugadas .n { margin-left: 0; }
  .jbotones { flex-wrap: wrap; }
  .jb { flex: 1 1 30%; }
  .jtab { position: relative; padding: 0; }
  .jtab #tab { position: absolute; inset: 0; margin: auto; }
}
@media (min-aspect-ratio: 5/4) and (max-height: 500px) {
  .jbarra { min-height: 40px; padding: 4px 8px; }
  .jbarra .rey { width: 26px; height: 26px; }
  .crono { font-size: 18px; padding: 5px 8px; min-width: 70px; }
  .jb { min-height: 44px; font-size: 12px; } .jb span { font-size: 18px; }
  .turno { font-size: 14px; min-height: 32px; }
  .btn.peq { min-height: 34px; padding: 4px 10px; }
}
@media (max-width: 380px) { .jb { font-size: 11px; } .crono { min-width: 72px; font-size: 19px; } }

/* ---------- tablero ---------- */
.tablero { position: relative; touch-action: none; user-select: none; -webkit-user-select: none; border-radius: 6px; overflow: hidden;
  box-shadow: 0 8px 26px rgba(0, 0, 0, .22); width: 320px; height: 320px; container-type: inline-size; }
.casillas { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr); }
.casilla { position: relative; }
.casilla.clara { background: var(--clara); } .casilla.oscura { background: var(--oscura); }
.casilla.ultima { background-image: linear-gradient(var(--ultima), var(--ultima)); }
.casilla.elegida { background-image: linear-gradient(var(--elegida), var(--elegida)); }
.casilla.jaque { background-image: radial-gradient(circle, rgba(255, 30, 30, .95) 0%, rgba(230, 20, 20, .6) 35%, rgba(200, 0, 0, 0) 72%); }
.casilla.puede::after { content: ""; position: absolute; inset: 35%; border-radius: 50%; background: var(--punto); }
.casilla.come::after { content: ""; position: absolute; inset: 3%; border-radius: 50%; box-shadow: inset 0 0 0 calc(1.1cqi) var(--punto); }
.casilla.encima { box-shadow: inset 0 0 0 4px rgba(255, 255, 255, .8); }
.coord { position: absolute; font-size: max(10px, 2.6cqi); font-weight: 800; line-height: 1; pointer-events: none; }
.coord.num { top: 3%; left: 4%; } .coord.letra { bottom: 3%; right: 5%; }
.casilla.clara .coord { color: var(--c-clara); } .casilla.oscura .coord { color: var(--c-oscura); }
.piezas { position: absolute; inset: 0; pointer-events: none; }
.pieza { position: absolute; left: 0; top: 0; width: 12.5%; height: 12.5%; background-size: 92%; background-position: center; background-repeat: no-repeat; will-change: transform; }
.pieza.anima { transition: transform .22s cubic-bezier(.3, .7, .3, 1); }
.pieza.arrastra { z-index: 5; transition: none; filter: drop-shadow(0 8px 8px rgba(0, 0, 0, .35)); }

/* ---------- ventanas ---------- */
.velo { position: fixed; inset: 0; z-index: 50; background: rgba(10, 12, 20, .5); display: grid; place-items: center; padding: 16px; animation: aparece .15s ease; }
.ventana { position: relative; background: var(--sup); border-radius: 18px; padding: 22px 20px 18px; width: min(440px, 100%); max-height: calc(100dvh - 32px);
  overflow: auto; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); text-align: center; }
.ventana.girada { transform: rotate(180deg); }
.ventana h2 { margin: 0 30px 8px; font-size: 22px; }
.ventana p { margin: 6px 0; }
.ventana .motivo { font-weight: 800; font-size: 18px; color: var(--acento); }
.ventana .res { font: 800 26px/1 ui-monospace, monospace; margin-top: 10px; }
.vbotones { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 16px; }
.vbotones .btn { flex: 1 1 140px; }
.cerrar { position: absolute; top: 8px; right: 8px; width: 44px; height: 44px; border: 0; background: transparent; font-size: 22px; cursor: pointer; border-radius: 10px; color: var(--suave); }
.btn img.mini { width: 26px; height: 26px; }
.corona .vbotones .btn { flex: 1 1 80px; flex-direction: column; padding: 8px; }
.corona .vbotones img { width: 64px; height: 64px; }
.opfila { text-align: left; margin: 12px 0; }
.opfila > span { display: block; font-weight: 700; margin-bottom: 6px; }
@keyframes aparece { from { opacity: 0; } }
.aviso { position: fixed; left: 50%; top: max(64px, calc(env(safe-area-inset-top) + 56px)); transform: translateX(-50%); z-index: 60; background: var(--txt); color: var(--bg);
  padding: 10px 18px; border-radius: 16px; width: max-content; max-width: min(420px, calc(100% - 32px)); font-size: 15px; font-weight: 700; box-shadow: var(--sombra); transition: opacity .3s; text-align: center; }
.aviso.fuera { opacity: 0; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- marcas del tablero (escuela) ---------- */
.flechas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 6; }
.flechas line { stroke: rgba(24, 160, 90, .85); stroke-width: .16; stroke-linecap: round; }
.flechas polygon { fill: rgba(24, 160, 90, .85); }
.casilla.pista { box-shadow: inset 0 0 0 4px #2fbf71, inset 0 0 18px 4px rgba(47, 191, 113, .7); animation: brillo 1.1s ease-in-out infinite; }
@keyframes brillo { 50% { box-shadow: inset 0 0 0 4px #2fbf71, inset 0 0 4px 0 rgba(47, 191, 113, .3); } }
.casilla.meta::before { content: "⭐"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 6cqi; animation: late 1.4s ease-in-out infinite; }
.tablero.mal { animation: sacude .35s; }
@keyframes sacude { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* =====================================================================
   ESCUELA
   ===================================================================== */
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--sup2); padding: 2px; flex: none; }
.avatar.peq { width: 28px; height: 28px; display: inline-block; vertical-align: middle; }
.cinta { display: inline-block; width: 30px; height: 10px; border-radius: 3px; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .25); vertical-align: middle; }
.estr { display: inline-flex; gap: 1px; font-size: 15px; line-height: 1; }
.estr i { font-style: normal; color: color-mix(in srgb, var(--suave) 45%, transparent); }
.estr i.on { color: #ffb300; text-shadow: 0 1px 0 rgba(0, 0, 0, .2); }
.nota { color: var(--suave); font-size: 14px; }
.err { color: var(--peligro); font-weight: 700; margin: 8px 0 0; }
.sub { margin: 20px 0 10px; font-size: 19px; } .sub small { color: var(--suave); font-weight: 500; font-size: 14px; }

/* quién juega */
.quien { text-align: center; max-width: 720px; margin: 0 auto; }
.quien h2 { font-size: clamp(22px, 5vw, 30px); margin: 10px 0; }
.perfiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 16px; }
.tperfil { display: flex; flex-direction: column; align-items: center; gap: 6px; border: 0; cursor: pointer; background: var(--sup); border-radius: var(--r);
  padding: 18px 10px; box-shadow: var(--sombra); }
.tperfil .avatar { width: 72px; height: 72px; padding: 6px; }
.tperfil b { font-size: 18px; } .tperfil small { color: var(--suave); font-size: 13px; }
.tperfil.nuevo { box-shadow: inset 0 0 0 3px dashed var(--linea); background: transparent; outline: 3px dashed var(--linea); outline-offset: -3px; }
.tperfil .mas { width: 72px; height: 72px; display: grid; place-items: center; font-size: 40px; color: var(--acento); }
.fila-ap { display: flex; gap: 8px; margin: 10px 0; }
.fila-ap input { flex: 1; min-width: 0; border: 2px solid var(--linea); background: var(--bg); border-radius: 12px; padding: 12px; font-size: 18px; }
.avs { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.av { border: 2px solid var(--linea); background: var(--bg); border-radius: 12px; padding: 4px; cursor: pointer; aspect-ratio: 1; }
.av img { width: 100%; height: 100%; }
.av.on { border-color: var(--acento); background: var(--acento-suave); box-shadow: 0 0 0 2px var(--acento); }

/* cabecera de la escuela */
.yo { display: inline-flex; align-items: center; gap: 8px; border: 0; background: var(--sup); border-radius: 999px; padding: 4px 14px 4px 4px; cursor: pointer;
  box-shadow: var(--sombra); font-size: 16px; max-width: 50vw; }
.yo b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.estado { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); margin-bottom: 12px; }
@media (min-width: 720px) { .estado { grid-template-columns: minmax(0, 1fr) auto; align-items: center; } }
.cint { display: flex; align-items: center; gap: 12px; background: var(--sup); border-radius: var(--r); padding: 10px 14px; box-shadow: var(--sombra); }
.cint .cinta { width: 46px; height: 18px; border-radius: 4px; flex: none; }
.cbar { flex: 1; min-width: 0; } .cbar b { font-size: 16px; } .cbar small { color: var(--suave); font-size: 13px; }
.prog { display: block; height: 10px; border-radius: 99px; background: var(--sup2); overflow: hidden; margin: 4px 0 2px; }
.prog i { display: block; height: 100%; background: linear-gradient(90deg, #ffb300, #ff7043); border-radius: 99px; transition: width .6s; }
.chipsE { display: flex; gap: 8px; }
.ce { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--sup); border-radius: var(--r); padding: 6px 12px;
  box-shadow: var(--sombra); font-size: 18px; line-height: 1.2; min-width: 84px; position: relative; overflow: hidden; }
.ce small { font-size: 12px; color: var(--suave); }
.ce.meta i { position: absolute; left: 0; bottom: 0; height: 5px; width: calc(var(--p) * 1%); background: var(--ok); }
.pestanas { display: flex; gap: 6px; margin: 14px 0 12px; overflow-x: auto; scrollbar-width: none; }
.pest { flex: 1; border: 0; background: var(--sup2); border-radius: 12px; padding: 10px 8px; font-weight: 800; cursor: pointer; white-space: nowrap; min-height: 46px; }
.pest.on { background: var(--acento); color: var(--acento-txt); }

/* mapa */
.mundo { background: var(--sup); border-radius: 18px; box-shadow: var(--sombra); margin-bottom: 12px; overflow: hidden; border-top: 6px solid var(--mc); }
.mcab { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: none; cursor: pointer; padding: 12px 14px; text-align: left; }
.mico { font-size: 36px; width: 52px; height: 52px; display: grid; place-items: center; border-radius: 50%; background: color-mix(in srgb, var(--mc) 18%, transparent); flex: none; }
.mtxt { flex: 1; min-width: 0; display: flex; flex-direction: column; } .mtxt b { font-size: 19px; } .mtxt small { color: var(--suave); font-size: 13px; }
.mflecha { font-size: 22px; color: var(--suave); }
.mundo.cerrado .mico { filter: grayscale(1); }
.mcerrado { padding: 0 16px 16px; text-align: center; }
.camino { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 10px 18px;
  background: radial-gradient(circle at 50% 0, color-mix(in srgb, var(--mc) 10%, transparent), transparent 70%); }
.nodo { --s: 74px; position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; border: 0; background: none; cursor: pointer;
  transform: translateX(calc(var(--z) * min(17vw, 70px))); padding: 4px; width: 170px; }
.bola { width: var(--s); height: var(--s); border-radius: 50%; display: grid; place-items: center; background: var(--mc); color: #fff;
  box-shadow: 0 6px 0 color-mix(in srgb, var(--mc) 60%, #000), 0 8px 16px rgba(0, 0, 0, .2); transition: transform .15s; font-size: 28px; }
.bola img { width: 70%; height: 70%; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .35)); }
.nodo.lec .bola { border-radius: 22px; }
.nl { font-size: 34px; }
.nodo:active .bola { transform: translateY(4px); box-shadow: 0 2px 0 color-mix(in srgb, var(--mc) 60%, #000); }
.nodo.bloq .bola { background: var(--sup2); color: var(--suave); box-shadow: 0 6px 0 var(--linea); font-size: 26px; }
.nodo.hecho .bola { box-shadow: 0 6px 0 color-mix(in srgb, var(--mc) 60%, #000), 0 0 0 4px #ffd54f; }
.nodo.ahora .bola { animation: late 1.4s ease-in-out infinite; box-shadow: 0 6px 0 color-mix(in srgb, var(--mc) 60%, #000), 0 0 0 6px color-mix(in srgb, var(--mc) 35%, transparent); }
.ntit { font-weight: 800; font-size: 14px; text-align: center; line-height: 1.2; } .ntit small { color: var(--suave); font-weight: 600; }
.nodo.bloq .ntit { color: var(--suave); }
.aqui { position: absolute; top: -6px; left: 50%; transform: translate(-50%, -100%); background: var(--txt); color: var(--bg); font-weight: 800; font-size: 13px;
  padding: 3px 10px; border-radius: 10px; white-space: nowrap; z-index: 2; }
.aqui::after { content: ""; position: absolute; left: 50%; bottom: -5px; margin-left: -5px; border: 5px solid transparent; border-bottom: 0; border-top-color: var(--txt); }

/* práctica */
.prac .tarjeta { position: relative; }
.nuevo { position: absolute; top: 10px; right: 12px; background: var(--peligro); color: #fff; font-weight: 800; font-size: 12px; padding: 2px 8px; border-radius: 99px; }

/* trofeos y tableros */
.trofeos { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.trofeo { background: var(--sup); border-radius: 14px; padding: 12px 10px; text-align: center; display: flex; flex-direction: column; gap: 3px; box-shadow: var(--sombra); opacity: .7; }
.trofeo.on { opacity: 1; box-shadow: inset 0 0 0 2px #ffd54f, var(--sombra); }
.tico { font-size: 34px; } .trofeo b { font-size: 15px; } .trofeo small { color: var(--suave); font-size: 12px; }
.tableros { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.tabl { border: 2px solid transparent; background: var(--sup); border-radius: 14px; padding: 10px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; box-shadow: var(--sombra); }
.tabl.on { border-color: var(--acento); } .tabl.bloq { opacity: .55; } .tabl small { color: var(--suave); font-size: 12px; }
.tabl .mini { width: 64px; height: 64px; border-radius: 6px; background: conic-gradient(var(--a) 0 25%, var(--b) 0 50%, var(--a) 0 75%, var(--b) 0) 0 0 / 50% 50%; }

/* ranking */
.rkt { margin-bottom: 4px; }
.rank { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.rank li { display: flex; align-items: center; gap: 10px; background: var(--bg); border-radius: 12px; padding: 6px 12px; }
.rank li.yo { box-shadow: inset 0 0 0 2px var(--acento); background: var(--acento-suave); }
.rank .pos { width: 30px; text-align: center; font-weight: 800; font-size: 18px; }
.rank b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank .pts { font-weight: 800; font-variant-numeric: tabular-nums; }
#online { margin-top: 12px; }
.ccta { margin: 0 0 6px; }
.emoclave { font-size: 44px; letter-spacing: 8px; background: var(--bg); border: 3px dashed var(--linea); border-radius: 14px; padding: 6px; margin: 8px 0; }
.ventana.cuenta h2 small { color: var(--suave); font-size: 15px; font-weight: 600; }
.slots { display: flex; gap: 8px; justify-content: center; margin: 10px 0; }
.slots span { width: 54px; height: 54px; border: 3px solid var(--linea); border-radius: 12px; display: grid; place-items: center; font-size: 32px; background: var(--bg); }
.pad { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }
.pad button { font-size: 24px; aspect-ratio: 1; border: 2px solid var(--linea); border-radius: 10px; background: var(--bg); padding: 0; cursor: pointer; }
.pad button:active { transform: scale(.9); background: var(--acento-suave); }
.btn:disabled { opacity: .45; cursor: default; }

/* pantalla de lección / ejercicio */
.escuela-tab { grid-template-areas: "cab" "obj" "tab" "profe" "lado"; }
.etit { font-weight: 800; }
.emini { min-width: 80px; display: flex; justify-content: flex-end; gap: 8px; align-items: center; font-weight: 800; font-size: 15px; flex-wrap: wrap; }
.emini .puntos { display: flex; gap: 4px; }
.emini .puntos i { width: 9px; height: 9px; border-radius: 50%; background: var(--linea); }
.emini .puntos i.hecho { background: var(--ok); } .emini .puntos i.ahora { background: var(--acento); transform: scale(1.35); }
.emini .rel.poco { color: var(--peligro); animation: late .8s infinite; }
.eobj { grid-area: obj; background: var(--sup); border-radius: 12px; padding: 8px 12px; text-align: center; font-size: 16px; min-height: 42px; box-shadow: var(--sombra); }
.eobj .cat { display: inline-block; background: var(--acento-suave); color: var(--acento); font-weight: 800; font-size: 12px; padding: 2px 8px; border-radius: 99px; margin-right: 6px; }
.cuenta-j { margin-left: 8px; background: var(--sup2); border-radius: 99px; padding: 2px 10px; white-space: nowrap; }
.profe { grid-area: profe; display: flex; align-items: flex-start; gap: 8px; min-height: 64px; }
.profe > img { width: 44px; height: 44px; flex: none; margin-top: 4px; filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .2)); }
.burbuja { position: relative; flex: 1; background: var(--sup); border-radius: 16px; padding: 10px 14px; font-size: 15.5px; line-height: 1.4; box-shadow: var(--sombra);
  max-height: 30dvh; overflow: auto; }
.burbuja::before { content: ""; position: absolute; left: -8px; top: 18px; border: 8px solid transparent; border-left: 0; border-right-color: var(--sup); }
.profe.bien .burbuja { background: color-mix(in srgb, var(--ok) 16%, var(--sup)); }
.profe.mal .burbuja { background: color-mix(in srgb, var(--peligro) 14%, var(--sup)); }
.profe.salta > img { animation: brinca .4s; }
@keyframes brinca { 40% { transform: translateY(-8px) rotate(-8deg); } }
.burbuja .idea { margin-top: 6px; font-weight: 700; }
.xpmini { display: inline-block; background: #ffb300; color: #3a2500; font-weight: 800; font-size: 13px; padding: 1px 8px; border-radius: 99px; margin-left: 4px; }
.ebotones { display: flex; gap: 6px; }
.ebotones .btn.grande { margin-top: 0; }
.escuela-tab .jlado { align-content: start; }

@media (min-aspect-ratio: 5/4) {
  .escuela-tab { grid-template-columns: minmax(0, 1fr) minmax(260px, 360px); grid-template-rows: auto auto minmax(0, 1fr) auto;
    grid-template-areas: "tab cab" "tab obj" "tab profe" "tab lado"; }
  .escuela-tab .profe { align-items: flex-start; min-height: 0; overflow: hidden; }
  .escuela-tab .burbuja { max-height: 100%; }
  .escuela-tab .jcab { flex-wrap: wrap; }
}
@media (min-aspect-ratio: 5/4) and (max-height: 500px) {
  .eobj { font-size: 14px; padding: 4px 8px; min-height: 0; }
  .burbuja { font-size: 13.5px; padding: 6px 10px; }
  .profe > img { width: 32px; height: 32px; }
  .ebotones .btn.grande { font-size: 16px; padding: 8px; min-height: 40px; }
}

/* celebración */
.celebra .grandes { display: flex; justify-content: center; gap: 6px; font-size: 54px; line-height: 1; margin: 4px 0 8px; }
.celebra .grandes i { font-style: normal; color: var(--sup2); text-shadow: 0 2px 0 var(--linea); }
.celebra .grandes i.on { color: #ffb300; text-shadow: 0 3px 0 #c77c00; animation: estrella .5s cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes estrella { from { transform: scale(0) rotate(-90deg); } }
.celebra .grandes i:nth-child(2) { transform: translateY(-10px); font-size: 64px; }
.xpgana { font-size: 26px; font-weight: 900; color: #ff8f00; margin: 6px 0; }
.logro { background: var(--acento-suave); border-radius: 12px; padding: 6px 10px; font-weight: 700; }
.gpts { font-size: 30px; font-weight: 900; }
.pasos { text-align: left; margin: 8px 0; padding-left: 22px; } .pasos li { margin: 3px 0; }
.recordar { background: var(--sup2); border-radius: 12px; padding: 8px 10px; text-align: left; }
.confeti { position: fixed; inset: 0; pointer-events: none; z-index: 70; overflow: hidden; }
.confeti i { position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px; animation: cae linear forwards; }
@keyframes cae { to { top: 105%; transform: rotate(720deg) translateX(40px); } }
.camino { padding-top: 34px; }
.nodo { gap: 8px; }
.pest { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 14px; padding: 8px 4px; }
.pest .pi { font-size: 22px; line-height: 1; }
.rank { width: 100%; } .rank li { width: 100%; }
.tarjeta small b { display: inline; font-size: inherit; }

/* ---------- contra el ordenador ---------- */
.niveles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.nivel { display: flex; flex-direction: column; align-items: center; gap: 1px; border: 2px solid var(--linea); background: var(--bg); border-radius: 12px;
  padding: 6px 2px; cursor: pointer; min-height: 70px; }
.nivel .nico { font-size: 22px; line-height: 1.1; } .nivel b { font-size: 17px; } .nivel small { font-size: 11px; color: var(--suave); text-align: center; line-height: 1.1; }
.nivel.on { border-color: var(--acento); background: var(--acento-suave); box-shadow: 0 0 0 2px var(--acento); }
@media (max-width: 360px) { .niveles { grid-template-columns: repeat(4, 1fr); } }
.piensa { display: inline-flex; gap: 3px; vertical-align: middle; }
.piensa i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: punto 1s infinite; }
.piensa i:nth-child(2) { animation-delay: .15s; } .piensa i:nth-child(3) { animation-delay: .3s; }
@keyframes punto { 50% { opacity: .2; transform: translateY(-3px); } }
