:root {
    --clue: #c9b458;
    --correct: #6aaa64;
    --lightGray: #d3d6da;
    --darkGray: #787c7e;
    --headerHeight: 60px;
    --lightGrayTransparent: #d3d6da56;
    --modalBackground: #d9d9d96e;
    --modalBackgroundDark: #0000004b;
    --blackish: #121212;
    --blackishTransparent: #121212ac;
    --darkerGray: #3a3a3c;
    --whiteish: #FAF9F6;
    --highContrastCorrect: #85c0f9;
    --highContrastClue: #f5793a;
}

@keyframes flipping {
    0% {
        transform: rotateX(0deg);
    }

    50% {
        transform: rotateX(90deg);
    }

    100% {
        transform: rotateX(0deg);
    }
}

@keyframes shake {
    0% {
        transform: translateX(0)
    }

    25% {
        transform: translateX(5px)
    }

    50% {
        transform: translateX(-5px)
    }

    75% {
        transform: translateX(5px)
    }

    100% {
        transform: translateX(0)
    }
}

@keyframes jump {
    0% {
        transform: translateY(0)
    }

    25% {
        transform: translateY(-15px)
    }

    50% {
        transform: translateY(0)
    }

    75% {
        transform: translateY(-10px)
    }

    100% {
        transform: translateY(0)
    }
}

/* * {
    font-family: 'Noto Sans JP', sans-serif;
} */

body {
    margin: 0;
    /* disable double tap zoom */
    touch-action: manipulation;
}


/* ---------header--------- */

header {
    border-bottom: 1px solid var(--lightGray);
}

nav {
    display: flex;
    align-items: center;
    position: relative;
    justify-content: space-between;
    height: var(--headerHeight);
}

#title {
    margin: 0;
    position: absolute;
    left: 0;
    right: 0;
    text-align: center;
    font-family: 'Suwannaphum', serif;
    font-size: 2rem;
    pointer-events: none;
    user-select: none;
}

#menu {
    position: absolute;
    right: 0;
    margin-right: 30px;
}

/* icons */

.material-symbols-outlined {
    color: black;
    font-weight: bold !important;
    font-size: 2rem !important;
    cursor: pointer;
    user-select: none;
}

.material-symbols-outlined:first-child {
    margin: 0 30px;
}

#menu .material-symbols-outlined {
    margin: 4px;
}

#source-code-link {
    position: relative;
}

/* tooltip for github link */

#tooltip-text {
    visibility: hidden;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.8rem;
    position: absolute;
    background-color: var(--lightGrayTransparent);
    color: rgba(0, 0, 0, 0.677);
    text-align: center;
    border-radius: 3px;
    width: 80px;
    padding: 5px 0;
    z-index: 1;
    left: 50%;
    margin-left: -38px;
    top: 5px;
}

#source-code-link:hover #tooltip-text {
    visibility: visible;
}

/* ------------page content------------ */

section {
    display: flex;
    flex-direction: column;
    align-items: center;

}

/* timer */

#timer-container {
    width: 200px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#timer-content {
    visibility: hidden;
    font-size: 1.1rem;
    font-family: 'Noto Sans JP', sans-serif;
    /* font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-weight: bold; */
}


/* alert */

#alert-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
    height: 40px;
    position: fixed;
    height: fit-content;
    top: 70px;
    z-index: 1;
}

#alert-container p {
    background-color: var(--blackishTransparent);
    color: white;
    margin: 0;
    font-family: 'Noto Sans JP', sans-serif;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-weight: bold;
    font-size: 0.9rem;
    padding: 10px 15px;
    margin: 2px;
    border-radius: 6px;
}

/* word board */

#word-board {
    /* margin-top: 50px; */
    user-select: none;
}

.row {
    display: flex;
    flex-direction: row;
}

.letter {
    width: 50px;
    height: 50px;
    border: 2px solid var(--lightGray);
    margin: 2px;
    text-align: center;
    font-size: 2rem;
    font-family: 'Noto Sans JP', sans-serif;
}

/* keyboard */

#keyboard-container {
    width: 540px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    -webkit-justify-content: center;
    -webkit-flex-wrap: wrap;
    margin-top: 40px;
    margin-bottom: 40px;
    user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
}


#keyboard-container button {
    width: 45px;
    height: 52px;
    border: none;
    border-radius: 4px;
    font-weight: bold;
    margin: 4px;
    cursor: pointer;
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 1.3rem;
}

#keyboard-container button[value="ENTER"] {
    width: 60px;
    font-size: 0.9rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

#keyboard-container button[value="⌫"] {
    font-size: 1rem;
    width: 60px;
}


/* -----------modal boxes------------ */

.modal {
    display: none;
    position: fixed;
    z-index: 1;
    padding-top: 50px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: var(--modalBackground);
    overflow-y: scroll;
}

#settings-content,
#help-content,
#stats-content {
    display: flex;
    flex-direction: column;
    margin-top: 20px;
    width: 460px;
    height: 400px;
    margin-left: auto;
    margin-right: auto;
    background-color: white;
    border-radius: 2%;
    padding: 0 3%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-weight: normal;
    box-shadow: 0 0 18px #888;
}

#help-content {
    height: 630px;
}

#help-content h2,
#settings-content h2,
#stats-content h2 {
    font-family: 'Suwannaphum', serif;
    margin: 0;
    font-size: 1.5rem;
}

#help-content .close,
#settings-content .close,
#stats-content .close {
    margin: 25px 0 0 0;
    align-self: flex-end;
}

/* help menu */
#help-content h4 {
    font-size: 1.2rem;
    font-weight: bold;
    margin: 0;
}

