:root {
    color-scheme: light;
    --blue: #1b7dd4;
    --blue-dark: #115b9c;
    --ink: #263238;
    --muted: #667680;
    --line: #dce5ea;
    --panel: #ffffff;
    --canvas: #edf5f8;
    --danger: #c83d4f;
    --shadow: 0 10px 30px rgba(27, 57, 75, 0.12);
    --safe-area-top: env(safe-area-inset-top, 0px);
    --safe-area-right: env(safe-area-inset-right, 0px);
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
    --safe-area-left: env(safe-area-inset-left, 0px);
}

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
    background-color: var(--blue);
}

body {
    color: var(--ink);
    font-family: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

body,
body * {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-drag: none;
    -webkit-user-select: none;
    user-select: none;
}

input:not([type]),
input:is([type="text"], [type="search"], [type="email"], [type="password"], [type="url"], [type="tel"], [type="number"]),
textarea,
[contenteditable]:not([contenteditable="false"]) {
    -webkit-touch-callout: default;
    -webkit-user-select: text;
    user-select: text;
}

button,
input,
select {
    font: inherit;
}

button,
select,
input[type="color"] {
    touch-action: manipulation;
}

[hidden] {
    display: none !important;
}

.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;
    white-space: nowrap !important;
    border: 0 !important;
}

.editor-shell {
    --debug-panel-width: 320px;
    position: relative;
    display: block;
    width: 100%;
    height: 100dvh;
}

.sidebar {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    display: flex;
    width: var(--debug-panel-width);
    min-width: 0;
    flex-direction: column;
    background: #f7fafb;
    border-left: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.sidebar[hidden] {
    display: none;
}

.sidebar-topbar {
    display: flex;
    min-height: 50px;
    align-items: center;
    justify-content: flex-end;
    padding: calc(10px + var(--safe-area-top)) calc(14px + var(--safe-area-right)) 0 14px;
}

.sidebar-close {
    display: grid;
    width: 40px;
    height: 40px;
    padding: 0;
    place-items: center;
    background: transparent;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
}

.sidebar-close:hover {
    transform: translateY(-1px);
}

.sidebar-close:active {
    transform: translateY(1px);
}

.sidebar-close:focus-visible {
    outline: 3px solid rgba(27, 125, 212, 0.3);
    outline-offset: 2px;
}

.sidebar-close img {
    display: block;
    width: 40px;
    height: 40px;
    object-fit: contain;
    filter: brightness(0);
    opacity: 0.8;
}

.sidebar-scroll {
    flex: 1;
    min-height: 0;
    padding: 14px calc(14px + var(--safe-area-right)) 14px 14px;
    overflow: auto;
}

.panel {
    padding: 15px;
    margin-bottom: 11px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 13px;
}

.panel h2 {
    margin: 0 0 12px;
    color: var(--ink);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.075em;
    text-transform: uppercase;
}

.panel-copy {
    margin: -3px 0 10px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.45;
}

.local-file-error {
    margin: 8px 0 0;
    color: var(--danger);
    font-size: 11px;
    font-weight: 700;
}

.local-file-error:empty {
    display: none;
}

.section-heading-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}

.save-state {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

.save-state.is-dirty {
    color: #a25b00;
}

.field-label {
    display: block;
    margin: 0 0 6px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

.text-field,
.select-field {
    width: 100%;
    height: 36px;
    min-width: 0;
    padding: 0 10px;
    color: var(--ink);
    background: #fff;
    border: 1px solid #cbd7de;
    border-radius: 8px;
    outline: none;
}

.text-field:focus,
.select-field:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(27, 125, 212, 0.13);
}

.build-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 7px 12px;
    margin-top: 10px;
    color: var(--muted);
    font-size: 11px;
}

.build-facts strong {
    color: var(--ink);
}

.part-add-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px;
}

.part-library-search {
    margin-bottom: 7px;
}

.part-add-row + .field-label {
    margin-top: 12px;
}

.selection-readout {
    min-height: 18px;
    margin: 10px 0 8px;
    color: var(--muted);
    font-size: 11px;
}

.debug-toggle-row {
    display: flex;
    min-height: 34px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 9px;
    color: var(--ink);
    background: #f4f7f8;
    border: 1px solid #cbd7de;
    border-radius: 8px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 800;
}

.debug-toggle-row input {
    width: 17px;
    height: 17px;
    margin: 0;
    accent-color: var(--blue);
    cursor: pointer;
}

.debug-toggle-row:has(input:focus-visible) {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(27, 125, 212, 0.13);
}

.action-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
}

.action-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 7px;
}

.button {
    min-height: 36px;
    padding: 7px 11px;
    color: var(--ink);
    background: #f4f7f8;
    border: 1px solid #cbd7de;
    border-radius: 8px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 800;
}

.button:hover:not(:disabled) {
    background: #e9f1f5;
}

.button:active:not(:disabled) {
    transform: translateY(1px);
}

.button.primary,
.button.save {
    color: #fff;
    background: var(--blue);
    border-color: var(--blue);
}

.button.primary:hover:not(:disabled),
.button.save:hover:not(:disabled) {
    background: var(--blue-dark);
}

.button.danger {
    color: var(--danger);
    background: #fff8f8;
    border-color: #efc7cc;
}

.button.compact {
    padding-inline: 5px;
}

.button.is-active {
    color: var(--blue-dark);
    background: #e5f2fc;
    border-color: #8fc4ec;
}

.button:disabled,
.text-field:disabled,
.select-field:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.full-width {
    width: 100%;
    margin-top: 7px;
}

.button.save {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 42px;
}

.button.save img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

kbd {
    color: inherit;
    opacity: 0.62;
    font-family: inherit;
    font-size: 8px;
    font-weight: 700;
}

.warning-panel {
    padding: 12px 14px;
    margin-bottom: 12px;
    color: #6f4a00;
    background: #fff7df;
    border: 1px solid #efd48a;
    border-radius: 10px;
    font-size: 11px;
}

.warning-panel summary {
    cursor: pointer;
    font-weight: 800;
}

.warning-panel ul {
    padding-left: 18px;
    margin: 9px 0 0;
}

.warning-panel li + li {
    margin-top: 5px;
}

.sidebar-footer {
    min-height: 42px;
    padding: 10px calc(14px + var(--safe-area-right)) calc(10px + var(--safe-area-bottom)) 14px;
    color: #53646d;
    background: #edf3f6;
    border-top: 1px solid var(--line);
    font-size: 11px;
}

