@font-face {
    font-family: "Inter Variable";
    src: url("./InterVariable.ttf") format("truetype");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Inter Variable";
    src: url("./InterVariable-Italic.ttf") format("truetype");
    font-weight: 100 900;
    font-style: italic;
    font-display: swap;
}

:root {
    --bg: #0b0b0b;
    --panel: #121212;
    --panel-soft: #171717;
    --panel-strong: #0f0f0f;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.14);
    --text: rgba(246, 246, 246, 0.94);
    --text-soft: rgba(246, 246, 246, 0.58);
    --text-faint: rgba(246, 246, 246, 0.34);
    --chip: #1a1a1a;
    --chip-active: #f3f3f3;
    --chip-active-text: #111111;
    --sidebar-width: 386px;
    --info-height: 124px;
    --radius: 26px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    min-height: 100%;
    overscroll-behavior: none;
}

body {
    margin: 0;
    overflow: hidden;
    background: #0b0b0b;
    color: var(--text);
    font-family: "Inter Variable", sans-serif;
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 20 20'%3E%3Cpath fill='%23000' d='M2.8 2.6l4.6 11 1.8-3.8 4 3.2 1.2-1.5-4-3.1 4.1-1.4z'/%3E%3Cpath fill='none' stroke='%23fff' stroke-width='0.9' d='M2.8 2.6l4.6 11 1.8-3.8 4 3.2 1.2-1.5-4-3.1 4.1-1.4z'/%3E%3C/svg%3E") 2 2, auto;
}

.page-transition {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    place-items: center;
    overflow: hidden;
    pointer-events: none;
    visibility: hidden;
    opacity: 1;
    background: transparent;
}

.page-transition__shutter {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.page-transition__shutter::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 3;
    width: min(18rem, 30vw);
    aspect-ratio: 1.55;
    border: 1px solid rgba(244, 244, 241, 0.12);
    opacity: 0;
    transform: translate3d(-50%, -50%, 0) scale(4.6);
    will-change: transform, opacity;
}

.page-transition__panel {
    position: absolute;
    z-index: 2;
    display: block;
    background: #0f0f0f;
    transform: translate3d(var(--panel-x), var(--panel-y), 0);
    will-change: transform;
}

.page-transition__panel--top {
    left: 0;
    right: 0;
    top: -1px;
    height: calc(50% + 1px);
    --panel-x: 0;
    --panel-y: -101%;
}

.page-transition__panel--bottom {
    left: 0;
    right: 0;
    bottom: -1px;
    height: calc(50% + 1px);
    --panel-x: 0;
    --panel-y: 101%;
}

.page-transition__panel--left {
    left: -1px;
    top: 0;
    bottom: 0;
    width: calc(50% + 1px);
    --panel-x: -101%;
    --panel-y: 0;
}

.page-transition__panel--right {
    right: -1px;
    top: 0;
    bottom: 0;
    width: calc(50% + 1px);
    --panel-x: 101%;
    --panel-y: 0;
}

.page-transition__logo {
    position: relative;
    z-index: 4;
    width: clamp(2.75rem, 4.8vw, 4.6rem);
    height: auto;
    opacity: 0;
    filter: invert(1) blur(0.12rem) drop-shadow(0 0 0 rgba(255, 255, 255, 0));
    transform: scale(1.04);
    will-change: transform, opacity, filter;
}

body.is-page-leaving .page-transition {
    visibility: visible;
}

body.is-page-leaving .page-transition__panel {
    animation: preloaderPanelOpen 0.82s cubic-bezier(0.76, 0, 0.24, 1) reverse both;
}

body.is-page-leaving .page-transition__shutter::before {
    animation: preloaderSquareGuide 0.82s cubic-bezier(0.76, 0, 0.24, 1) reverse both;
}

body.is-page-leaving .page-transition__logo {
    animation: preloaderLogoOut 0.62s cubic-bezier(0.16, 1, 0.3, 1) reverse both;
}

html.is-shutter-entering,
html.is-shutter-entering body {
    overflow: hidden;
}

