*,
*::after,
*::before {
    box-sizing: border-box;
    font-family: Arial;
}

body {
    background-color: white;
    margin: 0em;
    padding: 0em;
    display: flex;
    flex-direction: column;
    align-items: center;

    position: relative;
    height: 100%;
    width: 100%;
}

html {
    font-size: clamp(0.4rem, 2.65vh, 2.5em);
}

@media screen and (max-width: 600px) {
    html {
        font-size: clamp(0.4rem, min(4.75vw, 2.65vh), 2.5em);
    }
}

svg {
    pointer-events: none;
}

a.exit {
    font-weight: bold;
    color: black;
    cursor: pointer;
}


a.exit:link {
    text-decoration: none;
}

a.exit:visited {
    text-decoration: none;
}

a.exit:hover {
    text-decoration: none;
}

a.exit:active {
    text-decoration: none;
}

.welcome-content {
    margin-top: 6em;
}

.hide {
    visibility: hidden;
    position: absolute;
}

.show {
    visibility: visible;
    position: relative;
}

.page {
    visibility: hidden;
    position: absolute;
    margin-top: .5em;
    padding-top: .5em;

    max-width: 100%;
    max-height: 100%;
    overflow: hidden;
}

.page.active {
    visibility: visible;
    position: relative;
}

