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

:root {
    /* ── Blueberry palette ── */
    --palette-blueberry-100: #F0EEFF;
    --palette-blueberry-200: #DBD7FF;
    --palette-blueberry-300: #B3A8F7;
    --palette-blueberry-500: #2E2B74;
    --palette-blueberry-800: #1E193E;
    --palette-blueberry-900: #15122B;

    /* ── Global palette ── */
    --palette-base-100: #FBFBFD;
    --palette-base-800: #2A2A30;
    --palette-green-500: #00800C;
    --palette-yellow-500: #FFB300;
    --palette-red-500: #D32F2F;

    /* ── Semantic — Blueberry theme ── */
    --color-primary: var(--palette-blueberry-500);
    --color-primary-darker: var(--palette-blueberry-800);
    --color-primary-lighter: var(--palette-blueberry-300);
    --color-background-darkest: var(--palette-blueberry-900);
    --color-surface: var(--palette-blueberry-100);
    --color-background: var(--palette-blueberry-200);

    /* ── Semantic — Global ── */
    --color-text: var(--palette-base-800);
    --color-surface-alt: var(--palette-base-800);
    --color-success: var(--palette-green-500);
    --color-warning: var(--palette-yellow-500);
    --color-error: var(--palette-red-500);

    /* ── Export accent (orange) ── */
    --color-export: #EA580C;
    --color-export-hover: #C44A08;

    /* ── Surface ── */
    --color-surface-raised: #ffffff;
    /* panel/card surfaces above background */
    --color-on-surface: var(--palette-blueberry-900);
    --color-label: #666;
    /* muted section labels */
    --color-hint: #aaa;
    /* hints and estimates */

    /* ── App aliases (used throughout existing CSS) ── */
    --primary-color: var(--color-primary);
    --text-color: var(--color-text);
    --bg-color: var(--color-surface);
    --card-bg: var(--palette-base-100);
    --border-color: #d8d5ee;

    /* ── Type scale ── */
    --text-xs: 0.625rem;
    /* 10px — micro labels: ticks, card names */
    --text-sm: 0.6875rem;
    /* 11px — small UI: section headers, meta, hints */
    --text-md: 0.8125rem;
    /* 13px — interface: buttons, radio, controls */
    --dropdown-chevron-size: 20px;
    --radius-card: 16px;
    --radius-control: 14px;
    --radius-control-sm: 10px;
    --control-height: 40px;
    --shadow-soft: 0 10px 24px rgba(21, 18, 43, 0.12);
    --shadow-card: 0 12px 28px rgba(30, 25, 62, 0.16);
}

/* ── Dark theme overrides ─────────────────────────────────────────────────── */

html.theme-dark {
    --palette-base-100: var(--palette-blueberry-800);
    --bg-color: var(--palette-blueberry-900);
    --card-bg: var(--palette-blueberry-800);
    --color-surface: var(--palette-blueberry-800);
    --color-surface-raised: var(--palette-blueberry-800);
    --color-background: var(--palette-blueberry-900);
    --color-background-darkest: var(--palette-blueberry-900);
    --text-color: var(--palette-blueberry-100);
    --color-text: var(--palette-blueberry-100);
    --color-on-surface: var(--palette-blueberry-100);
    --color-label: var(--palette-blueberry-300);
    --color-hint: var(--palette-blueberry-300);
    --border-color: rgba(179, 168, 247, 0.18);
    /* Interactive elements need a lighter primary so they're visible on dark surfaces */
    --color-primary: var(--palette-blueberry-300);
    --primary-color: var(--palette-blueberry-300);
}

/* Filled buttons: dark text on light-primary bg for contrast */
/* (export buttons use --color-export, not --color-primary, so no override needed) */

/* Radio active: border + subtle tint for visibility in both light and dark */
html.theme-dark .radio-option:has(input:checked) {
    background: rgba(255, 255, 255, 0.1);
    color: var(--palette-blueberry-200);
    border-color: var(--palette-blueberry-300);
}

/* Section boxes: subtly differentiated in dark mode */
html.theme-dark .controls-section-box {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    box-shadow: none;
}

/* Orbit hint toast: invert for dark mode */
html.theme-dark .orbit-hint-bar {
    background: var(--palette-blueberry-200);
}

html.theme-dark .orbit-hint {
    color: var(--palette-blueberry-900);
}

html.theme-dark .orbit-hint-dismiss {
    background: rgba(30, 25, 62, 0.15);
    color: var(--palette-blueberry-900);
}

/* Thumb card visible borders in dark mode */
html.theme-dark .color-option,
html.theme-dark .shading-option,
html.theme-dark .rotation-option,
html.theme-dark .dimension-option {
    border-color: rgba(179, 168, 247, 0.4);
}

html.theme-dark .loop-toggle-track {
    background: rgba(255, 255, 255, 0.2);
}

/* ══════════════════════════════════════════════════════════════════════════════
   DEFAULT (empty) STATE — normal page layout like GCoder
   ══════════════════════════════════════════════════════════════════════════════ */

html,
body {
    margin: 0;
}

body {
    font-family: "Source Sans 3", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    padding: 20px;
}

.container {
    max-width: 900px;
    margin: 0 auto;
}

/* Compact select button shown only in loaded state */
.compact-btn {
    display: none;
}

input[type="file"] {
    display: none;
}

/* Hidden file inputs used for programmatic .click() must not be display:none */
#partReplaceInput {
    display: block;
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
}

/* ── Viewer + controls: hidden in default state ── */

.viewer-section {
    display: none;
}

.controls-bar {
    display: none;
}

/* ── Footer (default) ── */

footer {
    margin-top: 20px;
    text-align: center;
    font-size: 0.8rem;
    color: #aaa;
}

footer p {
    margin: 0;
}

/* ── Shared utilities ── */

.hidden {
    display: none !important;
}

/* ══════════════════════════════════════════════════════════════════════════════
   LOADED STATE — full-viewport flex layout (set via html.loaded class)
   ══════════════════════════════════════════════════════════════════════════════ */

html.loaded,
html.loaded body {
    height: 100%;
    overflow: hidden;
}

html.loaded body {
    padding: 0;
    box-sizing: border-box;
}

html.loaded .container {
    height: 100%;
    padding: 0;
    max-width: none;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

html.loaded .app-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

html.loaded main {
    flex: 0 0 45vh;
    min-height: 200px;
    overflow: hidden;
}

html.loaded .sidebar {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    /* On narrow viewports, prevent sidebar from becoming too cramped */
    min-width: 280px;
}

@media (max-width: 899px) {
    html.loaded .app-body {
        flex-direction: column;
    }

    html.loaded main {
        order: 0;
        flex: 0 0 48vh;
        min-height: 220px;
    }

    html.loaded .sidebar {
        order: 1;
        flex: 1;
        min-height: 150px;
        min-width: auto;
        max-width: none;
    }

    html.loaded .sidebar-header {
        display: none;
    }

    html.loaded .sidebar-brand-row {
        display: none;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        padding: 12px 12px 8px;
        background: var(--color-surface);
    }

    html.loaded .sidebar-brand-actions {
        flex: 1 1 auto;
        min-width: 0;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }

    html.loaded .sidebar-brand-actions .sidebar-upload-btn,
    html.loaded .sidebar-brand-actions .copy-link-btn--export,
    html.loaded .sidebar-brand-actions .info-icon-btn {
        width: 100%;
        min-width: 0;
        justify-content: center;
    }

    /* On mobile/tablet, hide the floating button and show the persistent dock */
    #btnAppSettingsCanvas {
        display: none !important;
    }

    #appSettingsDock {
        display: block !important;
    }

    #appSettingsOverlay[hidden] {
        display: none !important;
    }

    #appSettingsOverlay:not([hidden]) {
        display: block !important;
    }
}

@media (max-width: 640px) {
    html.loaded .app-body {
        flex-direction: column;
    }

    html.loaded main {
        flex: 0 0 40vh;
        min-height: 200px;
    }

    html.loaded .sidebar {
        flex: 1;
        min-height: 150px;
        min-width: auto;
        max-width: none;
    }

    /* Shrink logo on small screens to save space */
    html.loaded .logo {
        height: 24px;
    }

    /* Make export panel narrower on mobile */
    .settings-panel {
        width: calc(100vw - 24px);
        max-width: calc(100vw - 24px);
    }

    /* Reduce padding in export modal body on mobile */
    .export-modal-body {
        padding: 4px;
        row-gap: 8px;
    }

    /* Reduce export modal header padding */
    .export-modal-panel .settings-panel-header {
        padding: 12px 16px 10px;
    }
}

@media (max-width: 899px) and (min-width: 641px) {
    html.loaded main {
        /* Constrain height to give sidebar more breathing room */
        flex: 0 0 auto;
        max-height: 50vh;
    }

    html.loaded .sidebar {
        min-width: 300px;
    }
}

@media (min-width: 900px) {
    html.loaded .app-body {
        flex-direction: row;
    }

    html.loaded main {
        flex: 1;
        min-height: 0;
    }

    html.loaded .sidebar {
        flex: none;
        width: 385px;
        border-left: 1px solid var(--border-color);
        overflow: hidden;
        transition: width 0.2s ease;
    }

    /* On desktop, show the floating settings button and hide the persistent dock */
    #btnAppSettingsCanvas {
        display: inline-flex !important;
    }

    #appSettingsDock {
        display: none !important;
    }

    #appSettingsOverlay:not([hidden]) {
        display: block !important;
    }

    #appSettingsOverlay[hidden] {
        display: none !important;
    }

    html.loaded.sidebar-collapsed .sidebar,
    html.loaded.sidepanels-hidden .sidebar {
        width: 0;
        min-width: 0;
        max-width: 0;
        flex-basis: 0;
        border-left: none;
    }

    /* Collapsed: tab flips to point left (expand) */
    html.loaded.sidebar-collapsed .sidebar-edge-tab svg,
    html.loaded.sidepanels-hidden .sidebar-edge-tab svg {
        transform: rotate(180deg);
    }

    html.loaded .controls-bar {
        border-top: none;
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        /* Allow min-height: 100% on the bar to push info btn to bottom */
        display: flex;
        flex-direction: column;
    }

    .controls-row {
        flex-direction: column;
        flex-wrap: nowrap;
        align-items: stretch;
    }

    .controls-row--motion {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .range-label {
        min-width: 0;
    }
}

/* ── Header (loaded) ── */

html.loaded header {
    display: none;
}

html.loaded .logo {
    height: 32px;
    margin: 0;
}

html.loaded header>p {
    display: none;
}

html.loaded .compact-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0.55em 1em;
    min-height: var(--control-height);
    font-size: var(--text-md);
    font-weight: 600;
    font-family: "Source Sans 3", system-ui, sans-serif;
    line-height: 1.2;
    flex-shrink: 0;
    background: var(--palette-blueberry-500);
    border: none;
    color: #fff;
    border-radius: var(--radius-control);
    box-shadow: var(--shadow-soft);
    transition: background 0.15s, transform 0.1s;
}

html.loaded .compact-btn:hover {
    background: var(--palette-blueberry-800);
}

html.loaded .compact-btn:active {
    transform: scale(0.95);
}

/* ── Main canvas area (loaded) ── */

html.loaded main {
    display: flex;
    flex-direction: column;
    position: relative;
}

html.loaded .app-body,
html.loaded .viewer-section,
html.loaded .controls-bar,
html.loaded .sidebar {
    transition: opacity 220ms ease, transform 220ms ease;
}

html.loaded.startup-shell-ready .app-body,
html.loaded.startup-shell-ready .viewer-section,
html.loaded.startup-shell-ready .controls-bar,
html.loaded.startup-shell-ready .sidebar {
    opacity: 0.88;
    transform: translateY(3px);
}

html.loaded.startup-shell-ready.startup-model-ready .app-body,
html.loaded.startup-shell-ready.startup-model-ready .viewer-section,
html.loaded.startup-shell-ready.startup-model-ready .controls-bar,
html.loaded.startup-shell-ready.startup-model-ready .sidebar {
    opacity: 1;
    transform: none;
}

html.loaded main.drag-over {
    background: rgba(46, 43, 116, 0.04);
}

html.loaded .viewer-section {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

html.loaded .viewer-section.hidden {
    display: none !important;
}

@media (prefers-reduced-motion: reduce) {

    html.loaded .app-body,
    html.loaded .viewer-section,
    html.loaded .controls-bar,
    html.loaded .sidebar {
        transition: none;
    }
}

.canvas-wrap {
    position: relative;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    background: var(--color-background-darkest);
}

html.export-workspace-active .canvas-wrap.is-export-transparent {
    background-color: #f0f0f0;
    background-image:
        linear-gradient(45deg, rgba(0, 0, 0, 0.08) 25%, transparent 25%, transparent 75%, rgba(0, 0, 0, 0.08) 75%),
        linear-gradient(45deg, rgba(0, 0, 0, 0.08) 25%, transparent 25%, transparent 75%, rgba(0, 0, 0, 0.08) 75%);
    background-size: 28px 28px;
    background-position: 0 0, 14px 14px;
}

html.loaded.layout-v2-desktop.export-workspace-active .canvas-wrap.is-export-transparent {
    background-color: #f0f0f0;
    background-image:
        linear-gradient(45deg, rgba(0, 0, 0, 0.08) 25%, transparent 25%, transparent 75%, rgba(0, 0, 0, 0.08) 75%),
        linear-gradient(45deg, rgba(0, 0, 0, 0.08) 25%, transparent 25%, transparent 75%, rgba(0, 0, 0, 0.08) 75%);
    background-size: 28px 28px;
    background-position: 0 0, 14px 14px;
}

.canvas-wrap canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

/* ── Export progress overlay ── */
.export-progress-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: color-mix(in srgb, var(--color-background-darkest, #1a1a2e) 38%, transparent);
    backdrop-filter: blur(8px) saturate(110%);
    -webkit-backdrop-filter: blur(8px) saturate(110%);
    overflow: hidden;
    isolation: isolate;
    z-index: 9999;
}

.export-progress-overlay[hidden] {
    display: none;
}

.export-progress-overlay::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    background-image: var(--export-progress-snapshot, none);
    background-size: cover;
    background-position: center;
    filter: blur(8px) saturate(105%);
    transform: scale(1.02);
    z-index: 0;
}

.export-progress-overlay.has-snapshot::before {
    opacity: 0.7;
}

.export-progress-overlay__dialog {
    position: relative;
    z-index: 1;
    width: min(360px, calc(100% - 28px));
    min-height: 168px;
    border-radius: 20px;
    border: 1px solid color-mix(in srgb, var(--palette-blueberry-300, #b8b6ca) 72%, #fff 28%);
    background: color-mix(in srgb, var(--color-surface, #fff) 92%, #eef0ff 8%);
    box-shadow: 0 26px 48px rgba(18, 20, 56, 0.32);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 20px 18px 18px;
}

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

.export-progress-overlay__spinner {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 3.5px solid rgba(51, 49, 132, 0.16);
    border-top-color: color-mix(in srgb, var(--palette-blueberry-700, #3e3a93) 72%, #fff 28%);
    animation: _export-spin 0.8s linear infinite;
}

.export-progress-overlay__label {
    font-size: 13px;
    font-weight: 600;
    color: color-mix(in srgb, var(--palette-blueberry-900, #1f1a47) 78%, #000 22%);
    letter-spacing: 0.01em;
    text-align: center;
}

.export-progress-overlay__bar-wrap {
    width: min(240px, 90%);
    height: 4px;
    border-radius: 2px;
    background: rgba(62, 58, 147, 0.15);
    overflow: hidden;
}

.export-progress-overlay__bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #4f4aa8 0%, #322f83 100%);
    border-radius: 2px;
    transition: width 0.1s linear;
}

.canvas-wrap.export-progress-freeze #canvas,
.canvas-wrap.export-progress-freeze #exportFrameCanvas {
    opacity: 0;
}

.file-chip {
    display: none;
    align-items: center;
    gap: 4px;
    position: relative;
    min-height: var(--control-height);
    padding: 0 10px 0 14px;
    background: var(--palette-blueberry-200);
    color: var(--palette-blueberry-900);
    border-radius: var(--radius-control);
    border: 1px solid color-mix(in srgb, var(--palette-blueberry-300) 72%, #fff 28%);
    cursor: default;
    flex: 1 1 0;
    min-width: 0;
    overflow: visible;
    font-size: var(--text-md);
    font-weight: 600;
    transition: background 0.15s, color 0.15s;
}

html.loaded .file-chip {
    display: inline-flex;
}

.file-chip-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 1;
    min-width: 0;
}

.file-chip-x {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 1.5em;
    height: 1.5em;
    border: none;
    background: transparent;
    color: inherit;
    cursor: pointer;
    padding: 0;
}

.file-chip-x:hover {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
    border-radius: 50%;
}

.file-chip-expand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 1.5em;
    height: 1.5em;
    border: none;
    background: transparent;
    color: inherit;
    cursor: pointer;
    padding: 0;
}

.file-chip-expand svg {
    transform: rotate(-90deg);
    transition: transform 0.15s ease;
}

.file-chip-expand[aria-expanded="true"] svg {
    transform: rotate(0deg);
}

.file-chip-parts-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 26;
    min-width: min(360px, calc(100vw - 52px));
    max-width: min(420px, calc(100vw - 52px));
    max-height: 48vh;
    overflow: auto;
    background: var(--color-surface-raised);
    border: 1px solid color-mix(in srgb, var(--palette-blueberry-300) 78%, #fff 22%);
    border-radius: var(--radius-control);
    padding: 8px;
    box-shadow: var(--shadow-card);
}

.file-chip-part-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 6px;
    padding: 4px 2px;
}

.file-chip-part-name {
    font-size: var(--text-sm);
    color: var(--color-on-surface);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-chip-part-btn {
    border: 1px solid color-mix(in srgb, var(--palette-blueberry-300) 75%, #fff 25%);
    border-radius: var(--radius-control-sm);
    min-height: 28px;
    padding: 4px 10px;
    background: transparent;
    color: var(--color-on-surface);
    font-size: var(--text-xs);
    font-weight: 600;
    cursor: pointer;
}

.file-chip-part-btn:hover {
    border-color: var(--palette-blueberry-500);
}

.file-chip-part-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.file-chip-part-btn--remove {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.canvas-logo {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 5;
    pointer-events: none;
}

html.loaded .canvas-logo {
    height: clamp(32px, 6vh, 64px);
    width: auto;
    top: 20px;
}

.canvas-logo--icon {
    display: none;
}

/* On narrow viewports swap the wordmark for the square favicon */
@media (max-width: 899px) {
    html.loaded .canvas-logo--wordmark {
        display: none;
    }

    html.loaded .canvas-logo--icon {
        display: block;
        width: 36px;
        height: 36px;
    }
}

.canvas-top-right {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: calc(100% - 80px);
    min-width: 0;
}

.fps-readout {
    position: absolute;
    left: 20px;
    top: 20px;
    bottom: auto;
    z-index: 6;
    min-width: 78px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.32);
    background: rgba(16, 19, 41, 0.72);
    color: #f5f7ff;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-align: center;
    pointer-events: none;
    user-select: none;
    backdrop-filter: blur(4px);
}

html.theme-light .fps-readout {
    border-color: rgba(12, 20, 38, 0.22);
    background: rgba(255, 255, 255, 0.82);
    color: #1c2a45;
}

.canvas-export-btn {
    min-height: var(--control-height);
    border-radius: var(--radius-control);
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: var(--text-md);
    font-weight: 700;
    white-space: nowrap;
}

.canvas-quick-close-btn {
    width: var(--control-height);
    height: var(--control-height);
    border-radius: var(--radius-control);
    background: rgba(21, 18, 43, 0.9);
    color: var(--palette-blueberry-100);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.canvas-quick-close-btn:hover {
    background: rgba(21, 18, 43, 1);
}

@media (max-width: 1199px) {
    html.loaded .file-chip {
        display: none !important;
    }

    html.loaded .canvas-top-right {
        left: 66px;
        right: 14px;
        top: 14px;
        max-width: none;
        gap: 8px;
    }

    html.loaded .canvas-utility-icons {
        display: inline-flex;
    }

    html.loaded .canvas-replace-btn,
    html.loaded .canvas-export-btn {
        flex: 1 1 0;
        min-width: 0;
        padding-left: 12px;
        padding-right: 12px;
        justify-content: center;
    }
}

.canvas-utility-icons {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.canvas-mini-export-card {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 7;
    min-width: 300px;
    max-width: min(360px, calc(100% - 40px));
    border-radius: 20px;
    padding: 14px;
    border: 1px solid color-mix(in srgb, var(--palette-blueberry-300) 72%, #fff 28%);
    background: color-mix(in srgb, var(--color-surface-raised) 94%, #fff 6%);
    box-shadow: 0 10px 28px rgba(20, 18, 43, 0.18);
    display: none;
    flex-direction: column;
    gap: 12px;
}

html.loaded.layout-v2-desktop .canvas-mini-export-card {
    top: 20px;
}

html.loaded .canvas-mini-export-card {
    display: flex;
}

.canvas-mini-export-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.canvas-mini-export-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--color-on-surface);
}

.canvas-mini-export-settings {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid color-mix(in srgb, var(--palette-blueberry-300) 72%, transparent);
    background: color-mix(in srgb, var(--palette-blueberry-100) 90%, white 10%);
    color: var(--color-on-surface);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.canvas-mini-export-settings svg {
    width: 18px;
    height: 18px;
    display: block;
    flex: 0 0 18px;
}

.canvas-mini-export-settings:hover {
    border-color: color-mix(in srgb, var(--palette-blueberry-500) 72%, transparent);
    background: color-mix(in srgb, var(--palette-blueberry-100) 78%, white 22%);
}

.canvas-mini-export-actions {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) minmax(140px, 1fr) 44px;
    gap: 10px;
    align-items: center;
}

.canvas-mini-export-actions .export-select {
    min-height: 44px;
    border-radius: 999px;
    font-weight: 700;
}

.canvas-mini-export-actions .export-btn {
    min-height: 44px;
    border-radius: 999px;
}

.canvas-mini-export-actions .canvas-mini-export-settings {
    width: 44px;
    height: 44px;
}

.canvas-utility-btn {
    position: relative;
    width: 52px;
    height: 52px;
    border-radius: 999px;
    background: #fff;
    color: var(--palette-blueberry-500);
    border: 2px solid rgba(74, 67, 145, 0.14);
    box-shadow: 0 8px 20px rgba(18, 16, 48, 0.16);
    transition: border-color 0.15s, color 0.15s, background 0.15s;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    fill: currentColor;
}

#btnAppSettingsCanvas {
    display: inline-flex;
    position: relative;
    z-index: 1001;
}

.canvas-utility-btn svg {
    fill: currentColor;
    color: inherit;
}

.canvas-utility-btn:hover {
    border-color: color-mix(in srgb, var(--palette-blueberry-300) 80%, white 20%);
    color: var(--palette-blueberry-500);
    background: #fff;
    box-shadow: 0 10px 24px rgba(18, 16, 48, 0.2);
}

.canvas-utility-btn:active {
    transform: scale(0.95);
}

.canvas-utility-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--palette-blueberry-300) 75%, transparent);
}

.build-update-badge {
    position: absolute;
    top: -6px;
    right: -8px;
    min-width: 20px;
    height: 13px;
    padding: 0 4px;
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 999px;
    background: #f2791a;
    color: #fff;
    font-size: 8px;
    font-weight: 800;
    letter-spacing: 0.06em;
    line-height: 11px;
    text-align: center;
    font-family: inherit;
    box-shadow: 0 2px 6px rgba(121, 59, 11, 0.18);
    pointer-events: none;
}

.build-update-badge[hidden] {
    display: none !important;
}

.sidepanel-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sidepanel-toggle-icon {
    width: 18px;
    height: 18px;
    display: block;
}

.sidepanel-toggle-icon--close {
    display: none;
}

.sidepanel-toggle-icon--expand {
    display: block;
}

.sidepanel-toggle-btn.is-hidden .sidepanel-toggle-icon--close {
    display: block;
}

.sidepanel-toggle-btn.is-hidden .sidepanel-toggle-icon--expand {
    display: none;
}

.sidepanel-toggle-btn.is-hidden {
    color: var(--palette-blueberry-500);
    border-color: var(--palette-blueberry-500);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--palette-blueberry-500) 15%, transparent);
}

html.loaded .canvas-replace-btn {
    flex-shrink: 0;
}

.scroll-hint {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    font-size: var(--text-md);
    font-weight: 600;
    pointer-events: none;
    transition: opacity 0.3s;
}

.pause-btn {
    z-index: 1;
    width: 52px;
    height: 52px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 2px solid rgba(74, 67, 145, 0.14);
    background: #fff;
    color: var(--palette-blueberry-500);
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(18, 16, 48, 0.16);
    transition: border-color 0.15s, color 0.15s, opacity 0.15s, background 0.15s;
    font-size: 0;
    font-family: "Source Sans 3", system-ui, sans-serif;
}

.undo-redo-btn {
    z-index: 1;
    width: 52px;
    height: 52px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 2px solid rgba(74, 67, 145, 0.14);
    background: #fff;
    color: var(--palette-blueberry-500);
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(18, 16, 48, 0.16);
    transition: border-color 0.15s, color 0.15s, opacity 0.15s, background 0.15s;
    font-size: 0;
    font-family: "Source Sans 3", system-ui, sans-serif;
}

.undo-redo-btn:hover:not(:disabled) {
    border-color: color-mix(in srgb, var(--palette-blueberry-300) 80%, white 20%);
    color: var(--palette-blueberry-500);
    background: #fff;
    box-shadow: 0 10px 24px rgba(18, 16, 48, 0.2);
}

.undo-redo-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.undo-redo-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.undo-redo-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--palette-blueberry-300) 75%, transparent);
}