html.is-shutter-entering .page-transition {
    visibility: visible;
}

html.is-shutter-entering .page-transition__panel {
    animation: preloaderPanelOpen 0.82s cubic-bezier(0.76, 0, 0.24, 1) both;
}

html.is-shutter-entering .page-transition__shutter::before {
    animation: preloaderSquareGuide 0.82s cubic-bezier(0.76, 0, 0.24, 1) both;
}

html.is-shutter-entering .page-transition__logo {
    animation: preloaderLogoOut 0.62s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes preloaderPanelOpen {
    0%,
    18% { transform: translate3d(0, 0, 0); }
    100% { transform: translate3d(var(--panel-x), var(--panel-y), 0); }
}

@keyframes preloaderSquareGuide {
    0% {
        opacity: 0;
        transform: translate3d(-50%, -50%, 0) scale(0.1);
    }
    20% { opacity: 0; }
    42% { opacity: 0.42; }
    100% {
        opacity: 0;
        transform: translate3d(-50%, -50%, 0) scale(4.6);
    }
}

@keyframes preloaderLogoOut {
    0% {
        opacity: 0.9;
        transform: scale(0.98);
        filter: invert(1) blur(0) drop-shadow(0 0 1.1rem rgba(255, 255, 255, 0.06));
    }
    34% {
        opacity: 0.78;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(1.04);
        filter: invert(1) blur(0.12rem) drop-shadow(0 0 0 rgba(255, 255, 255, 0));
    }
}

@media (prefers-reduced-motion: reduce) {
    body.is-page-leaving .page-transition,
    body.is-page-leaving .page-transition__panel,
    body.is-page-leaving .page-transition__shutter::before,
    body.is-page-leaving .page-transition__logo,
    html.is-shutter-entering .page-transition,
    html.is-shutter-entering .page-transition__panel,
    html.is-shutter-entering .page-transition__shutter::before,
    html.is-shutter-entering .page-transition__logo {
        animation: none;
    }

    body.is-page-leaving .page-transition {
        visibility: visible;
        opacity: 1;
        background: #050505;
    }

    html.is-shutter-entering .page-transition {
        visibility: hidden;
        opacity: 0;
    }
}

body > .sound-embed,
body > .site-footer {
    display: none !important;
}

.cursor-follower {
    display: none !important;
}

#fileInput,
#textureInput {
    display: none;
}

.app-shell {
    position: relative;
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
    background: rgba(10, 10, 10, 0.96);
}

.hud-sidebar {
    position: relative;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    height: 100vh;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
    border-right: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(22, 22, 22, 0.98) 0%, rgba(16, 16, 16, 0.98) 100%);
}

.hud-sidebar__brand {
    position: relative;
    padding: 34px 22px 26px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.hud-brand__link {
    display: block;
    width: fit-content;
    max-width: 100%;
    color: inherit;
    text-decoration: none;
}

.hud-brand__logo {
    width: min(330px, calc(100% - 8px));
    max-width: 100%;
    filter: invert(1);
    opacity: 0.98;
    transition: opacity 180ms ease, transform 180ms ease;
}

.hud-brand__link:hover .hud-brand__logo {
    opacity: 1;
    transform: translateY(-1px);
}

.hud-brand__logo svg,
.hud-brand__logo img {
    display: block;
    width: 100%;
    height: auto;
}

.language-switch {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 16px;
    padding: 5px 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.025);
}

.language-switch__button {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--text-faint);
    padding: 3px 6px;
    border-radius: 999px;
    font: 760 10px/1 "Inter Variable", sans-serif;
    letter-spacing: 0.14em;
    cursor: pointer;
    transition: background 160ms ease, color 160ms ease;
}

.language-switch__button.is-active {
    background: rgba(255, 255, 255, 0.9);
    color: #111111;
}

.language-switch__divider {
    color: rgba(255, 255, 255, 0.22);
    font: 620 10px/1 "Inter Variable", sans-serif;
}