.centered {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.header {
    display: inline-flex;
    gap: 1em;
    height: 1.5em;
    justify-content: center;
    align-items: center;
}

.focail {
    color: black;
    height: auto;
    width: 8em;
}

.focail-large {
    width: 7em;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    margin-top: 1em;
    margin-bottom: 1em;
}

.badge {
    height: 5em;
    width: 5em;
    user-select: none;
}

.icon {
    height: 1.25em;
    margin-top: .5em;
    offset-position: 1em;
    user-select: none;
    cursor: pointer;
}

.underline {
    width: 19em;
    margin: .5em auto 0;
    height: 2px;
    background: hsl(209, 7%, 78%);
}

.button {
    height: 2.1em;
    background: black;
    border: none;
    border-radius: .25em;
    font-weight: bold;
    font-size: 1.1em;
    justify-content: center;
    color: white;
    cursor: pointer;
}

.button.play {
    width: 9em;
    margin-top: 1.60em;
}

.button.share {
    width: 13em;
    margin-top: 1.95em;
    display: grid;
    grid-template-columns: repeat(3, 3em);
    justify-items: center;
    align-items: center;
}

.button.replay {
    font-size: 1em;
    height: 2em;
    width: 5em;
    margin-bottom: .25em;
}

.share-icon {
    width: auto;
    height: 1.2em;
}

h1 {
    font-weight: bold;
    font-size: 1.5em;
    margin-top: -.5em;
    margin-bottom: 0em;
}

h2 {
    font-weight: bold;
    font-size: 1em;
    margin-bottom: -0.5em;
}

h3 {
    font-family: 'Times New Roman', Times, serif;
    font-weight: bold;
    font-size: 1.35em;
    margin-bottom: -0.5em;
}

h4 {
    font-weight: bold;
}

h5 {
    font-family: 'Times New Roman', Times, serif;
    font-weight: bold;
    font-size: 3em;
    margin-bottom: 0em;
}

.bold {
    font-weight: bold;
}

.reduced-margin-bottom {
    margin-bottom: -1em;
}

.reduced-margin-bottom-large {
    margin-bottom: -1.6em;
}

.return-message {
    font-size: 2em;
    margin-bottom: -1em;
}

.return-info {
    font-size: .85em;
    margin-bottom: -0.8em;
}

.box {
    display: flex;
    align-items: center;
    text-align: center;
    width: 18.5em;
}

.box.left {
    justify-content: left;
}

.box.right {
    justify-content: right;
}

.statistic {
    display: inline;
    border-color: black;
    width: auto;
    height: auto;
    grid-column: span 1;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.statistic.large{
    grid-column: span 2;
}

.statistic-data {
    font-size: 1.25em;
    margin-bottom: -.5em;
}

.statistic-label {
    font-size: .65em;
}

.stats-grid {
    display: grid;
    justify-content: center;
    align-content: center;
    grid-template-columns: repeat(5, 3em);
    grid-template-rows: repeat(1, 4.25em);
    gap: .5em;
    margin-bottom: 1em;
    margin-top: -.5em;
}

.stat-bar-grid {
    display: grid;
    grid-template-rows: repeat(6, 1em);
    gap: 0.5em;
    margin-bottom: .5em;
    margin-top: .6em;
}

.stat-bar {
    width: var(--width, 16em);
    height: auto;
    background: hsl(0, 0%, 50%);
    text-align: right;
    font-weight: bold;
    margin-top: 1.4em;
    color: white;
    padding-right: .25em;
}

.stat-bar.last {
    background: hsl(178, 100%, 19%);
}

.text-box {
    margin-top: 2em;
    margin-bottom: 2em;
    width: 20.5em;
    height: auto;
    font-size: .9em;
}

.text-box.small {
    width: 15em;
    margin-left: -2em;
    text-align: left;
}

.info {
    font-size: 0.85em;
}

.keyboard {
    display: grid;
    grid-template-columns: repeat(20, minmax(auto, .75em));
    grid-auto-rows: 3em;
    gap: .25em;
    justify-content: center;
}

.key {
    font-size: inherit;
    font-weight: bold;
    grid-column: span 2;
    border: none;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: hsl(
        var(--hue, 209),
        var(--saturation, 7%),
        calc(var(--lightness-offset, 0% ) + var(--lightness, 78%))
    );
    color: black;
    fill: black;
    text-transform: uppercase;
    border-radius: .25em;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.key.large {
    font-size: .6em;
    grid-column: span 3;
}

.key>svg {
    width: 1.75em;
    height: 1.75em;
}

.key:hover, .key:focus-visible {
    --lightness-offset: 10%;
}

@media (hover: none) and (pointer: coarse) {
    .key:hover,
    .key:focus,
    .key:focus-visible,
    .key:active {
        --lightness-offset: 0%;
    }
}

.key.wrong {
    color: white;
    --hue: 0;
    --saturation: 0%;
    --lightness: 50%;
}

.key.wrong-location{
    color: white;
    --hue: 9;
    --saturation: 80%;
    --lightness: 56%;
}

.key.correct {
    color: white;
    --hue: 178;
    --saturation: 100%;
    --lightness: 19%;
}

.key.disable {
    color: transparent;
    --hue: 209;
    --saturation: 7%;
    --lightness: 90%;
    pointer-events: none;
}

.guess-grid {
    display: grid;
    justify-content: center;
    align-content: center;
    grid-template-columns: repeat(5, 3.5em);
    grid-template-rows: repeat(6, 3.5em);
    gap: .25em;
    margin-bottom: .5em;
    margin-top: .5em;
}

.tile {
    font-size: 2em;
    color: white;
    border: .05em solid black;
    text-transform: uppercase;
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
    user-select: none;
    transition: transform 250ms linear;
}

.tile.dummy {
    width: 1.75em;
    height: 1.75em;
    margin-right: 1.5em;
}

.tile[data-state="next"]{
    border: .075em dashed black;
}

.tile[data-state="active"]{
    border-color: hsl(200, 1%, 34%);
    color: black;
}

.tile[data-state="wrong"] {
    border: none;
    background-color: hsl(0, 0%, 50%);
}

.tile[data-state="wrong-location"] {
    border: none;
    background-color: hsl(9, 80%, 56%);
}

.tile[data-state="correct"] {
    border: none;
    background-color: hsl(178, 100%, 19%);
}

.shake {
    animation: shake 250ms ease-in-out;
}

.tile.dance {
    animation: dance 500ms ease-in-out;
}

.tile.flip {
    transform: rotateX(90deg);
}

@keyframes shake {
    10% {
        transform: translateX(-5%);
    }

    30% {
        transform: translateX(5%);
    }

    50% {
        transform: translateX(-7.5%);
    }

    70% {
        transform: translateX(7.5%);
    }

    90% {
        transform: translateX(-5%);
    }

    100% {
        transform: translateX(0);
    }
}

@keyframes dance {
    20% {
        transform: translateY(-50%);
    }

    40% {
        transform: translateY(5%);
    }

    60% {
        transform: translateY(-25%);
    }

    80% {
        transform: translateY(2.5%);
    }

    90% {
        transform: translateY(-5%);
    }

    100% {
        transform: translateY(0%);
    }
}

.alert-container {
    position: fixed;
    top: 10vh;
    left: 50vw;
    transform: translateX(-50%);
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.alert-container.stats {
    top: clamp(1em, 60vh, 30em);
}

.alert {
    border: none;
    pointer-events: none;
    background-color: hsl(64, 64%, 61%);
    padding: .75em;
    border-radius: .25em;
    opacity: 1;
    transition: opacity 500ms ease-in-out;
    margin-bottom: .5em;
}

.alert:last-child {
    margin-bottom: 0;
}

.alert.hide {
    opacity: 0;
}