html, body, #app {
    width: 100%;
    height: 100%;
    margin: 0;
    background: #0d1117;
    overscroll-behavior: none;
}

body {
    font-family: Consolas, "Cascadia Mono", "Courier New", monospace;
    overflow: hidden;
}

.klooie-host {
    --klooie-layer-canvas: 0;
    --klooie-layer-zoom: 30;
    --klooie-layer-touch-controller: 40;
    --klooie-layer-encourage: 50;
    --klooie-layer-orientation: 60;
    position: relative;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    background: #000;
    box-sizing: border-box;
}

.klooie-host.klooie-mobile-portrait-blocked > .klooie-canvas {
    visibility: hidden;
}

.klooie-touch-controller {
    --klooie-touch-lift: clamp(14px, 4dvh, 32px);
    --klooie-touch-system-left: max(22px, env(safe-area-inset-left));
    --klooie-touch-system-bottom: max(8px, env(safe-area-inset-bottom));
    --klooie-touch-system-height: clamp(32px, 8dvh, 38px);
    --klooie-touch-system-clearance: clamp(8px, 2.5dvh, 14px);
    --klooie-touch-stick-left: max(14px, env(safe-area-inset-left));
    --klooie-touch-stick-bottom: calc(var(--klooie-touch-system-bottom) + var(--klooie-touch-system-height) + var(--klooie-touch-system-clearance));
    --klooie-touch-stick-width: clamp(136px, 25vw, 240px);
    --klooie-touch-stick-height: clamp(118px, 32dvh, 190px);
    --klooie-touch-stick-base-size: clamp(84px, 24dvh, 126px);
    --klooie-touch-stick-center-offset: clamp(42px, 12dvh, 63px);
    --klooie-touch-face-right: max(18px, env(safe-area-inset-right));
    --klooie-touch-face-bottom: calc(max(14px, env(safe-area-inset-bottom)) + var(--klooie-touch-lift));
    --klooie-touch-face-width: clamp(150px, 28vw, 218px);
    --klooie-touch-face-height: clamp(132px, 36dvh, 190px);
    --klooie-touch-face-center-offset: clamp(75px, 14vw, 109px);
    --klooie-touch-button-size: clamp(48px, 15dvh, 68px);
    --klooie-touch-shoulder-width: clamp(56px, 12vw, 82px);
    --klooie-touch-shoulder-height: clamp(34px, 10dvh, 48px);
    --klooie-touch-shoulder-lift: clamp(22px, 5dvh, 40px);
    position: fixed;
    inset: 0;
    z-index: var(--klooie-layer-touch-controller);
    pointer-events: none;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.klooie-touch-controller-enter {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 420ms ease, transform 420ms ease;
}

.klooie-touch-controller-enter.is-visible {
    opacity: 1;
    transform: translateY(0);
}

    .klooie-touch-controller button {
        position: relative;
        pointer-events: auto;
        touch-action: none;
        border: 1px solid rgba(255, 255, 255, .36);
        border-radius: 999px;
        color: rgba(255, 255, 255, .9);
        background: rgba(14, 20, 28, .34);
        box-shadow: 0 6px 18px rgba(0, 0, 0, .22), inset 0 0 18px rgba(255, 255, 255, .08);
        font: 700 16px Consolas, "Cascadia Mono", "Courier New", monospace;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

        .klooie-touch-controller [data-button].is-encouraged {
            z-index: 2;
            scale: 1;
            overflow: visible;
            animation: klooie-touch-encourage-pulse 1.15s ease-in-out infinite;
        }

        .klooie-touch-controller [data-button].is-encouraged::before {
            content: "";
            position: absolute;
            inset: -18px;
            border-radius: inherit;
            background: radial-gradient(circle, rgba(255, 232, 120, .58), rgba(255, 156, 64, .30) 44%, rgba(255, 156, 64, 0) 72%);
            filter: blur(1px);
            z-index: -1;
            pointer-events: none;
            animation: klooie-touch-encourage-glow 1.15s ease-in-out infinite;
        }

        .klooie-touch-stick-base.is-encouraged::before {
            border-radius: 50%;
        }

.klooie-touch-face button,
.klooie-touch-shoulders button {
    border-radius: 14px;
}

        .klooie-touch-controller button.is-pressed {
            background: rgba(255, 255, 255, 1);
            border-color: rgba(255, 255, 255, 1);
            color: rgba(15, 23, 42, 1);
            box-shadow: none;
        }

        .klooie-touch-controller [data-button].is-disabled {
            opacity: .34;
            filter: saturate(.55);
        }

.klooie-horizontal-required {
    position: absolute;
    inset: 0;
    display: none;
    place-items: center;
    color: white;
    background: rgba(0, 0, 0, .78);
    z-index: var(--klooie-layer-orientation);
    pointer-events: auto;
}

.klooie-touch-encourage-drawer {
    position: fixed;
    left: 0;
    top: 0;
    width: 100vw;
    box-sizing: border-box;
    padding: calc(max(10px, env(safe-area-inset-top)) + 8px) max(18px, env(safe-area-inset-right)) 13px max(18px, env(safe-area-inset-left));
    color: rgba(255, 255, 255, .98);
    background: rgba(8, 13, 20, .88);
    border-bottom: 1px solid rgba(255, 255, 255, .24);
    box-shadow: 0 10px 28px rgba(0, 0, 0, .32), 0 0 22px rgba(255, 204, 92, .18);
    font: 800 clamp(16px, 4.6dvh, 24px) Consolas, "Cascadia Mono", "Courier New", monospace;
    text-align: center;
    z-index: var(--klooie-layer-encourage);
    pointer-events: none;
    animation: klooie-touch-drawer-in 220ms ease-out both;
}

    .klooie-touch-encourage-drawer[hidden] {
        display: none;
    }

.klooie-touch-controller.requires-horizontal.is-portrait .klooie-horizontal-required {
    display: grid;
}

.klooie-zoom-control {
    position: fixed;
    left: 50%;
    top: max(10px, env(safe-area-inset-top));
    transform: translateX(-50%);
    z-index: var(--klooie-layer-zoom);
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 999px;
    background: rgba(8, 13, 20, .66);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .28);
    pointer-events: auto;
    user-select: none;
    -webkit-user-select: none;
    opacity: 1;
    transition: opacity 180ms ease;
}

    .klooie-zoom-control.is-dimmed {
        opacity: .34;
    }

    .klooie-zoom-control.is-hidden-by-encourage {
        opacity: 0;
        pointer-events: none;
    }

    .klooie-zoom-control button {
        width: 36px;
        height: 36px;
        padding: 0;
        border: 1px solid rgba(255, 255, 255, .30);
        border-radius: 50%;
        color: rgba(255, 255, 255, .9);
        background: rgba(255, 255, 255, .15);
        font: 700 20px Consolas, "Cascadia Mono", "Courier New", monospace;
        line-height: 1;
    }

    .klooie-zoom-control button:disabled {
        opacity: .38;
    }

    .klooie-zoom-value {
        min-width: 48px;
        color: rgba(255, 255, 255, .92);
        font: 700 13px Consolas, "Cascadia Mono", "Courier New", monospace;
        text-align: center;
    }

.klooie-horizontal-required-card {
    display: grid;
    gap: 14px;
    justify-items: center;
    padding: 28px 34px;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 20px;
    background: rgba(20, 26, 36, .72);
    box-shadow: 0 16px 44px rgba(0, 0, 0, .42);
    font-size: 18px;
    font-weight: 700;
}

.klooie-horizontal-required-icon {
    font-size: 48px;
    line-height: 1;
}

.klooie-mobile-actions {
    position: absolute;
    left: max(10px, env(safe-area-inset-left));
    top: max(10px, env(safe-area-inset-top));
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 999px;
    background: rgba(8, 13, 20, .72);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .32);
    pointer-events: auto;
}

    .klooie-mobile-actions[hidden] {
        display: none;
    }

    .klooie-mobile-actions button {
        min-height: 36px;
        padding: 0 14px;
        font-size: 13px;
        background: rgba(255, 255, 255, .16);
    }

    .klooie-mobile-actions .klooie-mobile-dismiss {
        width: 36px;
        min-width: 36px;
        padding: 0;
    }