.hud-sidebar__filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 16px 20px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.tool-filter {
    appearance: none;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: var(--chip);
    color: var(--text-soft);
    padding: 7px 12px;
    font: 640 11px/1 "Inter Variable", sans-serif;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}

.tool-filter.is-active {
    background: var(--chip-active);
    border-color: rgba(255, 255, 255, 0.18);
    color: var(--chip-active-text);
}

.hud-sidebar__tools {
    min-height: 0;
    overflow-x: hidden;
    overflow-y: scroll;
    padding-bottom: 12px;
    scrollbar-gutter: stable;
    overscroll-behavior: contain;
    background:
        linear-gradient(rgba(18, 18, 18, 0.96), rgba(18, 18, 18, 0)) top / 100% 18px no-repeat,
        linear-gradient(rgba(18, 18, 18, 0), rgba(18, 18, 18, 0.96)) bottom / 100% 22px no-repeat,
        linear-gradient(180deg, rgba(18, 18, 18, 0.4), rgba(18, 18, 18, 0.4));
}

.hud-sidebar__tools::-webkit-scrollbar,
.controls-drawer__body::-webkit-scrollbar,
.lil-gui.root::-webkit-scrollbar {
    width: 10px;
}

.hud-sidebar__tools::-webkit-scrollbar-track,
.controls-drawer__body::-webkit-scrollbar-track,
.lil-gui.root::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.03);
}

.hud-sidebar__tools::-webkit-scrollbar-thumb,
.controls-drawer__body::-webkit-scrollbar-thumb,
.lil-gui.root::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
}

.tool-card {
    position: relative;
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) 20px;
    align-items: center;
    gap: 16px;
    width: 100%;
    border: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    background: transparent;
    color: inherit;
    text-align: left;
    padding: 17px 18px 18px 20px;
    transition: background 180ms ease, border-color 180ms ease;
}

.tool-card:hover,
.tool-card.is-active {
    background: rgba(255, 255, 255, 0.04);
}

.tool-card__index {
    align-self: start;
    color: var(--text-faint);
    font: 560 11px/1 "Inter Variable", sans-serif;
    letter-spacing: 0.18em;
}

.tool-card__content {
    min-width: 0;
}

.tool-card__title {
    margin: 0 0 6px;
    color: var(--text);
    font-size: 19px;
    font-weight: 700;
    line-height: 1;
}

.tool-card__meta {
    margin: 0;
    color: var(--text-faint);
    font: 560 10px/1.35 "Inter Variable", sans-serif;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.tool-card__arrow {
    color: var(--text-faint);
    font-size: 16px;
    text-align: right;
}

.tool-card[hidden] {
    display: none;
}

.tool-card--callout {
    box-shadow: inset 0 0 0 0 rgba(255, 255, 255, 0);
    animation: fileCalloutCardIntro 4.8s ease forwards;
}

.tool-card--callout .tool-card__arrow {
    display: none;
}

.tool-card__callout {
    display: none;
}

.hud-file-callout {
    position: fixed;
    z-index: 32;
    display: inline-flex;
    align-items: center;
    pointer-events: none;
    transform: translateY(-50%);
    opacity: 0;
    animation: fileCalloutIntro 4.8s ease forwards;
}

.hud-file-callout[hidden] {
    display: none;
}

.hud-file-callout__line {
    width: 36px;
    height: 1px;
    background: rgba(255, 255, 255, 0.74);
}

.hud-file-callout__dot {
    width: 15px;
    height: 15px;
    margin-left: -1px;
    border: 4px solid rgba(255, 255, 255, 0.92);
    border-radius: 999px;
    background: #0b0b0b;
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.16);
}

.hud-file-callout__text {
    width: 78px;
    margin-left: 10px;
    color: rgba(255, 255, 255, 0.78);
    font: 760 10px/1.12 "Inter Variable", sans-serif;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

@keyframes fileCalloutIntro {
    0% {
        opacity: 0;
    }
    21%,
    62% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        visibility: hidden;
    }
}

