@font-face {
    font-family: 'Barcelona ITC Std';
    src: url('./fonts/Barcelona/Barcelona_ITC_Std_Bold.otf') format('opentype');
    font-weight: 700;
    font-style: normal;
}

@font-face {
    font-family: 'Barcelona ITC Std';
    src: url('./fonts/Barcelona/Barcelona_ITC_Std_Bold.otf') format('opentype');
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'SF Pro';
    src: url('./fonts/SF_Pro/SF-Pro-Text-Medium.otf') format('opentype');
    font-weight: 500;
    font-style: normal;
}

@font-face {
    font-family: 'SF Pro';
    src: url('./fonts/SF_Pro/SF-Pro-Text-Regular.otf') format('opentype');
    font-weight: 400;
    font-style: normal;
}

#game-mascot {
    display: none;
}

.logo {
    width: 75px;
    position: fixed;
    left: 15px;
    top: 15px;
    z-index: 1000;
}

.popup-message {
    position: absolute;
    top: 50%;
    left: 50%;
    margin: auto;
    transform: translate(-50%, 0);
    background: #D3CBBD;
    color: #136F31;
    border: 2px solid #BFB7A9;
    border-radius: 8px;
    padding: 16px 32px;
    font-size: 1em;
    z-index: 2000;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.15);
    pointer-events: none;
    width: 45vw;
    opacity: 0;
}

.popup-message.show {
    opacity: 1;
    transition: opacity 0.4s;
}

.popup-message.hide {
    opacity: 0;
    transition: opacity 1s;
}

.message {
    margin-bottom: 15px;
    font-size: 1em;
    font-weight: 500;
}

/* Base styles - optimized for small screens (mobile-first) */
body {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    background-color: #DDD5C7;
    margin: 0;
    color: #136F31;
    height: fit-content;
}

* {
    -webkit-tap-highlight-color: transparent;
    outline: none;
    -ms-touch-action: none;
    touch-action: none;
}

#top {
    width: 80vw;
    display: flex;
    justify-content: center;
    flex-direction: column;
    align-items: center;
}

h1 {
    font-family: 'Barcelona ITC Std', sans-serif;
    font-weight: 700;
    font-style: normal;
    font-size: 32px;
    line-height: 138%;
    letter-spacing: 0%;
    margin: 10px 0;
}

p {
    font-family: 'SF Pro', sans-serif;
    font-weight: 400;
    font-style: normal;
    font-size: 0.9rem;
    line-height: 120%;
    letter-spacing: 0%;
    text-align: center;
    margin-bottom: 5%;
}

.game-container {
    background-color: #DDD5C7;
    border-radius: 8px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100vw;
    box-sizing: border-box;
}



.game-board {
    display: grid;
    grid-template-rows: repeat(6, 1fr);
    gap: 1vw;
    margin: auto;
    margin-bottom: 8%;
}

.row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1vw;
}

.tile {
    width: 13vw;
    height: 13vw;
    /* Creates a square aspect ratio */
    position: relative;
    /* For image positioning */
    display: flex;
    /* For centering image if needed */
    justify-content: center;
    align-items: center;
    border: 2px solid rgb(191, 183, 169);
    box-sizing: border-box;
    background-color: rgba(229, 227, 224, 0.32);
    transition: background-color 0.3s ease-in-out, border-color 0.3s ease-in-out;
    overflow: hidden;
    /* Hide overflow from image */
}

.tile img {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 80%;
    /* Don't let image touch borders */
    max-height: 80%;
    object-fit: contain;
    /* Ensure image scales properly */
    opacity: 0;
    /* Hidden by default, shown when a letter is put */
    transition: opacity 0.1s ease-in-out;
    /* Faster transition for current guess */
}

.tile.revealed img {
    opacity: 1;
    /* Show image when tile is revealed after guess submit */
}


.tile.correct {
    background-color: rgba(18, 158, 80, 0.6);
    /* Green */
}

.tile.present {
    background-color: rgba(247, 220, 20, 0.6);
    /* Yellow */
}

.tile.absent {
    background-color: rgba(191, 183, 169, 0.5);
    /* Grey */
}

/* Current guess display styles (REMOVED: #current-guess-display, .guess-tile-img) */


.end-screen {
    position: fixed;
    top: 0;
    width: 100vw;
    height: 100vh;
    background: #DDD5C7;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    z-index: 100;
}