#btnFrameOverlay {
    gap: 0;
}

#btnFrameOverlay .frame-overlay-icon--confirm,
#btnFrameOverlay .frame-overlay-label {
    display: none;
}

#btnFrameOverlay.is-crop-confirm {
    width: auto;
    min-width: 2.5rem;
    padding: 0 12px;
    gap: 6px;
    border-radius: 9999px;
    background: var(--color-export);
    color: #fff;
    border-color: color-mix(in srgb, var(--color-export) 70%, #fff);
    font-size: var(--text-sm);
    font-weight: 700;
}

#btnFrameOverlay.is-crop-confirm .frame-overlay-icon--frame {
    display: none;
}

#btnFrameOverlay.is-crop-confirm .frame-overlay-icon--confirm,
#btnFrameOverlay.is-crop-confirm .frame-overlay-label {
    display: inline-flex;
}

#btnFrameOverlay.is-crop-confirm:hover {
    background: var(--color-export-hover);
    color: #fff;
    border-color: color-mix(in srgb, var(--color-export-hover) 70%, #fff);
}

.pause-btn:hover {
    border-color: color-mix(in srgb, var(--palette-blueberry-500) 45%, transparent);
    color: var(--palette-blueberry-500);
    background: #fff;
}

.pause-btn:active {
    transform: scale(0.95);
}

.pause-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--palette-blueberry-300) 75%, transparent);
}

.pause-btn.is-playing {
    background: #fff;
    border-color: var(--palette-blueberry-500);
    color: var(--palette-blueberry-500);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--palette-blueberry-500) 15%, transparent);
}

.pause-btn.is-locked,
.cam-nav-action-btn.is-locked {
    opacity: 0.42;
    cursor: not-allowed;
    pointer-events: none;
    transform: none;
}

.pause-btn.is-locked:hover,
.cam-nav-action-btn.is-locked:hover {
    background: rgba(21, 18, 43, 0.9);
    color: var(--palette-blueberry-200);
}

html.none-mode #btnPause {
    opacity: 0.3;
    pointer-events: none;
}

html.none-mode #btnExportPause {
    opacity: 0.3;
    pointer-events: none;
}

.reset-zoom-btn {
    left: 50px;
}

.rotate-ccw-btn {
    left: 50px;
}

.rotate-x-btn {
    left: 90px;
}

.cam-nav {
    display: grid;
    grid-template-areas:
        ".    up   ."
        "left mid  right"
        ".    down .";
    grid-template-columns: repeat(3, 1.9rem);
    grid-template-rows: repeat(3, 1.9rem);
    gap: 3px;
    z-index: 10;
    pointer-events: auto;
}

.cam-nav-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 16px;
    pointer-events: auto;
    position: static;
    width: min(860px, calc(100vw - 200px));
    max-width: calc(100vw - 24px);
    margin: 0 auto;
}

@media (max-width: 899px) {
    .cam-nav-row {
        grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
        align-items: center;
        width: 100%;
        max-width: calc(100vw - 24px);
        gap: 10px;
    }

    .cam-nav-row #footerCropControls {
        justify-self: start;
        width: auto;
        max-width: min(34vw, 156px);
        margin-right: 6px;
    }

    .cam-nav-center {
        justify-self: center;
        margin-left: 2px;
    }

    .cam-nav-right {
        justify-self: end;
    }
}

.cam-nav-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.cam-nav-right {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
}

.cam-nav-right .pause-btn {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
}

@media (max-width: 899px) {
    .cam-nav-right .pause-btn {
        width: 40px;
        height: 40px;
    }

    .cam-nav-right {
        gap: 6px;
    }
}

html.dpad-hidden .canvas-bottom-center .cam-nav-row {
    display: none !important;
}

html.dpad-hidden .canvas-overlay-br {
    display: flex;
}

.cam-nav-row .ruler-hud {
    margin: 0;
    min-width: 0;
    justify-self: end;
}

.cam-nav-row .cam-nav {
    position: static;
    transform: none !important;
}

.cam-nav-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.cam-nav-action-btn {
    width: 2rem;
    height: 2rem;
    color: var(--palette-blueberry-100);
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(21, 18, 43, 0.9);
    box-shadow: 0 6px 18px rgba(8, 6, 18, 0.24);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 10px;
}

.cam-nav-action-btn--close {
    width: auto;
    min-width: 82px;
    padding: 0 10px;
    gap: 7px;
    height: 2rem;
    border-radius: 9px !important;
    font-size: var(--text-md);
    font-weight: 600;
    font-family: "Source Sans 3", system-ui, sans-serif;
}

.cam-nav-action-btn:hover {
    background: rgba(21, 18, 43, 0.98);
}

.cam-nav-action-btn.is-active,
#btnInspectMode.is-active {
    background: var(--palette-blueberry-200);
    border-color: var(--palette-blueberry-500);
    color: var(--palette-blueberry-500);
}

.cam-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: rgba(21, 18, 43, 0.85);
    color: var(--palette-blueberry-200);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 9px;
    cursor: pointer;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: background 0.15s, color 0.15s, transform 0.1s;
}

.cam-btn:hover {
    background: rgba(21, 18, 43, 0.96);
    color: var(--palette-blueberry-100);
}

.cam-btn:active {
    transform: scale(0.95);
}

.cam-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--palette-blueberry-300);
}

.cam-btn svg {
    display: block !important;
    width: 16px !important;
    height: 16px !important;
    flex-shrink: 0 !important;
    color: inherit;
    fill: currentColor;
}

.cam-btn-up {
    grid-area: up;
}

.cam-btn-left {
    grid-area: left;
}

.cam-btn-center {
    grid-area: mid;
}

.cam-btn-right {
    grid-area: right;
}

.cam-btn-down {
    grid-area: down;
}

/* ── Controls bar reset camera button ── */

.reset-cam-btn {
    margin-left: auto;
    align-self: center;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: var(--text-md);
    font-weight: 600;
    background: transparent;
    border: 1px solid #ccc;
    color: #666;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: border-color 0.15s, color 0.15s;
}

.reset-cam-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* ── Controls bar (loaded) ── */

html.loaded .controls-bar {
    display: flex;
    flex-shrink: 0;
    flex-direction: column;
    position: relative;
    gap: 16px;
    border-top: none;
    padding: 20px;
    background: var(--color-surface);
    transition: background 0.2s, border-color 0.2s;
}

html.loaded .controls-bar.hidden {
    display: none !important;
}

/* ── Section boxes inside controls bar ── */

.controls-section-box {
    background: var(--color-surface-raised);
    border-radius: var(--radius-card);
    padding: 20px 18px 18px;
    box-shadow: var(--shadow-card);
    min-width: 0;
    overflow: hidden;
    flex-shrink: 0;
}

#environmentBox {
    overflow: visible;
}

#modelBox {
    overflow: visible;
}

#buildPlateBox {
    overflow: visible;
}

.thumb-select-wrap {
    display: block;
    position: relative;
}

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

#modelPartSelector,
#bgModelSyncSelector {
    margin: 8px 0 10px;
}

.part-thumbs-head {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-on-surface);
    margin-bottom: 10px;
}

.thumb-select {
    position: relative;
    width: 100%;
}

.thumb-select-btn {
    width: 100%;
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    min-height: 120px;
    padding: 12px 14px;
    border-radius: var(--radius-card);
    border: 1px solid color-mix(in srgb, var(--palette-blueberry-300) 78%, white 22%);
    background: #fff;
    box-shadow: var(--shadow-soft);
    cursor: pointer;
}

.thumb-select-btn.is-multipart-summary {
    grid-template-columns: 88px minmax(0, 1fr) auto;
    min-height: 96px;
}

.thumb-select-btn.is-multipart-summary.is-empty-selection {
    grid-template-columns: minmax(0, 1fr) auto;
}

.thumb-select-btn.is-multipart-summary.is-empty-selection .thumb-select-canvas {
    display: none;
}

.thumb-select-btn:hover {
    border-color: var(--palette-blueberry-500);
}

.thumb-select-btn.is-ruler-hovering {
    border-color: var(--palette-blueberry-600);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--palette-blueberry-300) 52%, transparent), var(--shadow-soft);
}

.thumb-select-btn.is-static {
    grid-template-columns: 96px minmax(0, 1fr);
    cursor: default;
}

.thumb-select-btn.is-static:hover {
    border-color: color-mix(in srgb, var(--palette-blueberry-300) 78%, white 22%);
}

.thumb-select-btn.is-static .thumb-select-chevron {
    display: none;
}

.thumb-select-canvas {
    width: 112px;
    height: 112px;
    border-radius: 14px;
    border: none;
    background: transparent;
    display: block;
}

.thumb-select-btn.is-multipart-summary .thumb-select-canvas {
    width: 88px;
    height: 88px;
}

.thumb-select-text {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-on-surface);
    text-align: left;
    line-height: 1.24;
    overflow-wrap: anywhere;
}

.thumb-select-btn.is-multipart-summary .thumb-select-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 4px;
    min-height: 0;
}

.thumb-select-summary-title {
    width: 100%;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.08;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.thumb-select-summary-meta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    color: color-mix(in srgb, var(--palette-blueberry-700) 78%, var(--color-on-surface) 22%);
    line-height: 1;
}

.part-option-more--summary {
    width: 24px;
    height: 24px;
    border-radius: 6px;
}

.thumb-select-summary-check {
    width: 16px;
    height: 16px;
    border: 1.5px solid color-mix(in srgb, var(--color-on-surface) 50%, transparent);
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    background: transparent;
}

.thumb-select-summary-check::after {
    content: '';
    display: block;
}

.thumb-select-summary-check[data-selection-state="all"] {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.thumb-select-summary-check[data-selection-state="all"]::after {
    width: 7px;
    height: 4px;
    border-left: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(-45deg);
}

.thumb-select-summary-check[data-selection-state="some"] {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.thumb-select-summary-check[data-selection-state="some"]::after {
    width: 7px;
    height: 2px;
    border-radius: 999px;
    background: #fff;
}

.thumb-select-chevron {
    width: 20px;
    height: 20px;
    color: var(--color-on-surface);
    margin-right: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transform: rotate(-90deg);
    transition: transform 0.16s ease;
}

.thumb-select-chevron svg {
    width: 100%;
    height: 100%;
    display: block;
}

.thumb-select-btn[aria-expanded="true"] .thumb-select-chevron {
    transform: rotate(0deg);
}

#modelPartSelectorBtn .thumb-select-chevron,
#modelPartSelectorBtn[aria-expanded="true"] .thumb-select-chevron {
    transform: none;
}

.thumb-select-menu {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 8px);
    z-index: 35;
    max-height: 280px;
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: auto;
    padding: 6px;
    border-radius: var(--radius-control);
    border: 1px solid color-mix(in srgb, var(--palette-blueberry-300) 75%, white 25%);
    background: var(--color-surface-raised);
    box-shadow: 0 28px 44px rgba(16, 14, 36, 0.38), 0 8px 20px rgba(16, 14, 36, 0.22);
}

.thumb-select-menu.thumb-select-menu--above {
    top: auto;
    bottom: calc(100% + 8px);
}

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

.model-bulk-bar {
    margin-bottom: 0;
    padding: 8px;
    border: none;
    border-radius: 10px;
    background: color-mix(in srgb, #fff 78%, var(--palette-blueberry-100) 22%);
    display: block;
}

.model-bulk-bar-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
}

.model-bulk-selection {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 22px;
    flex: 1;
    justify-content: flex-start;
}

.model-bulk-center-actions {
    flex: 0 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

.model-bulk-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    flex: 1;
}

.model-bulk-selection-count {
    font-size: 12px;
    font-weight: 700;
    color: var(--color-on-surface);
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.model-bulk-icon-btn,
.model-bulk-toggle-all {
    width: 34px;
    height: 30px;
    min-width: 34px;
    min-height: 30px;
    padding: 0;
    flex: 0 0 34px;
    border: 1px solid color-mix(in srgb, var(--palette-blueberry-400) 68%, white 32%);
    border-radius: 8px;
    background: #fff;
    color: var(--color-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    cursor: pointer;
}

.model-bulk-toggle-all {
    width: 20px;
    height: 20px;
    min-width: 20px;
    min-height: 20px;
    flex: 0 0 20px;
    border: none;
    border-radius: 0;
    background: transparent;
    padding: 0;
}

.model-bulk-toggle-all .thumb-select-option-check-input {
    width: 20px;
    height: 20px;
    border-radius: 5px;
}

.model-bulk-toggle-all .thumb-select-option-check-input:indeterminate {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.model-bulk-toggle-all .thumb-select-option-check-input:indeterminate::after {
    transform: none;
    width: 8px;
    height: 2px;
    border: none;
    border-radius: 999px;
    background: #fff;
}

.model-bulk-switch {
    border: none;
    background: transparent;
    color: var(--color-on-surface);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.01em;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-left: auto;
    padding: 0;
    cursor: pointer;
    position: relative;
}

.model-bulk-switch-label {
    white-space: nowrap;
}

.model-bulk-switch-track {
    --bulk-switch-track-width: 48px;
    --bulk-switch-track-padding: 3px;
    --bulk-switch-thumb-width: 32px;
    width: var(--bulk-switch-track-width);
    height: 30px;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--color-label) 34%, white 66%);
    background: color-mix(in srgb, var(--color-label) 26%, white 74%);
    display: inline-flex;
    align-items: center;
    padding: var(--bulk-switch-track-padding);
    box-shadow: inset 0 1px 2px rgba(46, 43, 116, 0.08);
    transition: background 140ms ease, border-color 140ms ease;
    position: relative;
    overflow: hidden;
}

.model-bulk-switch-thumb {
    width: var(--bulk-switch-thumb-width);
    height: 24px;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(46, 43, 116, 0.16);
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    transform: translateX(0);
    transition: transform 140ms ease, color 140ms ease, box-shadow 140ms ease;
    color: var(--color-label);
}

.model-bulk-switch-state {
    position: static;
    font-size: 9px;
    font-weight: 900;
    color: currentColor;
    letter-spacing: 0.04em;
    line-height: 1;
    transition: color 140ms ease;
    white-space: nowrap;
    z-index: 3;
    text-transform: uppercase;
}

.model-bulk-switch.is-active .model-bulk-switch-track {
    border-color: var(--color-primary);
    background: var(--color-primary);
}

.model-bulk-switch.is-active .model-bulk-switch-thumb {
    transform: translateX(calc(var(--bulk-switch-track-width) - (var(--bulk-switch-track-padding) * 2) - var(--bulk-switch-thumb-width) - 1px));
    color: var(--color-primary-darker);
}

.model-bulk-switch.is-active .model-bulk-switch-state {
    color: var(--color-primary-darker);
}

.model-bulk-icon-btn svg {
    width: 20px;
    height: 20px;
    display: block;
    flex: 0 0 20px;
}

.model-bulk-icon-btn:hover,
.model-bulk-toggle-all:hover {
    border-color: var(--palette-blueberry-500);
    background: color-mix(in srgb, #fff 70%, var(--palette-blueberry-100) 30%);
}

.model-bulk-toggle-all:hover {
    border-color: transparent;
    background: transparent;
}

.model-bulk-icon-btn.is-active {
    border-color: var(--palette-blueberry-500);
    background: var(--palette-blueberry-200);
    color: var(--palette-blueberry-500);
}

.model-bulk-view {
    display: none;
}

.model-bulk-btn {
    border: 1px solid color-mix(in srgb, var(--palette-blueberry-400) 68%, white 32%);
    border-radius: 8px;
    background: #fff;
    color: var(--color-on-surface);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.01em;
    padding: 6px 8px;
    cursor: pointer;
}

.model-bulk-btn:hover {
    border-color: var(--palette-blueberry-500);
    background: color-mix(in srgb, #fff 70%, var(--palette-blueberry-100) 30%);
}

.model-bulk-btn:disabled {
    opacity: 0.48;
    cursor: not-allowed;
}

#modelPartSelectorMenu {
    max-height: none;
    overflow: visible;
}

#modelPartSelectorMenu.thumb-select-menu--floating-card {
    position: fixed;
    left: 12px;
    top: 120px;
    right: auto;
    bottom: auto;
    width: min(420px, calc(100vw - 24px));
    min-width: 360px;
    max-width: min(420px, calc(100vw - 24px));
    max-height: min(760px, calc(100vh - 24px));
    overflow: hidden;
    background: color-mix(in srgb, var(--color-surface-raised, #fff) 80%, transparent);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    resize: both;
    padding: 0;
    z-index: 140;
    box-shadow: 0 22px 44px rgba(14, 12, 35, 0.28), 0 8px 20px rgba(14, 12, 35, 0.2);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
}

#modelPartSelectorMenu .model-selector-floating-header {
    display: none;
}

#modelPartSelectorMenu.thumb-select-menu--floating-card .model-selector-items {
    overflow: auto;
}

#modelPartSelectorMenu.thumb-select-menu--floating-card .model-selector-floating-header {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    margin: 0;
    padding: 20px 18px 12px;
    border-bottom: 1px solid color-mix(in srgb, var(--palette-blueberry-300) 75%, white 25%);
    background: color-mix(in srgb, var(--color-surface-raised, #fff) 80%, transparent);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    cursor: grab;
    user-select: none;
    border-radius: 16px 16px 0 0;
}

#modelPartSelectorMenu.thumb-select-menu--floating-card .model-selector-floating-header.is-dragging {
    cursor: grabbing;
}

#modelPartSelectorMenu.thumb-select-menu--floating-card .model-selector-floating-header .model-selector-floating-drag-indicator {
    position: absolute;
    top: 4px;
    left: 50%;
    transform: translateX(-50%) rotate(90deg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: color-mix(in srgb, var(--color-on-surface, #2e2b74) 58%, transparent);
    opacity: 0.7;
    pointer-events: none;
}

#modelPartSelectorMenu.thumb-select-menu--floating-card .model-selector-floating-header .model-selector-floating-title {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: var(--color-on-surface, #2e2b74);
}

#modelPartSelectorMenu.thumb-select-menu--floating-card .model-selector-floating-header .model-selector-floating-minimize {
    margin-left: auto;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: 1.5px solid var(--border-color, rgba(0, 0, 0, 0.12));
    background: var(--color-surface-raised, rgba(255, 255, 255, 0.9));
    color: var(--palette-blueberry-800);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    box-shadow: var(--shadow-soft);
    transition: background 0.12s, border-color 0.12s, box-shadow 0.12s, transform 0.1s;
}

#modelPartSelectorMenu.thumb-select-menu--floating-card .model-selector-floating-header .model-selector-floating-minimize:hover {
    border-color: color-mix(in srgb, var(--palette-blueberry-500) 45%, transparent);
    background: color-mix(in srgb, var(--color-primary) 6%, transparent);
    box-shadow: 0 10px 24px rgba(18, 16, 48, 0.2);
}

#modelPartSelectorMenu.thumb-select-menu--floating-card .model-selector-floating-header .model-selector-floating-minimize:active {
    transform: scale(0.95);
}

#modelPartSelectorMenu.thumb-select-menu--floating-card .model-selector-floating-header .model-selector-floating-minimize:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-primary) 36%, transparent);
}

#modelPartSelectorMenu.thumb-select-menu--floating-card.model-selector-view--grid .model-selector-floating-header,
#modelPartSelectorMenu.thumb-select-menu--floating-card.model-selector-view--card .model-selector-floating-header,
#modelPartSelectorMenu.thumb-select-menu--floating-card.model-selector-view--list .model-selector-floating-header {
    grid-column: 1 / -1;
}

#modelPartSelectorMenu .thumb-select-option {
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: flex-start;
}

.thumb-select-option-check {
    width: 20px;
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#modelPartSelectorMenu .thumb-select-option .thumb-select-option-check {
    display: none;
}

#modelPartSelectorMenu.is-multi-select-mode .thumb-select-option .thumb-select-option-check {
    display: flex;
}

.thumb-select-option-check-input {
    width: 20px;
    height: 20px;
    margin: 0;
    -webkit-appearance: none;
    appearance: none;
    border: 1.5px solid color-mix(in srgb, var(--color-on-surface) 52%, transparent);
    border-radius: 4px;
    background: transparent;
    display: grid;
    place-items: center;
    cursor: pointer;
}

.thumb-select-option-check-input::after {
    content: '';
    width: 8px;
    height: 5px;
    border-left: 2.5px solid #fff;
    border-bottom: 2.5px solid #fff;
    transform: rotate(-45deg) scale(0);
    transform-origin: center;
    transition: transform 120ms ease;
}

.thumb-select-option-check-input:checked {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.thumb-select-option-check-input:checked::after {
    transform: rotate(-45deg) scale(1);
}

.thumb-select-option-check-input:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-primary) 44%, transparent);
}

.thumb-select-option {
    width: 100%;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    padding: 6px;
    position: relative;
}

.thumb-select-option-thumb-wrap {
    position: relative;
    display: block;
    width: 72px;
}

.thumb-select-sync-badge {
    display: none !important;
    position: absolute;
    right: 8px;
    bottom: 8px;
    min-height: 20px;
    padding: 0 7px;
    border-radius: 999px;
    background: #e05b6f;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.02em;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.thumb-select-option.is-bg-sync-source .thumb-select-sync-badge {
    display: inline-flex;
}

#modelPartSelectorMenu .thumb-select-sync-badge {
    left: 8px;
    right: auto;
}

.part-visibility-toggle {
    position: absolute;
    right: 8px;
    bottom: 8px;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--palette-blueberry-400) 66%, white 34%);
    background: color-mix(in srgb, #fff 84%, var(--palette-blueberry-100) 16%);
    color: var(--palette-blueberry-700);
    display: grid;
    place-items: center;
    box-shadow: var(--shadow-soft);
    cursor: pointer;
    z-index: 3;
}

.part-visibility-toggle svg {
    width: 14px;
    height: 14px;
    display: block;
    fill: currentColor;
    pointer-events: none;
}

.part-visibility-toggle:hover {
    border-color: color-mix(in srgb, var(--palette-blueberry-600) 72%, white 28%);
    background: color-mix(in srgb, #fff 72%, var(--palette-blueberry-100) 28%);
}

.part-visibility-toggle.is-hidden {
    color: #78550e;
    border-color: color-mix(in srgb, #d4a648 72%, white 28%);
    background: color-mix(in srgb, #fff 78%, #ffe8b8 22%);
}

.thumb-select-option-main {
    width: 100%;
    border: none;
    background: transparent;
    padding: 0;
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    text-align: left;
    cursor: pointer;
}

#modelPartSelectorMenu.model-selector-view--list .thumb-select-option-main {
    grid-template-columns: minmax(0, 1fr);
}

#modelPartSelectorMenu.model-selector-view--list .thumb-select-option-canvas {
    display: none;
}

#modelPartSelectorMenu.model-selector-view--list .thumb-select-option {
    grid-template-columns: auto minmax(0, 1fr) auto;
}

#modelPartSelectorMenu.model-selector-view--card,
#modelPartSelectorMenu.model-selector-view--list,
#modelPartSelectorMenu.model-selector-view--grid {
    display: flex;
    flex-direction: column;
    padding: 0;
    flex: 1;
    min-height: 0;
}

#modelPartSelectorMenu.model-selector-view--card .model-bulk-bar,
#modelPartSelectorMenu.model-selector-view--list .model-bulk-bar,
#modelPartSelectorMenu.model-selector-view--grid .model-bulk-bar,
#modelPartSelectorMenu.model-selector-view--card .thumb-select-menu-add-row,
#modelPartSelectorMenu.model-selector-view--list .thumb-select-menu-add-row,
#modelPartSelectorMenu.model-selector-view--grid .thumb-select-menu-add-row {
    padding: 8px;
    margin: 8px 8px 6px 8px;
    border-bottom: 1px solid color-mix(in srgb, var(--palette-blueberry-300) 75%, white 25%);
    flex-shrink: 0;
}

#modelPartSelectorMenu .model-selector-items {
    display: grid;
    gap: 8px;
    padding: 8px 6px;
    overflow-y: auto;
    flex: 1;
    min-width: 0;
    min-height: 0;
    align-content: start;
    scrollbar-gutter: auto;
}

#modelPartSelectorMenu.model-selector-view--card .model-selector-items,
#modelPartSelectorMenu.model-selector-view--list .model-selector-items {
    grid-template-columns: minmax(0, 1fr);
}

#modelPartSelectorMenu.model-selector-view--grid .model-selector-items {
    grid-template-columns: repeat(auto-fit, minmax(156px, 1fr));
    justify-content: start;
}

#modelPartSelectorMenu.model-selector-view--card .thumb-select-option,
#modelPartSelectorMenu.model-selector-view--grid .thumb-select-option {
    border: 1px solid color-mix(in srgb, var(--palette-blueberry-300) 78%, white 22%);
    background: color-mix(in srgb, #fff 84%, var(--palette-blueberry-100) 16%);
    border-radius: 14px;
    padding: 8px;
}

#modelPartSelectorMenu.model-selector-view--card .thumb-select-option {
    overflow: visible;
    padding-right: 38px;
}

#modelPartSelectorMenu.model-selector-view--card .thumb-select-option-main {
    grid-template-columns: 74px minmax(0, 1fr);
    gap: 8px;
}

#modelPartSelectorMenu.model-selector-view--card .thumb-select-option-check {
    min-height: 74px;
    padding-top: 0;
}

#modelPartSelectorMenu.model-selector-view--card .thumb-select-option-thumb-wrap {
    width: 74px;
}

#modelPartSelectorMenu.model-selector-view--card .thumb-select-option-text {
    font-size: 10px;
    line-height: 1.18;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: calc(2 * 1.18em);
}