.workspace {
    --part-bin-width: clamp(210px, 24vw, 238px);
    position: relative;
    display: flex;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    flex-direction: row;
}

.file-drop-overlay {
    position: absolute;
    inset: 18px;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 6px;
    color: #fff;
    background: rgba(17, 91, 156, 0.9);
    border: 4px dashed rgba(255, 255, 255, 0.92);
    border-radius: 22px;
    box-shadow: 0 12px 36px rgba(5, 36, 64, 0.25);
    opacity: 0;
    pointer-events: none;
    transform: scale(0.985);
    visibility: hidden;
    transition: opacity 120ms ease, transform 120ms ease, visibility 120ms ease;
}

.file-drop-overlay strong {
    font-size: clamp(20px, 3vw, 34px);
    font-weight: 800;
}

.file-drop-overlay span {
    color: rgba(255, 255, 255, 0.88);
    font-size: 13px;
    font-weight: 700;
}

.workspace.is-file-drag-over .file-drop-overlay {
    opacity: 1;
    transform: scale(1);
    visibility: visible;
}

.viewport {
    position: relative;
    flex: 1;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    background: radial-gradient(circle at 50% 42%, #f9fcfd 0%, #e7f1f5 70%, #dbe9ef 100%);
}

#scene-canvas {
    display: block;
    width: 100%;
    height: 100%;
    outline: none;
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.corner-curve-report {
    max-height: 300px;
    margin: 10px 0 0;
    padding: 9px;
    overflow: auto;
    color: #29414f;
    background: #edf3f6;
    border: 1px solid #d3dfe5;
    border-radius: 7px;
    font: 10px/1.45 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.corner-curve-report:focus-visible {
    outline: 3px solid rgba(27, 125, 212, 0.22);
    outline-offset: 1px;
}

.color-eyedropper-preview {
    position: absolute;
    z-index: 4;
    width: 18px;
    height: 18px;
    background: transparent;
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 1px 5px rgba(38, 50, 56, 0.55);
    pointer-events: none;
    transform: translate(12px, 12px);
}

.part-bin {
    /*
     * PART BIN ARROW ICON HORIZONTAL TUNING
     * These move only the WHITE ARROW ICON, not its blue circular button.
     * Positive values nudge the icon RIGHT; negative values nudge it LEFT.
     * Adjust the open and closed values independently.
     */
    --part-bin-arrow-icon-palette-out-nudge: -10px; /* Palette OUT / panel open */
    --part-bin-arrow-icon-palette-in-nudge: -10px;  /* Palette IN / panel closed */

    --part-bin-arrow-palette-out-base: -20px;
    --part-bin-arrow-palette-in-base: -40px;
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 6;
    width: var(--part-bin-width);
    min-width: 0;
    isolation: isolate;
    pointer-events: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    transition: width 260ms cubic-bezier(0.22, 0.78, 0.24, 1);
}

.part-bin.is-collapsed {
    width: 0;
}

.editor-shell.is-debug-panel-open .part-bin {
    right: var(--debug-panel-width);
}

.part-bin-panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    display: flex;
    width: var(--part-bin-width);
    min-height: 0;
    padding:
        calc(36px + var(--safe-area-top))
        calc(20px + var(--safe-area-right))
        calc(22px + var(--safe-area-bottom))
        30px;
    flex-direction: column;
    background: #0165D4;
    pointer-events: auto;
    /* Four-pixel circular fillets soften the two ends of the bowed left edge. */
    clip-path: polygon(
        calc(3% + 4px) 0,
        100% 0,
        100% 100%,
        calc(3% + 4px) 100%,
        calc(3% + 2.47px) calc(100% - 0.3px),
        calc(3% + 1.17px) calc(100% - 1.17px),
        calc(3% + 0.3px) calc(100% - 2.47px),
        3% calc(100% - 4px),
        7.6% 75%,
        8.625% 50%,
        7.6% 25%,
        3% 4px,
        calc(3% + 0.3px) 2.47px,
        calc(3% + 1.17px) 1.17px,
        calc(3% + 2.47px) 0.3px
    );
    clip-path: shape(
        from calc(3% + 4px) 0,
        hline to 100%,
        vline to 100%,
        hline to calc(3% + 4px),
        curve to 3% calc(100% - 4px) with calc(3% + 1.79px) 100% / 3% calc(100% - 1.79px),
        curve to 3% 4px with 10.5% 75% / 10.5% 25%,
        curve to calc(3% + 4px) 0 with 3% 1.79px / calc(3% + 1.79px) 0,
        close
    );
    transition: transform 260ms cubic-bezier(0.22, 0.78, 0.24, 1), visibility 260ms;
}

.part-bin.is-drag-cancel-target .part-bin-panel {
    box-shadow: inset 0 0 0 5px rgba(8, 117, 213, 0.55);
}

.part-bin.is-collapsed .part-bin-panel {
    visibility: hidden;
    transform: translateX(100%);
}

.part-bin.is-collapsed.is-peeking .part-bin-toggle {
    animation: part-bin-toggle-peek 720ms cubic-bezier(0.3, 0.8, 0.35, 1);
}

@keyframes part-bin-toggle-peek {
    0%,
    100% {
        background-color: #0165D4;
        transform: translate(0, -50%);
    }

    34%,
    56% {
        background-color: #4B97EB;
        transform: translate(-14px, -50%);
    }

    78% {
        background-color: #0165D4;
        transform: translate(2px, -50%);
    }
}

.part-bin-panel h2 {
    margin: 0 0 18px;
    color: #fff;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.025em;
    line-height: 1;
    text-align: center;
    text-transform: uppercase;
}

.part-bin-toggle {
    position: absolute;
    top: 50%;
    left: var(--part-bin-arrow-palette-out-base);
    z-index: 1;
    display: grid;
    width: 68px;
    height: 68px;
    padding: 15px;
    place-items: center;
    background: #0165D4;
    border: 0;
    border-radius: 50%;
    box-shadow: 0 5px 18px rgba(21, 67, 98, 0.28);
    cursor: pointer;
    pointer-events: auto;
    transform: translateY(-50%);
    transition: left 220ms ease;
}

.part-bin.is-collapsed .part-bin-toggle {
    left: var(--part-bin-arrow-palette-in-base);
}

.part-bin-toggle:hover {
    background: #4B97EB;
}

.part-bin-toggle:focus-visible,
.part-bin-add-more:focus-visible,
.part-bin-option:focus-visible,
.part-bin-sticker-flip:focus-visible {
    outline: 3px solid rgba(8, 117, 213, 0.38);
    outline-offset: 3px;
}

.part-bin-toggle img {
    display: block;
    width: 32px;
    height: 32px;
    object-fit: contain;
    transform: translateX(var(--part-bin-arrow-icon-palette-out-nudge));
    transition: transform 220ms ease;
}

.part-bin.is-collapsed .part-bin-toggle img {
    transform: translateX(var(--part-bin-arrow-icon-palette-in-nudge)) rotate(180deg);
}

.part-bin-add-more {
    display: flex;
    width: 100%;
    min-height: 54px;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 10px;
    margin-bottom: 18px;
    color: #343b3f;
    background: #fff;
    border: 0;
    border-radius: 999px;
    box-shadow: 0 4px 12px rgba(21, 67, 98, 0.22);
    cursor: pointer;
    font-size: 14px;
    font-weight: 800;
    white-space: nowrap;
}

.part-bin-add-more:hover:not(:disabled) {
    background: #eef5f9;
    transform: translateY(-1px);
}

.part-bin-add-more:disabled {
    cursor: not-allowed;
}

.part-bin-add-more img {
    display: block;
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    filter: brightness(0);
    object-fit: contain;
    opacity: 0.8;
}

.part-bin-list {
    --part-bin-gap: 14px;
    display: flex;
    min-height: 0;
    align-items: center;
    gap: var(--part-bin-gap);
    padding: 0 5px 10px;
    flex: 1;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: none;
    overflow-anchor: none;
}

.part-bin-list::-webkit-scrollbar {
    display: none;
}

.part-bin-option-shell {
    position: relative;
    width: 100%;
    min-height: 0;
    flex: 0 0 auto;
    aspect-ratio: 1;
}

.part-bin-option-shell.is-reveal-pending {
    height: 0;
    margin-top: calc(-1 * var(--part-bin-gap));
    visibility: hidden;
}

.part-bin-option-shell.is-revealing {
    animation: part-bin-option-pop 420ms ease-out var(--part-reveal-delay, 0ms) backwards;
}

@keyframes part-bin-option-pop {
    0% {
        height: 0;
        margin-top: calc(-1 * var(--part-bin-gap));
        transform: scale(0);
    }
    65% {
        height: var(--part-reveal-size);
        margin-top: 0;
        transform: scale(1.035);
    }
    82% { transform: scale(0.98); }
    100% {
        height: var(--part-reveal-size);
        margin-top: 0;
        transform: scale(1);
    }
}

.part-bin-option {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: 0;
    overflow: hidden;
    color: var(--ink);
    background-color: #f8f8f6;
    background-image:
        linear-gradient(45deg, rgba(215, 218, 219, 0.5) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(215, 218, 219, 0.5) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(215, 218, 219, 0.5) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(215, 218, 219, 0.5) 75%);
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
    background-size: 16px 16px;
    border: 4px solid #d2d4d4;
    border-radius: 16px;
    cursor: pointer;
    touch-action: none;
    transition:
        background-color 280ms ease,
        border-color 280ms ease,
        transform 140ms ease,
        box-shadow 280ms ease;
    -webkit-user-drag: none;
}

.part-bin-option:hover:not(:disabled) {
    border-color: #1594f6;
    box-shadow: 0 7px 18px rgba(24, 58, 79, 0.22);
    transform: translateY(-2px);
}

.part-bin-option:active:not(:disabled) {
    transform: translateY(1px);
}

.part-bin-option:disabled {
    cursor: not-allowed;
    opacity: 0.58;
}

.part-bin-option.is-selected {
    background-color: #dceeff;
    border-color: #1594f6;
    box-shadow: 0 7px 18px rgba(24, 58, 79, 0.18);
}

.part-bin-option.is-dragging {
    border-color: #0875d5;
    cursor: grabbing;
    opacity: 0.52;
    transform: scale(0.96);
}

.part-bin.is-dragging-part,
.part-bin.is-dragging-part .part-bin-option {
    cursor: grabbing;
}

.part-bin-option img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    -webkit-user-drag: none;
}