.klooie-touch-stick-zone {
    position: absolute;
    left: var(--klooie-touch-stick-left);
    bottom: var(--klooie-touch-stick-bottom);
    width: var(--klooie-touch-stick-width);
    height: var(--klooie-touch-stick-height);
    pointer-events: auto;
    touch-action: none;
}

.klooie-touch-stick-base {
    position: absolute;
    left: 0;
    top: 0;
    width: var(--klooie-touch-stick-base-size);
    aspect-ratio: 1;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, .28);
    background: radial-gradient(circle, rgba(255, 255, 255, .11), rgba(14, 20, 28, .26));
    box-shadow: 0 8px 24px rgba(0, 0, 0, .24), inset 0 0 28px rgba(255, 255, 255, .08);
}

.klooie-touch-stick-label {
    position: absolute;
    left: 50%;
    top: 50%;
    max-width: calc(100% - 16px);
    overflow: hidden;
    text-overflow: ellipsis;
    transform: translate(-50%, -50%);
    color: rgba(255, 255, 255, .78);
    font-size: clamp(12px, 3dvh, 15px);
    font-weight: 700;
    z-index: 1;
    pointer-events: none;
    white-space: nowrap;
}

.klooie-touch-stick-knob {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 46%;
    aspect-ratio: 1;
    border-radius: 50%;
    transform: translate(0, 0);
    margin: -23% 0 0 -23%;
    border: 1px solid rgba(255, 255, 255, .42);
    background: rgba(255, 255, 255, .24);
    box-shadow: 0 5px 16px rgba(0, 0, 0, .25);
}