@keyframes fileCalloutCardIntro {
    0% {
        box-shadow: inset 0 0 0 0 rgba(255, 255, 255, 0);
        background: rgba(255, 255, 255, 0);
    }
    21%,
    62% {
        box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.78);
        background: rgba(255, 255, 255, 0.012);
    }
    100% {
        box-shadow: inset 0 0 0 0 rgba(255, 255, 255, 0);
        background: transparent;
    }
}

.hud-sidebar__footer {
    display: grid;
    gap: 12px;
    padding: 14px 20px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    background: linear-gradient(180deg, rgba(16, 16, 16, 0.94), rgba(18, 18, 18, 0.98));
}

.hud-footer__meta {
    display: grid;
    gap: 6px;
}

.hud-footer__meta p {
    margin: 0;
    color: var(--text-soft);
    font-size: 11px;
    line-height: 1.35;
}

.hud-footer__links {
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    width: fit-content;
    margin-left: 28px;
    padding: 6px 0 0 12px;
    transform: translateY(-6px);
}

.hud-footer__links::before {
    content: "";
    position: absolute;
    left: -28px;
    top: 7px;
    width: 24px;
    height: 34px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.025);
    pointer-events: none;
}

.hud-footer__links a,
.music-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.82);
    background: rgba(255, 255, 255, 0.03);
    transition: transform 160ms ease, background 160ms ease, color 160ms ease;
}

.music-toggle {
    padding: 0;
    cursor: pointer;
}

.music-control {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.hud-footer__links a:hover,
.music-toggle:hover,
.music-toggle.is-playing {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.hud-footer__links svg,
.music-toggle svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.music-toggle__icon--pause,
.music-toggle.is-playing .music-toggle__icon--play {
    display: none;
}

.music-toggle.is-playing .music-toggle__icon--pause {
    display: block;
}

.hud-footer__links audio {
    display: none;
}

.music-volume-popover {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 9px);
    display: grid;
    grid-template-columns: 88px 32px;
    align-items: center;
    gap: 8px;
    padding: 8px 9px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(10, 10, 10, 0.96);
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.32);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 5px);
    transition: opacity 150ms ease, transform 150ms ease;
    z-index: 8;
}

.music-control:hover .music-volume-popover,
.music-control:focus-within .music-volume-popover {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, 0);
}

.music-volume {
    width: 88px;
    accent-color: #ffffff;
}

.music-volume__value {
    color: rgba(255, 255, 255, 0.68);
    font: 650 10px/1 "Inter Variable", sans-serif;
    letter-spacing: 0.04em;
    text-align: right;
}

.sound-embed {
    width: 100%;
    max-width: 100%;
    padding: 8px 10px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(255, 255, 255, 0.02);
}

.sound-embed .elfsight-app-8d2a3da6-87d4-4e38-87bd-a303b034e273 {
    transform: scale(0.9);
    transform-origin: left center;
}

