@font-face {
    font-family: "VGA Raster";
    src: url("/vga-8x16.woff") format("woff");
    font-weight: 400;
    font-style: normal;
    font-display: block;
}

:root {
    color-scheme: light;
    --vga-blue: #0000a8;
    --vga-blue-dark: #000073;
    --vga-blue-text: #000080;
    --vga-panel: #a8a8a8;
    --vga-panel-dark: #8f8f8f;
    --vga-panel-light: #c8c8c8;
    --vga-white: #ffffff;
    --vga-black: #000000;
    --vga-hotkey: #00ffff;
    --vga-warning: #ff4040;
    --vga-success: #00ff00;
    --vga-shadow: 18px 18px 0 var(--vga-black);
    --vga-font: "VGA Raster", "Perfect DOS VGA 437", "PxPlus IBM VGA 8x16", "Courier New", monospace;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    border-radius: 0 !important;
}

html,
body {
    min-height: 100dvh;
    background: var(--vga-panel);
    color: var(--vga-blue-text);
    font-family: var(--vga-font);
    font-size: 16px;
    font-weight: 400;
    line-height: 1.08;
    letter-spacing: 0;
    text-rendering: geometricPrecision;
    -webkit-font-smoothing: none;
    font-smooth: never;
    overflow-y: auto;
}

body {
    display: flex;
    flex-direction: column;
    border: 3px solid var(--vga-blue);
}

body,
button,
input,
select,
textarea {
    font-family: var(--vga-font);
    font-size: 16px;
    letter-spacing: 0;
    -webkit-font-smoothing: none;
    font-smooth: never;
}

code,
kbd,
pre,
samp {
    font-family: var(--vga-font);
    font-size: 1em;
    font-weight: 400;
    color: inherit;
    font-variant-ligatures: none;
    font-feature-settings: "liga" 0, "clig" 0, "kern" 0;
    font-synthesis: none;
}

::selection {
    background: var(--vga-blue);
    color: var(--vga-white);
}

img,
canvas {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

a {
    color: var(--vga-blue-text);
    text-decoration: none;
}

a:hover,
a:focus-visible {
    background: var(--vga-blue);
    color: var(--vga-white);
    outline: 0;
}

.nav-bar {
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    align-items: flex-end;
    gap: 0;
    min-height: 31px;
    padding: 3px 6px 0 24px;
    background: var(--vga-blue);
    border-bottom: 0;
    color: var(--vga-panel-light);
    font-weight: 400;
    text-align: center;
}

.nav-bar a,
.nav-hamburger {
    display: inline-flex;
    align-items: center;
    min-height: 21px;
    padding: 3px 14px 0;
    margin: 0 1px;
    color: var(--vga-panel-light);
    background: transparent;
    text-decoration: none;
    white-space: nowrap;
    cursor: default;
}

.nav-hamburger {
    position: relative;
    color: transparent;
    min-width: 0;
    font-size: 0;
    justify-content: center;
}

.nav-hamburger::before {
    content: "Main \2630";
    color: var(--vga-panel-light);
    font-size: 16px;
    line-height: 1;
}

.nav-bar a:hover,
.nav-bar a:focus-visible {
    background: var(--vga-panel);
    color: var(--vga-blue-text);
}

.nav-hamburger:hover {
    background: var(--vga-panel);
    color: transparent;
}

.nav-hamburger:hover::before {
    color: var(--vga-blue-text);
}

.nav-bar a.active {
    background: var(--vga-panel);
    color: var(--vga-blue-text);
    margin-bottom: 0;
}

.nav-hamburger:has(.sidebar-menu.open),
.nav-hamburger:has(.sidebar-menu.open):hover {
    background: var(--vga-panel);
}

.nav-hamburger:has(.sidebar-menu.open)::before,
.nav-hamburger:has(.sidebar-menu.open):hover::before {
    color: var(--vga-blue-text);
}

.sidebar-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 246px;
    padding: 4px;
    z-index: 1200;
    background: var(--vga-blue);
    border: 2px solid var(--vga-white);
    box-shadow: var(--vga-shadow);
    color: var(--vga-white);
    font-size: 16px;
    line-height: 1.08;
    text-align: left;
}

.sidebar-menu.open {
    display: block;
}

.sidebar-menu .menu-header {
    padding: 2px 6px 6px;
    color: var(--vga-white);
    border-bottom: 1px solid var(--vga-white);
}

.sidebar-menu a {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    min-height: 24px;
    padding: 3px 6px;
    margin: 0;
    color: var(--vga-white) !important;
    background: var(--vga-blue);
    text-align: left;
}

.sidebar-menu a:hover,
.sidebar-menu a:focus-visible {
    color: var(--vga-blue-text) !important;
    background: var(--vga-panel) !important;
}

