/* Universal box-sizing for consistent layouts */
*, *::before, *::after {
    box-sizing: border-box;
}

/* This sets the background and font for the whole page */
body {
    font-family: 'Avenir Next', 'Helvetica Neue', Arial, sans-serif;
    background: #2b2d2e;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 10px;
    box-sizing: border-box;
}

/* The "Card" that holds the game */
.game-container {
    background: #1a1c1d;
    padding: 2.5rem;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    text-align: center;
    width: 380px;
    max-width: 100%;
    border: 3px solid #3a3c3d;
    box-sizing: border-box;
}

/* App icon styling */
.app-icon {
    width: 80px;
    height: 80px;
    margin-bottom: 1rem;
    border-radius: 18px;
}

h1 {
    color: #f4d03f;
    margin-bottom: 1.5rem;
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

/* Styling the puzzle text to make it stand out */
.scrambled-word {
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: 2px;
    color: #f4d03f;
    margin: 25px 0;
    padding: 20px;
    background: #2b2d2e;
    border-radius: 12px;
    border: 3px solid #3a3c3d;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Styling the input box */
input {
    width: 85%;
    padding: 14px 18px;
    border: 2px solid #3a3c3d;
    border-radius: 10px;
    font-size: 1.1rem;
    margin-bottom: 1.2rem;
    outline: none;
    transition: all 0.3s ease;
    font-family: inherit;
    background: #2b2d2e;
    color: #f4d03f;
    box-sizing: border-box;
    -webkit-appearance: none;
}

input:focus {
    border-color: #f4d03f;
    box-shadow: 0 0 0 3px rgba(244, 208, 63, 0.2);
}

input::placeholder {
    color: #6a6c6d;
}

/* Styling the button with a hover effect */
button {
    background: #f4d03f;
    color: #2b2d2e;
    border: none;
    padding: 13px 28px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 5px;
}

/* Only apply hover effects on devices that support hover */
@media (hover: hover) and (pointer: fine) {
    button:hover {
        transform: translateY(-2px);
        background: #f5d862;
    }
}

button:active {
    transform: translateY(0);
    opacity: 0.9;
}

.score-board {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2b2d2e;
    background: #f4d03f;
    display: inline-block;
    padding: 8px 20px;
    border-radius: 25px;
    margin-bottom: 15px;
    box-shadow: 0 3px 10px rgba(244, 208, 63, 0.4);
}

#scoreValue {
    color: #2b2d2e;
    font-weight: 700;
}


/* Hint text styling */
#hintText {
    margin-top: 1rem;
    font-size: 1.1rem;
    font-weight: 500;
    color: #f4d03f;
    min-height: 20px;
    padding: 8px;
    border-radius: 8px;
}

/* Space for the win/lose message */
#message {
    margin-top: 1.5rem;
    font-weight: 600;
    font-size: 1.05rem;
    min-height: 25px;
    padding: 5px;
    color: #f4d03f;
}

/* Mobile-specific optimizations */
@media screen and (max-width: 480px) {
    body {
        padding: 5px;
    }

    .game-container {
        padding: 1.5rem 1rem;
        border-radius: 15px;
        border-width: 2px;
    }

    .app-icon {
        width: 60px;
        height: 60px;
        margin-bottom: 0.75rem;
    }

    h1 {
        font-size: 2rem;
        margin-bottom: 1rem;
    }

    .scrambled-word {
        font-size: 1.5rem;
        padding: 15px;
        margin: 15px 0;
        min-height: 50px;
        letter-spacing: 1px;
    }

    input {
        width: 90%;
        padding: 16px 14px;
        font-size: 16px; /* Prevents zoom on iOS */
        margin-bottom: 1rem;
    }

    button {
        padding: 14px 20px;
        font-size: 0.95rem;
        margin: 4px;
        width: calc(100% - 8px);
        max-width: 300px;
        /* Better touch targets for mobile */
        min-height: 44px;
    }

    .score-board {
        font-size: 1.1rem;
        padding: 6px 16px;
        margin-bottom: 12px;
    }

    #hintText {
        font-size: 1rem;
        margin-top: 0.75rem;
    }

    #message {
        font-size: 1rem;
        margin-top: 1rem;
    }
}

/* Extra small screens */
@media screen and (max-width: 360px) {
    .game-container {
        padding: 1.25rem 0.75rem;
    }

    h1 {
        font-size: 1.75rem;
    }

    .scrambled-word {
        font-size: 1.35rem;
        padding: 12px;
    }

    button {
        font-size: 0.9rem;
        padding: 12px 16px;
    }
}

/* Landscape orientation on mobile */
@media screen and (max-height: 600px) and (orientation: landscape) {
    body {
        align-items: flex-start;
        padding-top: 10px;
        padding-bottom: 10px;
    }

    .game-container {
        padding: 1rem;
        margin: 10px 0;
    }

    .app-icon {
        width: 50px;
        height: 50px;
        margin-bottom: 0.5rem;
    }

    h1 {
        font-size: 1.5rem;
        margin-bottom: 0.75rem;
    }

    .scrambled-word {
        margin: 10px 0;
        padding: 10px;
        min-height: 40px;
    }

    input {
        margin-bottom: 0.75rem;
        padding: 10px 14px;
    }

    button {
        padding: 10px 16px;
        margin: 3px;
    }

    #message, #hintText {
        margin-top: 0.75rem;
    }
}