/**************************************************
*                   game-container                *
**************************************************/

/* Common to all devices */
:root {
    --letter-font-size: min(7.25vw);
    --letter-container-width: min(8vw);
    --key-width: min(7vw);
    --status-font-size: min(12px);
    --title-font-size: min(56px);
    --subtitle-font-size: min(16px);
    --footer-font-size: min(10px);
    --color-correct: rgb(137, 233, 137);
    --color-elsewhere: rgb(238, 222, 152);
    --color-miss: #aaa;
    --color-default: white;
    --color-status-error: #822;
    --color-status-winner: rgb(16, 124, 16);
    --color-status-loser: #822;
    --color-status: #000;
    --color-game-font: #2c3e50;
    --color-game-background: #f0f0f0;
    --color-title: #a22;
    --color-subtitle: #888;
    --color-stats-background: white;
    --color-stats-text: #444;
    --color-cursor-box: #a22;
    --color-modal-game-background: white;
    --color-viewport-color: #aaa;
}

/* Overrides for desktop */
@media (min-width: 576px) {
    :root {
        --letter-font-size: min(30px);
        --letter-container-width: min(35px);
        --key-width: min(25px);
        --status-font-size: min(12px);
        --title-font-size: min(56px);
        --subtitle-font-size: min(18px);
        --footer-font-size: min(10px);
    }
}

@media (min-width: 768px) {}

@media (min-width: 992px) {}

@media (min-width: 1200px) {}

@media (min-width: 1400px) {}

@font-face {
  font-family: 'Caveat';
  src: url('/fonts/Caveat-Medium.ttf') format('truetype');
  font-weight: 500;
  font-style: normal;
}

/* CONFIGURE OPTION(S) */ 
    .x-hard-mode-feature   { display: none;}    /* disable x-hard mode */

/* MAIN CSS BEGINS */
html,
#root {
    display: flex;
    justify-content: center;
}

html {
    height: 100%;
    background-color: var(--color-viewport-color);
    align-items: flex-start;
}

#root {
    width: 100%;
    align-items: center;
}

div {
    box-sizing: border-box;
}

body {
    height: 100%;
    width: auto;
    margin: 0 10px;
    display: flex;
}

#game-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    position: static;
    padding: 5px 10px;
    width: 100%;
    margin: 5px 0;
    font-family: Arial, sans-serif;
    color: var(--color-game-font);
    background-color: var(--color-game-background);
    border: 1px solid #aaa;
    box-shadow: 7px 7px #999;
    touch-action: none;
}

.modal-active #game-content {
    opacity: 0.3;
    transition: opacity 0.25s linear 4s;
}

.disable-tap-zoom {
    touch-action: none;
}

#game-content>.title,
#game-content>.subtitle {
    font-family: "Caveat", cursive;
    font-weight: 500;
    line-height: 90%;
}

#game-content>.title {
    font-size: var(--title-font-size);
    color: var(--color-title);
    margin: 10px 0 0 0;
}

#game-content>.subtitle {
    font-size: var(--subtitle-font-size);
    color: var(--color-subtitle);
    margin: 0;
}

#game-ui {
    margin-top: 15px;
}

.footer .correct {
    background-color: var(--color-correct);
}

.footer .elsewhere {
    background-color: var(--color-elsewhere);
}

.footer .miss {
    background-color: var(--color-miss);
}

.footer {
    font-size: var(--footer-font-size);
    font-weight: bold;
    margin: auto;
}

.footer hr {
    margin-top: 15px;
    opacity: 0.5;
}

.smaller-text {
    font-weight: normal;
    font-size: 80%;
}

.version-info {
    color: #bbb;
}

input.hard-checkbox {
    height: var(--footer-font-size);
    width: var(--footer-font-size);
}

.status-area {
    min-height: calc(var(--status-font-size) * 1.25);
    margin-top: 10px;
    font-size: var(--status-font-size);
}

.status {
    margin: 0;
}

.status.error {
    color: var(--color-status-error);
}