.external-favicon,
.sidebar-menu a .external-favicon {
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--vga-white);
    background: var(--vga-panel);
    color: var(--vga-blue-text);
    font-size: 12px;
    line-height: 1;
}

.sidebar-menu a img.external-favicon {
    border: 1px solid var(--vga-white);
    background: var(--vga-panel);
}

.container {
    width: 100%;
    max-width: none;
    min-height: calc(100dvh - 34px);
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    row-gap: 4px;
    margin: 0;
    padding: 4px;
    background: var(--vga-panel);
}

.landing-container {
    max-width: none;
}

.header-banner,
.status-banner {
    margin: 0 0 4px;
    padding: 7px 14px;
    background: var(--vga-blue);
    border: 2px solid var(--vga-white);
    box-shadow: none;
    color: var(--vga-white);
    text-align: left;
}

.header-banner {
    display: none;
}

.header-banner h1 {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    margin: 0;
    color: var(--vga-white);
    font-family: var(--vga-font);
    font-size: 16px;
    font-weight: 400;
    line-height: 1;
    text-shadow: none;
    white-space: nowrap;
}

.header-banner h1::before {
    content: ">";
    color: var(--vga-white);
}

.header-banner h1 img {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.status-banner {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-height: 28px;
}

.status-banner .message {
    color: var(--vga-white);
}

.status-banner.error .message {
    color: var(--vga-warning);
}

.status-banner.success .message {
    color: var(--vga-white);
}

.main-layout {
    display: grid;
    grid-template-columns: minmax(258px, 330px) minmax(0, 1fr);
    gap: 4px;
    align-items: stretch;
}

.left-column,
.right-column {
    min-width: 0;
}

.left-column {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: auto;
}

.right-column {
    display: flex;
    flex-direction: column;
}

.left-column > .window,
.right-column > .window {
    width: 100%;
    margin: 0;
}

.right-column > .window,
.right-column > .window > fieldset {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.right-column .viewer-box {
    flex: 1;
}

.window,
fieldset {
    position: relative;
    background: var(--vga-panel);
    border: 2px solid var(--vga-blue);
    box-shadow: none;
    color: var(--vga-blue-text);
}

.window {
    margin: 4px 0;
    padding: 4px;
    cursor: default;
}

.window > fieldset {
    min-height: 100%;
    margin: 0;
    padding: 10px 14px 14px;
    background: transparent;
    border: 0;
}

fieldset {
    margin: 0;
    padding: 10px 14px 14px;
}

legend {
    position: static;
    display: block;
    margin: 0 0 4px;
    padding: 0;
    color: var(--vga-white);
    background: transparent;
    font-family: var(--vga-font);
    font-weight: 400;
    text-align: left;
}

.window.blue {
    background: var(--vga-blue);
    border-color: var(--vga-white);
    color: var(--vga-white);
}

.window.blue legend {
    color: var(--vga-white);
}

.btn,
button,
select {
    min-height: 24px;
    padding: 2px 9px;
    border: 0;
    background: transparent;
    color: var(--vga-blue-text);
    font-family: var(--vga-font);
    font-size: 16px;
    font-weight: 400;
    line-height: 1;
    text-decoration: none;
    cursor: default;
    box-shadow: none;
    appearance: none;
}

.btn::first-letter {
    color: inherit;
}

.btn:hover:not(:disabled),
.btn:focus-visible:not(:disabled),
button:hover:not(:disabled),
button:focus-visible:not(:disabled),
select:hover:not(:disabled),
select:focus-visible:not(:disabled),
.btn.active,
button.active,
select.active {
    background: var(--vga-blue);
    color: var(--vga-white);
    outline: 0;
}

.btn:active:not(:disabled),
button:active:not(:disabled) {
    background: var(--vga-blue-dark);
    color: var(--vga-white);
}

.btn:disabled,
button:disabled,
select:disabled {
    color: var(--vga-panel-dark);
    background: transparent;
    cursor: default;
}

select.native-select-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.vga-select {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    color: var(--vga-blue-text);
}

.vga-select[hidden] {
    display: none !important;
}

.vga-select-button {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    min-height: 24px;
    padding: 2px 0;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: left;
}

.vga-select-button:hover:not(:disabled),
.vga-select-button:focus-visible:not(:disabled),
.vga-select.open .vga-select-button {
    background: transparent;
    color: inherit;
}

.vga-select-marker {
    margin-right: 7px;
    color: inherit;
}

.viewer-overlay-controls .vga-select {
    color: var(--vga-white);
}

.pref-row .vga-select {
    width: 100%;
}

.pref-row .vga-select-button {
    width: 100%;
}

.vga-select-popup {
    position: fixed;
    z-index: 4000;
    box-sizing: border-box;
    padding: 6px;
    background: var(--vga-blue);
    color: var(--vga-white);
    box-shadow: 28px 28px 0 var(--vga-black);
}

.vga-select-popup fieldset {
    min-width: 180px;
    margin: 0;
    padding: 4px 8px 8px;
    border: 2px solid var(--vga-white);
    background: var(--vga-blue);
    color: var(--vga-white);
}

.vga-select-popup legend {
    display: inline-block;
    margin: 0 0 0 10px;
    padding: 0 8px;
    background: var(--vga-blue);
    color: var(--vga-white);
}

.vga-select-option {
    display: block;
    width: 100%;
    min-height: 22px;
    padding: 1px 8px;
    background: transparent;
    color: var(--vga-white);
    text-align: left;
}

.vga-select-option:hover,
.vga-select-option:focus-visible,
.vga-select-option.hovered,
.vga-select-option.selected {
    background: var(--vga-black);
    color: var(--vga-white);
}

.vga-select-popup.has-hover .vga-select-option.selected:not(.hovered) {
    background: transparent;
}

.btn-primary,
.btn-secondary {
    background: transparent;
    color: var(--vga-blue-text);
    border: 0;
}

.button-row,
.viewer-buttons,
.landing-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    justify-content: flex-start;
    margin-top: 8px;
}

.viewer-buttons {
    margin: 0 0 8px;
}

.viewer-box {
    width: 100%;
    min-height: 352px;
    background: var(--vga-black);
    border: 2px solid var(--vga-blue);
    position: relative;
    overflow: hidden;
    overscroll-behavior: contain;
}

#viewer-container {
    width: 100%;
    height: 100%;
}

