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

html,
body {
    min-height: 100%;
    background: #fff8f0;
    font-family: "Nunito", sans-serif;
}

body {
    display: flex;
    justify-content: center;
    padding: 16px;
}

#app {
    width: 100%;
    max-width: 520px;
}

/* Every screen hidden by default */
.screen {
    display: none;
    flex-direction: column;
    min-height: 92vh;
    padding: 20px;
}

    .screen.active {
        display: flex;
    }

/* Menu */
#scr-menu {
    align-items: center;
    justify-content: center;
    gap: 20px;
    text-align: center;
    position: relative;
}

    #scr-menu h1 {
        font-size: 2.4rem;
        font-weight: 900;
        color: #3c3489;
        line-height: 1.2;
    }

    #scr-menu p {
        color: #5f5e5a;
        font-size: 1.05rem;
    }

.menu-icon {
    font-size: 56px;
    line-height: 1;
}

.game-btn {
    width: 100%;
    max-width: 340px;
    border: none;
    border-radius: 18px;
    padding: 20px 24px;
    font-family: "Nunito", sans-serif;
    font-size: 1.15rem;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 14px;
    color: #fff;
}

    .game-btn:active {
        transform: scale(0.96);
    }

    .game-btn.builder {
        background: #7f77dd;
    }

    .game-btn.match {
        background: #1d9e75;
    }

    .game-btn .btn-icon {
        font-size: 2.2rem;
        flex-shrink: 0;
    }

    .game-btn .btn-label {
        text-align: left;
    }

        .game-btn .btn-label small {
            display: block;
            font-size: 0.82rem;
            font-weight: 700;
            opacity: 0.88;
            margin-top: 2px;
        }

#settings-btn {
    position: absolute;
    top: 0;
    right: 0;
    background: #f0edf8;
    color: #534ab7;
    border: none;
    border-radius: 12px;
    padding: 8px 14px;
    font-size: 0.9rem;
    font-weight: 800;
    cursor: pointer;
    font-family: "Nunito", sans-serif;
}

/* Top bar shared */
.top-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
    flex-shrink: 0;
}

.back-btn {
    background: #f0edf8;
    color: #534ab7;
    border: none;
    border-radius: 12px;
    padding: 9px 16px;
    font-size: 0.9rem;
    font-weight: 800;
    cursor: pointer;
    font-family: "Nunito", sans-serif;
    flex-shrink: 0;
}

.top-bar h2 {
    font-size: 1.05rem;
    font-weight: 900;
    color: #3c3489;
    flex: 1;
}

.score-pill {
    background: #faeeda;
    border-radius: 24px;
    padding: 6px 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

    .score-pill span {
        font-size: 1.05rem;
        font-weight: 900;
        color: #ba7517;
    }

/* Shared game elements */
.word-emoji {
    font-size: 5.5rem;
    line-height: 1;
    text-align: center;
    margin-bottom: 8px;
}

.word-hint {
    color: #5f5e5a;
    font-size: 0.95rem;
    font-style: italic;
    text-align: center;
    margin-bottom: 14px;
}

.section-label {
    text-align: center;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.feedback {
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 1.05rem;
    font-weight: 900;
    text-align: center;
    margin: 8px 0;
}

/* Builder */
#scr-builder {
    align-items: center;
}

.speak-btn {
    background: #e6f1fb;
    color: #185fa5;
    border: none;
    border-radius: 12px;
    padding: 8px 18px;
    font-family: "Nunito", sans-serif;
    font-size: 0.95rem;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 14px;
}

.slots {
    display: flex;
    justify-content: center;
    gap: 10px;
    min-height: 70px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.slot {
    width: 62px;
    height: 66px;
    border-radius: 16px;
    border: 3px dashed #afa9ec;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.9rem;
    font-weight: 900;
    color: #3c3489;
    background: #fff;
    cursor: default;
    user-select: none;
}

    .slot.filled {
        background: #eeedfe;
        cursor: pointer;
    }

        .slot.filled:active {
            transform: scale(0.94);
        }

.letter-bank {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}

.letter-tile {
    width: 62px;
    height: 66px;
    border-radius: 16px;
    border: none;
    background: #7f77dd;
    color: #fff;
    font-size: 1.9rem;
    font-weight: 900;
    cursor: pointer;
    font-family: "Nunito", sans-serif;
    user-select: none;
}

    .letter-tile:active {
        transform: scale(0.91);
    }

    .letter-tile.used {
        opacity: 0.3;
        pointer-events: none;
    }

.clear-btn {
    background: #f0edf8;
    color: #534ab7;
    border: none;
    border-radius: 12px;
    padding: 9px 22px;
    font-size: 0.95rem;
    font-weight: 800;
    cursor: pointer;
    font-family: "Nunito", sans-serif;
    margin-top: 4px;
}

/* Match */
#scr-match {
    align-items: center;
}

.match-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    width: 100%;
    max-width: 360px;
    margin: 0 auto 8px;
}

.match-btn {
    background: #fff;
    color: #3c3489;
    border: 3px solid #afa9ec;
    border-radius: 18px;
    padding: 18px 10px;
    font-size: 1.5rem;
    font-weight: 900;
    cursor: pointer;
    font-family: "Nunito", sans-serif;
    letter-spacing: 2px;
}

    .match-btn:active {
        transform: scale(0.94);
    }

    .match-btn.correct {
        background: #c0dd97;
        border-color: #639922;
        color: #173404;
    }

    .match-btn.wrong {
        background: #f7c1c1;
        border-color: #e24b4a;
        color: #501313;
    }

/* Settings */
#scr-settings {
    gap: 14px;
}

.setting-card {
    background: #fff;
    border-radius: 16px;
    border: 2px solid #e8e6f5;
    padding: 16px 18px;
}

    .setting-card label {
        display: block;
        font-size: 0.95rem;
        font-weight: 800;
        color: #3c3489;
        margin-bottom: 8px;
    }

    .setting-card select {
        width: 100%;
        border: 2px solid #afa9ec;
        border-radius: 10px;
        padding: 8px 12px;
        font-family: "Nunito", sans-serif;
        font-size: 1rem;
        font-weight: 700;
        color: #3c3489;
        background: #fff;
    }

    .setting-card .hint {
        font-size: 0.82rem;
        color: #888780;
        margin-top: 6px;
    }

.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

    .toggle-row label {
        margin: 0;
    }

.toggle {
    width: 48px;
    height: 28px;
    border-radius: 14px;
    border: none;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
}

    .toggle.on {
        background: #7f77dd;
    }

    .toggle.off {
        background: #d3d1c7;
    }

    .toggle::after {
        content: "";
        position: absolute;
        top: 4px;
        width: 20px;
        height: 20px;
        border-radius: 50%;
        background: #fff;
    }

    .toggle.on::after {
        left: 24px;
    }

    .toggle.off::after {
        left: 4px;
    }

.save-btn {
    background: #7f77dd;
    color: #fff;
    border: none;
    border-radius: 14px;
    padding: 14px;
    font-family: "Nunito", sans-serif;
    font-size: 1.1rem;
    font-weight: 900;
    cursor: pointer;
    width: 100%;
}

/* Confetti */
#confetti-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 999;
    overflow: hidden;
    display: none;
}

.cp {
    position: absolute;
    top: -20px;
    border-radius: 3px;
    animation: fall linear forwards;
}

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

