/* ── reset & base ── */
:where(#app) *,
:where(#app) *::before,
:where(#app) *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}


.app-wrapper {
    max-width: 720px;
    width: 100%;
    background: #ffffff;
    border-radius: 56px 56px 40px 40px;
    box-shadow: 0 16px 48px rgba(210, 150, 180, 0.20), 0 4px 16px rgba(210, 150, 180, 0.10);
    padding: 28px 24px 32px;
    transition: all 0.2s;
    border: 2px solid #FDE7E9;
}

/* ── header ── */
.game-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 12px;
    margin-bottom: 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 1.1rem;
    font-weight: 700;
    color: #C13F4A;
    letter-spacing: -0.3px;
}
.brand-heart {
    font-size: 1.5rem;
    line-height: 1;
}

.level-badge {
    background: #FDE7E9;
    padding: 4px 14px;
    border-radius: 40px;
    font-size: 1rem;
    font-weight: 700;
    color: #C13F4A;
    box-shadow: inset 0 1px 3px rgba(196, 74, 108, 0.10);
    white-space: nowrap;
}

.header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-startover {
    background: transparent;
    border: 1.5px solid #EFE3CD;
    color: #617389;
    padding: 4px 12px;
    border-radius: 30px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    font-family: inherit;
    line-height: 1.4;
}
.btn-startover:hover {
    background: #FDE7E9;
    border-color: #C13F4A;
    color: #C13F4A;
}

/* ── progress row ── */
.progress-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 14px;
    margin-bottom: 20px;
    background: #FFF8EA;
    padding: 10px 16px;
    border-radius: 40px;
}

.progress-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #2F4A6B;
    white-space: nowrap;
}
.progress-label span {
    color: #C13F4A;
}

.progress-track {
    flex: 1;
    min-width: 80px;
    height: 12px;
    background: #EFE3CD;
    border-radius: 30px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.04);
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #F07C85, #E95762);
    border-radius: 30px;
    transition: width 0.5s ease;
}

.progress-count {
    font-size: 0.95rem;
    font-weight: 700;
    color: #2F4A6B;
    white-space: nowrap;
    min-width: 70px;
    text-align: right;
}

/* ── problem card ── */
.problem-card {
    background: #FFFFFF;
    border-radius: 40px;
    padding: 28px 20px 24px;
    box-shadow: 0 2px 12px rgba(210, 150, 180, 0.10);
    border: 2px solid #FDE7E9;
    margin-bottom: 18px;
    transition: border-color 0.3s;
}

.problem-display {
    text-align: center;
    font-size: 2.6rem;
    font-weight: 700;
    color: #123B6D;
    letter-spacing: 1px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 4px 12px;
    margin-bottom: 16px;
}
.problem-display .op {
    color: #C13F4A;
}
.problem-display .eq {
    color: #617389;
}

.answer-area {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 12px 16px;
    margin-top: 6px;
}

.answer-input {
    font-size: 2.4rem;
    font-weight: 700;
    width: 130px;
    max-width: 70%;
    padding: 12px 8px;
    border: 3px solid #EFE3CD;
    border-radius: 30px;
    text-align: center;
    font-family: inherit;
    background: #ffffff;
    color: #123B6D;
    transition: border-color 0.25s, box-shadow 0.25s;
    outline: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
    -moz-appearance: textfield;
    appearance: textfield;
}
.answer-input::-webkit-inner-spin-button,
.answer-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
}
.answer-input:focus {
    border-color: #E95762;
    box-shadow: 0 0 0 4px rgba(217, 108, 138, 0.15);
}
.answer-input:disabled {
    opacity: 0.6;
    background: #FFF8EA;
}

.btn-check {
    font-size: 1.2rem;
    font-weight: 700;
    padding: 12px 30px;
    border: none;
    border-radius: 50px;
    background: #E95762;
    color: #fff;
    cursor: pointer;
    transition: 0.2s;
    font-family: inherit;
    box-shadow: 0 4px 0 #A32F3A;
    letter-spacing: 0.3px;
    touch-action: manipulation;
    min-height: 60px;
    min-width: 140px;
}
.btn-check:hover:not(:disabled) {
    background: #C13F4A;
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #A32F3A;
}
.btn-check:active:not(:disabled) {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #A32F3A;
}
.btn-check:disabled {
    opacity: 0.5;
    transform: none;
    box-shadow: 0 4px 0 #A32F3A;
    cursor: default;
}