.klooie-touch-face {
    position: absolute;
    right: var(--klooie-touch-face-right);
    bottom: var(--klooie-touch-face-bottom);
    width: var(--klooie-touch-face-width);
    height: var(--klooie-touch-face-height);
    pointer-events: none;
}

    .klooie-touch-face button {
        position: absolute;
        width: var(--klooie-touch-button-size);
        aspect-ratio: 1;
    }

.klooie-touch-a {
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    background: rgba(16, 185, 129, .34) !important;
}

.klooie-touch-b {
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(239, 68, 68, .34) !important;
}

.klooie-touch-x {
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(59, 130, 246, .34) !important;
}

.klooie-touch-y {
    left: 50%;
    top: 0;
    transform: translateX(-50%);
    background: rgba(234, 179, 8, .34) !important;
}

.klooie-touch-face button.is-pressed {
    background: rgba(255, 255, 255, 1) !important;
}

.klooie-touch-shoulders {
    position: absolute;
    display: grid;
    grid-template-columns: 1fr;
    gap: clamp(5px, 1.4dvh, 8px);
    pointer-events: none;
}

.klooie-touch-left-shoulders {
    left: calc(var(--klooie-touch-stick-left) + var(--klooie-touch-stick-center-offset));
    bottom: calc(var(--klooie-touch-stick-bottom) + var(--klooie-touch-stick-height) + var(--klooie-touch-shoulder-lift) + clamp(6px, 1.6dvh, 10px));
    transform: translateX(-50%);
}

.klooie-touch-right-shoulders {
    right: calc(var(--klooie-touch-face-right) + var(--klooie-touch-face-center-offset));
    bottom: calc(var(--klooie-touch-face-bottom) + var(--klooie-touch-face-height) + var(--klooie-touch-shoulder-lift) + clamp(6px, 1.6dvh, 10px));
    transform: translateX(50%);
}

