:root {
    --yellow-color: #c9b458;
    --gray-color: #787c7e;
    --green-color: #6aaa64;
    --gray-color-2: #878a8c;
    --gray-color-3: #3a3a3c;
    --gray-color-4: #d3d6da;
    --font-color-1: #333;
}

html {
    touch-action: manipulation; /* Prevents double-tap zoom */
}

/* Improve body layout for mobile */
body {
    font-family: "Arial";
    color: var(--font-color-1);
    overflow-x: hidden; /* Prevent horizontal scrolling */
    min-height: 100vh; /* Ensure full height usage */
    display: flex;
    flex-direction: column;
    margin: 0;
    width: 100%;
    height: 100%;
    overflow: scroll;
}

@keyframes flip {
    0% {
        transform: rotateX(0deg);
    }
    50% {
        transform: rotateX(90deg);
    }
    100% {
        transform: rotateX(0deg);
    }
}

.flip {
    animation: flip 0.5s ease-in-out;
}

@keyframes flash-border {
    0% {
        border-color: red;
    }
    50% {
        border-color: var(--gray-color-4);
    }
    100% {
        border-color: red;
    }
}

.error {
    animation: flash-border 0.3s ease-in-out;
}

input {
    outline: none;
}

.testing-buffer {
    height: 500px;
    width: 50px;
    border: dashed 2px red;
    margin: auto;
}

.title-label {
    margin: auto auto auto 25px !important;
    text-align: left;
    font-family: "Arial";
    font-size: 25px;
    text-wrap: wrap;
    padding-right: 10px;
    width: fit-content;
    color: var(--font-color-1);
}

#openCustomWordleCreatorButton {
    width: fit-content;
    border-style: none;
    font-size: 25px;
    font-weight: 600;
    text-transform: uppercase;
    background-color: var(--yellow-color);
    color: white;
    height: 50px;
    margin: auto 25px auto 0;
    padding: 0 10px;
    cursor: pointer;
    transition: .05s ease-in-out;
}

#openCustomWordleCreatorButton:hover {
    transform: scale(1.1);
}

/* Header CSS */
.wordle-header {
    display: flex;
    width: 100%;
    height: 75px;
    background-color: white;
    border-style: none none solid none;
    border-color: var(--green-color);
    border-width: 7px;
    margin: 0;
    position: absolute;
    top: 0;
    left: 0;
}

.header-buffer {
    height: 75px;
    width: 100%;
    margin-bottom: 50px;
}
/* END Header CSS */

/* Game CSS */
#outer-game-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    flex-grow: 1;
    overflow: hidden;
    width: 100%;
    margin: auto;
}

#inner-game-container {
    width: 100%;
    height: fit-content;
    padding: 5px;
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap !important;
    gap: 5px;
    justify-content: center;
    align-items: center;
}

.word-container {
    width: 100%;
    max-width: fit-content;
    font: inherit;
    display: grid;
    grid-template-columns: repeat(12, calc(100% / 12 - 5px)); /* Ensure each column has equal width */
    grid-gap: 5px;
    white-space: nowrap; /* Prevent wrapping */
}


.letter-container {
    width: 62px;
    height: 62px;
    border: solid 2px var(--gray-color-4);
    border-radius: 0;
    font-size: 2.5rem;
    text-align: center;
    text-transform: uppercase;
    line-height: 62px;
    font-family: Arial;
    font-weight: 600;
    user-select: none;
}
/* END Game CSS */

/* Game Keyboard CSS */
#game-keyboard-outer-container {
    display: flex;
    flex-direction: column;
    width: fit-content;
    height: 500px;
    margin: 25px;
}

.keyboard-row {
    width: 100%;
    display: flex;
    gap: 5px;
    justify-content: center !important;
    text-align: center;
    margin: 5px auto;
}

.keyboard-key {
    display: flex;
    width: 43px !important;
    height: 58px !important;
    background-color: var(--gray-color-4);
    color: var(--font-color-1);
    font-size: 1.5rem;
    font-weight: 600;
    border-radius: 5px;
    border-style: none;
    cursor: pointer;
    transition: 0.125s ease-in-out;

    text-align: center !important;
    justify-content: center !important;
    align-items: center !important;
}

.keyboard-key:hover {
    background-color: #ddd;
}
/* END Game Keyboard CSS */

/* Game Over CSS */
.pop-up-container {
    display: none;
    flex-direction: column;
    height: fit-content;
    width: fit-content;
    padding: 25px 50px;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) !important;
    z-index: 100;
    margin: 0;
    border-style: solid;
    border-radius: 10px;
    box-shadow: 0px 0px 50px;
    background-color: white;

    justify-content: center;
    align-items: center;
}