.viewer-box canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.viewer-box canvas:active {
    cursor: move;
}

.selection-box {
    position: absolute;
    z-index: 120;
    border: 2px dashed var(--vga-hotkey);
    background: rgba(0, 255, 255, 0.18);
    pointer-events: none;
}

.drop-zone {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
    color: var(--vga-white);
    background: var(--vga-blue);
    text-align: center;
    cursor: default;
}

.drop-zone.drag-over {
    background: var(--vga-blue-dark);
}

.drop-zone p {
    margin: 4px 0;
    white-space: normal;
}

.drop-zone .btn {
    margin-top: 4px;
    border: 2px solid var(--vga-white);
    background: var(--vga-panel);
    color: var(--vga-blue-text);
}

.drop-zone .btn:hover,
.drop-zone .btn:focus-visible {
    background: var(--vga-panel-light);
    color: var(--vga-blue-text);
}

.drop-zone.hidden {
    display: none;
}

.viewer-overlay-controls {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
}

.viewer-overlay-controls select {
    color: var(--vga-white);
}

.viewer-help {
    margin-top: 8px;
    color: var(--vga-blue-text);
    text-align: left;
}

#explorer-panel,
#preview-panel {
    max-height: 210px;
    overflow-y: auto;
}

.explorer-header,
.preview-header {
    display: none;
}

.explorer-tree,
.preview-content,
.editor-panel,
.geo-list,
.geo-form {
    background: var(--vga-panel-light);
    border: 2px solid var(--vga-blue);
    color: var(--vga-blue-text);
}

.explorer-tree,
.tree-list {
    list-style: none;
}

.explorer-tree {
    padding: 4px;
}

.tree-section {
    margin-bottom: 4px;
}

.tree-section.collapsed .tree-list {
    display: none;
}

.tree-header,
.tree-item,
.geo-item {
    min-height: 20px;
    padding: 2px 5px;
    overflow: hidden;
    color: var(--vga-blue-text);
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: default;
}

.tree-header {
    color: var(--vga-white);
    background: var(--vga-blue);
}

.tree-toggle {
    margin-right: 5px;
}

.tree-list {
    margin: 0;
    padding-left: 14px;
}

.tree-header:hover,
.tree-item:hover,
.geo-item:hover {
    background: var(--vga-blue);
    color: var(--vga-white);
}

.tree-item.selected,
.geo-item.selected {
    background: var(--vga-blue);
    color: var(--vga-white);
}

.preview-content {
    padding: 6px;
    text-align: center;
}

#preview-canvas {
    max-width: 100%;
    border: 2px solid var(--vga-blue);
    background: var(--vga-black);
}

.preview-info {
    margin-top: 5px;
}

.editor-tabs,
.geo-tabs {
    display: flex;
    gap: 0;
    overflow-x: auto;
    background: var(--vga-blue);
    border: 2px solid var(--vga-blue);
    border-bottom: 0;
}