.part-bin-option.is-sticker img {
    padding: 10%;
    transition: transform 180ms ease;
}

.part-bin-option.is-sticker.is-flipped img {
    transform: scaleX(-1);
}

.part-bin-sticker-flip {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 3;
    display: grid;
    width: 44px;
    height: 44px;
    padding: 3px;
    place-items: center;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    cursor: pointer;
    touch-action: manipulation;
}

.part-bin-sticker-flip:hover {
    transform: scale(1.1);
}

.part-bin-sticker-flip img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    -webkit-user-drag: none;
}

.part-bin-option-prompt {
    position: absolute;
    right: 9px;
    bottom: 9px;
    left: 9px;
    z-index: 2;
    padding: 7px 8px;
    color: #07569c;
    background: rgba(240, 248, 255, 0.94);
    border-radius: 8px;
    box-shadow: 0 2px 7px rgba(17, 75, 119, 0.16);
    font-size: 13px;
    font-weight: 800;
    line-height: 1.15;
    opacity: 0;
    pointer-events: none;
    transform: translateY(5px);
    transition: opacity 280ms ease, transform 280ms ease;
}

.part-bin-option.is-selected .part-bin-option-prompt {
    opacity: 1;
    transform: translateY(0);
}

.part-bin-option-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 3px solid rgba(38, 50, 56, 0.15);
    border-top-color: #60727b;
    border-radius: 50%;
    animation: spin 700ms linear infinite;
}

.viewport-close {
    position: absolute;
    top: calc(24px + var(--safe-area-top));
    left: calc(24px + var(--safe-area-left));
    z-index: 4;
    display: grid;
    width: 50px;
    height: 50px;
    place-items: center;
    background: #1b7dd4;
    border-radius: 50%;
    box-shadow: none;
}

.viewport-close:hover {
    background: #006bc8;
    transform: translateY(-1px);
}

.viewport-close:active {
    transform: translateY(1px);
}

.viewport-close:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.94);
    outline-offset: 3px;
}

.viewport-close img {
    display: block;
    width: 50px;
    height: 50px;
    object-fit: contain;
}

.demo-card-callout {
    position: absolute;
    top: calc(32px + var(--safe-area-top));
    left: 50%;
    z-index: 4;
    padding: 7px 13px;
    color: #fff;
    background: #f5a400;
    border: 2px solid #fff;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0.025em;
    text-transform: uppercase;
    white-space: nowrap;
    pointer-events: none;
    transform: translateX(-50%);
}

