/* ── RESET & BASE ── */
:where(#app) *,
:where(#app) *::before,
:where(#app) *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
.app-container {
    max-width: 720px;
    width: 100%;
    background: #ffffffdd;
    backdrop-filter: blur(4px);
    background: #FFFFFF;
    border-radius: 48px 48px 32px 32px;
    box-shadow: 0 20px 60px rgba(180, 120, 100, 0.20), 0 8px 24px rgba(0, 0, 0, 0.06);
    padding: 32px 28px 40px;
    position: relative;
    overflow: hidden;
    border: 2px solid #FDE7E9;
    transition: all 0.2s;
}
@media (max-width: 500px) {
    .app-container {
        padding: 20px 16px 32px;
        border-radius: 32px 32px 24px 24px;
    }
}

/* ── TYPOGRAPHY ── */
h1,
h2,
h3 {
    font-weight: 600;
    letter-spacing: -0.01em;
}
h1 {
    font-size: 2.2rem;
    color: #C13F4A;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
h1 small {
    font-size: 1rem;
    font-weight: 400;
    color: #617389;
    margin-left: 4px;
}
h2 {
    font-size: 1.6rem;
    color: #C13F4A;
    margin-bottom: 8px;
}
h3 {
    font-size: 1.2rem;
    color: #2F4A6B;
    font-weight: 500;
}
.sub-head {
    color: #617389;
    font-size: 1rem;
    margin-bottom: 20px;
}

/* ── BUTTONS ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    border-radius: 60px;
    padding: 14px 32px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
    touch-action: manipulation;
    user-select: none;
    text-align: center;
    min-height: 56px;
    min-width: 48px;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.06);
}
.btn:active {
    transform: scale(0.96);
}
.btn-primary {
    background: #FDE7E9;
    color: #123B6D;
    box-shadow: 0 6px 0 #E95762;
}
.btn-primary:hover:not(:disabled) {
    background: #F5A0A6;
    transform: translateY(-2px);
    box-shadow: 0 8px 0 #E95762;
}
.btn-primary:disabled {
    opacity: 0.5;
    transform: none;
    box-shadow: 0 4px 0 #E95762;
    cursor: not-allowed;
}
.btn-success {
    background: #CDE8CF;
    color: #1F5A26;
    box-shadow: 0 6px 0 #429748;
}
.btn-success:hover:not(:disabled) {
    background: #CDE8CF;
    transform: translateY(-2px);
    box-shadow: 0 8px 0 #429748;
}
.btn-soft {
    background: #EFE3CD;
    color: #2F4A6B;
    box-shadow: 0 4px 0 #EFE3CD;
}
.btn-soft:hover {
    background: #EFE3CD;
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #EFE3CD;
}
.btn-outline {
    background: transparent;
    border: 2.5px solid #EFE3CD;
    color: #2F4A6B;
    box-shadow: none;
}
.btn-outline:hover {
    background: #FFF8EA;
    border-color: #EFE3CD;
}
.btn-small {
    padding: 8px 18px;
    font-size: 0.9rem;
    min-height: 40px;
    min-width: 40px;
}
.btn-icon {
    min-width: 48px;
    min-height: 48px;
    padding: 0 14px;
    border-radius: 60px;
    font-size: 1.2rem;
    background: #FFF8EA;
    border: none;
    cursor: pointer;
    transition: 0.15s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.btn-icon:hover {
    background: #EFE3CD;
    transform: scale(1.04);
}
.btn-icon:active {
    transform: scale(0.92);
}
.btn-growup {
    background: transparent;
    border: 2px dashed #EFE3CD;
    color: #2F4A6B;
    font-size: 0.9rem;
    padding: 8px 18px;
    border-radius: 40px;
    cursor: pointer;
    transition: 0.15s;
    font-family: inherit;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-growup:hover {
    background: #FFF8EA;
    border-color: #EFE3CD;
}

/* ── INPUTS ── */
.input-group {
    margin-bottom: 18px;
}
.input-group label {
    display: block;
    font-weight: 600;
    color: #2F4A6B;
    margin-bottom: 4px;
    font-size: 0.95rem;
}
.input-group .hint {
    font-weight: 400;
    color: #617389;
    font-size: 0.95rem;
    margin-left: 6px;
}
input,
textarea {
    width: 100%;
    padding: 14px 18px;
    font-size: 1.1rem;
    font-family: inherit;
    border: 2.5px solid #EFE3CD;
    border-radius: 24px;
    background: #FFFFFF;
    transition: 0.15s;
    color: #123B6D;
    outline: none;
    min-height: 56px;
}
input:focus,
textarea:focus {
    border-color: #EFE3CD;
    box-shadow: 0 0 0 4px #FDE7E980;
    background: #ffffff;
}
input::placeholder,
textarea::placeholder {
    color: #EFE3CD;
    font-weight: 300;
}
textarea {
    min-height: 90px;
    resize: vertical;
    border-radius: 20px;
}
.input-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.input-row .input-group {
    flex: 1;
    min-width: 140px;
}

/* ── CARD / PANEL ── */
.panel {
    background: #FFF8EA;
    border-radius: 32px;
    padding: 24px 28px;
    border: 2px solid #FDE7E9;
    margin-bottom: 20px;
}
.panel-soft {
    background: #FFF8EA;
    border-color: #EFE3CD;
}
.panel-centered {
    text-align: center;
}

/* ── PROGRESS ── */
.progress-wrap {
    margin: 8px 0 16px;
}
.progress-bar-bg {
    background: #EFE3CD;
    border-radius: 60px;
    height: 14px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.04);
}
.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #FDE7E9, #D99F2E);
    border-radius: 60px;
    transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.progress-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #617389;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    flex-wrap: wrap;
    gap: 2px;
}
.progress-labels span {
    padding: 2px 6px;
    border-radius: 30px;
    background: transparent;
    transition: 0.2s;
    white-space: nowrap;
}
.progress-labels span.done {
    color: #357A3A;
    background: #E8F4E9;
}
.progress-labels span.active {
    color: #C13F4A;
    background: #FDE7E9;
    font-weight: 700;
}

/* ── LEVEL QUESTION ── */
.level-question {
    font-size: 1.5rem;
    font-weight: 600;
    color: #123B6D;
    margin: 8px 0 16px;
    line-height: 1.3;
}
.level-question .emoji-big {
    font-size: 2rem;
    display: inline-block;
    margin-right: 8px;
}
.answer-reveal {
    background: #FFF8EA;
    border-radius: 24px;
    padding: 16px 20px;
    margin: 12px 0 16px;
    font-size: 1.2rem;
    border: 2px solid #EFE3CD;
    color: #123B6D;
    font-weight: 500;
    word-break: break-word;
}
.feedback {
    font-size: 1.05rem;
    padding: 12px 16px;
    border-radius: 20px;
    margin: 10px 0 14px;
    background: #FFF8EA;
    min-height: 48px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.feedback.hint {
    background: #FFF8EA;
    border: 2px solid #EFE3CD;
}
.feedback.success {
    background: #E8F4E9;
    border: 2px solid #429748;
    color: #1F5A26;
}
.feedback.teach {
    background: #FFF8EA;
    border: 2px solid #EFE3CD;
    font-weight: 500;
}

/* ── CELEBRATION OVERLAY ── */
.celebration-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.4s ease;
}
.celebration-overlay.open {
    display: flex;
}
.celebration-card {
    background: #FFFFFF;
    border-radius: 64px;
    padding: 40px 36px 48px;
    max-width: 520px;
    width: 100%;
    text-align: center;
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.25);
    animation: popIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 3px solid #FDE7E9;
    position: relative;
    overflow: hidden;
}
.celebration-card .big-emoji {
    font-size: 4.5rem;
    display: block;
    margin-bottom: 8px;
    line-height: 1.2;
}
.celebration-card h2 {
    font-size: 2.2rem;
    color: #C13F4A;
    margin: 8px 0 12px;
}
.celebration-card p {
    font-size: 1.15rem;
    color: #2F4A6B;
    margin-bottom: 20px;
    line-height: 1.4;
}
.confetti-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1001;
    overflow: hidden;
}
.confetti-piece {
    position: absolute;
    width: 12px;
    height: 12px;
    top: -20px;
    border-radius: 2px;
    animation: confettiFall linear forwards;
}

