:root {
    --letter-border-thickness: 2px;
    --example-letter-border-thickness: 2px;
    --c1: #c30000;
    --c2: #ff9019;
    --c3: #d4c600;
    --c4: #3a2fda;
    --bg: white;
    /* --bg: rgb(31, 31, 31); */
    --contrast: black;
}

html, body {
    margin: 0;
    height: 100vh; /* Full viewport height */
    display: flex;
    align-items: flex-start; /* Center vertically */
    justify-content: center; /* Center horizontally */
    background-color: var(--bg);
    font-family: Arial, Helvetica, sans-serif;
    overflow-x: hidden;
    padding-top: 10px;
}

button {
    all: unset; /* Resets most properties to their initial value */
    display: inline-block; /* Needed for proper button-like behavior */
    cursor: pointer; /* Ensures it looks clickable */
    touch-action: manipulation;
}

#container {
    display: flex;
    flex-direction: column; /* Stack elements vertically */
    align-items: center; /* Center items horizontally */
    text-align: center; /* Center-align text */
    justify-content: space-between;
    height: 95dvh;
    max-height: 650px;
}

h2 {
    margin: 0; /* Remove default margin */
    font-size: 1.5rem;
    color: var(--contrast);
}

 .t0, .t4, .t8 {
    text-shadow: 1px 1px var(--c1);
 }
 .t1, .t5, .t9 {
    text-shadow: 1px 1px var(--c2);
 }
 .t2, .t6, .t10 {
    text-shadow: 1px 1px var(--c3);
 }
 .t3, .t7, .t11 {
    text-shadow: 1px 1px var(--c4);
 }

.description {
    margin: 0;
    font-size: 1rem;
    color: var(--contrast); /* Optional: light gray text */
}

#board {
    display: grid;
    grid-template-columns: repeat(5, 67px);
    grid-gap: 8px;
    overflow: visible;
    padding: 3px;
}

#example-board {
    display: grid;
    grid-template-columns: repeat(5, 50px);
    grid-gap: 3px;
    overflow: visible;
    padding: 1px;
}
.letter {
    position: relative; /* Ensures child elements position relative to the tile */
    font-size: 40px;
    width: 67px;
    height: 67px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: var(--letter-border-thickness) solid var(--contrast);
    box-shadow: 3px 3px var(--contrast);
    border-radius: 10px;
    background-color: var(--bg);
    cursor: pointer;
    box-sizing: border-box; /* Ensure padding and border are included in the tile size */
    user-select: none;
}

.letter-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%); /* Keeps letter centered */
    font-weight: bold;
}

.letter-points {
    position: absolute;
    bottom: 2px;
    right: 3px;
    font-size: 12px; /* Slightly smaller than the letter */
    color: var(--contrast);
    pointer-events: none; /* Ensures clicks still register on the .letter div */
}

.example-letter {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: var(--example-letter-border-thickness) solid var(--contrast);
    border-radius: 5px;
    background-color: var(--bg);
    cursor: pointer;
    box-sizing: border-box; /* Ensure padding and border are included in the tile size */
    font-weight: bold;
    font-size: 1.7rem;
}

/* The overlay background */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px); /* Blur effect */
    display: flex;
    justify-content: center;
    align-items: flex-start;
    z-index: 1000; /* Ensure it's above other content */
    visibility: hidden;
    padding-top: 5px;
}

@media (min-width: 1024px) {
    html, body {
        align-items: center;
        padding-top: 0px;
    }
    .overlay {
        align-items: center;
        padding-top: 0px;
    }
}

.letter.selected {
    background-color: #dcdcdc;
}

.letter.c1 {
    border: var(--letter-border-thickness) solid var(--c1);
    box-shadow: 3px 3px var(--c1);
}

.example-letter.c1 {
    border: var(--example-letter-border-thickness) solid var(--c1);
}

.letter.c2 {
    border: var(--letter-border-thickness) solid var(--c2);
    box-shadow: 3px 3px var(--c2);
}
.example-letter.c2 {
    border: var(--example-letter-border-thickness) solid var(--c2);
}
.letter.c3 {
    border: var(--letter-border-thickness) solid var(--c3);
    box-shadow: 3px 3px var(--c3);
}
.example-letter.c3 {
    border: var(--example-letter-border-thickness) solid var(--c3);
}
.letter.c4 {
    border: var(--letter-border-thickness) solid var(--c4);
    box-shadow: 3px 3px var(--c4);
}
.example-letter.c4 {
    border: var(--example-letter-border-thickness) solid var(--c4);
}
.letter.conflict {
    background-color: rgb(255, 172, 172);
}
.letter.incorrect {
    color: rgb(255, 76, 76);
}
.letter.celebrate {
    border: var(--letter-border-thickness) solid green;
    box-shadow: 3px 3px green;
    background-color: #525252;
    color: white;
}
.letter.paused {
    /* border: 5px solid #b4b4b4; */
    border: 2px solid rgb(44, 44, 44);
    background-color: var(--bg);
    box-shadow: none;
}