.workspace.is-part-bin-open .demo-card-callout {
    left: calc(50% - (var(--part-bin-width) / 2));
}

.loading-overlay {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 7px;
    color: #fff;
    background: #42a5f5;
    text-shadow: 0 1px 2px rgba(17, 91, 156, 0.72);
    transition: opacity 180ms ease, visibility 180ms ease;
}

.loading-build-stage {
    display: none;
}

.loading-overlay.is-remix-loading {
    gap: 8px;
}

.loading-overlay.is-remix-loading .loading-build-stage {
    position: relative;
    display: block;
    width: min(76vw, 560px);
    height: clamp(240px, 44vh, 440px);
    flex: 0 1 auto;
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
    transition: transform 340ms cubic-bezier(0.55, 0, 0.8, 0.35), opacity 340ms ease;
    will-change: transform, opacity;
}

.loading-build-preview {
    display: block;
    width: 100%;
    height: 100%;
}

.loading-overlay.is-remix-loading .loading-build-stage.is-exiting {
    opacity: 0;
    transform: translate3d(-120vw, 0, 0) scale(0.96);
}

.loading-overlay.is-remix-loading .loading-build-stage.is-resetting {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
    transition: none;
}

.loading-overlay.is-remix-loading .loading-build-stage.is-popping {
    animation: loading-build-pop 420ms cubic-bezier(0.2, 0.85, 0.35, 1) both;
}

.loading-overlay.is-error .loading-build-stage {
    display: none;
}

.loading-overlay.is-hidden {
    visibility: hidden;
    opacity: 0;
}

.loading-overlay.is-error {
    color: #8e2835;
    background: rgba(255, 241, 243, 0.96);
    text-shadow: none;
}

.loading-overlay span {
    max-width: 420px;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

.loading-overlay:not(.is-error) span {
    color: #dce5ea;
}

.developer-auth {
    display: flex;
    order: 1;
    max-width: min(360px, calc(100vw - 40px));
    align-items: center;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
}

.developer-auth[hidden] {
    display: none;
}

.developer-sign-in {
    min-height: 44px;
    padding: 10px 18px;
    color: #fff;
    background: var(--blue);
    border: 0;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(21, 67, 98, 0.2);
    cursor: pointer;
    font: inherit;
    font-weight: 800;
}

.developer-sign-in:hover:not(:disabled) {
    background: #006bc8;
}

.developer-sign-in:focus-visible {
    outline: 3px solid rgba(8, 117, 213, 0.35);
    outline-offset: 3px;
}

.developer-sign-in:disabled {
    cursor: wait;
    opacity: 0.65;
}

.loading-overlay .auth-error {
    min-height: 18px;
    color: #8e2835;
}

.viewport-menu-control {
    position: absolute;
    top: calc(24px + var(--safe-area-top));
    right: calc(24px + var(--safe-area-right));
    z-index: 4;
    display: flex;
    align-items: flex-end;
    flex-direction: column;
    gap: 12px;
}

.workspace.is-part-bin-open .viewport-menu-control {
    right: calc(var(--part-bin-width) + 24px);
}

.editor-shell.is-debug-panel-open .viewport-menu-control {
    right: calc(var(--debug-panel-width) + 24px);
}

.editor-shell.is-debug-panel-open .workspace.is-part-bin-open .viewport-menu-control {
    right: calc(var(--debug-panel-width) + var(--part-bin-width) + 24px);
}

.viewport-menu-toggle {
    display: grid;
    width: 50px;
    height: 50px;
    padding: 0;
    place-items: center;
    background: #1b7dd4;
    border: 0;
    border-radius: 50%;
    box-shadow: none;
    cursor: pointer;
}

.viewport-menu-toggle:hover,
.viewport-menu-toggle[aria-expanded="true"] {
    background: #006bc8;
    transform: translateY(-1px);
}

.viewport-menu-toggle:focus-visible,
.viewport-menu-item:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.94);
    outline-offset: 3px;
}

.viewport-menu-toggle img {
    display: block;
    width: 50px;
    height: 50px;
    object-fit: contain;
}

.viewport-menu {
    position: relative;
    display: flex;
    width: min(280px, calc(100vw - 48px));
    padding: 10px;
    flex-direction: column;
    background: #0875d5;
    border-radius: 20px;
    box-shadow: 0 12px 34px rgba(21, 67, 98, 0.34);
}

.viewport-menu[hidden] {
    display: none;
}

.viewport-menu-item {
    display: flex;
    min-height: 64px;
    align-items: center;
    gap: 15px;
    padding: 8px 13px;
    color: #fff;
    background: transparent;
    border: 0;
    border-radius: 12px;
    cursor: pointer;
    text-align: left;
    text-decoration: none;
    font-size: 20px;
    font-weight: 800;
}

.viewport-menu-item:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.16);
}

.viewport-menu-item:active:not(:disabled) {
    transform: translateY(1px);
}

.viewport-menu-item:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.viewport-menu-item img {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    object-fit: contain;
}