/* ── PIN DIALOG ── */
.pin-overlay {
    position: fixed;
    inset: 0;
    z-index: 900;
    background: rgba(0, 0, 0, 0.30);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.25s ease;
}
.pin-overlay.open {
    display: flex;
}
.pin-card {
    background: #FFFFFF;
    border-radius: 48px;
    padding: 32px 28px 36px;
    max-width: 420px;
    width: 100%;
    text-align: center;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.20);
    border: 2px solid #FDE7E9;
    animation: popIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.pin-card h3 {
    font-size: 1.4rem;
    margin-bottom: 6px;
}
.pin-card p {
    color: #617389;
    margin-bottom: 18px;
    font-size: 0.95rem;
}
.pin-input-row {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}
.pin-input-row input {
    width: 180px;
    text-align: center;
    font-size: 1.6rem;
    letter-spacing: 8px;
    padding: 10px 12px;
    min-height: 60px;
    border-radius: 30px;
}
.pin-error {
    color: #C13F4A;
    font-size: 0.9rem;
    margin-top: 8px;
    min-height: 24px;
}

/* ── SETUP FORM ── */
.setup-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 16px;
}
.setup-grid .full-width {
    grid-column: 1 / -1;
}
@media (max-width: 500px) {
    .setup-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .setup-grid .full-width {
        grid-column: 1;
    }
}

