/* ===========================================================================
   ExploraIA · v2  ·  estilos  (edición "secundaria": vibrante y gamificada)
   El color de cada categoría llega por --cat-color desde la config.
   =========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&display=swap');

:root {
    --bg: #0b0f23;
    --bg2: #141a36;
    --panel: #1a2347;
    --panel2: #20294f;
    --texto: #f3f6ff;
    --tenue: #97a6d4;
    --acento: #4f8cff;
    --acento2: #a855f7;
    --rosa: #ff5fa2;
    --ok: #1dffa0;
    --mal: #ff5d6c;
    --oro: #ffd34d;
    --borde: rgba(140, 170, 240, 0.18);
    --fuente: "Fredoka", "Segoe UI", system-ui, sans-serif;
}

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

body {
    font-family: var(--fuente);
    color: var(--texto);
    min-height: 100vh;
    overflow-x: hidden;
    background: var(--bg);
}

/* ---------- Fondo animado (aurora + rejilla + orbes) ---------- */
.fondo { position: fixed; inset: 0; z-index: -3; overflow: hidden; background:
    radial-gradient(1200px 700px at 50% -10%, #243069 0%, var(--bg) 55%); }
.fondo::before { /* rejilla sutil */
    content: ""; position: absolute; inset: -2px;
    background-image:
        linear-gradient(rgba(120,150,240,.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(120,150,240,.06) 1px, transparent 1px);
    background-size: 44px 44px;
    -webkit-mask-image: radial-gradient(circle at 50% 30%, #000 0%, transparent 75%);
    mask-image: radial-gradient(circle at 50% 30%, #000 0%, transparent 75%);
}
.orbe { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .5; animation: flotar 14s ease-in-out infinite; }
.orbe.a { width: 420px; height: 420px; background: #3a5bff; top: -120px; left: -80px; }
.orbe.b { width: 380px; height: 380px; background: #a855f7; bottom: -120px; right: -60px; animation-delay: -5s; }
.orbe.c { width: 300px; height: 300px; background: #ff5fa2; top: 40%; left: 60%; animation-delay: -9s; }
@keyframes flotar { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(30px,-40px) scale(1.12); } }

/* Red de nodos (network) dibujada en canvas: emula una malla tecnológica que
   se mueve ligeramente. Ligera: pocos nodos + requestAnimationFrame. */
#net-bg { position: fixed; inset: 0; z-index: -2; pointer-events: none; }

#confetti { position: fixed; inset: 0; z-index: 200; pointer-events: none; }

/* ---------- Barra superior ---------- */
.topbar {
    /* La BARRA ocupa todo el ancho (fondo + borde + blur), pero su contenido
       se centra al mismo ancho que el contenido principal (.arbol-layout). */
    background: rgba(11, 15, 35, 0.7);
    border-bottom: 1px solid var(--borde);
    position: sticky; top: 0; z-index: 50;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}
.topbar-inner {
    display: flex; align-items: center; gap: 22px;
    max-width: 1120px; margin: 0 auto;
    padding: 14px 22px;
}
.marca { display: flex; align-items: center; gap: 10px; font-size: 26px; font-weight: 700; letter-spacing: .5px; text-shadow: 0 2px 10px rgba(0,0,0,.4); }
.marca span { background: linear-gradient(90deg, var(--acento), var(--acento2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
/* Carita de la mascota dentro del wordmark: recorte circular ampliado a la cara. */
.marca-robot {
    width: 46px; height: 46px; flex: 0 0 auto; border-radius: 50%;
    background-image: url("../images/robot.png");
    background-repeat: no-repeat;
    background-size: 200%;            /* zoom para encuadrar solo la cabeza */
    background-position: 50% 12%;     /* centra en la carita */
    background-color: #0e1430;
    box-shadow: 0 0 0 2px rgba(79,140,255,.5), inset 0 0 12px rgba(79,140,255,.25), 0 4px 12px rgba(0,0,0,.45);
    transition: transform .25s ease;
}
.marca:hover .marca-robot { transform: scale(1.08) rotate(-4deg); }

.hud { flex: 1; display: flex; align-items: center; gap: 12px; max-width: 520px; }
.hud-ico { font-size: 20px; filter: drop-shadow(0 0 6px var(--oro)); }
.hud-barra-wrap {
    flex: 1; height: 16px; background: #0a0f24; border-radius: 10px; overflow: hidden;
    border: 1px solid var(--borde); position: relative;
}
.hud-barra {
    height: 100%; width: 0;
    background: linear-gradient(90deg, var(--acento), var(--ok));
    border-radius: 10px; transition: width .6s cubic-bezier(.2,.9,.3,1.2); position: relative;
}
.hud-barra::after { /* brillo que recorre la barra */
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.5), transparent);
    transform: translateX(-100%); animation: brillo 2.6s linear infinite;
}
@keyframes brillo { to { transform: translateX(220%); } }
.hud-texto { font-size: 13px; color: var(--tenue); white-space: nowrap; font-weight: 500; }

.acciones { display: flex; gap: 10px; }
.btn-icono {
    width: 42px; height: 42px; border-radius: 50%;
    border: 1px solid var(--borde); background: var(--panel); color: var(--texto);
    font-size: 19px; cursor: pointer; transition: .2s; font-weight: 600;
}
.btn-icono:hover { background: var(--acento); border-color: var(--acento); transform: translateY(-2px); box-shadow: 0 6px 16px rgba(79,140,255,.4); }

/* Logo institucional (Junta de Castilla y León) en MONOCROMO BLANCO,
   sin caja: se integra en la barra oscura como una marca discreta. */
.logo-junta {
    display: flex; align-items: center; flex: 0 0 auto;
    margin-left: 10px; padding-left: 12px;
    border-left: 1px solid var(--borde);   /* separador sutil, no caja */
    opacity: .95; transition: opacity .2s;
}
.logo-junta:hover { opacity: 1; }
.logo-junta img {
    height: 58px; width: auto; display: block;
    /* el asset ya es blanco sobre transparente; solo una sombra sutil */
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .45));
}

/* Variante a COLOR (logo oficial). La imagen YA trae su propio fondo blanco,
   así que se coloca directamente: solo redondeo suave + sombra para separarla
   de la barra oscura. Se activa con .logo-color; si el archivo no existe, el
   onerror la quita y cae al logo blanco. */
.logo-junta.logo-color {
    border-left: none; opacity: 1;
}
.logo-junta.logo-color:hover { transform: translateY(-1px); }
.logo-junta.logo-color img {
    height: 56px; border-radius: 8px;
    filter: drop-shadow(0 3px 9px rgba(0, 0, 0, .45));
}

/* ---------- Vistas ---------- */
.vista { display: none; padding: 22px 16px 80px; }
.vista.activa { display: block; animation: entra .45s ease; }
@keyframes entra { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.titulo-arbol { text-align: center; font-size: 32px; font-weight: 700; letter-spacing: .5px; }
.titulo-arbol .emoji { filter: drop-shadow(0 3px 8px rgba(0,0,0,.4)); }
.subtitulo-arbol { text-align: center; color: var(--tenue); margin: 4px 0 10px; font-weight: 500; }

/* ---------- Mascota ---------- */
.mascota {
    position: fixed; left: 0; top: 0; z-index: 40; width: 132px;
    pointer-events: none;
    transform: translate(24px, 60vh);
    /* SOLO el robot se posiciona aquí y se desliza; el bocadillo es aparte */
    transition: transform 2.4s cubic-bezier(.45, .05, .25, 1);
    will-change: transform;
}
.robot-fig { position: relative; width: 132px; animation: bob 2.6s ease-in-out infinite; transform-origin: bottom center; }
.mascota img { width: 132px; display: block; position: relative; z-index: 1; filter: drop-shadow(0 10px 24px rgba(0,0,0,.55)); }
/* flotación + leve balanceo tipo robot */
@keyframes bob { 0% { transform: translateY(0) rotate(-2.5deg); } 50% { transform: translateY(-10px) rotate(2.5deg); } 100% { transform: translateY(0) rotate(-2.5deg); } }

/* Resplandor SOLO sobre la llama del PNG (base del cohete). Pequeño y bajo,
   crece hacia ABAJO al moverse (el chorro), sin iluminar el cuerpo. */
/* Anclado a la llama AZUL real del PNG (centro ≈ 41% x, ≈ 88% y). */
.llama {
    position: absolute; left: 41%; top: 84%; z-index: 2; pointer-events: none;
    width: 28px; height: 30px;
    /* anclada por ARRIBA, justo bajo la tobera; crece SOLO hacia abajo.
       Girada 14° para seguir la inclinación de la llama azul (punta a la izq.) */
    transform: translate(-50%, 0) rotate(14deg);
    transform-origin: 50% 0%;
    background: radial-gradient(ellipse 55% 65% at 50% 30%,
        rgba(200, 235, 255, .95) 0%, rgba(90, 160, 255, .5) 45%, rgba(60, 120, 255, 0) 70%);
    mix-blend-mode: screen;            /* realza la llama azul, sin tocar el cuerpo */
    filter: blur(2.5px); opacity: .5;
    animation: fuego 1.1s ease-in-out infinite alternate;
}
@keyframes fuego {
    from { opacity: .35; transform: translate(-50%, 0) rotate(14deg) scaleY(.85); }
    to   { opacity: .6;  transform: translate(-50%, 0) rotate(14deg) scaleY(1.12); }
}
/* al moverse, el chorro se ALARGA hacia ABAJO y brilla más (cuerpo intacto) */
.mascota.moviendo .llama { opacity: 1; animation: fuegoFuerte .16s ease-in-out infinite alternate; }
@keyframes fuegoFuerte {
    from { opacity: .8; transform: translate(-50%, 0) rotate(14deg) scaleY(1.5); }
    to   { opacity: 1;  transform: translate(-50%, 0) rotate(14deg) scaleY(2.4); }
}
/* reacción de cosquillas al acercar el ratón */
.mascota img.cosquillas { animation: cosquillas .55s ease; }
@keyframes cosquillas {
    0%, 100% { transform: translateY(-4px) rotate(0deg); }
    15% { transform: translateY(-7px) rotate(-14deg); }
    30% { transform: translateY(-3px) rotate(13deg); }
    45% { transform: translateY(-8px) rotate(-11deg); }
    60% { transform: translateY(-3px) rotate(9deg); }
    80% { transform: translateY(-6px) rotate(-5deg); }
}
.globo {
    position: absolute; top: -10px; width: max-content; max-width: 200px;
    background: #fff; color: #1a2347; padding: 11px 15px; border-radius: 16px;
    font-size: 14px; font-weight: 600;
    box-shadow: 0 8px 22px rgba(0,0,0,.4);
    transition: opacity .25s ease;   /* solo el bocadillo aparece/desaparece */
}
/* el bocadillo sale al lado que quepa, SIN mover al robot */
.mascota.b-der .globo { left: calc(100% + 14px); }
.mascota.b-izq .globo { right: calc(100% + 14px); }
@keyframes globoin { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: none; } }
.globo::after { content: ""; position: absolute; top: 20px; border: 8px solid transparent; }
.mascota.b-der .globo::after { left: -8px; border-right-color: #fff; }   /* flecha apunta al robot (a su izquierda) */
.mascota.b-izq .globo::after { right: -8px; border-left-color: #fff; }   /* flecha apunta al robot (a su derecha) */

/* Bocadillo ESPECIAL de cosquillas (distinto al estándar): amarillo y temblón */
.globo.globo-risa {
    background: linear-gradient(135deg, #ffe680, #ffb347);
    color: #6b3d00; font-weight: 700;
    box-shadow: 0 8px 22px rgba(255, 160, 40, .45);
    animation: risaWobble .35s ease-in-out infinite alternate;
}
.mascota.b-der .globo.globo-risa::after { border-right-color: #ffb347; }
.mascota.b-izq .globo.globo-risa::after { border-left-color: #ffb347; }
@keyframes risaWobble { from { transform: rotate(-3deg) scale(1); } to { transform: rotate(3deg) scale(1.04); } }

/* ---------- Árbol de habilidades ---------- */
.tree-root { position: relative; width: min(640px, 95vw); height: 1040px; margin: 6px auto 0; }
.tree-lines { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; }
.linea { stroke: #34406e; stroke-width: 1.1; stroke-linecap: round; stroke-dasharray: 2.4 2.6; }
.linea.activa { stroke: url(#gradLinea); stroke-width: 1.4; filter: drop-shadow(0 0 4px var(--acento)); animation: fluye 1.2s linear infinite; }
@keyframes fluye { to { stroke-dashoffset: -10; } }

.nodo {
    position: absolute; transform: translate(-50%, -50%);
    z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 8px;
    background: none; border: none; cursor: pointer; font-family: inherit;
}
.nodo-disco {
    width: 80px; height: 80px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-size: 34px;
    background: radial-gradient(circle at 35% 28%, #2c3970, #161e40 75%);
    border: 4px solid var(--cat-color, var(--acento));
    box-shadow: 0 8px 22px rgba(0,0,0,.5), inset 0 -6px 14px rgba(0,0,0,.4), inset 0 4px 10px rgba(255,255,255,.08);
    transition: transform .18s cubic-bezier(.2,.9,.3,1.4), box-shadow .2s; position: relative;
}
.nodo-disco::before { /* aro exterior */
    content: ""; position: absolute; inset: -10px; border-radius: 50%;
    border: 2px dashed var(--cat-color, var(--acento)); opacity: .35;
}
.nodo-label {
    font-size: 13px; font-weight: 600; color: var(--texto); max-width: 120px; text-align: center;
    background: rgba(11,15,35,.78); padding: 3px 10px; border-radius: 12px; border: 1px solid var(--borde);
}
.nodo-check {
    position: absolute; top: -6px; right: 4px; width: 30px; height: 30px; border-radius: 50%;
    background: linear-gradient(135deg, var(--ok), #16b07a); color: #053b2a; font-weight: 800;
    display: flex; align-items: center; justify-content: center; font-size: 17px; border: 3px solid var(--bg);
    box-shadow: 0 3px 10px rgba(46,230,160,.5);
}
/* disponible: vibra invitando a jugar */
.nodo-disponible .nodo-disco { animation: latido 1.7s ease-in-out infinite; }
.nodo-disponible:hover .nodo-disco { transform: scale(1.12) translateY(-2px); box-shadow: 0 0 30px var(--cat-color); }
.nodo-disponible:active .nodo-disco { transform: scale(.96); }
.nodo-completado .nodo-disco { border-color: var(--ok); }
.nodo-completado .nodo-disco::before { border-color: var(--ok); opacity: .5; }
.nodo-bloqueado { cursor: not-allowed; }
.nodo-bloqueado .nodo-disco { filter: grayscale(1) brightness(.45); border-color: #36446b; }
.nodo-bloqueado .nodo-disco::before { border-color: #36446b; }
.nodo-bloqueado .nodo-label { color: var(--tenue); }
@keyframes latido {
    0%,100% { box-shadow: 0 8px 22px rgba(0,0,0,.5), inset 0 -6px 14px rgba(0,0,0,.4), 0 0 0 0 var(--cat-color); }
    50% { box-shadow: 0 8px 22px rgba(0,0,0,.5), inset 0 -6px 14px rgba(0,0,0,.4), 0 0 26px 2px var(--cat-color); }
}
/* etiqueta "¡EMPIEZA!" en el primer disponible */
.nodo .empieza {
    position: absolute; top: -34px; left: 50%; transform: translateX(-50%);
    background: linear-gradient(90deg, var(--rosa), var(--oro)); color: #3a1020;
    font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 20px; white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0,0,0,.4); animation: saltito 1.2s ease-in-out infinite;
}
@keyframes saltito { 0%,100% { transform: translateX(-50%) translateY(0); } 50% { transform: translateX(-50%) translateY(-5px); } }

/* ---------- Layout árbol + Núcleo ---------- */
.arbol-layout { display: flex; gap: 26px; max-width: 1120px; margin: 0 auto; align-items: flex-start; }
.arbol-layout .tree-root { margin: 0; flex: 1 1 540px; height: 960px; }

.nucleo {
    flex: 0 0 320px; align-self: stretch;
    background: linear-gradient(180deg, rgba(26,35,71,.7), rgba(20,26,54,.55));
    border: 1px solid var(--borde); border-radius: 20px; padding: 22px 20px;
    -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
    position: sticky; top: 84px;
}
.nucleo-titulo { text-align: center; font-size: 15px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--tenue); margin-bottom: 14px; }

.nucleo-core {
    position: relative; width: 196px; height: 196px; border-radius: 50%; margin: 0 auto 8px;
    background: conic-gradient(var(--ok) calc(var(--pct, 0) * 3.6deg), #202a52 0);
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 0 34px rgba(46, 230, 160, .25); transition: background .6s ease;
}
.nucleo-core::before { content: ""; position: absolute; inset: 15px; border-radius: 50%; background: var(--panel); box-shadow: inset 0 0 24px rgba(0,0,0,.5); }
.nucleo-centro { position: relative; z-index: 1; text-align: center; }
.nucleo-pct { font-size: 44px; font-weight: 700; line-height: 1; }
.nucleo-cap { font-size: 12px; color: var(--tenue); margin-top: 2px; }
.nucleo-listo { margin: 6px 0 14px; text-align: center; font-size: 13px; font-weight: 700; color: var(--oro); min-height: 18px; }

.nucleo-modulos { display: flex; flex-direction: column; gap: 8px; }
.modulo { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 11px;
    background: #131a38; border: 1px solid var(--borde); opacity: .55; transition: .3s; --cat-color: var(--acento); }
.modulo.done { opacity: 1; border-color: var(--cat-color); background: #16224a; box-shadow: 0 0 0 1px var(--cat-color) inset; }
.modulo .m-ico { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
    background: #0f1530; border: 1px solid var(--borde); font-size: 16px; flex: 0 0 auto; }
.modulo.done .m-ico { border-color: var(--cat-color); }
.modulo .m-nombre { font-size: 13px; font-weight: 600; }
.modulo .m-estado { margin-left: auto; font-size: 13px; color: var(--tenue); }
.modulo.done .m-estado { color: var(--ok); }

/* ---------- Toast (explicación de nodos bloqueados) ---------- */
.toast {
    position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px);
    background: var(--panel2); border: 1px solid var(--borde); border-left: 4px solid var(--oro);
    color: var(--texto); padding: 14px 18px; border-radius: 14px; max-width: 420px; z-index: 120;
    box-shadow: 0 14px 40px rgba(0,0,0,.5); opacity: 0; transition: opacity .3s, transform .3s; font-size: 14px; line-height: 1.45;
}
.toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast strong { color: var(--oro); }

@media (max-width: 900px) {
    .arbol-layout { flex-direction: column; align-items: stretch; }
    .nucleo { position: static; flex: none; }
    .nucleo-modulos { display: grid; grid-template-columns: 1fr 1fr; }
    .arbol-layout .tree-root { width: 100%; }
}

/* ---------- Quiz ---------- */
.quiz-root { max-width: 780px; margin: 0 auto; }
.quiz-header { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.quiz-fila { display: flex; justify-content: space-between; align-items: center; }
.quiz-volver { background: none; border: none; color: var(--tenue); font-size: 15px; cursor: pointer; font-family: inherit; font-weight: 600; }
.quiz-volver:hover { color: var(--texto); }
.quiz-titulo { font-size: 22px; font-weight: 700; color: var(--cat-color, var(--acento)); text-align: center; }
.quiz-dots { display: flex; gap: 8px; justify-content: center; }
.dot { width: 26px; height: 8px; border-radius: 6px; background: #28335c; transition: .3s; }
.dot.actual { background: var(--cat-color, var(--acento)); transform: scaleY(1.4); }
.dot.ok { background: var(--ok); }
.dot.mal { background: var(--mal); }

.quiz-card {
    position: relative; border-radius: 20px; padding: 28px;
    background: linear-gradient(180deg, var(--panel), var(--panel2));
    box-shadow: 0 16px 50px rgba(0,0,0,.5);
    border: 1px solid var(--borde);
    animation: cardin .35s ease;
}
.quiz-card::before { /* borde superior con color de categoría */
    content: ""; position: absolute; left: 0; right: 0; top: 0; height: 5px; border-radius: 20px 20px 0 0;
    background: linear-gradient(90deg, var(--cat-color, var(--acento)), transparent);
}
@keyframes cardin { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }
.quiz-tipo { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase;
    color: var(--cat-color, var(--acento)); background: rgba(79,140,255,.12); padding: 4px 10px; border-radius: 20px; margin-bottom: 14px; }
.quiz-tipo-entrena { color: #3a2800; background: linear-gradient(90deg, #ffd34d, #ffb347); }
.quiz-enunciado { font-size: 20px; line-height: 1.5; margin-bottom: 22px; font-weight: 500; }
.quiz-opciones { display: flex; flex-direction: column; gap: 12px; }
.opcion {
    text-align: left; padding: 16px 18px; border-radius: 14px;
    background: #131a38; color: var(--texto);
    border: 2px solid var(--borde); font-size: 16px; cursor: pointer; transition: .15s; font-family: inherit; font-weight: 500;
}
.opcion:hover:not(.bloqueada) { border-color: var(--cat-color, var(--acento)); transform: translateX(4px); background: #182148; }
.opcion.sel { border-color: var(--cat-color, var(--acento)); background: #1e2a55; box-shadow: 0 0 0 3px rgba(79,140,255,.15); }
.opcion.opcion-multi::before { content: "○ "; opacity: .55; font-weight: 700; }
.opcion.opcion-multi.sel::before { content: "● "; opacity: 1; }
.opcion.bloqueada { cursor: default; }
.opcion.ok {
    border-color: var(--ok);
    background: linear-gradient(90deg, rgba(29,255,160,.28), rgba(29,255,160,.14));
    color: #eafff6; font-weight: 600;
    box-shadow: 0 0 0 1.5px var(--ok), 0 0 22px rgba(29,255,160,.55), inset 0 0 16px rgba(29,255,160,.18);
    animation: pop .35s ease;
}
.opcion.fallo { border-color: var(--mal); background: rgba(255,93,108,.16); animation: shake .4s ease; }
@keyframes pop { 0% { transform: scale(1);} 40% { transform: scale(1.03);} 100% { transform: scale(1);} }
@keyframes shake { 0%,100%{transform:translateX(0);} 20%{transform:translateX(-7px);} 40%{transform:translateX(7px);} 60%{transform:translateX(-5px);} 80%{transform:translateX(5px);} }

.quiz-pie { margin-top: 22px; display: flex; justify-content: flex-end; }
.btn-comprobar {
    padding: 14px 34px; border-radius: 14px; border: none; cursor: pointer;
    background: linear-gradient(90deg, var(--acento), var(--acento2)); color: #fff; font-weight: 700; font-size: 16px;
    font-family: inherit; transition: .2s; box-shadow: 0 8px 20px rgba(79,140,255,.35);
}
.btn-comprobar:hover { filter: brightness(1.08); transform: translateY(-2px); }
.btn-comprobar:active { transform: translateY(1px); }
.btn-comprobar:disabled { opacity: .35; cursor: not-allowed; box-shadow: none; transform: none; }

.feedback { margin-top: 20px; padding: 15px 18px; border-radius: 14px; font-size: 15px; line-height: 1.5; animation: fbin .35s ease; }
.feedback-ok { background: rgba(29,255,160,.16); border: 1px solid var(--ok); box-shadow: 0 0 18px rgba(29,255,160,.25); }
.feedback-mal { background: rgba(255,93,108,.14); border: 1px solid var(--mal); }
@keyframes fbin { from { opacity:0; transform: translateY(8px);} to { opacity:1; transform:none;} }

/* ---------- Modales ---------- */
.modal { position: fixed; inset: 0; z-index: 150; background: rgba(5,8,20,.8);
    -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px);
    display: none; align-items: center; justify-content: center; padding: 20px; }
.modal.abierto { display: flex; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal-caja {
    background: linear-gradient(180deg, var(--panel), var(--panel2));
    border: 1px solid var(--borde); border-radius: 22px; padding: 32px; max-width: 480px; width: 100%;
    position: relative; box-shadow: 0 24px 70px rgba(0,0,0,.65); text-align: center;
    animation: modalin .4s cubic-bezier(.2,.9,.3,1.3);
}
@keyframes modalin { from { opacity: 0; transform: scale(.85) translateY(20px); } to { opacity: 1; transform: none; } }
.modal-caja h2 { font-size: 26px; margin-bottom: 12px; }
.modal-caja h3 { margin: 16px 0 8px; color: var(--acento); font-size: 17px; }
.modal-caja p { color: var(--texto); line-height: 1.55; margin-bottom: 10px; }
.modal-caja ul { margin: 0 auto 6px; max-width: 320px; text-align: left; color: var(--tenue); padding-left: 18px; }
.modal-caja .btn-comprobar { margin-top: 20px; width: 100%; }
.modal-x { position: absolute; top: 14px; right: 16px; background: none; border: none; color: var(--tenue); font-size: 20px; cursor: pointer; }

.estrellas { font-size: 42px; letter-spacing: 6px; margin: 6px 0 14px; }
.estrellas .on { color: var(--oro); text-shadow: 0 0 14px rgba(255,211,77,.7); animation: estrellaPop .5s ease backwards; }
.estrellas .off { color: #33406b; }
.estrellas .on:nth-child(1){animation-delay:.05s} .estrellas .on:nth-child(2){animation-delay:.2s} .estrellas .on:nth-child(3){animation-delay:.35s}
@keyframes estrellaPop { 0% { transform: scale(0) rotate(-30deg); opacity: 0; } 70% { transform: scale(1.3); } 100% { transform: scale(1); opacity: 1; } }

.ayuda-cuerpo { text-align: left; }
.ayuda-credito { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--borde);
    display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.ayuda-credito span { font-size: 12px; color: var(--tenue); letter-spacing: .5px; }
.ayuda-credito img { height: 42px; width: auto; opacity: .92;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .4)); }
.ayuda-cats { display: flex; flex-direction: column; gap: 9px; margin-top: 6px; }
.ayuda-cat { display: flex; align-items: center; gap: 12px; font-size: 15px; font-weight: 500; }
.ayuda-cat-ico {
    width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    background: radial-gradient(circle at 35% 28%, #2c3970, #161e40); border: 2px solid var(--cat-color, var(--acento)); font-size: 18px; flex: 0 0 auto;
}

/* ---------- Cartel ancho (bienvenida / fin) ---------- */
.cartel-caja { max-width: 940px; text-align: left; padding: 30px 34px; }
.cartel { display: flex; gap: 32px; align-items: flex-start; }
.cartel-col { flex: 1 1 0; min-width: 0; }
.cartel-col-modulos { border-left: 1px solid var(--borde); padding-left: 30px; }
.cartel-col-texto p { color: var(--tenue); }
.cartel-col-texto ul { margin: 0; max-width: none; }
.cartel-cabecera { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.cartel-cabecera h2 { margin: 0; font-size: 27px; line-height: 1.1; }
/* Avatar del robot: recorte a la carita, como si él nos lo contara. */
.cartel-robot {
    width: 64px; height: 64px; flex: 0 0 auto; border-radius: 50%;
    background: #0e1430 url("../images/robot.png") no-repeat 50% 12% / 200%;
    box-shadow: 0 0 0 2px rgba(79,140,255,.5), inset 0 0 14px rgba(79,140,255,.25);
}
.cartel-robot.celebra { animation: bob 2.4s ease-in-out infinite; }
.cartel-pie { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--borde);
    display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.cartel-pie-fin { justify-content: center; }
.cartel-pie .btn-comprobar { margin-top: 0; width: auto; }

/* Logo JCYL negro sobre blanco (la imagen ya trae su fondo blanco). */
.credito-junta img { height: 50px; width: auto; display: block; border-radius: 8px; box-shadow: 0 4px 14px rgba(0,0,0,.3); }
.credito-junta.mono img { border-radius: 0; box-shadow: none; filter: drop-shadow(0 1px 2px rgba(0,0,0,.4)); }

@media (max-width: 760px) {
    .cartel { flex-direction: column; gap: 20px; }
    .cartel-col-modulos { border-left: none; padding-left: 0; border-top: 1px solid var(--borde); padding-top: 18px; }
}

@media (max-width: 540px) {
    .tree-root { height: 920px; }
    .nodo-disco { width: 70px; height: 70px; font-size: 30px; }
    .quiz-card { padding: 20px; }
    .quiz-enunciado { font-size: 18px; }
    .mascota img { width: 64px; }
    .globo { max-width: 130px; font-size: 12px; }
    .logo-junta img { height: 34px; }
    .logo-junta { margin-left: 6px; padding-left: 8px; }
}

/* ╔═══════════════════════════════════════════════════════════════════════════╗
   ║  PESTAÑA «VOLVER»  ·  INICIO                                               ║
   ║  Estilos de la pestaña azul lateral (borde izquierdo) de retorno al        ║
   ║  escritorio de juegos. PARA QUITARLA: borra este bloque entero (hasta el   ║
   ║  comentario «PESTAÑA VOLVER · FIN») y el bloque <a class="pestana-volver"> ║
   ║  de index.html.                                                           ║
   ╚═══════════════════════════════════════════════════════════════════════════╝ */
.pestana-volver {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 130;                       /* por encima del tablero; por debajo de los modales (150) */
    display: inline-flex;
    flex-direction: column;             /* flecha arriba, texto debajo */
    align-items: center;
    gap: 8px;
    padding: 16px 9px;
    writing-mode: vertical-rl;          /* texto «VOLVER» en vertical */
    background: linear-gradient(180deg, #1e6fff, #0b4fd6);
    color: #fff;
    font: 700 15px/1 system-ui, -apple-system, "Segoe UI", sans-serif;
    letter-spacing: 1px;
    text-decoration: none;
    border-radius: 0 12px 12px 0;       /* redondeo solo en el lado que sobresale */
    box-shadow: 2px 4px 16px rgba(0,0,0,.4), inset 0 0 0 1px rgba(255,255,255,.15);
    transition: transform .18s ease, box-shadow .18s ease, padding .18s ease;
}
.pestana-volver:hover {
    transform: translateY(-50%) translateX(3px);
    padding-right: 13px;
    box-shadow: 4px 6px 22px rgba(0,0,0,.5), inset 0 0 0 1px rgba(255,255,255,.28);
}
.pestana-volver:active { transform: translateY(-50%) translateX(0) scale(.98); }
.pestana-volver-flecha {
    writing-mode: horizontal-tb;        /* la flecha ← se mantiene horizontal */
    font-size: 18px;
    line-height: 1;
}
@media (max-width: 600px) {
    .pestana-volver { padding: 12px 7px; font-size: 13px; letter-spacing: .5px; }
    .pestana-volver-flecha { font-size: 15px; }
}
/* ═══  PESTAÑA «VOLVER»  ·  FIN  ═════════════════════════════════════════════ */
