@font-face {
    font-family: 'PixelOperator';
    src: url('/static/fonts/pixel_operator/PixelOperator.ttf');
}

@font-face {
    font-family: 'PixelOperator';
    src: url('/static/fonts/pixel_operator/PixelOperator-Bold.ttf');
    font-weight: bold;
}

@font-face {
    font-family: 'PixelOperatorMono';
    src: url('/static/fonts/pixel_operator/PixelOperatorMono.ttf');
}

@font-face {
    font-family: 'MonoCraft';
    src: url('/static/fonts/Monocraft.ttf');
}

:root {
    font-family: 'MonoCraft', 'PixelOperatorMono', 'Courier New', monospace;
    font-smooth: never;
    -webkit-font-smoothing: none;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: geometricPrecision;
    image-rendering: pixelated;

    --base-font-size: 13px;
    --ui-scale: 1;
    --w98-blue: #000078;
    --w98-blue-gradient: linear-gradient(90deg, #000078 0%, #000078 28%, #0f80cd 50%, #000078 72%, #000078 100%);
    --w98-gray: #c0c0c0;
    --w98-gray2: #a6a6a6;
    --ok: #008000;
    --danger: #800000;
}

* {
    box-sizing: border-box;
    scrollbar-width: auto;
    scrollbar-color: #c0c0c0 #808080;
    image-rendering: pixelated;
}

html {
    min-height: 100%;
    font-size: var(--base-font-size);
    color: #ffffff;
    background: #000000;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    min-height: 100vh;
    overflow-x: hidden;
    background-color: #000000;
    background-image: url('/static/img/bg/stars1.gif');
    background-repeat: repeat;
    background-size: auto;
    font-family: 'MonoCraft', 'PixelOperatorMono', 'Courier New', monospace;
}

main {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 18px;
}

button,
label[for],
.menu-button,
.win98-button:not(:disabled),
a {
    cursor: pointer;
}

button,
input,
select,
textarea {
    font-family: inherit;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="file"],
textarea {
    cursor: text;
}

:focus-visible {
    outline: 2px dotted #000078;
    outline-offset: 2px;
}

::-webkit-scrollbar {
    width: 17px;
    height: 17px;
    background: #c0c0c0;
}

::-webkit-scrollbar-track {
    background: repeating-linear-gradient(45deg, #808080 0 2px, #8f8f8f 2px 4px);
    border-top: 1px solid #808080;
    border-left: 1px solid #808080;
    border-right: 1px solid #ffffff;
    border-bottom: 1px solid #ffffff;
}

::-webkit-scrollbar-thumb,
::-webkit-scrollbar-button:single-button {
    background: #c0c0c0;
    border-top: 2px solid #ffffff;
    border-left: 2px solid #ffffff;
    border-right: 2px solid #000000;
    border-bottom: 2px solid #000000;
    box-shadow: inset -1px -1px 0 #808080, inset 1px 1px 0 #dfdfdf;
}

::-webkit-scrollbar-button:single-button {
    width: 17px;
    height: 17px;
    background-color: #c0c0c0;
    background-repeat: no-repeat;
    background-position: center;
    background-size: 7px 7px;
}

::-webkit-scrollbar-button:single-button:vertical:decrement {
    background-image: linear-gradient(45deg, transparent 50%, #000000 50%), linear-gradient(135deg, #000000 50%, transparent 50%);
    background-position: 5px 6px, 8px 6px;
    background-size: 4px 4px, 4px 4px;
}

::-webkit-scrollbar-button:single-button:vertical:increment {
    background-image: linear-gradient(225deg, transparent 50%, #000000 50%), linear-gradient(315deg, #000000 50%, transparent 50%);
    background-position: 5px 7px, 8px 7px;
    background-size: 4px 4px, 4px 4px;
}

::-webkit-scrollbar-button:single-button:horizontal:decrement {
    background-image: linear-gradient(135deg, transparent 50%, #000000 50%), linear-gradient(45deg, #000000 50%, transparent 50%);
    background-position: 6px 5px, 6px 8px;
    background-size: 4px 4px, 4px 4px;
}

::-webkit-scrollbar-button:single-button:horizontal:increment {
    background-image: linear-gradient(315deg, transparent 50%, #000000 50%), linear-gradient(225deg, #000000 50%, transparent 50%);
    background-position: 7px 5px, 7px 8px;
    background-size: 4px 4px, 4px 4px;
}

::-webkit-scrollbar-thumb:hover,
::-webkit-scrollbar-button:single-button:hover {
    background-color: #d0d0d0;
}

::-webkit-scrollbar-thumb:active,
::-webkit-scrollbar-button:single-button:active {
    border-top-color: #000000;
    border-left-color: #000000;
    border-right-color: #ffffff;
    border-bottom-color: #ffffff;
    box-shadow: inset -1px -1px 0 #dfdfdf, inset 1px 1px 0 #808080;
}

::-webkit-scrollbar-corner {
    background: #c0c0c0;
    border-top: 1px solid #808080;
    border-left: 1px solid #808080;
}

.win98-button {
    min-width: 92px;
    height: 28px;
    display: grid;
    place-items: center;
    margin: 0;
    padding: 0 10px;
    color: #000000;
    background: var(--w98-gray);
    border-top: 2px solid #ffffff;
    border-left: 2px solid #ffffff;
    border-right: 2px solid #000000;
    border-bottom: 2px solid #000000;
    box-shadow: inset -1px -1px 0 #808080, inset 1px 1px 0 #dfdfdf;
    font-size: 13px;
    line-height: 13px;
    text-align: center;
    text-decoration: none;
    appearance: none;
}

.win98-button:disabled,
.win98-button[aria-disabled="true"],
button:disabled,
button[aria-disabled="true"],
input:disabled,
select:disabled,
textarea:disabled {
    cursor: not-allowed;
}

.win98-button:disabled,
.win98-button[aria-disabled="true"] {
    color: #808080;
    text-shadow: 1px 1px 0 #ffffff;
}

.win98-button:active:not(:disabled):not([aria-disabled="true"]),
.win98-control:active,
.menu-button[aria-expanded="true"] {
    border-top-color: #000000;
    border-left-color: #000000;
    border-right-color: #ffffff;
    border-bottom-color: #ffffff;
    box-shadow: inset -1px -1px 0 #dfdfdf, inset 1px 1px 0 #808080;
    padding-top: 1px;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    display: none;
    background: rgba(128, 128, 128, .42);
    z-index: 70;
}

.modal-backdrop.is-visible {
    display: block;
}

.popup-window {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(780px, calc(100vw - 24px));
    max-height: min(760px, calc(100vh - 24px));
    display: none;
    z-index: 80;
    zoom: var(--ui-scale);
}

.popup-window.is-visible {
    display: flex;
    animation: popup-open-v10 180ms steps(5, end);
}

.popup-body {
    flex: 1 1 auto;
    min-height: 0;
    max-height: calc(100vh - 90px);
    margin: 0 6px 6px;
    padding: 12px;
    overflow: auto;
    color: #000000;
    background-color: #ffffff;
    background-image:
        linear-gradient(180deg, rgba(255,255,255,.9), rgba(238,238,238,.58)),
        repeating-linear-gradient(0deg, rgba(0,0,0,.025) 0 1px, transparent 1px 6px);
    font-size: 13px;
    line-height: 16px;
}

.popup-body h3 { margin: 0 0 8px; font-size: 16px; line-height: 18px; }
.popup-body h4 { margin: 14px 0 6px; font-size: 14px; line-height: 16px; }
.popup-body p { margin: 0 0 8px; }
.popup-body ul,
.popup-body ol { margin: 0 0 8px 18px; padding: 0; }
.popup-body li { margin: 0 0 4px; }
.popup-body .code-block {
    margin: 6px 0 10px;
    width: 100%;
    max-width: 100%;
    display: block;
    overflow: auto;
    overscroll-behavior: contain;
    padding: 8px;
    color: #00ff66;
    background: #000000;
    border: 0;
    font-family: 'MonoCraft', 'PixelOperatorMono', 'Courier New', monospace;
    font-size: 12px;
    line-height: 15px;
    white-space: pre;
    user-select: text;
    -webkit-user-select: text;
    cursor: text;
    box-sizing: border-box;
    contain: layout paint;
}

.popup-body .code-block code {
    display: inline-block;
    min-width: 100%;
    color: inherit;
    font: inherit;
    white-space: inherit;
    user-select: text;
    -webkit-user-select: text;
}

.copy-fallback-text {
    width: 100%;
    min-height: 58px;
    font-family: 'MonoCraft', 'PixelOperatorMono', monospace;
}

.popup-window.is-properties-popup {
    width: min(520px, calc(100vw - 24px));
}

.popup-window.is-preview-popup {
    width: min(760px, calc(100vw - 24px));
}

.toast {
    position: fixed;
    right: 12px;
    bottom: 52px;
    max-width: min(360px, calc(100vw - 24px));
    display: none;
    padding: 8px 10px;
    color: #000000;
    background: #ffffcc;
    border-top: 2px solid #ffffff;
    border-left: 2px solid #ffffff;
    border-right: 2px solid #000000;
    border-bottom: 2px solid #000000;
    z-index: 90;
    font-size: 12px;
    line-height: 14px;
    box-shadow: 4px 4px 0 rgba(0,0,0,.45);
    zoom: var(--ui-scale);
}

.toast.is-visible {
    display: block;
    animation: toast-in 180ms steps(3, end), toast-buzz 700ms steps(2, end) 180ms;
}

.toast.toast-warning {
    color: #000000;
    background: #ffffcc;
    border: 4px solid transparent;
    border-image: repeating-linear-gradient(45deg, #111111 0 8px, #ffcc00 8px 16px) 4;
}

.toast.toast-error {
    color: #ffffff;
    background: #b00000;
    text-shadow: 1px 1px 0 #000000;
    border-color: #ffb0b0 #330000 #330000 #ffb0b0;
}

@keyframes popup-open-v10 {
    from { transform: translate(-50%, -48%) scale(.97); opacity: .35; }
    to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

@keyframes toast-in { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes toast-buzz { 0%, 100% { margin-right: 0; } 25% { margin-right: 2px; } 50% { margin-right: -2px; } }

@media (min-width: 1800px) {
    :root { --base-font-size: 14px; --ui-scale: 1.2; }
}

@media (min-width: 2048px) {
    :root { --base-font-size: 15px; --ui-scale: 1.36; }
}

@media (min-width: 2560px) {
    :root { --base-font-size: 16px; --ui-scale: 1.58; }
}

@media (min-width: 3200px) {
    :root { --base-font-size: 18px; --ui-scale: 1.88; }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 1ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
    }
}
