* {
    box-sizing: border-box;
    font-family: Montserrat;
}

h1 {
    font-size: 40px;
}

h2 {
    font-size: 32px;
}

h1, h2 {
    font-weight: normal;
    line-height: 1.0;
    text-align: center;
    margin: 0;
}

body {
    background: #DDD;

    margin: 0;
    height: 100vh;

    display: grid;
    grid: 64px 3fr minmax(180px, 1fr) / auto;
}

header {
    max-width: 400px;
    width: 100%;
    margin: auto;
    display: grid;
    grid: auto / 80px auto 80px;
}

header .hide {
    display: revert;
    visibility: hidden;
}

#board {
    margin-bottom: 6px;
    max-height: calc(100vw / 5 * 6);
}

.row {
    display: flex;
    justify-content: center;
    gap: 4px;
    height: calc(100% / 6 - 12px);
    margin-bottom: 12px;
}

.sample-row {
    display: flex;
    justify-content: center;
    gap: 4px;
    height: 50px;
    margin-top: 8px;
    margin-bottom: 20px;
}

.sample-row .cell {
    font-size: 35px;
}

.row.shake .cell {
    animation: shake 0.4s ease 1;
}

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

    20%, 60% {
        transform: translateX(-10%);
    }

    40%, 80% {
        transform: translateX(10%);
    }
}

.cell {
    font-size: min(calc(10vh - 30px), calc(18vw - 25px));
    font-weight: 600;
    line-height: 0;
    color: transparent;

    background: #EEE;
    --front: #CCC;
    --highlight: #FFF;
    --shadow: #DDD;
    box-shadow: 0 8px var(--front),
        inset 1px 2px 2px var(--highlight),
        inset -1px -2px 2px var(--shadow),
        0 12px 4px rgba(0, 0, 0, 0.2);
    border-radius: 12%;

    display: flex;
    align-items: center;
    justify-content: center;

    width: calc(20% - 8px);
    max-width: 100px;

    transition: background-color 0.2s, color 0.2s, box-shadow 0.2s;
}

@supports (aspect-ratio: 1) {
    .cell {
        aspect-ratio: 1;
        width: auto;
        max-width: none;
    }
}

.height-fix .cell {
    height: 100%;
}

.cell.filled {
    color: #444;
}

.cell.incorrect {
    background: #AAA;
    --front: #777;
    --highlight: #BBB;
    --shadow: #999;
}

.cell.close {
    background: #FC0;
    --front: #C80;
    --highlight: #FD2;
    --shadow: #EA0;
}

.cell.correct {
    background: #5C0;
    --front: #2A2;
    --highlight: #6E0;
    --shadow: #3B0;
}

#keyboard {
    display: grid;
    grid: repeat(3, 1fr) / auto;
    gap: 2px;
    margin-bottom: 6px;
}

.key-row {
    display: flex;
    justify-content: center;
    gap: 2px;
}

.key {
    font-size: 20px;
    background: #BBB;
    color: #444;
    transition: background-color 0.2s, color 0.2s, transform 50ms;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;

    height: 100%;
    width: 8%;
    border-radius: 8px;

    cursor: pointer;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.key.pressed {
    transform: scale(0.9);
}

@supports (aspect-ratio: 1) {
    .key {
        aspect-ratio: 0.6;
        max-width: calc(10% - 2px);
        width: auto;
    }

    .key.wide {
        aspect-ratio: 0.9;
        max-width: calc(15% - 2px);
    }
}

.key.incorrect {
    background: #888;
    color: white;
}

.key.close {
    background: #FC0;
    color: #444;
}

.key.correct {
    background: #5C0;
    color: #444;
}

.container {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.4);
}

.hide {
    display: none;
}

.popup {
    background: white;
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.4);

    border-radius: 12px;
    padding: 20px;

    width: 90%;
    max-width: 500px;
    max-height: 95%;
    overflow-y: auto;

    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.center {
    text-align: center;
}

details {
    margin-bottom: 10px;
}

input[type="checkbox"] {
    margin-left: 0;
    margin-right: 6px;
    vertical-align: top;
}

.small {
    color: #555;
    font-size: smaller;
}

button {
    font-size: 1.2rem;
    background: #DDD;
    border: none;

    display: block;
    padding: 15px 30px;
    border-radius: 12px;
    margin: auto;

    cursor: pointer;
}

@media screen and (max-width: 600px) {
    button {
        width: 90%;
    }
}

button.confirm {
    background: #5C0;    
}

button.minimal {
    padding: 0;
    margin: 0;
    width: auto;
}

.button-row button {
    display: inline-block;
    margin-bottom: 4px;
}
