/* ═══════════════════════════════════════════
   PRIMARIA — Emoji de frase
   Agregar a frases.css o en un <style> inline
   en primaria.html
═══════════════════════════════════════════ */

/* Emoji grande que aparece encima de la frase en inglés */
.fs-card-phrase-emoji {
    font-size: 3rem;
    line-height: 1;
    text-align: center;
    margin-bottom: 8px;
    /* Animación suave al cambiar de carta */
    animation: emoji-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes emoji-pop {
    0%   { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1);   opacity: 1; }
}

/* En fuente grande, el emoji también crece */
[data-font="grande"] .fs-card-phrase-emoji {
    font-size: 3.5rem;
}

/* En fuente chica, un poco más pequeño */
[data-font="chica"] .fs-card-phrase-emoji {
    font-size: 2.5rem;
}

/* SELECTOR DE GRADOS 3.1 — ESTILO STREAMING RESPONSIVE */
body .fs-selector {
    width: min(1180px, calc(100% - 40px));
    max-width: 1180px;
    margin: 34px auto 70px;
}

body .fs-selector-header {
    position: relative;
    isolation: isolate;
    min-height: 390px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    overflow: hidden;
    padding: 46px 44px;
    margin-bottom: 24px;
    border: 1px solid rgba(27,198,226,.44);
    border-radius: 26px;
    text-align: left;
    background:
        linear-gradient(90deg, rgba(2,15,22,.98) 0%, rgba(2,15,22,.91) 45%, rgba(2,15,22,.28) 77%, rgba(2,15,22,.62) 100%),
        linear-gradient(0deg, rgba(2,15,22,.92), transparent 55%),
        url('../images/dashboard/primaria.webp') center / cover no-repeat;
    box-shadow: 0 28px 64px rgba(0,0,0,.4);
}

body .fs-selector-header::before {
    content: '';
    position: absolute;
    inset: 0 0 auto;
    height: 3px;
    background: linear-gradient(90deg, #14c8e5, #746de5, transparent 88%);
}

body .grade-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 13px;
    margin-bottom: 16px;
    border: 1px solid rgba(30,203,232,.42);
    border-radius: 99px;
    background: rgba(8,101,121,.28);
    color: #32d8ef;
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .08em;
}

body .fs-selector-header h1 {
    max-width: 650px;
    margin: 0 0 14px;
    color: #fff;
    font-size: clamp(2rem, 4vw, 3.3rem);
    line-height: 1.08;
    text-shadow: 0 3px 18px rgba(0,0,0,.55);
}