.btn-speak {
    background: transparent;
    border: 2px solid #EFE3CD;
    border-radius: 50%;
    width: 52px;
    height: 52px;
    font-size: 1.6rem;
    cursor: pointer;
    transition: 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #C13F4A;
    background: #FFFFFF;
    touch-action: manipulation;
    flex-shrink: 0;
}
.btn-speak:hover {
    background: #FDE7E9;
    border-color: #E95762;
    transform: scale(1.04);
}
.btn-speak:active {
    transform: scale(0.94);
}

/* ── feedback ── */
.feedback-area {
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 4px;
    font-size: 1.4rem;
    font-weight: 600;
    color: #123B6D;
    text-align: center;
    border-radius: 30px;
    margin-top: 6px;
    transition: 0.2s;
    gap: 8px;
    flex-wrap: wrap;
}
.feedback-area.correct {
    color: #2A612E;
}
.feedback-area.wrong {
    color: #C13F4A;
}
.feedback-area.helped {
    color: #7A5A12;
}
.feedback-area .emoji-big {
    font-size: 2rem;
}

/* ── level complete overlay ── */
.level-complete {
    text-align: center;
    padding: 20px 8px 12px;
}
.level-complete .big-emoji {
    font-size: 4rem;
    display: block;
    margin-bottom: 8px;
}
.level-complete h2 {
    font-size: 2rem;
    color: #C13F4A;
    margin-bottom: 4px;
}
.level-complete p {
    font-size: 1.1rem;
    color: #2F4A6B;
    margin-bottom: 16px;
}

.btn-next {
    font-size: 1.4rem;
    font-weight: 700;
    padding: 16px 44px;
    border: none;
    border-radius: 50px;
    background: #429748;
    color: #fff;
    cursor: pointer;
    transition: 0.2s;
    font-family: inherit;
    box-shadow: 0 4px 0 #2A612E;
    touch-action: manipulation;
    min-height: 64px;
}
.btn-next:hover {
    background: #357A3A;
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #2A612E;
}
.btn-next:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #2A612E;
}

.btn-playagain {
    font-size: 1.4rem;
    font-weight: 700;
    padding: 16px 44px;
    border: none;
    border-radius: 50px;
    background: #F2B544;
    color: #fff;
    cursor: pointer;
    transition: 0.2s;
    font-family: inherit;
    box-shadow: 0 4px 0 #B8862A;
    touch-action: manipulation;
    min-height: 64px;
}
.btn-playagain:hover {
    background: #D99F2E;
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #B8862A;
}
.btn-playagain:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #B8862A;
}

/* ── celebration (final) ── */
.celebration {
    text-align: center;
    padding: 16px 8px;
}
.celebration .big-emoji {
    font-size: 5rem;
    display: block;
    margin-bottom: 6px;
}
.celebration h1 {
    font-size: 2.6rem;
    color: #C13F4A;
    margin-bottom: 6px;
}
.celebration p {
    font-size: 1.2rem;
    color: #2F4A6B;
    margin-bottom: 20px;
}
.celebration .confetti {
    font-size: 2.4rem;
    letter-spacing: 6px;
    display: block;
    margin-bottom: 8px;
}

/* ── status dots (for completed problems) ── */
.status-dots {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 8px;
    margin-top: 12px;
    padding: 6px 0;
}
.dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #EFE3CD;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    font-weight: 700;
    color: #617389;
    transition: 0.25s;
    border: 2px solid transparent;
}
.dot.done {
    background: #CDE8CF;
    border-color: #429748;
    color: #1F5A26;
}
.dot.helped {
    background: #FDF1D8;
    border-color: #D99F2E;
    color: #7A5A12;
}
.dot.active {
    border-color: #E95762;
    background: #FDE7E9;
    box-shadow: 0 0 0 3px rgba(217, 108, 138, 0.20);
    transform: scale(1.08);
}
.dot-number {
    font-size: 0.95rem;
    font-weight: 700;
    color: #2F4A6B;
}

