/* Import Montserrat font */
@import url('https://fonts.googleapis.com/css?family=Montserrat:400,700');

*{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Montserrat', sans-serif;
    font-weight: 400;
}

body{
    width:100%;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    background-color: #22272e;
    gap:20px;
}

.game-stats-container {
    position: absolute;
    top: 10px;
    right: 15px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    z-index: 10;
}

.info-btn {
    background-color: #75d0ee;
    color: rgb(8, 8, 8);
    width: 50px;
    height: 50px;
    border: none;
    cursor: pointer;
    border-radius: 50%;
    font-size: 16px;
    text-align: center;
    line-height: 50px;
    transition: background-color 0.3s ease;
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 1000;
}

.timer-board, .score-board {
    padding: 8px 15px;
    background-color: rgba(255, 255, 255, 0.114);
    color: rgb(225, 225, 225);
    border-radius: 2px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    text-align: right;
}

.timer-board p, .score-board p {
    margin: 0;
    font-size: 1rem;
    display: flex;
    align-items: center;
}

#timer, #score {
    font-size: 18px;
    color: lightgreen;
    padding-left: 10px;
}

.board{
    width: 340px;
    height: 430px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap:10px;
}

.word{
    width:100%;
    display:flex;
    justify-content: space-evenly;
}
.word div{
    width: 60px;
    height:60px;
    display:flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    transition: all 0.3s ease-in-out;
    background-color:rgba(255, 255, 255, 0.116);
    color:rgba(255, 255, 255, 0.89);
    border-radius: 3px;
    border: 1px solid rgba(128, 128, 128, 0.321);
}

.buttons{
    width: 700px;
    display: flex;
    flex-wrap:wrap;
    justify-content: center;
    align-items: center;
    gap: 5px;
}

button{
    width: 45px;
    height: 55px; 
    font-size: 1.2rem;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.1s ease-in-out;
    user-select: none;
    border:none;
    outline:none;
    color: rgb(225, 225, 225);
    background-color:rgba(255, 255, 255, 0.114);
}

.incorrect{
    background-color: rgb(114, 114, 114) !important;
}

.present{
    background-color: rgba(214, 163, 52, 0.796) !important;
}

.correct{
    background-color: rgb(86, 171, 86) !important;
}

.alert{
    position:absolute;
    background-color: rgb(38, 41, 47);
    border-radius: 5px;
    transition: all 0.3s ease-in-out;
    transform:scale(0);
    border: 1px solid rgba(255, 255, 255, 0.138);
    color: white;
    display:flex;
    align-items: center;
}
.game-over-overlay {
    box-shadow: 0 0 200px 1000px rgba(0, 0, 0, 0.75);
}

.active{
    transform:scale(1);
}

#enter, #back{
    width:70px;
}

.scale{
    animation: scale 0.5s linear; 
}

 /* Info Modal Styles */
 
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

/* Making the Info modal dark-themed */
.modal-content {
    background-color: rgb(38, 41, 47); /* Dark background */
    border-radius: 10px;
    width: 90%;
    max-width: 650px;
    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2);
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.138); /* Consistent border */
    text-align: left;
}

.modal-content h2 { /* Info modal titel */
    margin-top: 10px;
    color: #fefdfd; /* White title text */
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: 10px;
}

/* Targeting text and lists inside the info modal */
#info-modal p, #info-modal li { /* Info modal explanations */
    margin-top: 5px;
    padding-left: 10px;
    padding-right: 10px;

    color: #ccc;
    text-align: left;
    margin-bottom: 0px;

}
#info-modal ul { /* Info modal bullet points*/
    padding-left: 35px;
    list-style-position: outside;
    margin-top: 5px;

}
#info-modal li {
    margin-bottom: 6px;
}

#info-modal .modal-section-title {
    color: hsl(0, 33%, 99%); /* White, same as h2 and close button */
    font-weight: bold;
    font-size: 1.1rem; /* Slightly larger than normal text */
    margin-top: 20px;   /* Space *above* the new section title */
    margin-bottom: 5px; /* Little space *below* the title, right before the list */
}

 
.close {
    position: absolute;
    top: 1px;
    right: 15px;
    font-size: 45px;
    cursor: pointer;
    color: #fff; /* White 'x' to be visible on dark background */
}

