:root {
    color-scheme: dark;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100svh;
    overflow: hidden;
    background: #111211;
    color: #f4f1e9;
    font-family: Manrope, sans-serif;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
}

.app {
    height: 100svh;
    display: grid;
    grid-template-rows: 72px 1fr;
}

header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    border-bottom: 1px solid rgba(244, 241, 233, .13);
    background: rgba(17, 18, 17, .9);
    position: relative;
    z-index: 2;
}

.brand {
    letter-spacing: -.06em;
    font-size: 20px;
    font-weight: 700;
}

.brand span {
    color: #c9ff57;
}

.status {
    font-family: "DM Mono", monospace;
    color: #9c9e99;
    font-size: 11px;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.viewer {
    position: relative;
    min-height: 0;
}

#renderCanvas {
    position: absolute;
    inset: 0;
}

#renderCanvas.is-panning {
    cursor: grab;
}

.drop-zone {
    position: absolute;
    z-index: 1;
    inset: 0;
    display: grid;
    place-items: center;
    pointer-events: none;
    transition: background .2s ease;
}

.drop-zone.dragging {
    background: rgba(201, 255, 87, .06);
    outline: 1px dashed #c9ff57;
    outline-offset: -24px;
}

.empty {
    text-align: center;
    max-width: 430px;
    padding: 30px;
    pointer-events: auto;
    transition: opacity .3s ease, transform .3s ease;
}

.empty.hidden {
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
}

.empty h1 {
    margin: 0 0 10px;
    font-size: clamp(36px, 6vw, 68px);
    letter-spacing: -.075em;
    line-height: .96;
}

.empty p {
    color: #afb1aa;
    margin: 0 0 25px;
    line-height: 1.65;
    font-size: 14px;
}

.file-button {
    display: inline-flex;
    cursor: pointer;
    align-items: center;
    gap: 12px;
    background: #c9ff57;
    color: #111211;
    padding: 14px 18px;
    font-weight: 700;
    font-size: 13px;
    transition: transform .2s ease, background .2s ease;
}

.file-button:hover {
    background: #dcff92;
    transform: translateY(-2px);
}

input {
    display: none;
}

.hint {
    margin-top: 16px;
    color: #70736d;
    font: 11px "DM Mono", monospace;
}

.model-info {
    position: absolute;
    z-index: 1;
    left: 28px;
    bottom: 26px;
    display: none;
    font: 11px "DM Mono", monospace;
    color: #c5c7c0;
    letter-spacing: .04em;
}

.model-info.visible {
    display: block;
}

.model-info strong {
    color: #c9ff57;
    font-weight: 500;
}

.view-navigation {
    position: absolute;
    z-index: 3;
    right: 452px;
    bottom: 26px;
    display: grid;
    justify-items: center;
    gap: 12px;
}

.view-cube, .projection-controls button {
    appearance: none;
    cursor: pointer;
    font: 600 12px "DM Mono", monospace;
    letter-spacing: .06em;
}

.view-cube {
    width: 148px;
    height: 148px;
    filter: drop-shadow(0 9px 12px rgba(0, 0, 0, .32));
    user-select: none;
}