body .grade-hero-accent {
    background: linear-gradient(135deg, #18c8e6, #7d75e9);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

body .fs-selector-header p {
    max-width: 610px;
    margin: 0 0 24px;
    color: #bdd2dd;
    font-size: .97rem;
    line-height: 1.65;
}

body .grade-hero-stats { display: flex; flex-wrap: wrap; gap: 9px; }
body .grade-hero-stats > div {
    min-width: 105px;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 12px;
    background: rgba(3,22,30,.62);
    backdrop-filter: blur(10px);
}
body .grade-hero-stats strong { color: #26d0e9; font-size: 1.08rem; line-height: 1.1; }
body .grade-hero-stats span { margin-top: 4px; color: #90aebc; font-size: .66rem; }

body .fs-selector-search-wrap {
    width: min(620px, 100%);
    margin: 0 auto 35px;
    border-color: rgba(32,201,226,.35);
    border-radius: 16px;
    background: rgba(5,28,36,.82);
    box-shadow: 0 12px 35px rgba(0,0,0,.22);
}

body .fs-industries-grid { display: block; }
body .fs-industry-block { margin-bottom: 42px; }
body .fs-industry-title {
    padding-bottom: 12px;
    margin-bottom: 16px;
    border-bottom: 1px solid rgba(29,196,222,.2);
    color: #42d4e9;
    font-size: .83rem;
    letter-spacing: .09em;
}

body .fs-areas-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

body .fs-area-card {
    position: relative;
    isolation: isolate;
    min-width: 0;
    min-height: 218px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    overflow: hidden;
    padding: 18px;
    border: 1px solid rgba(62,190,217,.25);
    border-radius: 17px;
    background: #061821;
    box-shadow: 0 12px 30px rgba(0,0,0,.24);
    transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
}

body .fs-area-card::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(180deg, rgba(2,13,20,.03) 4%, rgba(2,13,20,.34) 48%, rgba(2,13,20,.98) 100%);
}

body .fs-area-card:hover {
    transform: translateY(-5px);
    border-color: #20cce5;
    box-shadow: 0 18px 38px rgba(0,0,0,.4), 0 0 0 1px rgba(32,204,229,.22);
}

body .grade-card-cover {
    position: absolute;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform .35s ease;
}

body .fs-area-card:hover .grade-card-cover { transform: scale(1.045); }
body .fs-area-card > :not(.grade-card-cover) { position: relative; z-index: 2; }

body .fs-area-card-top { position: static; margin: 0; z-index: 2; }
body .fs-area-emoji-big {
    position: absolute;
    left: 14px;
    bottom: 14px;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(90,210,232,.25);
    border-radius: 11px;
    background: rgba(2,16,24,.78);
    backdrop-filter: blur(8px);
    font-size: 1.45rem;
}

body .fs-area-badges { position: absolute; top: 13px; right: 13px; }
body .fs-area-label,
body .fs-area-desc,
body .fs-area-meta,
body .fs-area-prog-bar { margin-left: 51px; }
body .fs-area-label { color: #fff; font-size: 1.03rem; text-shadow: 0 2px 10px rgba(0,0,0,.85); }
body .fs-area-desc {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    color: #a6bfca;
    font-size: .77rem;
}
body .fs-area-meta { color: #54cce0; }
body .fs-area-prog-bar { background: rgba(255,255,255,.12); }

/* Ocultar el contador de segundos en todas las pantallas. */
body .fs-countdown { display: none !important; }

@media (max-width: 900px) {
    body .fs-areas-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
    body .fs-selector { width: 100%; max-width: 100%; margin: 16px auto 50px; padding: 0 14px; }
    body .fs-selector-header {
        min-height: 470px;
        justify-content: flex-end;
        padding: 26px 18px 22px;
        border-radius: 19px;
        background:
            linear-gradient(180deg, rgba(2,15,22,.08) 0%, rgba(2,15,22,.89) 315px, rgba(2,15,22,.98) 100%),
            url('../images/dashboard/primaria.webp') 62% top / auto 365px no-repeat,
            #020f16;
    }
    body .fs-selector-header h1 { font-size: clamp(1.85rem, 9vw, 2.45rem); }
    body .fs-selector-header p { font-size: .85rem; line-height: 1.5; }
    body .grade-hero-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
    body .grade-hero-stats > div { min-width: 0; width: 100%; padding: 9px 5px; }
    body .fs-selector-search-wrap { margin-bottom: 28px; }
    body .fs-areas-grid { grid-template-columns: minmax(0, 1fr); gap: 13px; }
    body .fs-area-card { width: 100%; min-height: 0; aspect-ratio: 16 / 9; padding: 15px; }
    body .fs-area-label,
    body .fs-area-desc,
    body .fs-area-meta,
    body .fs-area-prog-bar { margin-left: 49px; }
}

@media (prefers-reduced-motion: reduce) {
    body .fs-area-card { transition: none; }
}
/* Flechas internas: recorren solo las frases del rango DEL/AL. */
.fs-card-step-nav {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 46px;
    margin-top: auto;
}

.fs-card-step-btn {
    display: inline-grid;
    place-items: center;
    width: 52px;
    height: 42px;
    padding: 0;
    border: 1px solid rgba(0, 211, 238, .55);
    border-radius: 12px;
    color: #21d4eb;
    background: rgba(0, 191, 220, .08);
    font-size: 1.05rem;
    cursor: pointer;
    transition: background .18s ease, border-color .18s ease, transform .18s ease, opacity .18s ease;
}

.fs-card-step-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    border-color: #21d4eb;
    background: rgba(0, 191, 220, .18);
}

.fs-card-step-btn:focus-visible {
    outline: 2px solid #21d4eb;
    outline-offset: 3px;
}

.fs-card-step-btn:disabled {
    opacity: .28;
    cursor: not-allowed;
}

.fs-card-step-position {
    min-width: 64px;
    color: var(--text-muted);
    font-size: .75rem;
    font-weight: 800;
    text-align: center;
    letter-spacing: .04em;
}

@media (max-width: 600px) {
    .fs-card-step-nav { gap: 9px; min-height: 42px; }
    .fs-card-step-btn { width: 46px; height: 38px; }
}

/* ═══════════════════════════════════════════
   RIVI · MAESTRO VIRTUAL POR GRADO
═══════════════════════════════════════════ */
.rivi-grade-launcher {
    position: fixed;
    z-index: 920;
    right: 18px;
    top: 52%;
    width: 116px;
    min-height: 138px;
    padding: 12px 9px 10px;
    border: 1px solid rgba(36, 211, 238, .55);
    border-radius: 25px;
    color: #eaffff;
    background: linear-gradient(155deg, rgba(5, 47, 63, .98), rgba(2, 20, 31, .98));
    box-shadow: 0 18px 48px rgba(0, 0, 0, .48), 0 0 30px rgba(0, 192, 230, .18);
    cursor: pointer;
    transform: translateY(-50%);
    transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease;
}

.rivi-grade-launcher:hover {
    transform: translateY(-50%) translateY(-4px) scale(1.025);
    border-color: #45e4ff;
    box-shadow: 0 22px 52px rgba(0, 0, 0, .55), 0 0 36px rgba(0, 209, 241, .32);
}

.rivi-grade-launcher:focus-visible { outline: 3px solid #67e8f9; outline-offset: 4px; }
.rivi-grade-launcher svg { display: block; width: 78px; height: 78px; margin: 0 auto 5px; filter: drop-shadow(0 7px 11px rgba(0, 190, 235, .3)); }
.rivi-launcher-copy { display: grid; line-height: 1.05; }
.rivi-launcher-copy b { color: #3fe5ff; font-size: 1rem; }
.rivi-launcher-copy small { margin-top: 5px; color: #a7cbd6; font-size: .64rem; font-weight: 700; }
.rivi-launcher-alert { position: absolute; top: 7px; right: 8px; display: grid; place-items: center; width: 21px; height: 21px; border: 2px solid #05202a; border-radius: 50%; color: #fff; background: #ef4759; font-size: .67rem; font-weight: 900; }

.rivi-teacher-overlay {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: grid;
    place-items: center;
    padding: 18px;
    visibility: hidden;
    opacity: 0;
    background: rgba(0, 8, 14, .78);
    backdrop-filter: blur(10px);
    transition: opacity .22s ease, visibility .22s ease;
}

.rivi-teacher-overlay.open { visibility: visible; opacity: 1; }
.rivi-teacher-window { position: relative; display: grid; grid-template-rows: 58px minmax(0, 1fr); width: min(1180px, 94vw); height: min(830px, 92vh); overflow: hidden; border: 1px solid rgba(39, 214, 240, .55); border-radius: 24px; background: #071722; box-shadow: 0 35px 110px rgba(0, 0, 0, .72), 0 0 55px rgba(0, 193, 226, .14); transform: translateY(18px) scale(.985); transition: transform .22s ease; }
.rivi-teacher-overlay.open .rivi-teacher-window { transform: none; }
.rivi-teacher-header { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 8px 12px 8px 19px; color: #ecfcff; border-bottom: 1px solid rgba(39, 214, 240, .25); background: linear-gradient(90deg, #062c3a, #071722); }
.rivi-teacher-header > div { display: flex; align-items: center; gap: 9px; min-width: 0; }
.rivi-teacher-header strong { color: #35dcf5; white-space: nowrap; }
.rivi-teacher-header small { overflow: hidden; color: #9dbbc6; text-overflow: ellipsis; white-space: nowrap; }
.rivi-teacher-dot { width: 10px; height: 10px; border-radius: 50%; background: #36e68a; box-shadow: 0 0 12px #36e68a; }
.rivi-teacher-header button { display: grid; place-items: center; width: 39px; height: 39px; flex: 0 0 auto; border: 1px solid rgba(255, 255, 255, .2); border-radius: 12px; color: #fff; background: rgba(255, 255, 255, .07); cursor: pointer; }
.rivi-teacher-header button:hover { color: #06151d; background: #35dcf5; }
.rivi-teacher-window iframe { width: 100%; height: 100%; border: 0; background: #dff6ff; }
.rivi-teacher-loading { position: absolute; z-index: 2; inset: 58px 0 0; display: grid; place-content: center; justify-items: center; gap: 13px; color: #c6e8ef; background: #071722; font-weight: 700; }
.rivi-teacher-loading span { width: 42px; height: 42px; border: 4px solid rgba(53, 220, 245, .2); border-top-color: #35dcf5; border-radius: 50%; animation: riviLoading .75s linear infinite; }
.rivi-teacher-loading.ready { display: none; }
@keyframes riviLoading { to { transform: rotate(360deg); } }

@media (max-width: 1200px) {
    .rivi-grade-launcher { right: 10px; width: 86px; min-height: 105px; padding: 8px 5px; }
    .rivi-grade-launcher svg { width: 61px; height: 61px; }
    .rivi-launcher-copy small { display: none; }
}

@media (max-width: 760px) {
    .rivi-grade-launcher { top: auto; right: 15px; bottom: 92px; width: 68px; min-height: 68px; padding: 4px; border-radius: 50%; transform: none; }
    .rivi-grade-launcher:hover { transform: translateY(-3px) scale(1.025); }
    .rivi-grade-launcher svg { width: 56px; height: 56px; margin: 0; }
    .rivi-launcher-copy { display: none; }
    .rivi-launcher-alert { top: -2px; right: -2px; }
    .rivi-teacher-overlay { padding: 0; }
    .rivi-teacher-window { width: 100%; height: 100%; border: 0; border-radius: 0; }
    .rivi-teacher-header { padding-left: 12px; }
    .rivi-teacher-header small { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .rivi-grade-launcher, .rivi-teacher-overlay, .rivi-teacher-window { transition: none; }
    .rivi-teacher-loading span { animation: none; }
}