.debug-sound-control {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.debug-sound-control .field-label {
    margin-bottom: 4px;
}

.debug-sound-control output {
    color: var(--muted);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
}

.debug-sound-volume {
    width: 100%;
    margin: 0;
    accent-color: var(--blue);
    cursor: pointer;
}

.debug-sound-volume:focus-visible {
    outline: 3px solid rgba(27, 125, 212, 0.22);
    outline-offset: 3px;
}

.viewport-menu-item.viewport-menu-debug {
    position: absolute;
    right: 12px;
    bottom: 8px;
    width: 28px;
    height: 28px;
    min-height: 28px;
    justify-content: center;
    gap: 0;
    padding: 4px;
    border-radius: 50%;
    opacity: 0.55;
}

.viewport-menu-item.viewport-menu-debug:hover:not(:disabled),
.viewport-menu-item.viewport-menu-debug[aria-expanded="true"] {
    opacity: 1;
}

.viewport-menu-item.viewport-menu-debug img {
    width: 20px;
    height: 20px;
    flex-basis: 20px;
}

.viewport-menu-item > span:only-child {
    padding-left: 57px;
}

.spinner {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(27, 125, 212, 0.18);
    border-top-color: var(--blue);
    border-radius: 50%;
    animation: spin 700ms linear infinite;
}

.loading-overlay.is-error .spinner {
    display: none;
}

.loading-overlay .spinner.is-complete {
    visibility: hidden;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes loading-build-pop {
    0% { transform: scale(1); }
    58% { transform: scale(1.075); }
    100% { transform: scale(1.025); }
}

.undo-confirmation {
    position: absolute;
    top: calc(18px + var(--safe-area-top));
    left: 50%;
    z-index: 6;
    max-width: calc(100% - 32px);
    padding: 9px 17px;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(191, 207, 215, 0.95);
    border-radius: 999px;
    box-shadow: 0 5px 18px rgba(21, 67, 98, 0.23);
    font-size: 13px;
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: 0.025em;
    text-align: center;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, calc(-100% - 36px));
}

.workspace.is-part-bin-open .undo-confirmation {
    left: calc(50% - (var(--part-bin-width) / 2));
}

.undo-confirmation.is-visible {
    animation: undo-confirmation-pop 1800ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes undo-confirmation-pop {
    0% {
        opacity: 0;
        transform: translate(-50%, calc(-100% - 36px));
    }

    14%,
    78% {
        opacity: 1;
        transform: translate(-50%, 0);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, calc(-100% - 36px));
    }
}

.editor-tip {
    position: absolute;
    left: 50%;
    bottom: calc(32px + var(--safe-area-bottom));
    z-index: 3;
    width: max-content;
    max-width: min(420px, calc(100% - 176px));
    padding: 6px 12px;
    margin: 0;
    color: rgba(255, 255, 255, 0.9);
    background: rgba(27, 125, 212, 0.502);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.35;
    text-align: center;
    pointer-events: none;
    opacity: 0.82;
    transform: translateX(-50%);
    user-select: none;
    -webkit-user-select: none;
}

.workspace.is-part-bin-open .editor-tip {
    left: calc(50% - (var(--part-bin-width) / 2));
    max-width: min(420px, calc(100% - var(--part-bin-width) - 176px));
}

.editor-tip.is-refreshing {
    animation: editor-tip-reveal 320ms ease-out;
}

@keyframes editor-tip-reveal {
    from {
        opacity: 0;
        transform: translate(-50%, 3px);
    }

    to {
        opacity: 0.82;
        transform: translate(-50%, 0);
    }
}

.voxel-tool-control {
    position: absolute;
    left: calc(24px + var(--safe-area-left));
    bottom: calc(24px + var(--safe-area-bottom));
    z-index: 3;
}

.voxel-tool-toggle {
    display: grid;
    width: 54px;
    height: 54px;
    padding: 5px;
    place-items: center;
    background: #0165D4;
    border: 0;
    border-radius: 50%;
    box-shadow: 0 5px 18px rgba(21, 67, 98, 0.40);
    /* outline: 3px solid #1B7DD4; */
    /* outline-offset: -2px; */
    cursor: pointer;
}

.voxel-tool-toggle:hover,
.voxel-tool-toggle[aria-expanded="true"] {
    background: #4B97EB;
}

.voxel-tool-toggle:focus-visible,
.voxel-tool-option:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.94);
    outline-offset: 3px;
}

.voxel-tool-toggle img {
    display: block;
    width: 44px;
    height: 44px;
    object-fit: contain;
}

.voxel-tool-toggle[hidden],
.voxel-tool-palette[hidden] {
    display: none;
}

.voxel-tool-palette {
    display: flex;
    flex-direction: row;
    width: max-content;
    align-items: center;
    gap: 5px;
    padding: 5px;
    background: #0165D4;
    border: 0;
    /* outline: 3px solid #1B7DD4; */
    /* outline-offset: -2px; */
    border-radius: 999px;
    box-shadow: 0 5px 18px rgba(21, 67, 98, 0.40);
}

.voxel-tool-option {
    display: grid;
    width: 52px;
    height: 52px;
    padding: 3px;
    flex: 0 0 auto;
    place-items: center;
    background: transparent;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
}

.voxel-tool-option:hover,
.voxel-tool-option.is-active {
    background: rgba(255, 255, 255, 0.18);
}

.voxel-tool-option img {
    display: block;
    width: 46px;
    height: 46px;
    object-fit: contain;
}

.curve-direction-menu {
    --curve-button-size: clamp(36px, 10vh, 52px);
    position: absolute;
    top: 0;
    left: 0;
    z-index: 5;
    transform: translate3d(-50%, -100%, 0);
    transform-origin: 50% calc(100% + 12px);
    touch-action: manipulation;
}

.curve-direction-panel {
    width: max-content;
    padding: 10px;
    overflow: hidden;
    background: #4b97eb;
    border-radius: 36px;
    box-shadow: 0 5px 18px rgba(21, 67, 98, 0.22);
}

.curve-direction-menu::after {
    position: absolute;
    bottom: -12px;
    left: calc(50% + var(--curve-pointer-offset, 0px));
    width: 24px;
    height: 14px;
    background: #4b97eb;
    clip-path: polygon(0 0, 100% 0, 50% 100%);
    content: "";
    transform: translateX(-50%);
    pointer-events: none;
}

.curve-direction-choices {
    display: grid;
    grid-template-columns: repeat(2, var(--curve-button-size));
    gap: 12px;
}

.curve-direction-option {
    display: grid;
    width: var(--curve-button-size);
    height: var(--curve-button-size);
    padding: 8px;
    place-items: center;
    background: #fff;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
}

.curve-direction-option img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}

#curve-direction-toggle {
    position: relative;
}

.curve-direction-add {
    position: absolute;
    right: 2%;
    bottom: 2%;
    width: 28%;
    height: 28%;
    background: var(--ink);
    border-radius: 50%;
    pointer-events: none;
}

.curve-direction-add::after {
    position: absolute;
    inset: -25%;
    background: #fff;
    mask: url("img/Add.png") center / contain no-repeat;
    content: "";
}

.curve-direction-option:hover {
    background: #eaf4ff;
}

.curve-direction-option[aria-pressed="true"] {
    outline: 2px solid #fff;
    outline-offset: 3px;
}

.curve-direction-option:focus-visible {
    box-shadow: inset 0 0 0 3px #0165d4;
}

.curve-direction-menu[hidden],
.curve-direction-choices[hidden],
.curve-direction-option[hidden] {
    display: none;
}

.part-actions {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 5;
    width: 219px;
    height: 89px;
    pointer-events: none;
    transform: translate3d(-50%, -100%, 0);
    will-change: top, left;
}

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

.part-actions-menu {
    position: relative;
    width: 100%;
    height: 100%;
    opacity: 1;
    transform: scale(1);
    transform-origin: 50% 100%;
    transition:
        transform 240ms cubic-bezier(0.22, 1.4, 0.36, 1),
        opacity 130ms ease;
    will-change: transform, opacity;
}