.hud-main {
    display: grid;
    grid-template-rows: minmax(0, 1fr) var(--info-height);
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.workbench-frame {
    position: relative;
    min-width: 0;
    min-height: 0;
    padding: 20px 20px 0 20px;
    overflow: hidden;
}

.workbench-frame__inner {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 0;
    border: 1px solid var(--border);
    background: rgba(5, 5, 5, 0.98);
    overflow: hidden;
}

.workbench-viewport {
    position: absolute;
    inset: 20px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: #000000;
    contain: strict;
    overflow: hidden;
}

.workbench-canvas {
    display: block;
    width: 100%;
    height: 100%;
    background: #000000;
}

.controls-drawer {
    position: absolute;
    top: 42px;
    right: 42px;
    z-index: 12;
    width: min(340px, calc(100% - 84px));
    pointer-events: none;
}

.controls-drawer__toggle {
    pointer-events: auto;
    position: absolute;
    top: 0;
    right: 0;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(14, 14, 14, 0.88);
    color: rgba(255, 255, 255, 0.9);
    padding: 11px 15px;
    font: 640 11px/1 "Inter Variable", sans-serif;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.controls-drawer__panel {
    pointer-events: auto;
    margin-top: 46px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background:
        linear-gradient(180deg, rgba(17, 17, 17, 0.96) 0%, rgba(10, 10, 10, 0.95) 100%);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 180ms ease, transform 180ms ease;
}

.controls-drawer.is-open .controls-drawer__panel {
    opacity: 1;
    transform: translateY(0);
}

.controls-drawer__header {
    display: grid;
    gap: 4px;
    padding: 16px 18px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.controls-drawer__header p {
    margin: 0;
    color: var(--text-faint);
    font: 560 10px/1 "Inter Variable", sans-serif;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.controls-drawer__header h2 {
    margin: 0;
    font-size: 21px;
    font-weight: 700;
}

.controls-drawer__body {
    max-height: calc(100vh - 240px);
    overflow: auto;
    padding: 10px 10px 16px;
}

.hud-info {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr) 180px;
    align-items: center;
    gap: 24px;
    padding: 0 26px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(19, 19, 19, 0.96);
}

.hud-info__left {
    display: grid;
    gap: 6px;
    justify-items: start;
}

.hud-info__left p,
.hud-info__right span {
    margin: 0;
    color: var(--text-faint);
    font: 560 10px/1 "Inter Variable", sans-serif;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.hud-info__left span {
    color: var(--text-soft);
    font: 560 18px/1 "Inter Variable", sans-serif;
}

.hud-info__center {
    text-align: center;
}

.hud-info__center p {
    margin: 0;
}

#toolInfoMeta {
    color: var(--text-faint);
    font: 560 11px/1.2 "Inter Variable", sans-serif;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

#toolInfoTitle {
    margin: 10px 0 8px;
    font-size: 24px;
    line-height: 1;
}

#toolInfoDescription {
    max-width: 720px;
    margin: 0 auto;
    color: var(--text-soft);
    font-size: 15px;
    line-height: 1.55;
}

.hud-info__right {
    display: grid;
    gap: 4px;
    justify-items: end;
}

.hud-info__right strong {
    color: rgba(255, 255, 255, 0.92);
    font: 560 11px/1 "Inter Variable", sans-serif;
    letter-spacing: 0.18em;
}

.lil-gui,
.lil-gui *,
.hud-footer__links a,
.hud-footer__links a *,
.music-toggle,
.music-toggle *,
.sound-embed,
.sound-embed * {
    cursor: auto !important;
}

.music-toggle,
.music-toggle *,
.music-volume,
.music-volume * {
    cursor: pointer !important;
}

.controls-drawer__body > .lil-gui.root {
    position: static;
    width: 100%;
    max-width: none;
    max-height: none;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    overflow: visible;
    --background-color: transparent;
    --widget-color: rgba(255, 255, 255, 0.06);
    --hover-color: rgba(255, 255, 255, 0.1);
    --focus-color: rgba(255, 255, 255, 0.08);
    --text-color: rgba(255, 255, 255, 0.88);
    --title-background-color: rgba(255, 255, 255, 0.04);
    --title-text-color: rgba(255, 255, 255, 0.94);
    --number-color: rgba(255, 255, 255, 0.88);
    --string-color: rgba(255, 255, 255, 0.88);
}

.controls-drawer__body > .lil-gui.root::before,
.controls-drawer__body > .lil-gui.root > .title {
    display: none;
}

.controls-drawer__body .lil-gui .folder {
    border-top: 0;
}

.controls-drawer__body .lil-gui .folder > .title {
    margin: 0 0 10px;
    padding: 12px 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    border-radius: 18px;
    font: 640 11px/1 "Inter Variable", sans-serif;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.controls-drawer__body .lil-gui .children {
    border-left: 0;
}

.controls-drawer__body .lil-gui .controller {
    margin: 0 0 8px;
    padding: 3px 0;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.controls-drawer__body .lil-gui .name {
    padding-left: 12px;
    font-size: 11px;
    letter-spacing: 0.02em;
}

.controls-drawer__body .lil-gui .widget {
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.controls-drawer__body .lil-gui .controller.color,
.controls-drawer__body .lil-gui .controller.color .widget {
    overflow: visible;
}

.controls-drawer__body .lil-gui .controller.color .widget {
    position: relative;
}

.controls-drawer__body .lil-gui .controller.color .display {
    display: contents;
}

.controls-drawer__body .lil-gui .controller.boolean {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 36px;
    padding: 6px 10px 6px 0;
    background: rgba(255, 255, 255, 0.022);
}

.controls-drawer__body .lil-gui .controller.boolean .name {
    align-self: center;
    color: rgba(255, 255, 255, 0.84);
}

.controls-drawer__body .lil-gui .controller.boolean .widget {
    justify-self: end;
    width: auto;
    min-width: 0;
    height: auto;
    padding: 0;
    border: 0;
    background: transparent;
}

.controls-drawer__body .lil-gui .controller.boolean input[type="checkbox"] {
    appearance: none;
    position: relative;
    display: block;
    width: 46px;
    height: 24px;
    margin: 0;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.025)),
        rgba(255, 255, 255, 0.04);
    box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.5);
    cursor: pointer;
    transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.controls-drawer__body .lil-gui .controller.boolean input[type="checkbox"]::before {
    content: "";
    position: absolute;
    left: 3px;
    top: 3px;
    width: 16px;
    height: 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.34);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.42);
    transition: transform 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.controls-drawer__body .lil-gui .controller.boolean input[type="checkbox"]:checked {
    border-color: rgba(255, 255, 255, 0.5);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(210, 210, 210, 0.78)),
        #ffffff;
    box-shadow: 0 0 18px rgba(255, 255, 255, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.68);
}

.controls-drawer__body .lil-gui .controller.boolean input[type="checkbox"]:checked::before {
    background: #101010;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.46);
    transform: translateX(22px);
}

.controls-drawer__body .lil-gui .controller.boolean input[type="checkbox"]:focus-visible {
    outline: 1px solid rgba(255, 255, 255, 0.72);
    outline-offset: 3px;
}

.controls-drawer__body .lil-gui .slider {
    height: 20px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
}

.controls-drawer__body .lil-gui .slider-fg {
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.94) 0%, rgba(204, 204, 204, 0.82) 100%);
}

