/* ===========================================================================
   MoodLab Creativo  ·  estilos  (edición "secundaria": cálida y orgánica)
   Paleta clara en tonos OCRE + BLANCO ROTO, ambiente amable y natural.
   El color de cada herramienta llega por --cat-color desde la config (pastel).
   =========================================================================== */

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

:root {
    --bg: #F4ECDB;          /* blanco roto cálido */
    --bg2: #EEE3CD;
    --panel: #FCF7EE;       /* crema casi blanco (tarjetas) */
    --panel2: #F6EEDD;
    --texto: #4A3A26;       /* marrón cálido legible */
    --tenue: #927B59;
    --acento: #C9874A;      /* ocre / terracota */
    --acento2: #E0A85C;     /* ocre dorado claro */
    --rosa: #E59AAE;
    --ok: #6FB07A;          /* verde salvia */
    --mal: #DD7E63;         /* teja suave */
    --oro: #E0B14E;
    --borde: rgba(120, 92, 52, 0.18);
    --sombra: rgba(120, 92, 52, 0.16);
    --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 orgánico (degradado cálido + dapples + orbes) ---------- */
.fondo { position: fixed; inset: 0; z-index: -3; overflow: hidden; background:
    radial-gradient(1200px 720px at 50% -12%, #FBF4E3 0%, var(--bg) 58%); }
.fondo::before { /* manchas suaves de luz cálida (textura orgánica) */
    content: ""; position: absolute; inset: -2px;
    background-image:
        radial-gradient(circle at 18% 28%, rgba(214, 170, 110, .14), transparent 42%),
        radial-gradient(circle at 82% 62%, rgba(200, 150, 95, .12), transparent 46%),
        radial-gradient(circle at 50% 90%, rgba(230, 200, 150, .12), transparent 44%),
        radial-gradient(circle at 70% 12%, rgba(225, 195, 150, .10), transparent 40%);
}
/* "blobs" orgánicos que respiran y se desplazan muy lentamente */
.orbe { position: absolute; border-radius: 50%; filter: blur(72px); opacity: .55; animation: flotar 18s ease-in-out infinite; }
.orbe.a { width: 460px; height: 460px; background: #E7B486; top: -130px; left: -90px; }
.orbe.b { width: 400px; height: 400px; background: #E6A6A6; bottom: -130px; right: -70px; animation-delay: -6s; }
.orbe.c { width: 320px; height: 320px; background: #A9C896; top: 42%; left: 58%; animation-delay: -11s; }
@keyframes flotar { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(34px,-44px) scale(1.14); } }

/* Iconos temáticos flotantes dibujados en canvas (js/network-bg.js) */
#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 {
    background: rgba(252, 247, 238, 0.78);
    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; }
.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 a la cabeza. */
.marca-robot {
    width: 46px; height: 46px; flex: 0 0 auto; border-radius: 50%;
    background-image: url("../images/mimi_meditando.png");
    background-repeat: no-repeat;
    background-size: 200%;
    background-position: 50% 12%;
    background-color: #F3E7D0;
    box-shadow: 0 0 0 2px rgba(201,135,74,.45), inset 0 0 12px rgba(201,135,74,.18), 0 4px 12px var(--sombra);
    transition: transform .25s ease;
}
/* Logotipo de marca en la cabecera (sustituye al wordmark cuando existe). */
.marca-logo { height: 96px; width: auto; max-width: 380px; display: block; filter: drop-shadow(0 2px 6px var(--sombra)); }
/* Avatar de los carteles: recorte a la CARA de la postura elegida. */
.cartel-robot.con-cara { background-size: 235%; background-position: 50% 13%; background-color: transparent; }
/* Mensaje de ánimo al final del texto de "Cómo se juega". */
.ayuda-animo { color: var(--acento); font-weight: 700; font-size: 16px; line-height: 1.5; margin-top: 8px; }
.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 1px 3px rgba(201,135,74,.5)); }
.hud-barra-wrap {
    flex: 1; height: 16px; background: #ECE0C8; 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,.55), 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); color: #fff; transform: translateY(-2px); box-shadow: 0 6px 16px rgba(201,135,74,.4); }

/* Logo institucional (Junta de Castilla y León). La imagen a color trae su
   propio fondo blanco; sobre la barra clara se integra con un redondeo suave. */
.logo-junta {
    display: flex; align-items: center; flex: 0 0 auto;
    margin-left: 10px; padding-left: 12px;
    border-left: 1px solid var(--borde);
    opacity: .96; transition: opacity .2s;
}
.logo-junta:hover { opacity: 1; }
.logo-junta img {
    height: 80px; width: auto; display: block;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .25));
}
.logo-junta.logo-color { border-left: none; opacity: 1; }
.logo-junta.logo-color:hover { transform: translateY(-1px); }
.logo-junta.logo-color img { height: 80px; border-radius: 8px; filter: drop-shadow(0 3px 9px var(--sombra)); }

/* ---------- 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; color: var(--texto); }
.titulo-arbol .emoji { filter: drop-shadow(0 2px 5px var(--sombra)); }
.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: 325px;
    pointer-events: none;
    transform: translate(24px, 48vh);
    opacity: 1;
    transition: opacity .6s ease;    /* APARECE / DESAPARECE suave (no se desliza) */
    will-change: opacity;
}
.mascota.moviendo { opacity: 0; }    /* invisible mientras se recoloca */
.robot-fig { position: relative; width: 325px; animation: bob 4s ease-in-out infinite; transform-origin: bottom center; }
.mascota img { width: 325px; display: block; position: relative; z-index: 1; filter: drop-shadow(0 16px 30px var(--sombra)); }
@keyframes bob { 0% { transform: translateY(0) rotate(-2.5deg); } 50% { transform: translateY(-10px) rotate(2.5deg); } 100% { transform: translateY(0) rotate(-2.5deg); } }