.part-actions.is-dragging .part-actions-menu {
    opacity: 0;
    transform: scale(0.08);
    transition:
        transform 130ms cubic-bezier(0.4, 0, 1, 1),
        opacity 100ms ease;
}

.part-actions.is-offscreen .part-actions-menu {
    visibility: hidden;
    opacity: 0;
}

.is-menu-closing,
.is-menu-closing * {
    pointer-events: none !important;
}

.part-actions-back {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 7px 10px rgba(21, 67, 98, 0.2));
    object-fit: contain;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}

.part-action {
    position: absolute;
    z-index: 1;
    display: grid;
    width: 48px;
    height: 48px;
    padding: 5px;
    place-items: center;
    background: rgba(255, 255, 255, 0.97);
    border: 0;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(21, 67, 98, 0.22);
    cursor: pointer;
    pointer-events: auto;
    transition: background-color 120ms ease, transform 120ms ease;
}

.part-action-tumble {
    top: 35px;
    left: 6px;
}

.part-action-rotate-y {
    top: 9px;
    left: 58px;
}

.part-action-pose,
.part-action-flip {
    top: 9px;
    left: 113px;
}

.part-action-delete {
    top: 35px;
    left: 165px;
}

.part-action:hover:not(:disabled) {
    background: #fff;
    transform: translateY(-1px);
}

.part-action:active:not(:disabled) {
    transform: translateY(1px);
}

.part-action:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.94);
    outline-offset: 3px;
}

.part-action:disabled {
    cursor: not-allowed;
    opacity: 0.48;
}

.part-action[hidden] {
    display: none;
}

/* While choosing a pose, the part menu gives way to cancel and keep. */
.part-actions.is-choosing-pose .part-actions-menu {
    display: none;
}

/* The checkmark takes the Pose button's exact spot; the X sits beside it in the
   Rotate button's spot. Both match the part-menu buttons' size. */
.pose-carousel-actions {
    --pose-action-gap: 7px;
    --pose-action-padding: 8px;
    position: absolute;
    top: calc(9px - var(--pose-action-padding));
    left: calc(113px - var(--pose-action-gap) - 48px - var(--pose-action-padding));
    display: flex;
    gap: var(--pose-action-gap);
    padding: var(--pose-action-padding);
    background: #4b97eb;
    border-radius: 999px;
    filter: drop-shadow(0 7px 10px rgba(21, 67, 98, 0.2));
    transform-origin: 50% 100%;
    pointer-events: auto;
}

.pose-carousel-actions[hidden] {
    display: none;
}

.pose-carousel-action {
    display: grid;
    width: 48px;
    height: 48px;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(21, 67, 98, 0.22);
    cursor: pointer;
    transition: background-color 120ms ease, transform 120ms ease;
}

.pose-carousel-action img {
    display: block;
    width: 48px;
    height: 48px;
    object-fit: contain;
    pointer-events: none;
}

.pose-carousel-cancel {
    background: #1b7dd4;
}

.pose-carousel-cancel:hover {
    background: #006bc8;
    transform: translateY(-1px);
}

.pose-carousel-keep {
    background: #fff;
}

.pose-carousel-keep:hover {
    background: #e5f2fc;
    transform: translateY(-1px);
}

.pose-carousel-action:active {
    transform: translateY(1px);
}

.pose-carousel-action:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.94);
    outline-offset: 3px;
}

/* While choosing a pose, only the carousel and its cancel and keep buttons take input. */
.pose-carousel-surface {
    position: absolute;
    inset: 0;
    z-index: 4;
    touch-action: none;
    -webkit-touch-callout: none;
    user-select: none;
    cursor: grab;
}

.pose-carousel-surface:active {
    cursor: grabbing;
}

.pose-carousel-surface[hidden] {
    display: none;
}

body.is-pose-carousel-open * {
    pointer-events: none !important;
}

.editor-tip,
.voxel-tool-control,
.color-palette-control,
.viewport-undo {
    transition: opacity 160ms ease, visibility 160ms;
}

body.is-pose-carousel-open :is(.editor-tip, .voxel-tool-control, .color-palette-control, .viewport-undo) {
    visibility: hidden;
    opacity: 0;
}

body.is-pose-carousel-open .pose-carousel-surface,
body.is-pose-carousel-open .pose-carousel-action {
    pointer-events: auto !important;
}

.part-action img {
    display: block;
    width: 38px;
    height: 38px;
    object-fit: contain;
    pointer-events: none;
}

.color-palette-control {
    position: absolute;
    left: calc(28px + var(--safe-area-left));
    bottom: calc(92px + var(--safe-area-bottom));
    z-index: 3;
}

.color-palette-control:has(.color-palette:not([hidden])) {
    z-index: 7;
}

.viewport-undo {
    position: absolute;
    right: calc(24px + var(--safe-area-right));
    bottom: calc(24px + var(--safe-area-bottom));
    z-index: 3;
    min-width: 102px;
    height: 50px;
    padding: 0 24px;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(191, 207, 215, 0.95);
    border-radius: 999px;
    box-shadow: 0 5px 18px rgba(21, 67, 98, 0.23);
    cursor: pointer;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.025em;
    text-transform: uppercase;
}

.workspace.is-part-bin-open .viewport-undo {
    right: calc(var(--part-bin-width) + 24px);
}

.editor-shell.is-debug-panel-open .viewport-undo {
    right: calc(var(--debug-panel-width) + 24px);
}

.editor-shell.is-debug-panel-open .workspace.is-part-bin-open .viewport-undo {
    right: calc(var(--debug-panel-width) + var(--part-bin-width) + 24px);
}

.viewport-undo:hover:not(:disabled) {
    background: #fff;
    border-color: #fff;
    transform: translateY(-1px);
}

.viewport-undo:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.9);
    outline-offset: 3px;
}

.viewport-undo:disabled {
    color: var(--ink);
    background: #fff;
    cursor: not-allowed;
    opacity: 1;
}

.color-palette-toggle {
    position: relative;
    display: grid;
    width: 50px;
    height: 50px;
    padding: 0;
    place-items: center;
    background: transparent;
    border: 0;
    border-radius: 50%;
    box-shadow: 0 4px 14px rgba(21, 67, 98, 0.2);
    cursor: pointer;
}

.color-palette-toggle:hover,
.color-palette-toggle[aria-expanded="true"] {
    background: transparent;
    transform: translateY(-1px);
}

