:root {
    --misty-blue: #315d9b;
    --misty-blue-dark: #193d75;
    --misty-sky: #dff6ff;
    --misty-cream: #fff7dc;
    --misty-coral: #ff7b62;
    --misty-yellow: #ffc94a;
    --misty-green: #35b79a;
    --misty-ink: #18345b;
    --soft-shadow: 0 18px 50px rgba(28, 71, 116, .16);
}

html { scroll-behavior: smooth; }

body {
    min-width: 320px;
    color: var(--misty-ink);
    font-family: "Nunito", sans-serif;
    background: #eaf8fc url("../images/background.png") center top / cover fixed;
    overflow-x: hidden;
}

h1, h2, h3, h4, .navbar, .btn { font-family: "Baloo 2", sans-serif; }
a { text-underline-offset: .2em; }

.site-header {
    background: rgba(255, 255, 255, .9);
    border-bottom: 1px solid rgba(49, 93, 155, .12);
    backdrop-filter: blur(12px);
}

.navbar-brand img { display: block; width: 120px; height: 76px; object-fit: contain; }
.navbar-toggler { color: var(--misty-blue); border: 0; box-shadow: none !important; }
.nav-link { color: var(--misty-ink); font-size: 1.02rem; font-weight: 700; }
.nav-link:hover, .nav-link:focus { color: var(--misty-coral); }
.section-space { padding: 4.5rem 0; }

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: .75rem;
    color: var(--misty-blue);
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.section-title {
    margin-bottom: .75rem;
    color: var(--misty-blue-dark);
    font-size: clamp(2.15rem, 8vw, 4.4rem);
    font-weight: 800;
    line-height: .98;
}

