/* ── RESET & BASE ── */
:where(#app) *,
:where(#app) *::before,
:where(#app) *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
/* ── APP CONTAINER ── */
.app {
    max-width: 720px;
    width: 100%;
    background: rgba(255, 248, 240, 0.85);
    backdrop-filter: blur(4px);
    border-radius: 60px 60px 48px 48px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12), 0 8px 24px rgba(0, 0, 0, 0.06);
    padding: 28px 30px 36px;
    transition: all 0.2s ease;
    border: 2px solid rgba(255, 255, 255, 0.6);
}
@media (max-width: 500px) {
    .app {
        padding: 20px 16px 24px;
        border-radius: 40px 40px 32px 32px;
    }
}

/* ── HEADER ── */
.header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 12px;
    margin-bottom: 14px;
}
.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.3rem;
    font-weight: 700;
    color: #123B6D;
    letter-spacing: -0.3px;
}
.brand-icon {
    font-size: 1.9rem;
    line-height: 1;
}
.brand span {
    background: linear-gradient(135deg, #F2B544, #E95762);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.level-badge {
    background: #FDF1D8;
    padding: 6px 18px 6px 16px;
    border-radius: 60px;
    font-weight: 600;
    font-size: 1rem;
    color: #123B6D;
    box-shadow: inset 0 1px 4px rgba(255, 255, 255, 0.7), 0 2px 6px rgba(0, 0, 0, 0.04);
    display: flex;
    align-items: center;
    gap: 6px;
}
.level-badge .num {
    background: #FDF1D8;
    padding: 0 10px 0 8px;
    border-radius: 40px;
    font-weight: 700;
    color: #C13F4A;
}
.level-badge .of {
    font-weight: 400;
    color: #617389;
    font-size: 0.95rem;
}

/* ── PROGRESS BAR ── */
.progress-wrap {
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
}
.progress-track {
    flex: 1;
    height: 12px;
    background: #EFE3CD;
    border-radius: 40px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
}
.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #F2B544, #D99F2E);
    border-radius: 40px;
    transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.progress-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: #2F4A6B;
    white-space: nowrap;
    background: #FFF8EA;
    padding: 2px 14px 2px 12px;
    border-radius: 40px;
    line-height: 1.7;
    letter-spacing: 0.2px;
}

/* ── PROBLEM CARD ── */
.problem-card {
    background: #fffffffa;
    border-radius: 48px;
    padding: 32px 24px 28px;
    box-shadow: 0 8px 32px rgba(180, 130, 90, 0.10), 0 2px 8px rgba(0, 0, 0, 0.02);
    margin-bottom: 18px;
    border: 1px solid rgba(255, 215, 180, 0.3);
    transition: background 0.2s;
}
@media (max-width: 500px) {
    .problem-card {
        padding: 24px 16px 20px;
        border-radius: 32px;
    }
}

.problem-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px 14px;
    margin-bottom: 18px;
}
.speak-btn {
    background: #FDF1D8;
    border: none;
    border-radius: 60px;
    width: 54px;
    height: 54px;
    font-size: 1.8rem;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.speak-btn:hover {
    background: #EFE3CD;
    transform: scale(1.02);
}
.speak-btn:active {
    transform: scale(0.94);
}

.equation {
    font-size: 2.8rem;
    font-weight: 700;
    color: #123B6D;
    letter-spacing: 2px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 8px;
    background: #FFF8EA;
    padding: 6px 18px 6px 20px;
    border-radius: 60px;
    box-shadow: inset 0 1px 6px rgba(0, 0, 0, 0.02);
}
.equation .eq-part {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}
.equation .eq-sign {
    color: #617389;
    font-weight: 400;
    font-size: 2.2rem;
}
.equation .eq-num {
    min-width: 1.4rem;
    text-align: center;
}
.equation .eq-equals {
    color: #617389;
    font-weight: 400;
    font-size: 2.2rem;
}
.eq-answer-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 3.6rem;
    min-height: 3.6rem;
    background: #fff;
    border-radius: 20px;
    border: 3px dashed #EFE3CD;
    font-size: 2.2rem;
    font-weight: 700;
    color: #123B6D;
    padding: 0 6px;
    transition: border-color 0.2s, background 0.2s;
}
.eq-answer-box.filled {
    border-style: solid;
    border-color: #EFE3CD;
    background: #FFF8EA;
}
.eq-answer-box.helped {
    border-color: #F2B544;
    background: #FDF1D8;
    border-style: solid;
}
.eq-answer-box.correct {
    border-color: #429748;
    background: #E8F4E9;
    border-style: solid;
}