/* ── UTILITY ── */
.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}
.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}
.mt-8 {
    margin-top: 8px;
}
.mt-16 {
    margin-top: 16px;
}
.mt-20 {
    margin-top: 20px;
}
.mb-8 {
    margin-bottom: 8px;
}
.mb-16 {
    margin-bottom: 16px;
}
.gap-8 {
    gap: 8px;
}
.gap-12 {
    gap: 12px;
}
.text-center {
    text-align: center;
}
.text-muted {
    color: #617389;
    font-size: 0.9rem;
}
.hidden {
    display: none !important;
}
.w-full {
    width: 100%;
}
.relative {
    position: relative;
}

/* ── ANIMATIONS ── */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}
@keyframes popIn {
    0% {
        transform: scale(0.85) translateY(20px);
        opacity: 0;
    }
    100% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}
@keyframes confettiFall {
    0% {
        transform: translateY(0) rotate(0deg) scale(1);
        opacity: 1;
    }
    100% {
        transform: translateY(110vh) rotate(720deg) scale(0.3);
        opacity: 0;
    }
}
@keyframes float {
    0%,
    100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-6px);
    }
}
.float {
    animation: float 2.4s ease-in-out infinite;
}

/* ── RESPONSIVE TWEAKS ── */
@media (max-width: 480px) {
    .level-question {
        font-size: 1.25rem;
    }
    .celebration-card {
        padding: 28px 20px 32px;
        border-radius: 40px;
    }
    .celebration-card h2 {
        font-size: 1.6rem;
    }
    .celebration-card .big-emoji {
        font-size: 3.2rem;
    }
    .btn {
        font-size: 1rem;
        padding: 12px 22px;
        min-height: 48px;
    }
    .panel {
        padding: 16px 16px;
    }
    .app-container {
        padding: 16px 12px 24px;
    }
    input,
    textarea {
        font-size: 1rem;
        padding: 12px 14px;
        min-height: 48px;
    }
    h1 {
        font-size: 1.6rem;
    }
    .pin-input-row input {
        width: 140px;
        font-size: 1.4rem;
        letter-spacing: 6px;
        min-height: 50px;
    }
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: #FFF8EA;
    border-radius: 10px;
}
::-webkit-scrollbar-thumb {
    background: #EFE3CD;
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: #EFE3CD;
}

/* ── SPEAKER BUTTON STYLING ── */
.speaker-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 4px 0;
}
.speaker-wrap .btn-icon {
    font-size: 1.3rem;
    min-width: 44px;
    min-height: 44px;
    padding: 0 10px;
    background: #FFF8EA;
    border-radius: 60px;
    border: none;
    cursor: pointer;
    transition: 0.15s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.speaker-wrap .btn-icon:hover {
    background: #EFE3CD;
    transform: scale(1.05);
}
.speaker-wrap .btn-icon:active {
    transform: scale(0.92);
}
.speaker-wrap .btn-icon.speaking {
    background: #EFE3CD;
    animation: pulse 0.8s ease infinite;
}
@keyframes pulse {
    0%,
    100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.08);
    }
}

/* ── COMPLETED LEVEL BADGE ── */
.badge-complete {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #E8F4E9;
    color: #2A612E;
    padding: 4px 14px 4px 10px;
    border-radius: 40px;
    font-size: 0.95rem;
    font-weight: 600;
}
.badge-locked {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #EFE3CD;
    color: #617389;
    padding: 4px 14px 4px 10px;
    border-radius: 40px;
    font-size: 0.95rem;
    font-weight: 500;
}

/* ── STATUS ROW ── */
.status-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    margin: 4px 0 12px;
    align-items: center;
}
.status-row .level-dot {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.95rem;
    padding: 4px 12px 4px 8px;
    border-radius: 40px;
    background: #FFF8EA;
    color: #617389;
    font-weight: 500;
}
.status-row .level-dot.done {
    background: #E8F4E9;
    color: #2A612E;
}
.status-row .level-dot.active {
    background: #FDE7E9;
    color: #C13F4A;
    font-weight: 700;
    border: 2px solid #EFE3CD;
}

/* ── FINAL CELEBRATION SPECIAL ── */
.final-stars {
    font-size: 3rem;
    letter-spacing: 8px;
    display: block;
    margin: 4px 0;
}
    