.tab-btn,
.geo-tab {
    flex: 1;
    min-width: max-content;
    min-height: 24px;
    padding: 3px 6px;
    color: var(--vga-white);
    background: var(--vga-blue);
    border: 0;
    text-align: center;
    white-space: nowrap;
}

.tab-btn:hover,
.geo-tab:hover,
.tab-btn.active,
.geo-tab.active {
    background: var(--vga-panel);
    color: var(--vga-blue-text);
}

.editor-panel {
    display: none;
    height: 220px;
    padding: 8px;
    overflow: auto;
}

.editor-panel.active {
    display: block;
}

.editor-form,
.geo-editor {
    font-size: 16px;
}

.editor-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.editor-table td {
    padding: 3px 5px;
    vertical-align: top;
}

.editor-table .label {
    width: 112px;
    color: var(--vga-white);
    text-align: right;
}

.editor-table .value {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.editor-table hr {
    border: 0;
    border-top: 2px solid var(--vga-blue);
    margin: 6px 0;
}

input,
textarea,
.editor-select,
.editor-input,
.editor-input-text,
.geo-search input,
.geo-row input[type="number"],
.geo-row input[type="text"],
.pref-row select {
    width: 100%;
    min-height: 24px;
    padding: 2px 4px;
    border: 2px solid var(--vga-blue);
    background: var(--vga-panel-light);
    color: var(--vga-blue-text);
    font-family: var(--vga-font);
    font-size: 16px;
    outline: 0;
}

input:focus,
textarea:focus,
.editor-select:focus,
.editor-input:focus,
.editor-input-text:focus,
.geo-search input:focus,
.geo-row input:focus,
.pref-row select:focus {
    background: var(--vga-blue);
    color: var(--vga-white);
}

.editor-input {
    width: 88px;
}

.editor-color,
.geo-row input[type="color"] {
    width: 56px;
    height: 24px;
    padding: 0;
    border: 2px solid var(--vga-blue);
    background: var(--vga-panel-light);
}

.editor-placeholder {
    padding: 20px;
    color: var(--vga-blue-text);
    text-align: center;
}

.geo-search {
    margin-bottom: 8px;
}

.geo-list {
    height: 132px;
    margin-bottom: 8px;
    overflow-y: auto;
}

.geo-item.more {
    color: var(--vga-panel-dark);
}

.geo-item .idx {
    display: inline-block;
    min-width: 34px;
    color: var(--vga-blue-text);
}

.geo-item.selected .idx {
    color: var(--vga-white);
}

.geo-form {
    padding: 8px;
}

.geo-form h4 {
    margin: 0 0 8px;
    padding-bottom: 4px;
    color: var(--vga-white);
    border-bottom: 2px solid var(--vga-blue);
    font-size: 16px;
    font-weight: 400;
}

.geo-form fieldset {
    margin: 0 0 8px;
    padding: 8px;
    border: 2px solid var(--vga-blue);
    box-shadow: none;
}

.geo-form fieldset legend {
    margin-bottom: 6px;
}

.geo-row,
.color-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.geo-row label {
    min-width: 22px;
    color: var(--vga-white);
}

.geo-row input[type="range"] {
    flex: 1;
    accent-color: var(--vga-blue);
}

.geo-apply {
    width: 100%;
    margin-top: 8px;
}

.color-swatch {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--vga-blue);
}

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1300;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.25);
}

.modal-content,
#prefsDialog {
    background: var(--vga-blue);
    border: 2px solid var(--vga-white);
    box-shadow: var(--vga-shadow);
    color: var(--vga-white);
}

.modal-content {
    min-width: min(92vw, 420px);
    max-width: 680px;
    display: flex;
    flex-direction: column;
}

.modal-header,
.modal-footer {
    padding: 8px 12px;
    background: var(--vga-blue);
    border-color: var(--vga-white);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--vga-white);
}

.modal-title {
    margin: 0;
    color: var(--vga-white);
    font-size: 16px;
    font-weight: 400;
}

.modal-close,
.btn-icon {
    min-width: 24px;
    padding: 2px;
    color: var(--vga-white);
    background: var(--vga-blue);
}

.modal-close:hover,
.btn-icon:hover {
    color: var(--vga-blue-text);
    background: var(--vga-panel);
}

.modal-body {
    max-height: 420px;
    padding: 16px;
    overflow-y: auto;
    color: var(--vga-white);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    border-top: 1px solid var(--vga-white);
}

.modal-ok {
    color: var(--vga-white);
}

.model-info-stats {
    font-family: var(--vga-font);
}

.stat-group {
    margin-bottom: 16px;
}

.stat-group h4,
.project-card h2,
.about-content h2,
.about-content h3 {
    color: var(--vga-white);
    font-size: 16px;
    font-weight: 400;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 4px;
}