.controls-drawer__body .lil-gui .slider > *,
.controls-drawer__body .lil-gui .slider::before,
.controls-drawer__body .lil-gui .slider::after {
    background-color: #ffffff !important;
    border-color: #ffffff !important;
}

.controls-drawer__body .lil-gui input[type="range"] {
    accent-color: #ffffff;
}

.controls-drawer__body .lil-gui input,
.controls-drawer__body .lil-gui button,
.controls-drawer__body .lil-gui select {
    border-radius: 999px !important;
}

.controls-drawer__body .lil-gui input[type="text"],
.controls-drawer__body .lil-gui input[type="number"],
.controls-drawer__body .lil-gui select,
.controls-drawer__body .lil-gui button {
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.92);
}

.inline-color-control {
    position: relative;
    width: 100%;
}

.inline-color-control.is-open {
    position: relative;
    z-index: 30;
}

.inline-color-control > input[type="color"] {
    position: absolute;
    width: 1px !important;
    height: 1px !important;
    opacity: 0;
    pointer-events: none;
}

.controls-drawer__body .lil-gui .inline-color-button {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    width: 100%;
    min-width: 0;
    height: 32px;
    padding: 4px 8px;
    border-radius: 999px !important;
    text-align: left;
}

.inline-color-swatch {
    display: block;
    width: 22px;
    height: 22px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 7px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24), 0 4px 12px rgba(0, 0, 0, 0.24);
}

.inline-color-value {
    overflow: hidden;
    color: rgba(255, 255, 255, 0.8);
    font: 650 11px/1 "Inter Variable", sans-serif;
    letter-spacing: 0.04em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.inline-color-panel {
    position: fixed;
    z-index: 1000;
    display: grid;
    gap: 8px;
    width: 220px;
    margin-top: 0;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    background: rgba(8, 8, 8, 0.96);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.38);
}