#modelPartSelectorMenu.model-selector-view--card .thumb-select-option.is-selected {
    border: 2px solid var(--palette-blueberry-500);
    background: color-mix(in srgb, #fff 62%, var(--palette-blueberry-100) 38%);
    box-shadow: none;
}

#modelPartSelectorMenu.model-selector-view--card .part-option-more,
#modelPartSelectorMenu.model-selector-view--grid .part-option-more {
    position: absolute;
    top: 50%;
    right: 6px;
    bottom: auto;
    transform: translateY(-50%);
    z-index: 5;
}

#modelPartSelectorMenu.model-selector-view--grid .thumb-select-option {
    overflow: visible;
    padding: 9px;
    padding-right: 38px;
}

#modelPartSelectorMenu.model-selector-view--grid .thumb-select-option-main {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 2px 0 0 0;
}

#modelPartSelectorMenu.model-selector-view--grid .thumb-select-option-thumb-wrap {
    width: min(100%, 88px);
    margin: 0 auto;
}

#modelPartSelectorMenu.model-selector-view--grid .thumb-select-option-canvas {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    max-height: 88px;
}

#modelPartSelectorMenu.model-selector-view--grid .thumb-select-option-text {
    font-size: 11px;
    line-height: 1.22;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: calc(2 * 1.22em);
}

#modelPartSelectorMenu.model-selector-view--grid .thumb-select-option-main {
    min-height: 152px;
}

#modelPartSelectorMenu.model-selector-view--grid .thumb-select-option-thumb-wrap {
    width: min(100%, 92px);
}

#modelPartSelectorMenu.model-selector-view--grid .thumb-select-option-canvas {
    max-height: 92px;
}

#modelPartSelectorMenu.model-selector-view--grid .thumb-select-option-check {
    top: 10px;
    left: 10px;
}

#modelPartSelectorMenu.model-selector-view--grid .thumb-select-option-check {
    position: absolute;
    top: 8px;
    left: 8px;
    min-height: 24px;
    width: 24px;
    border-radius: 6px;
    background: transparent;
    z-index: 3;
}

#modelPartSelectorMenu.model-selector-view--grid .thumb-select-option.is-selected {
    border: 2px solid var(--palette-blueberry-500);
    background: color-mix(in srgb, #fff 62%, var(--palette-blueberry-100) 38%);
    box-shadow: none;
}

#modelPartSelectorMenu.model-selector-view--grid .thumb-select-option.is-bg-sync-source .thumb-select-sync-badge {
    left: 10px;
    right: auto;
    bottom: 10px;
}

#modelPartSelectorMenu.model-selector-view--grid .part-visibility-toggle {
    right: 10px;
    bottom: 10px;
    width: 26px;
    height: 26px;
}

.thumb-select-option:hover {
    border-color: color-mix(in srgb, var(--palette-blueberry-300) 85%, white 15%);
    background: color-mix(in srgb, white 30%, var(--palette-blueberry-100) 70%);
}

.thumb-select-option.is-bg-sync-source {
    border: 2px solid var(--palette-blueberry-500);
    background: color-mix(in srgb, #fff 62%, var(--palette-blueberry-100) 38%);
    box-shadow: none;
}

.thumb-select-option.is-dragging {
    opacity: 0.55;
}

.thumb-select-option.is-drop-target {
    border-color: var(--palette-blueberry-500);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--palette-blueberry-300) 55%, transparent 45%);
}

.thumb-select-option.is-selected {
    border-color: white;
    box-shadow: 0 0 0 2px var(--color-primary);
}

.thumb-select-option.is-ruler-hovered {
    border-color: var(--palette-blueberry-600);
    background: color-mix(in srgb, white 46%, var(--palette-blueberry-100) 54%);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--palette-blueberry-400) 68%, transparent 32%);
}

#modelPartSelectorMenu.model-selector-view--grid .thumb-select-option.is-ruler-hovered {
    border-color: var(--palette-blueberry-600);
    background: color-mix(in srgb, #fff 48%, var(--palette-blueberry-100) 52%);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--palette-blueberry-400) 68%, transparent 32%);
}

.thumb-select-option-canvas {
    width: 72px;
    height: 72px;
    border-radius: 12px;
    border: 1px solid color-mix(in srgb, var(--palette-blueberry-300) 85%, white 15%);
    background: transparent;
    display: block;
}

.thumb-select-option-text {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-on-surface);
    text-align: left;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.part-option-more {
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--color-on-surface);
    display: grid;
    place-items: center;
    align-self: center;
    margin-top: 0;
    font-size: 20px;
    line-height: 0;
    cursor: pointer;
}

.part-option-more svg {
    width: 16px;
    height: 16px;
    display: block;
    fill: currentColor;
    pointer-events: none;
}

.part-option-more:hover {
    background: color-mix(in srgb, var(--palette-blueberry-100) 70%, #fff 30%);
}

.model-single-menu-row {
    display: flex;
    justify-content: flex-end;
    position: absolute;
    top: 18px;
    right: 14px;
    z-index: 3;
    pointer-events: none;
}

.model-single-menu-row[hidden] {
    display: none !important;
}

.model-single-menu-btn {
    width: 34px;
    height: 34px;
    margin: 0;
    padding: 0;
    display: grid;
    place-items: center;
    border-radius: 10px;
    border: 1px solid color-mix(in srgb, var(--palette-blueberry-300) 78%, white 22%);
    background: #fff;
    box-shadow: var(--shadow-soft);
    font-size: 18px;
    line-height: 1;
    pointer-events: auto;
}

.model-single-menu-btn:hover {
    border-color: var(--palette-blueberry-500);
}

.model-picker-add-btn {
    position: absolute;
    right: 12px;
    bottom: 20px;
    width: 38px;
    height: 38px;
    border: 1px solid color-mix(in srgb, var(--palette-blueberry-300) 76%, white 24%);
    border-radius: 999px;
    background: #fff;
    color: var(--color-primary);
    box-shadow: var(--shadow-soft);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 4;
}

.model-picker-add-btn:hover {
    border-color: var(--palette-blueberry-500);
    background: color-mix(in srgb, #fff 70%, var(--palette-blueberry-100) 30%);
}

.model-picker-add-btn[hidden] {
    display: none !important;
}

.model-picker-add-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.thumb-select-add-slot {
    width: 100%;
    min-height: 38px;
    border-radius: 10px;
    border: 1px dashed color-mix(in srgb, var(--palette-blueberry-500) 74%, white 26%);
    background: color-mix(in srgb, #fff 72%, var(--palette-blueberry-100) 28%);
    color: var(--color-primary);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.01em;
    cursor: pointer;
}

.thumb-select-add-slot:hover {
    border-color: var(--palette-blueberry-600);
    background: color-mix(in srgb, #fff 64%, var(--palette-blueberry-100) 36%);
}

.thumb-select-add-slot[hidden] {
    display: none !important;
}

.thumb-select-add-slot:disabled {
    cursor: not-allowed;
    opacity: 0.48;
}

.thumb-select-menu-add-row {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid color-mix(in srgb, var(--palette-blueberry-300) 75%, white 25%);
}

.thumb-select-menu-add-row:empty {
    display: none;
}

.thumb-select-add-slot--menu {
    min-height: 34px;
}

.build-plate-shape-group {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.build-plate-color-custom {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 999px;
    padding: 2px;
    background: conic-gradient(#ff0909, #ff9d00, #fff718, #84ff00, #8c00ff, #ff0909);
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.build-plate-color-custom:hover {
    transform: translateY(-1px);
}

.build-plate-color-custom:active {
    transform: scale(0.97);
}

.build-plate-color-custom:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--color-primary);
}

.build-plate-color-custom-core {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 999px;
    border: 1px solid rgba(0, 0, 0, 0.18);
    background: #c2a164;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.44);
}

.build-plate-color-input-hidden {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    pointer-events: none;
    clip: rect(0, 0, 0, 0);
}

.build-plate-shape-btn {
    display: grid;
    gap: 6px;
    justify-items: center;
    align-items: center;
    min-height: 74px;
    padding: 9px 8px;
    border: 1.5px solid color-mix(in srgb, var(--palette-blueberry-300) 78%, white 22%);
    border-radius: 12px;
    background: color-mix(in srgb, #fff 82%, var(--palette-blueberry-100) 18%);
    color: var(--color-label);
    cursor: pointer;
    transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease, color 150ms ease;
}

.build-plate-shape-btn:hover {
    border-color: var(--palette-blueberry-500);
}

.build-plate-shape-btn.is-active {
    border-color: #fff;
    color: var(--color-on-surface);
    background: #fff;
    box-shadow: 0 0 0 2px var(--color-primary), var(--shadow-soft);
}

.build-plate-shape-icon {
    width: 34px;
    height: 34px;
    border: 2px solid currentColor;
    background: color-mix(in srgb, #fff 76%, var(--palette-blueberry-100) 24%);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}

.build-plate-shape-icon--rectangle {
    border-radius: 4px;
}

.build-plate-shape-icon--rounded {
    border-radius: 11px;
}

.build-plate-shape-icon--circle {
    border-radius: 999px;
}

.build-plate-shape-label {
    font-size: var(--text-sm);
    font-weight: 700;
    line-height: 1.1;
}

.part-option-actions {
    position: fixed;
    z-index: 220;
    width: 186px;
    max-width: calc(100vw - 20px);
    background: var(--color-surface-raised);
    border: 1px solid color-mix(in srgb, var(--palette-blueberry-300) 70%, transparent);
    border-radius: 12px;
    box-shadow: var(--shadow-card);
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    pointer-events: auto;
}

.thumb-select-option .part-option-actions {
    position: fixed;
    width: 186px;
    max-width: calc(100vw - 20px);
}

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

.part-option-action {
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--color-on-surface);
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    padding: 8px 10px;
    cursor: pointer;
}

.part-option-action--toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.option-switch {
    width: 30px;
    height: 18px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--palette-blueberry-300) 55%, #fff 45%);
    position: relative;
    flex: 0 0 auto;
    transition: background-color 0.18s ease;
}

.option-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
    transition: transform 0.18s ease;
}

.option-switch.is-on {
    background: color-mix(in srgb, var(--color-primary) 82%, #fff 18%);
}

.option-switch.is-on::after {
    transform: translateX(12px);
}

.part-option-action:hover {
    background: color-mix(in srgb, var(--palette-blueberry-100) 68%, #fff 32%);
}

.part-option-action--danger {
    color: #d41717;
}

html.theme-dark .part-thumbs-head,
html.theme-dark .thumb-select-text,
html.theme-dark .thumb-select-option-text {
    color: var(--palette-blueberry-100);
}

html.theme-dark .thumb-select-summary-meta {
    color: var(--palette-blueberry-200);
}

html.theme-dark .thumb-select-summary-check {
    border-color: rgba(179, 168, 247, 0.68);
}

html.theme-dark .thumb-select-btn,
html.theme-dark .thumb-select-menu {
    background: rgba(30, 25, 62, 0.42);
    border-color: rgba(179, 168, 247, 0.42);
}

html.theme-dark .model-bulk-bar {
    border-color: transparent;
    background: rgba(34, 30, 70, 0.52);
}

html.theme-dark .model-bulk-btn {
    background: rgba(30, 25, 62, 0.26);
    border-color: rgba(179, 168, 247, 0.42);
    color: var(--palette-blueberry-100);
}

html.theme-dark .model-bulk-btn:hover {
    border-color: var(--palette-blueberry-300);
    background: rgba(56, 48, 104, 0.56);
}

html.theme-dark .model-bulk-icon-btn,
html.theme-dark .model-bulk-toggle-all {
    background: rgba(30, 25, 62, 0.26);
    border-color: rgba(179, 168, 247, 0.42);
    color: var(--palette-blueberry-100);
}

html.theme-dark .model-bulk-toggle-all {
    background: transparent;
    border-color: transparent;
}

html.theme-dark .model-bulk-view {
    background: rgba(30, 25, 62, 0.24);
    border-color: rgba(179, 168, 247, 0.38);
}

html.theme-dark .model-bulk-view-btn {
    color: var(--palette-blueberry-100);
}

html.theme-dark .model-bulk-view-btn.is-active {
    background: rgba(84, 72, 156, 0.58);
}

html.theme-dark .thumb-select-btn:hover,
html.theme-dark .thumb-select-option:hover {
    border-color: var(--palette-blueberry-300);
}

html.theme-dark .thumb-select-option.is-selected {
    border-color: white;
    box-shadow: 0 0 0 2px var(--palette-blueberry-300);
}

html.theme-dark .thumb-select-btn.is-ruler-hovering {
    border-color: var(--palette-blueberry-300);
    box-shadow: 0 0 0 2px rgba(179, 168, 247, 0.52), var(--shadow-soft);
}

html.theme-dark .thumb-select-option.is-ruler-hovered {
    border-color: rgba(232, 227, 255, 0.95);
    background: rgba(88, 76, 160, 0.52);
    box-shadow: 0 0 0 2px rgba(179, 168, 247, 0.62);
}

html.theme-dark #modelPartSelectorMenu.model-selector-view--grid .thumb-select-option {
    border-color: rgba(179, 168, 247, 0.4);
    background: rgba(34, 30, 70, 0.52);
}

html.theme-dark #modelPartSelectorMenu.model-selector-view--card .thumb-select-option,
html.theme-dark #modelPartSelectorMenu.model-selector-view--list .thumb-select-option {
    border-color: rgba(179, 168, 247, 0.4);
    background: rgba(34, 30, 70, 0.52);
}

html.theme-dark #modelPartSelectorMenu.model-selector-view--grid .thumb-select-option.is-selected {
    border: 2px solid rgba(232, 227, 255, 0.92);
    background: rgba(74, 64, 140, 0.5);
    box-shadow: none;
}

html.theme-dark #modelPartSelectorMenu.model-selector-view--grid .thumb-select-option.is-ruler-hovered {
    border: 2px solid rgba(232, 227, 255, 0.95);
    background: rgba(92, 82, 170, 0.58);
    box-shadow: none;
}

html.theme-dark .thumb-select-canvas,
html.theme-dark .thumb-select-option-canvas {
    border-color: rgba(179, 168, 247, 0.3);
    background: transparent;
}

html.theme-dark .thumb-select-option.is-bg-sync-source {
    border: 2px solid rgba(232, 227, 255, 0.92);
    background: rgba(74, 64, 140, 0.5);
    box-shadow: none;
}

html.theme-dark #btnInspectMode.is-active,
html.theme-dark .canvas-overlay-br .cam-nav-action-btn.is-active {
    background: rgba(242, 240, 255, 0.95);
    border-color: rgba(179, 168, 247, 0.6);
    color: var(--palette-blueberry-900);
}

html.theme-dark .canvas-overlay-br .cam-nav-action-btn {
    background: rgba(34, 30, 70, 0.88);
    color: var(--palette-blueberry-100);
    border-color: rgba(179, 168, 247, 0.36);
    box-shadow: 0 10px 24px rgba(8, 6, 20, 0.38);
}

html.theme-dark .canvas-overlay-br .cam-nav-action-btn:hover {
    background: rgba(56, 48, 104, 0.96);
    color: #fff;
    border-color: rgba(179, 168, 247, 0.48);
}

html.theme-dark .part-visibility-toggle {
    background: rgba(30, 25, 62, 0.38);
    border-color: rgba(179, 168, 247, 0.46);
    color: var(--palette-blueberry-100);
}

html.theme-dark .part-visibility-toggle:hover {
    border-color: rgba(222, 214, 255, 0.78);
    background: rgba(56, 48, 104, 0.62);
}

html.theme-dark .part-visibility-toggle.is-hidden {
    color: #ffd990;
    border-color: rgba(255, 203, 122, 0.72);
    background: rgba(108, 76, 20, 0.68);
}

html.theme-dark .part-option-actions {
    background: rgba(28, 24, 58, 0.98);
    border-color: rgba(179, 168, 247, 0.42);
    box-shadow: 0 18px 36px rgba(8, 6, 20, 0.42);
}

html.theme-dark .part-option-action {
    color: var(--palette-blueberry-100);
}

html.theme-dark .part-option-action:hover {
    background: rgba(84, 72, 156, 0.38);
}

html.theme-dark .model-single-menu-btn {
    background: rgba(30, 25, 62, 0.22);
    border-color: rgba(179, 168, 247, 0.3);
}

html.theme-dark .model-picker-add-btn {
    background: rgba(30, 25, 62, 0.28);
    border-color: rgba(179, 168, 247, 0.44);
    color: var(--palette-blueberry-100);
}

html.theme-dark .thumb-select-add-slot {
    border-color: rgba(179, 168, 247, 0.42);
    background: rgba(42, 36, 78, 0.35);
    color: var(--palette-blueberry-100);
}

html.theme-dark .build-plate-shape-btn {
    border-color: rgba(179, 168, 247, 0.38);
    background: rgba(46, 42, 90, 0.42);
    color: var(--palette-blueberry-200);
}

html.theme-dark .build-plate-shape-btn.is-active {
    border-color: rgba(179, 168, 247, 0.72);
    background: rgba(242, 240, 255, 0.96);
    color: var(--palette-blueberry-900);
    box-shadow: 0 0 0 2px rgba(179, 168, 247, 0.74);
}

.finish-mode-wrap {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    margin-top: 10px;
    margin-bottom: 0;
    padding: 4px;
    border-radius: var(--radius-control);
    border: none;
    background: color-mix(in srgb, var(--color-surface-raised) 74%, #d7d6e6 26%);
}

.finish-control-group {
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
}

.model-sliders>.finish-control-group {
    margin-top: 10px;
    padding-top: 10px;
}

.finish-control-group #textureTuneRoughnessRow {
    margin-top: 12px;
    padding-top: 0;
    border-top: none;
}

.finish-control-group #textureTuneRoughnessRow input[type="range"] {
    margin: 0;
}

.finish-mode-btn {
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    color: var(--color-label);
    font-size: var(--text-sm);
    font-weight: 600;
    line-height: 1;
    padding: 10px 6px;
    cursor: pointer;
    transition: background 140ms ease, border-color 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

.finish-mode-btn:hover {
    border-color: color-mix(in srgb, var(--palette-blueberry-300) 80%, white 20%);
    color: var(--palette-blueberry-900);
}

.finish-mode-btn.is-active {
    border-color: color-mix(in srgb, var(--border-color) 76%, #fff 24%);
    color: var(--color-on-surface);
    background: #ffffff;
    box-shadow: var(--shadow-soft);
}

html.theme-dark .finish-mode-wrap {
    background: rgba(77, 72, 126, 0.5);
    border: none;
}

html.theme-dark .finish-control-group {
    background: transparent;
    border: none;
}

#opacitySlider {
    --slider-fill: var(--color-primary);
}

html.theme-dark .finish-mode-btn {
    color: var(--palette-blueberry-200);
    background: rgba(46, 42, 90, 0.55);
    border-color: rgba(179, 168, 247, 0.34);
}

html.theme-dark .finish-mode-btn:hover {
    border-color: rgba(179, 168, 247, 0.48);
    color: var(--palette-blueberry-100);
}

html.theme-dark .finish-mode-btn.is-active {
    border-color: rgba(179, 168, 247, 0.6);
    background: rgba(242, 240, 255, 0.95);
    color: var(--palette-blueberry-900);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

html.theme-dark .app-settings-segmented {
    background: rgba(77, 72, 126, 0.5);
}

html.theme-dark .app-settings-segmented-btn {
    color: var(--palette-blueberry-200);
}

html.theme-dark .app-settings-segmented-btn.is-active {
    border-color: rgba(179, 168, 247, 0.6);
    background: rgba(242, 240, 255, 0.95);
    color: var(--palette-blueberry-900);
}

@media (max-width: 560px) {
    .thumb-select-btn {
        grid-template-columns: 76px minmax(0, 1fr) auto;
        gap: 10px;
    }

    .thumb-select-canvas {
        width: 76px;
        height: 76px;
    }

    .thumb-select-text {
        font-size: 13px;
    }

    .thumb-select-summary-title {
        font-size: 12px;
    }

    .thumb-select-summary-meta {
        font-size: 11px;
    }
}

/* ── Footer (loaded) ── */

html.loaded footer {
    display: none;
}

/* ══════════════════════════════════════════════════════════════════════════════
   CONTROLS & EXPORT — shared between states
   ══════════════════════════════════════════════════════════════════════════════ */

.controls-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-start;
}

.controls-row--copy {
    position: absolute;
    top: 20px;
    right: 24px;
    z-index: 2;
    padding: 0;
    border: none;
}

.controls-row--motion {
    align-items: flex-start;
}

.section-divider {
    border: none;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--border-color) 15%, var(--border-color) 85%, transparent);
    flex-shrink: 0;
    margin: 0;
    align-self: stretch;
}

.controls-row--theme {
    display: none;
    /* button is now fixed-position, not in the flow */
}

#themeToggleLabel {
    display: none;
}

@media (min-width: 600px) {
    #themeToggleLabel {
        display: inline;
    }
}

.theme-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 0.75em;
    min-height: 2.5em;
    font-size: var(--text-sm);
    font-weight: 600;
    font-family: "Source Sans 3", system-ui, sans-serif;
    line-height: 1.2;
    color: var(--palette-blueberry-200);
    background: rgba(21, 18, 43, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 9999px;
    cursor: pointer;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: background 0.15s, color 0.15s;
}

.theme-toggle-btn:hover {
    background: rgba(21, 18, 43, 0.96);
    color: var(--palette-blueberry-100);
}

/* ── Canvas top-left overlay group ── */

.canvas-overlay-tl {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── Canvas bottom-left overlay group ── */

.canvas-overlay-bl {
    position: absolute;
    bottom: 16px;
    left: 16px;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── Canvas bottom-right overlay group ── */

.canvas-overlay-br {
    position: absolute;
    bottom: 16px;
    right: 16px;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.pause-btn--active {
    background: var(--palette-blueberry-500) !important;
    color: var(--palette-blueberry-100) !important;
    border-color: var(--palette-blueberry-300) !important;
}

.export-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-start;
    padding-top: 14px;
    margin-top: 2px;
    border-top: 2px solid var(--border-color);
}

.downloads-section {
    flex: 1 1 100%;
    min-width: 0;
}

/* ── Export list (macOS-style action rows) ── */
.export-list {
    display: flex;
    flex-direction: column;
    width: 100%;
    margin-top: 0;
}

.export-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 0;
    border-bottom: 1px solid;
    border-image: linear-gradient(to right, transparent, var(--border-color) 15%, var(--border-color) 85%, transparent) 1;
}

.export-list-item:last-child {
    border-bottom: none;
    border-image: none;
}

.export-list-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.control-label {
    display: flex;
    flex-direction: column;
    font-size: var(--text-md);
    font-weight: 700;
    color: var(--color-label, #666);
    letter-spacing: 0.01em;
    gap: 10px;
    min-width: 0;
}

.range-label {
    flex: 1;
    min-width: 140px;
    gap: 2px;
}

.speed-label {
    flex-basis: 100%;
}

.tilt-range-label {
    display: none;
}

html.tilt-mode .tilt-range-label {
    display: flex;
}

.wobble-spin-range-label {
    display: none;
}

html.wobble-mode .wobble-spin-range-label {
    display: flex;
}

html.spin-ccw .rotation-thumb--spin .rot-icon {
    transform: scaleX(-1);
}

.range-label>span {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--color-label);
}

.range-label>span span {
    font-weight: 600;
    color: var(--color-label);
}

/* ── Slider reset button ── */

.slider-reset-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    padding: 0;
    border: 1.5px solid var(--color-primary);
    border-radius: 50%;
    background: var(--color-surface-raised);
    color: var(--color-primary);
    cursor: pointer;
    flex-shrink: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s, color 0.12s, border-color 0.12s, transform 0.12s;
}

.slider-reset-btn svg {
    width: 11px;
    height: 11px;
}

.slider-reset-btn.is-changed {
    opacity: 1;
    pointer-events: auto;
}

.slider-reset-btn.is-changed:hover {
    color: var(--color-primary);
    border-color: var(--color-primary);
    transform: rotate(-30deg);
}

.slider-ticks {
    display: none;
    /* replaced by inline snap dots */
}

/* Export card: ticks must align with the slider thumb inside setting rows */
.export-card-settings .slider-ticks {
    display: none;
}

/* ── Snap-point dots overlay on slider track ── */

.range-wrap {
    position: relative;
}

.snap-dots {
    position: absolute;
    inset: 0;
    overflow: visible;
    pointer-events: none;
}

.snap-dot-btn {
    position: absolute;
    top: calc(100% - 1px);
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    min-width: 0;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    pointer-events: auto;
    z-index: 2;
    transition: background 0.12s ease;
}

.snap-dot-btn::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--color-primary);
    opacity: 0.45;
}

.snap-dot-btn:hover,
.snap-dot-btn:focus-visible {
    background: color-mix(in srgb, var(--palette-blueberry-100) 88%, white 12%);
}

.snap-dot-btn:hover::after,
.snap-dot-btn:focus-visible::after {
    opacity: 0.75;
}

.snap-dot-btn:focus-visible {
    outline: none;
}

/* ── Export section (Figma-style) ── */

/* Format + Quality dropdowns row */
.export-selects-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    margin: 0;
}

.export-modal-panel {
    --export-type-label-size: 13px;
    --export-type-body-size: 13px;
    --export-type-meta-size: 12px;
    --export-gap-sm: 6px;
    --export-gap-md: 10px;
    --export-gap-lg: 14px;
}

.export-select-group {
    display: flex;
    flex-direction: column;
    gap: var(--export-gap-sm);
    flex: 1;
    min-width: 0;
}

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

.export-select-group--format {
    display: none;
}

.export-select-group--quality {
    display: flex;
    gap: var(--export-gap-md);
}

.export-select-group--duration {
    display: flex;
}

.export-quality-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 0;
}

.export-quality-inline-options {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
}