/* ── INPUT & CHECK ── */
.input-area {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 6px;
}
.answer-input {
    font-size: 1.8rem;
    font-weight: 600;
    width: 140px;
    padding: 12px 16px;
    border-radius: 40px;
    border: 2px solid #EFE3CD;
    background: #FFFFFF;
    text-align: center;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    color: #123B6D;
    outline: none;
}
.answer-input:focus {
    border-color: #D99F2E;
    box-shadow: 0 0 0 4px rgba(232, 130, 90, 0.15);
}
.answer-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-check {
    background: linear-gradient(145deg, #F2B544, #D99F2E);
    border: none;
    border-radius: 60px;
    padding: 12px 34px;
    font-size: 1.4rem;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.15s;
    box-shadow: 0 6px 16px rgba(232, 130, 90, 0.30);
    font-family: inherit;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.btn-check:hover:not(:disabled) {
    transform: scale(1.02);
    box-shadow: 0 8px 24px rgba(232, 130, 90, 0.35);
}
.btn-check:active:not(:disabled) {
    transform: scale(0.96);
}
.btn-check:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 4px 12px rgba(232, 130, 90, 0.15);
}

/* ── FEEDBACK ── */
.feedback {
    margin-top: 18px;
    min-height: 4.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 600;
    color: #2F4A6B;
    background: #FFF8EA;
    border-radius: 40px;
    padding: 6px 20px;
    text-align: center;
    transition: background 0.2s, color 0.2s;
    border: 1px solid rgba(255, 215, 180, 0.2);
}
.feedback.correct {
    background: #E8F4E9;
    color: #2A612E;
}
.feedback.helped {
    background: #FDF1D8;
    color: #8A5A12;
}
.feedback.tryagain {
    background: #FDF1D8;
    color: #8A5A12;
}
.feedback .emoji {
    font-size: 1.6rem;
    margin-right: 10px;
}

/* ── PROBLEM DOTS ── */
.dots-wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px 12px;
    margin-top: 16px;
    margin-bottom: 4px;
    padding: 4px 0;
}
.dot {
    width: 40px;
    height: 40px;
    border-radius: 60px;
    background: #EFE3CD;
    border: 2px solid #EFE3CD;
    transition: background 0.2s, border-color 0.2s, transform 0.15s;
    cursor: default;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 700;
    color: #617389;
    position: relative;
}
.dot.active {
    border-color: #D99F2E;
    background: #FDF1D8;
    transform: scale(1.10);
    box-shadow: 0 0 0 4px rgba(232, 130, 90, 0.15);
}
.dot.correct {
    background: #CDE8CF;
    border-color: #429748;
    color: #1F5A26;
}
.dot.helped {
    background: #FDF1D8;
    border-color: #D99F2E;
    color: #7A5A12;
}
.dot .dot-icon {
    font-size: 1.1rem;
    line-height: 1;
}
.dot .dot-num {
    font-size: 0.95rem;
    font-weight: 600;
    opacity: 0.5;
}

/* ── BOTTOM BAR ── */
.bottom-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 20px;
    padding-top: 14px;
    border-top: 2px solid rgba(220, 200, 180, 0.3);
}
.btn-startover {
    background: transparent;
    border: 2px solid #EFE3CD;
    border-radius: 60px;
    padding: 8px 22px;
    font-size: 1rem;
    font-weight: 600;
    color: #2F4A6B;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-startover:hover {
    background: #FFF8EA;
    border-color: #EFE3CD;
}
.btn-startover:active {
    transform: scale(0.96);
}