.inline-color-panel[hidden] {
    display: none !important;
}

.inline-color-sv {
    position: relative;
    height: 112px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    background:
        linear-gradient(0deg, #000 0%, rgba(0, 0, 0, 0) 100%),
        linear-gradient(90deg, #fff 0%, rgba(255, 255, 255, 0) 100%),
        var(--picker-hue, #ff0000);
    cursor: crosshair;
}

.inline-color-sv-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    border: 2px solid #fff;
    border-radius: 999px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.75), 0 2px 8px rgba(0, 0, 0, 0.4);
    transform: translate(-50%, -50%);
}

.inline-color-hue {
    width: 100%;
    accent-color: #ffffff;
}

.inline-color-hex {
    width: 100%;
    text-align: center;
    text-transform: uppercase;
}

.gradient-stops-ui {
    display: block;
    margin: 8px 0 4px;
    padding: 0;
}

.gradient-editor {
    display: grid;
    gap: 11px;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.025);
}

.gradient-editor__header,
.gradient-editor__list-title {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 82px;
    align-items: center;
    gap: 10px;
    color: rgba(255, 255, 255, 0.56);
    font: 700 9px/1.15 "Inter Variable", sans-serif;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.gradient-editor__header span:last-child,
.gradient-editor__list-title span:last-child {
    text-align: right;
}

.gradient-editor__preview {
    position: relative;
    padding-top: 2px;
    padding-bottom: 25px;
}

.gradient-editor__bar {
    height: 28px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 7px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
    cursor: copy;
}

.gradient-editor__stops {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 1px;
    height: 20px;
}

.gradient-editor__stop {
    position: absolute;
    bottom: 0;
    display: block !important;
    width: 14px !important;
    min-width: 14px !important;
    max-width: 14px !important;
    height: 14px !important;
    min-height: 14px !important;
    padding: 0 !important;
    border: 2px solid rgba(255, 255, 255, 0.95);
    border-radius: 3px !important;
    background: var(--stop-color);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.22);
    cursor: ew-resize;
    font-size: 0 !important;
    line-height: 0 !important;
    transform: translateX(-50%) rotate(45deg);
}

.gradient-editor__stop::after {
    content: "";
    position: absolute;
    inset: 2px;
    border-radius: 1px;
    background: var(--stop-color);
}

.gradient-editor__stop.is-active {
    border-color: #7ba9ff;
    box-shadow: 0 0 0 2px rgba(123, 169, 255, 0.22), 0 2px 12px rgba(0, 0, 0, 0.3);
}

.gradient-editor__selected {
    display: grid;
    gap: 7px;
    padding-top: 2px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.gradient-editor__selected-title {
    color: rgba(255, 255, 255, 0.56);
    font: 700 9px/1 "Inter Variable", sans-serif;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.gradient-editor__selected-controls {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr) 74px;
    gap: 7px;
    align-items: end;
}

.gradient-editor__field {
    display: grid;
    gap: 5px;
    min-width: 0;
}

.gradient-editor__field > span {
    color: rgba(255, 255, 255, 0.8);
    font: 620 9px/1 "Inter Variable", sans-serif;
}

.gradient-editor__color {
    width: 100%;
    height: 32px;
    padding: 0;
    border-radius: 10px !important;
    background: transparent !important;
}

.gradient-editor__position-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 14px;
    align-items: center;
    gap: 4px;
}

.gradient-editor__number {
    width: 100%;
    text-align: center;
}

.gradient-editor__position-wrap > span {
    color: rgba(255, 255, 255, 0.68);
    font: 600 12px/1 "Inter Variable", sans-serif;
}

.gradient-stop-list {
    display: grid;
    gap: 5px;
}

.gradient-stop-item {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr) 42px 14px;
    gap: 7px;
    align-items: center;
    width: 100%;
    min-height: 28px;
    padding: 5px 8px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 10px !important;
    background: rgba(0, 0, 0, 0.22);
    color: rgba(255, 255, 255, 0.9);
    text-align: left;
}