#game-finished-info-container {
    width: fit-content;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin: auto;
}

#game-finished-info-container h1 {
    font-family: "Arial";
}

#game-finished-share-button {
    width: 175px;
    height: 50px;
    border-radius: 25px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 18px;
    background-color: var(--green-color);
    border-style: none;
    color: white;
    cursor: pointer;
}

#exit-game-finished-container-button {
    width: 50px;
    height: 50px;
    font-weight: 800;
    font-size: 25px;
    line-height: 25px;
    cursor: pointer;
    background-color: transparent;
    border-style: none;
    transition: 0.125s ease-in-out;
}

#exit-game-finished-container-button:hover {
    color: #ff6e6e;
}
/* END Game Over CSS */

/* Create Wordle Container CSS */


#createWordleContainer {
    display: none;
}

#wordle-creation-container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    height: fit-content;
}

.input-div {
    display: flex;
    position: relative;
    padding: 0;
    margin: 10px 0 0 0;
    border-style: solid;
    border-radius: 5px;
    border-width: 2px;
}

.input-div input {
    position: absolute;
    font-size: 25px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 0;
    outline: none;
    border-style: none;
    background-color: transparent;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    text-indent: 10px;
}

.input-div:focus-within label {
    top: 0;
    background-color: white;
    font-size: 20px;
}

.input-div input:focus + label,
.input-div input:not(:placeholder-shown) + label {
    top: 0;
    font-size: 20px;
    background-color: white;
}

.input-div label {
    position: absolute;
    z-index: 2;
    left: 10px;
    top: 50%;
    height: fit-content;
    font-size: 25px;
    transform: translateY(-50%);
    font-weight: 600;
    pointer-events: none;
    transition: 0.125s ease-in-out;
    background-color: white;
    padding: 0 3px;
}

#wordle-creation-container .input-div {
    width: 300px;
    height: 50px;
}

.range-input-div {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 300px;
    height: 50px;
    margin-top: 10px;
    font-size: 25px;
}

#game-link-generating-container {
    display: none;
    justify-content: center;
    align-items: center;
    min-width: 300px;
    width: fit-content !important;
    flex-wrap: nowrap;
    text-wrap: nowrap;
    height: 50px;
    margin-top: 25px;
    padding: 0 10px;
    background-color: #ddd;
    border-radius: 10px;
}

#generateCustomLinkButton {
    margin: 20px auto 0 auto;
    width: 300px;
    height: 50px;
    border-radius: 10px;
    background-color: var(--green-color);
    
    color: white;
    font-size: 30px;
    font-weight: 700;
    text-transform: uppercase;
    border-style: none;
    cursor: pointer;
}

#copy-custom-link-button {
    background-color: transparent;
    border-style: none;
    cursor: pointer;
    height: fit-content;
    width: fit-content;
    margin: 0 5px 0 10px;
}

#copy-custom-link-button:hover {
    transform: scale(1.2);
}

#copy-custom-link-img {
    fill: var(--font-color-1);
}

.exitButton {
    background-color: var(--yellow-color);
    font-size: 20px;
    font-weight: 600;
    text-transform: uppercase;
    border-style: none;
    padding: 5px 10px;
    color: white;
    cursor: pointer;
    transition: .05s ease-in-out;
}

.exitButton:hover {
    transform: scale(1.1);
}

/* END Create Wordle CSS */



/* Responsive Design */
@media (max-width: 768px) {
    .wordle-header {
        height: 60px; /* Reduce header height */
        border-width: 5px; /* Adjust border size */
    }

    .header-buffer {
        height: 60px; /* Match header height */
    }

    #outer-game-container {
        width: 100%; /* Ensure full width usage */
        max-width: 500px; /* Prevent stretching too wide */
    }

    .letter-container {
        width: 50px;
        height: 50px;
        font-size: 2rem;
        line-height: 50px;
    }

    #game-keyboard-outer-container {
        height: auto; /* Remove fixed height */
        align-items: center;
        justify-self: center;
    }

    #game-keyboard-outer-container {
        transform: scale(.75);
    }

    .keyboard-row {
        display: flex;
        justify-content: center;
        align-items: center;
    }

    
    .special-key {
        max-width: none;
        width: 100%;
        justify-items: center;
        align-items: center;
    }

    #wordle-creation-container {
        max-width: 90%;
    }

    #custom-link-text {
        text-wrap: wrap;
    }
}