.status.winner {
    color: var(--color-status-winner);
}

.status.loser {
    color: var(--color-status-loser);
}

.color-code-guide {
    display: flex;
    justify-content: space-around;
}

/**************************************************
*                   key                           *
**************************************************/

button.key-button,
button.close-button {
    display: inline-block;
    border: 2px solid grey;
    border-radius: calc(var(--key-width) * 0.2);
    padding: 2px calc(var(--key-width) * 0.1);
    margin: 0 calc(var(--key-width) * 0.1);
    min-width: var(--key-width);
    height: auto;
    font-size: calc(var(--key-width) * 0.5);
    font-weight: 500;
    color: black;
}

/* keys disabled by default, enabled selectively below */
button.key-button,
.modal-active.modal-active.modal-active button.key-button {
    opacity: 0.4;
    pointer-events: none;
}

button.key-button:active {
    border: 2px solid black;
}

/* 
enable keys at desired times, based on game state,
and the position of the cursor in the edited line.
*/
.gamestate-playing .keyboard.enable-delete .key-delete,
.gamestate-playing .keyboard.enable-enter .key-enter,
.gamestate-playing .keyboard:not(.enable-enter) .alpha,
.gamestate-won .key-reset,
.gamestate-lost .key-reset {
    opacity: 1;
    pointer-events: all;
}

/* handle key color values */
.key-button.default {
    background-color: var(--color-default);
}

.key-button.miss {
    background-color: var(--color-miss);
}

.key-button.elsewhere {
    background-color: var(--color-elsewhere);
}

.key-button.correct {
    background-color: var(--color-correct);
}

/* 
     key down immediately makes dark, when down is removed, 
     fade back to normal
*/
.key-button {
    transition: all 0.2s 0s;
}

.key-button.key-down {
    color: white;
    background-color: #444;
    transition: all 0s 0s;
}

/*   if expert mode, disable the key if it's a miss.
     Duplicate .miss to increase priority of selector 
*/
.enable-hard-mode .key-button.miss.miss {
    opacity: 0.4;
    pointer-events: none;
}

/**************************************************
*                   keyboard                      *
**************************************************/
.keyboard .kb-row {
    display: flex;
    justify-content: center;
    margin: 1.5vh 0 0 0;
}

.keyboard {
    margin-top: 3vh;
    margin-bottom: 2vh;
}

/**************************************************
*                   guess-letter                  *
**************************************************/

.guess-letter {
    display: inline-block;
    position: absolute;
    height: 100%;
    width: 100%;
}

/* opposing sides of the wrapper content */
.back,
.front {
    position: absolute;
    backface-visibility: hidden;
    height: 100%;
    width: 100%;
}

.back {
    transform: rotateY(180deg);
}

/* when reveal class added, flip the wrapper div over to expose colored div */
.reveal .guess-letter {
    transform: rotateY(180deg);
}

.guess-letter.miss .back {
    background-color: var(--color-miss);
}

.guess-letter.correct .back {
    background-color: var(--color-correct);
}

.guess-letter.elsewhere .back {
    background-color: var(--color-elsewhere);
}

/**************************************************
*                   guess-word                    *
**************************************************/

.guess-letter {
    position: absolute;
    left: 0;
    top: 0;
    display: inline-block;
    width: 100%;
    height: 100%;
    font-size: var(--letter-font-size);
    font-weight: normal;
    font-family: Arial, sans-serif;
    transition: transform 0.75s;
    transform-style: preserve-3D;
}

.guess-row {
    display: flex;
    justify-content: center;
}

.letter-container {
    position: relative;
    height: var(--letter-container-width);
    width: var(--letter-container-width);
    margin: min(0.5vw, 5px);
    perspective: 500px;
    box-sizing: content-box;
    border: 3px solid #ccc;
}

.gamestate-playing .guess-row.focus>.letter-container {
    border: 3px solid #888;
}

.gamestate-playing .guess-row.focus>.letter-container.focus {
    border: 3px solid var(--color-cursor-box);
    background-color: #fee;
}