/* ── confirmation modal ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(40, 20, 30, 0.50);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeIn 0.25s ease;
}
.modal-box {
    max-width: 400px;
    width: 100%;
    background: #FFFFFF;
    border-radius: 48px;
    padding: 32px 28px 28px;
    text-align: center;
    box-shadow: 0 24px 64px rgba(60, 30, 40, 0.25);
    border: 2px solid #FDE7E9;
}
.modal-box h3 {
    font-size: 1.5rem;
    color: #123B6D;
    margin-bottom: 8px;
}
.modal-box p {
    font-size: 1rem;
    color: #2F4A6B;
    margin-bottom: 20px;
}
.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}
.modal-actions button {
    font-size: 1rem;
    font-weight: 700;
    padding: 10px 28px;
    border: none;
    border-radius: 40px;
    cursor: pointer;
    font-family: inherit;
    transition: 0.2s;
    touch-action: manipulation;
    min-width: 100px;
}
.modal-btn-cancel {
    background: #EFE3CD;
    color: #2F4A6B;
}
.modal-btn-cancel:hover {
    background: #EFE3CD;
}
.modal-btn-confirm {
    background: #E95762;
    color: #fff;
    box-shadow: 0 3px 0 #A32F3A;
}
.modal-btn-confirm:hover {
    background: #C13F4A;
    transform: translateY(-2px);
    box-shadow: 0 5px 0 #A32F3A;
}
.modal-btn-confirm:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 #A32F3A;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.96);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ── utilities ── */
.hidden {
    display: none !important;
}
.mt-8 {
    margin-top: 8px;
}
.mt-12 {
    margin-top: 12px;
}
.text-center {
    text-align: center;
}
.gap-8 {
    gap: 8px;
}

/* ── responsive ── */
@media (max-width: 500px) {
    .app-wrapper {
        padding: 18px 14px 22px;
        border-radius: 36px;
    }
    .problem-display {
        font-size: 2rem;
        gap: 2px 8px;
    }
    .answer-input {
        font-size: 2rem;
        width: 100px;
        padding: 10px 6px;
    }
    .btn-check {
        font-size: 1rem;
        padding: 10px 18px;
        min-width: 100px;
        min-height: 50px;
    }
    .btn-speak {
        width: 44px;
        height: 44px;
        font-size: 1.3rem;
    }
    .feedback-area {
        font-size: 1.1rem;
        min-height: 48px;
    }
    .level-badge {
        font-size: 0.95rem;
        padding: 2px 10px;
    }
    .brand {
        font-size: 0.95rem;
    }
    .progress-row {
        padding: 8px 12px;
        gap: 6px 10px;
    }
    .progress-label {
        font-size: 0.95rem;
    }
    .progress-count {
        font-size: 0.95rem;
        min-width: 60px;
    }
    .level-complete h2 {
        font-size: 1.6rem;
    }
    .celebration h1 {
        font-size: 2rem;
    }
    .btn-next,
    .btn-playagain {
        font-size: 1.1rem;
        padding: 14px 28px;
        min-height: 54px;
    }
    .modal-box {
        padding: 24px 18px 22px;
    }
    .modal-box h3 {
        font-size: 1.3rem;
    }
    .dot {
        width: 24px;
        height: 24px;
        font-size: 0.95rem;
    }
    .status-dots {
        gap: 4px 6px;
    }
}

@media (max-width: 380px) {
    .problem-display {
        font-size: 1.6rem;
    }
    .answer-input {
        font-size: 1.6rem;
        width: 80px;
        padding: 8px 4px;
    }
    .btn-check {
        font-size: 0.9rem;
        padding: 8px 14px;
        min-width: 80px;
        min-height: 44px;
    }
    .btn-speak {
        width: 38px;
        height: 38px;
        font-size: 1.1rem;
    }
    .feedback-area {
        font-size: 0.95rem;
    }
}

/* ── print-friendly ── */
@media print {
    .app-wrapper {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    .btn-check,
    .btn-next,
    .btn-playagain,
    .btn-speak,
    .btn-startover {
        display: none !important;
    }
    .answer-input {
        border: 1px solid #999;
    }
}
    
