*, body {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.full-screen-container {
    width: 100vw;
    height: 100vh; /* Fallback for older browsers */
    height: 100dvh; /* Use dynamic viewport height to account for mobile browser UI */
    /* background-color: #ff2626; /* Original color */
    background-color: #333; /* Darker page background for better contrast */
    display: flex; /* Added to center the game-container */
    justify-content: center; /* Added to center the game-container */
    align-items: center; /* Added to center the game-container */
    font-family: "Boogaloo", sans-serif;
}

.game-container {
    width: 95%; /* Example width, adjust as needed */
    height: 90%; /* Example height, adjust as needed */
    /* background-color: #a3d5ff; */
    background: #ffa3a3;
    background: linear-gradient(178deg, rgba(255, 163, 163, 1) 0%, rgba(163, 213, 255, 1) 22%, rgba(89, 180, 255, 1) 45%);
    border: 2px solid black;
    position: relative; /* Crucial for absolute positioning of duck elements */
    overflow: hidden; /* Prevents scrollbars if ducks animate slightly out of bounds */
    border-radius: 6px;
}

.title-screen, .results-screen {
    width: 100%;
    height: 100%;
    /* background-color: #a3d5ff; */
    background: #ffa3a3;
    background: linear-gradient(178deg, rgba(255, 163, 163, 1) 0%, rgba(163, 213, 255, 1) 22%, rgba(89, 180, 255, 1) 45%);
    position: relative;
    top: 0;
    left: 0;
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    font-family: "Boogaloo", sans-serif;
}

.results-screen {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 150;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    flex-direction: column;
    padding-top: 100px;
    opacity: 0;
    display: none;
}

.title-screen {
    background-color: #a3d6ff;
    padding-bottom: 100px;
}

.title-image {
    width: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.results-container {
    width: 36%;
    max-width: 420px;
    height: 230px;
    background-color: #3f3f74;
    border-radius: 8px;
    margin-top: 10px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(5, 1fr);
    gap: 5px; /* Added a small gap between grid items */
    padding: 5px; /* Added some padding inside the container */
}

.result-item {
    background-color: #ff77a8;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1em;
    border-radius: 8px;
    color: black;
    text-align: center;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.results-actions {
    width: 36%;
    max-width: 420px;
    margin-top: 16px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.results-action-btn {
    flex: 1 1 auto;
    min-width: 120px;
    padding: 12px 18px;
    font-size: 1.3em;
    font-family: "Boogaloo", sans-serif;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    background-color: #008751;
    filter: drop-shadow(2px 2px 3px rgba(0, 0, 0, 0.4));
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.results-action-btn:hover {
    background-color: #3f3f74;
}

.results-action-btn:active {
    transform: scale(0.97);
}

.results-action-btn.is-busy {
    opacity: 0.6;
    pointer-events: none;
}

#dn-share-btn {
    background-color: #29adff;
}

#dn-share-btn:hover {
    background-color: #1a8fd6;
}

#dn-save-btn {
    background-color: #ff77a8;
    color: #3f3f74;
}

#dn-save-btn:hover {
    background-color: #ff5c97;
    color: white;
}

.result-item.correct {
    /* color: #006400; */
    background-color: #29adff;
    color: white;
}

.result-item.incorrect {
    /* color: #dc143c; */ /* Remove specific color to inherit black from .result-item */
}

#title-text {
    width: 20%;
    filter: drop-shadow(2px 2px 3px rgba(0, 0, 0, 0.5));
}

.duck {
    background-color: #ff77a8;
    padding: 5px 10px;
    border: 1px solid #29adff;
    /* position: absolute; /* This is set by JavaScript */
    /* left and top are also set by JavaScript */
    cursor: default; /* Default cursor, not text selection */
    font-family: sans-serif; /* Changed from monospace for better Thai support */
    font-size: 1.5em; /* Slightly increased size for Thai characters */
    user-select: none; /* Prevents text selection during gameplay */
    /* display: inline-block; /* Ensures padding and dimensions are respected */
    border-radius: 8px;
}

.bird-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 80px;
    height: 80px;
    /* background-color: red; */ /* Removed debug color */
    background-color: transparent; /* Ensure transparency */
    overflow: hidden;
    z-index: 5; /* Optional: ensure it stays on top if other complex elements are added */
}

.bird-container-title, .bird-container-title-free {
    width: 140px;
    height: 140px;
    overflow: hidden;
    margin: 0px 30px;
}