.stat-row label {
    color: var(--vga-white);
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(260px, 1fr));
    gap: 4px;
}

.project-card {
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 8px;
    min-height: 152px;
    padding: 12px;
    background: transparent;
    border: 2px solid var(--vga-blue);
}

.project-card p,
.about-content p,
.about-content li {
    line-height: 1.22;
}

.project-card .btn {
    align-self: end;
    justify-self: start;
    margin-top: auto;
}

.contact-list,
.info-list {
    display: grid;
    gap: 4px;
}

.contact-list div,
.info-list div {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 16px;
    align-items: baseline;
    min-height: 20px;
}

.contact-list dt,
.info-list dt {
    color: var(--vga-white);
}

.contact-list dd,
.info-list dd {
    min-width: 0;
    overflow-wrap: anywhere;
}

.pgp-fingerprint,
.hit-counter {
    display: inline-block;
    max-width: 100%;
    padding: 2px 6px;
    background: var(--vga-black);
    color: var(--vga-success);
    overflow-wrap: anywhere;
}

.footer {
    margin: auto -4px -4px;
    padding: 2px 10px 1px;
    flex-shrink: 0;
    background: var(--vga-blue);
    border-top: 2px solid var(--vga-blue-dark);
    color: var(--vga-panel-light);
    text-align: center;
}

.about-content {
    line-height: 1.22;
}

.about-content h2 {
    margin: 0 0 10px;
    padding-bottom: 4px;
    border-bottom: 2px solid var(--vga-blue);
}

.about-content h3 {
    margin: 14px 0 8px;
}

.about-content p,
.about-content ul {
    margin-bottom: 12px;
}

.about-content ul {
    margin-left: 22px;
}

.about-content li {
    margin-bottom: 6px;
}

.back-link {
    display: inline-block;
    margin-top: 10px;
}

@media (max-width: 900px) {
    .main-layout {
        grid-template-columns: 1fr;
    }

    .left-column {
        order: 2;
    }

    .right-column {
        order: 1;
    }

    .right-column .viewer-box,
    .viewer-box {
        flex: 0 0 auto;
        height: clamp(360px, 54dvh, 560px);
        min-height: 0;
    }
}

    @media (max-width: 700px) {
    html,
    body,
    button,
    input,
    select,
    textarea {
        font-size: 14px;
    }

    .nav-bar {
        align-items: flex-end;
        min-height: 31px;
        padding: 3px 4px 0;
        overflow-x: auto;
    }

    .nav-bar a,
    .nav-hamburger {
        min-height: 18px;
        padding: 2px 11px;
    }

    .nav-hamburger::before {
        font-size: 14px;
    }

    .sidebar-menu {
        position: fixed;
        top: 31px;
        left: 4px;
        width: min(320px, calc(100vw - 8px));
        min-width: 0;
    }

    .container {
        min-height: calc(100dvh - 67px);
        padding: 3px;
    }

    .header-banner h1 .header-title {
        display: none;
    }

    .project-grid {
        grid-template-columns: 1fr;
    }

    .contact-list div,
    .info-list div {
        grid-template-columns: 1fr;
        gap: 2px;
    }

    .viewer-overlay-controls {
        position: static;
        margin-top: 4px;
        box-shadow: none;
    }
}

@media (pointer: coarse) {
    .nav-bar a,
    .nav-hamburger,
    .btn,
    button,
    select,
    input,
    .tab-btn,
    .geo-tab {
        min-height: 36px;
    }

    .right-column .viewer-box,
    .viewer-box {
        flex: 0 0 auto;
        height: clamp(340px, 52dvh, 540px);
        min-height: 0;
    }
}

.sidebar-menu a img.external-favicon {
  image-rendering: pixelated;
}

html.gxscc-root,
html.gxscc-root body {
  height: 100%;
  min-height: 100%;
  overflow: hidden;
}

body.gxscc-page {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}

html.gxscc-root.download-root,
html.gxscc-root.download-root body {
  height: auto;
  min-height: 100%;
  overflow-y: auto;
}

body.gxscc-page.download-page {
  display: block;
  min-height: 100dvh;
}

.app-shell {
    width: 100%;
    min-height: 0;
    flex: 1 1 auto;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 4px;
    margin: 0;
    padding: 4px 0;
    background: var(--vga-panel);
}

.gxscc-player-controls {
    display: grid;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0 0 8px;
    padding: 10px;
    border: 1px solid var(--vga-panel-dark);
    background: var(--vga-panel);
    color: var(--vga-white);
    overflow: hidden;
}

.gxscc-controls-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    min-width: 0;
}

.gxscc-controls-heading > * {
    min-width: 0;
}