.export-quality-meta-row .export-select-help {
    min-height: 0;
    margin: 0;
    margin-left: auto;
    text-align: right;
}

.export-dither-inline {
    flex-shrink: 0;
    font-weight: 600;
}

.export-section+.export-section {
    border-top: none;
    padding-top: 0;
    margin-top: 0;
}

.export-select-help {
    min-height: 22px;
    font-size: var(--export-type-meta-size);
    line-height: 1.3;
    color: color-mix(in srgb, var(--color-label, #666) 92%, #fff 8%);
}

.export-select-help.is-warning {
    color: color-mix(in srgb, #a34d00 78%, var(--color-label, #666) 22%);
}

.export-btn--inline {
    width: 100%;
    margin: 0;
    min-height: 38px;
    white-space: nowrap;
}

.export-quick-options {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px 12px;
    margin: 0;
}

.export-quick-options .gif-option-check {
    flex: 0 0 auto;
    width: fit-content;
    min-width: 0;
    padding: 2px 0;
    justify-content: flex-start;
    font-size: var(--export-type-body-size);
    font-weight: 500;
}

.gif-options-row.export-quick-options {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px 12px;
    align-items: stretch;
}

.gif-options-row.export-quick-options .gif-option-check {
    flex: 0 0 auto;
    width: fit-content;
}

.export-modal-body {
    row-gap: 12px;
}

.export-quick-options,
.export-format-opts {
    border: 1px solid color-mix(in srgb, var(--border-color) 84%, transparent 16%);
    border-radius: var(--radius-card);
    background: transparent;
    padding: 12px;
}

.export-format-opts {
    display: none !important;
}

.export-quick-options .gif-option-check input[type="checkbox"] {
    background: transparent;
}

.gif-options-row.export-quick-options {
    border: none;
    border-radius: 0;
    background: transparent;
    padding: 0;
}

.export-format-opts .export-size-est-row {
    margin: 0;
}

.export-motion-controls {
    border: 1px solid color-mix(in srgb, var(--border-color) 84%, transparent 16%);
    border-radius: var(--radius-card);
    padding: 12px;
    margin: 0;
    background: var(--color-surface-raised);
    display: grid;
    gap: var(--export-gap-md);
}

.export-motion-controls[hidden] {
    display: none !important;
}

#exportMotionControls {
    display: none !important;
}

.export-motion-controls-title {
    font-size: var(--export-type-label-size);
    font-weight: 600;
    color: var(--color-on-surface);
    line-height: 1.2;
    letter-spacing: 0.01em;
}

.crop-dimensions-dock .export-motion-controls-title {
    margin-bottom: 2px;
}

.export-motion-controls-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.export-motion-field,
.export-motion-range-row {
    margin: 0;
}



.export-dimensions-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}

.export-dimensions-row[hidden] {
    display: none !important;
}

.dimension-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.dimension-option {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    background: var(--palette-blueberry-200);
    box-shadow: 0 0 0 2px transparent;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.dimension-option input[type="radio"] {
    display: none;
}

.dimension-option:has(input:checked) {
    border-color: #fff;
    box-shadow: 0 0 0 2px var(--primary-color);
}

.dimension-option:hover {
    border-color: var(--color-primary-lighter);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(46, 43, 116, 0.15);
}

.dimension-option:has(input:checked):hover {
    border-color: #fff;
    box-shadow: 0 0 0 2px var(--primary-color), 0 4px 10px rgba(46, 43, 116, 0.15);
    transform: translateY(-1px);
}

.dimension-thumb {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--palette-blueberry-500);
}

.dimension-shape {
    display: block;
    border: 2px solid currentColor;
    border-radius: 3px;
    background: color-mix(in srgb, #fff 74%, var(--palette-blueberry-100) 26%);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
}

.dimension-thumb--square .dimension-shape {
    width: 24px;
    height: 24px;
}

.dimension-thumb--portrait12 .dimension-shape {
    width: 14px;
    height: 28px;
}

.dimension-thumb--landscape21 .dimension-shape {
    width: 28px;
    height: 14px;
}

.dimension-thumb--landscape43 .dimension-shape {
    width: 25px;
    height: 19px;
}

.export-select-label {
    font-size: var(--export-type-label-size);
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 0.01em;
    text-transform: none;
    color: var(--color-on-surface);
}

#exportQualitySegmented[hidden],
#exportCompressionRow[hidden],
#gifLoopRow[hidden],
#gifDitherRow[hidden] {
    display: none !important;
}

.export-select {
    width: 100%;
    padding: 6px 36px 6px 10px;
    border-radius: var(--radius-control);
    border: 1.5px solid var(--color-border, rgba(0, 0, 0, 0.12));
    background: var(--color-surface-raised);
    color: var(--color-on-surface);
    font-size: var(--export-type-body-size);
    font-family: inherit;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%231d183f' d='M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6z'/%3E%3C/svg%3E");
    background-position: calc(100% - 12px) 50%;
    background-size: 18px 18px;
    background-repeat: no-repeat;
}

.export-select:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 1px;
}

#exportCompressionRow>.export-select-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Format-specific options panel */
.export-format-opts {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px;
    border-top: none;
    margin: 0;
}

.export-format-opts[hidden] {
    display: none !important;
}

/* Modal preview for export */



.export-btn--main {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: min(470px, 100%);
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 4px;
    padding: 0.55em 1em;
    font-size: var(--text-md);
    font-weight: 700;
    background: var(--color-export);
    color: #fff;
    border: none;
    border-radius: 22px;
    cursor: pointer;
    text-align: center;
    transition: background 0.12s;
    margin-bottom: 6px;
    font-family: inherit;
}

.export-btn-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.export-btn--main:hover {
    background: var(--color-export-hover);
}

.export-btn--main:active {
    opacity: 0.88;
}

.export-btn--main:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

@media (max-width: 640px) {
    .export-selects-row {
        grid-template-columns: 1fr;
    }

    .export-motion-controls-grid {
        grid-template-columns: 1fr;
    }
}



input[type="color"] {
    width: 44px;
    height: 28px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    padding: 2px;
}

select {
    padding: 5px 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: var(--text-md);
    background: var(--color-surface-raised, white);
    color: var(--color-on-surface, #222);
    min-width: 100px;
    cursor: pointer;
}

.radio-group {
    display: flex;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.radio-option {
    display: flex;
    flex: 1;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: var(--text-md);
    font-weight: 500;
    color: var(--color-on-surface, #555);
    background: var(--color-surface-raised, white);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}

.rot-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.radio-option:not(:last-child) {
    border-right: 1px solid var(--border-color);
}

.radio-option input[type="radio"] {
    display: none;
}

.radio-option:has(input:checked) {
    background: transparent;
    color: var(--color-primary);
    border-color: var(--color-primary);
    font-weight: 700;
}

input[type="range"] {
    --slider-thumb-size: 22px;
    --slider-track-height: 8px;
    --slider-fill: var(--color-primary);
    --slider-track-base: var(--palette-blueberry-200);
    --slider-thumb-bg: #ffffff;
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
    height: var(--slider-track-height);
    border-radius: 999px;
    --fill-stop: calc((var(--pct, 0) * (100% - var(--slider-thumb-size))) + (var(--slider-thumb-size) / 2));
    background: var(--slider-track-gradient,
            linear-gradient(to right,
                var(--slider-fill) var(--fill-stop),
                var(--slider-track-base) var(--fill-stop)));
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: var(--slider-thumb-size);
    height: var(--slider-thumb-size);
    border-radius: 50%;
    background: var(--slider-thumb-bg);
    border: 1px solid rgba(214, 210, 236, 0.95);
    cursor: pointer;
    margin-top: calc((var(--slider-track-height) - var(--slider-thumb-size)) / 2);
    box-shadow: 0 8px 20px rgba(21, 18, 43, 0.16);
}

input[type="range"]::-moz-range-track {
    height: var(--slider-track-height);
    border-radius: 999px;
    background: var(--slider-track-gradient, var(--slider-track-base));
}

input[type="range"]::-moz-range-progress {
    height: var(--slider-track-height);
    border-radius: 999px;
    background: var(--slider-fill);
}

input[type="range"]::-moz-range-thumb {
    width: var(--slider-thumb-size);
    height: var(--slider-thumb-size);
    border-radius: 50%;
    background: var(--slider-thumb-bg);
    border: 1px solid rgba(214, 210, 236, 0.95);
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(21, 18, 43, 0.16);
}

html.theme-dark input[type="range"]::-webkit-slider-runnable-track {
    --fill-stop: calc((var(--pct, 0) * (100% - var(--slider-thumb-size))) + (var(--slider-thumb-size) / 2));
    background: var(--slider-track-gradient,
            linear-gradient(to right,
                var(--slider-fill) var(--fill-stop),
                var(--palette-blueberry-800) var(--fill-stop)));
}

html.theme-dark input[type="range"]::-moz-range-track {
    background: var(--palette-blueberry-800);
}

input[type="range"].tone-gradient-slider::-moz-range-progress {
    background: transparent;
}

.export-group {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

button {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: var(--text-md);
    font-weight: 600;
}

.primary-btn {
    background-color: var(--primary-color);
    color: white;
}

.primary-btn:hover {
    opacity: 0.9;
}

.primary-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.secondary-btn {
    background-color: #eee;
    color: #333;
}

.secondary-btn:hover {
    background-color: #ddd;
}

.secondary-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.export-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5em 1.25em;
    min-height: 2.5em;
    font-size: var(--text-md);
    font-weight: 600;
    font-family: "Source Sans 3", system-ui, sans-serif;
    line-height: 1.2;
    background: var(--color-export);
    color: #fff;
    border: none;
    border-radius: 9999px;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
}

.export-btn:hover {
    background: var(--color-export-hover);
}

.export-btn:active {
    transform: scale(0.95);
}

.export-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--palette-blueberry-300);
}

.export-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ── Small export button variant (in section headers) ── */
.export-btn--sm {
    padding: 0.3em 0.75em;
    min-height: 2em;
    font-size: var(--text-sm);
    gap: 4px;
}

/* ── Section header row (label + export buttons) ── */
.controls-row--section-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    flex-wrap: nowrap;
    gap: 8px;
    margin-bottom: 8px;
}

.section-heading {
    font-size: var(--text-md);
    font-weight: 700;
    color: var(--color-label);
    flex: 1;
    min-width: 0;
}

.section-export-btns {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* ── Per-format settings block (GIF, Video) ── */
.anim-format-block {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px 0 4px;
    border-top: 2px solid var(--color-border, rgba(0, 0, 0, 0.13));
    margin-top: 4px;
}

.format-block-header {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.format-block-header .export-quality-select {
    flex: 1;
    min-width: 0;
}

.format-block-label {
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--color-label);
    flex-shrink: 0;
    min-width: 36px;
}

.format-hint {
    font-size: var(--text-xs);
    color: var(--color-hint);
    font-weight: 400;
}


.export-status {
    font-size: var(--text-md);
    color: var(--color-label, #666);
    font-style: italic;
    align-self: center;
}

/* ── Animation export footer (progress bar + status) ── */

.anim-export-footer {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 4px 0 2px;
}

html.export-workspace-active .anim-export-footer {
    display: none;
}

.anim-progress {
    height: 4px;
    border-radius: 2px;
    background: var(--color-border, rgba(0, 0, 0, 0.1));
    overflow: hidden;
}

.anim-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--color-primary, #3b3a8e);
    border-radius: 2px;
    transition: width 0.1s linear;
}

.export-estimate {
    font-size: var(--text-sm);
    color: var(--color-label, #666);
    text-align: right;
    flex: 1;
}

/* ── GIF group (stacked button + loop toggle) ── */

.gif-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.gif-loop-label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--color-label);
    cursor: pointer;
    user-select: none;
}

.gif-loop-label input[type="checkbox"] {
    display: none;
}

.gif-loop-label:has(input:checked) .loop-toggle-track {
    background: var(--color-primary);
}

.gif-loop-label:has(input:checked) .loop-toggle-thumb {
    transform: translateX(12px);
}

html.none-mode .gif-loop-label {
    opacity: 0.38;
    pointer-events: none;
}

.loop-toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    min-height: 2.5em;
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--color-export);
    background: color-mix(in srgb, var(--color-export) 10%, white);
    border: 1px solid color-mix(in srgb, var(--color-export) 35%, white);
    border-radius: 9999px;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.loop-toggle-label input[type="checkbox"] {
    display: none;
}

.loop-toggle-track {
    position: relative;
    width: 28px;
    height: 16px;
    background: #ccc;
    border-radius: 8px;
    flex-shrink: 0;
    overflow: hidden;
    transition: background 0.2s;
}

.loop-toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 12px;
    height: 12px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.loop-toggle-label:has(input:checked) .loop-toggle-track {
    background: var(--color-export);
}

.loop-toggle-label:has(input:checked) .loop-toggle-thumb {
    transform: translateX(12px);
}

/* ── Toggle check/X icons ── */

.toggle-check-icon,
.toggle-x-icon {
    position: absolute;
    top: 50%;
    width: 9px;
    height: 9px;
    pointer-events: none;
    transition: opacity 0.15s;
    flex-shrink: 0;
}

.toggle-check-icon {
    left: 7px;
    transform: translate(-50%, -50%);
    color: white;
    opacity: 0;
}

.toggle-x-icon {
    left: 21px;
    transform: translate(-50%, -50%);
    color: rgba(0, 0, 0, 0.45);
    opacity: 1;
}

.gif-loop-label:has(input:checked) .toggle-check-icon,
.rotation-power-toggle:has(input:checked) .toggle-check-icon {
    opacity: 1;
}

.gif-loop-label:has(input:checked) .toggle-x-icon,
.rotation-power-toggle:has(input:checked) .toggle-x-icon {
    opacity: 0;
}

.rotation-power-toggle:has(input:checked) .loop-toggle-track {
    background: var(--color-primary);
}

.rotation-power-toggle:has(input:checked) .loop-toggle-thumb {
    transform: translateX(12px);
}

/* ── Texture tuning panel ── */

.texture-control {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    min-width: 0;
    align-self: stretch;
}

.texture-head {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    padding-right: 2.75rem;
    min-height: 2.5rem;
    width: 100%;
}

.texture-tune-wrap {
    position: absolute;
    top: 2px;
    right: 6px;
    z-index: 4;
}

.texture-tune-btn {
    position: relative;
    width: auto;
    height: auto;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--color-label);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
    opacity: 0.72;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.texture-tune-btn::before {
    content: "";
    position: absolute;
    inset: -10px;
}

.texture-tune-btn img {
    width: 17px;
    height: 17px;
    display: block;
    filter: var(--icon-filter, none);
}

.texture-tune-btn:hover {
    opacity: 1;
    transform: translateY(-1px);
}

.texture-tune-btn[aria-expanded="true"] {
    opacity: 1;
}

.texture-new-badge {
    position: absolute;
    top: -12px;
    right: -20px;
    min-width: 22px;
    height: 13px;
    padding: 0 4px;
    border: 1px solid rgba(255, 255, 255, 0.65);
    border-radius: 999px;
    background: #f2791a;
    color: #fff;
    font-size: 8px;
    font-weight: 800;
    letter-spacing: 0.06em;
    line-height: 11px;
    text-align: center;
    font-family: inherit;
    box-shadow: 0 2px 6px rgba(121, 59, 11, 0.18);
    pointer-events: none;
    /* Make it unclickable and allow clicks to pass through */
}

.texture-new-badge[hidden] {
    display: none !important;
}

.texture-news-popover {
    position: absolute;
    top: 26px;
    right: -4px;
    width: min(230px, 78vw);
    padding: 10px 28px 10px 10px;
    border-radius: 10px;
    border: 1px solid color-mix(in srgb, var(--color-primary) 22%, var(--color-border));
    background: color-mix(in srgb, var(--color-surface-raised) 92%, #fff 8%);
    box-shadow: 0 10px 26px rgba(31, 25, 66, 0.16);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    opacity: 0;
    transform: translateY(-4px);
    pointer-events: none;
    transition: opacity 0.16s ease, transform 0.16s ease;
}

.texture-news-popover::before {
    content: "";
    position: absolute;
    top: -6px;
    right: 16px;
    width: 10px;
    height: 10px;
    background: inherit;
    border-top: inherit;
    border-left: inherit;
    transform: rotate(45deg);
}

.texture-news-popover::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: -12px;
    height: 12px;
}

.texture-news-popover.is-open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.texture-news-popover[hidden] {
    display: none !important;
}

.texture-news-title {
    font-size: var(--text-xs);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-primary);
    margin-bottom: 6px;
}

.texture-news-item {
    position: relative;
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--color-label);
    line-height: 1.35;
    padding-left: 10px;
}

.texture-news-item::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.55em;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--color-primary) 80%, #fff 20%);
}

.texture-news-close {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 18px;
    height: 18px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--color-label);
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
}

.texture-news-close:hover {
    background: color-mix(in srgb, var(--color-primary) 18%, transparent);
    color: var(--color-primary);
}

.texture-tune-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 2px;
    padding-top: 8px;
    border-top: 1px solid var(--color-border, rgba(0, 0, 0, 0.08));
    width: 100%;
}

.texture-tune-panel[hidden] {
    display: none !important;
}

.texture-tune-row {
    margin: 0;
    gap: 2px;
}

.texture-tune-row[hidden] {
    display: none !important;
}

.texture-tune-row>span {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 8px;
}

.texture-tune-row.gif-option-check {
    margin-top: 2px;
    font-size: var(--text-sm);
}

/* Keep texture tuning sliders visually consistent: no snap-dot overlays. */
.texture-tune-panel .snap-dots {
    display: none;
}

/* ── Shading thumbnail cards ── */

.shading-group {
    display: flex;
    gap: 10px;
}

.shading-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px 8px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    box-shadow: 0 0 0 2px transparent;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s, background 0.15s;
}

.shading-option input[type="radio"] {
    display: none;
}

/* Double-ring selection: white inner gap + primary-color outer ring.
   Readable regardless of card or canvas background color. */
.shading-option:has(input:checked) {
    border-color: white;
    box-shadow: 0 0 0 2px var(--primary-color);
}

.shading-option:hover {
    border-color: var(--color-primary-lighter);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(46, 43, 116, 0.15);
}

.shading-option:has(input:checked):hover {
    border-color: white;
    box-shadow: 0 0 0 2px var(--primary-color), 0 4px 10px rgba(46, 43, 116, 0.15);
    transform: translateY(-1px);
}

.shading-thumb {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    flex-shrink: 0;
}


.shading-thumb--matte {
    background: radial-gradient(circle at 36% 32%, #ffffffc2 5%, #7f7ad2 34%, #55509a 70%, #3c3774 100%);
}

.shading-thumb--phong {
    background: radial-gradient(circle at 38% 35%, #ffffffcc 4%, var(--palette-blueberry-500) 40%, var(--palette-blueberry-800) 100%);
}

.shading-thumb--metallic {
    background: radial-gradient(circle at 32% 30%, #fff 4%, #ffffffcc 10%, var(--palette-blueberry-500) 36%, var(--palette-blueberry-800) 62%, var(--palette-blueberry-900) 90%);
}

/* ── Slider tooltip (Chrome-style hover bubble) ── */

.range-wrap {
    position: relative;
    width: 100%;
}

.range-wrap:has(input[type="range"]) {
    padding-bottom: 10px;
}

.slider-tooltip {
    margin-left: auto;
    margin-right: 6px;
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--color-label);
    white-space: nowrap;
    font-family: "Source Sans 3", system-ui, sans-serif;
    display: inline;
}

html.fine-tuning-enabled .slider-tooltip[role="button"][data-precise-entry-enabled="1"] {
    cursor: text;
    text-decoration: underline dotted;
    text-underline-offset: 2px;
}

html.fine-tuning-enabled .slider-tooltip[role="button"][data-precise-entry-enabled="1"]:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--color-on-surface) 38%, transparent);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ── Thumb card wrap (shared by Color, Texture, Rotation) ── */

.thumb-card-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.thumb-label {
    font-size: var(--text-sm);
    font-weight: 600;
    color: color-mix(in srgb, var(--color-on-surface) 78%, #000 22%);
    line-height: 1;
}

/* ── Sidebar header (sticky hamburger bar) ── */

.sidebar-header {
    display: none;
    flex-shrink: 0;
    justify-content: stretch;
    align-items: center;
    gap: 10px;
    padding: 14px 16px 0;
    background: var(--color-surface);
    position: sticky;
    top: 0;
    z-index: 10;
}

html.loaded .sidebar-header {
    display: flex;
}

/* ── Sidebar collapse edge tab ── */

.sidebar-edge-tab {
    display: none;
    position: fixed;
    right: 385px;
    /* flush with sidebar left edge when open */
    top: 50%;
    transform: translate(0, -50%);
    z-index: 30;
    width: 20px;
    height: 64px;
    padding: 0;
    border: 1px solid var(--palette-blueberry-300);
    border-right: none;
    border-radius: 6px 0 0 6px;
    background: var(--palette-blueberry-200);
    color: var(--palette-blueberry-500);
    cursor: pointer;
    transition: right 0.2s ease, background 0.12s, color 0.12s;
    align-items: center;
    justify-content: center;
}

.sidebar-edge-tab svg {
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.sidebar-edge-tab:hover {
    background: var(--color-primary, #3b3a8e);
    color: #fff;
    border-color: var(--color-primary, #3b3a8e);
}

@media (min-width: 900px) {
    html.loaded .sidebar-edge-tab {
        display: flex;
    }

    html.loaded.sidebar-collapsed .sidebar-edge-tab,
    html.loaded.sidepanels-hidden .sidebar-edge-tab {
        right: 0;
    }
}

/* ── Hamburger menu ── */

.menu-wrap {
    position: relative;
}

.menu-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: var(--control-height);
    height: var(--control-height);
    padding: 8px;
    background: var(--color-surface-raised, white);
    color: var(--color-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-control);
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s, border-color 0.15s;
}

html.loaded .menu-btn {
    display: flex;
}

.menu-btn span {
    display: block;
    width: 100%;
    height: 2px;
    background: currentColor;
    border-radius: 1px;
}

.menu-btn:hover {
    background: var(--palette-blueberry-100);
    border-color: var(--color-primary);
}

.menu-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--palette-blueberry-300);
}

/* ── Info overlay extras ── */

.settings-overlay.info-overlay {
    align-items: flex-end;
    justify-content: flex-end;
    padding: 16px;
}

.settings-overlay.help-overlay {
    background: transparent;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 0;
}

.settings-overlay.help-overlay .help-panel {
    position: absolute;
    margin: 0;
}

.info-made-by {
    display: block;
    font-size: var(--text-md);
    font-weight: 700;
    color: var(--color-on-surface);
    padding: 0 14px 2px;
}

/* ── Info button row ── */

.info-btn-row {
    display: flex;
    justify-content: flex-end;
    padding: 0 0 4px;
    margin-top: auto;
    /* pushes to bottom of flex column */
    padding-top: 24px;
    /* gap between last control and icon */
}

.info-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 50%;
    color: var(--color-label);
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
}

.info-icon-btn.canvas-utility-btn {
    width: 52px;
    height: 52px;
    border-radius: 999px;
    background: #fff;
    color: var(--palette-blueberry-500);
    border: 2px solid rgba(74, 67, 145, 0.14);
    box-shadow: 0 8px 20px rgba(18, 16, 48, 0.16);
}

.info-icon-btn.canvas-utility-btn svg {
    fill: currentColor;
    color: inherit;
}

.info-icon-btn.canvas-utility-btn:hover {
    color: var(--palette-blueberry-500);
    background: #fff;
    border-color: color-mix(in srgb, var(--palette-blueberry-300) 80%, white 20%);
    box-shadow: 0 10px 24px rgba(18, 16, 48, 0.2);
}

.info-icon-btn:hover {
    color: var(--color-on-surface);
    background: color-mix(in srgb, var(--palette-blueberry-500) 12%, transparent);
}

.info-icon-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--palette-blueberry-500) 15%, transparent);
}

.info-icon-btn.is-active {
    color: var(--palette-blueberry-500);
    background: color-mix(in srgb, var(--palette-blueberry-500) 12%, transparent);
}

/* ── Info panel extras ── */

.info-panel {
    width: 300px;
}

.settings-panel-header--about {
    align-items: center;
    flex-wrap: nowrap;
}

.help-panel-title-logo {
    display: block;
    width: auto;
    max-width: min(68vw, 260px);
    height: 36px;
}

.info-panel-body {
    padding: 14px 16px 16px !important;
    gap: 8px !important;
}

.info-section-title {
    margin: 0;
    padding-left: 14px;
    font-size: var(--text-md);
    font-weight: 700;
    color: var(--color-on-surface);
}

.info-whats-new-title {
    color: #f2791a;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.build-update-badge--inline {
    position: static;
    min-width: 22px;
    height: 14px;
    line-height: 12px;
}

.settings-panel-header--about .info-section-title {
    padding-left: 0;
}

.info-description {
    margin: 0;
    padding-left: 14px;
    font-size: var(--text-sm);
    color: var(--color-label);
    line-height: 1.5;
}

.info-meta {
    display: block;
    padding-left: 14px;
    font-size: var(--text-xs);
    color: var(--color-label);
    opacity: 0.75;
}

.info-whats-new-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.info-meta-line {
    margin: 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    column-gap: 6px;
}

.info-meta-separator {
    opacity: 0.7;
}

.info-whats-new-text {
    padding-left: 14px;
    margin-top: 0;
}

.info-text-link {
    font-size: var(--text-sm);
    color: var(--color-label);
    text-decoration: underline;
    text-underline-offset: 2px;
    font-weight: 400;
}

.info-text-link:hover {
    color: var(--color-on-surface);
}