/* The popup window */
.popup {
    background-color: var(--bg);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    width: 600px;
    max-width: 90%;
    text-align: left;
    position: relative;
    max-height: 70vh; /* Limit height to 80% of viewport */
    overflow-y: auto; /* Enable scrolling if content overflows */
    white-space: normal; /* allow wrapping */
    overflow-x: hidden;  /* optional: hide any accidental overflow */
    word-wrap: break-word; /* wrap long words or URLs */
}

/* The close button */
#close-button {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
}

.end-timer {
    display: none;
}

#start-message {
    color: var(--contrast);
    /* font-weight: bold; */
    margin: 0;
    padding: 0;
}

#keyboard-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    /* box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.2); */
    gap: 5px; /* Add spacing between rows */
    align-items: center; /* Center align the keyboard rows */
    /* background-color:#e2e2e2; */
    /* border-radius: 20px; */
    padding: 0px;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: 5px; /* Add spacing between keys */
}

.key {
    color: var(--contrast);
    position: relative;
    margin: 0; /* Remove margins */
    height: 47px; /* Ensure consistent height */
    width: 30px;
    font-size: 18px;
    background-color: var(--bg);
    border: 1px solid var(--contrast);
    border-radius: 5px;
    cursor: pointer;
    text-align: center;
    box-shadow: 1px 1px var(--contrast);
    user-select: none;
}

.key-letter {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%); /* Keeps letter perfectly centered */
    /* font-weight: bold; */
}

.key-points {
    position: absolute;
    bottom: 2px;
    right: 3px;
    font-size: 10px;
    color: var(--contrast);
    display: none;
}
.key-letter,
.key-points {
    pointer-events: none;
}

#second-keyboard-row .key, #bottom-keyboard-row .key {
    width: 34px;
}

.unavailable {
    background-color: #b4b4b4;
    box-shadow: none;
}
.paused-key {
    background-color: var(--bg);
    box-shadow: none;
}

#reset-button {
    margin: 0; /* Remove margins */
    padding: 6px;
    font-size: 18px;
    background: var(--bg);
    border: 1px solid #aaa;
    border-radius: 5px;
    cursor: pointer;
    text-align: center;
    display: none;
}

#report-missing-word-button {
    color: var(--contrast);
    display: none;
    border: 1px solid var(--contrast);
    padding: 3px;
    border-radius: 5px;
    box-shadow: 1px 1px red;
    background-color: var(--bg);
}
#got-it-button {
    color: var(--contrast);
    border: 1px solid var(--contrast);
    padding: 3px;
    border-radius: 5px;
    box-shadow: 1px 1px green;
    background-color: var(--bg);
}

.report-missing-word-button-paused {
    display: none;
}

#play-pause-button {
    border: 1px solid rgb(44, 44, 44);
    padding-top: 3px;
    padding-bottom: 3px;
    padding-left: 5px;
    padding-right: 5px;
    border-radius: 5px;
    background-color: var(--bg);
    box-shadow: 1px 1px purple;
    display: none;
}

#copy-results-button {
    display: none;
    border: 1px solid var(--contrast);
    padding: 3px;
    border-radius: 5px;
    background-color: var(--bg);
    box-shadow: 1px 1px green;
}

#refresh-key, #delete-key  {
    color: rgb(255, 76, 76);
}

@media screen and (max-height: 645px) {
    h2 {
        font-size: 1.4rem;
    }
    #board {
        grid-template-columns: repeat(5, 60px);
        grid-gap: 6px;
    }
    .letter {
        width: 60px;
        height: 60px;
    }
    #container {
        gap: 10px;
    }
     .key {
        height: 40px;
     }
}

#header-div {
    display: flex;
    align-items: center;
    justify-content: space-around;
    gap: 8px;
}

#timer, #score {
    margin: 0px;
    border: 1px solid var(--contrast);
    padding: 3px;
    border-radius: 5px;
    background-color: var(--bg);
    display: none;
    box-shadow: 1px 1px skyblue;
}

#mode-button, #how-to-play-button {
    margin: 0px;
    border: 1px solid var(--contrast);
    /* padding-top: 3px;
    padding-bottom: 3px; */
    padding-left: 4px;
    padding-right: 4px;
    border-radius: 5px;
    background-color: var(--bg);
    box-shadow: 1px 1px purple;
    text-decoration: none;
}

#actions-container {
    display: flex;
    gap: 10px;
    /* padding-bottom: 15px; */
}

#date {
    text-shadow: 1px 1px skyblue;
}