@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Nunito', 'Segoe UI', sans-serif;
    background: #f0f4f8;
    min-height: 100vh;
    color: #0f172a;
    overflow-x: hidden;
}

.screen {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

.screen.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes wiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-5deg); }
    75% { transform: rotate(5deg); }
}

@keyframes press {
    0% { transform: translateY(0) scale(1); }
    50% { transform: translateY(4px) scale(0.98); box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
    100% { transform: translateY(0) scale(1); }
}

@keyframes tilt-left {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(-15deg); }
}

@keyframes tilt-right {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(15deg); }
}

/* Login Screen */
.login-container {
    max-width: 480px;
    margin: 60px auto;
    background: #ffffff;
    padding: 45px;
    border-radius: 24px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.08);
}

.login-container h1 {
    text-align: center;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 30px;
    font-size: 32px;
    font-weight: 800;
}

.login-tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 30px;
    background: #f8fafc;
    padding: 6px;
    border-radius: 16px;
}

.tab {
    flex: 1;
    padding: 14px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 12px;
    font-size: 17px;
    font-weight: 700;
    transition: all 0.2s;
    color: #64748b;
}

.tab.active {
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.login-form {
    display: none;
}

.login-form.active {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

.login-form h2 {
    margin-bottom: 25px;
    color: #0f172a;
    font-size: 24px;
    font-weight: 700;
    text-align: center;
}

input {
    width: 100%;
    padding: 18px 20px;
    margin-bottom: 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 17px;
    font-family: 'Nunito', sans-serif;
    font-weight: 600;
    transition: all 0.2s;
    background: #f8fafc;
    color: #0f172a;
}

input:focus {
    outline: none;
    border-color: #6366f1;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

button {
    width: 100%;
    padding: 18px;
    margin-bottom: 12px;
    border: none;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    font-family: 'Nunito', sans-serif;
    position: relative;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

button:active {
    animation: press 0.2s;
}

button.secondary {
    background: linear-gradient(135deg, #64748b 0%, #475569 100%);
    box-shadow: 0 4px 12px rgba(100, 116, 139, 0.3);
}

/* Child Dashboard */
.dashboard-header {
    background: #ffffff;
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.child-info {
    display: flex;
    align-items: center;
    gap: 18px;
    font-size: 22px;
    font-weight: 700;
    color: #0f172a;
}

.avatar {
    font-size: 56px;
    animation: bounce 2s infinite;
    cursor: pointer;
    transition: transform 0.3s;
}

.avatar:hover {
    transform: scale(1.2) rotate(10deg);
}

.stats {
    display: flex;
    gap: 16px;
}

.stat {
    background: #ffffff;
    padding: 12px 24px;
    border-radius: 16px;
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border: 2px solid #f1f5f9;
    transition: transform 0.2s;
}

.stat:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.btn-logout {
    width: auto;
    padding: 12px 24px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.adventure-map {
    max-width: 1200px;
    margin: 50px auto;
    padding: 20px;
}

.adventure-map h2 {
    text-align: center;
    color: #0f172a;
    margin-bottom: 40px;
    font-size: 36px;
    font-weight: 800;
}

.subjects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 30px;
}

.subject-card {
    background: #ffffff;
    padding: 35px;
    border-radius: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    border: 2px solid #f1f5f9;
}

.subject-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 12px 32px rgba(0,0,0,0.12);
    border-color: #6366f1;
}

.subject-icon {
    font-size: 72px;
    margin-bottom: 18px;
}

.subject-card:hover .subject-icon {
    animation: bounce 0.6s;
}

.subject-card h3 {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
    font-size: 22px;
    font-weight: 800;
}

.subject-card p {
    color: #64748b;
    font-size: 16px;
    font-weight: 600;
}

/* Lesson List */
#lesson-list {
    max-width: 900px;
    margin: 50px auto;
    padding: 20px;
}

.btn-back {
    background: #ffffff;
    color: #6366f1;
    width: auto;
    padding: 14px 28px;
    margin-bottom: 25px;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

#subject-title {
    color: #0f172a;
    font-size: 38px;
    margin-bottom: 35px;
    text-align: center;
    font-weight: 800;
}

#lessons-container {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.lesson-card {
    background: #ffffff;
    padding: 24px;
    border-radius: 16px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border: 2px solid #f1f5f9;
}

.lesson-card:hover {
    transform: translateX(8px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    border-color: #6366f1;
}

.lesson-card.completed {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border-color: #10b981;
}

.lesson-info h3 {
    color: #0f172a;
    margin-bottom: 8px;
    font-size: 20px;
    font-weight: 700;
}

.lesson-info p {
    color: #64748b;
    font-size: 15px;
    font-weight: 600;
}

.lesson-status {
    font-size: 32px;
    animation: pulse 2s infinite;
}

/* Game Screen */
.game-header {
    background: #ffffff;
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    gap: 20px;
}

.hearts {
    display: flex;
    gap: 12px;
    font-size: 32px;
}

.heart {
    animation: pulse 1.5s infinite;
}

.heart.lost {
    opacity: 0.2;
    animation: none;
}

.progress-bar {
    flex: 1;
    max-width: 320px;
    height: 20px;
    background: #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #8b5cf6);
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

.combo-display {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 24px;
    font-weight: 800;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.4);
    animation: pulse 0.5s infinite;
}

.combo-text {
    display: flex;
    align-items: center;
    gap: 4px;
}

.game-content {
    max-width: 900px;
    margin: 50px auto;
    padding: 20px;
}

.question-text {
    background: #ffffff;
    padding: 35px;
    border-radius: 20px;
    font-size: 26px;
    text-align: center;
    margin-bottom: 35px;
    color: #0f172a;
    font-weight: 700;
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
    line-height: 1.5;
    border: 2px solid #f1f5f9;
}

.game-area {
    background: #ffffff;
    padding: 45px;
    border-radius: 20px;
    min-height: 320px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
    border: 2px solid #f1f5f9;
}

/* Multiple Choice & Common Buttons */
.choice-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.choice-btn {
    padding: 32px;
    font-size: 20px;
    font-weight: 700;
    border: 3px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Nunito', sans-serif;
    color: #0f172a;
}

.choice-btn:hover {
    border-color: #6366f1;
    transform: scale(1.03);
    background: #ffffff;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.2);
}

.choice-btn:active {
    animation: press 0.2s;
}

.choice-btn.correct {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border-color: #10b981;
    animation: pulse 0.5s;
}

.choice-btn.incorrect {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border-color: #ef4444;
    animation: wiggle 0.5s;
}

.choice-btn.disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* Sorting Game - Enhanced with Toy Chests */
.sorting-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.sorting-items {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-radius: 16px;
    min-height: 100px;
    border: 3px solid #fbbf24;
}

.sorting-item {
    padding: 18px 28px;
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    color: #0f172a;
    border: 3px solid #e2e8f0;
    border-radius: 16px;
    cursor: grab;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    user-select: none;
    animation: fadeIn 0.5s ease-out backwards;
}

.sorting-item:nth-child(2) { animation-delay: 0.1s; }
.sorting-item:nth-child(3) { animation-delay: 0.2s; }
.sorting-item:nth-child(4) { animation-delay: 0.3s; }

.sorting-item:hover {
    transform: scale(1.1) rotate(-3deg);
    border-color: #6366f1;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.3);
}

.sorting-item:active {
    cursor: grabbing;
    transform: scale(1.05) rotate(-1deg);
}

.sorting-item.dragging {
    opacity: 0.6;
    cursor: grabbing;
    transform: scale(1.15) rotate(5deg);
}

.sorting-baskets {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.sorting-basket {
    background: linear-gradient(135deg, #e0e7ff 0%, #ddd6fe 100%);
    border: 4px dashed #8b5cf6;
    border-radius: 20px;
    padding: 20px;
    min-height: 200px;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.sorting-basket::before {
    content: '🧺';
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 40px;
    opacity: 0.3;
}

.sorting-basket.drag-over {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-color: #f59e0b;
    border-style: solid;
    box-shadow: 0 0 30px rgba(245, 158, 11, 0.5);
    transform: scale(1.03);
}

.basket-header {
    font-size: 22px;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 15px;
    text-align: center;
    padding: 14px;
    background: linear-gradient(135deg, #ffffff 0%, #fef3c7 100%);
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.basket-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

@keyframes celebrateDrop {
    0% { transform: scale(1.3) rotate(10deg); }
    50% { transform: scale(0.9) rotate(-5deg); }
    100% { transform: scale(1) rotate(0deg); }
}

/* Builder Game - Puzzle Blocks */
.builder-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.builder-answer-area {
    min-height: 120px;
    padding: 24px;
    background: linear-gradient(135deg, #dbeafe 0%, #e0e7ff 100%);
    border-radius: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: center;
    border: 4px dashed #3b82f6;
    position: relative;
}

.builder-answer-area::before {
    content: '🧩 Собери здесь';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 14px;
    font-weight: 700;
    color: #3b82f6;
    opacity: 0.6;
}

.builder-tiles {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 20px;
}

.builder-tile {
    padding: 20px 32px;
    font-size: 26px;
    font-weight: 800;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    border-radius: 18px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
    border: 3px solid rgba(255,255,255,0.3);
    position: relative;
}

.builder-tile::before {
    content: '🧩';
    position: absolute;
    top: -8px;
    left: -8px;
    font-size: 20px;
    opacity: 0.7;
}

.builder-tile:hover {
    transform: scale(1.12) rotate(-3deg);
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.5);
}

.builder-tile:active {
    animation: bounceSnap 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.builder-tile.used {
    opacity: 0.25;
    pointer-events: none;
    transform: scale(0.85);
    filter: grayscale(0.8);
}

@keyframes bounceSnap {
    0% { transform: scale(1); }
    50% { transform: scale(0.9) rotate(-5deg); }
    100% { transform: scale(1.15) rotate(0deg); }
}

.builder-controls {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.builder-btn {
    padding: 14px 28px;
    font-size: 18px;
    font-weight: 700;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Nunito', sans-serif;
}

.builder-btn.undo {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.builder-btn.clear {
    background: linear-gradient(135deg, #64748b 0%, #475569 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(100, 116, 139, 0.3);
}

.builder-btn.submit {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* Matching Game - SVG Lines */
.matching-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    position: relative;
}

.matching-column {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.match-item {
    padding: 24px;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 4px solid #e2e8f0;
    border-radius: 18px;
    cursor: pointer;
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.match-item:hover {
    border-color: #6366f1;
    transform: scale(1.05);
    background: #ffffff;
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.3);
}

.match-item:active {
    animation: press 0.2s;
}

.match-item.selected {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    border-color: #6366f1;
    transform: scale(1.08);
    box-shadow: 0 8px 28px rgba(99, 102, 241, 0.5);
    animation: pulse 1s infinite;
}

.match-item.matched {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border-color: #10b981;
    color: #0f172a;
    pointer-events: none;
    animation: matchSuccess 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.match-line-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.match-line {
    stroke-width: 4;
    stroke-linecap: round;
    fill: none;
    opacity: 0;
    animation: drawLine 0.6s ease-out forwards;
}

@keyframes drawLine {
    from {
        stroke-dashoffset: 1000;
        opacity: 0;
    }
    to {
        stroke-dashoffset: 0;
        opacity: 1;
    }
}

@keyframes matchSuccess {
    0% { transform: scale(1); }
    50% { transform: scale(1.15) rotate(3deg); }
    100% { transform: scale(1) rotate(0deg); }
}

/* Scales (Comparison) Game - Animated SVG Balance */
.scales-container {
    display: flex;
    flex-direction: column;
    gap: 35px;
    align-items: center;
}

.scales-display {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

.scales-svg {
    width: 100%;
    height: 300px;
    overflow: visible;
}

.scales-beam {
    transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-origin: center;
}

.scales-beam.tilt-left {
    transform: rotate(-15deg);
}

.scales-beam.tilt-right {
    transform: rotate(15deg);
}

.scales-pan {
    transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.scales-value {
    font-size: 36px;
    font-weight: 800;
    fill: #0f172a;
}

.scales-icons {
    font-size: 24px;
}

.scales-operators {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.scales-operator-btn {
    padding: 24px 40px;
    font-size: 36px;
    font-weight: 800;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 4px solid #e2e8f0;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    color: #0f172a;
    font-family: 'Nunito', sans-serif;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.scales-operator-btn:hover {
    border-color: #6366f1;
    transform: scale(1.15);
    box-shadow: 0 8px 28px rgba(99, 102, 241, 0.3);
}

.scales-operator-btn:active {
    animation: press 0.2s;
}

.scales-operator-btn.correct {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border-color: #10b981;
    animation: pulse 0.5s;
}

.scales-operator-btn.incorrect {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border-color: #ef4444;
    animation: wiggle 0.5s;
}

/* Fill Blank Game - Story Board */
.fill-blank-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.fill-blank-sentence {
    font-size: 28px;
    font-weight: 700;
    color: #0f172a;
    line-height: 2.2;
    text-align: center;
    padding: 30px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-radius: 20px;
    border: 4px solid #fbbf24;
    position: relative;
}

.fill-blank-sentence::before {
    content: '📖';
    position: absolute;
    top: 10px;
    left: 20px;
    font-size: 32px;
}

.blank-slot {
    display: inline-block;
    min-width: 100px;
    padding: 10px 24px;
    margin: 0 8px;
    background: linear-gradient(135deg, #ffffff 0%, #fef3c7 100%);
    border: 4px dashed #f59e0b;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-weight: 800;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.1);
    position: relative;
}

.blank-slot::before {
    content: '?';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    color: #f59e0b;
    opacity: 0.3;
}

.blank-slot:hover {
    background: #fde68a;
    border-color: #d97706;
    transform: scale(1.08);
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.3);
}

.blank-slot.filled {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border-color: #3b82f6;
    border-style: solid;
    animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.blank-slot.filled::before {
    display: none;
}

.blank-slot.correct {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border-color: #10b981;
    animation: correctPop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.blank-slot.incorrect {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border-color: #ef4444;
    animation: wiggle 0.5s;
}

.fill-blank-options {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
    padding: 24px;
    background: linear-gradient(135deg, #f8fafc 0%, #e0e7ff 100%);
    border-radius: 20px;
    border: 3px solid #cbd5e1;
}

.fill-blank-option {
    padding: 20px 32px;
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    color: #0f172a;
    border: 4px solid #e2e8f0;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.fill-blank-option:hover {
    border-color: #6366f1;
    transform: scale(1.1) rotate(-2deg);
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.3);
}

.fill-blank-option:active {
    animation: press 0.2s;
}

.fill-blank-option.used {
    opacity: 0.2;
    pointer-events: none;
    transform: scale(0.9);
    filter: grayscale(0.8);
}

@keyframes popIn {
    0% { transform: scale(0.8); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

@keyframes correctPop {
    0% { transform: scale(1); }
    25% { transform: scale(1.2) rotate(5deg); }
    50% { transform: scale(0.95) rotate(-3deg); }
    75% { transform: scale(1.1) rotate(2deg); }
    100% { transform: scale(1) rotate(0deg); }
}

/* Submit Button */
.submit-btn {
    width: 100%;
    padding: 24px;
    font-size: 22px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    font-weight: 700;
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.3);
    margin-top: 20px;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(16, 185, 129, 0.4);
}

.submit-btn:active {
    animation: press 0.2s;
}

/* Hint Box */
.hint-box {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-left: 6px solid #f59e0b;
    padding: 24px;
    margin-top: 24px;
    border-radius: 16px;
    font-size: 19px;
    font-weight: 600;
    color: #0f172a;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
    animation: bounce 0.5s;
}

.hint-box.hidden {
    display: none;
}

/* AI Owl Helper */
.ai-helper-widget {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
}

.owl-button {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ec4899 0%, #8b5cf6 100%);
    border: none;
    font-size: 36px;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(236, 72, 153, 0.4);
    transition: all 0.3s;
    animation: pulse 2s infinite;
}

.owl-button:hover {
    transform: scale(1.15) rotate(10deg);
}

.ai-helper-panel {
    position: absolute;
    bottom: 90px;
    right: 0;
    width: 320px;
    background: #ffffff;
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.2);
    display: none;
}

.ai-helper-panel.active {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

.ai-helper-panel h3 {
    color: #0f172a;
    margin-bottom: 16px;
    font-size: 20px;
    font-weight: 700;
}

.ai-helper-panel p {
    color: #64748b;
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 12px;
    font-weight: 600;
}

.ai-hint-limit {
    font-size: 13px;
    color: #94a3b8;
    text-align: center;
    margin-top: 12px;
}

/* Confetti */
#confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

.confetti {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 2px;
    animation: fall 3s linear;
}

@keyframes fall {
    to {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Parent Dashboard */
.parent-header {
    background: #ffffff;
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.parent-header h1 {
    font-size: 28px;
    font-weight: 800;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

#children-list {
    max-width: 1000px;
    margin: 50px auto;
    padding: 20px;
}

.child-card {
    background: #ffffff;
    padding: 28px;
    border-radius: 20px;
    margin-bottom: 24px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
    transition: transform 0.3s;
    border: 2px solid #f1f5f9;
}

.child-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

.child-card h3 {
    color: #0f172a;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 12px;
}

.child-card p {
    color: #64748b;
    font-size: 16px;
    margin-bottom: 8px;
    font-weight: 600;
}

.ai-toggle {
    margin-top: 16px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #ec4899 0%, #8b5cf6 100%);
    border: none;
    color: white;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    width: auto;
}

/* Responsive */
/* Buratino Story Illustrations */
.buratino-story-banner {
    margin-bottom: 30px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    animation: fadeIn 0.8s ease-out;
}

.buratino-banner {
    width: 100%;
    height: auto;
    display: block;
}

.buratino-task-badge {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    animation: bounceIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.buratino-badge {
    width: 80px;
    height: 80px;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.2));
}

/* Golden Key Animation */
.golden-key {
    animation: floatKey 3s ease-in-out infinite;
    transform-origin: center;
}

@keyframes floatKey {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-15px) rotate(5deg); }
}

/* Pine Tree Sway */
.pine-tree {
    animation: sway 4s ease-in-out infinite;
    transform-origin: bottom center;
}

@keyframes sway {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-2deg); }
    75% { transform: rotate(2deg); }
}

/* Lantern Flame Flicker */
.flame {
    animation: flicker 1.5s ease-in-out infinite;
}

@keyframes flicker {
    0%, 100% { opacity: 1; transform: scale(1); }
    25% { opacity: 0.85; transform: scale(1.05) translateY(-2px); }
    50% { opacity: 0.9; transform: scale(0.98) translateY(1px); }
    75% { opacity: 0.95; transform: scale(1.02) translateY(-1px); }
}

/* Pitcher Shake */
.pitcher {
    animation: shake 2s ease-in-out infinite;
    transform-origin: bottom center;
}

@keyframes shake {
    0%, 100% { transform: translateX(0) rotate(0deg); }
    25% { transform: translateX(-2px) rotate(-1deg); }
    50% { transform: translateX(0) rotate(0deg); }
    75% { transform: translateX(2px) rotate(1deg); }
}

/* Canvas Opening Door */
.canvas {
    animation: canvasPulse 3s ease-in-out infinite;
}

@keyframes canvasPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.02); opacity: 0.95; }
}

.secret-door {
    animation: doorReveal 4s ease-in-out infinite;
}

@keyframes doorReveal {
    0%, 70%, 100% { opacity: 0; }
    85% { opacity: 0.4; }
}

/* Door with Keyhole */
.door {
    animation: doorShake 2.5s ease-in-out infinite;
}

@keyframes doorShake {
    0%, 90%, 100% { transform: translateX(0); }
    92%, 96% { transform: translateX(-2px); }
    94%, 98% { transform: translateX(2px); }
}

.keyhole {
    animation: keyholeGlow 2s ease-in-out infinite;
}

@keyframes keyholeGlow {
    0%, 100% { opacity: 1; filter: drop-shadow(0 0 3px #ffd700); }
    50% { opacity: 0.7; filter: drop-shadow(0 0 8px #ffd700); }
}

/* Theater Curtain Wave */
.curtain {
    animation: curtainWave 3s ease-in-out infinite;
    transform-origin: top center;
}

@keyframes curtainWave {
    0%, 100% { transform: scaleY(1); }
    50% { transform: scaleY(1.02); }
}

/* Sparkles Animation */
.sparkles circle {
    animation: sparkleShine 1.5s ease-in-out infinite;
}

.sparkle.s1 { animation-delay: 0s; }
.sparkle.s2 { animation-delay: 0.3s; }
.sparkle.s3 { animation-delay: 0.6s; }
.sparkle.s4 { animation-delay: 0.9s; }

@keyframes sparkleShine {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.5); }
}

/* Success Particles for Buratino Stories */
.success-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

.success-particles .particle {
    position: absolute;
    font-size: 24px;
    animation: particleBurst 1.5s ease-out forwards;
    opacity: 1;
}

@keyframes particleBurst {
    0% {
        transform: translateY(0) scale(0) rotate(0deg);
        opacity: 1;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: translateY(-150px) scale(1.5) rotate(360deg);
        opacity: 0;
    }
}

@keyframes bounceIn {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    60% {
        transform: scale(1.2) rotate(10deg);
        opacity: 1;
    }
    100% {
        transform: scale(1) rotate(0deg);
    }
}

@media (max-width: 768px) {
    .choice-grid {
        grid-template-columns: 1fr;
    }

    .subjects-grid {
        grid-template-columns: 1fr;
    }

    .matching-container {
        grid-template-columns: 1fr;
    }

    .sorting-baskets {
        grid-template-columns: 1fr;
    }

    .scales-display {
        flex-direction: column;
        gap: 20px;
    }

    .dashboard-header {
        flex-direction: column;
        gap: 16px;
    }

    .game-header {
        flex-wrap: wrap;
    }

    .stats {
        flex-wrap: wrap;
        justify-content: center;
    }

    .progress-bar {
        width: 100%;
        max-width: 100%;
    }

    .combo-display {
        font-size: 18px;
        padding: 6px 16px;
    }

    .login-container {
        margin: 30px 20px;
        padding: 30px;
    }

    .adventure-map h2 {
        font-size: 28px;
    }

    .ai-helper-widget {
        bottom: 20px;
        right: 20px;
    }

    .ai-helper-panel {
        width: 280px;
    }

    .question-text {
        font-size: 22px;
        padding: 28px;
    }

    .game-area {
        padding: 30px;
    }

    .fill-blank-sentence {
        font-size: 22px;
    }

    .scales-side {
        font-size: 28px;
        padding: 24px;
    }

    .scales-operator-btn {
        padding: 20px 32px;
        font-size: 32px;
    }

    .buratino-badge {
        width: 60px;
        height: 60px;
    }
}




/* Comic Book Slider */

.story-card.comic-mode { max-width: 680px; margin: 0 auto; padding: 20px; border-radius: 22px; background: #fff; box-shadow: 0 12px 32px rgba(15,23,42,0.1); border: 3px solid #e2e8f0; }

.comic-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }

.comic-badge { background: #fef3c7; color: #b45309; font-weight: 700; padding: 5px 12px; border-radius: 999px; font-size: 0.9rem; }

.comic-counter { font-weight: 700; color: #64748b; font-size: 0.95rem; }

.comic-viewport { background: #f8fafc; border: 2px solid #cbd5e1; border-radius: 18px; overflow: hidden; }

.comic-illustration { width: 100%; background: #e0f2fe; border-bottom: 2px solid #cbd5e1; line-height: 0; }

.comic-svg { width: 100%; height: auto; max-height: 270px; display: block; }

.comic-caption { padding: 18px 20px; font-size: 1.15rem; line-height: 1.6; color: #1e293b; font-weight: 500; min-height: 115px; }

.comic-dots { display: flex; justify-content: center; gap: 8px; margin: 14px 0; }

.comic-dot { width: 11px; height: 11px; border-radius: 50%; border: none; background: #cbd5e1; cursor: pointer; padding: 0; transition: all 0.2s; }

.comic-dot.active { width: 28px; border-radius: 999px; background: #6366f1; }

.comic-controls { display: flex; gap: 12px; justify-content: space-between; }

.comic-nav-btn { flex: 1; padding: 14px 18px; border-radius: 14px; border: none; font-size: 1.05rem; font-weight: 700; cursor: pointer; }

.comic-nav-btn.prev { background: #e2e8f0; color: #334155; }

.comic-nav-btn.prev:disabled { opacity: 0.4; cursor: not-allowed; }

.comic-nav-btn.next { background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff; }

.comic-nav-btn.next.finish { background: linear-gradient(135deg, #10b981, #059669); }


.story-cover-img { display: block; max-width: 100%; max-height: 340px; margin: 0 auto 20px; border-radius: 16px; object-fit: contain; box-shadow: 0 8px 24px rgba(15,23,42,0.14); border: 2px solid #e2e8f0; background: #fff; }