.info-link-btn {
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.info-link-btn svg {
    flex: 0 0 auto;
}

.brand-link-logo {
    flex: 0 0 auto;
    display: block;
    width: auto;
    height: 14px;
    max-width: 66px;
}

.brand-link-logo--etsy {
    height: 13px;
    max-width: 32px;
}

.brand-link-logo--printables,
.brand-link-logo--youtube,
.brand-link-logo--github {
    height: 14px;
    max-width: 64px;
}

.info-brand-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 0 14px;
}

.info-brand-link {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: 10px;
    text-decoration: none;
    background: transparent;
    border: 1px solid transparent;
    transition: background 0.12s, border-color 0.12s;
}

.info-brand-link:hover {
    background: var(--palette-blueberry-100);
    border-color: color-mix(in srgb, var(--palette-blueberry-300) 70%, transparent);
}

.info-brand-link:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--palette-blueberry-300);
}

.help-controls-list {
    margin: 0;
    padding: 0 0 0 14px;
    font-size: var(--text-sm);
    line-height: 1.7;
    color: var(--text-color);
    list-style: none;
}

.help-controls-list li {
    padding: 2px 0;
}

.help-controls-list strong {
    color: var(--palette-blueberry-600);
}

@media (min-width: 900px) {
    .info-panel {
        width: 340px;
    }
}

/* ── Settings overlay panel ── */

.settings-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1000;
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    padding: 12px;
}

.settings-overlay[hidden] {
    display: none;
}

/* ── Mobile export layout (split card, preview stays visible) ── */
@media (max-width: 640px) {
    .settings-overlay.export-overlay {
        align-items: flex-end;
        justify-content: center;
        padding: 0 8px 8px;
        background: transparent;
        pointer-events: none;
    }

    .export-modal-panel {
        position: relative;
        width: 100% !important;
        max-width: 680px !important;
        height: auto;
        max-height: 46svh;
        border-radius: 16px 16px 14px 14px;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        pointer-events: auto;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    }

    .export-modal-body {
        max-height: calc(46svh - 110px);
        overflow-y: auto;
        overflow-x: hidden;
    }

    /* Make export options more compact on mobile */
    .export-quick-options,
    .export-format-opts,
    .export-motion-controls {
        padding: 8px;
        row-gap: 6px;
    }

    .export-motion-controls-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .export-select {
        font-size: var(--text-sm);
        padding: 4px 28px 4px 8px;
    }

    .export-btn--main {
        width: 100%;
        padding: 0.4em 1em;
        margin: 4px 0;
        font-size: var(--text-sm);
    }

    .export-primary-row .export-close-inline,
    .export-primary-row .export-copy-inline {
        flex: 1 1 calc(50% - 4px);
    }

    /* Hide download package button on mobile to save space */
    .sidebar-footer-actions.export-panel-package-row {
        display: none !important;
    }

    /* Further reduce padding in export modal body on mobile */
    .export-modal-body {
        padding: 2px;
    }

    .export-modal-panel .settings-panel-header {
        padding: 10px 14px 8px;
        border-radius: 20px 20px 0 0;
    }

    /* Reduce all export row gaps for compact mobile layout */
    .export-selects-row,
    .gif-options-row.export-quick-options {
        gap: 4px;
    }

    .export-quick-options .gif-option-check {
        padding: 0;
    }

    #modelPartSelectorMenu {
        max-height: min(58vh, 520px);
    }

    #modelPartSelectorMenu.model-selector-view--grid {
        gap: 6px;
    }

    #modelPartSelectorMenu.model-selector-view--grid .thumb-select-option {
        padding: 7px;
        min-height: 0;
    }

    #modelPartSelectorMenu.model-selector-view--grid .thumb-select-option-main {
        gap: 4px;
        padding-top: 10px;
    }

    #modelPartSelectorMenu.model-selector-view--grid .thumb-select-option-canvas {
        aspect-ratio: 1 / 1;
        max-height: 86px;
    }

    #modelPartSelectorMenu.model-selector-view--grid .thumb-select-option-text {
        min-height: 0;
        font-size: 10px;
        line-height: 1.16;
    }
}

.settings-panel {
    background: color-mix(in srgb, var(--color-surface-raised, white) 90%, transparent);
    border-radius: 16px;
    box-shadow: 0 4px 32px rgba(0, 0, 0, 0.18), 0 1.5px 4px rgba(0, 0, 0, 0.06);
    width: 280px;
    max-width: calc(100vw - 24px);
    overflow: hidden;
    transition: background 0.2s;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.settings-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    row-gap: 10px;
    column-gap: 8px;
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--border-color);
}

.settings-panel-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--color-on-surface, #222);
}

.export-modal-panel .settings-panel-header {
    justify-content: flex-start;
    position: relative;
    padding-top: 26px;
    cursor: grab;
}

.export-modal-panel .settings-panel-header h3 {
    flex: 1;
}

.export-modal-panel .settings-panel-header button,
.export-modal-panel .settings-panel-header a {
    cursor: pointer;
}

.export-modal-panel .settings-panel-header.is-dragging {
    cursor: grabbing;
}

.export-drag-indicator {
    position: absolute;
    top: 4px;
    left: 50%;
    transform: translateX(-50%) rotate(90deg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: color-mix(in srgb, var(--color-on-surface, #2e2b74) 55%, transparent);
    opacity: 0.7;
    pointer-events: none;
}

.export-drag-indicator svg {
    display: block;
}

.export-header-link {
    border: none;
    background: transparent;
    color: var(--palette-blueberry-600);
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: 0.01em;
    line-height: 1.1;
    padding: 4px 6px;
    border-radius: 8px;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.export-header-link:hover {
    color: var(--palette-blueberry-800);
    background: color-mix(in srgb, var(--palette-blueberry-100) 58%, transparent);
}

.export-header-link:disabled {
    opacity: 0.6;
    cursor: wait;
}

.export-panel-toggle {
    flex: 1;
    min-height: 34px;
    border: none;
    background: transparent;
    color: var(--color-on-surface, #222);
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    text-align: left;
    cursor: pointer;
}

.export-panel-toggle-chevron {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.16s ease;
}

.export-panel-toggle-chevron svg {
    width: 100%;
    height: 100%;
    display: block;
}

.export-panel-collapsed-bar {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(110px, 1fr) minmax(132px, auto);
    gap: 12px;
    align-items: center;
}

.export-panel-collapsed-bar[hidden] {
    display: none !important;
}

.export-select-group--compact {
    min-width: 0;
}

.export-select--compact {
    min-height: 44px;
    font-weight: 700;
}

.export-btn--compact {
    width: 100%;
    min-width: 0;
    padding-left: 16px;
    padding-right: 16px;
}

.export-modal-panel.is-collapsed .export-panel-toggle-chevron {
    transform: rotate(-90deg);
}

.export-modal-body[hidden] {
    display: none !important;
}

.settings-close-btn {
    width: 36px;
    height: 36px;
    border: 1.5px solid var(--border-color, rgba(0, 0, 0, 0.12));
    background: var(--color-surface-raised, rgba(255, 255, 255, 0.9));
    color: var(--color-on-surface, #555);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-shadow: var(--shadow-soft);
    transition: background 0.12s, border-color 0.12s, box-shadow 0.12s, transform 0.1s;
}

.settings-close-btn:hover {
    background: color-mix(in srgb, var(--color-primary) 6%, transparent);
    border-color: color-mix(in srgb, var(--palette-blueberry-300) 80%, white 20%);
    box-shadow: 0 10px 24px rgba(18, 16, 48, 0.2);
}

.settings-close-btn:active {
    transform: scale(0.95);
}

.settings-close-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--palette-blueberry-300);
}

/* Keep preview action buttons aligned with the existing D-pad style. */
.canvas-overlay-br .cam-nav-action-btn {
    width: 52px;
    height: 52px;
    border-radius: 999px;
    background: #fff;
    color: var(--palette-blueberry-600);
    border: 2px solid rgba(74, 67, 145, 0.14);
    box-shadow: 0 8px 20px rgba(18, 16, 48, 0.16);
}

.canvas-overlay-br .cam-nav-action-btn:hover {
    border-color: color-mix(in srgb, var(--palette-blueberry-300) 80%, white 20%);
    color: var(--palette-blueberry-500);
    background: #fff;
}

.canvas-overlay-br .cam-nav-action-btn.is-active {
    background: var(--palette-blueberry-200);
    border-color: var(--palette-blueberry-500);
    color: var(--palette-blueberry-500);
}

#btnExportPause {
    display: flex;
}

#btnExportPause.is-paused {
    border-color: var(--palette-blueberry-500);
}

.settings-panel-body {
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.settings-action-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 11px 14px;
    background: transparent;
    color: var(--color-on-surface, #2E2B74);
    border: none;
    border-radius: 10px;
    font-size: var(--text-md);
    font-weight: 600;
    font-family: "Source Sans 3", system-ui, sans-serif;
    cursor: pointer;
    text-align: left;
    transition: background 0.12s;
    box-sizing: border-box;
}

.settings-action-btn:hover {
    background: var(--palette-blueberry-100);
}

.settings-action-btn:active {
    transform: scale(0.98);
}

.settings-action-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--palette-blueberry-300);
}

.settings-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 14px;
}

html.theme-dark .settings-action-btn:hover {
    background: rgba(179, 168, 247, 0.1);
}

html.theme-dark .settings-close-btn:hover {
    background: color-mix(in srgb, var(--palette-blueberry-400) 12%, transparent);
    border-color: rgba(179, 168, 247, 0.48);
}

/* ── Color picker cards ── */

.color-group {
    display: flex;
    gap: 6px;
}

.color-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px 8px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    position: relative;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.color-option:focus-within {
    border-color: white;
    box-shadow: 0 0 0 2px var(--primary-color);
}

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

.color-swatch {
    width: 44px;
    height: 44px;
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
}

.color-name {
    font-size: var(--text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-label);
    line-height: 1;
}

.color-option:hover {
    border-color: var(--color-primary-lighter);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(46, 43, 116, 0.15);
}

.color-edit-icon {
    position: absolute;
    top: 6px;
    /* aligns with .color-option padding-top */
    left: 8px;
    /* aligns with .color-option padding-left */
    width: 44px;
    /* matches .color-swatch width */
    height: 44px;
    /* matches .color-swatch height */
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.48);
    border-radius: 4px;
    color: #fff;
    opacity: 0;
    transition: opacity 0.15s;
    pointer-events: none;
}

.color-edit-icon svg {
    width: 20px;
    height: 20px;
}

.color-option:hover .color-edit-icon {
    opacity: 1;
}

/* ── Unified Styles group (colors + shading) ── */

.styles-group {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.colors-sub {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.shading-sub {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-end;
}

.shading-sub-label {
    font-size: var(--text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-label, #666);
    line-height: 1;
}

.shading-items {
    display: flex;
    gap: 10px;
}

/* ── Export buttons row ── */

.export-buttons-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-start;
}

.export-gif-group {
    display: inline-flex;
    align-items: stretch;
}

/* ── GIF compound pill (button + loop inline) ── */

.gif-compound {
    display: inline-flex;
    align-items: stretch;
    border-radius: 9999px;
    overflow: hidden;
}

.gif-btn {
    border-radius: 9999px 0 0 9999px;
    border-right: 1px solid rgba(255, 255, 255, 0.25);
}

.gif-loop-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 14px;
    min-height: 2.5em;
    font-size: var(--text-md);
    font-weight: 600;
    font-family: "Source Sans 3", system-ui, sans-serif;
    color: white;
    background: var(--color-export);
    border-radius: 0 9999px 9999px 0;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    transition: background 0.15s;
}

.gif-loop-inline:hover {
    background: var(--color-export-hover);
}

.gif-loop-inline input[type="checkbox"] {
    display: none;
}

.gif-loop-inline .loop-toggle-track {
    background: rgba(255, 255, 255, 0.35);
}

.gif-loop-inline:has(input:checked) .loop-toggle-track {
    background: rgba(255, 255, 255, 0.9);
}

.gif-loop-inline .loop-toggle-thumb {
    background: var(--color-export);
    box-shadow: none;
}

.gif-loop-inline:has(input:checked) .loop-toggle-thumb {
    background: var(--color-export);
}

/* ── Export quality settings (legacy; no longer in DOM) ── */

.export-quality-settings {
    display: none;
}

.export-quality-item {
    display: none;
}

.quality-label {
    display: none;
}

/* ── Export frame overlay canvas ── */

#exportFrameCanvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3;
    display: block;
}

.crop-dimensions-dock {
    position: relative;
    z-index: 1;
    pointer-events: auto;
    width: 100%;
    border-radius: 0;
    border: none;
    background: transparent;
    padding: 0;
}

.crop-dimensions-dock[hidden] {
    display: none !important;
}

.export-crop-segmented {
    --export-tab-columns: 4;
}

.export-crop-tab {
    min-height: 74px;
    display: grid;
    grid-template-rows: 38px auto;
    align-content: center;
    justify-items: center;
    gap: 6px;
    padding: 8px 8px 7px;
    position: relative;
}

.export-crop-tab input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.export-crop-tab__shape {
    display: block;
    align-self: center;
    border: 2px solid currentColor;
    border-radius: 4px;
    background: color-mix(in srgb, var(--palette-blueberry-200) 42%, #fff 58%);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--palette-blueberry-700) 20%, transparent);
}

.export-crop-tab__shape--square {
    width: 22px;
    height: 22px;
}

.export-crop-tab__shape--portrait12 {
    width: 12px;
    height: 25px;
}

.export-crop-tab__shape--landscape21 {
    width: 26px;
    height: 13px;
}

.export-crop-tab__shape--landscape43 {
    width: 24px;
    height: 18px;
}

.export-crop-tab__ratio {
    font-size: var(--export-type-body-size);
    font-weight: 600;
    color: inherit;
    line-height: 1;
    align-self: center;
}

.export-crop-tab:has(input:checked) {
    background: #fff;
    color: var(--color-on-surface);
    box-shadow: 0 1px 2px rgba(20, 18, 43, 0.12);
}

.export-crop-tab:has(input:checked) .export-crop-tab__shape {
    background: color-mix(in srgb, var(--color-primary) 30%, #fff 70%);
    border-color: color-mix(in srgb, var(--color-primary) 72%, transparent);
}

.crop-dimensions-dock .export-dimensions-row {
    margin: 0;
    gap: 6px;
}

.crop-dimensions-dock .export-select-label {
    display: none;
}

.crop-dimensions-dock .dimension-group {
    flex-direction: row;
    gap: 8px;
    justify-content: flex-start;
}


html.crop-mode #btnFrameOverlay,
html.crop-mode .canvas-overlay-br,
html.crop-mode .canvas-overlay-bl,
html.crop-mode .orbit-hint-bar {
    display: none;
}

html.crop-mode.export-workspace-active .canvas-bottom-center {
    display: flex !important;
}

html.crop-mode.export-workspace-active .orbit-hint-bar {
    display: none;
}

html.crop-mode.export-workspace-active .canvas-overlay-bl {
    display: flex;
}

html.export-workspace-active .canvas-overlay-br,
html.crop-mode.export-workspace-active .canvas-overlay-br {
    display: flex !important;
}

html.dpad-hidden.export-workspace-active .canvas-overlay-br,
html.dpad-hidden.crop-mode.export-workspace-active .canvas-overlay-br {
    display: flex !important;
}

/* ── Ruler / dimensions HUD ── */

.ruler-hud {
    position: static;
    z-index: 7;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 9px;
    min-height: 44px;
    border-radius: 14px;
    background: color-mix(in srgb, var(--palette-blueberry-100) 26%, white 74%);
    border: 1px solid color-mix(in srgb, var(--palette-blueberry-300) 46%, transparent);
    box-shadow: 0 10px 24px rgba(20, 18, 43, 0.1);
    pointer-events: auto;
    white-space: nowrap;
    max-width: min(92vw, 560px);
    cursor: pointer;
    user-select: none;
    transition: background 0.15s, border-color 0.15s;
}

.ruler-hud:hover {
    background: color-mix(in srgb, var(--palette-blueberry-100) 34%, white 66%);
    border-color: color-mix(in srgb, var(--palette-blueberry-400) 58%, transparent);
}

.ruler-hud:active {
    background: color-mix(in srgb, var(--palette-blueberry-100) 42%, white 58%);
}

.ruler-hud:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 40%, transparent), 0 10px 24px rgba(20, 18, 43, 0.1);
}

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

.ruler-hud.is-dims-hidden .ruler-dim,
.ruler-hud.is-dims-hidden .ruler-sep,
.ruler-hud.is-dims-hidden .ruler-unit {
    display: none;
}

.ruler-hud.is-dims-hidden {
    max-width: none;
    min-height: 0;
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
}

.ruler-dim {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
}

.ruler-axis {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--palette-blueberry-500);
    text-transform: uppercase;
    line-height: 1;
}

.ruler-val {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-on-surface);
    line-height: 1.1;
}

.ruler-sep {
    color: color-mix(in srgb, var(--palette-blueberry-500) 40%, transparent);
    font-size: 14px;
    line-height: 1;
    align-self: center;
}

.ruler-unit {
    font-size: 10px;
    font-weight: 700;
    color: var(--palette-blueberry-500);
    letter-spacing: 0.04em;
    align-self: center;
}

.ruler-unit-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 28px;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--palette-blueberry-500) 52%, transparent);
    background: rgba(46, 43, 116, 0.1);
    color: var(--palette-blueberry-500);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: lowercase;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.ruler-unit-toggle:hover {
    background: rgba(46, 43, 116, 0.16);
    border-color: color-mix(in srgb, var(--palette-blueberry-500) 78%, transparent);
}

.ruler-unit-toggle:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--palette-blueberry-300) 75%, transparent);
}

.ruler-part-hover-toggle,
.ruler-part-select-toggle {
    min-width: 112px;
    height: 40px;
    padding: 0 12px;
    border-radius: 999px;
    border: 2px solid rgba(74, 67, 145, 0.18);
    background: #fff;
    color: color-mix(in srgb, var(--palette-blueberry-500) 62%, white);
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(18, 16, 48, 0.16);
    transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s, opacity 0.15s;
}

.ruler-mode-picker {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 0;
    border: none;
    background: transparent;
}

.ruler-mode-picker[hidden] {
    display: none !important;
}

/* Visually-hidden radio inputs inside labels */
.ruler-mode-radio {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.ruler-part-hover-toggle,
.ruler-part-select-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.ruler-toggle-icon {
    width: 18px;
    height: 18px;
    display: block;
    flex: 0 0 auto;
    fill: currentColor;
}

#rulerHoverLabel,
#rulerSelectLabel {
    display: inline;
}

.ruler-toggle-text {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.01em;
    line-height: 1;
    white-space: nowrap;
}

#rulerSelectToggle {
    order: 1;
}

#rulerHoverToggle {
    order: 2;
}

.ruler-part-hover-toggle:hover,
.ruler-part-select-toggle:hover {
    border-color: color-mix(in srgb, var(--palette-blueberry-500) 45%, transparent);
    color: var(--palette-blueberry-500);
    background: color-mix(in srgb, var(--palette-blueberry-100) 58%, #fff);
}

.ruler-part-hover-toggle.is-active,
.ruler-part-select-toggle.is-active {
    background: var(--palette-blueberry-200);
    border-color: var(--palette-blueberry-500);
    color: var(--palette-blueberry-500);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--palette-blueberry-500) 14%, transparent), 0 8px 20px rgba(18, 16, 48, 0.16);
}

.ruler-part-hover-toggle:disabled,
.ruler-part-hover-toggle:has(input:disabled),
.ruler-part-select-toggle:disabled,
.ruler-part-select-toggle:has(input:disabled) {
    opacity: 0.52;
    cursor: not-allowed;
}

.ruler-part-hover-toggle:disabled:hover,
.ruler-part-hover-toggle:has(input:disabled):hover,
.ruler-part-select-toggle:disabled:hover,
.ruler-part-select-toggle:has(input:disabled):hover {
    background: #fff;
    border-color: rgba(74, 67, 145, 0.18);
    color: color-mix(in srgb, var(--palette-blueberry-500) 62%, white);
}

.ruler-part-hover-toggle:focus-visible,
.ruler-part-hover-toggle:focus-within,
.ruler-part-select-toggle:focus-visible,
.ruler-part-select-toggle:focus-within {
    outline: none;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--palette-blueberry-300) 75%, transparent);
}

.ruler-lines-switch[hidden] {
    display: none;
}

.ruler-lines-switch {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 4px;
    cursor: pointer;
}

.ruler-lines-text {
    font-size: 10px;
    font-weight: 700;
    color: color-mix(in srgb, var(--palette-blueberry-500) 72%, transparent);
    letter-spacing: 0.02em;
}

.ruler-lines-input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    border: 0;
    padding: 0;
    clip: rect(0 0 0 0);
    overflow: hidden;
}

.ruler-lines-ui {
    position: relative;
    width: 56px;
    height: 32px;
    border-radius: 999px;
    background: rgba(141, 138, 183, 0.34);
    border: 1px solid rgba(111, 104, 174, 0.36);
    box-shadow: inset 0 1px 2px rgba(20, 18, 43, 0.08);
    transition: background 0.18s ease;
}

.ruler-lines-ui::after {
    content: '';
    position: absolute;
    width: 26px;
    height: 26px;
    top: 2px;
    left: 2px;
    border-radius: 50%;
    background: #f2f2f2;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    transition: transform 0.18s ease;
}

.ruler-lines-input:checked+.ruler-lines-ui {
    background: #8c88b2;
}

.ruler-lines-input:checked+.ruler-lines-ui::after {
    transform: translateX(24px);
}

@media (max-width: 700px) {
    .ruler-hud {
        left: 8px;
        bottom: 54px;
        gap: 6px;
        padding: 5px 8px;
    }

    .ruler-axis {
        font-size: 8px;
    }

    .ruler-val {
        font-size: 11px;
    }

    .ruler-unit-toggle {
        min-width: 34px;
        height: 24px;
        font-size: 9px;
    }

    .ruler-part-hover-toggle,
    .ruler-part-select-toggle {
        width: 46px;
        height: 46px;
        padding: 0;
    }

    .ruler-mode-picker {
        gap: 8px;
        padding: 0;
    }

    .ruler-lines-text {
        font-size: 9px;
    }

    .ruler-lines-ui {
        width: 48px;
        height: 28px;
    }

    .ruler-lines-ui::after {
        width: 22px;
        height: 22px;
    }

    .ruler-lines-input:checked+.ruler-lines-ui::after {
        transform: translateX(20px);
    }
}

.frame-dim-region {
    position: absolute;
    pointer-events: none;
    z-index: 4;
    display: none;
}

html.crop-mode .frame-dim-region {
    display: block;
    pointer-events: auto;
    cursor: pointer;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* ── Crop corner drag handles ── */
.crop-corner {
    position: absolute;
    width: 22px;
    height: 22px;
    z-index: 8;
    display: none;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

html.crop-mode .crop-corner {
    display: block;
}

.crop-corner--tl {
    cursor: nw-resize;
}

.crop-corner--tr {
    cursor: ne-resize;
}

.crop-corner--bl {
    cursor: sw-resize;
}

.crop-corner--br {
    cursor: se-resize;
}

/* ── Export section header row ── */

.export-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
    min-width: 0;
    overflow: hidden;
}

.export-section-title {
    font-size: var(--text-md);
    font-weight: 700;
    white-space: nowrap;
}

.export-transparent-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-label, #888);
    cursor: pointer;
    white-space: nowrap;
    padding: 3px 7px;
    border: 1.5px solid var(--color-border, rgba(0, 0, 0, 0.15));
    border-radius: 6px;
    transition: border-color 0.12s, color 0.12s;
}