.section-copy { max-width: 660px; color: #46627d; font-size: 1.08rem; }

.hero {
    position: relative;
    min-height: 620px;
    padding: 3.2rem 0 4.5rem;
    background: linear-gradient(180deg, rgba(255,255,255,.72), rgba(223,246,255,.26));
}

.hero::before, .hero::after {
    position: absolute;
    border: 2px solid rgba(255, 255, 255, .8);
    border-radius: 50%;
    content: "";
    animation: float 5s ease-in-out infinite;
}

.hero::before { top: 12%; right: 8%; width: 52px; height: 52px; }
.hero::after { top: 26%; right: 23%; width: 20px; height: 20px; animation-delay: -2s; }

.hero-title {
    color: var(--misty-blue-dark);
    font-size: clamp(3rem, 13vw, 6.4rem);
    font-weight: 800;
    line-height: .86;
    text-wrap: balance;
}

.hero-title span { color: var(--misty-coral); }
.hero-copy { max-width: 540px; color: #3f607e; font-size: 1.15rem; font-weight: 600; }

.btn-adventure {
    padding: .8rem 1.35rem;
    color: #fff;
    background: var(--misty-coral);
    border: 2px solid var(--misty-coral);
    border-radius: 999px;
    box-shadow: 0 10px 22px rgba(255, 123, 98, .25);
    font-size: 1.08rem;
    font-weight: 800;
}

.btn-adventure:hover, .btn-adventure:focus {
    color: #fff;
    background: #ed654d;
    border-color: #ed654d;
    transform: translateY(-2px);
}

.btn-outline-adventure {
    padding: .8rem 1.35rem;
    color: var(--misty-blue);
    background: rgba(255, 255, 255, .55);
    border: 2px solid var(--misty-blue);
    border-radius: 999px;
    font-size: 1.08rem;
    font-weight: 800;
}

.btn-outline-adventure:hover { color: #fff; background: var(--misty-blue); }

.collection-frame {
    position: relative;
    padding: .5rem;
    background: rgba(255,255,255,.7);
    border: 1px solid rgba(255,255,255,.9);
    border-radius: 1.75rem;
    box-shadow: var(--soft-shadow);
    transform: rotate(1deg);
}

.collection-frame img { width: 100%; border-radius: 1.35rem; }

.collection-badge {
    position: absolute;
    right: -.65rem;
    bottom: -.75rem;
    width: 94px;
    height: 94px;
    display: grid;
    place-content: center;
    color: var(--misty-ink);
    background: var(--misty-yellow);
    border: 5px solid #fff;
    border-radius: 50%;
    box-shadow: 0 9px 24px rgba(24,52,91,.2);
    font-family: "Baloo 2", sans-serif;
    font-size: .85rem;
    font-weight: 800;
    line-height: 1;
    text-align: center;
    transform: rotate(-8deg);
    cursor: pointer;
    transition: transform .2s ease, filter .2s ease;
}

.collection-badge:hover { filter: brightness(1.04); transform: rotate(-4deg) scale(1.04); }
.collection-badge:focus-visible { outline: 4px solid var(--misty-coral); outline-offset: 4px; }
.collection-badge.secret-bump { animation: secretBump .3s ease; }

.glass-section { background: rgba(255, 255, 255, .78); border-block: 1px solid rgba(255,255,255,.9); backdrop-filter: blur(8px); }

.shop-card {
    height: 100%;
    padding: 1.5rem;
    background: rgba(255,255,255,.82);
    border: 1px solid rgba(49,93,155,.1);
    border-radius: 1.5rem;
    box-shadow: 0 12px 28px rgba(28,71,116,.1);
    transition: transform .25s ease, box-shadow .25s ease;
}

.shop-card:hover { transform: translateY(-5px); box-shadow: var(--soft-shadow); }

.icon-bubble {
    width: 58px;
    height: 58px;
    display: grid;
    place-content: center;
    margin-bottom: 1rem;
    color: #fff;
    background: var(--misty-blue);
    border-radius: 18px;
    font-size: 1.4rem;
    transform: rotate(-5deg);
}

.shop-card:nth-child(2) .icon-bubble { background: var(--misty-green); }

.accordion-item {
    margin-bottom: .8rem;
    overflow: hidden;
    background: rgba(255,255,255,.82);
    border: 1px solid rgba(49,93,155,.12) !important;
    border-radius: 1rem !important;
}

.accordion-button {
    gap: .7rem;
    color: var(--misty-ink);
    background: transparent;
    font-family: "Baloo 2", sans-serif;
    font-size: 1.08rem;
    font-weight: 700;
    box-shadow: none !important;
}

.accordion-button:not(.collapsed) { color: var(--misty-blue); background: var(--misty-sky); }
.accordion-button i { width: 24px; color: var(--misty-coral); text-align: center; }

.character-card {
    position: relative;
    height: 100%;
    overflow: hidden;
    background: linear-gradient(145deg, #e2f7ff, #fff);
    border: 4px solid rgba(255,255,255,.95);
    border-radius: 2rem;
    box-shadow: var(--soft-shadow);
    cursor: pointer;
    transition: transform .25s ease;
}

.character-card:hover { transform: translateY(-8px) rotate(-1deg); }
.character-card:focus-visible { outline: 4px solid var(--misty-yellow); outline-offset: 4px; }
.character-card.character-pink { background: linear-gradient(145deg, #ffe4ef, #fff6d9); }
.character-card.character-green { background: linear-gradient(145deg, #dff8da, #e1f7ff); }

.character-image {
    width: 120%;
    max-width: none;
    height: 355px;
    display: block;
    object-fit: cover;
    object-position: center;
    transform: translateX(-10%);
}

.character-info {
    position: absolute;
    right: .9rem;
    bottom: .9rem;
    left: .9rem;
    padding: .9rem 1rem;
    color: #fff;
    background: rgba(25,61,117,.9);
    border-radius: 1rem;
    backdrop-filter: blur(6px);
}

.character-info h3 { margin: 0; font-size: 1.65rem; font-weight: 800; }
.character-info p { margin: 0; font-size: .9rem; }

.character-action {
    position: absolute;
    top: .8rem;
    right: .8rem;
    width: 42px;
    height: 42px;
    display: grid;
    place-content: center;
    color: var(--misty-blue);
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 6px 15px rgba(24,52,91,.15);
}

.games-cta {
    position: relative;
    overflow: hidden;
    padding: 2.5rem 1.4rem;
    color: #fff;
    background: linear-gradient(135deg, #315d9b, #24477d 65%, #163663);
    border: 5px solid rgba(255,255,255,.75);
    border-radius: 2rem;
    box-shadow: var(--soft-shadow);
}

.games-cta::before {
    position: absolute;
    top: -50px;
    right: -40px;
    width: 180px;
    height: 180px;
    background: var(--misty-yellow);
    border-radius: 50%;
    content: "";
    opacity: .95;
}

.games-icons { position: relative; z-index: 1; font-size: clamp(3.5rem, 12vw, 7rem); }
.games-icons i:first-child { color: var(--misty-yellow); transform: rotate(-14deg); }
.games-icons i:last-child { color: #91e4d3; transform: rotate(12deg); }

.news-placeholder {
    min-height: 280px;
    display: grid;
    place-items: center;
    padding: 2.5rem 1.25rem;
    background: linear-gradient(135deg, rgba(255,247,220,.9), rgba(255,255,255,.84));
    border: 2px dashed rgba(49,93,155,.28);
    border-radius: 2rem;
    text-align: center;
}

.news-placeholder i { color: var(--misty-coral); font-size: 2.4rem; }
footer { color: #e6f2ff; background: #142f58; }
.footer-logo { width: 130px; height: 88px; object-fit: contain; }
.footer-link { color: #e6f2ff; text-decoration: none; }
.footer-link:hover { color: var(--misty-yellow); }

.social-link {
    width: 44px;
    height: 44px;
    display: inline-grid;
    place-content: center;
    color: #fff;
    background: rgba(255,255,255,.11);
    border-radius: 50%;
    text-decoration: none;
    transition: transform .2s ease, background .2s ease;
}

.social-link:hover { color: #fff; background: var(--misty-coral); transform: translateY(-3px); }

.back-to-top {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 1020;
    width: 46px;
    height: 46px;
    display: grid;
    place-content: center;
    color: #fff;
    background: var(--misty-coral);
    border: 0;
    border-radius: 50%;
    box-shadow: 0 8px 20px rgba(24,52,91,.22);
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: .2s ease;
}

.back-to-top.visible { opacity: 1; pointer-events: auto; transform: translateY(0); }
.modal-content { border: 0; border-radius: 1.5rem; box-shadow: var(--soft-shadow); }
.modal-character { width: 100%; max-height: 380px; object-fit: cover; object-position: 74% center; border-radius: 1rem; }

.collector-toast {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 1090;
    max-width: min(370px, calc(100vw - 2rem));
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: 1rem 1.15rem;
    color: #fff;
    background: linear-gradient(135deg, #193d75, #315d9b);
    border: 2px solid rgba(255,255,255,.75);
    border-radius: 1rem;
    box-shadow: var(--soft-shadow);
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
    transition: .3s ease;
}

.collector-toast.visible { opacity: 1; transform: translateY(0); }
.collector-toast > i { color: var(--misty-yellow); font-size: 1.8rem; }
.collector-toast strong, .collector-toast span { display: block; }
.collector-toast span { margin-top: .1rem; font-size: .85rem; opacity: .86; }

.collector-sparkle {
    position: fixed;
    top: -2rem;
    left: var(--x);
    z-index: 1085;
    color: var(--misty-coral);
    font-size: 1.1rem;
    pointer-events: none;
    animation: sparkleFall 2s var(--delay) ease-in forwards;
}

/* Página de juegos */
.game-page { min-height: 70vh; background: linear-gradient(180deg, rgba(255,255,255,.55), rgba(223,246,255,.68)); }
.game-hero { padding: 3.8rem 0 2.5rem; }
.game-lobby, .game-panel { max-width: 1080px; margin-inline: auto; }
.game-lobby[hidden], .game-panel[hidden], .game-result[hidden] { display: none !important; }

.game-choice-card {
    height: 100%;
    overflow: hidden;
    background: rgba(255,255,255,.9);
    border: 4px solid rgba(255,255,255,.9);
    border-radius: 2rem;
    box-shadow: var(--soft-shadow);
    transition: transform .25s ease, box-shadow .25s ease;
}

.game-choice-card:hover { transform: translateY(-6px); box-shadow: 0 24px 55px rgba(28,71,116,.22); }
.game-choice-card h2 { margin-bottom: .6rem; color: var(--misty-blue-dark); font-size: clamp(2rem, 7vw, 3rem); font-weight: 800; }
.game-choice-card p { min-height: 3.25rem; color: #4a657e; }
.game-kicker { color: var(--misty-coral); font-size: .82rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }

.choice-art { position: relative; height: 225px; overflow: hidden; background: linear-gradient(135deg, #bdeeff, #fff3c6); }
.memory-art img { position: absolute; width: 118px; border: 5px solid #fff; border-radius: .8rem; box-shadow: 0 10px 20px rgba(24,52,91,.18); }
.memory-art img:first-child { top: 19px; left: calc(50% - 108px); transform: rotate(-9deg); }
.memory-art img:nth-child(2) { top: 12px; left: 50%; transform: rotate(8deg); }
.memory-art > i { position: absolute; right: 1.2rem; bottom: 1rem; color: rgba(49,93,155,.2); font-size: 3.4rem; }
.puzzle-art img { width: 100%; height: 100%; object-fit: cover; filter: saturate(.85); }
.puzzle-art::after { position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.15)); content: ""; }
.puzzle-art > i { position: absolute; right: 1.2rem; bottom: 1rem; z-index: 1; color: #fff; font-size: 4rem; filter: drop-shadow(0 5px 8px rgba(24,52,91,.3)); }

.collector-note {
    max-width: 650px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .75rem;
    margin: 2rem auto 0;
    padding: .9rem 1.15rem;
    color: #405d78;
    background: rgba(255,255,255,.65);
    border: 1px solid rgba(49,93,155,.12);
    border-radius: 999px;
    text-align: center;
}
.collector-note i { color: var(--misty-yellow); }

.game-panel {
    padding: 1rem;
    background: rgba(255,255,255,.88);
    border: 1px solid rgba(49,93,155,.12);
    border-radius: 1.5rem;
    box-shadow: var(--soft-shadow);
}

.game-panel-header { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: .5rem; margin-bottom: 1rem; }
.game-panel-header h2 { margin: 0; color: var(--misty-blue-dark); font-size: clamp(1.65rem, 6vw, 2.7rem); font-weight: 800; }
.game-panel-header .game-kicker { display: none; }
.game-back, .game-icon-button {
    min-width: 44px;
    min-height: 44px;
    display: inline-grid;
    place-content: center;
    color: var(--misty-blue);
    background: var(--misty-sky);
    border: 0;
    border-radius: 50%;
}
.game-back span { display: none; }
.game-back:hover, .game-icon-button:hover { color: #fff; background: var(--misty-blue); }

.game-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; margin-bottom: 1rem; }
.game-stats > div {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    column-gap: .5rem;
    padding: .75rem;
    background: #f3faff;
    border: 1px solid #dcecf6;
    border-radius: 1rem;
}
.game-stats i { grid-row: 1 / span 2; color: var(--misty-coral); font-size: 1.2rem; }
.game-stats span { color: #637b91; font-size: .7rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.game-stats strong { color: var(--misty-blue-dark); font-family: "Baloo 2", sans-serif; font-size: 1.15rem; line-height: 1; }
.game-stats .record-stat { background: #fff8dc; border-color: #f5df8d; }
.game-stats .record-stat i { color: #db9e00; }

.game-instruction { margin: 0 auto 1rem; color: #58718a; font-size: .9rem; text-align: center; }
.game-instruction i { color: var(--misty-blue); }

.memory-levels {
    width: max-content;
    max-width: 100%;
    display: flex;
    align-items: center;
    gap: .35rem;
    margin: 0 auto 1rem;
    padding: .4rem;
    background: #edf8fe;
    border: 1px solid #d8ebf5;
    border-radius: 999px;
}
.memory-levels span, .memory-levels small { padding-inline: .35rem; color: #607a92; font-size: .72rem; font-weight: 800; text-transform: uppercase; }
.memory-levels button { width: 38px; height: 38px; color: var(--misty-blue); background: #fff; border: 0; border-radius: 50%; font-family: "Baloo 2", sans-serif; font-weight: 800; }
.memory-levels button:hover, .memory-levels button.active { color: #fff; background: var(--misty-coral); box-shadow: 0 5px 12px rgba(255,123,98,.25); }
.memory-levels button:focus-visible { outline: 3px solid var(--misty-yellow); outline-offset: 2px; }

.memory-grid { max-width: 800px; display: grid; grid-template-columns: repeat(3, 1fr); gap: .55rem; margin-inline: auto; perspective: 1000px; }
.memory-grid[data-cards="8"], .memory-grid[data-cards="10"], .memory-grid[data-cards="12"] { grid-template-columns: repeat(4, 1fr); }
.memory-card { aspect-ratio: 2 / 3; padding: 0; background: transparent; border: 0; border-radius: .75rem; perspective: 900px; }
.memory-card:focus-visible { outline: 4px solid var(--misty-yellow); outline-offset: 3px; }
.memory-card-inner { position: relative; width: 100%; height: 100%; display: block; transform-style: preserve-3d; transition: transform .5s cubic-bezier(.2,.7,.2,1); }
.memory-card.flipped .memory-card-inner, .memory-card.matched .memory-card-inner { transform: rotateY(180deg); }
.memory-card-face { position: absolute; inset: 0; overflow: hidden; background: #fff; border: 3px solid #fff; border-radius: .75rem; box-shadow: 0 7px 16px rgba(24,52,91,.17); backface-visibility: hidden; }
.memory-card-face img { width: 100%; height: 100%; display: block; object-fit: cover; }
.memory-card-face.card-back { transform: rotateY(180deg); }
.memory-card.matched .memory-card-face { border-color: var(--misty-yellow); box-shadow: 0 0 0 3px rgba(255,201,74,.28), 0 8px 18px rgba(24,52,91,.18); }

.puzzle-wrap { max-width: 630px; margin-inline: auto; padding: .55rem; background: #fff; border-radius: 1.2rem; box-shadow: 0 12px 30px rgba(28,71,116,.17); }
.puzzle-board { aspect-ratio: 1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; overflow: hidden; background: var(--misty-blue-dark); border-radius: .8rem; }
.puzzle-tile { padding: 0; background-color: #d9f0f7; background-image: url("../games/rompecabezas/rompecabezas-1.png"); background-repeat: no-repeat; background-size: 300% 300%; border: 0; transition: transform .12s ease, filter .2s ease; }
.puzzle-tile:not(.puzzle-blank):hover { filter: brightness(1.08); }
.puzzle-tile:focus-visible { position: relative; z-index: 2; outline: 4px solid var(--misty-yellow); outline-offset: -4px; }
.puzzle-blank { background: repeating-linear-gradient(135deg, #dff6ff, #dff6ff 9px, #d5eff8 9px, #d5eff8 18px); }
.puzzle-board.wrong-move { animation: boardShake .25s ease; }
.puzzle-board.puzzle-complete { gap: 0; }
.puzzle-board.puzzle-complete .puzzle-blank { background-image: url("../games/rompecabezas/rompecabezas-1.png"); background-size: 300% 300%; background-position: 100% 100%; }

.game-actions { display: flex; flex-direction: column; gap: .75rem; justify-content: center; margin: 1.5rem 0 .5rem; }
.game-result { max-width: 650px; margin: 1.5rem auto 0; padding: 1.5rem; background: linear-gradient(135deg, #fff8d9, #fff); border: 2px solid #f6db76; border-radius: 1.5rem; text-align: center; }
.game-result h3 { margin: .5rem 0; color: var(--misty-blue-dark); font-size: 2rem; font-weight: 800; }
.result-icon { color: #e5a700; font-size: 2.5rem; }

.share-feedback {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 1100;
    max-width: calc(100vw - 2rem);
    padding: .85rem 1.1rem;
    color: #fff;
    background: var(--misty-blue-dark);
    border-radius: 999px;
    box-shadow: var(--soft-shadow);
    opacity: 0;
    pointer-events: none;
    transform: translateY(15px);
    transition: .25s ease;
}
.share-feedback.visible { opacity: 1; transform: translateY(0); }

@keyframes secretBump { 50% { transform: rotate(5deg) scale(1.12); } }
@keyframes sparkleFall { to { transform: translateY(105vh) rotate(440deg); opacity: .15; } }
@keyframes boardShake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

@keyframes float { 50% { transform: translateY(-13px); } }

@media (min-width: 768px) {
    .navbar-brand img { width: 150px; height: 92px; }
    .hero { min-height: 680px; padding: 5rem 0; }
    .section-space { padding: 6rem 0; }
    .character-image { height: 420px; }
    .games-cta { padding: 4rem; }
    .game-hero { padding: 5rem 0 3.5rem; }
    .game-panel { padding: 2rem; border-radius: 2rem; }
    .game-panel-header { grid-template-columns: 150px 1fr 150px; }
    .game-panel-header .game-kicker, .game-back span { display: inline; }
    .game-back { width: max-content; padding: .65rem 1rem; display: inline-flex; align-items: center; gap: .5rem; border-radius: 999px; font-weight: 800; }
    .game-icon-button { justify-self: end; }
    .game-stats { grid-template-columns: repeat(4, 1fr); }
    .memory-grid { gap: 1rem; }
    .memory-grid[data-cards="10"] { grid-template-columns: repeat(5, 1fr); }
    .memory-grid[data-cards="12"] { grid-template-columns: repeat(6, 1fr); }
    .memory-card-face { border-width: 5px; border-radius: 1rem; }
    .game-actions { flex-direction: row; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

.game-back{
        text-decoration: none;
    }

    .shop-card--explore .icon-bubble i {
    transition: transform .35s ease;
}

.shop-card--explore:hover .icon-bubble i {
    transform: rotate(-15deg) scale(1.15);
}