/* CRT de Educatic · escenario y conversación en burbuja, inspirado en AnderCode.
   El botón se mantiene dentro del hero; al desplazarse solo el CRT compacto
   queda en pantalla, con la burbuja minimizada para no tapar anuncios. */
.educatic-hero-guide {
    --crt-accent: #2563eb;
    --crt-light: #eaf2ff;
    --crt-dark: #1d4ed8;
    position: relative;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    color: #19243b;
}
.educatic-hero-guide[data-tone="red"] { --crt-accent:#dc2626; --crt-light:#fff0f1; --crt-dark:#991b1b; }
.educatic-hero-guide[data-tone="green"] { --crt-accent:#15803d; --crt-light:#e8f8ef; --crt-dark:#166534; }
.educatic-hero-guide[data-tone="purple"] { --crt-accent:#7c3aed; --crt-light:#f1ebff; --crt-dark:#5b21b6; }
.educatic-hero-guide[data-tone="orange"] { --crt-accent:#c2410c; --crt-light:#ffedd5; --crt-dark:#9a3412; }

.educatic-guide-stage {
    position: relative;
    min-height: 442px;
    isolation: isolate;
    border-radius: 29px;
    border: 1px solid rgba(255,255,255,.82);
    background: radial-gradient(circle at 50% 66%, rgba(184,161,255,.23), transparent 43%),
                linear-gradient(160deg, #fff, #f4f0ff);
    box-shadow: 0 24px 52px rgba(0,17,66,.18);
    overflow: hidden;
}
.educatic-guide-orbit {
    position: absolute;
    pointer-events: none;
    z-index: 0;
    top: 64%;
    left: 50%;
    width: 260px;
    height: 260px;
    border: 1px solid rgba(115,82,221,.17);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}
.educatic-guide-orbit.orbit-inner {
    width: 204px;
    height: 204px;
    border-style: dashed;
    border-color: rgba(115,82,221,.20);
    background: radial-gradient(circle,rgba(255,255,255,.55),rgba(213,200,255,.04));
}
.educatic-guide-chip {
    position: absolute;
    z-index: 4;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 11px;
    border: 1px solid #ebe6fd;
    border-radius: 12px;
    background: rgba(255,255,255,.97);
    color: #35324d;
    box-shadow: 0 10px 24px rgba(39,35,85,.09);
    font-size: .7rem;
    font-weight: 800;
    white-space: nowrap;
    cursor: pointer;
    transition: border-color .18s ease, transform .18s ease;
}
.educatic-guide-chip i { color: #7c3aed; font-size: .85rem; }
.educatic-guide-chip:hover, .educatic-guide-chip.is-selected {
    border-color: var(--crt-accent);
    transform: translateY(-3px);
}
.educatic-guide-chip.chip-learn { top: 31px; right: 4%; transform: rotate(5deg); }
.educatic-guide-chip.chip-discover { top: 236px; right: 4%; transform: rotate(4deg); }
.educatic-guide-chip.chip-grow { top: 244px; left: 4%; transform: rotate(-3deg); }
.educatic-guide-chip.chip-learn:hover,
.educatic-guide-chip.chip-discover:hover,
.educatic-guide-chip.chip-grow:hover { transform: translateY(-3px); }

.educatic-guide-assistant { position: static; }
.educatic-guide-character {
    position: absolute;
    z-index: 3;
    left: 50%;
    right: auto;
    top: auto;
    bottom: 26px;
    transform: translateX(-50%);
    display: grid;
    place-items: center;
    width: 220px;
    height: 220px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    appearance: none;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    filter: drop-shadow(0 11px 14px rgba(38,33,79,.12));
    transition: filter .2s ease;
}
.educatic-guide-character:hover { filter: drop-shadow(0 14px 19px rgba(38,33,79,.20)); }
.educatic-guide-sprite {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    background-repeat: no-repeat;
    background-size: 300% 300%;
    background-position: 50% 50%;
    opacity: 0;
    pointer-events: none;
    transition: opacity .08s linear;
}
.educatic-hero-guide.has-sprites .educatic-guide-direction { opacity: 1; }
.educatic-hero-guide.has-sprites .educatic-guide-character.is-reacting .educatic-guide-direction { opacity: 0; }
.educatic-hero-guide.has-sprites .educatic-guide-character.is-reacting .educatic-guide-reaction { opacity: 1; }
.educatic-guide-fallback {
    width: 83%;
    height: 83%;
    border-radius: 23px;
    object-fit: contain;
    transition: opacity .1s;
}
.educatic-hero-guide.has-sprites .educatic-guide-fallback { opacity: 0; }
.educatic-guide-character.is-reacting { animation: educaticCrtBoop .5s ease; }
@keyframes educaticCrtBoop {
    0%,100% { scale:1; }
    28% { scale:1.07 .9; }
    56% { scale:.94 1.07; }
    80% { scale:1.02 .98; }
}

.educatic-guide-bubble {
    position: absolute;
    z-index: 6;
    top: 18px;
    bottom: auto;
    left: 5%;
    width: min(297px, 68%);
    padding: 13px 14px 12px;
    border: 1px solid #ece8f9;
    border-radius: 16px;
    background: #fff;
    color: #222138;
    box-shadow: 0 14px 32px rgba(47,33,83,.16);
    transform-origin: right bottom;
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    transition: opacity .24s ease, transform .24s ease, visibility .24s ease;
}
.educatic-guide-bubble::after {
    content: "";
    position: absolute;
    right: 57px;
    bottom: -8px;
    top: auto;
    width: 15px;
    height: 15px;
    background: #fff;
    border-bottom: 1px solid #ece8f9;
    border-right: 1px solid #ece8f9;
    transform: rotate(45deg);
}
.educatic-hero-guide.is-collapsed:not(.is-docked) .educatic-guide-bubble {
    opacity: 0;
    visibility: hidden;
    transform: translateY(-7px) scale(.975);
    pointer-events: none;
}
.educatic-guide-bubble-label {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 7px;
    padding-right: 24px;
    color: var(--crt-dark);
    font-size: .62rem;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: .02em;
}
.educatic-guide-live-dot {
    display: inline-block;
    flex: 0 0 7px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 3px #dcfce7;
}
.educatic-guide-topic {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100px;
    font-size: .57rem;
    font-weight: 800;
    color: var(--crt-dark);
    background: var(--crt-light);
    border-radius: 999px;
    padding: 4px 7px;
    text-transform: none;
    letter-spacing: normal;
}
.educatic-guide-title {
    display: block;
    margin-bottom: 5px;
    padding-right: 6px;
    color: #202038;
    font-size: .84rem;
    line-height: 1.33;
    font-weight: 850;
}
.educatic-guide-message {
    margin: 0 0 10px;
    color: #66637a;
    line-height: 1.43;
    font-size: .72rem;
}
.educatic-guide-close, .educatic-guide-next, .educatic-guide-pause {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: #f5f2fb;
    color: #6b6081;
    cursor: pointer;
}
.educatic-guide-close {
    position: absolute;
    z-index: 2;
    right: 9px;
    top: 9px;
    width: 25px;
    height: 25px;
}
.educatic-guide-close:hover, .educatic-guide-next:hover, .educatic-guide-pause:hover {
    background: var(--crt-light); color: var(--crt-dark);
}
.educatic-guide-bubble-footer {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
}
.educatic-guide-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    max-width: 100%;
    padding: 8px 10px;
    border-radius: 9px;
    text-decoration: none;
    color: #fff !important;
    background: var(--crt-accent);
    font-size: .66rem;
    font-weight: 800;
}
.educatic-guide-cta:hover { color: #fff !important; filter: brightness(.92); }
.educatic-guide-counter {
    color: #827e95;
    margin-left: auto;
    font-size: .61rem;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.educatic-guide-counter strong { color: var(--crt-accent); }
.educatic-guide-next, .educatic-guide-pause { width: 25px; height: 27px; }
.educatic-hero-guide a:focus-visible, .educatic-hero-guide button:focus-visible {
    outline: 3px solid #60a5fa; outline-offset: 3px;
}

/* Al bajar del inicio, solo CRT aparece en esquina; no se despliega
   publicidad ni se altera el flujo del documento. La burbuja inicia cerrada. */
.educatic-hero-guide.is-docked {
    position: fixed;
    z-index: 1025;
    bottom: max(14px, env(safe-area-inset-bottom));
    right: 16px;
    width: auto;
    max-width: calc(100vw - 20px);
    margin: 0;
}
.educatic-hero-guide.is-docked .educatic-guide-stage {
    overflow: visible;
    isolation: auto;
    width: auto;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}
.educatic-hero-guide.is-docked .educatic-guide-orbit,
.educatic-hero-guide.is-docked .educatic-guide-chip { display: none; }
.educatic-hero-guide.is-docked .educatic-guide-assistant {
    display: flex;
    flex-direction: row-reverse;
    align-items: flex-end;
    gap: 10px;
}
.educatic-hero-guide.is-docked .educatic-guide-character {
    position: relative;
    top: auto;
    right: auto;
    left: auto;
    bottom: auto;
    transform: none;
    flex: 0 0 73px;
    width: 73px;
    height: 73px;
    border: 1px solid rgba(155,130,226,.28);
    border-radius: 22px;
    background: radial-gradient(circle at 45% 30%,#fff,#f2edff);
    box-shadow: 0 12px 30px rgba(36,26,70,.19);
    filter: none;
    backdrop-filter: blur(7px);
}
.educatic-hero-guide.is-docked .educatic-guide-fallback {
    width: 65px;
    height: 65px;
}
.educatic-hero-guide.is-docked .educatic-guide-bubble {
    position: relative;
    left: auto;
    top: auto;
    bottom: auto;
    width: 274px;
    max-width: calc(100vw - 110px);
    margin-bottom: 3px;
    box-shadow: 0 16px 37px rgba(32,25,66,.2);
}
.educatic-hero-guide.is-docked .educatic-guide-bubble::after {
    top: auto;
    right: -8px;
    bottom: 24px;
    border-bottom: 0;
    border-top: 1px solid #ece8f9;
    border-left: 0;
    border-right: 1px solid #ece8f9;
}
.educatic-hero-guide.is-docked.is-collapsed .educatic-guide-bubble { display: none; }

/* Adaptar escena e interacción a pantallas pequeñas. */
@media (max-width: 1199.98px) {
    .educatic-guide-stage { min-height: 438px; }
    .educatic-guide-character {
        left: 50%;
        right: auto;
        top: auto;
        bottom: 24px;
        width: 205px;
        height: 205px;
    }
    .educatic-guide-orbit { top: 64%; left: 50%; width: 240px; height: 240px; }
    .educatic-guide-orbit.orbit-inner { width: 187px; height: 187px; }
    .educatic-guide-bubble { top: 16px; left: 5%; width: min(282px, 69%); }
    .educatic-guide-chip.chip-discover { top: 226px; right: 3%; }
    .educatic-guide-chip.chip-grow { top: 236px; left: 3%; }
}
@media (max-width: 575px) {
    /* Dos zonas claras: burbuja superior y mascota centrada debajo. */
    .educatic-guide-stage { min-height: 470px; border-radius: 22px; }
    .educatic-guide-bubble {
        top: 14px;
        bottom: auto;
        left: 4%;
        width: 92%;
        padding: 12px 13px;
    }
    .educatic-guide-bubble::after { right: 27%; }
    .educatic-guide-character {
        left: 50%;
        right: auto;
        top: auto;
        bottom: 18px;
        width: 188px;
        height: 188px;
    }
    .educatic-guide-orbit { top: 70%; left: 50%; width: 215px; height: 215px; }
    .educatic-guide-orbit.orbit-inner { width: 166px; height: 166px; }
    .educatic-guide-chip { padding: 7px 9px; font-size: .63rem; }
    .educatic-guide-chip.chip-learn { top: 248px; left: 3%; right: auto; }
    .educatic-guide-chip.chip-discover { top: 248px; right: 3%; }
    .educatic-guide-chip.chip-grow { top: 292px; left: 2%; }
    .educatic-guide-title { font-size: .79rem; }
    .educatic-guide-message { font-size: .7rem; }
    .educatic-hero-guide.is-docked { right: 12px; }
    .educatic-hero-guide.is-docked .educatic-guide-character {
        width: 65px;
        height: 65px;
        flex-basis: 65px;
        border-radius: 18px;
    }
    .educatic-hero-guide.is-docked .educatic-guide-bubble { width: 248px; max-width: calc(100vw - 94px); }
}
@media (max-width: 345px) {
    .educatic-guide-bubble { width: 81%; }
    .educatic-guide-topic { max-width: 63px; }
}
@media (prefers-reduced-motion: reduce) {
    .educatic-guide-character.is-reacting { animation: none !important; }
    .educatic-guide-bubble {
        animation: none !important;
        transition: none !important;
    }
    .educatic-guide-sprite, .educatic-guide-fallback,
    .educatic-guide-chip { transition: none !important; }
}