.export-transparent-label:has(input:checked) {
    border-color: var(--palette-blueberry-400, #6c63ff);
    color: var(--palette-blueberry-500, #5a52d5);
}

.export-transparent-label input {
    accent-color: var(--palette-blueberry-400, #6c63ff);
    width: 12px;
    height: 12px;
}

.export-transparent-label:has(input:disabled) {
    opacity: 0.4;
    pointer-events: none;
}

.export-quality-select {
    flex: 1;
    font-size: var(--text-sm);
    padding: 4px 6px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.loop-count-select {
    font-size: var(--text-sm);
    padding: 4px 6px;
    border-radius: 6px;
    border: 1px solid var(--color-border, rgba(0, 0, 0, 0.15));
    background: var(--color-surface, #f5f5f7);
    color: var(--color-label);
    cursor: pointer;
}

/* frame-toggle-btn kept for CSS history, now hidden (button moved to canvas) */
.frame-toggle-btn {
    display: none;
}

/* ── Estimate row inside export cards ── */

.export-size-est-row {
    padding: 5px 12px 7px;
    font-size: var(--text-md);
    color: var(--color-label, #999);
    margin-top: 2px;
    min-height: 24px;
}

.export-info-time {
    font-weight: 700;
    font-size: var(--text-lg, 0.9rem);
    color: var(--color-on-surface, #222);
    font-style: normal;
}

.export-size-est-row:empty,
.export-size-est-row span:empty {
    display: none;
}

/* ── Per-format export cards ── */

.export-format-card {
    background: var(--color-surface, #f5f5f7);
    border: 1.5px solid var(--color-border, rgba(0, 0, 0, 0.09));
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 8px;
}

.export-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px 8px 12px;
    background: var(--color-surface-raised, rgba(0, 0, 0, 0.04));
    border-bottom: 1px solid var(--color-border, rgba(0, 0, 0, 0.09));
}

.export-card-title {
    font-size: var(--text-sm, 12px);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-label, #777);
}

.export-btn--card {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    font-size: var(--text-sm, 12px);
    min-height: unset;
    height: 28px;
    border-radius: 6px;
}

.export-card-settings {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 4px 0;
}

.export-setting-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    min-height: 32px;
    cursor: default;
}

.export-setting-row:hover {
    background: var(--color-surface-raised, rgba(0, 0, 0, 0.025));
}

.export-setting-row select,
.export-setting-row input[type="range"],
.export-setting-row input[type="number"] {
    flex: 1;
    min-width: 0;
}

.export-setting-label {
    min-width: 52px;
    font-size: var(--text-sm, 12px);
    font-weight: 600;
    color: var(--color-label, #777);
    white-space: nowrap;
    flex-shrink: 0;
}

.export-setting-hint {
    font-size: var(--text-sm);
    color: var(--color-label, #999);
    white-space: nowrap;
}

.export-number-input {
    -webkit-appearance: none;
    appearance: none;
    width: 56px;
    padding: 4px 6px;
    font-size: var(--text-sm, 12px);
    font-family: inherit;
    background: var(--color-input-bg, var(--color-surface));
    border: 1.5px solid var(--color-border, rgba(0, 0, 0, 0.15));
    border-radius: 6px;
    color: inherit;
    text-align: center;
    flex: 0 0 auto;
}

.export-number-input:focus {
    outline: none;
    border-color: var(--color-accent, #6c63ff);
}

/* image format radios — compact inline version */
.radio-group--sm {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
}

.radio-group--sm .radio-option {
    padding: 3px 10px;
    font-size: var(--text-sm, 12px);
    min-height: unset;
    height: 26px;
    border-radius: 6px;
}

/* ── GIF inline checkbox options ── */
.gif-options-row {
    display: flex;
    gap: 14px;
    align-items: center;
}

.gif-options-row--select {
    gap: 8px;
}

.gif-option-label {
    font-size: var(--text-sm, 12px);
    font-weight: 500;
    color: var(--color-on-surface, #555);
    white-space: nowrap;
}

.gif-option-check {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: var(--text-sm, 12px);
    font-weight: 500;
    color: var(--color-on-surface, #555);
    cursor: pointer;
    white-space: nowrap;
}

.gif-option-check[hidden] {
    display: none !important;
}

.gif-option-check input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin: 0;
    -webkit-appearance: none;
    appearance: none;
    border: 2px solid color-mix(in srgb, var(--color-on-surface) 46%, transparent);
    border-radius: 6px;
    background: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
    flex-shrink: 0;
}

.gif-option-check input[type="checkbox"]::after {
    content: '';
    width: 8px;
    height: 5px;
    border-left: 2.5px solid #fff;
    border-bottom: 2.5px solid #fff;
    transform: rotate(-45deg) scale(0);
    transform-origin: center;
    transition: transform 120ms ease;
}

.gif-option-check input[type="checkbox"]:checked {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.gif-option-check input[type="checkbox"]:checked::after {
    transform: rotate(-45deg) scale(1);
}

.gif-option-check input[type="checkbox"]:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-primary) 42%, transparent);
}

/* ── Inline export section inside animation / image boxes ── */

.anim-export-inner,
.img-export-inner {
    display: flex;
    flex-direction: column;
    padding: 4px 0 0;
    gap: 6px;
}

.export-format-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.export-save-row {
    display: flex;
    justify-content: flex-end;
    padding-top: 6px;
}

.export-save-row .export-btn {
    flex: 1;
}

/* ── GIF type dropdown ── */

.gif-type-select {
    -webkit-appearance: none;
    appearance: none;
    padding: 0 2em 0 1em;
    min-height: 2.5em;
    font-size: var(--text-md);
    font-weight: 600;
    font-family: "Source Sans 3", system-ui, sans-serif;
    line-height: 1.2;
    background-color: var(--color-export);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.6em center;
    color: #fff;
    border: none;
    border-left: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 0 9999px 9999px 0;
    cursor: pointer;
    transition: background-color 0.15s;
}

.gif-type-select:hover {
    background-color: var(--color-export-hover);
}

.gif-type-select:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--palette-blueberry-300);
}

.gif-type-select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ── Controls bar footer (Reset settings) ── */

.controls-bar-footer {
    height: 0;
    padding: 0;
    overflow: visible;
}

#btnResetSettings {
    color: var(--color-label);
    border-color: var(--color-primary);
}

#btnResetSettings:hover {
    color: var(--palette-red-500);
    border-color: var(--palette-red-500);
}

.canvas-bottom-center {
    position: absolute;
    bottom: 16px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    align-items: end;
    padding: 0 16px;
    z-index: 5;
    pointer-events: none;
}

.canvas-bottom-center .ruler-hud {
    max-width: min(44vw, 430px);
}

.canvas-bottom-center .cam-nav-row {
    width: min(860px, calc(100vw - 200px));
    max-width: calc(100% - 24px);
}

.orbit-hint-bar {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 8px 8px 8px 16px;
    background: var(--palette-blueberry-100);
    border-radius: 9999px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.16), 0 1px 3px rgba(0, 0, 0, 0.08);
    pointer-events: auto;
}

.orbit-hint-bar.visible {
    display: inline-flex;
    position: absolute;
    left: 16px;
    pointer-events: auto;
}

@media (min-width: 900px) {
    .orbit-hint-bar.visible {
        position: absolute;
        left: 50%;
        bottom: calc(100% + 10px);
        transform: translateX(-50%);
        max-width: min(78vw, 720px);
        z-index: 7;
    }
}

.orbit-hint {
    margin: 0;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--palette-blueberry-800);
    font-family: "Source Sans 3", system-ui, sans-serif;
}

.orbit-hint-dismiss {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    border: none;
    background: rgba(30, 25, 62, 0.1);
    color: var(--palette-blueberry-800);
    border-radius: 50%;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s;
}

.orbit-hint-dismiss:hover {
    background: rgba(30, 25, 62, 0.2);
}

@media (max-width: 899px) {
    .canvas-bottom-center {
        bottom: calc(18px + env(safe-area-inset-bottom, 0px));
        align-items: end;
        padding: 0 10px;
    }

    .orbit-hint-bar.visible {
        position: static;
        left: auto;
        max-width: calc(100vw - 32px);
    }

    .orbit-hint-bar {
        padding: 7px 10px;
        border-radius: 16px;
    }

    .orbit-hint {
        white-space: normal;
        text-align: center;
        line-height: 1.25;
    }

    .orbit-hint-bar.visible+.cam-nav {
        margin-top: 12px;
    }

    .orbit-hint-bar.visible+.cam-nav-row {
        margin-top: 12px;
    }

    .canvas-bottom-center .cam-nav-row {
        width: 100%;
        max-width: calc(100vw - 24px);
    }
}

@media (min-width: 900px) and (max-width: 1180px),
(min-width: 900px) and (max-height: 820px) {
    .canvas-bottom-center {
        bottom: 72px;
    }

    .cam-nav {
        transform: none;
    }

    .cam-nav-row {
        transform: none;
    }

    .ruler-hud {
        max-width: min(44vw, 340px);
        gap: 5px;
        padding: 5px 8px;
    }

    .ruler-lines-text {
        display: none;
    }

    .ruler-lines-switch {
        margin-left: 2px;
    }

    .ruler-lines-ui {
        width: 46px;
        height: 28px;
    }

    .ruler-lines-ui::after {
        width: 22px;
        height: 22px;
    }

    .ruler-lines-input:checked+.ruler-lines-ui::after {
        transform: translateX(18px);
    }
}

.copy-link-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0.55em 1em;
    min-height: var(--control-height);
    font-size: var(--text-md);
    font-weight: 600;
    font-family: "Source Sans 3", system-ui, sans-serif;
    line-height: 1.2;
    color: var(--color-primary);
    background: transparent;
    border: 1px solid var(--color-primary);
    border-radius: var(--radius-control);
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    box-shadow: var(--shadow-soft);
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.copy-link-btn:hover {
    background: color-mix(in srgb, var(--color-primary) 6%, transparent);
    border-color: color-mix(in srgb, var(--palette-blueberry-300) 80%, white 20%);
}

.copy-link-btn:active {
    transform: scale(0.95);
}

.copy-link-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--palette-blueberry-300);
}

.copy-link-btn--secondary {
    color: var(--color-label, #666);
    border-color: var(--color-primary);
}

.copy-link-btn--secondary:hover {
    background: color-mix(in srgb, var(--color-label, #666) 6%, transparent);
    border-color: color-mix(in srgb, var(--palette-blueberry-300) 80%, white 20%);
}

.copy-link-btn--text-link {
    display: inline-block;
    min-height: 0;
    padding: 6px 12px;
    background: transparent;
    border: none;
    box-shadow: none;
    color: var(--color-primary);
    text-decoration: underline;
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    vertical-align: middle;
}

.copy-link-btn--text-link:hover {
    background: rgba(0, 0, 0, 0.05);
    border: none;
    color: var(--color-primary-darker);
}

.copy-link-btn--danger {
    color: #fff;
    background: var(--palette-red-500);
    border-color: color-mix(in srgb, var(--palette-red-500) 72%, #fff 28%);
}

.copy-link-btn--danger:hover {
    background: color-mix(in srgb, var(--palette-red-500) 92%, #000 8%);
    border-color: color-mix(in srgb, var(--palette-blueberry-300) 80%, white 20%);
}

.copy-link-btn--danger:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--palette-red-500) 38%, transparent);
}

#btnResetEverything {
    color: #fff;
    background: var(--palette-red-500);
    border-color: color-mix(in srgb, var(--palette-red-500) 72%, #fff 28%);
}

#btnResetEverything:hover {
    background: color-mix(in srgb, var(--palette-red-500) 92%, #000 8%);
    border-color: color-mix(in srgb, var(--palette-blueberry-300) 80%, white 20%);
}

#btnResetEverything:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--palette-red-500) 38%, transparent);
}

.copy-link-btn--export {
    color: #fff;
    background: var(--color-export);
    border-color: color-mix(in srgb, var(--color-export) 70%, #fff 30%);
    font-size: var(--text-lg);
    min-height: var(--control-height);
    padding: 0.55em 1.05em;
}

.copy-link-btn--export:hover {
    background: var(--color-export-hover);
    border-color: color-mix(in srgb, var(--palette-blueberry-300) 80%, white 20%);
}

html.none-mode .range-label {
    opacity: 0.38;
    pointer-events: none;
}

html.none-mode .loop-toggle-label {
    opacity: 0.38;
    pointer-events: none;
}

html.none-mode .rotation-group {
    opacity: 0.38;
    pointer-events: none;
}

/* ── Rotation thumbnail cards ── */

.rotation-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ── Section header row (label + power toggle) ── */

.section-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

/* ── Rotation power toggle (macOS-style) ── */

.rotation-power-toggle {
    cursor: pointer;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.rotation-power-toggle input[type="checkbox"] {
    display: none;
}

.rotation-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    background: var(--palette-blueberry-200);
    cursor: pointer;
    box-shadow: 0 0 0 2px transparent;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.rotation-option input[type="radio"] {
    display: none;
}

.rotation-option:has(input:checked) {
    border-color: white;
    box-shadow: 0 0 0 2px var(--primary-color);
}

.rotation-option:hover {
    border-color: var(--color-primary-lighter);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(46, 43, 116, 0.15);
}

.rotation-option:has(input:checked):hover {
    border-color: white;
    box-shadow: 0 0 0 2px var(--primary-color), 0 4px 10px rgba(46, 43, 116, 0.15);
    transform: translateY(-1px);
}

.rotation-thumb {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--palette-blueberry-500);
}

.rotation-thumb .rot-icon {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
}

.rotation-thumb-icon {
    width: 26px;
    height: 26px;
    object-fit: contain;
    display: block;
}

.rot-icon-svg {
    fill: currentColor;
    stroke: none;
}

/* ── Rotation hover demo animations ── */

@keyframes rot-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes rot-tilt {
    0% {
        transform: rotateX(0deg);
    }

    25% {
        transform: rotateX(-12deg);
    }

    75% {
        transform: rotateX(12deg);
    }

    100% {
        transform: rotateX(0deg);
    }
}

.rotation-option:hover .rotation-thumb--spin .rot-icon {
    animation: rot-spin 2.4s linear 3;
}

/* Keep hover preview direction aligned with runtime spin direction. */
html.spin-ccw .rotation-option:hover .rotation-thumb--spin .rot-icon {
    animation: rot-spin-ccw 2.4s linear 3;
}

html:not(.spin-ccw) .rotation-option:hover .rotation-thumb--spin .rot-icon {
    animation: rot-spin 2.4s linear 3;
}

@keyframes rot-spin-ccw {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(-360deg);
    }
}

.rotation-option:hover .rotation-thumb--tilt .rot-icon {
    animation: rot-tilt 1.4s ease-in-out 3;
}

@keyframes rot-wobble {
    0% {
        transform: rotateX(0deg) rotateY(0deg);
    }

    25% {
        transform: rotateX(-8deg) rotateY(90deg);
    }

    50% {
        transform: rotateX(0deg) rotateY(180deg);
    }

    75% {
        transform: rotateX(8deg) rotateY(270deg);
    }

    100% {
        transform: rotateX(0deg) rotateY(360deg);
    }
}

.rotation-option:hover .rotation-thumb--wobble .rot-icon {
    animation: rot-wobble 1.6s ease-in-out 3;
}

/* ── Theme transition ────────────────────────────────────────────────────────── */

html {
    transition: background-color 0.25s, color 0.25s;
}

.container,
.controls-bar,
.settings-panel,
.radio-option,
.color-option,
select {
    transition: background 0.25s, border-color 0.25s, color 0.2s;
}



/* ── Rotation re-click pause hint ── */

.preset-group .thumb-card-wrap {
    min-width: 0;
    max-width: 100%;
}

.preset-group .thumb-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    font-size: var(--text-sm);
    font-weight: 600;
    color: color-mix(in srgb, var(--color-on-surface) 80%, #000 20%);
}

.preset-add-slot {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px dashed var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    cursor: pointer;
}

.preset-add-slot:hover {
    border-color: var(--palette-blueberry-400);
    color: var(--palette-blueberry-500);
}

/* ── Advanced Settings (compact collapsible inside Theme box) ── */
.adv-settings {
    margin-top: 12px;
    border-top: 1px solid var(--border-color);
    padding-top: 4px;
}

.adv-settings>summary {
    cursor: pointer;
    font-size: var(--text-sm, 12px);
    font-weight: 600;
    color: var(--color-text-muted);
    outline: none;
    user-select: none;
    padding: 8px 0 4px;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 6px;
}

.adv-settings>summary::before {
    content: '›';
    display: inline-block;
    transition: transform 0.15s;
    font-size: 14px;
    line-height: 1;
}

.adv-settings[open]>summary::before {
    transform: rotate(90deg);
}

/* ── Programmatic selection state for preset thumbs ── */
.shading-option.is-selected {
    border-color: white;
    box-shadow: 0 0 0 2px var(--color-primary);
}

/* ── Model Sync thumbnails: no border unless selected ── */
#bg-preset-modelcolor,
#build-plate-preset-modelcolor {
    border: none !important;
    background-color: color-mix(in srgb, var(--palette-blueberry-100) 48%, white 52%) !important;
}

#bgPresetsBar .shading-option.is-selected #bg-preset-modelcolor,
#buildPlatePresetsBar .shading-option.is-selected #build-plate-preset-modelcolor {
    border: 2px solid var(--color-primary) !important;
}

/* ── Custom slot overwrite button ── */
.preset-save-btn {
    display: none;
    font-size: 9px;
    font-weight: 700;
    font-family: inherit;
    color: var(--color-primary);
    background: none;
    border: 1px solid var(--color-primary);
    border-radius: 4px;
    padding: 1px 5px;
    cursor: pointer;
    margin-top: 2px;
    white-space: nowrap;
    line-height: 1.4;
    transition: background 0.12s, color 0.12s;
}

.thumb-card-wrap:hover .preset-save-btn {
    display: block;
}

.preset-save-btn:hover {
    background: var(--color-primary);
    color: #fff;
}

/* ── Sidebar tabs ─────────────────────────────────────────────────────────── */

.sidebar-tabs {
    display: none;
    /* hidden until app loaded */
    flex-shrink: 0;
    border-bottom: none;
    background: var(--color-surface);
    padding: 10px 16px 0;
    position: sticky;
    top: 0;
    z-index: 9;
    gap: 4px;
    border-radius: var(--radius-card);
}

html.loaded .sidebar-tabs {
    display: flex;
}