/* Styles for the bird container when it's directly inside a .duck element */
.duck > .bird-container {
    width: 90px; /* Smaller bird on the duck */
    height: 90px;
    top: -90px;  /* Positioned above the duck (negative of its height) */
    left: 50%;
    transform: translateX(-50%); /* Horizontally center the bird above the duck */
    /* position: absolute; is inherited from .bird-container */
    /* overflow: hidden; is inherited from .bird-container */
    /* z-index can be adjusted if needed, but usually not necessary for children */
}

.bird_img {
    height: 100%;
}

.duck.targeted {
    background-color: #29adff; /* Light blue, distinct from normal yellow */
    outline: 2px solid #ff77a8; /* Dark blue outline */
    color: white;
}

.duck.typed-char { /* Class for individually styled typed characters if we go that route */
    color: green;
    font-weight: bold;
}

.duck.shot {
    background-color: #ff6347 !important; /* Tomato red */
    transform: scale(1.2);
    opacity: 0;
    transition: background-color 0.1s, transform 0.2s, opacity 0.2s 0.1s; /* Stagger opacity for a poof effect */
}

#round-indicator-container {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px; /* Space between dots */
    z-index: 125;
    opacity: 0;
}

.indicator-dot {
    width: 15px;
    height: 15px;
    border: 2px solid #555; /* Dark grey border */
    border-radius: 50%; /* Make it a circle */
    background-color: transparent; /* No fill initially */
    transition: background-color 0.3s ease;
}

.indicator-dot.active {
    background-color: #ffd700; /* Yellow */
    border-color: #e6c300;
}

.indicator-dot.shot {
    background-color: #32cd32; /* Lime Green */
    border-color: #28a428;
}

.indicator-dot.missed {
    background-color: #dc143c; /* Crimson Red */
    border-color: #b01030;
}

/* .game-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 15px 30px;
    font-size: 1.5em;
    cursor: pointer;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transition: background-color 0.3s ease;
} */

.title-container {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: row;
}

.game-button:hover {
    background-color: #3f3f74;
}

#restart-game-button {
    /* Additional specific styles if needed, e.g., different color */
    background-color: #007bff; /* Blue */
}

#restart-game-button:hover {
    background-color: #0056b3;
}

#start-game-button {
    margin-top: 4px;
}

.plays-remaining {
    color: white;
}

/* Thai keyboard styles moved to ../shared/thai-keyboard.css */

#bg-trees {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 1;
    filter: blur(2px);
}

.photographer-container {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    /* width: 200px; */
    width: 210px;
    height: 210px;
    z-index: 120;
    overflow: hidden;
    /* background-color: red; */
}

.photographer-img {
    /* transform-origin: center; */
    height: 100%;
}

.game-bg {
    z-index: 1;
}

.game-ui {
    z-index: 10;
}

.title-screen button {
    padding: 10px 20px;
    font-size: 2em;
    cursor: pointer;
    background-color: #008751;
    color: white;
    border: none;
    border-radius: 5px;
    font-family: "Boogaloo", sans-serif;
    min-width: 300px;
    margin-top: 20px;
    filter: drop-shadow(2px 2px 3px rgba(0, 0, 0, 0.5));
}

#bird-free1 {
    /* background-color: red; */
    position: absolute;
    width: 140px;
    height: 140px;
    bottom: -20px;
    left: 54%;
}

.keyboard-language {
    margin-top: 20px;
    font-size: 1.2em;
    color: white;
}

/* ---------------------------------------------------------------------BIRD ANIMATIONS --------------------------------------------------------------------- */

.bird_fly_right {
    animation: fly_right 0.5s steps(4) infinite;
}

.bird_fly_front {
    animation: fly_front 0.4s steps(4) infinite;
}

.bird_fly_back {
    animation: fly_back 0.45s steps(4) infinite;
}

.bird_idle {
    animation: bird_idle 1s steps(7) infinite;
}
.photo_idle {
    animation: photo_idle 3s steps(3) infinite;
}

.photo_gotcha {
    animation: photo_gotcha 0.4s steps(1) infinite;
}

.photo_look_left {
    animation: photo_look_left 0.4s steps(1) infinite;
}

.photo_snap_left {
    animation: photo_snap_left 0.4s steps(1) infinite;
}

.photo_look_right {
    animation: photo_look_right 0.4s steps(1) infinite;
}

.photo_snap_right {
    animation: photo_snap_right 0.4s steps(1) infinite;
}

.photo_look_around {
    animation: photo_look_around 2s steps(2) infinite;
}