.view-cube-svg { display: block; width: 100%; height: 100%; overflow: visible; }
.view-cube-label { display: none; fill: #252823; font: 600 11px "DM Mono", monospace; letter-spacing: .06em; pointer-events: none; }
.view-cube-label.is-visible { display: block; }
.view-cube-region { display: none; fill: #b8bcb5; stroke: #343733; stroke-width: 1.1; vector-effect: non-scaling-stroke; cursor: pointer; transition: fill .12s ease, stroke .12s ease; }
.view-cube-region.is-visible { display: block; }
.view-cube-region--face { fill: #c7cbc4; }
.view-cube-region--edge { fill: #a8ada5; }
.view-cube-region--corner { fill: #92988f; }
.view-cube-region:hover, .view-cube-region:focus-visible, .view-cube-region[aria-pressed="true"] { fill: #c9ff57; stroke: #66871e; stroke-width: 1.7; outline: none; }

.projection-controls {
    display: flex;
    background: rgba(20, 21, 20, .86);
    border: 1px solid rgba(244, 241, 233, .2);
}

.projection-controls button {
    padding: 9px 10px;
    color: #a7aaa2;
    border: 0;
    background: transparent;
    transition: color .18s ease, background .18s ease;
}

.projection-controls button + button { border-left: 1px solid rgba(244, 241, 233, .15); }
.projection-controls button:hover, .projection-controls button.active { color: #121410; background: #c9ff57; }

.toolbox {
    position: absolute;
    z-index: 2;
    top: 22px;
    right: 28px;
    width: 400px;
    bottom: 200px;
    max-height: calc(100% - 44px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 16px;
    background: rgba(20, 21, 20, .3);
    border: 1px solid rgba(244, 241, 233, .15);
    /*backdrop-filter: blur(10px);*/
    scrollbar-color: #72756e transparent;
    scrollbar-width: thin;
}

.toolbox::-webkit-scrollbar {
    width: 7px;
}

.toolbox::-webkit-scrollbar-thumb {
    background: #72756e;
}

.camera-toolbox {
    left: 28px;
    right: auto;
    width: 220px;
}

.toolbox-title {
    margin: 0 0 15px;
    color: #f4f1e9;
    font: 500 11px "DM Mono", monospace;
    letter-spacing: .09em;
    text-transform: uppercase;
}

.inspector-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin: -16px -16px 16px;
    border-bottom: 1px solid rgba(244, 241, 233, .14);
}

.inspector-tab {
    appearance: none;
    cursor: pointer;
    padding: 13px 8px 11px;
    color: #858880;
    background: transparent;
    border: 0;
    border-bottom: 2px solid transparent;
    font: 10px "DM Mono", monospace;
    letter-spacing: .04em;
    text-transform: uppercase;
    transition: color .2s ease, border-color .2s ease;
}

.inspector-tab:hover, .inspector-tab.active {
    color: #c9ff57;
}

.inspector-tab.active {
    border-bottom-color: #c9ff57;
}

.file-content-meta {
    margin: -5px 0 12px;
    color: #858880;
    font: 10px/1.5 "DM Mono", monospace;
}

.file-content {
    min-height: 330px;
    max-height: calc(100svh - 190px);
    margin: 0;
    padding: 10px;
    overflow: auto;
    white-space: pre;
    tab-size: 2;
    color: #d8dbd3;
    background: #151615;
    border: 1px solid rgba(244, 241, 233, .1);
    font: 10px/1.55 "DM Mono", monospace;
    scrollbar-color: #72756e transparent;
    scrollbar-width: thin;
}

.toolbox-section + .toolbox-section {
    margin-top: 15px;
    padding-top: 14px;
    border-top: 1px solid rgba(244, 241, 233, .11);
}

.toolbox-label {
    margin: 0 0 8px;
    color: #777a73;
    font: 10px "DM Mono", monospace;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.toolbox-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 31px;
    color: #acaea7;
    font-size: 12px;
}

.toolbox-row + .toolbox-row {
    margin-top: 8px;
}

.switch {
    position: relative;
    display: inline-flex;
    width: 32px;
    height: 18px;
    cursor: pointer;
}

.switch input {
    display: none;
}

.switch span {
    width: 100%;
    border-radius: 20px;
    background: #444640;
    transition: background .2s ease;
}

.switch span::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #eeeee9;
    transition: transform .2s ease;
}

.switch input:checked + span {
    background: #9dcc39;
}

.switch input:checked + span::after {
    transform: translateX(14px);
}

input[type="color"] {
    display: block;
    width: 32px;
    height: 22px;
    padding: 0;
    cursor: pointer;
    background: none;
    border: 1px solid rgba(244, 241, 233, .3);
}

.color-picker {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 104px;
    padding: 3px;
    background: #20211f;
    border: 1px solid rgba(244, 241, 233, .2);
}

.color-picker input[type="color"] {
    width: 22px;
    height: 18px;
    border: 0;
    flex: 0 0 auto;
}

.color-picker input[type="range"] {
    width: 66px;
    min-width: 0;
}

input[type="range"] {
    display: block;
    width: 102px;
    accent-color: #c9ff57;
    cursor: pointer;
}

output {
    color: #c9ff57;
    font: 10px "DM Mono", monospace;
    margin-left: auto;
}

.controls {
    position: absolute;
    z-index: 1;
    right: 28px;
    bottom: 26px;
    display: flex;
    gap: 8px;
}

.controls button {
    appearance: none;
    cursor: pointer;
    color: #f4f1e9;
    background: rgba(20, 21, 20, .86);
    border: 1px solid rgba(244, 241, 233, .2);
    padding: 10px 13px;
    font: 11px "DM Mono", monospace;
    transition: border-color .2s ease, color .2s ease;
}

.controls button:hover {
    color: #c9ff57;
    border-color: #c9ff57;
}

.camera-move {
    display: grid;
    grid-template-columns: repeat(3, 28px);
    justify-content: center;
    gap: 5px;
    margin-top: 12px;
}

.camera-move button {
    appearance: none;
    cursor: pointer;
    color: #d8dbd3;
    background: #272925;
    border: 1px solid rgba(244, 241, 233, .16);
    min-height: 27px;
    font: 14px "DM Mono", monospace;
}

.camera-move button:first-child {
    grid-column: 2;
}

.camera-move button:last-child {
    grid-column: 2;
}

.camera-move button:hover {
    color: #c9ff57;
    border-color: #c9ff57;
}

.message {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 4;
    padding: 10px 14px;
    display: none;
    background: #242522;
    color: #f4f1e9;
    font-size: 12px;
}

.message.visible {
    display: block;
}

@media (max-width: 600px) {
    header {
        padding: 0 18px;
    }

    .status {
        display: none;
    }

    .toolbox {
        right: 18px;
        top: 18px;
        width: 400px;
    }

    .camera-toolbox {
        display: none;
    }

    .model-info {
        left: 18px;
        bottom: 68px;
    }

    .controls {
        right: 18px;
        bottom: 18px;
    }

    .controls button {
        padding: 9px 10px;
    }

    .view-navigation {
        right: 18px;
        bottom: 65px;
        transform: scale(.86);
        transform-origin: bottom right;
    }
}