.sidebar-tab {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    background: color-mix(in srgb, var(--palette-blueberry-100) 76%, #fff 24%);
    border: 1px solid color-mix(in srgb, var(--palette-blueberry-300) 56%, transparent);
    border-radius: 12px;
    padding: 10px 10px;
    font-size: var(--text-sm, 12px);
    font-weight: 600;
    color: var(--color-label);
    cursor: pointer;
    font-family: inherit;
    letter-spacing: 0.01em;
    transition: color 0.12s, border-color 0.12s;
}

.sidebar-tab-icon {
    width: 16px;
    height: 16px;
    opacity: 0.82;
    flex-shrink: 0;
}

.sidebar-tab.is-active .sidebar-tab-icon {
    opacity: 1;
}

.sidebar-tab.is-active {
    color: #fff;
    border-color: color-mix(in srgb, var(--color-primary) 70%, #fff 30%);
    background: linear-gradient(180deg, color-mix(in srgb, var(--color-primary) 86%, #fff 14%), color-mix(in srgb, var(--color-primary) 94%, #000 6%));
    box-shadow: var(--shadow-soft);
}

.sidebar-tab:hover:not(.is-active) {
    color: var(--color-on-surface, var(--color-text));
    border-color: color-mix(in srgb, var(--palette-blueberry-400) 62%, transparent);
}

.app-settings-dock {
    margin-top: 14px;
    border: 1px solid color-mix(in srgb, var(--palette-blueberry-300) 52%, transparent);
    border-radius: var(--radius-card);
    background: var(--color-surface-raised);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

.app-settings-toggle {
    width: 100%;
    min-height: 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 18px;
    border: none;
    background: transparent;
    color: var(--color-on-surface);
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.3px;
    cursor: pointer;
    outline: none;
}

.app-settings-toggle-chevron {
    width: 30px;
    min-width: 30px;
    height: 30px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    border-radius: 9px;
    background: color-mix(in srgb, var(--surface-elev) 88%, #fff 12%);
    color: var(--color-on-surface);
    transition: transform 0.16s ease;
}

.app-settings-toggle-chevron svg {
    width: 18px;
    height: 18px;
    display: block;
}

.app-settings-dock.is-collapsed .app-settings-toggle-chevron {
    transform: rotate(-90deg);
}

.app-settings-toggle:focus,
.app-settings-toggle:active {
    outline: none;
    box-shadow: none;
}

.app-settings-toggle:focus-visible {
    outline: none;
    box-shadow: none;
}

.app-settings-dock-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 0 12px 12px;
}

.app-settings-dock-body[hidden] {
    display: none !important;
}

.app-settings-dock[hidden],
.app-settings-dock[hidden] * {
    display: none !important;
}

.app-settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    z-index: 999;
    pointer-events: none;
    display: block;
}

.app-settings-overlay[hidden] {
    display: none !important;
}

.app-settings-panel {
    position: fixed;
    max-width: 360px;
    min-width: 340px;
    max-height: 80vh;
    overflow-y: auto;
    pointer-events: auto;
    border-radius: var(--radius-card);
    background: var(--color-surface-raised);
    box-shadow: var(--shadow-card);
}

.app-settings-panel-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px;
}

.app-settings-actions-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.sidebar-brand-row {
    display: none;
}

.sidebar-brand-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-logo--icon {
    display: none;
}

#desktopRightRailBg {
    display: none;
}

.fine-tuning-row--dock {
    margin: 0;
    padding-top: 4px;
}

.fine-tuning-row--dock .gif-option-check {
    margin-top: 4px;
}

.app-settings-reset-btn {
    width: fit-content;
    margin-top: 4px;
}

.app-settings-danger-row {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 2px;
}

.app-settings-inline-group {
    display: grid;
    gap: 8px;
    padding: 2px 2px 4px;
}

.app-settings-unit-row {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    column-gap: 0;
}

.app-settings-segmented {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
    padding: 4px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--color-surface-raised) 74%, #d7d6e6 26%);
}

.app-settings-segmented-btn {
    border: 1px solid transparent;
    border-radius: 999px;
    min-height: 42px;
    background: transparent;
    color: var(--color-label);
    font-size: var(--text-md);
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.app-settings-segmented-btn:hover {
    border-color: color-mix(in srgb, var(--palette-blueberry-300) 80%, white 20%);
}

.app-settings-segmented-btn.is-active {
    border-color: color-mix(in srgb, var(--border-color) 76%, #fff 24%);
    background: #ffffff;
    color: var(--color-on-surface);
}

.app-settings-inline-help {
    margin: 0;
    font-size: 12px;
    line-height: 1.35;
    color: var(--color-label);
}

.app-settings-inline-label {
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--color-on-surface);
}

.app-settings-select {
    width: 100%;
    min-height: 36px;
}

.app-settings-inline-custom-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.app-settings-inline-custom-row[hidden] {
    display: none !important;
}

.app-settings-number {
    min-width: 0;
    width: 100%;
}

.app-settings-inline-sep,
.app-settings-inline-unit {
    font-size: var(--text-sm);
    color: var(--color-label);
    font-weight: 600;
}

.export-panel-package-row {
    margin-top: 4px;
}

.export-panel-package-row .copy-link-btn {
    width: 100%;
    justify-content: center;
}

.export-primary-row {
    margin-top: 2px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.export-primary-row .export-btn {
    flex: 1 1 170px;
    width: auto;
    min-height: 52px;
    font-size: var(--text-lg);
    justify-content: center;
}

.export-primary-row .export-close-inline {
    flex: 1 1 auto;
    min-height: 52px;
    min-width: 0;
    padding: 0 12px;
    font-weight: 700;
    justify-content: center;
}

.export-primary-row .export-copy-inline {
    flex: 1 1 auto;
    min-height: 52px;
    min-width: 0;
    padding: 0 12px;
    font-weight: 700;
    justify-content: center;
}

.export-primary-row .export-copy-inline svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.export-primary-row .copy-link-btn--secondary {
    color: var(--color-primary);
}

.export-primary-row .copy-link-btn {
    box-shadow: none;
}

.export-environment-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.export-collapsed-confirm-overlay {
    align-items: center;
    justify-content: center;
    padding: 14px;
}

.export-collapsed-confirm-panel {
    width: min(440px, calc(100vw - 28px));
}

.export-collapsed-confirm-body {
    gap: 12px;
    padding: 14px 16px 16px;
}

.export-collapsed-confirm-text {
    margin: 0;
    color: var(--color-label);
    font-size: var(--text-sm);
    line-height: 1.45;
}

.export-collapsed-confirm-summary {
    display: grid;
    gap: 8px;
}

.export-collapsed-confirm-card {
    border: 1px solid color-mix(in srgb, var(--border-color) 85%, transparent 15%);
    border-radius: 10px;
    background: color-mix(in srgb, var(--color-surface-raised) 88%, #fff 12%);
    padding: 0;
    overflow: hidden;
}

.export-collapsed-confirm-card-summary {
    list-style: none;
    cursor: pointer;
    display: grid;
    gap: 4px;
    padding: 10px 12px;
}

.export-collapsed-confirm-card-summary::-webkit-details-marker {
    display: none;
}

.export-collapsed-confirm-card-title {
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--color-on-surface);
}

.export-collapsed-confirm-card-meta {
    font-size: 12px;
    color: color-mix(in srgb, var(--color-label) 88%, transparent 12%);
    line-height: 1.35;
}

.export-collapsed-confirm-list {
    border-top: 1px solid color-mix(in srgb, var(--border-color) 86%, transparent 14%);
    padding: 10px 12px;
    display: grid;
    gap: 8px;
}

.export-collapsed-confirm-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    font-size: var(--text-sm);
    color: var(--color-on-surface);
}

.export-collapsed-confirm-row span:first-child {
    opacity: 0.75;
}

.export-collapsed-confirm-row--check {
    user-select: none;
}

.export-collapsed-confirm-control {
    width: auto;
    min-width: 152px;
    margin: 0;
}

.export-collapsed-confirm-row input[type="range"] {
    width: 170px;
}

.export-collapsed-confirm-row input[type="checkbox"] {
    width: 20px;
    height: 20px;
}

.export-collapsed-confirm-check {
    margin-top: 2px;
}

.export-collapsed-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.upload-choice-overlay {
    align-items: center;
    justify-content: center;
    padding: 14px;
}

.upload-choice-panel {
    width: min(520px, calc(100vw - 28px));
}

.upload-choice-body {
    gap: 14px;
    padding: 14px 16px 16px;
}

.upload-choice-text {
    margin: 0;
    color: var(--color-label);
    font-size: var(--text-sm);
    line-height: 1.45;
}

.upload-choice-step {
    display: grid;
    gap: 8px;
}

.upload-choice-step[hidden] {
    display: none !important;
}

.upload-choice-step-label {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: color-mix(in srgb, var(--palette-blueberry-700) 82%, transparent);
}

.upload-choice-dropzone {
    width: 100%;
    min-height: 112px;
    border-radius: 12px;
    border: 2px dashed color-mix(in srgb, var(--palette-blueberry-500) 62%, transparent 38%);
    background: color-mix(in srgb, var(--palette-blueberry-100) 64%, #fff 36%);
    color: var(--color-on-surface);
    display: grid;
    place-items: center;
    gap: 6px;
    text-align: center;
    padding: 14px;
    cursor: pointer;
    transition: border-color 0.14s ease, background 0.14s ease, transform 0.14s ease;
}

.upload-choice-dropzone:hover,
.upload-choice-dropzone.is-dragover {
    border-color: var(--palette-blueberry-600);
    background: color-mix(in srgb, var(--palette-blueberry-100) 50%, #fff 50%);
}

.upload-choice-dropzone:active {
    transform: scale(0.995);
}

.upload-choice-dropzone-title {
    font-size: var(--text-md);
    font-weight: 700;
}

.upload-choice-dropzone-sub {
    font-size: var(--text-sm);
    color: var(--color-label);
}

.upload-choice-browse-link {
    text-decoration: underline;
    text-underline-offset: 2px;
    font-weight: 700;
}

.upload-choice-file-list-wrap {
    border: 1px solid color-mix(in srgb, var(--palette-blueberry-300) 68%, white 32%);
    border-radius: 10px;
    background: color-mix(in srgb, #fff 90%, var(--palette-blueberry-100) 10%);
    padding: 8px;
    display: grid;
    gap: 8px;
}

.upload-choice-file-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 6px;
}

.upload-choice-file-item {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) 28px;
    align-items: center;
    gap: 8px;
    border: 1px solid color-mix(in srgb, var(--palette-blueberry-200) 65%, white 35%);
    border-radius: 8px;
    background: color-mix(in srgb, #fff 86%, var(--palette-blueberry-100) 14%);
    padding: 6px 8px;
}

.upload-choice-file-index {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.03em;
    color: color-mix(in srgb, var(--palette-blueberry-700) 74%, transparent);
}

.upload-choice-file-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-on-surface);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.upload-choice-file-remove {
    width: 24px;
    height: 24px;
    border: 1px solid color-mix(in srgb, var(--palette-blueberry-300) 66%, white 34%);
    border-radius: 999px;
    background: color-mix(in srgb, #fff 90%, var(--palette-blueberry-100) 10%);
    color: var(--palette-blueberry-600);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
    transition: border-color 0.14s ease, background 0.14s ease, color 0.14s ease;
}

.upload-choice-file-remove:hover {
    border-color: var(--palette-blueberry-500);
    background: color-mix(in srgb, var(--palette-blueberry-100) 62%, #fff 38%);
    color: var(--palette-blueberry-800);
}

.upload-choice-show-more {
    justify-self: flex-start;
    border: none;
    background: transparent;
    color: var(--palette-blueberry-600);
    font-size: 12px;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
    padding: 0;
    cursor: pointer;
}

.upload-choice-show-more[hidden] {
    display: none !important;
}

.upload-choice-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.upload-choice-action-btn {
    min-width: 136px;
    height: 42px;
    justify-content: center;
    padding: 10px 16px;
}

.upload-choice-actions-right {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: nowrap;
}

.upload-choice-actions-right[hidden] {
    display: none !important;
}

.upload-choice-action-btn--add {
    border-color: color-mix(in srgb, var(--palette-blueberry-600) 72%, transparent 28%);
    color: var(--palette-blueberry-700);
    background: color-mix(in srgb, #fff 86%, var(--palette-blueberry-100) 14%);
}

.upload-choice-action-btn--add:hover {
    border-color: var(--palette-blueberry-600);
    background: color-mix(in srgb, #fff 76%, var(--palette-blueberry-100) 24%);
    color: var(--palette-blueberry-800);
}

.upload-choice-action-btn--add:active {
    transform: translateY(1px);
}

html.theme-dark .upload-choice-dropzone {
    border-color: rgba(179, 168, 247, 0.5);
    background: rgba(40, 34, 76, 0.52);
    color: var(--palette-blueberry-100);
}

html.theme-dark .upload-choice-dropzone:hover,
html.theme-dark .upload-choice-dropzone.is-dragover {
    border-color: rgba(222, 214, 255, 0.76);
    background: rgba(56, 48, 104, 0.64);
}

html.theme-dark .upload-choice-dropzone-sub {
    color: var(--palette-blueberry-200);
}

html.theme-dark .upload-choice-step-label {
    color: var(--palette-blueberry-200);
}

html.theme-dark .upload-choice-file-list-wrap {
    border-color: rgba(179, 168, 247, 0.46);
    background: rgba(40, 34, 76, 0.52);
}

html.theme-dark .upload-choice-file-item {
    border-color: rgba(179, 168, 247, 0.4);
    background: rgba(56, 48, 104, 0.38);
}

html.theme-dark .upload-choice-file-remove {
    border-color: rgba(179, 168, 247, 0.5);
    background: rgba(56, 48, 104, 0.52);
    color: var(--palette-blueberry-200);
}

html.theme-dark .upload-choice-file-remove:hover {
    border-color: rgba(222, 214, 255, 0.76);
    background: rgba(86, 74, 145, 0.54);
    color: #ffffff;
}

html.theme-dark .upload-choice-file-index {
    color: var(--palette-blueberry-200);
}

html.theme-dark .upload-choice-action-btn--add {
    border-color: rgba(179, 168, 247, 0.7);
    color: #e7e2ff;
    background: rgba(52, 44, 102, 0.5);
}

html.theme-dark .upload-choice-action-btn--add:hover {
    border-color: rgba(222, 214, 255, 0.84);
    background: rgba(76, 65, 140, 0.62);
    color: #ffffff;
}

html.theme-dark .upload-choice-show-more {
    color: #d3ccff;
}

@media (max-width: 560px) {
    .upload-choice-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .upload-choice-actions-right {
        margin-left: 0;
        width: 100%;
        justify-content: stretch;
    }

    .upload-choice-actions-right>button {
        flex: 1 1 auto;
    }

    .upload-choice-action-btn {
        min-width: 0;
    }
}

html.loaded.layout-mobile-accordion .sidebar-tabs {
    display: flex !important;
}

html.loaded.layout-mobile-accordion .mobile-panel-toggle {
    display: none !important;
}

.mobile-panel-toggle {
    display: none;
    width: 100%;
    min-height: 44px;
    border: 1px solid color-mix(in srgb, var(--palette-blueberry-300) 52%, transparent);
    border-radius: 12px;
    background: color-mix(in srgb, var(--palette-blueberry-100) 78%, #fff 22%);
    color: var(--color-on-surface);
    font-size: var(--text-md);
    font-weight: 700;
    text-align: left;
    padding: 0 14px;
    cursor: pointer;
}

.mobile-panel-toggle[aria-expanded="true"] {
    border-color: color-mix(in srgb, var(--color-primary) 70%, #fff 30%);
    box-shadow: var(--shadow-soft);
}

html.loaded.layout-mobile-accordion .mobile-panel-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
}

html.loaded.layout-mobile-accordion .tab-panel {
    gap: 10px;
}

html.loaded.layout-tablet-tabs .canvas-top-right {
    display: none !important;
}

html.loaded.layout-mobile-accordion .canvas-top-right {
    display: flex !important;
    left: auto;
    right: 12px;
    top: 12px;
    max-width: none;
    z-index: 44;
}

html.loaded.layout-mobile-accordion .canvas-top-right> :not(.canvas-utility-icons) {
    display: none !important;
}

html.loaded.layout-mobile-accordion .canvas-top-right .canvas-utility-icons {
    display: inline-flex !important;
    gap: 8px;
}

html.loaded.layout-mobile-accordion .canvas-top-right .canvas-utility-btn {
    width: 36px;
    height: 36px;
}

html.loaded.layout-mobile-accordion .canvas-top-right .canvas-utility-btn.sidepanel-toggle-btn,
html.loaded.layout-mobile-accordion .canvas-top-right .canvas-utility-btn#btnAppSettingsCanvas {
    display: inline-flex;
}

html.loaded.layout-mobile-accordion.sidepanels-hidden .sidebar,
html.loaded.layout-tablet-tabs.sidepanels-hidden .sidebar {
    display: none !important;
}

html.loaded.layout-mobile-accordion.sidepanels-hidden main,
html.loaded.layout-tablet-tabs.sidepanels-hidden main {
    flex: 1 1 auto;
    min-height: 100dvh;
}

html.loaded.layout-mobile-accordion .canvas-logo,
html.loaded.layout-tablet-tabs .canvas-logo {
    display: none !important;
}

html.loaded.layout-mobile-accordion .sidebar-header,
html.loaded.layout-tablet-tabs .sidebar-header {
    display: none !important;
}

html.loaded.layout-mobile-accordion .sidebar-brand-row,
html.loaded.layout-tablet-tabs .sidebar-brand-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    padding: 12px 12px 8px;
    background: var(--color-surface);
    min-width: 0;
}

html.loaded.layout-mobile-accordion .sidebar-brand-actions,
html.loaded.layout-tablet-tabs .sidebar-brand-actions {
    margin-left: auto;
    flex: 0 0 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 8px;
}

html.loaded.layout-mobile-accordion .sidebar-brand-actions .sidebar-upload-btn,
html.loaded.layout-mobile-accordion .sidebar-brand-actions .copy-link-btn--export,
html.loaded.layout-tablet-tabs .sidebar-brand-actions .sidebar-upload-btn,
html.loaded.layout-tablet-tabs .sidebar-brand-actions .copy-link-btn--export {
    width: auto;
    flex: 0 0 auto;
    min-width: 0;
    justify-content: center;
    font-size: var(--text-md);
}

html.loaded.layout-mobile-accordion .sidebar-brand-actions .sidebar-upload-btn svg,
html.loaded.layout-mobile-accordion .sidebar-brand-actions .copy-link-btn--export svg,
html.loaded.layout-tablet-tabs .sidebar-brand-actions .sidebar-upload-btn svg,
html.loaded.layout-tablet-tabs .sidebar-brand-actions .copy-link-btn--export svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

html.loaded.layout-mobile-accordion .sidebar-brand-actions .sidebar-upload-btn span,
html.loaded.layout-tablet-tabs .sidebar-brand-actions .sidebar-upload-btn span {
    white-space: nowrap;
}

html.loaded.layout-tablet-tabs .sidebar,
html.loaded.layout-mobile-accordion .sidebar {
    order: 0;
    border-right: 1px solid var(--border-color);
    border-left: none;
}

html.loaded.layout-mobile-accordion .app-body {
    flex-direction: column;
}

html.loaded.layout-mobile-accordion main {
    order: 0;
    flex: 0 0 48vh;
}

html.loaded.layout-mobile-accordion .sidebar {
    order: 1;
}

html.loaded.layout-mobile-accordion .sidebar-brand-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

html.loaded.layout-mobile-accordion .sidebar-brand-actions .info-icon-btn,
html.loaded.layout-tablet-tabs .sidebar-brand-actions .info-icon-btn {
    width: 100%;
    justify-content: center;
}

#environmentBox .bg-toggle-row:has(#autoBgCheck:checked)~.control-label:has(#bgOpacitySlider) {
    display: none !important;
}

#buildPlateControls .bg-toggle-row:has(#buildPlateAutoBrightness:checked)~.control-label:has(#buildPlateShadeSlider) {
    display: none !important;
}

@media (min-width: 1200px) {
    html.loaded.layout-v2-desktop .sidebar-edge-tab {
        display: none !important;
    }

    html.loaded.layout-v2-desktop.sidebar-collapsed:not(.sidepanels-hidden) .sidebar {
        width: clamp(340px, 28vw, 460px) !important;
        border-right: 1px solid var(--border-color);
    }

    html.loaded.layout-v2-desktop .sidebar-tabs {
        display: none !important;
    }

    html.loaded.layout-v2-desktop .mobile-panel-toggle {
        display: none !important;
    }

    html.loaded.layout-v2-desktop .sidebar {
        order: -1;
        width: clamp(340px, 28vw, 460px);
        border-left: none;
        border-right: 1px solid var(--border-color);
        background: var(--color-surface);
        overflow-y: auto;
        overflow-x: hidden;
    }

    html.loaded.layout-v2-desktop .sidebar-header {
        display: none !important;
    }

    html.loaded.layout-v2-desktop .sidebar-brand-row {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        gap: 10px;
        padding: 14px 20px 8px;
        background: var(--color-surface);
        min-width: 0;
    }

    html.loaded.layout-v2-desktop .sidebar-logo {
        height: 50px;
        width: auto;
        flex-shrink: 0;
    }

    html.loaded.layout-v2-desktop .sidebar-upload-btn {
        min-height: 40px;
        padding: 0.5em 0.9em;
        border-radius: 14px;
    }

    html.loaded.layout-v2-desktop .sidebar-brand-actions {
        margin-left: auto;
        flex: 0 0 auto;
        min-width: 0;
        display: flex;
        align-items: center;
        justify-content: flex-end;
        flex-wrap: nowrap;
        gap: 8px;
    }

    html.loaded.layout-v2-desktop .sidebar-brand-actions .sidebar-upload-btn,
    html.loaded.layout-v2-desktop .sidebar-brand-actions .copy-link-btn--export {
        width: auto;
        flex: 0 0 auto;
        min-width: 0;
        justify-content: center;
    }

    html.loaded.layout-v2-desktop .sidebar-brand-actions .copy-link-btn--export {
        min-height: 40px;
        padding: 0.5em 0.95em;
        border-radius: 14px;
        font-size: var(--text-md);
    }

    html.loaded.layout-v2-desktop .canvas-logo,
    html.loaded.layout-v2-desktop .canvas-top-right {
        display: none !important;
    }

    html.loaded.layout-v2-desktop .canvas-top-right {
        display: flex !important;
        top: 16px;
        right: 16px;
        left: auto;
        z-index: 44;
        max-width: none;
    }

    html.loaded.layout-v2-desktop .canvas-top-right> :not(.canvas-utility-icons) {
        display: none !important;
    }

    html.loaded.layout-v2-desktop .canvas-top-right .canvas-utility-icons {
        display: inline-flex !important;
        gap: 8px;
    }

    html.loaded.layout-v2-desktop .canvas-top-right .canvas-utility-btn {
        width: 36px;
        height: 36px;
    }

    html.loaded.layout-v2-desktop .canvas-top-right .canvas-utility-btn.sidepanel-toggle-btn,
    html.loaded.layout-v2-desktop .canvas-top-right .canvas-utility-btn#btnAppSettingsCanvas {
        display: inline-flex;
    }

    html.loaded.layout-v2-desktop #desktopRightRailBg {
        display: block;
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: calc(clamp(320px, 24vw, 420px) + 32px);
        background: var(--color-surface);
        border-left: 1px solid var(--border-color);
        z-index: 36;
        pointer-events: none;
    }

    html.loaded.layout-v2-desktop main {
        margin-right: calc(clamp(320px, 24vw, 420px) + 32px);
    }

    html.loaded.layout-v2-desktop .tab-panel--theme {
        display: flex !important;
        padding: 4px 8px 10px 8px;
    }

    html.loaded.layout-v2-desktop .tab-panel--effects {
        display: flex !important;
        position: fixed;
        top: var(--desktop-v2-effects-top, 310px);
        right: 16px;
        width: calc(clamp(320px, 24vw, 420px));
        max-height: var(--desktop-v2-effects-max-height, calc(100vh - 220px));
        overflow-x: visible;
        overflow-y: auto;
        scrollbar-gutter: auto;
        z-index: 40;
        padding: 6px 16px 40px 10px;
    }

    html.loaded.layout-v2-desktop .tab-panel--effects .controls-section-box {
        overflow: visible;
        box-shadow: 0 12px 26px rgba(20, 18, 43, 0.12);
    }

    html.loaded.layout-v2-desktop.sidepanels-hidden .sidebar {
        width: 0 !important;
        border-right: none !important;
        overflow: hidden;
    }

    html.loaded.layout-v2-desktop.sidepanels-hidden main {
        margin-right: 0;
    }

    html.loaded.layout-v2-desktop.sidepanels-hidden #desktopRightRailBg,
    html.loaded.layout-v2-desktop.sidepanels-hidden .tab-panel--effects {
        display: none !important;
    }

    html.loaded.layout-v2-desktop .tab-panel--effects[hidden] {
        display: none !important;
    }

    html.loaded.layout-v2-desktop .export-overlay {
        position: fixed;
        inset: 0;
        z-index: 90;
        display: flex;
        align-items: flex-start;
        justify-content: flex-start;
        padding: 14px;
        background: transparent;
        pointer-events: none;
    }

    html.loaded.layout-v2-desktop .export-overlay[hidden] {
        display: none;
    }

    html.loaded.layout-v2-desktop .export-modal-panel {
        width: min(380px, calc(100vw - 28px));
        height: auto;
        max-height: calc(100vh - 24px);
        overflow: hidden;
        pointer-events: auto;
        border: 1px solid color-mix(in srgb, var(--palette-blueberry-300) 52%, transparent);
        background: color-mix(in srgb, var(--color-surface-raised) 92%, transparent);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        box-shadow: 0 24px 64px rgba(12, 10, 33, 0.3);
    }

    html.loaded.layout-v2-desktop.export-workspace-active .export-overlay {
        align-items: stretch;
        justify-content: center;
        padding: 0;
        background: transparent;
        pointer-events: none;
    }

    html.loaded.layout-v2-desktop.export-workspace-active .sidebar,
    html.loaded.layout-v2-desktop.export-workspace-active .tab-panel--effects,
    html.loaded.layout-v2-desktop.export-workspace-active #desktopRightRailBg {
        display: none !important;
    }

    html.loaded.layout-v2-desktop.export-workspace-active main {
        display: block;
        margin-right: 0;
    }

    html.loaded.layout-v2-desktop.export-workspace-active .canvas-wrap {
        width: 100vw;
        max-width: none;
        height: 100vh;
        margin-inline: 0;
    }

    html.loaded.layout-v2-desktop.export-workspace-active .export-modal-panel {
        width: min(360px, calc(100vw - 24px));
        height: auto;
        max-height: calc(100vh - 28px);
        overflow: visible;
        position: fixed;
        left: max(12px, calc(50vw - min(42vw, 520px) - 360px));
        top: max(12px, calc(50vh - 300px));
        transform: none;
        pointer-events: auto;
        background: color-mix(in srgb, var(--color-surface-raised) 90%, transparent);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        box-shadow: 0 24px 64px rgba(12, 10, 33, 0.3);
    }

    html.loaded.layout-v2-desktop.export-workspace-active .export-modal-body {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 12px 12px 14px;
        overflow-y: auto;
        max-height: calc(100vh - 92px);
        flex: 0 1 auto;
    }

    html.loaded.layout-v2-desktop.export-workspace-active .canvas-top-right,
    html.loaded.layout-v2-desktop.export-workspace-active .canvas-overlay-tl,
    html.loaded.layout-v2-desktop.export-workspace-active .canvas-overlay-bl,
    html.loaded.layout-v2-desktop.export-workspace-active .orbit-hint-bar {
        display: none !important;
    }

    html.loaded.layout-v2-desktop.export-workspace-active .canvas-overlay-br {
        display: flex !important;
    }

    html.loaded.layout-v2-desktop.export-workspace-active .canvas-bottom-center {
        display: flex !important;
        bottom: 14px;
        z-index: 96;
        pointer-events: none;
    }

    html.loaded.layout-v2-desktop.export-workspace-active .cam-nav {
        display: grid !important;
        transform: none;
        margin: 0;
        pointer-events: auto;
    }

    html.loaded.layout-v2-desktop.export-workspace-active #btnAppSettingsCanvas {
        display: none !important;
    }

    html.loaded.layout-v2-desktop .settings-panel-header {
        padding: 12px 16px 10px;
    }

    html.loaded.layout-v2-desktop .settings-panel-header {
        gap: 8px;
    }

    html.loaded.layout-v2-desktop .export-modal-body {
        max-width: none;
        margin: 0;
        padding: 10px;
    }

    html.loaded.layout-v2-desktop .settings-divider {
        display: none;
    }

    html.loaded.layout-v2-desktop .settings-overlay.help-overlay .settings-divider {
        display: block;
        background: color-mix(in srgb, var(--palette-blueberry-300) 58%, transparent);
        margin: 6px 14px;
    }

    html.loaded.layout-v2-desktop #btnOpenExportModal {
        display: inline-flex;
    }

    html.loaded.layout-v2-desktop #appSettingsDock {
        position: fixed;
        right: 16px;
        bottom: 16px;
        top: auto;
        width: clamp(320px, 24vw, 420px);
        z-index: 55;
        margin-top: 0;
    }

    html.loaded.layout-v2-desktop .sidebar-footer-actions {
        justify-content: flex-start;
        margin-top: 0;
    }

    html.loaded.layout-v2-desktop #btnThemeToggleRail {
        min-height: 34px;
        padding: 0.35em 0.8em;
    }

    html.loaded.layout-v2-desktop .info-btn-row {
        display: none;
    }

    html.loaded.layout-v2-desktop .canvas-overlay-br {
        right: 16px;
    }

    html.loaded.layout-v2-desktop .canvas-overlay-bl {
        display: none;
    }
}

@media (min-width: 1200px) and (max-width: 1799px) {
    html.loaded.layout-v2-desktop .sidebar-brand-row {
        gap: 8px;
        padding: 12px 14px 8px;
    }

    html.loaded.layout-v2-desktop .sidebar-logo--wordmark {
        display: block;
        height: clamp(34px, 2.8vw, 46px);
        width: auto;
        max-width: min(180px, 48%);
        object-fit: contain;
        flex: 0 1 auto;
    }

    html.loaded.layout-v2-desktop .sidebar-logo--icon {
        display: none;
    }

    html.loaded.layout-v2-desktop .sidebar-upload-btn {
        flex: 1 1 auto;
        min-width: 0;
        padding: 0.5em 0.75em;
    }

    html.loaded.layout-v2-desktop .sidebar-upload-btn span {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    html.loaded.layout-v2-desktop .sidebar-brand-actions .copy-link-btn--export {
        flex: 1 1 auto;
        min-width: 0;
        padding: 0.5em 0.8em;
    }
}

@media (min-width: 1200px) and (max-width: 1320px) {
    html.loaded.layout-v2-desktop .sidebar-logo--wordmark {
        display: none;
    }

    html.loaded.layout-v2-desktop .sidebar-logo--icon {
        display: block;
        width: 40px;
        min-width: 40px;
        height: 40px;
        object-fit: contain;
        flex: 0 0 40px;
    }
}

@media (max-width: 1399px) {
    #btnAppSettingsCanvas {
        display: inline-flex !important;
    }
}

@media (min-width: 1200px) {
    html.loaded.layout-v2-desktop.export-workspace-active .export-modal-panel {
        display: inline-flex;
        height: fit-content;
        min-height: 0;
    }

    html.loaded.layout-v2-desktop.export-workspace-active .export-modal-body {
        flex: 0 0 auto;
    }
}

html.loaded.layout-v2-desktop .ruler-hud {
    top: auto;
    left: 16px;
    bottom: 14px;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 20px;
    max-width: min(34vw, 430px);
    background: color-mix(in srgb, var(--palette-blueberry-100) 26%, white 74%);
    border: 1px solid color-mix(in srgb, var(--palette-blueberry-300) 44%, transparent);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: 0 10px 24px rgba(20, 18, 43, 0.1);
}

html.loaded.layout-v2-desktop .ruler-hud.is-dims-hidden {
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
    max-width: none;
}

html.loaded.layout-v2-desktop .ruler-sep,
html.loaded.layout-v2-desktop .ruler-unit,
html.loaded.layout-v2-desktop .ruler-lines-text {
    color: var(--palette-blueberry-400);
}

html.loaded.layout-v2-desktop .ruler-axis {
    color: var(--palette-blueberry-400);
    font-size: 10px;
}

html.loaded.layout-v2-desktop .ruler-val {
    color: var(--color-on-surface);
    font-size: 20px;
    font-weight: 700;
    line-height: 1;
}

html.loaded.layout-v2-desktop .ruler-unit-toggle {
    padding: 5px 12px;
    font-size: 11px;
    background: var(--palette-blueberry-500);
    border-color: var(--palette-blueberry-500);
    color: #fff;
}

html.loaded.layout-v2-desktop .ruler-part-hover-toggle,
html.loaded.layout-v2-desktop .ruler-part-select-toggle {
    width: 52px;
    height: 52px;
    padding: 0;
    border-color: rgba(74, 67, 145, 0.18);
    background: #fff;
    color: color-mix(in srgb, var(--palette-blueberry-500) 62%, white);
}

html.loaded.layout-v2-desktop .ruler-mode-picker {
    padding: 0;
    gap: 10px;
    border-color: transparent;
    background: transparent;
}

html.loaded.layout-v2-desktop .ruler-part-hover-toggle.is-active,
html.loaded.layout-v2-desktop .ruler-part-select-toggle.is-active {
    background: var(--palette-blueberry-200);
    border-color: var(--palette-blueberry-500);
    color: var(--palette-blueberry-500);
}

html.loaded.layout-v2-desktop .ruler-lines-switch {
    margin-left: auto;
    color: var(--palette-blueberry-400);
}

html.loaded.layout-v2-desktop .ruler-lines-ui {
    width: 50px;
    height: 30px;
    background: rgba(141, 138, 183, 0.42);
    border-color: rgba(111, 104, 174, 0.42);
}

html.loaded.layout-v2-desktop .ruler-lines-ui::after {
    width: 24px;
    height: 24px;
    top: 2px;
    left: 2px;
    background: #fff;
}

html.loaded.layout-v2-desktop .ruler-lines-input:checked+.ruler-lines-ui {
    background: #8c88b2;
}

html.loaded.layout-v2-desktop .ruler-lines-input:checked+.ruler-lines-ui::after {
    transform: translateX(22px);
}

/* ── Tab panels ── */

.tab-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.tab-panel[hidden] {
    display: none;
}

html.loaded.export-workspace-active .sidebar {
    display: none !important;
    transition: none !important;
}

html.loaded.export-workspace-active .controls-bar,
html.loaded.export-workspace-active .sidebar-header,
html.loaded.export-workspace-active .sidebar-brand-row,
html.loaded.export-workspace-active .sidebar-edge-tab,
html.loaded.export-workspace-active #desktopRightRailBg {
    display: none !important;
}

