/* kids.css */
:root {
    --bg-color: #FFF0F5;
    --primary: #FF98B8;
    --primary-dark: #E81A63;
    --text-color: #73003A;
    --white: #FFFFFF;
    /* Navbar variables (mismas que landing) */
    --primary-color: #FC2680;
    --secondary-purple: #793AB8;
    --text-dark: #333333;
    --shadow: 0 2px 10px rgba(0,0,0,0.08);
    --transition: all 0.3s ease;
    --border-radius: 30px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

body {
    font-family: 'Quicksand', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.menu-body {
    overflow-y: auto;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

.app-header {
    text-align: center;
    padding: 15px 20px;
    background: var(--white);
    box-shadow: 0 4px 15px rgba(255, 152, 184, 0.2);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.app-header .back-btn {
    position: absolute;
    left: 20px;
    color: var(--primary-dark);
    font-size: 1.5rem;
    text-decoration: none;
}

.logo-area {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.logo-area .logo {
    width: 40px;
    height: auto;
}

.logo-area h1 {
    font-family: 'Fredoka One', cursive;
    color: var(--primary);
    font-size: 2rem;
    letter-spacing: 1px;
}

.subtitle {
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
    color: #666;
    margin-top: 5px;
    padding-bottom: 10px;
}

/* Menu Area */
.menu-area {
    padding: 40px 20px;
    flex: 1;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.game-card {
    background: var(--white);
    border-radius: 20px;
    padding: 30px 20px;
    text-align: center;
    text-decoration: none;
    color: var(--text-color);
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    transition: transform 0.3s;
}

.game-card:active, .game-card:hover {
    transform: translateY(-5px);
}

.game-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 15px;
    color: white;
    font-size: 2.5rem;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.game-card h3 {
    font-family: 'Fredoka One', cursive;
    font-size: 1.5rem;
    color: var(--primary-dark);
    margin-bottom: 10px;
}

.offline-badge {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #FF98B8;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    z-index: 100;
}

/* Modal Victory */
.victory-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.victory-content {
    background: white;
    padding: 40px;
    border-radius: 30px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(255, 152, 184, 0.4);
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.victory-icon {
    font-size: 4rem;
    color: #FFD700;
    margin-bottom: 20px;
}

.victory-content h2 {
    font-family: 'Fredoka One', cursive;
    color: var(--primary-dark);
    font-size: 2rem;
    margin-bottom: 10px;
}

.victory-content p {
    color: #666;
    margin-bottom: 25px;
    font-size: 1.1rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 25px;
    font-size: 1.1rem;
    font-weight: bold;
    font-family: 'Quicksand', sans-serif;
    border-radius: 30px;
    cursor: pointer;
    text-decoration: none;
    width: 100%;
    margin-bottom: 15px;
}

.btn-secondary {
    background: #E0E0E0;
    color: #555;
}

/* Common Game Layout */
.game-area {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    position: relative;
}

/* Draw Specific */
.canvas-wrapper {
    background: var(--white);
    width: 100%;
    height: 100%;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    overflow: hidden;
    border: 4px solid var(--white);
    position: relative;
}
#drawing-canvas {
    width: 100%; height: 100%; display: block; touch-action: none;
}
.toolbar {
    background: var(--white);
    padding: 15px 20px;
    box-shadow: 0 -4px 15px rgba(255, 152, 184, 0.2);
    border-top-left-radius: 25px;
    border-top-right-radius: 25px;
}
.colors-palette {
    display: flex; justify-content: center; gap: 15px; margin-bottom: 15px; flex-wrap: wrap;
}
.color-btn {
    width: 40px; height: 40px; border-radius: 50%; border: 4px solid transparent; cursor: pointer;
}
.color-btn.active { transform: scale(1.15); border-color: #DFDFDF; }
.eraser-btn { display: flex; justify-content: center; align-items: center; border: 2px solid #E0E0E0 !important; color: #555; font-size: 1.2rem; background: #fff;}
.eraser-btn.active { border: 4px solid var(--primary) !important; color: var(--primary); }
.actions { display: flex; justify-content: space-between; gap: 15px;}
.size-picker { flex: 1; display: flex; align-items: center; }
.size-picker input { width: 100%; accent-color: var(--primary); }
.action-btn { background: #F5F5F5; border: none; padding: 10px 15px; border-radius: 20px; font-weight: 700; cursor: pointer; font-size: 0.9rem;}
.action-btn.save { background: var(--primary); color: var(--white); }

/* Memory Specific */
.memory-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    max-width: 500px;
    width: 100%;
}
.memory-card {
    aspect-ratio: 1;
    background: var(--white);
    border-radius: 10px;
    cursor: pointer;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.5s;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.memory-card.flipped { transform: rotateY(180deg); }
.memory-card .front, .memory-card .back {
    position: absolute; width: 100%; height: 100%;
    backface-visibility: hidden;
    border-radius: 10px;
    display: flex; justify-content: center; align-items: center;
    font-size: 2.5rem;
}
.memory-card .front { background: var(--primary); color: white; }
.memory-card .back { background: var(--white); transform: rotateY(180deg); }

/* Puzzle Specific */
.jigsaw-board {
    width: 300px;
    height: 300px;
    background: #eee;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 0;
    border: 5px solid white;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    border-radius: 10px;
    overflow: hidden;
}
.jigsaw-piece {
    background-size: 300px 300px;
    background-image: url('https://res.cloudinary.com/dwoau0ajc/image/upload/v1753327639/WhatsApp_Image_2025-07-23_at_19.59.09_yd4dtt.png'); /* domhe logo base */
    cursor: pointer;
    transition: transform 0.2s, opacity 0.2s;
}
.jigsaw-piece.empty { opacity: 0; pointer-events: none; }

/* ============================================================
   NAVBAR — igual que landing page
   ============================================================ */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(250, 246, 241, 0.97);
    backdrop-filter: blur(10px);
    z-index: 1000;
    padding: 10px 0;
    transition: var(--transition);
    box-shadow: none;
}

.navbar.scrolled {
    box-shadow: var(--shadow);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 70px;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 15px;
    height: 60px;
}

.logo-img {
    width: 50px;
    height: auto;
}

.logo-text img {
    width: 200px;
    height: 55px;
    object-fit: contain;
}

.logo-text {
    text-decoration: none;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 25px;
    align-items: center;
}

.nav-link {
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 600;
    transition: var(--transition);
    position: relative;
    font-size: 15px;
    font-family: 'Quicksand', sans-serif;
}

.nav-link:hover {
    color: var(--primary-color);
}

.nav-link::after {
    content: "";
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: var(--transition);
}

.nav-link:hover::after {
    width: 100%;
}

.kids-nav-link {
    color: #FF98B8 !important;
    font-weight: 700;
}

.login-btn {
    background: var(--primary-color);
    color: var(--white) !important;
    padding: 8px 20px;
    border-radius: var(--border-radius);
}

.login-btn:hover {
    background: var(--secondary-purple);
}

.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
    gap: 5px;
    background: none;
    border: none;
    padding: 4px;
}

.bar {
    width: 25px;
    height: 3px;
    background: var(--text-dark);
    border-radius: 3px;
    transition: var(--transition);
    display: block;
}

/* ── Kids menu con navbar ────────────────────────────────────── */
.kids-menu-container {
    padding-top: 90px;
    height: auto;
    min-height: 100vh;
}

.kids-hero {
    text-align: center;
    padding: 30px 20px 10px;
}

.kids-hero-title {
    font-family: 'Fredoka One', cursive;
    color: var(--primary);
    font-size: 2.8rem;
    margin-bottom: 8px;
}

.subtitle {
    text-align: center;
    font-weight: 600;
    font-size: 0.95rem;
    color: #777;
    padding-bottom: 6px;
}

/* ============================================================
   JUEGO DE MATEMÁTICAS
   ============================================================ */

/* Permite seleccionar/escribir en inputs dentro del juego */
.math-area input {
    user-select: text;
    -webkit-user-select: text;
}

.math-area {
    flex-direction: column;
    align-items: center;
    gap: 18px;
    padding: 20px 16px 30px;
    overflow-y: auto;
}

/* ── Barra de ositos ──────────────────────────────────────── */
.bears-bar {
    text-align: center;
    width: 100%;
    max-width: 480px;
}

.bears-track {
    display: flex;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.bear-unit {
    font-size: 1.9rem;
    filter: grayscale(100%) opacity(0.28);
    transition: filter 0.4s ease, transform 0.3s ease;
    display: inline-block;
}

.bear-unit.filled {
    filter: none;
    transform: scale(1.15);
    animation: bearPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes bearPop {
    0%   { transform: scale(0.5); }
    70%  { transform: scale(1.35); }
    100% { transform: scale(1.15); }
}

.bears-label {
    font-size: 0.82rem;
    color: #999;
    font-weight: 600;
}

/* ── Tarjeta de la pregunta ───────────────────────────────── */
.math-card {
    background: var(--white);
    border-radius: 28px;
    padding: 32px 28px 24px;
    box-shadow: 0 10px 32px rgba(255, 152, 184, 0.22);
    width: 100%;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.math-op-display {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    justify-content: center;
}

.op-num {
    font-family: 'Fredoka One', cursive;
    font-size: 4rem;
    color: var(--text-color);
    line-height: 1;
}

.op-sign {
    font-family: 'Fredoka One', cursive;
    font-size: 3.5rem;
    color: var(--primary);
    line-height: 1;
}

.op-eq {
    font-family: 'Fredoka One', cursive;
    font-size: 3.5rem;
    color: #aaa;
    line-height: 1;
}

.op-unknown {
    font-family: 'Fredoka One', cursive;
    font-size: 4rem;
    color: var(--primary-dark);
    line-height: 1;
}

/* ── Input y botón ────────────────────────────────────────── */
.math-input-row {
    display: flex;
    gap: 12px;
    width: 100%;
    align-items: center;
}

.math-input {
    flex: 1;
    padding: 14px 18px;
    font-size: 1.6rem;
    font-family: 'Fredoka One', cursive;
    font-weight: 400;
    color: var(--text-color);
    border: 3px solid #FFD6E8;
    border-radius: 16px;
    background: #FFF8FB;
    text-align: center;
    outline: none;
    transition: border-color 0.2s;
    /* quitar flechas de number input */
    -moz-appearance: textfield;
}

.math-input::-webkit-outer-spin-button,
.math-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.math-input:focus { border-color: var(--primary); }

.math-input.pulse {
    animation: inputPulse 0.35s ease;
}

@keyframes inputPulse {
    0%, 100% { border-color: #FFD6E8; }
    50%       { border-color: var(--primary-dark); transform: scale(1.03); }
}

.math-check-btn {
    background: var(--primary-dark);
    color: white;
    border: none;
    width: 56px;
    height: 56px;
    border-radius: 16px;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.15s;
    flex-shrink: 0;
}

.math-check-btn:active { transform: scale(0.92); }
.math-check-btn:hover  { background: #C2004F; }

/* ── Feedback ─────────────────────────────────────────────── */
.math-feedback {
    font-family: 'Fredoka One', cursive;
    font-size: 1.4rem;
    text-align: center;
    min-height: 2rem;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.25s, transform 0.25s;
}

.math-feedback.show {
    opacity: 1;
    transform: translateY(0);
}

.feedback-correct { color: #25C16A; }
.feedback-wrong   { color: var(--primary-dark); }

/* ── Shake ────────────────────────────────────────────────── */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%       { transform: translateX(-8px); }
    40%       { transform: translateX(8px); }
    60%       { transform: translateX(-6px); }
    80%       { transform: translateX(6px); }
}

.math-card.shake {
    animation: shake 0.45s ease;
}

/* ── Marcador ─────────────────────────────────────────────── */
.math-score {
    display: flex;
    gap: 24px;
    font-size: 0.9rem;
    font-weight: 700;
}

.score-correct { color: #25C16A; }
.score-wrong   { color: var(--primary-dark); }

/* ── Botón reset ──────────────────────────────────────────── */
.math-reset {
    width: auto;
    padding: 10px 28px;
    font-size: 0.95rem;
    margin-bottom: 0;
}

/* ============================================================
   RESPONSIVE — Navbar mobile
   ============================================================ */
@media (max-width: 768px) {
    .logo-img  { width: 40px; }
    .logo-text img { width: 140px; height: 35px; }

    .nav-menu {
        position: fixed;
        left: -100%;
        top: 70px;
        flex-direction: column;
        background: var(--white);
        width: 100%;
        text-align: center;
        transition: 0.3s;
        box-shadow: var(--shadow);
        padding: 20px 0;
        gap: 0;
    }

    .nav-menu .nav-item {
        padding: 10px 0;
        border-bottom: 1px solid #f0f0f0;
    }

    .nav-menu.active { left: 0; }

    .hamburger { display: flex; }

    .hamburger.active .bar:nth-child(1) { transform: translateY(8px) rotate(45deg); }
    .hamburger.active .bar:nth-child(2) { opacity: 0; }
    .hamburger.active .bar:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

    .kids-menu-container { padding-top: 80px; }

    .op-num, .op-unknown { font-size: 3rem; }
    .op-sign, .op-eq     { font-size: 2.5rem; }
    .bear-unit            { font-size: 1.6rem; }
}
