:root {
    --color-bg-light: #f8f8f8;
    --color-accent-light: #e8e8e8;
    --color-text-light: #383838;
    --color-text-muted-light: #c8c8c8;

    --color-bg-dark: #282828;
    --color-accent-dark: #3c3c3c;
    --color-text-dark: #d4d4d4;
    --color-text-muted-dark: #858585;

    --color-bg: var(--color-bg-light);
    --color-accent: var(--color-accent-light);
    --color-text: var(--color-text-light);
    --color-text-muted: var(--color-text-muted-light);
    color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
    :root:not(.light) {
        --color-bg: var(--color-bg-dark);
        --color-accent: var(--color-accent-dark);
        --color-text: var(--color-text-dark);
        --color-text-muted: var(--color-text-muted-dark);
        color-scheme: dark;
    }
}

:root.dark {
    --color-bg: var(--color-bg-dark);
    --color-accent: var(--color-accent-dark);
    --color-text: var(--color-text-dark);
    --color-text-muted: var(--color-text-muted-dark);
    color-scheme: dark;
}

:root.light {
    color-scheme: light;
}

html {
    box-sizing: border-box;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

*,
*::before,
*::after {
    box-sizing: inherit;
}

html,
body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

body {
    background-color: var(--color-bg);
    color: var(--color-text);
    font-family: 'Press Start 2P', monospace, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    min-height: 100svh;
    overflow: hidden;
}

[hidden] {
    display: none !important;
}

.container {
    width: 100%;
    max-width: 800px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 10px 0;
    flex-grow: 1;
}

.header,
.footer {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
}

.header {
    margin-top: 10px;
}

.footer {
    flex-direction: column;
    gap: 5px;
    margin-bottom: 10px;
}

.title-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 5px;
    flex-grow: 1;
}

.title {
    font-size: clamp(18px, 2.4vw, 24px);
    font-weight: normal;
    line-height: 1;
    margin: 0;
}

.env-tag {
    display: inline-flex;
    align-items: center;
    font-size: clamp(9px, 1.2vw, 12px);
    line-height: 1.2;
    padding: 2px 6px;
    border-radius: 4px;
    background-color: var(--color-accent);
    color: var(--color-text);
}

.stats {
    display: grid;
    grid-template-rows: auto auto;
    grid-auto-flow: column;
    justify-content: start;
    row-gap: 0.6rem;
    column-gap: 1.3rem;
    margin: 0;
    padding: 0;
    text-align: center;
}

.stats dt {
    grid-row: 1;
    font-size: clamp(9px, 1.2vw, 10px);
    color: var(--color-text-muted);
    font-weight: normal;
    margin: 0;
}

.stats dd {
    min-height: 1em;
    grid-row: 2;
    font-size: clamp(10px, 1.4vw, 14px);
    font-weight: normal;
    margin: 0;
}

#stats-grid-food {
    min-width: 5ch;
}

.content {
    box-sizing: content-box;
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    border: 1px solid var(--color-accent);
}

.content>* {
    box-sizing: border-box;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--color-bg);
}

#canvas {
    z-index: 1;
    cursor: pointer;
    touch-action: none;
    pointer-events: auto;
}

body.loading #canvas {
    display: none;
}

#loader {
    display: none;
    z-index: 2;
    justify-content: center;
    align-items: center;
}

#loader::after {
    content: "";
    width: 40px;
    height: 40px;
    background-color: var(--color-accent);
    animation: spin-pulse 1.5s ease-in-out infinite;
}

@keyframes spin-pulse {
    0% {
        transform: scale(0.8) rotate(0deg);
    }

    50% {
        transform: scale(1.2) rotate(360deg);
    }

    100% {
        transform: scale(0.8) rotate(360deg);
    }
}

body.loading #loader {
    display: flex;
}

#about {
    z-index: 3;
    padding: 20px 20px;
}

#about-content {
    overflow-y: auto;
    max-height: 100%;
    width: 100%;
    padding-right: 15px;
    font-size: clamp(10px, 1.4vw, 14px);
    text-align: left;
    line-height: 1.7;
    letter-spacing: 0.01em;
    font-weight: 400;
    pointer-events: auto;
    touch-action: auto;
    -webkit-overflow-scrolling: touch;
}

#about-content h3 {
    margin: 18px 0 10px;
    font-size: clamp(11px, 1.5vw, 15px);
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0.02em;
}

#about-content h3:first-of-type {
    margin-top: 0;
}

.about-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    align-items: center;
    justify-content: flex-start;
    margin-top: 30px;
}

.about-meta__version {
    font-size: clamp(9px, 1.2vw, 12px);
    color: var(--color-text-muted);
}

#about-content ul {
    margin: 0;
    padding-left: 15px;
}

#about-content li {
    margin-bottom: 8px;
}

#about-content p {
    margin: 0 0 14px;
}

.button-row {
    display: flex;
    flex-direction: row;
    gap: 8px;
    justify-content: center;
    align-items: center;
}

.button-row button {
    font-family: inherit;
    font-size: 10px;
    color: var(--color-text-muted);
    padding: 7px 10px;
    border: none;
    background-color: var(--color-bg);
    cursor: pointer;
    min-width: 80px;
    width: auto;
    pointer-events: auto;
    touch-action: manipulation;
}

.button-row button:hover {
    color: var(--color-text);
}


@media (max-width: 850px) {
    .header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .title-wrapper {
        margin-bottom: 8px;
    }
}

@media (max-width: 800px) {
    .content {
        border-left: none;
        border-right: none;
    }
}