.color-palette-toggle:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.9);
    outline-offset: 3px;
}

.color-palette-toggle.is-eyedropper-active {
    outline: 3px solid #fff;
    outline-offset: 3px;
}

.color-palette-toggle img {
    display: block;
    width: 50px;
    height: 50px;
    object-fit: contain;
}

.color-palette-indicator {
    position: absolute;
    z-index: 1;
    width: 30px;
    height: 30px;
    background: #42a5f5;
    border: 3px solid #fff;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(38, 50, 56, 0.32);
    pointer-events: none;
}

.color-palette {
    position: absolute;
    left: 0;
    bottom: 62px;
    padding: 8px;
    background: #fff;
    border: 1px solid rgba(191, 207, 215, 0.95);
    border-radius: 12px;
    box-shadow: 0 12px 34px rgba(21, 67, 98, 0.3);
}

.color-palette[hidden] {
    display: none;
}

.paint-materials {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 8px;
}

.paint-material {
    display: grid;
    place-items: center;
    min-height: 46px;
    padding: 5px;
    background: #2e91ef;
    border: 2px solid transparent;
    border-radius: 10px;
    cursor: pointer;
}

.paint-material svg {
    width: 34px;
    height: 34px;
}

.paint-material[data-material-id="emission"] svg {
    filter: drop-shadow(0 0 4px #fff);
}

.paint-material[data-material-id="translucent"] svg {
    opacity: 0.65;
}

.paint-material.is-selected {
    border-color: #124e85;
    box-shadow: inset 0 0 0 2px #fff;
}

.paint-material:hover {
    background: #167cd9;
}

.paint-material:focus-visible {
    outline: 2px solid #124e85;
    outline-offset: 2px;
}

.color-palette-indicator[data-material-id="emission"] {
    box-shadow: 0 0 9px 3px #fff;
}

.color-palette-indicator[data-material-id="translucent"] {
    opacity: 0.6;
}

.color-eyedropper {
    display: flex;
    width: 100%;
    min-height: 36px;
    margin: 0 0 8px;
    padding: 5px 9px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    color: var(--ink);
    background: #eef7fc;
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
}

.color-eyedropper:hover,
.color-eyedropper:focus-visible {
    color: #0f5e9f;
    background: #dff1fb;
}

.color-eyedropper:focus-visible {
    outline: 2px solid #176fbe;
    outline-offset: 2px;
}

.color-eyedropper img {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    object-fit: contain;
}

.color-palette-swatches {
    display: grid;
    grid-template-columns: repeat(8, 28px);
    grid-auto-rows: 28px;
    overflow: hidden;
    border: 1px solid rgba(38, 50, 56, 0.14);
    border-radius: 7px;
}

.color-palette-swatch {
    position: relative;
    width: 28px;
    height: 28px;
    padding: 0;
    background: var(--swatch-color);
    border: 0;
    cursor: pointer;
}

.color-palette-swatch:hover,
.color-palette-swatch:focus-visible {
    z-index: 1;
    outline: 3px solid #fff;
    outline-offset: -3px;
    box-shadow: inset 0 0 0 4px rgba(38, 50, 56, 0.46);
}

.color-palette-swatch.is-selected::after {
    position: absolute;
    inset: 5px;
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(38, 50, 56, 0.7);
    content: "";
}

.scan-parts-overlay {
    position: fixed;
    inset: 0;
    z-index: 20;
    overflow: hidden;
}

.scan-parts-scrim {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    opacity: 0;
    transition: opacity 240ms ease;
}

.scan-parts-overlay.is-open .scan-parts-scrim {
    opacity: 1;
}

.scan-parts-stage {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 10px;
    padding:
        calc(74px + var(--safe-area-top))
        calc(16px + var(--safe-area-right))
        calc(38px + var(--safe-area-bottom))
        calc(16px + var(--safe-area-left));
    pointer-events: none;
}

.scan-parts-stack {
    position: relative;
    width: min(82vw, 458px);
    width: min(82vw, calc(72.028dvh - 126.77px), 458px);
    aspect-ratio: 618 / 858;
}

.scan-parts-overlay .camera-frame-card {
    width: 100%;
}

.scan-parts-camera-card {
    position: absolute;
    inset: 0;
    will-change: transform, opacity;
}

.scan-parts-camera-card {
    z-index: 1;
    pointer-events: auto;
    transform: translateY(calc(-50dvh - 50% - 32px));
    transition: transform 600ms cubic-bezier(0.22, 0.78, 0.24, 1), opacity 240ms ease;
}

.scan-parts-overlay.is-open .scan-parts-camera-card {
    transform: translateY(0);
}

.scan-parts-overlay.is-completing .scan-parts-camera-card {
    opacity: 0;
    transform: translate3d(0, calc(100dvh + 100%), 0) rotate(-7deg);
    transition: transform 400ms cubic-bezier(0.4, 0, 1, 1), opacity 260ms ease;
}

.scan-parts-overlay.is-closing .scan-parts-camera-card {
    opacity: 0;
    transform: translateY(calc(-50dvh - 50% - 32px));
    pointer-events: none;
}

.scan-parts-status {
    width: min(82vw, 458px);
    min-height: 22px;
    margin: 0;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    text-align: center;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 180ms ease 380ms, transform 180ms ease 380ms;
}

.scan-parts-overlay.is-open .scan-parts-status {
    opacity: 1;
    transform: translateY(0);
}

.scan-parts-cancel {
    padding: 10px 24px;
    color: #fff;
    background: transparent;
    border: 2px solid #fff;
    border-radius: 999px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-6px);
    transition:
        opacity 180ms ease 420ms,
        transform 180ms ease 420ms,
        background-color 150ms ease;
}

.scan-parts-cancel:hover {
    background: rgba(255, 255, 255, 0.12);
}

.scan-parts-cancel:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.5);
    outline-offset: 3px;
}

