@import url("https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;800&display=swap");

* {
    /* border: 1px solid #FF000080; */
    margin: 0px;
    user-select: none;

    transition-property: all;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

html {
    height: 100%;
}

body {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 0px;
    background: darkgreen;
    width: 100%;
    height: 100%;
    font-family: "JetBrains Mono", "Roboto Mono", monospace;
}

#total {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: white;
    font-size: 72px;
    font-weight: 800;
    text-align: center;

    &.pulse-anim {
        animation: pulse 250ms ease-in-out;
    }

    &.danger {
        animation: flash 1s linear infinite, pulse 250ms ease-in-out;
    }

    &.over {
        color: red;
    }
}

.container {
    max-width: 500px;
}

.grid {
    display: flex;
    padding: 5px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.card {
    position: relative;
    width: 72px;
    height: 86px;
    padding-left: 4px;
    background: white;
    color: #1a1a1a;
    font-size: 32px;
    font-weight: 800;
    border: 3px solid darkgray;
    border-radius: 10px;
    box-shadow: 3px 3px 10px black;

    --rot: 0deg;

    &:active {
        border-color: gold;
    }

    &:hover {
        border-color: #a0d0ff;
        transform: rotate(var(--rot));
    }

    &::after {
        content: attr(data-desc);
        position: absolute;
        bottom: 2px;
        right: 2px;
        font-size: 10px;
        font-weight: 800;
        color: darkgray;
    }
}

.hidden {
    display: none;
}

.controls {
    display: flex;
    gap: 5px;
    padding: 2px;
    align-items: end;
    width: 95%;
    height: 32px;

    & > * {
        border: 2px darkgray solid;
        border-radius: 5px;
        height: 32px;
    }
}

.btn:hover:not(.disabled),
#history:hover {
    border-color: #a0d0ff;
}

.btn {
    background: white;
    color: #1a1a1a;
    width: 32px;

    &.disabled {
        opacity: 0.5;
    }
}

#history {
    z-index: 99;
    flex-grow: 1;
    font-size: 14px;
    background: white;
    min-height: 32px;
    height: fit-content;
    max-height: 32px;
    display: flex;
    flex-direction: column;
    justify-content: end;
    overflow: hidden;

    &.full-list {
        max-height: 95dvh;
        border: 2px #a0d0ff solid;

        & .history-event {
            white-space: wrap;

            &::before {
                background: none;
            }
        }

        & .history-event:not(:last-child) {
            border-bottom: 1px solid darkgray;
        }
    }

    & .history-event {
        position: relative;
        display: inline-block;
        min-height: 32px;
        vertical-align: middle;
        align-content: center;
        animation: slide-in 1s;
        padding-left: 4px;
        white-space: nowrap;
        border-bottom: 1px solid transparent;

        &:before {
            content: "";
            background: linear-gradient(to right, transparent 90%, white);
            width: 100%;
            height: 100%;
            position: absolute;
            top: 0;
            left: 0;
        }

        &:last-child {
            margin-bottom: -1px;
        }
    }

    & .undo {
        animation: slide-in reverse 250ms;
    }
}

@keyframes flash {
    50% {
        color: red;
    }
}

@keyframes pulse {
    0% {
        scale: 1.3;
    }

    10% {
        scale: 1.29;
    }
}

@keyframes slide-in {
    0% {
        opacity: 0%;
        margin-bottom: -32px;
    }

    100% {
        opacity: 1;
        margin-bottom: -1px;
    }
}