@keyframes fly_right {
    0% {
        transform: translate3d(0, 0, 0);
    }
    100% {
        transform: translate3d(calc(100% * -4/23), 0, 0);
    }
}

@keyframes fly_front {
    0% {
        transform: translate3d(calc(100% * -4/23), 0, 0);
    }
    100% {
        transform: translate3d(calc(100% * -8/23), 0, 0);
    }
}

@keyframes fly_back {
    0% {
        transform: translate3d(calc(100% * -8/23), 0, 0);
    }
    100% {
        transform: translate3d(calc(100% * -12/23), 0, 0);
    }
}

@keyframes bird_idle {
    0% {
        transform: translate3d(calc(100% * -16/23), 0, 0);
    }
    100% {
        transform: translate3d(calc(100% * -23/23), 0, 0);
    }
}

@keyframes photo_idle {
    0% {
        transform: translate3d(0, 0, 0);
    }
    100% {
        transform: translate3d(calc(100% * -3/8), 0, 0);
    }
}

@keyframes photo_gotcha {
    0% {
        transform: translate3d(calc(100% * -7/8), 0, 0);
    }
    100% {
        transform: translate3d(calc(100% * -7/8), 0, 0);
    }
}

@keyframes photo_look_left {
    0% {
        transform: translate3d(calc(100% * -4/8), 0, 0);
    }
    100% {
        transform: translate3d(calc(100% * -4/8), 0, 0);
    }
}

@keyframes photo_snap_left {
    0% {
        transform: translate3d(calc(100% * -6/8), 0, 0);
    }
    100% {
        transform: translate3d(calc(100% * -6/8), 0, 0);
    }
}

@keyframes photo_look_right {
    0% {
        transform: translate3d(calc(100% * -3/8), 0, 0);
    }
    100% {
        transform: translate3d(calc(100% * -3/8), 0, 0);
    }
}

@keyframes photo_snap_right {
    0% {
        transform: translate3d(calc(100% * -6/8), 0, 0);
    }
    100% {
        transform: translate3d(calc(100% * -6/8), 0, 0);
    }
}

@keyframes photo_look_around {
    0% {
        transform: translate3d(calc(100% * -3/8), 0, 0);
    }
    100% {
        transform: translate3d(calc(100% * -5/8), 0, 0);
    }
}

/* ---------------------------------------------------------------------MEDIA QUERIES --------------------------------------------------------------------- */

@media (max-width: 768px) {
    .game-container {
        width: 100%;
        /* height: 50%; */
        flex: 1; /* Fill available vertical space */
        min-height: 0; /* Allow shrinking if content is too large */
        border: none;
        border-radius: 0px;
    }

    .full-screen-container {
        justify-content: flex-start;
        align-items: flex-start;
        /* background-color: #11b80b; */
        flex-direction: column; /* Stack game and keyboard vertically */
    }

    .photographer-container {
        width: 140px;
        height: 140px;
    }

    .bird-container-title {
        width: 80px;
        height: 80px;
        margin: 0px;
    }

    #title-text {
        width: 50%;
    }

    .title-screen button {
        padding: 10px 20px;
        font-size: 1.2em;
        cursor: pointer;
        background-color: #008751;
        color: white;
        border: none;
        border-radius: 5px;
        font-family: "Boogaloo", sans-serif;
        min-width: 200px;
        margin-top: 10px;
    }

    #bird-free1 {
        width: 70px;
        height: 70px;
        bottom: -10px;
        left: 54%;
    }

    .results-container {
        width: 90%;
    }

    .result-item {
        font-size: 0.9em;
    }

    .results-actions {
        width: 90%;
    }

    .results-action-btn {
        font-size: 1.1em;
        padding: 10px 12px;
        min-width: 90px;
    }

    .results-screen {
        justify-content: center;
        padding-top: 0;
    }

    .keyboard-language {
        display: none;
    }
}

.back-button {
    position: fixed; /* Sticky position */
    top: 6px;
    left: 6px;
    z-index: 200; /* Ensure it's above other content */
    background-color: rgba(0, 0, 0, 0.5); /* Semi-transparent black */
    color: white;
    padding: 10px 15px;
    border-radius: 12px; /* Make it circular */
    text-decoration: none; /* Remove underline from link */
    font-size: 20px; /* Adjust icon size */
    transition: background-color 0.3s ease;
}

.back-button:hover {
    background-color: rgba(0, 0, 0, 0.8); /* Darken on hover */
}