.level-status {
    font-size: 0.95rem;
    font-weight: 500;
    color: #2F4A6B;
    background: #FFF8EA;
    padding: 4px 18px 4px 16px;
    border-radius: 40px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ── MODAL / OVERLAY ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(40, 28, 20, 0.55);
    backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 24px;
    animation: fadeIn 0.3s ease;
}
.modal-overlay.open {
    display: flex;
}
@keyframes fadeIn {
    0% {
        opacity: 0;
        transform: scale(0.96);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.modal {
    background: #FFFFFF;
    border-radius: 60px;
    max-width: 500px;
    width: 100%;
    padding: 40px 36px 36px;
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.25);
    text-align: center;
    border: 2px solid rgba(255, 215, 180, 0.3);
}
@media (max-width: 500px) {
    .modal {
        padding: 32px 20px 28px;
        border-radius: 40px;
    }
}
.modal .big-icon {
    font-size: 4.2rem;
    margin-bottom: 6px;
    display: block;
}
.modal h2 {
    font-size: 2rem;
    font-weight: 700;
    color: #123B6D;
    margin-bottom: 8px;
    line-height: 1.2;
}
.modal p {
    font-size: 1.15rem;
    color: #2F4A6B;
    margin-bottom: 20px;
    line-height: 1.5;
}
.modal .btn-primary {
    background: linear-gradient(145deg, #F2B544, #D99F2E);
    border: none;
    border-radius: 60px;
    padding: 14px 44px;
    font-size: 1.4rem;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.15s;
    box-shadow: 0 6px 20px rgba(232, 130, 90, 0.30);
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}
.modal .btn-primary:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 28px rgba(232, 130, 90, 0.35);
}
.modal .btn-primary:active {
    transform: scale(0.96);
}
.modal .btn-secondary {
    background: #FDF1D8;
    border: none;
    border-radius: 60px;
    padding: 14px 36px;
    font-size: 1.2rem;
    font-weight: 600;
    color: #2F4A6B;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.modal .btn-secondary:hover {
    background: #EFE3CD;
}
.modal .btn-secondary:active {
    transform: scale(0.96);
}
.modal .btn-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 4px;
}

/* ── START OVER CONFIRM ── */
.modal-confirm .btn-group {
    margin-top: 12px;
}
.modal-confirm .btn-danger {
    background: #E95762;
    border: none;
    border-radius: 60px;
    padding: 12px 34px;
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.15s;
    box-shadow: 0 4px 16px rgba(232, 93, 74, 0.25);
    font-family: inherit;
}
.modal-confirm .btn-danger:hover {
    transform: scale(1.02);
}
.modal-confirm .btn-danger:active {
    transform: scale(0.96);
}

/* ── RESPONSIVE TWEAKS ── */
@media (max-width: 600px) {
    .equation {
        font-size: 2.2rem;
        padding: 4px 12px 4px 14px;
        gap: 2px 4px;
    }
    .equation .eq-sign,
    .equation .eq-equals {
        font-size: 1.8rem;
    }
    .eq-answer-box {
        min-width: 2.8rem;
        min-height: 2.8rem;
        font-size: 1.8rem;
        border-radius: 16px;
    }
    .answer-input {
        font-size: 1.5rem;
        width: 110px;
        padding: 10px 12px;
    }
    .btn-check {
        font-size: 1.2rem;
        padding: 10px 26px;
    }
    .speak-btn {
        width: 46px;
        height: 46px;
        font-size: 1.5rem;
    }
    .brand {
        font-size: 1.1rem;
    }
    .brand-icon {
        font-size: 1.6rem;
    }
    .level-badge {
        font-size: 0.95rem;
        padding: 4px 14px 4px 12px;
    }
    .problem-card {
        padding: 20px 12px 16px;
    }
    .feedback {
        font-size: 1rem;
        min-height: 3.6rem;
        padding: 4px 14px;
    }
    .dot {
        width: 34px;
        height: 34px;
        font-size: 0.95rem;
    }
    .modal h2 {
        font-size: 1.6rem;
    }
    .modal .big-icon {
        font-size: 3.4rem;
    }
    .modal {
        padding: 28px 16px 24px;
    }
}
@media (max-width: 400px) {
    .equation {
        font-size: 1.8rem;
    }
    .equation .eq-sign,
    .equation .eq-equals {
        font-size: 1.5rem;
    }
    .eq-answer-box {
        min-width: 2.4rem;
        min-height: 2.4rem;
        font-size: 1.5rem;
    }
    .answer-input {
        font-size: 1.3rem;
        width: 90px;
        padding: 8px 10px;
    }
    .btn-check {
        font-size: 1rem;
        padding: 8px 20px;
    }
    .problem-row {
        gap: 6px 8px;
    }
    .speak-btn {
        width: 40px;
        height: 40px;
        font-size: 1.3rem;
    }
    .dot {
        width: 28px;
        height: 28px;
        font-size: 0.95rem;
        gap: 6px;
    }
    .dots-wrap {
        gap: 6px 8px;
    }
    .brand {
        font-size: 0.95rem;
    }
}

/* ── UTILITY ── */
.hidden {
    display: none !important;
}
.text-muted {
    color: #617389;
}
.mt-1 {
    margin-top: 8px;
}
.mb-1 {
    margin-bottom: 8px;
}
.gap-1 {
    gap: 6px;
}
.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}
    
