/**
 * @license
 * SPDX-FileCopyrightText: 2026 The Algorist
 * SPDX-License-Identifier: Unlicense
 */

@font-face {
    font-family: 'pixelzone';
    src: url('./fonts/pixelzone.ttf') format('truetype');
    font-display: block;
}

:root {
    --aspect-width: 16;
    --aspect-height: 9;
    --bottom-space: 105px;
    --btn-h: 56px;
    --gap: 20px;
    --top-gap: 20px;
}

.ui-mobile-mode {
    --bottom-space: 85px;
    --btn-h: 46px;
    --gap: 6px;
    --top-gap: 10px;
}

html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: fixed;
    top: 0;
    left: 0;
    contain: paint size layout;
}

body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: fixed;
    top: 0;
    left: 0;
    background-color: #FAF9F6;
}

    body:focus {
        outline: none;
    }

.canvas-container {
    position: absolute;
    top: calc(var(--top-gap) + (100dvh - var(--bottom-space) - env(safe-area-inset-bottom, 0px) - var(--top-gap)) / 2);
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pinch-zoom;
}

.art-canvas-surface {
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
    max-width: none;
    max-height: none;
    touch-action: pinch-zoom;
}

    .art-canvas-surface.art-canvas-visible {
        opacity: 1;
    }

@media (orientation: landscape) {
    .canvas-container {
        width: calc((100dvh - var(--bottom-space) - env(safe-area-inset-bottom, 0px) - var(--top-gap)) * (var(--aspect-width) / var(--aspect-height)));
        height: calc(100dvh - var(--bottom-space) - env(safe-area-inset-bottom, 0px) - var(--top-gap));
        max-width: 100vw;
        transform: translate(-50%, -50%) rotate(0deg);
    }

    .ui-bottom-bar {
        width: calc((100dvh - var(--bottom-space) - env(safe-area-inset-bottom, 0px) - var(--top-gap)) * (var(--aspect-width) / var(--aspect-height)));
        max-width: 100vw;
    }

    .ui-element {
        flex: 1;
        width: auto;
        letter-spacing: 2px;
    }
}

@media (orientation: portrait) {
    .canvas-container {
        width: calc(100dvh - var(--bottom-space) - env(safe-area-inset-bottom, 0px) - var(--top-gap));
        height: 100vw;
        max-width: 100dvh;
        max-height: 100vw;
        transform: translate(-50%, -50%) rotate(90deg);
    }

    .ui-bottom-bar {
        width: 100vw;
        max-width: 100vw;
    }

    .ui-element {
        letter-spacing: 2px;
        font-size: clamp(24px, 6vw, 42px) !important;
    }
}

.ui-element {
    height: var(--btn-h);
    font-size: clamp(14px, 4.5cqi, 48px);
    box-sizing: border-box;
    flex: 1;
    min-width: 0;
    border-radius: 0px;
    border: none;
    font-family: 'pixelzone', monospace;
    font-weight: 400;
    text-transform: uppercase;
    -webkit-font-smoothing: none;
    -moz-osx-font-smoothing: none;
    font-smooth: never;
    image-rendering: pixelated;
    touch-action: manipulation;
    cursor: pointer;
    background-color: transparent;
    color: #555;
    outline: none;
    white-space: nowrap;
    padding: 0 4px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 2px 0 0 #888, 2px 0 0 0 #888, 0 -2px 0 0 #888, -2px 0 0 0 #888;
    transform: scale(1);
    transition: background-color 0.25s cubic-bezier(0.4, 0, 0.2, 1), color 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.1s ease;
}

    .ui-element:active:not(:disabled),
    .ui-element.ui-active,
    .ui-element:disabled {
        box-shadow: 0 2px 0 0 #555, 2px 0 0 0 #555, 0 -2px 0 0 #555, -2px 0 0 0 #555 !important;
        color: #555 !important;
        transform: scale(0.96) !important;
    }

    .ui-element:active:not(:disabled),
    .ui-element.ui-active {
        background-color: transparent !important;
    }

    .ui-element:disabled {
        pointer-events: none !important;
        cursor: not-allowed !important;
        transition: none !important;
    }

.ui-bottom-bar {
    position: fixed;
    bottom: 0px;
    left: 50%;
    transform: translateX(-50%);
    height: calc(var(--bottom-space) + env(safe-area-inset-bottom, 0px));
    z-index: 1000;
    background-color: transparent;
    box-sizing: border-box;
    padding: 0 var(--gap) env(safe-area-inset-bottom, 0px) var(--gap);
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: var(--gap);
}

div[id*="goog"], div[class*="goog"], iframe[id*="goog"], .skiptranslate, #goog-gt-tt {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    position: absolute !important;
    top: -9999px !important;
    left: -9999px !important;
    content-visibility: hidden !important;
}

@media (prefers-color-scheme: dark) {
    body {
        background-color: #121212;
    }

    .ui-element {
        color: #AAA;
        box-shadow: 0 2px 0 0 #777, 2px 0 0 0 #777, 0 -2px 0 0 #777, -2px 0 0 0 #777;
    }

        .ui-element:active:not(:disabled),
        .ui-element.ui-active,
        .ui-element:disabled {
            box-shadow: 0 2px 0 0 #AAA, 2px 0 0 0 #AAA, 0 -2px 0 0 #AAA, -2px 0 0 0 #AAA !important;
            color: #AAA !important;
        }
}

canvas {
    opacity: 1;
    transition: opacity 0.5s ease-in-out;
}

.canvas-fade {
    opacity: 0;
}

::view-transition-old(root),
::view-transition-new(root) {
    animation-duration: 0.5s;
    animation-timing-function: ease-in-out;
}