.gxscc-controls-heading h2,
.gxscc-controls-heading p,
.gxscc-player-status {
    margin: 0;
}

.gxscc-controls-heading h2 {
    color: var(--vga-white);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
}

.gxscc-controls-heading p,
.gxscc-player-status {
    color: var(--vga-white);
    font-size: 13px;
    line-height: 1.35;
}

.gxscc-controls-heading > div > p {
    opacity: 0.78;
}

.gxscc-player-status {
    flex: 0 1 34ch;
    color: var(--vga-white);
    text-align: right;
}

.gxscc-transport-controls {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
    min-width: 0;
}

.gxscc-transport-controls > button {
    width: 100%;
    min-width: 0;
}

.gxscc-channel-controls {
    min-width: 0;
    margin: 0;
    padding: 7px;
    border: 1px solid var(--vga-panel-dark);
    background: transparent;
}

.gxscc-channel-controls legend {
    margin: 0;
    padding: 0 4px;
    color: var(--vga-white);
    font-size: 13px;
    line-height: 1;
}

.gxscc-channel-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    width: 100%;
    min-width: 0;
}

.gxscc-channel-toggle {
    min-width: 0;
    padding-inline: 4px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.gxscc-channel-toggle[aria-pressed="true"],
#gxsccPause[aria-pressed="true"] {
    border-color: var(--vga-blue);
    background: var(--vga-blue);
    color: var(--vga-white);
}

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.screen-wrap {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--vga-panel);
    border: 0;
}

#screen {
    display: block;
    width: 100%;
    height: 100%;
    background: var(--vga-panel);
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

#screen:focus-visible {
    outline: 3px solid var(--vga-blue);
    outline-offset: -3px;
}

@media (max-width: 760px) {
    .gxscc-controls-heading {
        display: grid;
        gap: 4px;
    }

    .gxscc-player-status {
        text-align: left;
    }

    .gxscc-transport-controls {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .gxscc-channel-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.download-container {
    --download-panel-width: 430px;
    --download-gap: 4px;
    --download-content-width: calc((var(--download-panel-width) * 2) + var(--download-gap));
    width: 100%;
    max-width: none;
    min-height: calc(100dvh - 34px);
    display: flex;
    flex-direction: column;
    row-gap: 4px;
    margin: 0;
    padding: 4px;
    background: var(--vga-panel);
}

.download-layout {
    width: min(100%, var(--download-content-width));
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, var(--download-panel-width)));
    gap: var(--download-gap);
    align-items: stretch;
    justify-content: center;
    justify-items: stretch;
}

.linux-download-layout {
    align-items: start;
}

.download-heading {
    width: min(100%, var(--download-content-width));
    margin: 0 auto 4px;
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    padding: 8px;
    border: 2px solid var(--vga-blue);
    color: var(--vga-blue-text);
}

.download-heading .app-icon,
.app-summary .app-icon {
    width: 56px;
    height: 56px;
    object-fit: contain;
}

.download-heading h1,
.app-summary h2,
.distro-summary h2,
.download-option h2 {
    margin: 0 0 6px;
    color: var(--vga-white);
    font-size: 16px;
    font-weight: 400;
    line-height: 1;
}

.download-heading p,
.app-summary p,
.distro-summary p {
    margin: 0;
    line-height: 1.22;
}

.download-page .window {
    width: 100%;
    min-width: 0;
    min-height: 100%;
    margin: 0;
}

.download-page .window > fieldset {
    width: 100%;
    min-width: 0;
    height: 100%;
}

.app-summary {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
}

.download-options {
    display: grid;
    gap: 10px;
}

.download-option {
    padding-top: 10px;
    border-top: 2px solid var(--vga-blue);
}

.download-option:first-child {
    padding-top: 0;
    border-top: 0;
}

.preview-section {
    width: min(100%, var(--download-content-width));
    margin: 0 auto 4px;
    padding: 8px 12px;
    border: 2px solid var(--vga-blue);
    background: var(--vga-panel);
}

.app-preview {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
}

#prefsDialog {
    position: fixed;
    margin: 0;
    min-width: min(92vw, 620px);
    max-width: 620px;
    padding: 0;
}

#prefsDialog::backdrop {
    background: rgba(0, 0, 0, 0.25);
}

#prefsForm {
    margin: 0;
    padding: 14px;
    color: var(--vga-white);
}

#prefsForm h2 {
    margin: 0 0 12px;
    color: var(--vga-white);
    font-size: 16px;
    font-weight: 400;
}

#prefsRows {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 16px;
}

.pref-row {
    display: grid;
    gap: 4px;
}

.pref-row label {
    color: var(--vga-white);
}

