/* ========================================
   RHYME CHIME
   Main Stylesheet
   ======================================== */


/* ---------- BASIC SETUP ---------- */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #f7f7f2;
    font-family: Arial, Helvetica, sans-serif;
    color: #17324d;
}


/* ---------- GAME CONTAINER ---------- */

.game {
    width: 100%;
    max-width: 520px;
    min-height: 100vh;
    margin: 0 auto;
    padding: 32px 24px;
    text-align: center;
}


/* ---------- HEADER ---------- */

.game-header {
    margin-bottom: 46px;
}

.logo-row {
    display: flex;
    justify-content: center;
    align-items: center;

    gap: 10px;
}

.logo-bell {
    font-size: 34px;

    transform-origin: top center;
}

.logo {
    margin: 0;

    font-size: 38px;
    font-weight: 900;

    letter-spacing: -1.5px;

    color: #17324d;
}

.logo span {
    color: #72b84a;
}

.tagline {
    margin: 7px 0 20px;

    color: #7c8995;

    font-size: 14px;
    font-weight: 600;
}

.puzzle-number {
    display: inline-block;

    margin: 0;
    padding: 7px 12px;

    border-radius: 100px;

    background: #edf6e8;
    color: #5a9e3d;

    font-size: 12px;
    font-weight: 800;

    letter-spacing: 1.5px;
}


/* ---------- CLUE ---------- */

.clue-label {
    margin: 0 0 10px;

    font-size: 12px;
    font-weight: 800;

    letter-spacing: 1.8px;

    color: #7c8995;
}

.clue {
    margin: 0 0 28px;
    padding: 26px 22px;

    border: 1px solid #e3e6e2;
    border-radius: 20px;

    background: white;

    box-shadow:
        0 5px 18px rgba(23, 50, 77, 0.06);

    font-size: 26px;
    line-height: 1.3;

    color: #17324d;
}


/* ---------- ANSWER AREA ---------- */

.answer-area {
    display: flex;
    gap: 12px;
}

.answer-area input {
    width: 50%;
    min-width: 0;
    height: 58px;

    border: 2px solid #cfd6d2;
    border-radius: 16px;

    background: white;

    font-size: 20px;
    font-weight: bold;
    text-align: center;
    color: #17324d;

    outline: none;

    transition:
        border-color 0.15s ease,
        background-color 0.15s ease,
        color 0.15s ease;

    text-transform: uppercase;
    letter-spacing: 1px;
        
    box-shadow:
        0 3px 10px rgba(23, 50, 77, 0.04);
}

.answer-area input::placeholder {
    text-transform: none;
    letter-spacing: 0;

    color: #a4adb5;
    font-weight: 600;
}

.answer-area input:focus {
    border-color: #72b84a;
}


/* ---------- SUBMIT BUTTON ---------- */

.submit-button {
    width: 100%;
    height: 56px;

    margin-top: 16px;

    border: 0;
    border-radius: 14px;

    background: #72b84a;
    color: white;

    font-size: 19px;
    font-weight: bold;

    cursor: pointer;

    transition:
        transform 0.1s ease,
        opacity 0.2s ease;

    box-shadow:
        0 5px 12px rgba(90, 158, 61, 0.22);
}

.submit-button:active {
    transform: scale(0.98);
}

.submit-button:disabled {
    opacity: 0.5;
    cursor: default;
}


/* ---------- GAME MESSAGES ---------- */

.message {
    min-height: 28px;

    margin-top: 18px;

    font-size: 17px;
    font-weight: bold;
}

.message.correct {
    color: #5a9e3d;
}

.message.incorrect {
    color: #c94b4b;
}


/* ---------- WRONG ANSWER ---------- */

.answer-area.wrong-answer {
    animation: wrongShake 0.5s ease-in-out;
}

.answer-area.wrong-answer input {
    border-color: #d94a4a !important;
    background-color: #fff0f0 !important;
    color: #d94a4a;
}

@keyframes wrongShake {

    0% {
        transform: translateX(0);
    }

    15% {
        transform: translateX(-10px);
    }

    30% {
        transform: translateX(10px);
    }

    45% {
        transform: translateX(-8px);
    }

    60% {
        transform: translateX(8px);
    }

    75% {
        transform: translateX(-4px);
    }

    90% {
        transform: translateX(4px);
    }

    100% {
        transform: translateX(0);
    }

}


/* ---------- HINTS ---------- */

.hints {
    margin-top: 24px;
    padding-top: 28px;

    border-top: 1px solid #d9dedb;
}

.hints h3 {
    margin-top: 0;

    font-size: 16px;
}

.hint-buttons {
    display: flex;
    gap: 8px;
}

.hint-button {
    flex: 1;

    min-height: 48px;

    border: 2px solid #d9dedb;
    border-radius: 12px;

    background: white;
    color: #17324d;

    font-weight: bold;

    cursor: pointer;

    transition:
        background-color 0.15s ease,
        border-color 0.15s ease,
        transform 0.1s ease;
}