.scan-parts-overlay.is-open .scan-parts-cancel {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.scan-parts-overlay.is-completing .scan-parts-cancel {
    opacity: 0;
    pointer-events: none;
}

@media (max-width: 480px) {
    .scan-parts-stage {
        padding:
            calc(64px + var(--safe-area-top))
            calc(12px + var(--safe-area-right))
            calc(28px + var(--safe-area-bottom))
            calc(12px + var(--safe-area-left));
    }

    .scan-parts-stack {
        width: min(88vw, 458px);
        width: min(88vw, calc(72.028dvh - 121.01px), 458px);
    }

}

@media (prefers-reduced-motion: reduce) {
    .part-bin,
    .part-bin-panel,
    .part-bin-toggle,
    .part-bin-toggle img,
    .part-bin-option,
    .part-bin-option.is-sticker img,
    .part-bin-option-prompt,
    .part-bin-sticker-flip,
    .part-actions-menu,
    .part-action,
    .curve-direction-menu,
    .curve-direction-option,
    .scan-parts-scrim,
    .scan-parts-camera-card,
    .scan-parts-status,
    .scan-parts-cancel {
        transition-duration: 0.01ms !important;
        transition-delay: 0ms !important;
    }

    .editor-tip.is-refreshing {
        animation: none;
    }

    .undo-confirmation.is-visible {
        animation-name: undo-confirmation-fade;
    }

    .part-bin-option-shell.is-revealing,
    .part-bin.is-peeking .part-bin-toggle {
        animation: none;
    }
}

@keyframes undo-confirmation-fade {
    0%,
    100% {
        opacity: 0;
        transform: translate(-50%, 0);
    }

    1%,
    78% {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

@media (min-width: 841px) and (min-height: 501px) {
    .workspace {
        --tool-palette-center: 50%;
    }

    .workspace.is-part-bin-open {
        --tool-palette-center: calc(50% - (var(--part-bin-width) / 2));
    }

    .voxel-tool-control {
        left: var(--tool-palette-center);
        transform: translateX(-50%);
    }

    .color-palette-control {
        bottom: calc(28px + var(--safe-area-bottom));
    }

    .editor-tip {
        bottom: calc(96px + var(--safe-area-bottom));
    }
}

@media (max-width: 840px) {
    .editor-shell {
        --debug-panel-width: 270px;
    }

    .sidebar-scroll {
        padding: 10px calc(10px + var(--safe-area-right)) 10px 10px;
    }

    .panel {
        padding: 12px;
    }

    .editor-tip {
        display: none;
    }

}

@media (max-width: 620px) {
    .editor-shell {
        --debug-panel-width: min(224px, calc(100vw - 151px));
    }

    .button kbd {
        display: none;
    }

    .voxel-tool-control {
        left: calc(16px + var(--safe-area-left));
        bottom: calc(16px + var(--safe-area-bottom));
    }

    .editor-shell.is-debug-panel-open .voxel-tool-control {
        bottom: calc(82px + var(--safe-area-bottom));
    }

    .viewport-menu-control {
        top: calc(16px + var(--safe-area-top));
        right: calc(16px + var(--safe-area-right));
    }

    .workspace.is-part-bin-open .viewport-menu-control {
        right: calc(var(--part-bin-width) + 16px);
    }

    .editor-shell.is-debug-panel-open .viewport-menu-control {
        right: calc(var(--debug-panel-width) + 16px);
    }

    .editor-shell.is-debug-panel-open .workspace.is-part-bin-open .viewport-menu-control {
        right: calc(var(--debug-panel-width) + var(--part-bin-width) + 16px);
    }

    .viewport-close {
        top: calc(16px + var(--safe-area-top));
        left: calc(16px + var(--safe-area-left));
    }

    .demo-card-callout {
        top: calc(24px + var(--safe-area-top));
    }

    .workspace {
        --part-bin-width: 172px;
    }

    .part-bin {
        --part-bin-arrow-palette-out-base: -13px;
        --part-bin-arrow-palette-in-base: -26px;
    }

    .part-bin-panel {
        padding:
            calc(24px + var(--safe-area-top))
            calc(14px + var(--safe-area-right))
            calc(14px + var(--safe-area-bottom))
            22px;
    }

    .part-bin-panel h2 {
        margin-bottom: 12px;
        font-size: 16px;
    }

    .part-bin-toggle {
        width: 56px;
        height: 56px;
        padding: 13px;
    }

    .part-bin-toggle img {
        width: 28px;
        height: 28px;
    }

    .part-bin-add-more {
        min-height: 46px;
        gap: 3px;
        padding-inline: 6px;
        margin-bottom: 12px;
        font-size: 12px;
    }

    .part-bin-add-more img {
        width: 26px;
        height: 26px;
        flex-basis: 26px;
    }

    .part-bin-list {
        --part-bin-gap: 9px;
    }

    .part-bin-option {
        border-width: 3px;
        border-radius: 13px;
    }

    .part-bin-sticker-flip {
        top: 4px;
        right: 4px;
        width: 40px;
        height: 40px;
        padding: 3px;
    }

    .part-bin-option-prompt {
        right: 6px;
        bottom: 6px;
        left: 6px;
        padding: 6px;
        font-size: 11px;
    }

    .viewport-menu {
        width: min(250px, calc(100vw - 32px));
    }

    .viewport-menu-item {
        min-height: 56px;
        font-size: 17px;
    }

    .viewport-menu-item img {
        width: 36px;
        height: 36px;
        flex-basis: 36px;
    }

    .voxel-tool-palette {
        gap: 1px;
        padding: 5px;
    }

    .voxel-tool-option {
        width: 44px;
        height: 44px;
    }

    .voxel-tool-option img {
        width: 36px;
        height: 36px;
    }

    .color-palette-control {
        left: calc(20px + var(--safe-area-left));
        bottom: calc(84px + var(--safe-area-bottom));
    }

    .editor-shell.is-debug-panel-open .color-palette-control {
        bottom: calc(150px + var(--safe-area-bottom));
    }

    .viewport-undo {
        right: calc(16px + var(--safe-area-right));
        bottom: calc(16px + var(--safe-area-bottom));
        min-width: 82px;
        padding-inline: 18px;
    }

    .workspace.is-part-bin-open .viewport-undo {
        right: calc(var(--part-bin-width) + 16px);
    }

    .editor-shell.is-debug-panel-open .viewport-undo {
        right: calc(var(--debug-panel-width) + 16px);
    }

    .editor-shell.is-debug-panel-open .workspace.is-part-bin-open .viewport-undo {
        right: calc(var(--debug-panel-width) + var(--part-bin-width) + 16px);
    }

    .color-palette-swatches {
        grid-template-columns: repeat(8, 24px);
        grid-auto-rows: 24px;
    }

    .color-palette-swatch {
        width: 24px;
        height: 24px;
    }

    .sidebar :is(input, select, textarea) {
        font-size: 16px;
    }
}

@media (orientation: landscape) and (max-height: 500px),
       (orientation: landscape) and (max-width: 900px) {
    .editor-tip {
        display: none;
    }
}