.pref-row select {
    border-color: var(--vga-white);
    background: var(--vga-blue);
    color: var(--vga-white);
}

body.gxscc-page menu {
    display: flex;
    justify-content: flex-end;
    gap: 4px;
    margin: 14px 0 0;
    padding: 0;
}

body.gxscc-page menu button {
    color: var(--vga-white);
}

@media (max-width: 860px) {
    body.gxscc-page {
        overflow-y: auto;
    }

    #prefsRows,
    .download-layout {
        grid-template-columns: 1fr;
    }

    .download-layout {
        width: 100%;
    }

    .download-heading {
        width: 100%;
        grid-template-columns: 48px minmax(0, 1fr);
    }

    .download-heading .app-icon,
    .app-summary .app-icon {
        width: 48px;
        height: 48px;
    }
}

html.gamecube-root,
html.gamecube-root body {
  min-height: 100%;
}

body.gamecube-page {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
}

.gamecube-container {
  flex: 1 1 auto;
  height: calc(100dvh - 31px);
  min-height: 0;
  overflow: hidden;
  padding: 0;
  background: #000;
}

.gamecube-stage {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: #000;
}

body.gamecube-page #screen {
  align-self: center;
  display: block;
  justify-self: center;
  object-fit: contain;
  width: min(100%, calc((100dvh - 37px) * var(--frame-aspect, 1.1111111111)));
  height: auto;
  max-width: none;
  max-height: calc(100dvh - 37px);
  aspect-ratio: var(--frame-aspect, 1.1111111111);
  background: #000;
  cursor: default;
  image-rendering: auto;
  outline: none;
  touch-action: none;
  user-select: none;
}

.module-map-container {
  gap: 4px;
}

.module-map-intro {
  max-width: 980px;
}

.module-map-content {
  display: grid;
  gap: 10px;
  line-height: 1.22;
}

.module-map-content h2,
.module-map-content h3 {
  color: var(--vga-white);
  font-size: 16px;
  font-weight: 400;
}

.module-map-content h2 {
  margin-top: 2px;
  padding: 3px 6px;
  background: var(--vga-blue);
  color: var(--vga-white);
}

.module-map-content h3 {
  margin-top: 8px;
  padding-bottom: 3px;
  border-bottom: 2px solid var(--vga-blue);
}

.module-table-wrap {
  overflow-x: auto;
  border: 2px solid var(--vga-blue);
  background: var(--vga-panel);
}

.module-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  table-layout: fixed;
}

.module-table th,
.module-table td {
  padding: 5px 7px;
  border: 1px solid var(--vga-blue);
  vertical-align: top;
  text-align: left;
  overflow-wrap: anywhere;
}

.module-table th {
  background: var(--vga-blue);
  color: var(--vga-white);
  font-weight: 400;
}

.module-table td:first-child {
  width: 34%;
  color: var(--vga-white);
}

.boot-chain-table th:first-child,
.boot-chain-table td:first-child {
  width: 88px;
  overflow-wrap: normal;
  word-break: normal;
}

.boot-chain-table th:nth-child(2),
.boot-chain-table td:nth-child(2) {
  width: 24%;
}

.inventory-table th:first-child,
.inventory-table td:first-child {
  width: 33%;
}

.inventory-table th:nth-child(2),
.inventory-table td:nth-child(2) {
  width: 12%;
}

.module-table code,
.module-map-content p code {
  color: var(--vga-white);
}

.zscripter-container {
    gap: 4px;
}

.zscripter-hero {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
}

.zscripter-icon-large {
    width: 64px;
    height: 64px;
    border: 2px solid var(--vga-blue);
    border-radius: 22%;
    background: var(--vga-black);
    object-fit: cover;
}

.zscripter-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 2px;
}

.zscripter-app-store-link {
    display: inline-block;
    margin-top: 4px;
    padding: 10px;
    line-height: 0;
}

.zscripter-app-store-link:hover,
.zscripter-app-store-link:focus-visible {
    background: transparent;
    outline: 2px dashed var(--vga-blue);
    outline-offset: -2px;
}

.zscripter-app-store-badge {
    display: block;
    width: 144px;
    max-width: 100%;
    height: auto;
}

.zscripter-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(260px, 1fr));
    gap: 4px;
}

.zscripter-grid > .window {
    margin: 0;
}

.zscripter-list {
    margin: 0 0 12px 22px;
}

.zscripter-list li {
    margin-bottom: 6px;
    line-height: 1.22;
}

.zscripter-callout {
    padding: 8px 10px;
    margin: 12px 0;
    background: var(--vga-black);
    color: var(--vga-success);
}

.zscripter-callout a {
    color: var(--vga-success) !important;
}