.llama {
    position: absolute; left: 41%; top: 84%; z-index: 2; pointer-events: none;
    width: 28px; height: 30px;
    transform: translate(-50%, 0) rotate(14deg);
    transform-origin: 50% 0%;
    background: radial-gradient(ellipse 55% 65% at 50% 30%,
        rgba(255, 230, 180, .95) 0%, rgba(230, 160, 90, .5) 45%, rgba(220, 150, 80, 0) 70%);
    mix-blend-mode: screen;
    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); }
}
.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); }
}
.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: var(--texto); padding: 11px 15px; border-radius: 16px;
    font-size: 14px; font-weight: 600;
    border: 1px solid var(--borde);
    box-shadow: 0 8px 20px var(--sombra);
    transition: opacity .25s ease;
}
.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; }
.mascota.b-izq .globo::after { right: -8px; border-left-color: #fff; }

.globo.globo-risa {
    background: linear-gradient(135deg, #ffe6a8, #ffc06a);
    color: #6b3d00; font-weight: 700;
    box-shadow: 0 8px 20px rgba(224, 160, 70, .4);
    animation: risaWobble .35s ease-in-out infinite alternate;
}
.mascota.b-der .globo.globo-risa::after { border-right-color: #ffc06a; }
.mascota.b-izq .globo.globo-risa::after { border-left-color: #ffc06a; }
@keyframes risaWobble { from { transform: rotate(-3deg) scale(1); } to { transform: rotate(3deg) scale(1.04); } }

/* ---------- Tablero: camino de fases HORIZONTAL + menú debajo ---------- */
.arbol-layout { display: flex; flex-direction: column; gap: 22px; max-width: 1120px; margin: 0 auto; }

/* contenedor con scroll horizontal en pantallas estrechas */
.tablero { width: 100%; overflow-x: auto; overflow-y: hidden; padding: 6px 2px 8px; }
.tree-root { position: relative; width: 100%; min-width: 680px; height: 340px; margin: 0 auto; }
.tree-lines { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; }
.linea { stroke: #D8C39C; stroke-width: 1.1; stroke-linecap: round; stroke-dasharray: 2.4 2.6; }
.linea.activa { stroke: url(#gradLinea); stroke-width: 1.6; filter: drop-shadow(0 0 3px 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: 98px; height: 98px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-size: 42px;
    /* relleno PASTEL: tinte suave del color de la herramienta */
    background: radial-gradient(circle at 35% 28%,
        color-mix(in srgb, var(--cat-color, var(--acento)) 42%, #ffffff),
        color-mix(in srgb, var(--cat-color, var(--acento)) 20%, #ffffff) 78%);
    border: 4px solid var(--cat-color, var(--acento));
    box-shadow: 0 8px 20px var(--sombra), inset 0 -5px 12px rgba(120,92,52,.12), inset 0 4px 10px rgba(255,255,255,.6);
    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: .4;
}
/* Icono de la etapa (imagen): llena por completo el círculo */
.nodo-ico { width: 132%; height: 132%; object-fit: contain; display: block; filter: drop-shadow(0 1px 2px rgba(120,92,52,.25)); }
/* Candado pequeño superpuesto en las etapas bloqueadas */
.nodo-candado {
    position: absolute; width: 40%; height: 40%; object-fit: contain;
    left: 50%; top: 50%; transform: translate(-50%, -50%);
    filter: drop-shadow(0 2px 5px rgba(0, 0, 0, .35));
}
.nodo-label {
    font-size: 13px; font-weight: 600; color: var(--texto); max-width: 120px; text-align: center;
    background: rgba(252,247,238,.9); 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), #4f9b62); color: #fff; 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(111,176,122,.5);
}
.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 26px 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: .55; }
.nodo-bloqueado { cursor: not-allowed; }
.nodo-bloqueado .nodo-disco { border-color: #CBBD9E; }
.nodo-bloqueado .nodo-disco::before { border-color: #CBBD9E; }
.nodo-bloqueado .nodo-ico { filter: grayscale(.75); opacity: .38; }   /* etapa velada bajo el candado */
.nodo-bloqueado .nodo-label { color: var(--tenue); }
@keyframes latido {
    0%,100% { box-shadow: 0 8px 20px var(--sombra), 0 0 0 0 var(--cat-color); }
    50% { box-shadow: 0 8px 20px var(--sombra), 0 0 22px 2px var(--cat-color); }
}
.nodo .empieza {
    position: absolute; top: -34px; left: 50%; transform: translateX(-50%);
    background: linear-gradient(90deg, var(--rosa), var(--oro)); color: #5a2a14;
    font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 20px; white-space: nowrap;
    box-shadow: 0 4px 12px var(--sombra); animation: saltito 1.2s ease-in-out infinite;
}
@keyframes saltito { 0%,100% { transform: translateX(-50%) translateY(0); } 50% { transform: translateX(-50%) translateY(-5px); } }

/* ---------- Menú del laboratorio (debajo del camino) ---------- */
.nucleo {
    width: 100%;
    background: linear-gradient(180deg, var(--panel), var(--panel2));
    border: 1px solid var(--borde); border-radius: 22px; padding: 20px 24px;
    box-shadow: 0 10px 30px var(--sombra);
    display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 16px 30px;
}
.nucleo-titulo { order: 0; flex-basis: 100%; text-align: center; font-size: 15px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--tenue); }

.nucleo-core {
    order: 1; flex: 0 0 auto;
    position: relative; width: 150px; height: 150px; border-radius: 50%; margin: 0;
    background: conic-gradient(var(--ok) calc(var(--pct, 0) * 3.6deg), #E7DBC2 0);
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 0 28px rgba(111, 176, 122, .25); transition: background .6s ease;
}
.nucleo-core::before { content: ""; position: absolute; inset: 13px; border-radius: 50%; background: var(--panel); box-shadow: inset 0 0 18px rgba(120,92,52,.14); }
.nucleo-centro { position: relative; z-index: 1; text-align: center; }
.nucleo-pct { font-size: 38px; font-weight: 700; line-height: 1; color: var(--texto); }
.nucleo-cap { font-size: 12px; color: var(--tenue); margin-top: 2px; }
.nucleo-listo { order: 3; flex-basis: 100%; text-align: center; font-size: 13px; font-weight: 700; color: var(--acento); min-height: 18px; }

.nucleo-modulos { order: 2; flex: 1 1 480px; display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px; }
.modulo { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 11px;
    background: #FBF6EB; border: 1px solid var(--borde); opacity: .62; transition: .3s; --cat-color: var(--acento); }
.modulo.done { opacity: 1; border-color: var(--cat-color); background: color-mix(in srgb, var(--cat-color) 12%, #ffffff); 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: #fff; 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(--panel); 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 36px var(--sombra); 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(--acento); }

@media (max-width: 600px) {
    .nucleo-modulos { grid-template-columns: 1fr 1fr; }
}

/* ---------- 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: #E2D5BC; 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 40px var(--sombra);
    border: 1px solid var(--borde);
    animation: cardin .35s ease;
}
.quiz-card::before {
    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: color-mix(in srgb, var(--cat-color, var(--acento)) 16%, transparent); padding: 4px 10px; border-radius: 20px; margin-bottom: 14px; }
.quiz-tipo-entrena { color: #6b3d00; background: linear-gradient(90deg, #ffd98a, #ffbf6e); }
.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: #FFFBF3; 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: color-mix(in srgb, var(--cat-color, var(--acento)) 8%, #FFFBF3); }
.opcion.sel { border-color: var(--cat-color, var(--acento)); background: color-mix(in srgb, var(--cat-color, var(--acento)) 14%, #ffffff); box-shadow: 0 0 0 3px color-mix(in srgb, var(--cat-color, var(--acento)) 20%, transparent); }
.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(111,176,122,.30), rgba(111,176,122,.15));
    color: #2c4a36; font-weight: 600;
    box-shadow: 0 0 0 1.5px var(--ok), 0 0 18px rgba(111,176,122,.4);
    animation: pop .35s ease;
}
.opcion.fallo { border-color: var(--mal); background: rgba(221,126,99,.18); 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 18px rgba(201,135,74,.35);
}
.btn-comprobar:hover { filter: brightness(1.06); transform: translateY(-2px); }
.btn-comprobar:active { transform: translateY(1px); }
.btn-comprobar:disabled { opacity: .4; 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(111,176,122,.18); border: 1px solid var(--ok); }
.feedback-mal { background: rgba(221,126,99,.15); 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(74,58,38,.45);
    -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 60px rgba(120,92,52,.30); 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 12px rgba(224,177,78,.6); animation: estrellaPop .5s ease backwards; }
.estrellas .off { color: #DDCBA9; }
.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: .95; filter: drop-shadow(0 1px 2px var(--sombra)); }
.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: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    background: radial-gradient(circle at 35% 28%,
        color-mix(in srgb, var(--cat-color, var(--acento)) 42%, #ffffff),
        color-mix(in srgb, var(--cat-color, var(--acento)) 20%, #ffffff));
    border: 2px solid var(--cat-color, var(--acento)); font-size: 18px; flex: 0 0 auto; overflow: hidden;
}
.ayuda-cat-ico img { width: 118%; height: 118%; object-fit: contain; }

/* ---------- 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; }
.cartel-robot {
    width: 64px; height: 64px; flex: 0 0 auto; border-radius: 50%;
    background-color: #F3E7D0;
    background-image: url("../images/mimi_meditando.png");
    background-repeat: no-repeat; background-position: 50% 12%; background-size: 200%;
    box-shadow: 0 0 0 2px rgba(201,135,74,.45), inset 0 0 14px rgba(201,135,74,.18);
}
.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; }

.credito-junta img { height: 74px; width: auto; display: block; border-radius: 8px; box-shadow: 0 4px 12px var(--sombra); }
.credito-junta.mono img { border-radius: 0; box-shadow: none; filter: drop-shadow(0 1px 2px var(--sombra)); }

@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) {
    .nodo-disco { width: 82px; height: 82px; font-size: 34px; }
    .tree-root { height: 320px; }
    .quiz-card { padding: 20px; }
    .quiz-enunciado { font-size: 18px; }
    .mascota, .robot-fig, .mascota img { width: 180px; }
    .globo { max-width: 130px; font-size: 12px; }
    .logo-junta img, .logo-junta.logo-color img { height: 52px; }
    .logo-junta { margin-left: 6px; padding-left: 8px; }
    .topbar-inner { padding: 16px 14px; }
    .marca-logo { height: 58px; }
}

/* ===========================================================================
   MoodCheck · termómetro emocional (exploración personal, sin nota)
   =========================================================================== */
.mood-intro { text-align: center; color: var(--tenue); max-width: 700px; margin: 0 auto 4px; font-size: 15px; line-height: 1.5; }
.mood-tipo { color: #6b3d00; background: linear-gradient(90deg, #ffd98a, #f2b6cb); }
.mood-card .quiz-enunciado { text-align: center; }

/* fila de 5 niveles del termómetro */
.mood-escala { display: flex; gap: 10px; justify-content: space-between; flex-wrap: wrap; }
.mood-opcion {
    flex: 1 1 0; min-width: 92px;
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    padding: 16px 8px; border-radius: 16px;
    border: 2px solid var(--borde); background: #FFFBF3;
    color: var(--texto); cursor: pointer; font-family: inherit;
    transition: transform .15s ease, border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.mood-opcion:hover { transform: translateY(-3px); border-color: var(--cat-color, var(--acento)); }
.mood-opcion.sel {
    border-color: var(--cat-color, var(--acento));
    background: color-mix(in srgb, var(--cat-color, var(--acento)) 14%, #ffffff);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--cat-color, var(--acento)) 26%, transparent);
    transform: translateY(-3px);
}
.mood-marca { font-size: 30px; line-height: 1; display: flex; align-items: center; justify-content: center; height: 42px; }
/* punto graduado del termómetro: crece y se intensifica con el nivel (0..4) */
.mood-marca-nivel {
    width: calc(16px + var(--nivel) * 6px);
    height: calc(16px + var(--nivel) * 6px);
    border-radius: 50%;
    background: var(--cat-color, var(--acento));
    opacity: calc(.5 + var(--nivel) * .12);
    box-shadow: 0 2px 8px color-mix(in srgb, var(--cat-color, var(--acento)) 40%, transparent);
}
.mood-etq { font-size: 12.5px; color: var(--tenue); text-align: center; line-height: 1.25; }
.mood-opcion.sel .mood-etq { color: var(--texto); font-weight: 600; }

/* pantalla de cierre */
.mood-cierre-ico { font-size: 48px; text-align: center; }
.mood-cierre-titulo { text-align: center; margin-top: 4px; }
.mood-cierre-texto { text-align: center; color: var(--texto); font-size: 17px; line-height: 1.6; max-width: 640px; margin: 8px auto 0; }
.mood-seguridad {
    margin-top: 20px; padding: 14px 16px; border-radius: 14px;
    background: rgba(224, 177, 78, .15); border: 1px solid rgba(224, 177, 78, .42);
    font-size: 14px; line-height: 1.5; color: var(--texto);
}

@media (max-width: 540px) {
    .mood-opcion { min-width: 0; flex-basis: 28%; padding: 12px 4px; }
    .mood-etq { font-size: 11px; }
    .mood-cierre-texto { font-size: 15px; }
}

/* ===========================================================================
   Fichas de concepto (tarjetas que se voltean)
   =========================================================================== */
.ficha-tipo { color: #6b3d00; background: linear-gradient(90deg, #ffd98a, #f2b6cb); }
.fichas-zona { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; margin: 6px 0 4px; }
.ficha {
    width: 210px; height: 250px; perspective: 1100px; cursor: pointer;
    --cat-color: var(--acento); background: none; border: none; padding: 0;
}
.ficha-inner {
    position: relative; width: 100%; height: 100%;
    transition: transform .55s cubic-bezier(.2, .9, .3, 1.1);
    transform-style: preserve-3d;
}
.ficha.volteada .ficha-inner { transform: rotateY(180deg); }
.ficha-cara {
    position: absolute; inset: 0; border-radius: 18px; padding: 18px 16px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
    border: 2px solid var(--cat-color); box-shadow: 0 8px 20px var(--sombra); background: #FFFBF3;
    -webkit-backface-visibility: hidden; backface-visibility: hidden;
}
.ficha-front { background: radial-gradient(circle at 50% 22%, color-mix(in srgb, var(--cat-color) 24%, #ffffff), #FFFBF3 78%); }
.ficha-emoji { font-size: 62px; line-height: 1; margin-bottom: 12px; filter: drop-shadow(0 2px 4px var(--sombra)); }
.ficha-img { width: 104px; height: 104px; object-fit: contain; margin-bottom: 12px; }
.ficha-titulo { font-size: 17px; font-weight: 700; color: var(--texto); line-height: 1.25; }
.ficha-girar { position: absolute; bottom: 9px; right: 12px; display: flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--tenue); font-weight: 600; }
.ficha-girar-ico { font-size: 15px; }
.ficha:hover .ficha-girar-ico { animation: giraHint 1s ease-in-out infinite; }
@keyframes giraHint { 50% { transform: rotate(180deg); } }
.ficha-back { transform: rotateY(180deg); background: color-mix(in srgb, var(--cat-color) 12%, #FFFBF3); }
.ficha-texto { font-size: 14.5px; line-height: 1.5; color: var(--texto); margin: 0; }
.fichas-pie { justify-content: center; }
/* punto del progreso correspondiente a las fichas (clase propia, NO 'ficha'
   para no colisionar con el selector de las tarjetas .ficha) */
.dot.dot-ficha { background: #c9a6d6; }

/* ===========================================================================
   Reto "creactiva" (elegir actividades creativas) y termómetro creativo
   =========================================================================== */
.opcion-creativa { display: flex; align-items: center; gap: 12px; }
.opcion-creativa .op-emoji { font-size: 24px; line-height: 1; flex: 0 0 auto; }
.opcion-creativa .op-texto { flex: 1; }
.opcion-creativa.sel::after { content: "✓"; margin-left: auto; color: var(--cat-color, var(--acento)); font-weight: 800; }

.mood-creativa-zona { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 4px 0 14px; }
.mood-chip {
    display: inline-flex; align-items: center; gap: 7px; padding: 10px 15px; border-radius: 24px;
    border: 2px solid var(--borde); background: #FFFBF3; color: var(--texto);
    cursor: pointer; font-family: inherit; font-size: 14.5px; font-weight: 600; transition: .15s;
}
.mood-chip:hover { border-color: var(--cat-color, var(--acento)); transform: translateY(-2px); }
.mood-chip.sel { border-color: var(--cat-color, var(--acento)); background: color-mix(in srgb, var(--cat-color, var(--acento)) 16%, #ffffff); }
.mood-chip-ico { font-size: 18px; }
.mood-libre {
    display: block; width: 100%; max-width: 440px; margin: 0 auto;
    padding: 12px 15px; border-radius: 14px; border: 2px solid var(--borde);
    background: #FFFBF3; font-family: inherit; font-size: 15px; color: var(--texto);
}
.mood-libre:focus { outline: none; border-color: var(--cat-color, var(--acento)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--cat-color, var(--acento)) 20%, transparent); }

/* Campo de texto libre "¿cómo te sientes ahora?" */
.mood-area {
    display: block; width: 100%; max-width: 580px; margin: 4px auto 6px;
    padding: 14px 16px; border-radius: 14px; border: 2px solid var(--borde);
    background: #FFFBF3; font-family: inherit; font-size: 15px; line-height: 1.55; color: var(--texto);
    resize: vertical; min-height: 110px;
}
.mood-area:focus { outline: none; border-color: var(--cat-color, var(--acento)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--cat-color, var(--acento)) 20%, transparent); }

/* ===========================================================================
   Diario emocional (modal + exportación a PDF por impresión)
   =========================================================================== */
.diario-titulo { text-align: center; font-size: 26px; margin-bottom: 8px; }
.diario-intro, .diario-vacio { color: var(--tenue); text-align: center; max-width: 640px; margin: 0 auto 14px; line-height: 1.5; }
.diario-lista { display: flex; flex-direction: column; gap: 12px; max-height: 52vh; overflow-y: auto; padding: 2px; }
.diario-entrada { border: 1px solid var(--borde); border-left: 4px solid var(--acento); border-radius: 12px; padding: 12px 14px; background: #FFFBF3; }
.diario-fase { font-size: 11px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--acento); margin-bottom: 4px; }
.diario-preg { font-size: 14.5px; color: var(--texto); font-weight: 600; line-height: 1.4; }
.diario-resp { font-size: 15px; color: var(--tenue); margin-top: 4px; }
.diario-resp::before { content: "→ "; color: var(--acento); }
.diario-acciones { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }
.diario-acciones .btn-comprobar { margin-top: 0; width: auto; }
.btn-diario-borrar {
    padding: 12px 22px; border-radius: 14px; border: 1px solid var(--borde);
    background: transparent; color: var(--tenue); font-weight: 600; font-size: 14px; cursor: pointer; font-family: inherit;
}
.btn-diario-borrar:hover { color: var(--mal); border-color: var(--mal); }

/* Versión imprimible (oculta en pantalla; visible al imprimir / Guardar como PDF) */
#diario-print { display: none; }
@media print {
    body > *:not(#diario-print) { display: none !important; }
    #diario-print { display: block !important; padding: 6mm 4mm; color: #2b2b2b; font-family: "Fredoka", system-ui, sans-serif; }
    #diario-print h1 { font-size: 24px; margin: 0 0 2px; color: #C9874A; }
    #diario-print .dp-sub { font-size: 12px; color: #777; margin: 0 0 2px; }
    #diario-print .dp-nota { font-size: 13px; color: #555; margin: 0 0 14px; font-style: italic; }
    #diario-print h2 { font-size: 15px; margin: 16px 0 6px; color: #8a5a2a; border-bottom: 1px solid #e3d6c2; padding-bottom: 3px; }
    #diario-print .dp-entrada { margin: 0 0 9px; break-inside: avoid; }
    #diario-print .dp-preg { font-size: 13.5px; font-weight: 600; color: #333; }
    #diario-print .dp-resp { font-size: 13.5px; color: #555; margin-top: 1px; }
    #diario-print .dp-resp::before { content: "→ "; color: #C9874A; }
}

@media (max-width: 680px) {
    .ficha { width: 44%; height: 230px; }
    .ficha-emoji { font-size: 52px; }
    .ficha-titulo { font-size: 15px; }
}