.gradient-stop-item.is-active {
    border-color: rgba(123, 169, 255, 0.72);
    background: rgba(61, 103, 183, 0.16);
}

.gradient-stop-item__swatch {
    display: block;
    width: 16px;
    height: 16px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 5px;
}

.gradient-stop-item__hex,
.gradient-stop-item__pos {
    font: 700 10px/1 "Inter Variable", sans-serif;
}

.gradient-stop-item__hex {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gradient-stop-item__pos,
.gradient-stop-item__close {
    color: rgba(255, 255, 255, 0.56);
    text-align: right;
}

.gradient-stop-item__close {
    font-size: 14px;
    line-height: 1;
    text-align: center;
}

.gradient-stop-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    width: 100%;
    height: 32px;
    padding: 0 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px !important;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.9);
    font: 700 10px/1 "Inter Variable", sans-serif;
}

.gradient-stop-remove:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.image-filters-ui {
    max-height: 390px;
    margin: 10px 0 4px;
    padding: 2px 4px 2px 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.image-filter-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.image-filter-card {
    display: grid;
    gap: 6px;
    box-sizing: border-box;
    min-width: 0;
    min-height: 74px;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, 0.075);
    border-radius: 12px !important;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.018));
    color: rgba(255, 255, 255, 0.68);
    cursor: pointer;
    user-select: none;
    transition: border-color 160ms ease, background 160ms ease, color 160ms ease, transform 160ms ease;
}

.image-filter-card:hover,
.image-filter-card.is-active {
    border-color: rgba(255, 255, 255, 0.34);
    background: rgba(255, 255, 255, 0.07);
    color: rgba(255, 255, 255, 0.96);
}

.image-filter-card:focus-visible {
    outline: 1px solid rgba(255, 255, 255, 0.48);
    outline-offset: 2px;
}

.image-filter-card:active {
    transform: translateY(1px);
}

.image-filter-preview {
    display: block;
    width: 100%;
    height: 42px;
    border-radius: 9px;
    background: var(--filter-preview);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), inset 0 -10px 18px rgba(0, 0, 0, 0.22);
}

.image-filter-name {
    overflow: hidden;
    color: inherit;
    font: 680 10px/1.2 "Inter Variable", sans-serif;
    letter-spacing: 0.04em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 1180px) {
    :root {
        --sidebar-width: 320px;
        --info-height: 148px;
    }

    .tool-card__title {
        font-size: 17px;
    }

    .controls-drawer {
        top: 32px;
        right: 32px;
    }
}

@media (max-width: 920px) {
    body {
        overflow: auto;
    }

    .app-shell {
        grid-template-columns: 1fr;
        grid-template-rows: auto minmax(0, 1fr);
        height: auto;
        min-height: 100vh;
    }

    .hud-sidebar {
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

    .hud-main {
        grid-template-rows: minmax(70vh, auto) auto;
    }

    .hud-info {
        grid-template-columns: 1fr;
        text-align: center;
        padding: 22px;
    }

    .hud-info__left,
    .hud-info__right {
        justify-items: center;
    }

    .controls-drawer {
        width: min(340px, calc(100% - 56px));
        top: 28px;
        right: 28px;
    }
}

@media (max-width: 640px) {
    .hud-sidebar__brand {
        padding: 24px 20px 18px;
    }

    .hud-sidebar__filters,
    .hud-sidebar__footer {
        padding-left: 16px;
        padding-right: 16px;
    }

    .tool-card {
        grid-template-columns: 40px minmax(0, 1fr) 18px;
        gap: 14px;
        padding: 18px 16px;
    }

    .workbench-frame {
        padding: 14px 14px 0;
    }

    .workbench-viewport {
        inset: 14px;
    }

    .controls-drawer {
        position: absolute;
        top: 22px;
        right: 22px;
        left: 22px;
        width: auto;
    }

    .controls-drawer__body {
        max-height: 48vh;
    }
}