.hint-button:active {
    transform: scale(0.97);
    background: #eeeeea;
}


/* ---------- DISABLED INPUTS ---------- */

.answer-area input:disabled {
    opacity: 1;

    background: #f2f4f1;

    -webkit-text-fill-color: #17324d;
}

/* ---------- HINT STATES ---------- */

.hint-message {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;

    gap: 10px;

    min-height: 28px;
    margin: 18px 0 0;

    font-size: 16px;
    font-weight: 800;
    letter-spacing: 1.5px;

    color: #5a9e3d;
}

.hint-word {
    white-space: nowrap;
}

.hint-button:disabled {
    opacity: 0.35;
    cursor: default;
}

.hint-button.used {
    opacity: 1;

    background: #edf6e8;
    border-color: #72b84a;
    color: #5a9e3d;
}

/* ---------- SOLVED PANEL ---------- */

.solved-panel {
    display: none;

    margin-top: 12px;
    padding: 28px 20px;

    border: 2px solid #72b84a;
    border-radius: 20px;

    background: #f2faee;

    text-align: center;
}

.solved-panel.show {
    display: block;
    animation: solvedAppear 0.4s ease-out;
}

.solved-bell {
    font-size: 52px;
    line-height: 1;

    animation: ringBell 0.6s ease-in-out;
}

.solved-label {
    margin: 16px 0 6px;

    color: #5a9e3d;

    font-size: 13px;
    font-weight: bold;

    letter-spacing: 2px;
}

.solved-answer {
    margin: 8px 0;

    color: #17324d;

    font-size: 30px;
}

.solved-stats {
    margin: 8px 0 22px;

    color: #7c8995;

    font-size: 15px;
    font-weight: bold;
}


/* ---------- NEXT PUZZLE BUTTON ---------- */

.next-button {
    width: 100%;
    min-height: 52px;

    border: 0;
    border-radius: 14px;

    background: #72b84a;
    color: white;

    font-size: 17px;
    font-weight: bold;

    cursor: pointer;

    transition:
        transform 0.1s ease,
        opacity 0.2s ease;
}

.next-button:active {
    transform: scale(0.98);
}


/* ---------- SOLVE ANIMATIONS ---------- */

@keyframes solvedAppear {

    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }

}


@keyframes ringBell {

    0% {
        transform: rotate(0deg);
    }

    15% {
        transform: rotate(18deg);
    }

    30% {
        transform: rotate(-18deg);
    }

    45% {
        transform: rotate(14deg);
    }

    60% {
        transform: rotate(-14deg);
    }

    75% {
        transform: rotate(7deg);
    }

    90% {
        transform: rotate(-7deg);
    }

    100% {
        transform: rotate(0deg);
    }

}

/* ---------- SHARE BUTTON ---------- */

.share-button {
    width: 100%;
    min-height: 52px;

    margin-bottom: 10px;

    border: 2px solid #72b84a;
    border-radius: 14px;

    background: white;
    color: #5a9e3d;

    font-size: 17px;
    font-weight: bold;

    cursor: pointer;

    transition:
        transform 0.1s ease,
        background-color 0.15s ease;
}

.share-button:active {
    transform: scale(0.98);
    background: #edf6e8;
}

/* ---------- CONFETTI ---------- */

#confetti-container {
    position: fixed;
    inset: 0;

    pointer-events: none;
    overflow: hidden;

    z-index: 9999;
}

.confetti {
    position: absolute;

    bottom: -20px;

    width: 10px;
    height: 16px;

    border-radius: 2px;

    animation: confettiBurst 1.6s ease-out forwards;
}

@keyframes confettiBurst {

    0% {
        transform:
            translate(0, 0)
            rotate(0deg);

        opacity: 1;
    }

    70% {
        opacity: 1;
    }

    100% {
        transform:
            translate(
                var(--confetti-x),
                var(--confetti-y)
            )
            rotate(var(--confetti-rotation));

        opacity: 0;
    }
}

/* ---------- MOBILE ---------- */

@media (max-width: 400px) {

    .game-header {
        margin-bottom: 30px;
    }
    
    .tagline {
        margin-bottom: 14px;
    }
    
    .clue {
        padding: 20px 18px;
        margin-bottom: 22px;
    }

    .game {
        padding: 24px 18px;
    }

    .logo {
        font-size: 34px;
    }

    .clue {
        font-size: 25px;
    }

    .answer-area {
        gap: 8px;
    }

    .answer-area input {
        height: 56px;
        font-size: 18px;
    }

    .hint-buttons {
        gap: 6px;
    }

    .hint-button {
        font-size: 13px;
    }

}


/* ---------- REDUCED MOTION ---------- */

@media (prefers-reduced-motion: reduce) {

    .answer-area.wrong-answer {
        animation: none;
    }

}