html.loaded.export-workspace-active main {
    flex: 1;
    min-height: 0;
}

html.export-workspace-active body {
    overflow: hidden;
}

html.loaded.export-workspace-active main,
html.loaded.export-workspace-active #viewerSection,
html.loaded.export-workspace-active .viewer-section,
html.loaded.export-workspace-active .canvas-wrap {
    min-height: 100vh;
    height: 100vh;
}

.export-overlay {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 12px;
    background: transparent;
    pointer-events: none;
}

.export-overlay[hidden] {
    display: none;
}

.export-modal-panel {
    position: fixed;
    left: 14px;
    top: 14px;
    width: min(380px, calc(100vw - 28px));
    height: auto;
    max-height: calc(100vh - 24px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    pointer-events: auto;
    box-shadow: 0 24px 64px rgba(12, 10, 33, 0.3);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.export-workspace-active .export-modal-panel {
    width: min(380px, calc(100vw - 28px)) !important;
    height: auto !important;
    max-height: calc(100vh - 24px) !important;
    border-radius: 22px;
    overflow: visible;
    pointer-events: auto;
    box-shadow: 0 30px 80px rgba(10, 9, 19, 0.28);
    background: color-mix(in srgb, var(--color-surface-raised) 90%, transparent);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    align-self: flex-start;
}

@media (max-width: 899px) {
    .export-overlay {
        align-items: flex-end;
        justify-content: center;
        padding: 0;
    }

    .export-workspace-active .export-overlay {
        pointer-events: auto;
        background: rgba(14, 12, 35, 0.28) !important;
    }

    .export-workspace-active .canvas-bottom-center,
    .export-workspace-active .canvas-overlay-tl,
    .export-workspace-active .canvas-overlay-bl,
    .export-workspace-active .canvas-overlay-br,
    .export-workspace-active .canvas-top-right {
        display: none !important;
    }

    .export-modal-panel {
        width: min(680px, calc(100vw - 12px));
        max-height: 46svh;
        border-radius: 0;
    }

    .export-modal-body {
        max-height: calc(46svh - 78px);
        overflow-y: auto;
    }

    /* ── Mobile export: overlay sheet, not a workspace takeover ── */
    /* Restore normal layout so the export panel feels like a bottom sheet */
    html.loaded.export-workspace-active .sidebar {
        display: flex !important;
    }

    html.loaded.layout-mobile-accordion.export-workspace-active .sidebar-brand-row,
    html.loaded.layout-tablet-tabs.export-workspace-active .sidebar-brand-row {
        display: flex !important;
    }

    /* Restore normal canvas height — do not override with workspace dimensions */
    html.loaded.export-workspace-active main {
        flex: 0 0 48vh !important;
        min-height: 220px !important;
    }

    html.loaded.export-workspace-active main,
    html.loaded.export-workspace-active #viewerSection,
    html.loaded.export-workspace-active .viewer-section,
    html.loaded.export-workspace-active .canvas-wrap {
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
    }

    /* Export panel is a fixed bottom-sheet overlay */
    .export-workspace-active .export-modal-panel {
        position: fixed;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        bottom: 0 !important;
        width: auto !important;
        max-width: none !important;
        height: auto !important;
        max-height: 54svh !important;
        border-radius: 0 !important;
        border: none !important;
        border-top: 1px solid color-mix(in srgb, var(--palette-blueberry-300) 50%, transparent) !important;
        box-shadow: 0 -4px 24px rgba(12, 10, 33, 0.18) !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    .export-workspace-active .export-modal-body {
        height: auto !important;
        max-height: calc(54svh - 86px) !important;
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    }

    .export-workspace-active .settings-panel-header {
        cursor: default;
    }

    .export-workspace-active .export-drag-indicator {
        display: none;
    }
}

.export-modal-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    max-width: none;
    align-items: center;
    flex-wrap: nowrap;
    padding: 10px;
    display: grid;
    grid-template-columns: minmax(320px, 390px) minmax(360px, 1fr);
    column-gap: 16px;
    row-gap: 12px;
    align-items: start;
}

.export-workspace-active .export-modal-body {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px 12px 14px;
    overflow-y: auto;
    max-height: calc(100vh - 92px);
    flex: 0 1 auto;
}

.export-workspace-active .export-modal-body>* {
    width: 100%;
}

.export-workspace-active .settings-divider {
    display: none;
}

.export-workspace-active .settings-panel-header {
    padding: 12px 14px 10px;
}

.export-workspace-active .settings-panel-header h3 {
    font-size: 1rem;
}

.export-workspace-active .export-format-tabs {
    gap: 3px;
    padding: 3px;
}

.export-workspace-active .export-format-tab {
    min-height: 34px;
    padding: 0 10px;
}

.export-workspace-active .export-selects-row {
    gap: 6px;
}

.export-workspace-active .export-quick-options,
.export-workspace-active .export-format-opts,
.export-workspace-active .export-motion-controls {
    padding: 12px;
    border-radius: var(--radius-card);
}

.export-workspace-active .gif-options-row.export-quick-options {
    display: flex;
    flex-wrap: nowrap;
    column-gap: 12px;
    row-gap: 6px;
    padding: 0;
    border-radius: 0;
    background: transparent;
}

.export-workspace-active .gif-options-row.export-quick-options .gif-option-check {
    min-height: 36px;
    padding: 0;
}

.export-workspace-active .export-size-est-row {
    padding: 0;
    min-height: 0;
}

.export-workspace-active .anim-export-footer,
.export-workspace-active #exportStatus,
.export-workspace-active #exportStatusAnim {
    min-height: 0;
}

.export-workspace-active .export-panel-package-row {
    margin-top: 2px;
}

.export-workspace-active .export-primary-row {
    margin-top: 0;
}

@media (max-width: 520px) {
    .export-workspace-active .gif-options-row.export-quick-options {
        display: flex;
        flex-wrap: nowrap;
    }
}

#btnExportPause .export-pause-icon--play {
    display: none;
}

#btnExportPause.is-paused .export-pause-icon--pause {
    display: none;
}

#btnExportPause.is-paused .export-pause-icon--play {
    display: block;
}

.export-modal-body> :not(#exportPreviewDetails) {
    grid-column: 1;
}

#exportPreviewDetails {
    grid-column: 2;
    grid-row: 1 / span 20;
    margin-top: 0;
}



.export-format-tabs {
    display: grid;
    grid-template-columns: repeat(var(--export-tab-columns, 4), minmax(0, 1fr));
    gap: 4px;
    border-radius: 22px;
    padding: 4px;
    border: none;
    background: color-mix(in srgb, var(--color-surface-raised) 74%, #d7d6e6 26%);
    overflow: visible;
}

.export-format-tab {
    border: none;
    border-radius: 22px;
    min-height: 30px;
    padding: 0 12px;
    font-size: var(--export-type-body-size);
    font-weight: 700;
    color: color-mix(in srgb, var(--color-on-surface) 76%, transparent 24%);
    background: transparent;
    cursor: pointer;
    transition: background 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

.export-format-tab--size {
    min-height: 54px;
    padding: 6px 10px;
    display: grid;
    grid-template-rows: auto auto;
    justify-items: center;
    align-content: center;
    gap: 2px;
    line-height: 1.15;
    text-align: center;
}

.export-size-tier {
    display: block;
    width: 100%;
    font-size: inherit;
    font-weight: inherit;
}

.export-size-dimensions {
    display: block;
    width: 100%;
    font-size: var(--export-type-meta-size);
    font-weight: 400;
    color: color-mix(in srgb, var(--color-on-surface) 76%, transparent 24%);
}

.export-workspace-active .export-format-tab--size {
    min-height: 54px;
    padding: 6px 8px;
}

.export-format-tab--size.is-active .export-size-dimensions {
    color: color-mix(in srgb, var(--color-on-surface) 86%, transparent 14%);
}

.export-format-tab.is-active {
    background: #fff;
    color: var(--color-on-surface);
    box-shadow: 0 4px 10px rgba(20, 18, 43, 0.14);
}

/* Keep crop segmented tabs on the same active-chip treatment as other segmented controls. */
.export-crop-tab:has(input:checked) {
    background: #fff;
    color: var(--color-on-surface);
    box-shadow: 0 4px 10px rgba(20, 18, 43, 0.14);
}

html.theme-dark .export-format-tabs {
    background: rgba(77, 72, 126, 0.5);
}

html.theme-dark .export-format-tab {
    color: rgba(232, 227, 255, 0.74);
}

html.theme-dark .export-format-tab.is-active {
    background: rgba(242, 240, 255, 0.96);
    color: var(--palette-blueberry-900);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.22);
}

html.theme-dark .export-crop-tab:has(input:checked) {
    background: rgba(242, 240, 255, 0.96);
    color: var(--palette-blueberry-900);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.22);
}

/* ── Footer controls row: disabled, layout now handled by cam-nav-row grid ── */
.footer-controls-row {
    display: none;
}

/* ── Crop Pill ── */
.crop-pill {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    background: #fff;
    border-radius: 999px;
    box-shadow: 0 2px 12px rgba(18, 16, 48, 0.16);
    padding: 5px 5px 5px 5px;
    flex-shrink: 0;
    order: -1;
    margin-right: auto;
}

.crop-pill__ratios {
    display: flex;
    align-items: center;
    gap: 0;
}

/* Collapsed: show only checked option (or first if none checked) */
.crop-pill.is-collapsed .crop-pill__option {
    display: none;
}

.crop-pill.is-collapsed .crop-pill__option:has(input:checked) {
    display: flex;
}

/* If nothing checked, show first option as default preview */
.crop-pill.is-collapsed:not(:has(input:checked)) .crop-pill__option:first-child {
    display: flex;
}

.crop-pill__option {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 5px 9px;
    border-radius: 999px;
    cursor: pointer;
    color: var(--palette-blueberry-600);
    transition: background 120ms;
    min-width: 42px;
    min-height: 42px;
}

.crop-pill__option:has(input:checked) {
    background: var(--palette-blueberry-100);
    color: var(--palette-blueberry-800);
}

.crop-pill__option:hover {
    background: var(--palette-blueberry-50);
}

.crop-pill__option,
.crop-pill__option * {
    cursor: pointer;
}

.crop-pill__option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.crop-pill__shape {
    display: block;
    border: 2px solid currentColor;
    border-radius: 3px;
    flex-shrink: 0;
    cursor: inherit;
    pointer-events: none;
}

.crop-pill__shape--square {
    width: 15px;
    height: 15px;
}

.crop-pill__shape--portrait {
    width: 9px;
    height: 17px;
}

.crop-pill__shape--landscape {
    width: 19px;
    height: 10px;
}

.crop-pill__shape--landscape43 {
    width: 17px;
    height: 13px;
}

.crop-pill__lbl {
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    font-family: "Source Sans 3", system-ui, sans-serif;
    white-space: nowrap;
    cursor: inherit;
    pointer-events: none;
}

.crop-pill__cancel {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 999px;
    border: none;
    background: transparent;
    color: var(--palette-blueberry-500);
    cursor: pointer;
    flex-shrink: 0;
    transition: background 120ms;
}

/* Only show the crop cancel button when a ratio is actually selected */
.crop-pill:not(:has(input:checked)) .crop-pill__cancel {
    display: none !important;
}

.crop-pill__cancel:hover {
    background: var(--palette-blueberry-50);
}

.crop-pill__cancel svg,
.crop-pill__chevron svg {
    display: block !important;
    width: 16px !important;
    height: 16px !important;
    flex-shrink: 0 !important;
    min-width: 16px !important;
    pointer-events: none;
}

/* Hide Preview UI state: hide all canvas overlays, D-pad, FPS counter, buttons */
html.preview-ui-hidden .canvas-top-left,
html.preview-ui-hidden .canvas-top-right,
html.preview-ui-hidden .canvas-overlay-tl,
html.preview-ui-hidden .canvas-overlay-bl,
html.preview-ui-hidden .canvas-overlay-br,
html.preview-ui-hidden .canvas-bottom-center {
    display: none !important;
}

.crop-pill__chevron {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    min-width: 30px;
    min-height: 30px;
    aspect-ratio: 1 / 1;
    padding: 0;
    box-sizing: border-box;
    line-height: 0;
    border-radius: 999px;
    border: none;
    background: rgba(0, 0, 0, 0.05);
    color: var(--palette-blueberry-500);
    cursor: pointer;
    flex-shrink: 0;
    transition: background 120ms;
}

.crop-pill__chevron:hover {
    background: rgba(0, 0, 0, 0.10);
}

.crop-pill__cancel {
    min-width: 30px;
    min-height: 30px;
    aspect-ratio: 1 / 1;
    padding: 0;
    box-sizing: border-box;
    line-height: 0;
}

/* Dark mode crop pill */
html.theme-dark .crop-pill {
    background: rgba(38, 34, 74, 0.97);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}

html.theme-dark .crop-pill__option {
    color: rgba(200, 194, 255, 0.8);
}

html.theme-dark .crop-pill__option:has(input:checked) {
    background: rgba(100, 90, 180, 0.3);
    color: rgba(232, 227, 255, 0.95);
}

html.theme-dark .crop-pill__chevron {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(200, 194, 255, 0.8);
}

html.theme-dark .crop-pill__cancel {
    color: #ff7a30;
}

/* Mobile: crop pill collapsed by default, all items visible */
@media (max-width: 899px) {

    /* Prevent crop pill from overflowing its grid cell */
    .cam-nav-row .crop-pill {
        min-width: 0;
        overflow: hidden;
    }

    .crop-pill {
        padding: 5px;
        min-width: 0;
        width: auto;
        max-width: min(34vw, 156px);
    }

    .crop-pill__ratios {
        max-width: calc(100% - 64px);
        overflow-x: auto;
        scrollbar-width: none;
    }

    .crop-pill.is-collapsed .crop-pill__ratios {
        max-width: none;
        overflow: visible;
        width: auto;
    }

    .crop-pill__ratios::-webkit-scrollbar {
        display: none;
    }

    .crop-pill__option {
        min-width: 38px;
        padding: 4px 7px;
    }

    /* Keep the crop pill visible on mobile; collapsed state is handled by option visibility rules. */
    .crop-pill {
        display: inline-flex;
    }
}

/* Mobile settings / desktop theme toggle swap */
.mobile-settings-btn {
    display: none;
}

@media (max-width: 899px) {
    #btnThemeToggle {
        display: none !important;
    }

    .mobile-settings-btn {
        display: none !important;
    }
}

.export-format-tab:hover:not(.is-active) {
    background: color-mix(in srgb, var(--palette-blueberry-100) 58%, transparent);
    color: var(--color-on-surface);
}

.export-select:hover {
    border-color: color-mix(in srgb, var(--color-primary) 48%, var(--color-border));
    background-color: color-mix(in srgb, var(--color-surface-raised) 92%, #fff 8%);
}

.gif-options-row.export-quick-options .gif-option-check:hover,
.export-quality-inline-options .gif-option-check:hover {
    color: var(--color-on-surface);
}

.gif-options-row.export-quick-options .gif-option-check:hover input[type="checkbox"],
.export-quality-inline-options .gif-option-check:hover input[type="checkbox"] {
    border-color: color-mix(in srgb, var(--color-primary) 58%, var(--color-on-surface));
}

#exportCompressionRow:hover .range-wrap {
    filter: saturate(1.02);
}

.export-format-tab:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-primary) 38%, transparent);
}

.export-download-btn {
    width: 100%;
    margin-top: 10px;
    justify-content: center;
}

/* ── Box headings (Model / Environment cards) ── */
.box-heading {
    font-size: 22px;
    font-weight: 800;
    color: var(--color-on-surface);
    letter-spacing: -0.3px;
    margin-bottom: 14px;
}

.box-heading-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    margin-bottom: 10px;
}

.box-heading-row .box-heading {
    margin-bottom: 0;
}

.copy-link-btn--compact {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    padding: 0.35em 0.8em;
    font-size: var(--text-sm);
}

.copy-link-btn--compact svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
}

.sidebar-footer-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 2px;
}

.card-reset-btn {
    width: 32px;
    min-width: 32px;
    min-height: 32px;
    padding: 0;
    font-size: 0;
    gap: 0;
    border: none;
    background: transparent;
    color: color-mix(in srgb, var(--color-on-surface) 72%, transparent);
    opacity: 0.58;
}

.card-reset-btn.is-active {
    opacity: 1;
    color: var(--color-on-surface);
}

.card-reset-btn svg {
    width: 12px;
    height: 12px;
}

.card-reset-btn:hover {
    background: color-mix(in srgb, var(--color-primary) 8%, transparent);
    color: var(--color-on-surface);
}

.card-reset-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-primary) 38%, transparent);
}

.card-reset-btn:disabled {
    opacity: 0.34;
    color: color-mix(in srgb, var(--color-on-surface) 42%, transparent);
    cursor: default;
    pointer-events: none;
}

.card-header-toggle {
    cursor: pointer;
}

.card-header-toggle>* {
    cursor: auto;
}

.card-collapse-btn {
    margin-left: auto;
    width: 30px;
    min-width: 30px;
    height: 30px;
    padding: 0;
    flex-shrink: 0;
    border-radius: 9px;
    border: 1px solid var(--border-color);
    background: color-mix(in srgb, var(--surface-elev) 88%, #fff 12%);
    color: var(--color-on-surface);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.card-collapse-btn span {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 160ms ease;
}

.card-collapse-btn span svg {
    width: 18px;
    height: 18px;
    display: block;
}

.controls-section-box.is-collapsed .card-collapse-btn span {
    transform: rotate(-90deg);
}

.controls-section-box.is-collapsed> :not(.box-heading-row):not(.controls-row--section-header) {
    display: none !important;
}

.controls-row--section-header {
    margin-bottom: 10px;
}

.controls-row--section-header .card-reset-btn {
    margin-left: 0;
}

.bg-toggle-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

@keyframes shade-row-reveal {
    from {
        opacity: 0;
        transform: translateY(3px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.control-label.shade-row-reveal {
    animation: shade-row-reveal 220ms ease-out;
}

.bg-toggle-row .gif-option-check {
    margin-top: 0 !important;
    white-space: nowrap;
}

.build-plate-controls {
    display: grid;
    gap: 8px;
    padding: 8px;
    border-radius: 12px;
    border: 1px solid color-mix(in srgb, var(--border-color) 82%, transparent 18%);
    background: color-mix(in srgb, var(--surface-elev) 86%, #fff 14%);
}

.build-plate-controls[hidden] {
    display: none !important;
}

#buildPlateConfigBody[hidden] {
    display: none !important;
}

.box-sub-heading {
    font-size: var(--text-sm, 12px);
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 10px;
    opacity: 0.7;
}

/* ── Slider sections (always expanded) ── */
.adv-section {
    margin-top: 12px;
}

.model-sliders,
.light-sliders {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-top: 18px;
}

.model-sliders> :first-child {
    padding-top: 0;
    border-top: none;
}

.model-sliders>*+*,
.light-sliders>*+* {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid color-mix(in srgb, var(--border-color) 78%, transparent 22%);
}

.control-label {
    color: var(--color-on-surface);
}

.range-label>span {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-on-surface);
}

.gif-option-check {
    font-size: var(--export-type-body-size);
    font-weight: 500;
    color: var(--color-on-surface);
}

/* Extra sliders revealed by Show All */
.adv-extra {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-bottom: 4px;
}

.adv-extra[hidden] {
    display: none;
}

/* Show All / Show Less underlined text link */
.show-all-link {
    display: inline-block;
    background: none;
    border: none;
    padding: 4px 0;
    margin-top: 10px;
    font-size: var(--text-sm, 12px);
    font-weight: 500;
    font-family: inherit;
    color: var(--color-text-muted);
    text-decoration: underline;
    cursor: pointer;
}

/* Fine Tuning row at bottom of Theme panel */
.fine-tuning-row {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 0 4px;
}

.fine-tuning-hint {
    font-size: var(--text-xs, 10px);
    color: var(--color-text-muted);
    opacity: 0.65;
    padding-left: 22px;
}

@media (max-width: 980px) {
    .export-modal-panel {
        width: min(700px, calc(100vw - 24px));
    }

    .export-modal-body {
        grid-template-columns: minmax(0, 1fr);
    }

    .export-modal-body> :not(#exportPreviewDetails),
    #exportPreviewDetails {
        grid-column: 1;
        grid-row: auto;
    }
}

/* Checkbox row */
.adv-section-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--text-sm, 12px);
    font-weight: 500;
    color: var(--color-text);
    padding: 4px 0;
}

.adv-section-check input[type="checkbox"] {
    width: 20px;
    height: 20px;
    -webkit-appearance: none;
    appearance: none;
    border: 2px solid color-mix(in srgb, var(--color-on-surface) 46%, transparent);
    border-radius: 6px;
    background: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
    flex: 0 0 auto;
}

.adv-section-check input[type="checkbox"]::after {
    content: '';
    width: 8px;
    height: 5px;
    border-left: 2.5px solid #fff;
    border-bottom: 2.5px solid #fff;
    transform: rotate(-45deg) scale(0);
    transform-origin: center;
    transition: transform 120ms ease;
}

.adv-section-check input[type="checkbox"]:checked {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.adv-section-check input[type="checkbox"]:checked::after {
    transform: rotate(-45deg) scale(1);
}

.adv-section-check input[type="checkbox"]:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-primary) 42%, transparent);
}

html.theme-dark .gif-option-check input[type="checkbox"],
html.theme-dark .adv-section-check input[type="checkbox"] {
    background: rgba(30, 25, 62, 0.32);
    border-color: rgba(179, 168, 247, 0.46);
}

#bgModelSyncSourceWrap {
    width: 100%;
    margin: 0;
}

#bgModelSyncSelector .thumb-select-btn {
    grid-template-columns: 56px minmax(0, 1fr) auto;
    gap: 10px;
    padding: 8px;
    min-height: 64px;
    border-radius: 14px;
    box-shadow: var(--shadow-soft);
}

#bgModelSyncSelector .thumb-select-text,
#bgModelSyncSelector .thumb-select-option-text {
    font-size: 12px;
}

#bgModelSyncSelector .thumb-select-canvas {
    width: 56px;
    height: 56px;
    min-width: 56px;
    min-height: 56px;
    max-width: 56px;
    max-height: 56px;
    flex: 0 0 56px;
    border-radius: 12px;
}

#bgModelSyncSelector .thumb-select-menu {
    max-height: min(52vh, 420px);
}

#bgModelSyncSelector .thumb-select-option {
    grid-template-columns: 48px minmax(0, 1fr);
    padding: 5px;
}

#bgModelSyncSelector .thumb-select-option-canvas {
    width: 48px;
    height: 48px;
    border-radius: 10px;
}

#bgModelSyncSelector .thumb-select-sync-badge {
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
}

#buildPlateModelSyncSourceWrap {
    width: 100%;
    margin: 0;
}

#bgModelSyncSourceWrap,
#buildPlateModelSyncSourceWrap {
    position: relative;
    height: 0;
    overflow: visible;
    pointer-events: none;
}

#bgModelSyncSourceWrap .thumb-select,
#buildPlateModelSyncSourceWrap .thumb-select {
    position: static;
}

#bgModelSyncSelectorBtn,
#buildPlateModelSyncSelectorBtn {
    display: none !important;
}

#bgModelSyncSelectorMenu,
#buildPlateModelSyncSelectorMenu {
    pointer-events: auto;
}

#buildPlateModelSyncSelector .thumb-select-btn {
    grid-template-columns: 56px minmax(0, 1fr) auto;
    gap: 10px;
    padding: 8px;
    min-height: 64px;
    border-radius: 14px;
    box-shadow: var(--shadow-soft);
}

#buildPlateModelSyncSelector .thumb-select-text,
#buildPlateModelSyncSelector .thumb-select-option-text {
    font-size: 12px;
}

#buildPlateModelSyncSelector .thumb-select-canvas {
    width: 56px;
    height: 56px;
    min-width: 56px;
    min-height: 56px;
    max-width: 56px;
    max-height: 56px;
    flex: 0 0 56px;
    border-radius: 12px;
}

#buildPlateModelSyncSelector .thumb-select-menu {
    max-height: min(52vh, 420px);
}

#buildPlateModelSyncSelector .thumb-select-option {
    grid-template-columns: 48px minmax(0, 1fr);
    padding: 5px;
}

#buildPlateModelSyncSelector .thumb-select-option-canvas {
    width: 48px;
    height: 48px;
    border-radius: 10px;
}

#buildPlateModelSyncSelector .thumb-select-sync-badge {
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
}

#buildPlateBox .build-plate-section-label {
    margin-top: 0;
    margin-bottom: 8px;
}

#buildPlateBox .build-plate-section-label>span {
    color: #4f4b66;
    font-size: 13px;
    font-weight: 700;
}

html.theme-dark #buildPlateBox .build-plate-section-label>span {
    color: var(--palette-blueberry-200);
}

#buildPlateBox .preset-group {
    margin-bottom: 14px;
}

#buildPlateBox .build-plate-shape-group {
    margin-top: 12px !important;
}

/* ── Preset group inside new cards (no extra margin needed) ── */
#modelBox .preset-group,
#environmentBox .preset-group,
#buildPlateBox .preset-group {
    margin-top: 0;
    margin-bottom: 0;
}

#modelBox .preset-group {
    gap: 12px;
}

#modelBox .shading-option {
    padding: 6px 8px;
    border: 2px solid transparent;
    border-radius: 6px;
    background: transparent;
    box-shadow: 0 0 0 2px transparent;
}

#modelBox .shading-option:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(46, 43, 116, 0.15);
}

#modelBox .shading-option.is-selected {
    border-color: white;
    box-shadow: 0 0 0 2px var(--color-primary);
}

#modelBox .preset-group .thumb-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--color-on-surface);
}