.guess-row.previous .letter-container {
    border: 3px solid #888;
}

@keyframes shake {
    0% {
        transform: translate(1px, 1px) rotate(0deg);
    }

    10% {
        transform: translate(-1px, -2px) rotate(-2deg);
    }

    20% {
        transform: translate(-3px, 0px) rotate(2deg);
    }

    30% {
        transform: translate(3px, 2px) rotate(0deg);
    }

    40% {
        transform: translate(1px, -1px) rotate(3deg);
    }

    50% {
        transform: translate(-1px, 2px) rotate(-3deg);
    }

    60% {
        transform: translate(-3px, 1px) rotate(0deg);
    }

    70% {
        transform: translate(3px, 1px) rotate(-4deg);
    }

    80% {
        transform: translate(-1px, -1px) rotate(1deg);
    }

    90% {
        transform: translate(1px, 2px) rotate(0deg);
    }

    100% {
        transform: translate(1px, -2px) rotate(-3deg);
    }
}

.gamestate-won .guess-row.latest-reveal {
    animation: shake 0.5s;
    animation-iteration-count: 2;
    animation-delay: 2s;
}

/* flip the columns .5s apart */
.reveal .letter-container:nth-child(2) .guess-letter {
    transition-delay: 0.5s;
}

.reveal .letter-container:nth-child(3) .guess-letter {
    transition-delay: 1s;
}

.reveal .letter-container:nth-child(4) .guess-letter {
    transition-delay: 1.5s;
}

.reveal .letter-container:nth-child(5) .guess-letter {
    transition-delay: 2s;
}

.reveal .letter-container:nth-child(6) .guess-letter {
    transition-delay: 2.5s;
}

/**************************************************
*                   statbar                       *
**************************************************/
.box-bar div {
    padding: 0;
}

.box-bar {
    height: 15px;
    width: 280px;
    font-size: max(0.7vw, 70%);
    display: flex;
    justify-content: flex-start;
    align-items: center;
    margin: 0 0 5px 0;
    position: relative;
    padding: 0;
}

.box-caption1 {
    height: 100%;
    flex: 0 0 50px;
    padding-top: 2px;
}

.box-caption2 {
    height: 100%;
    flex: 0 0 35px;
    padding-top: 2px;
}

.box {
    height: 100%;
    flex: 1 0 auto;
    border: 1px dotted #aaa;
    margin: 0 -1px 0 0;
}

.box.filled {
    border: 1px solid black;
    background-color: var(--color-correct);
}

.bar-missed-pct .box.filled {
    border: 1px solid black;
    background-color: var(--color-miss);
}

/**************************************************
*                   statbox                       *
**************************************************/
.stat-box.show-dialog {
    display: block;
    visibility: visible;
    transform: scale(1, 1);
    transition: transform 0.25s linear 4s;
}

.stat-box {
    display: block;
    border: 2px solid #777;
    border-radius: 15px;
    width: auto;
    height: auto;
    position: absolute;
    background-color: var(--color-stats-background);
    color: var(--color-stats-text);
    padding: 5px;
    transform: scale(0, 0);
    visibility: hidden;
    z-index: 1;
}

.close-button {
    display: flex;
    justify-content: center;
    margin: 15px 0 5px 0;
}

.close-button button:hover {
    cursor: pointer;
    border-color: #444;
}

.stat-box.show-dialog .close-button button {
    pointer-events: all;
}

h1 {
    font-size: larger;
    margin: 10px 0;
}

h2 {
    font-size: large;
    margin: 25px 0 7px 0;
}

.modal-active .game-container {
    opacity: 0.4;
    transition: all 0.4s linear 4s;
    background-color: var(--color-modal-game-background);
}

/**************************************************
*                  Misc                           *
**************************************************/
.debug .dbg-green {
    border: 1px solid green;
}

.debug .dbg-red {
    border: 1px solid red;
}

.debug .dbg-yellow {
    border: 1px solid red;
}

.debug .dbg-blue {
    border: 1px solid blue;
}