.end-screen div {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30% 10%;
}

.end-screen img {
    position: relative;
    width: 90vw;
    height: auto;
}

.end-screen.hidden {
    display: none;
}

.end-screen button {
    margin-top: 20px;
    font-size: 1.2em;
    padding: 10px 30px;
}



.hidden {
    display: none;
}

/* --- Keyboard Styles (Mobile-first) --- */
.keyboard {
    display: flex;
    flex-direction: column;
    gap: 3px;
    max-width: 100%;
    padding: 0 50px;
    margin-bottom: 15px;
    align-items: center;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: 5px;
}

.keyboard-row.last {
    border-top: solid 1px rgba(191, 183, 169, 1);
    width: 98vw;
    padding-top: 3px;
    max-width: 400px;
}

.key {
    height: 8vw;
    width: 7.5vw;
    font-size: 1rem;
    /* Font size still used for 'Enter'/'Backspace' text */
    background-color: rgba(227, 227, 227, 0.72);
    border-radius: 8px;
    cursor: pointer;
    user-select: none;
    display: flex;
    justify-content: center;
    align-items: center;
    text-transform: uppercase;
    transition: background-color 0.2s ease-in-out;
    box-sizing: border-box;
    border: none;
}



.key-clicked {
    background-color: rgba(255, 255, 255, 0.72);
    /* Blue effect */
    transition: background-color 0.01s;
}


.key.guess-button {
    width: fit-content;
    padding: 0 14px;
    background-color: rgba(18, 158, 80, 0.3);
    color: black;
    margin-left: 10px;

    font-family: SF Pro;
    font-weight: 400;
    font-style: Regular;
    font-size: 15px;
    line-height: 100%;
    letter-spacing: -4%;
    text-transform: uppercase;

}

.key.backspace {
    padding: 0 20px;
    margin-left: 5px;

}

.key.correct {
    background-color: rgba(18, 158, 80, 0.6);
}

.key.present {
    background-color: rgba(247, 220, 20, 0.6);
}

.key.absent {
    background-color: rgba(191, 183, 169, 0.5);
}

.key.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.key-image {
    height: 4.6vw;
    pointer-events: none;
}

#reset-button {
    padding: 10px 20px;
    font-size: 1.2em;
    background-color: #4CAF50;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

#reset-button:hover {
    background-color: #45a049;
}


/* --- Media Queries for Larger Screens (Tablets & Desktops) --- */
@media (min-width: 600px) {
    .game-container {
        padding: 0px;
        max-width: 500px;
    }

    #game-mascot {
        width: 25vw;
        height: auto;
        position: absolute;
        bottom: 0;
        left: 2%;
        display: block;
    }

    .logo {
        width: 140px;
        position: absolute;
        left: 20px;
        top: 25px;
    }

    h1 {
        font-family: Barcelona ITC Std;
        font-weight: 700;
        font-style: Bold;
        font-size: 48.49px;
        line-height: 138%;
        letter-spacing: 0%;

    }

    p {
        font-family: SF Pro;
        font-weight: 510;
        font-style: Medium;
        font-size: 20px;
        line-height: 120%;
        letter-spacing: 0%;
        text-align: center;
        margin: 20px 0;
        width: 500px;
    }

    .game-board {
        max-width: 350px;
        gap: 7px;
    }

    .tile {
        font-size: 2.2em;
        width: 65px;
        height: 65px;
    }

    .row {
        gap: 4px;
    }

    .message {
        font-size: 1.2em;
    }

    .keyboard {
        max-width: 450px;
    }

    .key {
        height: 53px;
        width: 48px;
        font-size: 1.1em;
    }

    .key-image {
        height: 35px;
    }

    .key.backspace {
        padding: 0 35px;
        margin-left: 10px;

    }

    .key.guess-button {
        padding: 0 25px;
        margin-left: 25px;

    }

    .keyboard-row.last {
        margin-top: 5px;
        padding-top: 8px;
    }

    .end-screen {
        position: absolute;

        background: #DDD5C7;
        display: flex;
        flex-direction: column;
        align-items: center;
        z-index: 1000;
        padding: 0;
    }

    .end-screen div{
        padding: 15% 10%;
    }

    .end-screen img {
        bottom: 0;
        position: absolute;
        left: 2%;
        height: 60vh;
        width: auto;
    }
}