.zscripter-callout a:hover,
.zscripter-callout a:focus-visible {
    background: var(--vga-success);
    color: var(--vga-black);
}

.zscripter-callout .zscripter-support-email {
    color: var(--vga-success) !important;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.zscripter-policy-date {
    display: inline-block;
    margin-bottom: 12px;
    padding: 2px 6px;
    background: var(--vga-black);
    color: var(--vga-success);
}

.zscripter-legal-list {
    display: grid;
    gap: 8px;
    margin: 0;
    list-style: none;
}

.zscripter-legal-list li {
    padding: 8px;
    border: 2px solid var(--vga-blue);
}

.zscripter-license-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 14px;
}

.zscripter-license-item {
    border: 2px solid var(--vga-blue);
}

.zscripter-license-item[open] {
    grid-column: 1 / -1;
}

.zscripter-license-item summary {
    padding: 8px;
    cursor: pointer;
    font-weight: normal;
}

.zscripter-license-kind {
    margin: 0;
    padding: 0 8px 8px;
    font-weight: normal;
}

.zscripter-license-text {
    box-sizing: border-box;
    width: 100%;
    max-height: 420px;
    margin: 0;
    padding: 10px;
    overflow: auto;
    border: 0;
    border-top: 2px solid var(--vga-blue);
    background: var(--vga-black);
    color: var(--vga-success);
    font: inherit;
    font-size: 12px;
    font-weight: normal;
    line-height: 1.35;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

@media (max-width: 720px) {
    .zscripter-hero,
    .zscripter-grid,
    .zscripter-license-list {
        grid-template-columns: 1fr;
    }
}

body.wasmtolua-page {
  min-height: 100vh;
}

.wasmtolua-container {
  max-width: none;
}

.wasmtolua-layout {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(320px, 1.15fr) minmax(280px, 0.9fr);
  gap: 4px;
  align-items: stretch;
  min-height: 0;
}

.wasmtolua-input-window,
.wasmtolua-output-window,
.wasmtolua-console-window {
  min-width: 0;
  margin: 0;
}

.wasmtolua-layout .window > fieldset {
  display: flex;
  flex-direction: column;
}

.field-label {
  display: block;
  margin-bottom: 0.5em;
  font-weight: bold;
}

.text-input,
.code-area {
  width: 100%;
  border: 2px inset var(--vga-panel-light);
  background-color: var(--vga-white);
  color: var(--vga-black);
  font: inherit;
}

.text-input {
  padding: 5px 7px;
  margin-bottom: 8px;
}

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.file-button {
  display: inline-flex;
  align-items: center;
}

.input-area.dragging {
  background: var(--vga-blue);
  color: var(--vga-white);
}

.code-area {
  padding: 8px;
  resize: vertical;
  line-height: 1.2;
  white-space: pre;
  user-select: text;
  -webkit-user-select: text;
  cursor: text;
}

.code-area:focus {
  background-color: var(--vga-white);
  color: var(--vga-black);
}

.code-area::selection {
  background: var(--vga-black);
  color: var(--vga-white);
}

.code-area::-moz-selection {
  background: var(--vga-black);
  color: var(--vga-white);
}

.input-area {
  min-height: 460px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.output-area {
  min-height: 460px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 8px;
  align-items: center;
}

.sticky-row {
  margin-top: 0;
  margin-bottom: 8px;
}

.summary-grid {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.summary-item {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 8px;
  align-items: baseline;
}

.summary-label {
  font-weight: bold;
}

.summary-value {
  min-width: 0;
  word-break: break-word;
}

.run-controls {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(160px, 2fr);
  gap: 8px 12px;
  margin-top: 8px;
  align-items: center;
}

.run-controls .field-label {
  margin-bottom: 0;
}

.run-controls .text-input {
  margin-bottom: 0;
}

.console-log {
  border: 2px inset var(--vga-panel-light);
  background: var(--vga-black);
  color: var(--vga-success);
  min-height: 558px;
  max-height: none;
  overflow: auto;
  padding: 8px;
  white-space: pre-wrap;
}

.console-log.empty {
  color: var(--vga-panel-light);
}

.status-message {
  margin-left: auto;
  color: var(--vga-panel-dark);
}

.status-message.busy {
  color: var(--vga-blue-text);
}

.status-message.success {
  color: var(--vga-blue-text);
}

.status-message.error {
  color: var(--vga-warning);
}

@media (max-width: 1180px) {
  .wasmtolua-layout {
    grid-template-columns: 1fr;
  }

  .input-area,
  .output-area {
    min-height: 340px;
  }

  .console-log {
    min-height: 260px;
  }
}

@media (max-width: 640px) {
  .run-controls {
    grid-template-columns: 1fr;
  }
}