/* This is the BARE MINIMUM CHANGE to fix the centering */
#info-modal .close-hint {
    font-size: 0.8rem;
    color: #797878;
    margin-top: 20px;
    text-align: center; /* This will now take priority over the left-align */
}

/* This specifically targets the hint inside the win/loss alerts */
.alert .close-hint {
    margin-top: 40px;
    font-size: 0.7rem;
    color: #797878;
    text-align: center; /* This ensures it's centered here too */
}

.example {
    margin-top: 15px;
    padding-top: 20px;
    border-top: 1px solid #444; /* Separator line */
    display: flex; /* Enable flex properties */
    flex-direction: column; /* Stack contents vertically */
    align-items: center; /* Center contents horizontally */
    text-align: center; /* Center text beneath the tiles */
    margin-bottom: 15px;
}


.word-box {
    display: flex;
    gap: 5px;
    margin-bottom: 10px;
}

/* Making example tiles match the dark theme of the game board */
.tile {
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    font-weight: bold;
    border-radius: 5px;
    background-color: rgba(255, 255, 255, 0.116);
    color: #fff;
    border: 1px solid rgba(128, 128, 128, 0.321);
}

.tile.correct {
    background-color: rgb(86, 171, 86);
}
.tile.present {
    background-color: rgba(214, 163, 52, 0.796);
}
.tile.incorrect {
    background-color: #787c7e;
}



@media screen and (max-width: 700px) {
    body{
        gap:40px;
    }
    
    .board{
        width:300px;
        height: 300px;
        gap:5px;
    }

    .word div{
        width:50px;
        height:50px;
    }

    .buttons{
        width:320px;
        gap:5px;
    }

    button{
        width:28px;
        height:38px;
        font-size: 0.8rem;
        transition: 0.1s ease all;
    }
    #enter, #back{
        width:45px;
    }
}
    
@keyframes rotate {
    0%{
        transform:rotateX(0deg);
    }
    50%{
        transform:rotateX(180deg);
    }
    100%{
        transform:rotateX(0deg);
    }
}

@keyframes scale {
    0%{
        transform:scale(1);
    }
    50%{
        transform:scale(1.1);
    }
    100%{
        transform:scale(1);
    }
}


.game-over-container {
    text-align: center;
    padding: 20px;
    color: #fff;
}

.final-stats-grid {
    display: flex;
    justify-content: space-around;
    width: 100%;
    margin-top: 25px;
    margin-bottom: 25px;
    border-top: 1px solid #444;
    border-bottom: 1px solid #444;
    padding: 15px 0;
}

.stat-item h4 {
    font-size: 1rem;
    color: #bbb;
    margin-bottom: 5px;
}

.stat-item p {
    font-size: 1.5rem;
    font-weight: bold;
    color: lightgreen;
}

.words-played h4 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: #ddd;
}

.final-word-correct {
    font-size: 1.8rem;
    font-weight: bold;
    color: rgb(86, 171, 86);
    margin: 5px 0;
    letter-spacing: 2px;
}

.final-word-incorrect {
    font-size: 1.8rem;
    font-weight: bold;
    color: #cc5c5c;
    margin: 5px 0;
    letter-spacing: 2px;
}

.game-over-subtitle {
    font-size: 1rem;
    color: #ddd;
    margin-top: 15px;
    margin-bottom: 15px;
}

.modal-fact {
    font-size: 1.1rem;
    color: #f9fbfc;
    margin-top: 20px;
    margin-bottom: 20px;
}

.modal-correct-word {
    font-weight: bold;
    color: #ff9900;
    font-size: 2em;
    margin-top: 0px;
    margin-bottom: 10px;
    display: block;
}

.alert .close-hint {
    margin-top: 40px;
    font-size: 0.7rem;
    color: rgb(104, 105, 106)

}

#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    pointer-events: none; /* Allows clicks to go "through" the canvas */
    z-index: 999; /* Ensures it's on top of the game, but modals will have a higher z-index */
}