/* === 1. Setări Generale și Fonturi === */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Fredoka', sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow-x: hidden;
}

/* Fundalul animat actualizat - Doar Albastru și Verde Estompat */
.bg-animated {
    /* Paletă: Albastru pastel, Albastru cer, Verde pal/mentă estompat, Verde foarte deschis */
    background: linear-gradient(-45deg, #a1c4fd, #c2e9fb, #d1f2eb, #e8f8f5);
    background-size: 400% 400%;
    animation: gradientAnim 15s ease infinite;
}

@keyframes gradientAnim {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* === 2. Containere și Carduri === */
.kid-container {
    background: white;
    padding: 35px;
    border-radius: 30px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.2), inset 0 0 0 10px #f8fafc;
    max-width: 500px;
    width: 100%;
    text-align: center;
    position: relative;
}

.bounce-in {
    animation: bounceIn 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes bounceIn {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* === 3. Tipografie === */
.title-fun { color: #2d3436; font-size: 2.2em; margin-bottom: 10px; text-shadow: 2px 2px 0 #f1f2f6; }
.subtitle-fun { color: #636e72; font-size: 1.2em; margin-bottom: 25px; }
.dynamic-title { color: #0369a1; font-size: 1.8em; margin-bottom: 20px; min-height: 1.5em; }

/* === 4. Pagina INDEX: Selector Dificultate === */
.form-section {
    background: #ffffff;
    border: 3px dashed #dfe6e9;
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 20px;
}

.form-section h3 { margin-bottom: 15px; color: #2d3436; font-size: 1.2em; }

.difficulty-selector {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.difficulty-selector input[type="radio"] { display: none; }

.diff-label {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px;
    border: 4px solid #f1f2f6;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
    background: #fbfbfb;
}

.diff-label .emoji { font-size: 2em; }
.diff-label .text { font-weight: 700; margin-top: 5px; color: #2d3436; }

#beginner:checked + .label-beg { border-color: #2ecc71; background-color: #e8f8f0; transform: translateY(-5px); }
#advanced:checked + .label-adv { border-color: #e67e22; background-color: #fef5ed; transform: translateY(-5px); }

/* === 5. Butoane Operații (Index & Exercise) === */
.buttons-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.btn-kid {
    padding: 18px;
    font-size: 1.1em;
    font-weight: 700;
    border: none;
    border-radius: 15px;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-kid:hover { transform: translateY(-3px); filter: brightness(1.1); }
.btn-kid:active { transform: translateY(0); }

.btn-add { background: #ff7675; box-shadow: 0 5px 0 #d63031; }
.btn-sub { background: #74b9ff; box-shadow: 0 5px 0 #0984e3; }
.btn-mul { background: #55efc4; box-shadow: 0 5px 0 #00b894; color: #2d3436; }
.btn-div { background: #ffeaa7; box-shadow: 0 5px 0 #fdcb6e; color: #2d3436; }

/* === 6. Pagina EXERCISE: Zona Matematică Verticală === */
.vertical-math-box {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    width: fit-content;
    margin: 20px auto;
    padding: 20px;
    background: #f8fafc;
    border-radius: 20px;
    border: 4px solid #f1f2f6;
}

.num-row {
    width: 100%;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.giant-num {
    font-size: 6rem;
    font-weight: 700;
    line-height: 1;
    display: inline-block;
    animation: pulse 2s infinite ease-in-out;
}

.color-1 { color: #f43f5e; }
.color-2 { color: #8b5cf6; }

.giant-operator {
    font-size: 4rem;
    margin-right: 20px;
    color: #f59e0b;
    font-weight: 700;
}

.math-line {
    width: 100%;
    height: 8px;
    background: #334155;
    border-radius: 10px;
    margin: 15px 0;
}

.huge-input {
    width: 100%;
    font-size: 3.5rem;
    text-align: center;
    border: 5px solid #e2e8f0;
    border-radius: 20px;
    padding: 10px;
    color: #059669;
    font-family: inherit;
    font-weight: 700;
}

.huge-input:focus { outline: none; border-color: #10b981; background: #f0fff4; }

/* === 7. Animații Exerciții === */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.anim-right { animation: slideR 0.6s ease-out; }
.anim-left { animation: slideL 0.6s ease-out; }

@keyframes slideR { from { transform: translateX(60px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideL { from { transform: translateX(-60px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* === 8. Butoane de Control === */
.btn-main {
    width: 100%;
    background: #10b981;
    color: white;
    border: none;
    padding: 18px;
    border-radius: 15px;
    font-size: 1.4rem;
    font-weight: 700;
    margin-top: 15px;
    cursor: pointer;
    box-shadow: 0 6px 0 #059669;
    font-family: inherit;
}

.btn-sec {
    width: 100%;
    background: #3b82f6;
    color: white;
    border: none;
    padding: 15px;
    border-radius: 15px;
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 10px;
    cursor: pointer;
    box-shadow: 0 5px 0 #2563eb;
    font-family: inherit;
}

.btn-main:active, .btn-sec:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(0,0,0,0.2); }

/* === 9. Scor și Mesaje === */
.score-tag {
    background: #f1f2f6;
    padding: 10px 20px;
    border-radius: 50px;
    display: inline-block;
    margin-top: 25px;
    font-weight: 700;
    color: #64748b;
}

.back-link {
    display: block;
    margin-top: 20px;
    color: #94a3b8;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.back-link:hover { color: #64748b; }

/* === 10. Mesaje Corect/Greșit === */
.correct-msg { color: #10ac84; font-weight: bold; animation: bounceIn 0.5s; }
.incorrect-msg { color: #ee5253; font-weight: bold; animation: shake 0.5s; }

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* === 11. Media Queries Mobil === */
@media (max-width: 480px) {
    .kid-container { padding: 20px; }
    .giant-num { font-size: 4rem; }
    .giant-operator { font-size: 2.5rem; }
    .huge-input { font-size: 2.5rem; }
    .title-fun { font-size: 1.6em; }
    .buttons-grid { grid-template-columns: 1fr; }
}

footer { margin-top: 30px; font-size: 0.85em; color: #b2bec3; }
footer a { color: #0984e3; text-decoration: none; font-weight: bold; }