#help-content h6 {
    margin: 0;
    font-size: 1.1rem;
    padding-bottom: 14px;
    font-weight: 600;
    font-style: italic;
}

#rules-list {
    margin: 0 0 15px 10px;
    padding: 0;
}

#help-content li {
    margin: 0 0 5px 0;
}


/* help menu: example styles */

#example-container p {
    margin: 4px 0 20px 6px;
    font-size: 1.1rem;
}

.example-row {
    display: flex;
    flex-direction: row;
    margin: 15px 0 0 0;
}

.example-tile {
    width: 38px;
    height: 30px;
    border: 2px solid var(--darkGray);
    margin: 0 2px;
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 1.5rem;
    padding-bottom: 2%;
    text-align: center;
}

/* stats menu */

#stat-info {
    margin-top: 15px;
    display: flex;
    flex-direction: row;
    justify-content: space-around;
    align-items: first baseline;
}

.stat-num-container {
    width: 17%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-number {
    margin: 0;
    padding: 0;
    font-size: 2.5rem;
    font-weight: bold;
}

.stat-title {
    margin: 0;
    padding: 0;
    font-size: 0.7rem;
}

#stats-content input[type="button"] {
    display: none;
    margin-top: 70px;
    margin-left: auto;
    margin-right: auto;
    background-color: var(--correct);
    border: none;
    height: 65px;
    width: 50%;
    border-radius: 5px;
    font-weight: bold;
    font-size: 1.2rem;
    color: var(--whiteish);

}

/* settings menu */
.setting-row {
    user-select: none;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--lightGray);
}

.setting-row:last-child {
    border-bottom: none;
}

#settings-content h2 {
    margin-bottom: 20px;
}

/* toggle box */

.switch {
    position: relative;
    display: inline-block;
    width: 33px;
    height: 19px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--darkGray) !important;
    -webkit-transition: .4s;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 15px;
    width: 15px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    -webkit-transition: .4s;
    transition: .4s;
}

input:checked+.slider {
    background-color: var(--correct) !important;
}

input:focus+.slider {
    box-shadow: 0 0 1px var(--correct) !important;
}

input:checked+.slider:before {
    -webkit-transform: translateX(15px);
    -ms-transform: translateX(15px);
    transform: translateX(15px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* coloring */

.correct {
    background-color: var(--correct) !important;
    border-color: var(--correct) !important;
    color: white !important;
    transition: none;
}

.high-contrast-correct {
    background-color: var(--highContrastCorrect) !important;
    border-color: var(--highContrastCorrect) !important;
    color: white !important;
    transition: none;
}

.clue {
    background-color: var(--clue) !important;
    border-color: var(--clue) !important;
    color: white !important;
    transition: none;
}

.high-contrast-clue {
    background-color: var(--highContrastClue) !important;
    border-color: var(--highContrastClue) !important;
    color: white !important;
    transition: none;
}

.not-in-word {
    background-color: var(--darkGray) !important;
    border-color: var(--darkGray) !important;
    color: white !important;
    transition: none;
}

.dark-mode-not-in-word {
    background-color: var(--darkerGray) !important;
    border-color: var(--darkerGray) !important;
    color: var(--whiteish) !important;
}

.empty-tile {
    border-color: var(--lightGray);
    color: black;
}

.dark-mode-empty-tile {
    border-color: var(--darkGray) !important;
    color: var(--whiteisht) !important;
}

.typing {
    border-color: black !important;
    transition: all 0.5s;
}

.dark-mode-typing {
    color: var(--whiteish);
    border-color: var(--darkGray);
}

.key-not-colored {
    background-color: var(--lightGray) !important;
    color: black;
}

.dm-key-not-colored {
    background-color: var(--darkGray) !important;
    color: var(--whiteish);
}

/* flip game tiles */

.flip {
    animation: 0.5s linear flipping;
}

/* shake tiles if not valid word */
.shake {
    animation: shake 0.2s;
}

.jump {
    animation: jump 0.5s;
}

@media(max-width: 600px) {

    .modal {
        padding-top: 0px;
    }

    #settings-content,
    #help-content {
        width: 290px;
        padding: 0 30px;
    }

    #settings-content {
        height: 500px;
    }

    #help-content {
        height: 750px;
    }

    /* alert container has been moved up */
    #alert-container {
        margin-top: 10px;
    }

    /* board has been moved up */
    #word-board {
        margin-top: 10px;
    }

    /* smaller keyboard */
    #keyboard-container {
        width: 97%;

    }

    #keyboard-container button {
        width: 8%;
        height: 50px;
        margin: 0.8%;
        cursor: pointer;
        font-family: 'Noto Sans JP', sans-serif;
        padding: 0;
    }

    #keyboard-container button[value="ENTER"] {
        font-size: 0.7rem;
        padding: 0;
        width: 13%;
    }

    #keyboard-container button[value="⌫"] {
        width: 13%;
    }
}

@media(max-width: 350px) {

    #settings-content,
    #help-content {
        width: 200px;
        padding: 0 20px;
    }

    #settings-content {
        height: 500px;
    }

    #help-content {
        height: 800px;
    }

    /* header */
    .material-symbols-outlined {
        font-size: 1.4rem !important;
    }

    .material-symbols-outlined:first-child {
        margin: 0 10px;
    }

    #menu .material-symbols-outlined {
        margin: 1px;
    }

    #menu {
        margin-right: 10px;
    }

    /* keyboard */
    #keyboard-container button[value="ENTER"] {
        font-size: 0.5rem;

    }

    /* game tiles */

    .letter {
        width: 40px;
        height: 40px;
        margin: 2px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.9rem;
    }
}