.klooie-touch-shoulders button {
    min-width: var(--klooie-touch-shoulder-width);
    min-height: var(--klooie-touch-shoulder-height);
    padding: 0 10px;
    font-size: clamp(12px, 3dvh, 15px);
    color: rgba(15, 23, 42, .9);
    background: rgba(255, 255, 255, .54);
}

    .klooie-touch-shoulders button[data-button="6"],
    .klooie-touch-shoulders button[data-button="7"] {
        min-height: calc(var(--klooie-touch-shoulder-height) * 2);
    }

    .klooie-touch-shoulders button.is-pressed {
        color: rgba(15, 23, 42, 1);
        background: rgba(255, 255, 255, 1);
    }

.klooie-touch-system {
    position: absolute;
    left: calc(var(--klooie-touch-stick-left) + var(--klooie-touch-stick-center-offset));
    bottom: var(--klooie-touch-system-bottom);
    display: flex;
    gap: clamp(6px, 1.6vw, 8px);
    pointer-events: none;
    transform: translateX(-50%);
}

    .klooie-touch-system button {
        min-width: clamp(50px, 10vw, 60px);
        min-height: var(--klooie-touch-system-height);
        padding: 0 10px;
        font-size: clamp(12px, 3dvh, 13px);
        background: rgba(14, 20, 28, .42);
    }

@keyframes klooie-touch-encourage-pulse {
    0%, 100% {
        scale: 1;
    }

    50% {
        scale: 1.12;
    }
}

@keyframes klooie-touch-encourage-glow {
    0%, 100% {
        opacity: .58;
    }

    50% {
        opacity: 1;
    }
}

@keyframes klooie-touch-drawer-in {
    from {
        opacity: 0;
        transform: translateY(-100%);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}
        
@media (pointer: fine) and (hover: hover) {
    .klooie-touch-controller {
        display: none;
    }
}

.home-page {
    min-height: 100vh;
    box-sizing: border-box;
    padding: 48px;
    color: #e6edf3;
    background: #0d1117;
}

.home-panel {
    width: min(760px, 100%);
}

.home-panel h1 {
    margin: 0 0 24px 0;
    font-size: 2rem;
    font-weight: 700;
}

.home-panel p {
    color: #9aa7b2;
}

.eyebrow {
    margin: 0 0 8px 0;
    color: #58a6ff;
    font-size: .875rem;
    text-transform: uppercase;
}

.app-list {
    display: grid;
    gap: 12px;
}

.app-link {
    display: grid;
    grid-template-columns: minmax(120px, max-content) 1fr;
    gap: 4px 16px;
    padding: 16px;
    border: 1px solid #30363d;
    border-radius: 8px;
    color: #e6edf3;
    text-decoration: none;
    background: #161b22;
}

.app-link:hover,
.app-link:focus-visible {
    border-color: #58a6ff;
    outline: none;
}

.app-title {
    font-weight: 700;
}

.app-route {
    color: #7ee787;
}

.app-description {
    grid-column: 1 / -1;
    color: #9aa7b2;
}

.klooie-canvas {
    display: block;
    position: relative;
    z-index: var(--klooie-layer-canvas);
    width: 100vw;
    height: 100vh;
    width: 100%;
    height: 100%;
    background: #000;
}

.browser-console-measure {
    position: absolute;
    left: -10000px;
    top: -10000px;
    visibility: hidden;
    font-family: Consolas, "Cascadia Mono", "Courier New", monospace;
    font-size: 1rem;
    line-height: 1;
    white-space: pre;
}

.browser-console-measure-mobile {
    font-weight: 700;
}

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto;
}

.loading-progress circle {
    fill: none;
    stroke: #333;
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: #888;
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    color: #ddd;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "Loading");
}
