@font-face {
    font-family: "Iansui";
    src: url("./fonts/iansui/Iansui-Regular.ttf") format("truetype");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

.app-live-region {
    position: fixed;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@font-face {
    font-family: "jf open 粉圓";
    src: url("./fonts/open-huninn/jf-openhuninn-2.1.ttf") format("truetype");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Chiron Hei HK";
    src: url("./fonts/chiron-hei-hk/ChironHeiHK-L.ttf") format("truetype");
    font-weight: 300;
    font-display: swap;
}

@font-face {
    font-family: "Chiron Hei HK";
    src: url("./fonts/chiron-hei-hk/ChironHeiHK-M.ttf") format("truetype");
    font-weight: 500 700;
    font-display: swap;
}

@font-face {
    font-family: "GenRyu Min TC";
    src: url("./fonts/genryu-min/GenRyuMin2TC-R.otf") format("opentype");
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: "GenRyu Min TC";
    src: url("./fonts/genryu-min/GenRyuMin2TC-B.otf") format("opentype");
    font-weight: 700;
    font-display: swap;
}

:root {
    --primary: #ff9f0a;
    --workspace-accent: var(--primary);
    --bg: #18181a;
    --panel-bg: #1c1c1e;
    --text: #ffffff;
    --surface-control: #3a3a3c;
    --surface-control-hover: #48484a;
    --surface-control-active: #5a5a5f;
    --ink-on-accent: #1c1c1e;
    --accent-orange: #ff9f0a;
    --accent-orange-hover: #ffb340;
    --accent-green: #3CAE4E;
    --accent-green-hover: #48C55A;
    --accent-blue: #32aec6;
    --accent-blue-hover: #49bfd5;
    --accent-purple: #BF5AF2;
    --accent-purple-hover: #ca71f4;
    --list-photo-thumb-width: 48px;
    --list-photo-thumb-height: 62px;
    --list-photo-thumb-compact-width: 36px;
    --list-photo-thumb-compact-height: 46px;
    --list-photo-thumb-matte: rgba(255,255,255,0.035);
    --shadow-control-rest: 0 4px 10px rgba(0,0,0,0.30);
    --shadow-control-hover: 0 6px 16px rgba(0,0,0,0.34);
    --shadow-floating-rest: 0 8px 24px rgba(0,0,0,0.50), 0 0 0 1px rgba(255,255,255,0.055) inset;
    --shadow-floating-hover: 0 10px 26px rgba(0,0,0,0.54);
    --glow-orange-soft: 0 0 12px rgba(255,159,10,0.18);
    --glow-green-soft: 0 0 12px rgba(60,174,78,0.16);
    --glow-blue-soft: 0 0 12px rgba(50,174,198,0.18);
    --glow-purple-soft: 0 0 12px rgba(191,90,242,0.18);
    --glass-blur-workspace: 12px;
    --glass-blur-floating: 12px;
    --glass-blur-popover: 16px;
    --glass-blur-picker: 18px;
    --glass-blur-nested: 8px;
    --glass-saturation-floating: 180%;
    --glass-saturation-popover: 125%;
    --modal-background-flat-filter: saturate(.85) contrast(.95);
}

body.batch-background-session > :is(.workspace-body, .workspace-topbar) {
    transition: opacity var(--batch-background-duration, 360ms) ease, filter var(--batch-background-duration, 360ms) ease, transform 240ms ease;
}
body.batch-background-concealed { --glass-blur-workspace: 0px; }
body.batch-background-concealed > :is(.workspace-body, .workspace-topbar) { opacity: 0; pointer-events: none; }
body:is(.decorative-animations-off, .app-background-paused).batch-background-session > :is(.workspace-body, .workspace-topbar) { transition: none; }
@media (prefers-reduced-motion: reduce) { body.batch-background-session > :is(.workspace-body, .workspace-topbar) { transition: none; } }
    html {
        width: 100%;
        height: 100%;
        max-height: 100%;
        overflow: clip;
        overscroll-behavior: none;
    }
    * { box-sizing: border-box; }
    .spec-dpi-suffix {
        display: inline-block;
        margin-left: 3px;
        font-size: 0.68em;
        font-weight: inherit;
        line-height: 1;
        letter-spacing: 0;
        vertical-align: 0.08em;
        white-space: nowrap;
        opacity: 0.78;
    }
    .fs-label-vert .spec-dpi-suffix {
        margin-left: 1px;
        font-size: 0.62em;
        vertical-align: baseline;
    }
    body {
        -webkit-user-select: none;
        user-select: none;
    }
    input,
    textarea,
    [contenteditable="true"] {
        -webkit-user-select: text;
        user-select: text;
    }
    body,
    button,
    input,
    select,
    textarea {
        font-family: "Chiron Hei HK", "PingFang TC", "Microsoft JhengHei", "Heiti TC", sans-serif;
    }
    body.interface-font-iansui,
    body.interface-font-iansui button,
    body.interface-font-iansui input,
    body.interface-font-iansui select,
    body.interface-font-iansui textarea {
        font-family: "Iansui", "Chiron Hei HK", "PingFang TC", "Microsoft JhengHei", sans-serif !important;
    }
    body.interface-font-huninn,
    body.interface-font-huninn button,
    body.interface-font-huninn input,
    body.interface-font-huninn select,
    body.interface-font-huninn textarea {
        font-family: "jf open 粉圓", "Chiron Hei HK", "PingFang TC", "Microsoft JhengHei", sans-serif !important;
    }
    body.interface-font-mincho,
    body.interface-font-mincho button,
    body.interface-font-mincho input,
    body.interface-font-mincho select,
    body.interface-font-mincho textarea {
        font-family: "GenRyu Min TC", "Chiron Hei HK", "PingFang TC", "Microsoft JhengHei", serif !important;
    }
    body.interface-font-hei,
    body.interface-font-hei button,
    body.interface-font-hei input,
    body.interface-font-hei select,
    body.interface-font-hei textarea {
        font-family: "Chiron Hei HK", "PingFang TC", "Microsoft JhengHei", "Heiti TC", sans-serif !important;
    }
    body.interface-font-iansui,
    body.interface-font-huninn {
        font-synthesis-weight: none;
    }
    body:is(.interface-font-iansui, .interface-font-huninn) #editor {
        font-synthesis-weight: auto;
    }
    body { background: var(--bg); color: var(--text); margin: 0; padding: 0; position: fixed; inset: 0; width: 100%; height: 100vh; height: var(--app-vh, 100dvh); max-height: var(--app-vh, 100dvh); display: flex; overflow: clip; overscroll-behavior: none; font-size: 15px; }
    .source-file-row {
        --source-file-control-size: 44px;
        display: grid;
        grid-template-columns: minmax(0, 1fr) var(--source-file-control-size);
        align-items: stretch;
        gap: 10px;
    }
    .source-file-picker {
        position: relative;
        min-width: 0;
        height: var(--source-file-control-size);
        box-sizing: border-box;
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        align-items: center;
        gap: 10px;
        padding: 6px;
        border: 1px solid #3a3a3c;
        border-radius: 8px;
        background: #18181a;
        overflow: hidden;
        transition: border-color 0.2s ease, box-shadow 0.2s ease;
    }
    .source-file-picker:focus-within {
        border-color: var(--primary);
        box-shadow: 0 0 0 1px var(--primary);
    }
    .source-file-picker input[type="file"] {
        position: absolute;
        inset: 0;
        width: 1px;
        height: 1px;
        opacity: 0;
        pointer-events: none;
    }
    .source-file-choose-btn {
        height: 30px;
        padding: 0 13px;
        border: 1px solid #48484a;
        border-radius: 8px;
        background: #f5f5f7;
        color: #1c1c1e;
        font-size: 13px;
        font-weight: 900;
        cursor: pointer;
        white-space: nowrap;
    }
    .source-file-choose-btn:hover {
        background: #ffffff;
    }
    #sourceFileName {
        min-width: 0;
        color: #f5f5f7;
        font-size: 13px;
        font-weight: 800;
        cursor: help;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .source-path-tooltip {
        position: fixed;
        z-index: 100000;
        max-width: min(520px, calc(100vw - 24px));
        padding: 9px 12px;
        border: 1px solid rgba(255,159,10,0.48);
        border-radius: 8px;
        background: rgba(28,28,30,0.96);
        color: #f5f5f7;
        font-size: 12px;
        font-weight: 700;
        line-height: 1.45;
        letter-spacing: 0;
        overflow-wrap: anywhere;
        white-space: normal;
        box-shadow: 0 12px 28px rgba(0,0,0,0.44), 0 0 0 1px rgba(255,255,255,0.05);
        opacity: 0;
        transform: translateY(-4px);
        pointer-events: none;
        transition: opacity 0.16s ease, transform 0.16s ease;
    }
    .source-path-tooltip.is-visible {
        opacity: 1;
        transform: translateY(0);
    }
    .source-path-tooltip.is-cover-help { border-color: rgba(50,174,198,.36); }
    .source-path-tooltip.is-cover-help::before {
        content: "";
        position: absolute;
        left: var(--hint-arrow-left, 14px);
        top: -5px;
        width: 8px;
        height: 8px;
        background: rgba(28,28,30,0.96);
        border-left: 1px solid rgba(50,174,198,.36);
        border-bottom: 1px solid rgba(50,174,198,.36);
        transform: rotate(135deg);
    }
    .source-path-tooltip.is-cover-help.is-above-anchor::before { top: auto; bottom: -5px; transform: rotate(-45deg); }
    .hover-help[data-portaled-help="true"]::before,
    .hover-help[data-portaled-help="true"]::after { display: none; }
    .btn-icon.source-folder-btn {
        width: var(--source-file-control-size);
        min-width: var(--source-file-control-size);
        height: var(--source-file-control-size);
        align-self: stretch;
        color: #f5f5f7;
        border: 0;
        border-radius: 8px;
        background: var(--surface-control);
        box-shadow: none;
    }
    .btn-icon.source-folder-btn:hover {
        color: #ffffff;
        background: var(--surface-control-hover);
    }
    ::-webkit-scrollbar { width: 8px; height: 8px; }
    ::-webkit-scrollbar-track { background: var(--panel-bg); }
    ::-webkit-scrollbar-thumb { background: #48484a; border-radius: 4px; }
    ::-webkit-scrollbar-thumb:hover { background: #636366; }

    .settings-page,
    .settings-page-scroll {
        --ui-scroll-thumb: #3CAE4E;
        --ui-scroll-thumb-hover: #62d579;
        --ui-scroll-track: rgba(20, 52, 27, 0.92);
    }
    .simple-mode-content,
    .simple-file-list {
        --ui-scroll-thumb: #64a8ff;
        --ui-scroll-thumb-hover: #8fc1ff;
        --ui-scroll-track: rgba(20, 40, 64, 0.92);
    }
    .cd-control-pane,
    .cd-tab-panel {
        --ui-scroll-thumb: #32aec6;
        --ui-scroll-thumb-hover: #61d5e8;
        --ui-scroll-track: rgba(16, 45, 51, 0.94);
    }
    .layout-control-scroll,
    #freeLayoutControls {
        --ui-scroll-thumb: #BF5AF2;
        --ui-scroll-thumb-hover: #d28bfa;
        --ui-scroll-track: rgba(47, 24, 61, 0.94);
    }
    .sidebar,
    .filmstrip-scroll,
    .shortcut-panel {
        --ui-scroll-thumb: #ff9f0a;
        --ui-scroll-thumb-hover: #ffb340;
        --ui-scroll-track: rgba(58, 38, 14, 0.94);
    }
    :where(.settings-page, .settings-page-scroll, .simple-mode-content, .simple-file-list,
        .cd-control-pane, .cd-tab-panel, .layout-control-scroll, #freeLayoutControls,
        .sidebar, .filmstrip-scroll, .shortcut-panel) {
        scrollbar-width: auto;
        scrollbar-color: var(--ui-scroll-thumb) var(--ui-scroll-track);
    }
    :where(.settings-page, .settings-page-scroll, .simple-mode-content, .simple-file-list,
        .cd-control-pane, .cd-tab-panel, .layout-control-scroll, #freeLayoutControls,
        .sidebar, .filmstrip-scroll, .shortcut-panel)::-webkit-scrollbar {
        width: 10px;
        height: 10px;
    }
    :where(.settings-page, .settings-page-scroll, .simple-mode-content, .simple-file-list,
        .cd-control-pane, .cd-tab-panel, .layout-control-scroll, #freeLayoutControls,
        .sidebar, .filmstrip-scroll, .shortcut-panel)::-webkit-scrollbar-track {
        background: var(--ui-scroll-track);
        border-radius: 6px;
    }
    :where(.settings-page, .settings-page-scroll, .simple-mode-content, .simple-file-list,
        .cd-control-pane, .cd-tab-panel, .layout-control-scroll, #freeLayoutControls,
        .sidebar, .filmstrip-scroll, .shortcut-panel)::-webkit-scrollbar-thumb {
        min-height: 34px;
        border: 2px solid var(--ui-scroll-track);
        border-radius: 6px;
        background: var(--ui-scroll-thumb);
    }
    :where(.settings-page, .settings-page-scroll, .simple-mode-content, .simple-file-list,
        .cd-control-pane, .cd-tab-panel, .layout-control-scroll, #freeLayoutControls,
        .sidebar, .filmstrip-scroll, .shortcut-panel)::-webkit-scrollbar-thumb:hover {
        background: var(--ui-scroll-thumb-hover);
    }

/* --- 環境光暈動畫 (徹底解決邊緣與亮線問題) --- */
    @keyframes ambientGlow {
        /* 這次只做輕微的放大與移動，絕不縮小，確保邊緣永遠藏在螢幕外 */
        0% { transform: scale(1) translate(0px, 0px); opacity: 0.5; }
        50% { transform: scale(1.05) translate(1vw, 1vh); opacity: 0.9; }
        100% { transform: scale(1.02) translate(-1vw, -1vh); opacity: 0.5; }
    }

    body::after {
        content: "";
        position: fixed;

        top: -25vh; left: -25vw; width: 150vw; height: 150vh;

        z-index: 9999;
        pointer-events: none;
        mix-blend-mode: screen;

        background-repeat: no-repeat;
        background-size: 100% 100%;

        /* 將透明度維持在您覺得舒適的暗度 */
        background-image:
            radial-gradient(circle at 30% 30%, rgba(255, 159, 10, 0.06) 0%, rgba(255, 159, 10, 0) 50%),
            radial-gradient(circle at 70% 60%, rgba(191, 90, 242, 0.05) 0%, rgba(191, 90, 242, 0) 50%),
            radial-gradient(circle at 40% 70%, rgba(50, 174, 198, 0.04) 0%, rgba(50, 174, 198, 0) 50%);

        animation: ambientGlow 10s ease-in-out infinite alternate;
        filter: opacity(1);
        transition: filter 3s ease;

        /* 強制硬體加速，讓 Mac 渲染更滑順，避免破圖 */
        will-change: transform, opacity;
    }

    body.app-background-paused *,
    body.app-background-paused::before,
    body.app-background-paused::after {
        animation-play-state: paused !important;
    }

    body.app-background-paused::after {
        will-change: auto;
    }

    body.welcome-mode .sidebar,
    body.welcome-mode .sidebar-toggle-btn,
    body.welcome-mode .filmstrip-bar,
    body.welcome-mode .filmstrip-toggle,
    body.welcome-mode .filmstrip-position-toggle,
    body.welcome-mode .shortcut-panel,
    body.welcome-mode .simple-mode-fab,
    body.welcome-mode .settings-fab,
    body.welcome-mode #capacityTag,
    body.welcome-mode #canvasViewDock,
    body.welcome-mode #canvasZoomControl {
        display: none !important;
    }

    body.welcome-mode .main-editor,
    body.welcome-mode .canvas-container {
        min-height: 100vh;
        min-height: var(--welcome-vh, 100dvh);
    }

    body.welcome-mode .canvas-container {
        padding: 0 !important;
        cursor: pointer;
    }

    body.welcome-mode canvas {
        background: transparent;
        box-shadow: none;
    }


    canvas { background: #000; box-shadow: 0 0 30px rgba(0,0,0,0.6); cursor: move; touch-action: none; margin: auto; flex-shrink: 0; }

    .control-group { background: #242426; padding: 16px; border-radius: 12px; border: 1px solid #333336; display: flex; flex-direction: column; gap: 10px; }

    .sub-group { background: #1c1c1e; padding: 12px; border-radius: 8px; border: 1px solid #3a3a3c; display: flex; flex-direction: column; gap: 8px; }

    #layoutModal { --workspace-accent: #BF5AF2; }
    #cdModal { --workspace-accent: #32aec6; }

    label { font-size: 13px; color: #aeaeb2; font-weight: normal; letter-spacing: 0.5px; margin:0; }
    .control-group > label,
    .sub-group > label,
    #cdShopPanelTitle,
    .cd-upload-field > span {
        color: var(--workspace-accent) !important;
        font-weight: 700 !important;
    }
    select, input[type="file"], input[type="text"], input[type="date"], input[type="number"] { background: #18181a; color: white; border: 1px solid #3a3a3c; padding: 10px; border-radius: 8px; font-size: 14px; outline: none; width: 100%; transition: 0.2s; }
    select:focus, input[type="file"]:focus, input[type="text"]:focus, input[type="date"]:focus, input[type="number"]:focus, textarea:focus { border-color: var(--modal-accent, var(--workspace-accent, var(--primary))) !important; box-shadow: 0 0 0 1px var(--modal-accent, var(--workspace-accent, var(--primary))); }
    button:focus-visible {
        outline: 2px solid var(--modal-accent, var(--workspace-accent, var(--primary)));
        outline-offset: 2px;
    }
    #upload::file-selector-button,
    #upload::-webkit-file-upload-button {
        height: 28px;
        padding: 0 12px;
        margin-right: 8px;
        border: 1px solid #48484a;
        border-radius: 8px;
        background: #f5f5f7;
        color: #1c1c1e;
        font-weight: 800;
        cursor: pointer;
    }
    input[type="color"] {
        box-sizing: border-box;
        width: 36px;
        height: 36px;
        border: 1px solid var(--modal-accent, var(--workspace-accent, var(--primary)));
        border-radius: 9px;
        padding: 3px;
        background: #1c1c1e;
        cursor: pointer;
        outline: none;
        transition: border-color 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
    }
    input[type="color"]:hover,
    input[type="color"]:focus {
        box-shadow: 0 0 0 1px var(--modal-accent, var(--workspace-accent, var(--primary)));
        filter: brightness(1.08);
    }
    input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
    input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 6px; }
    input[type="color"]::-moz-color-swatch { border: 0; border-radius: 6px; }
    input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(1); cursor: pointer; }

    input[type="color"].sunny-color-native {
        position: absolute !important;
        width: 1px !important;
        height: 1px !important;
        min-width: 1px !important;
        opacity: 0 !important;
        pointer-events: none !important;
        padding: 0 !important;
        border: 0 !important;
        margin: 0 !important;
    }

    .sunny-color-swatch-btn {
        --sunny-swatch-color: #ffffff;
        --sunny-swatch-accent: var(--modal-accent, var(--workspace-accent, var(--primary)));
        position: relative;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 36px;
        width: 36px;
        height: 36px;
        padding: 3px;
        border: 1px solid #48484a;
        border-radius: 9px;
        background:
            linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0)),
            #242426;
        cursor: pointer;
        transition: transform 0.12s ease, background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
    }
    .sunny-color-swatch-btn::before {
        content: "";
        display: block;
        width: 100%;
        height: 100%;
        border-radius: 6px;
        background:
            linear-gradient(135deg, rgba(255,255,255,0.20), rgba(255,255,255,0) 34%),
            var(--sunny-swatch-color);
        box-shadow: inset 0 0 0 1px rgba(255,255,255,0.16), inset 0 -10px 14px rgba(0,0,0,0.10);
    }
    .sunny-color-swatch-btn:hover,
    .sunny-color-swatch-btn:focus-visible {
        background:
            linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0)),
            #2c2c2e;
        border-color: var(--sunny-swatch-accent);
        filter: brightness(1.08);
        box-shadow: 0 0 0 1px color-mix(in srgb, var(--sunny-swatch-accent) 64%, transparent), 0 0 16px color-mix(in srgb, var(--sunny-swatch-accent) 24%, transparent);
    }
    .sunny-color-swatch-btn:active {
        transform: scale(0.96);
    }
    .sunny-color-swatch-btn.is-value-changing {
        animation: sunnyColorSwatchPulse 0.24s cubic-bezier(.2, .95, .28, 1.2);
    }
    .sunny-color-swatch-btn.is-value-changing::before {
        animation: sunnyColorSwatchShine 0.24s ease-out;
    }

    .sunny-color-picker {
        --picker-accent: #32aec6;
        position: fixed;
        left: 420px;
        top: 128px;
        width: min(360px, calc(100vw - 24px));
        z-index: 7000;
        color: #f5f5f7;
        border: 1px solid color-mix(in srgb, var(--picker-accent) 58%, rgba(255,255,255,0.18));
        border-radius: 14px;
        background:
            linear-gradient(160deg, rgba(255,255,255,0.13), rgba(255,255,255,0.035)),
            rgba(28, 28, 30, 0.70);
        backdrop-filter: blur(var(--glass-blur-picker)) saturate(1.25);
        -webkit-backdrop-filter: blur(var(--glass-blur-picker)) saturate(1.25);
        box-shadow: 0 22px 62px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.045) inset;
        opacity: 1;
        transform: translateY(0) scale(1);
        transform-origin: top left;
        transition: opacity 0.16s ease, transform 0.18s cubic-bezier(.2, .9, .28, 1.08), box-shadow 0.18s ease;
        user-select: none;
        visibility: visible;
        pointer-events: auto;
    }
    .sunny-color-picker.is-opening {
        animation: sunnyColorPickerEnter 0.2s cubic-bezier(.18, .92, .22, 1.12);
    }
    .sunny-color-picker.is-hidden {
        opacity: 0;
        visibility: hidden;
        pointer-events: none !important;
        transform: translateY(-6px) scale(0.985);
    }
    .sunny-color-picker.is-hidden *,
    .sunny-color-picker[aria-hidden="true"] * {
        pointer-events: none !important;
    }
    .sunny-color-picker.is-positioning {
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
        transform: translateY(-6px) scale(0.985);
        transition: none !important;
        animation: none !important;
    }
    .sunny-color-picker.is-value-changing {
        box-shadow:
            0 24px 66px rgba(0,0,0,0.56),
            0 0 0 1px rgba(255,255,255,0.06) inset,
            0 0 22px color-mix(in srgb, var(--picker-accent) 24%, transparent);
    }
    .sunny-color-picker.is-mode-switching {
        box-shadow:
            0 24px 66px rgba(0,0,0,0.56),
            0 0 0 1px rgba(255,255,255,0.06) inset,
            0 0 18px color-mix(in srgb, var(--picker-accent) 18%, transparent);
    }
    .sunny-color-picker.is-dragging {
        transition: none;
    }
    .sunny-color-picker-head {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 12px 12px 10px;
        cursor: grab;
        border-bottom: 1px solid rgba(255,255,255,0.08);
    }
    .sunny-color-picker.is-dragging .sunny-color-picker-head { cursor: grabbing; }
    .sunny-color-picker-title {
        flex: 1;
        min-width: 0;
        color: var(--picker-accent);
        font-size: 14px;
        font-weight: 900;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
    }
    .sunny-color-picker-close,
    .sunny-eyedropper-btn {
        width: 30px;
        height: 30px;
        border: 1px solid #48484a;
        border-radius: 8px;
        background: #3a3a3c;
        color: #f5f5f7;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.12s ease;
    }
    .sunny-color-picker-close {
        font-size: 18px;
        font-weight: 900;
        line-height: 1;
    }
    .sunny-eyedropper-btn {
        color: var(--picker-accent);
    }
    .sunny-color-picker-close:hover,
    .sunny-eyedropper-btn:hover {
        border-color: var(--picker-accent);
        background: #48484a;
        box-shadow: 0 0 0 1px color-mix(in srgb, var(--picker-accent) 48%, transparent);
    }
    .sunny-eyedropper-btn:disabled {
        opacity: 0.38;
        cursor: not-allowed;
        color: #8e8e93;
    }
    .sunny-color-picker-close:active,
    .sunny-eyedropper-btn:active {
        transform: scale(0.94);
    }
    .sunny-eyedropper-btn.is-active {
        color: #ffffff;
        border-color: var(--picker-accent);
        background: color-mix(in srgb, var(--picker-accent) 32%, #2c2c2e);
        box-shadow: 0 0 14px color-mix(in srgb, var(--picker-accent) 28%, transparent);
    }
    .sunny-color-picker.is-eyedropper-active:not(.is-eyedropper-capture-hidden) {
        box-shadow: 0 24px 66px rgba(0,0,0,.56), 0 0 0 1px rgba(255,255,255,.06) inset, 0 0 24px color-mix(in srgb, var(--picker-accent) 28%, transparent);
    }
    .sunny-color-picker.is-eyedropper-capture-hidden {
        opacity: 0 !important;
        visibility: hidden !important;
        transition: none !important;
    }
    .sunny-color-picker-body {
        padding: 12px;
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
    .sunny-color-sv {
        position: relative;
        height: 172px;
        border-radius: 10px;
        border: 1px solid rgba(255,255,255,0.12);
        overflow: hidden;
        cursor: crosshair;
        box-shadow: inset 0 0 0 1px rgba(0,0,0,0.15);
    }
    .sunny-color-sv-cursor,
    .sunny-color-hue-cursor {
        position: absolute;
        pointer-events: none;
        border: 2px solid #fff;
        box-shadow: 0 0 0 1px rgba(0,0,0,0.65), 0 4px 12px rgba(0,0,0,0.35);
    }
    .sunny-color-sv-cursor {
        width: 16px;
        height: 16px;
        border-radius: 50%;
        transform: translate(-50%, -50%);
    }
    .sunny-color-hue {
        position: relative;
        height: 18px;
        border-radius: 999px;
        border: 1px solid rgba(255,255,255,0.12);
        background: linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00);
    }
    .sunny-color-hue input[type="range"] {
        position: absolute;
        inset: -9px -2px;
        width: calc(100% + 4px);
        opacity: 0;
        cursor: pointer;
    }
    .sunny-color-hue-cursor {
        top: 50%;
        width: 14px;
        height: 26px;
        border-radius: 9px;
        transform: translate(-50%, -50%);
        background: rgba(28,28,30,0.72);
    }
    .sunny-color-compare {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 116px;
        gap: 8px;
        align-items: center;
    }
    .sunny-color-chip {
        position: relative;
        min-width: 0;
        height: 44px;
        border-radius: 10px;
        border: 1px solid rgba(255,255,255,0.13);
        background:
            linear-gradient(135deg, rgba(255,255,255,0.18), rgba(255,255,255,0) 38%),
            var(--chip-color, #ffffff);
        color: #fff;
        font-size: 12px;
        font-weight: 900;
        text-shadow: 0 1px 3px rgba(0,0,0,0.72);
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        justify-content: flex-end;
        padding: 7px 9px;
        cursor: pointer;
        transition: transform 0.16s ease, filter 0.16s ease, box-shadow 0.16s ease;
    }
    .sunny-color-chip::before {
        position: absolute;
        top: 6px;
        left: 9px;
        color: rgba(255,255,255,0.82);
        font-size: 10px;
        font-weight: 900;
        text-shadow: 0 1px 2px rgba(0,0,0,0.68);
    }
    .sunny-color-chip-current {
        position: relative;
    }
    .sunny-color-chip-current::before {
        content: "現在";
    }
    .sunny-color-chip-original {
        position: relative;
        height: 44px;
        padding: 7px 9px;
        font-size: 12px;
        opacity: 0.86;
    }
    .sunny-color-chip-original::before { content: "修改前"; }
    .sunny-color-chip-code {
        margin-top: 3px;
        font-size: 10px;
        font-family: Consolas, Monaco, Menlo, monospace;
        letter-spacing: 0;
        opacity: 0.95;
        text-transform: uppercase;
    }
    .sunny-color-chip-original:hover { opacity: 0.86; }
    .sunny-color-chip[data-role="current-color"] {
        cursor: default;
    }
    .sunny-color-default-btn {
        --default-color: #ffffff;
        width: 112px;
        height: 42px;
        border: 1px solid #48484a;
        border-radius: 8px;
        background: #3a3a3c;
        color: var(--picker-accent);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        padding: 0 9px;
        cursor: pointer;
        font-size: 12px;
        font-weight: 900;
        justify-self: end;
        transition: background 0.16s ease, border-color 0.16s ease, transform 0.12s ease, filter 0.16s ease;
    }
    .sunny-color-default-btn > span:not(.sunny-color-default-chip) {
        color: #f5f5f7;
        line-height: 1;
    }
    .sunny-color-default-chip {
        width: 17px;
        height: 17px;
        flex: 0 0 17px;
        border-radius: 5px;
        border: 1px solid rgba(255,255,255,0.20);
        background:
            linear-gradient(135deg, rgba(255,255,255,0.22), rgba(255,255,255,0) 40%),
            var(--default-color);
        box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08);
    }
    .sunny-color-default-btn svg {
        width: 17px;
        height: 17px;
        fill: none;
        stroke: currentColor;
        stroke-width: 2;
        stroke-linecap: round;
        stroke-linejoin: round;
    }
    .sunny-color-default-btn:hover {
        border-color: var(--picker-accent);
        background: #48484a;
        filter: brightness(1.06);
        box-shadow: 0 0 0 1px color-mix(in srgb, var(--picker-accent) 46%, transparent);
    }
    .sunny-color-default-btn:active {
        transform: scale(0.94);
    }
    .sunny-color-picker.is-value-changing .sunny-color-chip[data-role="current-color"] {
        animation: sunnyColorChipPulse 0.24s cubic-bezier(.2, .95, .28, 1.18);
    }
    .sunny-color-picker.is-value-changing .sunny-color-sv-cursor,
    .sunny-color-picker.is-value-changing .sunny-color-hue-cursor {
        animation: sunnyColorCursorPulse 0.22s ease-out;
    }
    .sunny-color-mode-tabs {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 4px;
        padding: 4px;
        border: 1px solid rgba(255,255,255,0.10);
        border-radius: 10px;
        background: rgba(12,12,14,0.42);
    }
    .sunny-color-mode-btn {
        min-width: 0;
        height: 28px;
        border: 1px solid #3a3a3c;
        border-radius: 8px;
        background: #242426;
        color: #d1d1d6;
        font-size: 11px;
        font-weight: 900;
        letter-spacing: 0;
        cursor: pointer;
        transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.12s ease;
    }
    .sunny-color-mode-btn:hover {
        color: #ffffff;
        border-color: #48484a;
        background: #3a3a3c;
    }
    .sunny-color-mode-btn:active {
        transform: scale(0.96);
    }
    .sunny-color-mode-btn.is-active {
        color: #ffffff;
        border-color: color-mix(in srgb, var(--picker-accent) 55%, rgba(255,255,255,0.18));
        background: color-mix(in srgb, var(--picker-accent) 32%, #242426);
        box-shadow: 0 0 14px color-mix(in srgb, var(--picker-accent) 18%, transparent);
    }
    .sunny-color-panels {
        display: flex;
        flex-direction: column;
        gap: 0;
    }
    .sunny-color-grid {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 8px;
    }
    .sunny-color-panel {
        max-height: 0;
        opacity: 0;
        transform: translateY(-5px) scale(0.99);
        overflow: hidden;
        pointer-events: none;
        transition:
            max-height 0.18s cubic-bezier(.2,.85,.28,1),
            opacity 0.14s ease,
            transform 0.18s cubic-bezier(.2,.85,.28,1);
    }
    .sunny-color-panel.is-active {
        max-height: 56px;
        opacity: 1;
        transform: translateY(0) scale(1);
        pointer-events: auto;
    }
    .sunny-color-picker.is-mode-switching .sunny-color-panel.is-active {
        animation: sunnyColorPanelSwitch 0.2s cubic-bezier(.18,.92,.22,1.08);
    }
    .sunny-color-picker.is-positioning .sunny-color-panel {
        transition: none !important;
        animation: none !important;
    }
    .sunny-color-panel[data-color-panel="rgb"],
    .sunny-color-panel[data-color-panel="hsl"] {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .sunny-color-panel[data-color-panel="hex"] {
        grid-template-columns: 1fr;
    }
    .sunny-color-field {
        display: flex;
        flex-direction: column;
        gap: 4px;
        min-width: 0;
    }
    .sunny-color-field.is-wide {
        grid-column: span 4;
    }
    .sunny-color-panel[data-color-panel="hex"] .sunny-color-field.is-wide {
        grid-column: 1 / -1;
    }
    .sunny-color-field span {
        color: #d1d1d6;
        font-size: 11px;
        font-weight: 900;
    }
    .sunny-color-field input {
        width: 100%;
        height: 34px;
        border-radius: 8px;
        border: 1px solid rgba(255,255,255,0.14);
        background: rgba(12,12,14,0.72);
        color: #ffffff;
        font-size: 13px;
        font-weight: 800;
        text-align: center;
        padding: 0 8px;
        outline: none;
        transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, transform 0.14s ease;
    }
    .sunny-color-field input:focus {
        border-color: var(--picker-accent) !important;
        box-shadow: 0 0 0 1px color-mix(in srgb, var(--picker-accent) 72%, transparent), 0 0 12px color-mix(in srgb, var(--picker-accent) 20%, transparent) !important;
        caret-color: var(--picker-accent);
    }
    .sunny-color-field input[type="text"] {
        text-align: left;
        font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
        letter-spacing: 0;
    }
    .sunny-color-field input.numeric-text-input {
        text-align: center;
        font-family: inherit;
    }
    .sunny-color-field.is-editing input {
        animation: sunnyColorFieldFlash 0.24s ease-out;
    }

    @keyframes sunnyColorPickerEnter {
        0% { opacity: 0; transform: translateY(-8px) scale(0.972); }
        64% { opacity: 1; transform: translateY(1px) scale(1.008); }
        100% { opacity: 1; transform: translateY(0) scale(1); }
    }
    @keyframes sunnyColorChipPulse {
        0% { transform: scale(1); filter: brightness(1); }
        48% { transform: scale(1.035); filter: brightness(1.14); }
        100% { transform: scale(1); filter: brightness(1); }
    }
    @keyframes sunnyColorCursorPulse {
        0% { box-shadow: 0 0 0 1px rgba(0,0,0,0.65), 0 4px 12px rgba(0,0,0,0.35); }
        52% { box-shadow: 0 0 0 3px rgba(255,255,255,0.56), 0 0 16px color-mix(in srgb, var(--picker-accent) 48%, transparent); }
        100% { box-shadow: 0 0 0 1px rgba(0,0,0,0.65), 0 4px 12px rgba(0,0,0,0.35); }
    }
    @keyframes sunnyColorSwatchPulse {
        0% { transform: scale(1); }
        48% { transform: scale(1.075); box-shadow: 0 0 0 1px var(--sunny-swatch-accent), 0 0 18px color-mix(in srgb, var(--sunny-swatch-accent) 34%, transparent); }
        100% { transform: scale(1); }
    }
    @keyframes sunnyColorSwatchShine {
        0% { filter: brightness(1); }
        52% { filter: brightness(1.18) saturate(1.08); }
        100% { filter: brightness(1); }
    }
    @keyframes sunnyColorFieldFlash {
        0% { transform: scale(1); background: rgba(12,12,14,0.72); }
        44% { transform: scale(1.025); background: color-mix(in srgb, var(--picker-accent) 22%, rgba(12,12,14,0.72)); }
        100% { transform: scale(1); background: rgba(12,12,14,0.72); }
    }
    @keyframes sunnyColorPanelSwitch {
        0% { opacity: 0; transform: translateY(5px) scale(0.985); }
        66% { opacity: 1; transform: translateY(-1px) scale(1.006); }
        100% { opacity: 1; transform: translateY(0) scale(1); }
    }

    html.sunny-eyedropper-active,
    html.sunny-eyedropper-active * {
        cursor: crosshair !important;
    }

    .sidebar select,
    .sidebar input[type="file"],
    .sidebar input[type="text"],
    .sidebar input[type="date"],
    .sidebar input[type="number"],
    #layoutModal select,
    #layoutModal input[type="file"],
    #layoutModal input[type="text"],
    #layoutModal input[type="date"],
    #layoutModal input[type="number"],
    #cdModal select,
    #cdModal input[type="file"],
    #cdModal input[type="text"],
    #cdModal input[type="date"],
    #cdModal input[type="number"],
    #cdModal textarea {
        background: #18181a !important;
        color: #f5f5f7 !important;
        border-color: #3a3a3c !important;
        caret-color: var(--workspace-accent);
    }
    .sidebar input::placeholder,
    #layoutModal input::placeholder,
    #cdModal input::placeholder,
    #cdModal textarea::placeholder,
    .cyan-input::placeholder {
        color: #8e8e93 !important;
        opacity: 1;
    }
    .cyan-input { border: 1px solid #3a3a3c !important; color: #f5f5f7 !important; background: #18181a !important; }
    .purple-select { border: 1px solid #3a3a3c !important; color: #f5f5f7 !important; background: #18181a !important; }
    .layout-paper-native-select { display: none !important; }
    .layout-paper-picker { display: flex; flex-direction: column; gap: 8px; }
    .layout-paper-type-row { display: grid; grid-template-columns: 1fr; gap: 8px; }
    .layout-paper-type-btn,
    .layout-paper-option-btn {
        min-height: 34px;
        border-radius: 8px;
        border: 1px solid #48484a;
        background: #1c1c1e;
        color: #d1d1d6;
        font-weight: 800;
        cursor: pointer;
        transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.12s ease, box-shadow 0.16s ease;
    }
    .layout-paper-type-btn:hover,
    .layout-paper-option-btn:hover {
        border-color: rgba(191, 90, 242, 0.72);
        color: #ffffff;
    }
    .layout-paper-type-btn:active,
    .layout-paper-option-btn:active { transform: scale(0.98); }
    .layout-paper-type-btn.active {
        background: #BF5AF2;
        border-color: #BF5AF2;
        color: #1c1c1e;
        box-shadow: 0 2px 8px rgba(191, 90, 242, 0.28);
    }
    .layout-paper-option-btn.active :is(span, small) { color: inherit; }
    .layout-paper-option-btn.active {
        background: #BF5AF2;
        border-color: #BF5AF2;
        color: #1c1c1e;
        box-shadow: 0 0 0 1px rgba(191, 90, 242, 0.18);
    }
    .layout-paper-option-grid {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 8px;
        max-height: 48px;
        opacity: 1;
        overflow: visible;
        transform: translateY(0) scaleY(1);
        transform-origin: top center;
        transition: max-height 0.24s ease, opacity 0.18s ease, transform 0.24s ease, margin 0.24s ease;
    }
    .layout-paper-option-grid[data-layout-paper-options="fixed"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .layout-paper-option-grid.is-hidden {
        max-height: 0;
        opacity: 0;
        margin-top: -8px;
        overflow: hidden;
        pointer-events: none;
        transform: translateY(-5px) scaleY(0.92);
    }
    .layout-unlimited-length-option {
        margin-top: 2px;
        opacity: 1;
        transition: opacity 0.18s ease;
    }
    .layout-unlimited-length-option.is-disabled {
        opacity: 0.42;
        pointer-events: none;
    }
    .layout-unlimited-length-option .switch-row {
        min-height: 38px;
        padding: 7px 2px;
        border: 0;
        border-radius: 0;
        background: transparent;
        color: #d9b4ff;
        font-size: 12px;
        font-weight: 800;
    }
    .layout-paper-option-btn {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        padding: 6px 4px;
        line-height: 1.15;
    }
    .layout-paper-option-btn span { font-size: 13px; }
    .layout-paper-option-btn small {
        color: #aeaeb2;
        font-size: 10px;
        font-weight: 800;
    }
    .layout-paper-option-btn.active small { color: var(--ink-on-accent); }
    .layout-paper-option-grid.is-fusing-in .layout-paper-option-btn {
        animation: layoutPaperFuseIn 0.34s cubic-bezier(0.2, 0.9, 0.18, 1.05) both;
    }
    .layout-paper-option-grid.is-splitting-in .layout-paper-option-btn:nth-child(1),
    .layout-paper-option-grid.is-splitting-in .layout-paper-option-btn:nth-child(3) {
        animation: layoutPaperSplitLeftIn 0.34s cubic-bezier(0.2, 0.9, 0.18, 1.05) both;
    }
    .layout-paper-option-grid.is-splitting-in .layout-paper-option-btn:nth-child(2),
    .layout-paper-option-grid.is-splitting-in .layout-paper-option-btn:nth-child(4) {
        animation: layoutPaperSplitRightIn 0.34s cubic-bezier(0.2, 0.9, 0.18, 1.05) both;
    }
    @keyframes layoutPaperFuseIn {
        0% { opacity: 0.35; transform: scaleX(0.46) translateY(-4px); filter: blur(0.6px); }
        58% { opacity: 1; transform: scaleX(1.08) translateY(0); filter: blur(0); }
        100% { opacity: 1; transform: scaleX(1) translateY(0); filter: blur(0); }
    }
    @keyframes layoutPaperSplitLeftIn {
        0% { opacity: 0.35; transform: translateX(48%) scaleX(0.58); filter: blur(0.6px); }
        62% { opacity: 1; transform: translateX(-5%) scaleX(1.04); filter: blur(0); }
        100% { opacity: 1; transform: translateX(0) scaleX(1); filter: blur(0); }
    }
    @keyframes layoutPaperSplitRightIn {
        0% { opacity: 0.35; transform: translateX(-48%) scaleX(0.58); filter: blur(0.6px); }
        62% { opacity: 1; transform: translateX(5%) scaleX(1.04); filter: blur(0); }
        100% { opacity: 1; transform: translateX(0) scaleX(1); filter: blur(0); }
    }

    .slider-box { display: flex; align-items: center; gap: 8px; }
    input[type="range"] { -webkit-appearance: none; width: 100%; background: transparent; height: 20px; flex:1; cursor: pointer; }
    input[type=range]:focus { outline: none; }
    input[type=range]::-webkit-slider-runnable-track { width: 100%; height: 4px; cursor: pointer; background: #3a3a3c; border-radius: 2px; }
    input[type=range]::-webkit-slider-thumb { height: 16px; width: 16px; border-radius: 50%; background: #ffffff; cursor: pointer; -webkit-appearance: none; margin-top: -6px; box-shadow: 0 2px 5px rgba(0,0,0,0.5); border: 1px solid #d1d1d6; }
    input[type=range]:focus::-webkit-slider-thumb {
        border-color: var(--workspace-accent, var(--primary));
        background: #ffffff;
        box-shadow: 0 2px 5px rgba(0,0,0,0.42), 0 0 0 3px color-mix(in srgb, var(--workspace-accent, var(--primary)) 24%, transparent);
    }

    .btn-icon { background: var(--surface-control); color: white; border: none; width: 30px; height: 30px; border-radius: 8px; cursor: pointer; font-weight: bold; font-size: 15px; display: flex; align-items: center; justify-content: center; transition: transform 0.12s ease, background 0.16s ease, color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease; user-select: none; }
    .btn-icon:hover { background: var(--surface-control-hover); box-shadow: var(--shadow-control-rest); }
    .btn-icon:active { background: var(--surface-control-active); transform: scale(0.95); }
    .btn-mini { background: var(--surface-control); font-size: 12px; padding: 0 8px; height: 26px; border-radius: 8px; color: white; border: 1px solid var(--surface-control-hover); cursor: pointer; font-weight: 700; transition: transform 0.12s ease, background 0.16s ease, color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease; }
    .btn-mini:hover { background: var(--surface-control-hover); box-shadow: var(--shadow-control-rest); }
    .btn-mini:active { transform: scale(0.97); }

    .btn { background: var(--primary); color: var(--ink-on-accent); border: 1px solid transparent; padding: 12px; border-radius: 8px; cursor: pointer; font-weight: bold; font-size: 15px; text-align: center; transition: transform 0.12s ease, background 0.16s ease, color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease; }
    :is(.spec-favorite-confirm-actions, .layout-favorite-manager-footer, .layout-favorite-name-actions,
        .simple-coverage-confirm-actions, .simple-complete-actions, .simple-complete-nav-actions,
        .batch-mode-footer, .ugem-upload-footer-actions) .btn:not([hidden]) {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding-block: 0;
        line-height: 1.2;
    }
    .btn:hover:not(:disabled) { background: var(--accent-orange-hover); filter: none; box-shadow: var(--glow-orange-soft); }
    .btn:active:not(:disabled) { transform: scale(0.985); }
    .btn:disabled, .btn-mini:disabled { opacity: 0.45; cursor: not-allowed; filter: none; }
    .btn-secondary { background: var(--surface-control); color: white; border: 1px solid var(--surface-control-hover); }
    .btn-secondary:hover:not(:disabled) { background: var(--surface-control-hover); box-shadow: var(--shadow-control-rest); }
    .btn-inline-icon {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
    }
    .ui-download-simple-icon {
        width: 1.12em;
        height: 1.12em;
        flex: 0 0 auto;
        display: inline-block;
        background: currentColor;
        -webkit-mask: url('./assets/icons/download-simple.svg') center / contain no-repeat;
        mask: url('./assets/icons/download-simple.svg') center / contain no-repeat;
    }
    .ui-upload-simple-icon {
        width: 1.12em;
        height: 1.12em;
        flex: 0 0 auto;
        display: inline-block;
        background: currentColor;
        -webkit-mask: url('./assets/icons/upload-simple.svg') center / contain no-repeat;
        mask: url('./assets/icons/upload-simple.svg') center / contain no-repeat;
    }
    .ui-settings-gear-icon {
        display: inline-block;
        width: 1em;
        height: 1em;
        flex: 0 0 auto;
        background: transparent url("./assets/icons/settings-gear-six.svg?v=6.10-release-r3") center / contain no-repeat;
    }
    .welcome-icon-btn .ui-settings-gear-icon {
        width: 26px;
        height: 26px;
    }
    .btn-full-row {
        width: 100%;
        margin-top: 8px;
    }
    .btn-flex-1 { flex: 1 1 0; }
    .btn-flex-2 { flex: 2 1 0; }
    .btn-tool-compact {
        width: 24px;
        height: 24px;
        padding: 0;
        flex-shrink: 0;
    }
    .btn-tool-circle {
        border-radius: 50%;
        font-size: 10px;
        font-weight: 400;
    }
    .btn-danger-pill {
        margin-top: 8px;
        padding: 6px 20px;
        border: 1px solid #ff3b30;
        border-radius: 20px;
        background: #ff3b30;
        color: #fff;
        font-size: 13px;
        font-weight: 800;
        cursor: pointer;
        transition: transform 0.12s ease, background 0.16s ease, border-color 0.16s ease;
    }
    .btn-danger-pill:hover {
        background: #ff5045;
        border-color: #ff5045;
    }
    .btn-danger-pill:active {
        transform: scale(0.97);
    }
    .btn-workspace-quick {
        --workspace-accent: #64a8ff;
        background: var(--workspace-accent);
        border-color: var(--workspace-accent);
        color: var(--ink-on-accent);
        font-weight: 800;
    }
    .btn.btn-workspace-quick:hover:not(:disabled) {
        background: #8fc1ff;
        border-color: #8fc1ff;
        color: var(--ink-on-accent);
        filter: none;
        box-shadow: 0 0 12px color-mix(in srgb, var(--workspace-accent) 18%, transparent);
    }
    .btn.btn-workspace-quick:focus-visible { outline-color: var(--workspace-accent); }
    .btn.btn-workspace-quick:disabled { box-shadow: none; }
    .btn-workspace-layout {
        --workspace-accent: #BF5AF2;
        background: #BF5AF2;
        border-color: #BF5AF2;
        color: var(--ink-on-accent);
        font-weight: 800;
    }
    .btn.btn-workspace-layout:hover:not(:disabled) {
        background: var(--accent-purple-hover);
        border-color: var(--accent-purple-hover);
        color: var(--ink-on-accent);
        filter: none;
        box-shadow: var(--glow-purple-soft);
    }
    .btn.btn-workspace-layout:focus-visible {
        outline-color: #BF5AF2;
    }
    .btn-workspace-cover {
        --workspace-accent: #32aec6;
        background: #32aec6;
        border-color: #32aec6;
        color: var(--ink-on-accent);
        font-weight: 800;
    }
    .btn.btn-workspace-cover:hover:not(:disabled) {
        background: var(--accent-blue-hover);
        border-color: var(--accent-blue-hover);
        color: var(--ink-on-accent);
        filter: none;
        box-shadow: var(--glow-blue-soft);
    }
    .btn.btn-workspace-cover:focus-visible {
        outline-color: #32aec6;
    }
    .filmstrip-action-btn {
        height: 46px;
        min-height: 46px;
        box-sizing: border-box;
        padding: 10px 12px;
        font-size: 15px;
        box-shadow: var(--shadow-control-rest);
        gap: 8px;
    }
    .modal-action-primary,
    .modal-confirm-btn {
        gap: 6px;
    }
    .modal-confirm-btn {
        gap: 8px;
    }
    .cd-custom-cover-reset-btn {
        width: 100%;
        margin-top: 2px;
    }
    .cd-action-row {
        display: flex;
        gap: 10px;
        padding-top: 8px;
    }
    .micro-adjust-header {
        gap: 10px;
    }
    .micro-adjust-actions {
        display: flex;
        align-items: center;
        gap: 8px;
        flex-shrink: 0;
    }
    .micro-adjust-mode {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 4px;
        padding: 4px;
        border: 1px solid #3a3a3c;
        border-radius: 8px;
        background: rgba(0,0,0,0.24);
        transition: opacity 0.18s ease, border-color 0.18s ease;
    }
    .micro-adjust-mode-btn {
        min-width: 0;
        min-height: 32px;
        padding: 6px 8px;
        border: 1px solid transparent;
        border-radius: 6px;
        background: transparent;
        color: #aeaeb2;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        font: inherit;
        font-size: 12px;
        font-weight: 800;
        cursor: pointer;
        white-space: nowrap;
        transition: color 0.16s ease, border-color 0.16s ease, background 0.16s ease;
    }
    .micro-adjust-mode-btn:hover {
        color: #fff;
        background: rgba(255,255,255,0.055);
    }
    .micro-adjust-mode-btn.active {
        color: #161618;
        border-color: rgba(255,159,10,0.82);
        background: var(--primary);
    }
    .micro-adjust-mode-btn.lock-mode-tab.active {
        color: #ffffff;
        border-color: #ff453a;
        background: rgba(255,69,58,0.24);
        box-shadow: 0 0 0 1px rgba(255,69,58,0.10), 0 0 12px rgba(255,69,58,0.16);
    }
    .positioning-control-group {
        gap: 10px;
    }
    .linked-positioning-tools {
        display: flex;
        flex-direction: column;
        gap: 8px;
        min-width: 0;
    }
    .linked-positioning-tools[hidden] {
        display: none !important;
    }
    .positioning-tools-label {
        color: var(--primary);
        font-size: 13px;
        font-weight: 800;
    }
    .sidebar-reset-btn {
        gap: 6px;
    }
    .sensitivity-toggle {
        height: 26px;
        border-radius: 999px;
        border: 1px solid rgba(255,159,10,0.55);
        background: rgba(255,159,10,0.14);
        color: #f5f5f7;
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 0 8px 0 10px;
        cursor: pointer;
        font-size: 12px;
        font-weight: 800;
        line-height: 1;
        white-space: nowrap;
        transition: transform 0.15s ease, background 0.18s ease, border-color 0.18s ease;
    }
    .sensitivity-toggle > span:first-child,
    .sensitivity-toggle strong {
        display: inline-flex;
        align-items: center;
        min-height: 14px;
        font-size: 12px;
        font-weight: 800;
        line-height: 14px;
    }
    .sensitivity-toggle strong {
        color: var(--primary);
    }
    .sensitivity-toggle:hover {
        background: rgba(255,159,10,0.22);
        border-color: var(--primary);
    }
    .sensitivity-toggle:active {
        transform: scale(0.96);
    }
    .sensitivity-toggle:focus-visible {
        outline: none;
        box-shadow: 0 0 0 2px rgba(255,159,10,0.68);
    }
    .sensitivity-dot-ring {
        width: 18px;
        height: 18px;
        border-radius: 50%;
        border: 2px solid #1c1c1e;
        box-shadow: 0 0 0 1px rgba(255,255,255,0.22);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 18px;
        align-self: center;
    }
    .sensitivity-dot {
        display: inline-block;
        flex: 0 0 auto;
        background: var(--primary);
    }
    .line-width-toggle { --primary: #BF5AF2; height: 36px; border-color: rgba(191,90,242,.55); background: rgba(191,90,242,.14); padding: 0 10px; }
    select[data-line-width-control][hidden], label:has(select[data-line-width-control]) > span[hidden] { display: none; }
    .line-width-toggle:hover:not(:disabled) { border-color: var(--primary); background: rgba(191,90,242,.22); }
    .line-width-toggle:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
    .line-width-toggle .sensitivity-dot { transition: width 160ms ease, height 160ms ease; }
    body:is(.decorative-animations-off, .app-background-paused) .line-width-toggle .sensitivity-dot { transition: none; }
    @media (prefers-reduced-motion: reduce) { .line-width-toggle .sensitivity-dot { transition: none; } }
    .adjust-control-row {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .pan-adjust-row {
        gap: 0 !important;
    }
    .micro-adjust-section {
        height: 122px;
        min-height: 122px;
        box-sizing: border-box;
    }
    .pan-control-grid {
        display: grid;
        grid-template-columns: 48px minmax(76px, 1fr) 96px;
        align-items: start;
        gap: 10px;
        width: 100%;
    }
    .pan-control-grid > .adjust-tool-title {
        align-self: start;
        height: 24px;
        display: inline-flex;
        align-items: center;
    }
    .pan-control-grid #btnLinkRuler {
        justify-self: end;
        margin-right: 8px;
    }
    .pan-control-grid #btnLinkRuler,
    .adjust-value-actions #btnZoomMode,
    .rot-action-row #btnStraighten {
        width: 96px;
        min-width: 96px;
        max-width: 96px;
        height: 26px;
        box-sizing: border-box;
        padding-left: 6px;
        padding-right: 6px;
        justify-content: center;
    }
    .link-ruler-btn {
        height: 26px;
        padding: 0 8px;
        font-size: 12px;
        font-weight: 700;
        white-space: nowrap;
    }
    .link-ruler-btn.is-linked {
        background: #ff3b30;
        border-color: #ff3b30;
        color: #ffffff;
    }
    .link-ruler-btn.is-linked:hover:not(:disabled) {
        background: #ff5045;
        border-color: #ff5045;
        box-shadow: 0 0 12px rgba(255, 59, 48, 0.22);
    }
    .adjust-control-top {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        min-height: 28px;
    }
    .adjust-tool-title {
        color: var(--primary);
        font-size: 14px;
        font-weight: 800;
        flex: 0 0 auto;
    }
    .adjust-value-actions {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 6px;
        min-width: 0;
    }
    .adjust-control-row .adjust-control-body {
        width: 100%;
        min-width: 0;
    }
    .pan-nudge-pad {
        display: grid;
        grid-template-columns: repeat(3, 24px);
        grid-template-rows: repeat(2, 24px);
        gap: 2px;
        justify-content: center;
        justify-self: center;
        position: relative;
        top: 3px;
    }
    .pan-nudge-pad .btn-icon {
        width: 24px;
        height: 24px;
        line-height: 1;
        padding: 0;
    }
    #panUp {
        grid-column: 2;
        grid-row: 1;
    }
    #panLeft {
        grid-column: 1;
        grid-row: 2;
    }
    #panDown {
        grid-column: 2;
        grid-row: 2;
    }
    #panRight {
        grid-column: 3;
        grid-row: 2;
    }
    .adjust-slider-row {
        width: 100%;
        gap: 8px;
        align-items: center;
    }
    .adjust-slider-row .btn-icon {
        width: 26px !important;
        height: 26px !important;
        line-height: 1;
        padding: 0 0 2px 0;
        align-self: center;
    }
    .adjust-slider-row #zoomOut {
        font-size: 18px;
        padding-bottom: 4px;
    }
    .adjust-slider-row #zoomIn {
        font-size: 17px;
        padding-bottom: 2px;
    }
    .adjust-slider-row #rotLeft,
    .adjust-slider-row #rotRight {
        font-size: 18px;
        padding-bottom: 3px;
    }
    .adjust-control-row input[type="range"] {
        min-width: 0;
        width: 100%;
    }
    .zoom-slider-shell {
        --sat-left: 0%;
        --sat-right: 100%;
        position: relative;
        flex: 1 1 auto;
        min-width: 0;
        height: 28px;
        display: flex;
        align-items: center;
    }
    .zoom-slider-shell input[type="range"] {
        position: relative;
        z-index: 2;
        flex: 1;
        background: transparent;
    }
    .zoom-satellite {
        position: absolute;
        top: 50%;
        left: var(--sat-left);
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: var(--primary);
        box-shadow: 0 0 0 2px rgba(28,28,30,0.85), 0 0 8px rgba(255,159,10,0.55);
        transform: translate(-50%, -50%);
        transition: left 0.28s cubic-bezier(0.2, 0.8, 0.2, 1), background 0.18s ease, box-shadow 0.18s ease;
        pointer-events: none;
        z-index: 3;
    }
    .zoom-slider-shell.is-dragging .zoom-satellite {
        transition: background 0.18s ease, box-shadow 0.18s ease;
    }
    .zoom-satellite-right {
        left: var(--sat-right);
    }
    .zoom-slider-shell.is-absolute .zoom-satellite {
        background: #3CAE4E;
        box-shadow: 0 0 0 2px rgba(28,28,30,0.85), 0 0 8px rgba(60,174,78,0.5);
    }
    .zoom-fit-row {
        display: flex;
        justify-content: space-between;
        margin-top: 6px;
        padding: 0 32px;
    }
    .pan-align-row {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
        grid-column: 1 / -1;
        width: 100%;
        box-sizing: border-box;
        margin-top: 8px;
    }
    .zoom-fit-btn {
        min-width: 66px;
        font-size: 11px;
        padding: 0 8px;
        border-color: #48484a;
        color: #fff;
        background: #3a3a3c;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 4px;
        white-space: nowrap;
    }
    .zoom-fit-btn .axis-icon {
        color: var(--primary);
        font-size: 14px;
        line-height: 1;
    }
    .pan-align-btn svg {
        flex: 0 0 auto;
        color: var(--primary);
    }
    .rot-preset-row {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
        margin-top: 6px;
        padding: 0 32px;
    }
    .pan-align-btn,
    .rot-preset-btn {
        width: 100%;
        min-width: 0;
    }
    .rot-preset-btn {
        font-size: 11px;
        padding: 0 4px;
        border-color: #48484a;
        color: #fff;
        background: #3a3a3c;
    }
    .rot-preset-btn:hover:not(:disabled) {
        background: #48484a;
    }
    .rot-action-row {
        gap: 6px;
        flex-wrap: nowrap;
        min-width: 0;
    }
    .rot-action-row .btn-mini,
    .rot-action-row .val-text {
        flex-shrink: 0;
        white-space: nowrap;
    }
    .btn-straighten {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 4px;
        white-space: nowrap;
    }
    .btn-straighten .straighten-ruler-icon {
        flex: 0 0 auto;
        transform: translateY(-1px);
    }
    .btn-rot-export {
        display: none;
        background: var(--primary);
        color: #1c1c1e;
        border-color: var(--primary);
        font-weight: 800;
        padding: 0 10px;
    }
    .btn-rot-export.is-visible {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    .btn-rot-export:hover {
        filter: brightness(1.08);
        background: var(--primary);
    }

    .btn-green { background: var(--accent-green); color: var(--ink-on-accent); border: 1px solid var(--accent-green); font-weight: bold; }
    .btn-green:hover:not(:disabled) { background: var(--accent-green-hover); border-color: var(--accent-green-hover); box-shadow: var(--glow-green-soft); }
    .btn-green:focus-visible {
        outline: none;
        box-shadow: inset 0 0 0 2px rgba(225,255,229,0.42), var(--glow-green-soft);
    }
    .zoom-mode-btn {
        color: var(--ink-on-accent);
        font-weight: 800;
        line-height: 1;
        white-space: nowrap;
        overflow: hidden;
    }
    .zoom-mode-relative:hover:not(:disabled) {
        background: var(--accent-green-hover);
        border-color: var(--accent-green-hover);
        color: var(--ink-on-accent) !important;
        filter: none;
        box-shadow: var(--glow-green-soft);
    }
    .btn-orange { background: var(--primary); color: var(--ink-on-accent); border: 1px solid var(--primary); font-weight: bold; transition: transform 0.12s ease, background 0.16s ease, color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease; }
    .btn-orange:hover:not(:disabled) { background: var(--accent-orange-hover); border-color: var(--accent-orange-hover); filter: none; color: var(--ink-on-accent) !important; box-shadow: var(--glow-orange-soft); }
    #btnZoomMode.zoom-mode-absolute:hover:not(:disabled) {
        background: var(--accent-orange-hover);
        border-color: var(--accent-orange-hover);
        color: var(--ink-on-accent) !important;
        filter: none;
        box-shadow: var(--glow-orange-soft);
    }

    .head-detect-actions {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    .head-detect-switch {
        display: flex;
        align-items: stretch;
        gap: 8px;
        position: relative;
        isolation: isolate;
    }
    .head-detect-switch::before,
    .head-detect-switch::after {
        content: "";
        position: absolute;
        top: -12px;
        bottom: -12px;
        left: -10px;
        right: 55px;
        pointer-events: none;
        opacity: 0;
        border-radius: 18px;
        transition: opacity 0.35s ease, transform 0.45s ease;
    }
    .head-detect-switch::before {
        z-index: 0;
        transform: scale(0.92);
        background:
            radial-gradient(circle at 12% 50%, rgba(255, 159, 10, 0.72) 0%, rgba(255, 159, 10, 0.16) 16%, rgba(255, 159, 10, 0) 34%),
            radial-gradient(circle at 50% 18%, rgba(191, 90, 242, 0.68) 0%, rgba(191, 90, 242, 0.16) 18%, rgba(191, 90, 242, 0) 36%),
            radial-gradient(circle at 86% 52%, rgba(50, 174, 198, 0.72) 0%, rgba(50, 174, 198, 0.18) 17%, rgba(50, 174, 198, 0) 35%),
            radial-gradient(circle at 50% 84%, rgba(255, 159, 10, 0.52) 0%, rgba(255, 159, 10, 0.12) 16%, rgba(255, 159, 10, 0) 30%);
        background-size: 180% 180%;
        background-position: 0% 50%, 50% 0%, 100% 50%, 50% 100%;
        filter: blur(14px) saturate(1.16);
    }
    .head-detect-switch::after {
        z-index: 1;
        top: -3px;
        bottom: -3px;
        left: -3px;
        right: 52px;
        border: 1px solid rgba(255,255,255,0.18);
        background: radial-gradient(circle at 50% 50%, rgba(255,255,255,0.22) 0%, rgba(255,255,255,0.04) 38%, rgba(255,255,255,0) 72%);
        filter: blur(3px);
        transform: scale(0.94);
    }
    .head-detect-switch.advanced-magic-casting::before {
        opacity: 0.92;
        transform: scale(1.02);
        animation: advancedMagicAuraDrift 1.2s linear infinite, advancedMagicHaloPulse 1.35s ease-in-out infinite;
    }
    .head-detect-switch.advanced-magic-casting::after {
        opacity: 0.72;
        transform: scale(1.01);
        animation: advancedMagicInnerPulse 1.25s ease-in-out infinite;
    }
    .head-detect-switch.advanced-magic-settling::before {
        opacity: 0;
        transform: scale(1.18);
        animation: advancedMagicHaloFade 0.9s ease-out forwards;
    }
    .head-detect-switch.advanced-magic-settling::after {
        opacity: 0;
        transform: scale(1.12);
        animation: advancedMagicHaloFade 0.82s ease-out forwards;
    }
    .head-mode-button {
        flex: 1 1 auto;
        width: auto;
        box-sizing: border-box;
        height: 47px;
        min-height: 47px;
        padding: 0 12px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 7px;
        position: relative;
        overflow: hidden;
        transform-origin: center center;
        transition: transform 0.18s ease, filter 0.18s ease, box-shadow 0.24s ease, background 0.24s ease, border-color 0.24s ease, color 0.24s ease;
        z-index: 2;
    }
    .head-mode-button > svg {
        width: 1em;
        height: 1em;
        flex: 0 0 auto;
        color: inherit;
    }
    .head-mode-button-label {
        display: inline-flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 1px;
        line-height: 1.08;
    }
    .head-mode-button-escape {
        display: block;
        font-size: 10px;
        font-weight: 700;
        opacity: 0.82;
    }
    .head-mode-button::after {
        content: "";
        position: absolute;
        top: 0;
        bottom: 0;
        left: -45%;
        width: 36%;
        pointer-events: none;
        opacity: 0;
        background: linear-gradient(100deg, transparent 0%, rgba(255,255,255,0.32) 48%, transparent 100%);
        transform: skewX(-16deg);
    }
    .head-mode-button.is-mode-switching {
        animation: headModeSwitchPop 0.32s cubic-bezier(0.18, 0.9, 0.28, 1.24) both;
    }
    .head-mode-button.is-mode-switching::after {
        animation: headModeSwitchSheen 0.34s ease-out both;
    }
    .head-mode-button.is-hidden {
        display: none !important;
    }
    .btn-head-mode-toggle {
        width: 47px;
        height: 47px;
        flex: 0 0 47px;
        border: 1px solid #3CAE4E;
        border-radius: 8px;
        background: #3CAE4E;
        color: #1c1c1e;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        box-shadow: 0 6px 14px rgba(0,0,0,0.24);
        transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease, filter 0.16s ease;
        position: relative;
        overflow: hidden;
        z-index: 3;
    }
    .btn-head-mode-toggle svg {
        transition: transform 0.18s ease;
    }
    .btn-head-mode-toggle[aria-expanded="true"] {
        background: #48C55A;
        border-color: #78dc86;
        box-shadow: 0 6px 16px rgba(0,0,0,0.28), 0 0 0 2px rgba(60,174,78,0.22);
    }
    .btn-head-mode-toggle[aria-expanded="true"] svg {
        transform: scale(1.04);
    }
    .btn-head-mode-toggle:hover {
        background: #48C55A;
        border-color: #48C55A;
        filter: brightness(1.04);
    }
    .btn-head-mode-toggle:focus-visible {
        outline: 2px solid #62d579;
        outline-offset: 2px;
        box-shadow: 0 6px 16px rgba(0,0,0,0.28), 0 0 0 2px rgba(60,174,78,0.22), 0 0 12px rgba(60,174,78,0.24);
    }
    .btn-head-mode-toggle:active {
        transform: translateY(1px) scale(0.98);
    }
    .head-mode-menu {
        display: flex;
        flex-direction: column;
        gap: 6px;
        margin-top: 0;
        max-height: 0;
        padding: 0 8px;
        opacity: 0;
        overflow: hidden;
        pointer-events: none;
        transform: translateY(-6px);
        border: 1px solid rgba(255,159,10,0);
        border-radius: 8px;
        background: linear-gradient(180deg, rgba(35,31,27,0.96) 0%, rgba(24,24,26,0.96) 100%);
        transition:
            max-height 0.34s cubic-bezier(0.22, 0.9, 0.24, 1),
            opacity 0.22s ease,
            transform 0.28s ease,
            margin-top 0.28s ease,
            padding 0.28s ease,
            border-color 0.28s ease;
    }
    .head-mode-menu.is-open {
        max-height: 480px;
        margin-top: 2px;
        padding: 8px;
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0);
        border-color: rgba(255,159,10,0.30);
        box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
    }
    .head-placement-control {
        --head-placement-color: #ff9f0a;
        --workspace-accent: var(--head-placement-color);
        --head-placement-border: rgba(255,159,10,.30);
        --head-placement-background: rgba(255,159,10,.08);
        display: flex;
        flex-direction: column;
        gap: 5px;
        padding: 9px 10px 8px;
        border: 1px solid var(--head-placement-border);
        border-radius: 7px;
        background: var(--head-placement-background);
        transition: background-color .28s ease, border-color .28s ease, color .28s ease;
    }
    .head-placement-control.is-independent {
        --head-placement-color: #3CAE4E;
        --head-placement-border: rgba(60,174,78,.30);
        --head-placement-background: rgba(60,174,78,.08);
    }
    .head-placement-mode.switch-row { --switch-accent: var(--head-placement-color); position: relative; min-height: 28px; padding: 0; margin: 0; gap: 8px; font-size: 12px; color: var(--head-placement-color); transition: color .28s ease; }
    .head-placement-mode .switch-control { border-color: var(--head-placement-border); transition: background-color .28s ease, border-color .28s ease, box-shadow .28s ease; }
    .head-placement-mode .switch-control::after { transition: transform .28s ease, background-color .28s ease; }
    .head-placement-mode input:not(:checked) + .switch-control::after { background: var(--head-placement-color); }
    .head-placement-mode:hover input:not(:checked):not(:disabled) + .switch-control::after { background: color-mix(in srgb, var(--head-placement-color) 72%, white); }
    .head-placement-mode:has(input:disabled) { pointer-events: none; opacity: .45; }
    .head-placement-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; align-items: center; }
    .head-placement-actions .btn-mini { color: var(--head-placement-color); border-color: var(--head-placement-border); background: var(--head-placement-background); transition: color .28s ease, background-color .28s ease, border-color .28s ease, box-shadow .18s ease, transform .12s ease; }
    .head-placement-actions #btnRestoreHeadPlacementDefault { color: #f5f5f7; background: var(--surface-control); border-color: var(--surface-control-hover); }
    .head-placement-actions #btnRestoreHeadPlacementDefault:hover:not(:disabled) { background: var(--surface-control-hover); border-color: var(--surface-control-hover); filter: none; }
    .head-placement-actions .btn-mini:hover:not(:disabled) { border-color: var(--head-placement-color); filter: brightness(1.12); }
    .head-placement-actions .btn-mini:focus-visible { outline: 2px solid var(--head-placement-color); outline-offset: 2px; box-shadow: none; }
    .head-placement-header,
    .head-placement-scale {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    .head-placement-header {
        color: #f5f5f7;
        font-size: 12px;
        font-weight: 800;
    }
    .head-placement-header strong {
        color: var(--head-placement-color);
        font-size: 11px;
        transition: color .28s ease;
    }
    .head-placement-control input[type="range"] {
        width: 100%;
        accent-color: var(--head-placement-color);
    }
    .head-placement-control input[type="range"]::-webkit-slider-thumb { background: var(--head-placement-color); border-color: var(--head-placement-color); transition: background-color .28s ease, border-color .28s ease, box-shadow .28s ease; }
    .head-placement-control input[type="range"]::-webkit-slider-runnable-track { background: color-mix(in srgb, var(--head-placement-color) 32%, #3a3a3c); transition: background-color .28s ease; }
    body.decorative-animations-off .head-placement-control,
    body.decorative-animations-off .head-placement-control *,
    body.decorative-animations-off .head-placement-control *::after,
    body.decorative-animations-off .head-placement-control input[type="range"]::-webkit-slider-thumb,
    body.decorative-animations-off .head-placement-control input[type="range"]::-webkit-slider-runnable-track { transition: none; }
    @media (prefers-reduced-motion: reduce) {
        .head-placement-control, .head-placement-control *, .head-placement-control *::after,
        .head-placement-control input[type="range"]::-webkit-slider-thumb,
        .head-placement-control input[type="range"]::-webkit-slider-runnable-track { transition: none; }
    }
    .head-placement-control.is-disabled {
        border-color: rgba(255,255,255,0.12);
        background: rgba(255,255,255,0.035);
    }
    .head-placement-control.is-disabled input[type="range"],
    .head-placement-control.is-disabled .head-placement-scale,
    .head-placement-control.is-disabled .head-placement-note {
        opacity: 0.45;
    }
    .head-placement-control.is-disabled .head-placement-header strong {
        color: #a6a6aa;
    }
    .head-placement-scale {
        color: #a6a6aa;
        font-size: 10px;
        font-weight: 700;
    }
    .head-placement-note {
        color: rgba(245,245,247,0.62);
        font-size: 10px;
        line-height: 1.3;
    }
    .head-mode-option {
        width: 100%;
        min-height: 50px;
        padding: 8px 10px 8px 13px;
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:
            "main current"
            "desc current";
        align-items: center;
        gap: 1px 8px;
        position: relative;
        border: 1px solid rgba(255,255,255,0.06);
        border-radius: 7px;
        background: rgba(28,28,30,0.72);
        color: #f5f5f7;
        text-align: left;
        cursor: pointer;
        transform: translateY(-3px);
        opacity: 0;
        transition:
            transform 0.22s ease,
            opacity 0.22s ease,
            background 0.18s ease,
            border-color 0.18s ease,
            box-shadow 0.18s ease,
            color 0.18s ease;
    }
    .head-mode-menu.is-open .head-mode-option {
        transform: translateY(0);
        opacity: 1;
    }
    .head-mode-menu.is-open .head-mode-option:nth-child(2) {
        transition-delay: 0.035s;
    }
    .head-mode-menu.is-open .head-mode-option:nth-child(3) {
        transition-delay: 0.07s;
    }
    .head-mode-option::before {
        content: "";
        position: absolute;
        left: 5px;
        top: 10px;
        bottom: 10px;
        width: 3px;
        border-radius: 999px;
        background: #ff9f0a;
        opacity: 0.62;
        transition: opacity 0.18s ease, width 0.18s ease, box-shadow 0.18s ease;
    }
    .head-mode-option[data-head-mode="advanced"]::before {
        background: #d6752c;
    }
    .head-mode-option[data-head-mode="manual"]::before {
        background: #8e8e93;
    }
    .head-mode-option:hover {
        background: rgba(43,40,36,0.96);
        border-color: rgba(255,159,10,0.22);
        box-shadow: inset 0 0 0 1px rgba(255,159,10,0.04);
    }
    .head-mode-option.is-active {
        border-color: rgba(255,159,10,0.58);
        background: rgba(255,159,10,0.13);
        box-shadow: inset 0 0 0 1px rgba(255,159,10,0.08), 0 0 14px rgba(255,159,10,0.05);
    }
    .head-mode-option.is-active::before {
        width: 4px;
        opacity: 1;
        box-shadow: 0 0 8px rgba(255,159,10,0.38);
    }
    .head-mode-option[data-head-mode="advanced"].is-active {
        border-color: rgba(214,117,44,0.58);
        background: rgba(214,117,44,0.14);
    }
    .head-mode-option[data-head-mode="manual"].is-active {
        border-color: rgba(142,142,147,0.56);
        background: rgba(142,142,147,0.14);
    }
    .head-mode-option-main {
        grid-area: main;
        font-size: 13px;
        font-weight: 800;
        line-height: 1.25;
    }
    .head-mode-option-desc {
        grid-area: desc;
        color: rgba(245,245,247,0.70);
        font-size: 11px;
        font-weight: 600;
        line-height: 1.25;
    }
    .head-mode-option-current {
        grid-area: current;
        display: inline-flex;
        color: transparent;
        font-size: 10px;
        font-weight: 800;
        white-space: nowrap;
        opacity: 0;
        transform: translateX(-3px);
        transition: opacity 0.16s ease, transform 0.16s ease, color 0.16s ease;
    }
    .head-mode-option.is-active .head-mode-option-current {
        display: inline-flex;
        opacity: 1;
        transform: translateX(0);
        color: #ff9f0a;
    }
    .head-mode-option[data-head-mode="advanced"].is-active .head-mode-option-current {
        color: #ffb15c;
    }
    .head-mode-option[data-head-mode="manual"].is-active .head-mode-option-current {
        color: #d1d1d6;
    }
    .btn-magic-auto {
        position: relative;
        isolation: isolate;
        background: var(--primary);
        color: var(--ink-on-accent);
        border-color: var(--primary);
        box-shadow: var(--shadow-control-rest), 0 0 0 1px rgba(255,255,255,0.08) inset;
    }
    .btn-magic-auto:hover:not(:disabled) {
        background: var(--accent-orange-hover);
        border-color: var(--accent-orange-hover);
        color: var(--ink-on-accent);
        filter: none;
        box-shadow: var(--shadow-control-hover), var(--glow-orange-soft);
    }
    .btn-advanced-magic {
        position: relative;
        isolation: isolate;
        border: 1px solid rgba(255,159,10,0.68);
        color: #f5f5f7;
        background: rgba(255,159,10,0.14);
        box-shadow: inset 0 0 0 1px rgba(255,159,10,0.12), 0 0 0 1px rgba(255,159,10,0.08), var(--shadow-control-rest);
    }
    .btn-advanced-magic:hover:not(:disabled) {
        background: rgba(255,159,10,0.22);
        border-color: var(--primary);
        color: #ffffff;
        filter: none;
        box-shadow: var(--glow-orange-soft);
    }
    .btn-magic-auto .magic-sigil {
        flex: 0 0 auto;
    }
    .btn-advanced-magic .magic-sigil {
        flex: 0 0 auto;
    }
    .btn-magic-auto.is-loading:disabled,
    .btn-advanced-magic.is-loading:disabled {
        opacity: 1;
        cursor: wait;
    }
    .btn-magic-auto::before {
        content: "";
        position: absolute;
        inset: 0;
        border-radius: inherit;
        z-index: -1;
        pointer-events: none;
        background: linear-gradient(90deg, #ff9f0a 0%, #bf5af2 42%, #32aec6 76%, #ff9f0a 100%);
        background-size: 260% 100%;
        opacity: 0;
        transition: opacity .32s ease-out;
        animation: magicButtonGradient 1.15s linear infinite paused;
    }
    .btn-magic-auto:is(.is-loading, .is-ready)::before { animation-play-state: running; }
    .btn-magic-auto.is-loading::before { opacity: 1; }
    .decorative-animations-off .btn-magic-auto::before { transition: none; }
    @media (prefers-reduced-motion: reduce) {
        .btn-magic-auto::before { animation: none; transition: none; }
    }
    .btn-magic-auto.is-loading .magic-sigil {
        transform-origin: center;
        animation: magicWandFlip 1.25s ease-in-out infinite;
    }
    .btn-advanced-magic::before {
        content: "";
        position: absolute;
        inset: 0;
        border-radius: inherit;
        z-index: -1;
        pointer-events: none;
        background: linear-gradient(135deg, rgba(37, 20, 11, 0.98) 0%, rgba(63, 28, 24, 0.98) 42%, rgba(18, 34, 46, 0.96) 100%);
        opacity: 0;
        transition: opacity .32s ease-out;
    }
    .btn-advanced-magic.is-loading::before { opacity: 1; }
    .decorative-animations-off .btn-advanced-magic::before { transition: none; }
    @media (prefers-reduced-motion: reduce) {
        .btn-advanced-magic::before { transition: none; }
    }
    .btn-advanced-magic.is-loading {
        color: #fff7ef;
        border-color: rgba(255, 196, 120, 0.7);
        box-shadow: 0 0 0 1px rgba(255,255,255,0.12), 0 10px 24px rgba(0,0,0,0.42), 0 0 18px rgba(191,90,242,0.14);
        animation: advancedMagicCorePulse 1.32s ease-in-out infinite;
    }
    .btn-advanced-magic.is-loading .magic-sigil {
        animation: magicSigilSpin 1.1s linear infinite, advancedMagicSigilPulse 1.2s ease-in-out infinite;
        filter: drop-shadow(0 0 5px rgba(255, 210, 160, 0.34));
    }
    .btn-advanced-magic.is-ready {
        animation: advancedMagicReadySettle 0.88s ease-out both;
    }
    .btn-magic-auto.is-picking-top {
        background: #ff3b30;
        border-color: #ff3b30;
        color: #ffffff;
    }
    .btn-magic-auto.is-picking-top:hover:not(:disabled) {
        background: #ff5045;
        border-color: #ff5045;
        color: #ffffff;
    }
    .btn-magic {
        background: #3a3a3c;
        color: #f5f5f7;
        border-color: #48484a;
        box-shadow: var(--shadow-control-rest);
    }
    .btn-magic:hover:not(:disabled) {
        background: #444448;
        border-color: #5a5a5f;
        color: #ffffff;
        filter: none;
    }
    .btn-magic.active { background: #ff3b30; color: white; }
    .btn-magic.active:hover { background: #ff5045; }
    @keyframes magicWandFlip {
        0%, 100% { transform: scaleX(1); }
        50% { transform: scaleX(-1); }
    }
    @keyframes magicSigilSpin {
        to { transform: rotate(360deg); }
    }
    @keyframes magicButtonGradient {
        from { background-position: 0% 50%; }
        to { background-position: 260% 50%; }
    }
    @keyframes headModeSwitchPop {
        0% { transform: scale(0.94); filter: brightness(0.96); }
        58% { transform: scale(1.045); filter: brightness(1.08); }
        100% { transform: scale(1); filter: brightness(1); }
    }
    @keyframes headModeSwitchSheen {
        0% { left: -45%; opacity: 0; }
        20% { opacity: 0.85; }
        100% { left: 112%; opacity: 0; }
    }
    @keyframes advancedMagicAuraDrift {
        0% { background-position: 0% 50%, 50% 0%, 100% 50%, 50% 100%; }
        100% { background-position: 100% 50%, 50% 100%, 0% 50%, 50% 0%; }
    }
    @keyframes advancedMagicHaloPulse {
        0%, 100% { filter: blur(16px) saturate(1.1); opacity: 0.84; }
        50% { filter: blur(19px) saturate(1.28); opacity: 1; }
    }
    @keyframes advancedMagicInnerPulse {
        0%, 100% { opacity: 0.46; }
        50% { opacity: 0.82; }
    }
    @keyframes advancedMagicHaloFade {
        0% { opacity: 0.92; }
        100% { opacity: 0; }
    }
    @keyframes advancedMagicCorePulse {
        0%, 100% { transform: translateY(0) scale(1); box-shadow: 0 0 0 1px rgba(255,255,255,0.14), 0 10px 26px rgba(0,0,0,0.44), 0 0 24px rgba(191,90,242,0.16); }
        50% { transform: translateY(-1px) scale(1.02); box-shadow: 0 0 0 1px rgba(255,255,255,0.16), 0 12px 30px rgba(0,0,0,0.48), 0 0 28px rgba(50,174,198,0.26); }
    }
    @keyframes advancedMagicSigilPulse {
        0%, 100% { opacity: 0.96; }
        50% { opacity: 0.72; }
    }
    @keyframes advancedMagicReadySettle {
        0% { transform: scale(1.03); box-shadow: 0 0 0 1px rgba(255,255,255,0.18), 0 0 22px rgba(255,159,10,0.22); }
        100% { transform: scale(1); box-shadow: 0 6px 14px rgba(0,0,0,0.24), 0 0 0 1px rgba(255,255,255,0.08) inset; }
    }

    textarea.cyan-input {
        background: #18181a;
        color: #f5f5f7 !important;
        border: 1px solid #3a3a3c !important;
        padding: 10px;
        border-radius: 8px;
        font-size: 14px;
        outline: none;
        width: 100%;
        resize: vertical;
        min-height: 72px;
        line-height: 1.45;
        transition: 0.2s;
    }
    .sidebar input[type="file"]:focus,
    .sidebar input[type="text"]:focus,
    .sidebar input[type="date"]:focus,
    .sidebar input[type="number"]:focus,
    #layoutModal input[type="file"]:focus,
    #layoutModal input[type="text"]:focus,
    #layoutModal input[type="date"]:focus,
    #layoutModal input[type="number"]:focus,
    #cdModal input[type="file"]:focus,
    #cdModal input[type="text"]:focus,
    #cdModal input[type="date"]:focus,
    #cdModal input[type="number"]:focus,
    #cdModal textarea:focus,
    textarea.cyan-input:focus {
        border-color: var(--modal-accent, var(--workspace-accent, var(--primary))) !important;
        box-shadow: 0 0 0 1px var(--modal-accent, var(--workspace-accent, var(--primary))) !important;
    }
    .cd-editor-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
    #cdModal .modal-content {
        width: min(1100px, 96vw) !important;
        max-width: 96vw;
        max-height: calc(100vh - 36px);
        overflow: hidden;
        transition: height 0.3s cubic-bezier(.2, .78, .22, 1);
        will-change: height;
    }
    #cdModal .cd-modal-content {
        padding-top: 64px;
    }
    .cd-modal-heading {
        position: absolute;
        top: 22px;
        left: 22px;
        color: #32aec6;
    }
    #cdModal .cd-modal-close { position: absolute; top: 22px; right: 22px; z-index: 2; }
    #cdModal .modal-content.is-frame-switching {
        overflow: hidden;
    }
    .cd-modal-body {
        min-height: 0;
        max-height: calc(100vh - 126px);
        align-items: stretch;
        overflow: hidden;
    }
    .cd-control-column {
        box-sizing: border-box;
        flex: 0 0 clamp(330px, 37vw, 380px) !important;
        width: auto;
        max-width: clamp(330px, 37vw, 380px);
        min-width: min(330px, 40vw) !important;
        min-height: 0;
        max-height: calc(100vh - 126px);
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
    .cd-control-pane {
        box-sizing: border-box;
        flex: 1 1 auto !important;
        width: 100%;
        max-width: none;
        min-width: 0 !important;
        min-height: 0;
        max-height: none;
        display: flex;
        flex-direction: column;
        gap: 12px;
        overflow-x: hidden;
        overflow-y: auto;
        padding-right: 2px;
        scrollbar-gutter: stable;
    }
    .cd-control-pane.is-tab-switching {
        animation: cdControlPaneSwitch 0.28s cubic-bezier(.2, .78, .22, 1);
    }
    .cd-control-pane > .control-group,
    .cd-control-pane > .cd-editor-tabs,
    .cd-control-pane > .cd-tab-panel {
        flex: 0 0 auto;
    }
    .cd-control-column > .cd-action-row {
        flex: 0 0 auto;
        margin: 0;
    }
    .cd-preview-pane {
        flex: 1 1 520px !important;
        min-width: min(500px, 49vw) !important;
        transition: min-width 0.28s ease;
    }
    .cd-preview-frame {
        line-height: 0;
        transition: width 0.32s ease, height 0.32s ease, transform 0.32s ease, opacity 0.22s ease;
        will-change: width, height, transform;
    }
    #cdCanvas {
        display: block;
        transition: width 0.32s ease, height 0.32s ease, box-shadow 0.24s ease, transform 0.32s ease;
        will-change: width, height, transform;
    }
    .cd-style-transition-canvas {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        pointer-events: none;
        z-index: 2;
        background: transparent;
        box-shadow: none;
        margin: 0;
    }
    .cd-style-transition-canvas[hidden] { display: none; }
    .cd-art-loading {
        position: absolute;
        inset: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        background: #f4eedc;
        color: #292e27;
        font-size: 15px;
        font-weight: 700;
        pointer-events: none;
        z-index: 3;
    }
    .cd-art-loading.has-previous { background: transparent; color: #8ad9e8; }
    .cd-art-loading > span {
        padding: 12px 18px;
        border-radius: 8px;
        background: rgba(249, 245, 233, 0.9);
        line-height: 1.4;
    }
    .cd-art-loading.has-previous > span { background: rgba(24, 24, 26, 0.9); }
    .cd-art-loading[hidden] { display: none; }
    .cd-preview-frame.is-switching #cdCanvas {
        transform: scale(0.985);
        box-shadow: 0 0 22px rgba(50,174,198,0.34) !important;
    }
    .cd-tab-btn {
        background: #242426; color: #aeaeb2; border: 1px solid #3a3a3c; border-radius: 8px;
        height: 34px; cursor: pointer; font-weight: bold; transition: background 0.2s, color 0.2s, border-color 0.2s;
    }
    .cd-tab-btn.active { background: rgba(50,174,198,0.18); color: #32aec6; border-color: #32aec6; }
    .cd-tab-panel {
        box-sizing: border-box;
        width: 100%;
        display: none;
        max-height: 0;
        opacity: 0;
        overflow: hidden;
        pointer-events: none;
        transform: translateY(-6px);
        transform-origin: top center;
        visibility: hidden;
        transition: opacity 0.2s ease, transform 0.22s ease;
        will-change: opacity, transform;
    }
    .cd-tab-panel.active {
        display: block;
        flex: 0 0 auto;
        min-height: auto;
        max-height: none;
        opacity: 1;
        overflow: visible;
        padding-right: 0;
        pointer-events: auto;
        transform: translateY(0);
        visibility: visible;
        animation: cdTabPanelIn 0.24s cubic-bezier(.2, .78, .22, 1);
    }
    @keyframes cdTabPanelIn {
        from { opacity: 0; transform: translateY(8px) scale(0.992); }
        to { opacity: 1; transform: translateY(0); }
    }
    @keyframes cdControlPaneSwitch {
        0% { transform: translateY(0); }
        45% { transform: translateY(3px); }
        100% { transform: translateY(0); }
    }
    #cdTabCase .control-group + .control-group { margin-top: 12px; }
    .cd-collapsible-block {
        max-height: 180px;
        opacity: 1;
        overflow: hidden;
        transform: translateY(0);
        transition: max-height 0.24s ease, opacity 0.18s ease, transform 0.2s ease, padding 0.2s ease, border-color 0.2s ease, margin 0.2s ease;
    }
    .cd-collapsible-block.is-collapsed {
        max-height: 0;
        opacity: 0;
        margin-top: 0 !important;
        padding-top: 0;
        padding-bottom: 0;
        border-color: transparent;
        pointer-events: none;
        transform: translateY(-4px);
    }
    .cd-shop-editor { gap: 8px; }
    .cd-cover-size-control {
        display: flex;
        flex-direction: column;
        gap: 7px;
        padding: 8px 0 10px;
        border-top: 1px solid rgba(50,174,198,0.18);
        border-bottom: 1px solid rgba(50,174,198,0.18);
        transition: opacity 0.18s ease;
    }
    .cd-cover-size-heading {
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        gap: 10px;
        color: #8ad9e8;
        font-size: 13px;
        font-weight: 850;
    }
    .cd-cover-size-heading small {
        color: #8e8e93;
        font-size: 11px;
        font-weight: 650;
        white-space: nowrap;
    }
    .cd-cover-size-fields {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr)) 34px;
        align-items: end;
        gap: 8px;
    }
    .cd-cover-size-fields label {
        min-width: 0;
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto;
        align-items: center;
        gap: 6px;
        color: #d1d1d6;
        font-size: 12px;
        font-weight: 750;
    }
    .cd-cover-size-fields input {
        width: 100%;
        min-width: 0;
        height: 34px;
        padding: 0 8px;
        text-align: right;
        font-weight: 800;
    }
    .cd-cover-size-fields small {
        color: #8e8e93;
        font-size: 11px;
        font-weight: 650;
    }
    .cd-cover-size-reset {
        width: 34px;
        height: 34px;
        padding: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border: 1px solid rgba(50,174,198,0.42);
        border-radius: 7px;
        background: rgba(50,174,198,0.08);
        color: #8ad9e8;
        cursor: pointer;
        transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease;
    }
    .cd-cover-size-reset:hover:not(:disabled) {
        border-color: #32aec6;
        background: rgba(50,174,198,0.18);
        color: #ffffff;
    }
    .cd-cover-size-control.is-disabled {
        opacity: 0.46;
    }
    .cd-cover-size-control.is-disabled input,
    .cd-cover-size-control.is-disabled button {
        cursor: not-allowed;
    }
    #cdTabShop .cd-shop-editor > .flex-row:last-child {
        position: sticky;
        bottom: 0;
        z-index: 2;
        margin: 6px -2px 0;
        padding: 8px 2px 2px;
        background: linear-gradient(180deg, rgba(28,28,30,0), rgba(28,28,30,0.96) 34%, rgba(28,28,30,0.98));
        backdrop-filter: blur(var(--glass-blur-nested));
        -webkit-backdrop-filter: blur(var(--glass-blur-nested));
    }
    .cd-move-save-hint {
        display: none;
        color: #3CAE4E;
        font-size: 13px;
        font-weight: 800;
        margin-bottom: 8px;
        text-align: center;
    }
    .cd-move-save-hint.show {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 5px;
    }
    .cd-markdown-help {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        gap: 3px 9px;
        color: #d1d1d6;
        font-size: 12px;
        font-weight: 600;
        line-height: 1.4;
    }
    .cd-markdown-help-label {
        color: #32aec6;
        font-weight: 800;
    }
    .cd-markdown-help code {
        padding: 0;
        border: 0;
        background: transparent;
        color: inherit;
        font: inherit;
        white-space: nowrap;
    }
    .cd-move-save-hint.is-custom-cover .cd-markdown-help {
        display: none;
    }
    .cd-edit-layout-btn.is-hidden {
        display: none;
    }
    .cd-edit-layout-btn {
        margin-top: 10px;
        min-width: 122px;
        height: 32px;
        border-color: #32aec6;
        background: rgba(50,174,198,0.20);
        color: #7de5f6;
        font-weight: 800;
    }
    .cd-edit-layout-btn:hover {
        background: rgba(50,174,198,0.32);
        color: #ffffff;
    }
    .cd-animation-option {
        margin-top: auto;
        color: #d1d1d6;
    }
    .cd-animation-option.is-hidden {
        display: none;
    }
    .cd-shop-text-settings,
    .cd-custom-cover-settings {
        box-sizing: border-box;
        width: 100%;
        display: none;
        flex-direction: column;
        gap: 8px;
        opacity: 0;
        overflow: hidden;
        pointer-events: auto;
        transform: translateY(8px) scale(0.992);
        transform-origin: top center;
        transition: opacity 0.22s ease, transform 0.24s ease;
    }
    #cdTabShop:not(.is-custom-cover) .cd-shop-text-settings,
    #cdTabShop.is-custom-cover .cd-custom-cover-settings {
        display: flex;
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0);
        animation: cdTabPanelIn 0.24s cubic-bezier(.2, .78, .22, 1);
    }
    .cd-layer-toolbar {
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        gap: 10px;
        color: #32aec6;
        font-size: 13px;
        font-weight: 800;
        padding: 1px 2px 2px;
    }
    .cd-layer-toolbar small {
        color: #8e8e93;
        font-size: 12px;
        font-weight: 600;
        white-space: nowrap;
    }
    .cd-layer-list {
        position: relative;
        display: flex;
        flex-direction: column;
        gap: 8px;
        min-height: 0;
    }
    .cd-layer-card {
        position: relative;
        display: grid;
        grid-template-columns: minmax(0, 1fr) 34px;
        align-items: start;
        overflow: hidden;
        border: 1px solid rgba(50, 174, 198, 0.22);
        border-radius: 8px;
        background: rgba(28, 28, 30, 0.86);
        box-shadow: inset 0 1px 0 rgba(255,255,255,0.035);
        transition: border-color 0.18s ease, background 0.18s ease, opacity 0.18s ease, transform 0.26s cubic-bezier(.2,.78,.24,1), box-shadow 0.18s ease;
        will-change: transform;
    }
    .cd-layer-card:hover {
        border-color: rgba(50, 174, 198, 0.42);
        background: rgba(35, 35, 38, 0.92);
    }
    .cd-layer-card.is-selected {
        border-color: #32aec6;
        box-shadow: 0 0 0 1px rgba(50,174,198,0.18), 0 8px 18px rgba(0,0,0,0.22);
    }
    .cd-layer-card.is-layer-hidden {
        opacity: 0.54;
    }
    .cd-layer-card.is-dragging {
        opacity: 0.42;
        transform: scale(0.985);
    }
    .cd-layer-card.is-layer-animating {
        pointer-events: none;
        z-index: 1;
    }
    .cd-layer-card.is-fixed-layer {
        grid-template-columns: minmax(0, 1fr);
    }
    .cd-layer-card.is-no-grip .cd-layer-head {
        grid-template-columns: minmax(68px, auto) minmax(0, 1fr);
    }
    .cd-layer-card.is-locked-open .cd-layer-head {
        cursor: default;
    }
    .cd-layer-card.is-locked-open .cd-layer-head:hover .cd-layer-title {
        color: #e5e5ea;
    }
    .cd-layer-head {
        min-width: 0;
        height: 42px;
        display: grid;
        grid-template-columns: 22px minmax(68px, auto) minmax(0, 1fr);
        align-items: center;
        gap: 8px;
        padding: 0 10px;
        border: 0;
        background: transparent;
        color: #f5f5f7;
        cursor: pointer;
        text-align: left;
    }
    .cd-layer-head:hover .cd-layer-title {
        color: #7de5f6;
    }
    .cd-layer-grip {
        width: 22px;
        height: 22px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        color: #32aec6;
        opacity: 0.82;
        cursor: grab;
    }
    .cd-layer-grip svg,
    .cd-layer-eye svg {
        width: 18px;
        height: 18px;
        fill: none;
        stroke: currentColor;
        stroke-width: 2;
        stroke-linecap: round;
        stroke-linejoin: round;
    }
    .cd-layer-title {
        color: #e5e5ea;
        font-size: 13px;
        font-weight: 850;
        white-space: nowrap;
        transition: color 0.18s ease;
    }
    .cd-layer-summary {
        min-width: 0;
        color: #8e8e93;
        font-size: 12px;
        font-weight: 650;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .cd-layer-eye {
        width: 34px;
        height: 42px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border: 0;
        border-left: 1px solid rgba(255,255,255,0.06);
        background: transparent;
        color: #32aec6;
        cursor: pointer;
        transition: color 0.18s ease, background 0.18s ease;
    }
    .cd-layer-eye:hover {
        color: #ffffff;
        background: rgba(50,174,198,0.12);
    }
    .cd-layer-eye.is-off {
        color: #6f6f75;
    }
    .cd-layer-eye.is-off svg {
        opacity: 0.72;
    }
    .cd-layer-body {
        grid-column: 1 / -1;
        display: flex;
        flex-direction: column;
        gap: 8px;
        max-height: 0;
        opacity: 0;
        overflow: hidden;
        padding: 0 10px;
        transform: translateY(-4px);
        pointer-events: none;
        transition: max-height 0.24s ease, opacity 0.18s ease, transform 0.2s ease, padding 0.2s ease;
    }
    .cd-layer-card.is-expanded .cd-layer-body {
        max-height: 380px;
        opacity: 1;
        padding: 0 10px 10px;
        transform: translateY(0);
        pointer-events: auto;
    }
    .cd-layer-body .btn-mini {
        align-self: flex-start;
    }
    .cd-layer-text-actions {
        display: grid;
        grid-template-columns: minmax(0, 0.88fr) minmax(0, 1.12fr);
        gap: 8px;
        padding-top: 2px;
    }
    .cd-layer-text-actions .btn-mini {
        width: 100%;
        min-width: 0;
        align-self: stretch;
        padding-inline: 8px;
        font-size: 11.5px;
        white-space: nowrap;
    }
    .cd-layer-apply-all-btn {
        border-color: rgba(50, 174, 198, 0.48);
        background: rgba(50, 174, 198, 0.12);
        color: #8ad9e8;
    }
    .cd-layer-apply-all-btn:hover:not(:disabled) {
        border-color: #32aec6;
        background: rgba(50, 174, 198, 0.24);
        color: #ffffff;
    }
    .cd-layer-option-row {
        min-height: 32px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        color: #d1d1d6;
        font-size: 12px;
        font-weight: 800;
    }
    .cd-layer-option-row.cd-contact-align-row { justify-content: flex-end; }
    .cd-align-segment {
        display: inline-flex;
        align-items: center;
        padding: 2px;
        border: 1px solid rgba(50,174,198,0.34);
        border-radius: 8px;
        background: rgba(255,255,255,0.035);
    }
    .cd-align-segment button {
        min-width: 42px;
        height: 26px;
        border: 0;
        border-radius: 6px;
        background: transparent;
        color: #8e8e93;
        font-size: 12px;
        font-weight: 850;
        cursor: pointer;
        transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
    }
    .cd-align-segment button[aria-pressed="true"] {
        background: rgba(50,174,198,0.26);
        color: #ffffff;
    }
    .cd-align-segment button:hover {
        color: #ffffff;
        transform: translateY(-1px);
    }
    .cd-upload-field {
        display: flex;
        flex-direction: column;
        gap: 6px;
        color: #d1d1d6;
        font-size: 13px;
    }
    .cd-upload-field small {
        color: #8e8e93;
        font-size: 12px;
        font-weight: normal;
        margin-left: 6px;
    }
    .cd-upload-field input[type="file"] {
        width: 100%;
        min-height: 36px;
        padding: 7px 9px;
        background: #1c1c1e;
        border-radius: 8px;
    }
    .cd-custom-file-row {
        display: flex;
        align-items: center;
        gap: 8px;
    }
    .cd-custom-file-row input[type="file"] {
        flex: 1;
        min-width: 0;
        color: transparent !important;
    }
    .cd-custom-file-row input[type="file"]::file-selector-button {
        height: 28px;
        padding: 0 12px;
        margin-right: 0;
        border-radius: 8px;
        border: 1px solid #48484a;
        background: #f5f5f7;
        color: #1c1c1e;
        font-weight: 800;
        cursor: pointer;
    }
    .cd-custom-file-row input[type="file"]::-webkit-file-upload-button {
        height: 28px;
        padding: 0 12px;
        margin-right: 0;
        border-radius: 8px;
        border: 1px solid #48484a;
        background: #f5f5f7;
        color: #1c1c1e;
        font-weight: 800;
        cursor: pointer;
    }
    .cd-custom-file-row #btnClearCustomCoverCache {
        flex: 0 0 auto;
        height: 34px;
        min-width: 76px;
        padding: 0 12px;
        border-radius: 8px;
        border-color: rgba(50, 174, 198, 0.45);
        background: rgba(50, 174, 198, 0.14);
        color: #d7f8ff;
        font-weight: 800;
    }
    .cd-custom-file-row #btnClearCustomCoverCache:hover {
        background: rgba(50, 174, 198, 0.24);
        border-color: #32aec6;
    }
    .cd-font-row {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 64px;
        gap: 6px 8px;
        align-items: center;
    }
    .cd-font-row span {
        grid-column: 1 / -1;
        color: #d1d1d6;
        font-size: 13px;
        font-weight: 750;
        white-space: nowrap;
    }
    .cd-font-row select,
    .cd-font-row input {
        min-width: 0;
    }
    .cd-font-row select {
        width: 100%;
        height: 40px;
        min-height: 40px;
        max-height: 40px;
        box-sizing: border-box;
        padding-top: 5px;
        padding-bottom: 5px;
        font-size: 14px;
        line-height: 1.45;
    }
    .cd-font-row select option {
        min-height: 32px;
        padding: 5px 8px;
        font-size: 14px;
        line-height: 1.45;
    }
    .cd-font-row input[type="number"] {
        height: 40px;
        min-height: 40px;
        box-sizing: border-box;
    }
    .cd-font-row select:has(option[value="hei"]:checked) { font-family: "Chiron Hei HK", "PingFang TC", "Microsoft JhengHei", sans-serif; }
    .cd-font-row select:has(option[value="round"]:checked) { font-family: "jf open 粉圓", "Chiron Hei HK", sans-serif; }
    .cd-font-row select:has(option[value="hand"]:checked) { font-family: "Iansui", "Chiron Hei HK", cursive; }
    .cd-font-row select:has(option[value="serif"]:checked) { font-family: "GenRyu Min TC", "Songti TC", "PMingLiU", serif; }
    .cd-font-row select:has(option[value="mono"]:checked) { font-family: Consolas, Monaco, Menlo, monospace; }
    .cd-font-row select[data-font-preview="hei"] { font-family: "Chiron Hei HK", "PingFang TC", "Microsoft JhengHei", sans-serif; }
    .cd-font-row select[data-font-preview="round"] { font-family: "jf open 粉圓", "Chiron Hei HK", sans-serif; }
    .cd-font-row select[data-font-preview="hand"] { font-family: "Iansui", "Chiron Hei HK", cursive; }
    .cd-font-row select[data-font-preview="serif"] { font-family: "GenRyu Min TC", "Songti TC", "PMingLiU", serif; }
    .cd-font-row select[data-font-preview="mono"] { font-family: Consolas, Monaco, Menlo, monospace; }
    .cd-font-options {
        display: flex;
        gap: 8px;
        align-items: center;
        justify-content: flex-end;
        margin-top: -3px;
        padding-bottom: 3px;
    }
    .cd-text-color-input {
        flex: 0 0 auto;
    }
    .cd-align-toggle,
    .cd-style-toggle {
        width: 32px;
        height: 32px;
        border-radius: 8px;
        border: 1px solid #48484a;
        background: #3a3a3c;
        color: #d1d1d6;
        cursor: pointer;
        font-size: 13px;
        font-weight: 700;
        line-height: 1;
        transition: transform 0.12s ease, background 0.16s ease, color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
    }
    .cd-style-toggle[aria-pressed="true"] {
        background: rgba(50,174,198,0.26);
        color: #ffffff;
        border-color: #61d5e8;
        box-shadow: 0 0 0 1px rgba(50,174,198,0.18);
    }
    .cd-style-italic {
        font-family: Georgia, "Times New Roman", serif;
        font-style: italic;
    }
    .cd-align-toggle:hover,
    .cd-style-toggle:hover {
        border-color: #61d5e8;
        background: #48484a;
        color: #ffffff;
    }
    .cd-align-toggle:active,
    .cd-style-toggle:active {
        transform: scale(0.96);
    }
    .cd-font-options label {
        color: #d1d1d6;
        font-size: 12px;
    }
    .cd-custom-style-section {
        display: grid;
        grid-template-columns: 72px minmax(0, 1fr);
        gap: 8px;
        align-items: center;
        padding: 8px 0 2px;
        border-top: 1px solid rgba(255,255,255,0.08);
    }
    .cd-custom-style-title {
        color: #d1d1d6;
        font-size: 13px;
        font-weight: 800;
        white-space: nowrap;
    }
    .cd-toggle-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
    }
    .cd-effect-group {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 6px;
    }
    .cd-effect-toggle {
        height: 30px;
        border-radius: 8px;
        border: 1px solid #48484a;
        background: #3a3a3c;
        color: #d1d1d6;
        font-size: 12px;
        font-weight: 800;
        cursor: pointer;
        transition: transform 0.12s ease, background 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
    }
    .cd-effect-toggle.active {
        background: rgba(50,174,198,0.26);
        border-color: #61d5e8;
        color: #ffffff;
        box-shadow: 0 0 0 1px rgba(50,174,198,0.18);
    }
    .cd-effect-toggle:hover {
        border-color: #61d5e8;
        background: #48484a;
        color: #ffffff;
    }
    .cd-effect-toggle:active {
        transform: scale(0.97);
    }
    .cd-toggle-pill,
    .cd-compact-field,
    .cd-range-field {
        min-height: 30px;
        display: inline-flex;
        align-items: center;
        gap: 7px;
        color: #d1d1d6;
        font-size: 12px;
        font-weight: 700;
    }
    .cd-toggle-pill {
        padding: 5px 8px;
        background: rgba(255,255,255,0.035);
        border: 1px solid rgba(50,174,198,0.24);
        border-radius: 8px;
    }
    .cd-toggle-pill input {
        accent-color: #3CAE4E;
    }
    .cd-color-inline {
        display: flex;
        align-items: center;
        gap: 9px;
        flex-wrap: nowrap;
    }
    .cd-color-swatch-field {
        display: inline-flex;
        align-items: center;
        gap: 7px;
        color: #ffffff;
        font-size: 14px;
        font-weight: 800;
        white-space: nowrap;
    }
    .cd-color-swatch-field input[type="color"] {
        width: 36px;
        height: 36px;
        border-width: 1px;
        border-radius: 9px;
    }
    .cd-color-swatch-field .sunny-color-swatch-btn,
    .layout-color-field .sunny-color-swatch-btn {
        flex: 0 0 36px;
    }
    .cd-color-actions {
        display: flex;
        align-items: center;
        gap: 7px;
        margin-left: 2px;
    }
    .cd-color-actions .btn-mini {
        height: 30px;
        padding: 0 10px;
        white-space: nowrap;
        font-size: 12px;
    }
    .cd-color-actions #btnRandomCdColor {
        background: #32aec6;
        border-color: #32aec6;
        color: #1c1c1e;
        font-weight: 800;
    }
    .cd-color-actions #btnRandomCdColor:hover:not(:disabled) {
        background: #49bfd5;
        border-color: #49bfd5;
        color: #1c1c1e;
        filter: none;
        box-shadow: 0 0 12px rgba(50,174,198,0.24);
    }
    .cd-color-actions #btnResetCdColor {
        background: #3a3a3c;
        border-color: #48484a;
        color: #f5f5f7;
    }
    .cd-color-actions #btnResetCdColor:hover:not(:disabled) {
        background: #48484a;
        border-color: #61d5e8;
        color: #ffffff;
    }
    .cd-swap-color-btn {
        width: 32px;
        height: 32px;
        justify-content: center;
        color: #d1d1d6;
        background: #3a3a3c;
        border: 1px solid #48484a;
        padding: 0;
    }
    .cd-swap-color-btn:hover:not(:disabled) {
        background: #48484a;
        border-color: #61d5e8;
        color: #ffffff;
    }
    .cd-compact-field input[type="color"] {
        width: 36px;
        height: 36px;
        flex: 0 0 36px;
        margin-left: auto;
    }
    .cd-compact-field .sunny-color-swatch-btn {
        margin-left: auto;
    }
    .cd-range-field {
        grid-column: 2;
        width: 100%;
    }
    .cd-compact-field,
    .cd-range-field {
        opacity: 1;
        overflow: hidden;
        transform: translateY(0);
        transition:
            max-height 0.22s ease,
            min-height 0.22s ease,
            opacity 0.18s ease,
            transform 0.22s ease,
            margin 0.22s ease,
            padding 0.22s ease;
    }
    .cd-compact-field {
        min-height: 38px;
        max-height: 40px;
    }
    .cd-range-field {
        min-height: 34px;
        max-height: 36px;
    }
    .cd-compact-field.is-hidden,
    .cd-range-field.is-hidden {
        max-height: 0;
        min-height: 0;
        opacity: 0;
        margin-top: 0;
        margin-bottom: 0;
        padding-top: 0;
        padding-bottom: 0;
        pointer-events: none;
        transform: translateY(-4px);
    }
    .cd-range-field input[type="range"] {
        flex: 1;
        min-width: 0;
    }
    .cd-range-field > span {
        min-width: 34px;
    }
    .cd-layer-controls {
        position: absolute;
        z-index: 6;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        transform: translate(-50%, -50%);
        pointer-events: auto;
        filter: drop-shadow(0 7px 16px rgba(0,0,0,0.34));
    }
    .cd-layer-controls.is-floating-outside {
        transform: translate(-50%, -100%);
    }
    .cd-layer-controls.is-floating-below {
        transform: translate(-50%, 0);
    }
    .cd-layer-controls.is-hidden {
        display: none;
    }
    .cd-layer-controls button {
        width: 30px;
        height: 30px;
        border-radius: 999px;
        border: 1px solid rgba(72,197,90,0.78);
        background: rgba(22, 24, 25, 0.84);
        color: #e7ffe9;
        font-size: 14px;
        font-weight: 900;
        line-height: 1;
        cursor: pointer;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        transition: transform 0.14s ease, background 0.14s ease, border-color 0.14s ease;
    }
    .cd-layer-controls button:hover {
        background: rgba(58, 172, 78, 0.88);
        border-color: #7aff8b;
        transform: translateY(-1px) scale(1.04);
    }
    .cd-finish-edit-btn {
        align-self: center;
        margin-top: 8px;
        min-width: 118px;
        height: 32px;
        border-color: #32aec6;
        background: rgba(50,174,198,0.18);
        color: #8cecff;
        font-weight: 800;
        transform: translateY(0);
        opacity: 1;
        transition: opacity 0.18s ease, transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
    }
    .cd-finish-edit-btn:hover {
        background: rgba(50,174,198,0.30);
        border-color: #7de5f6;
        color: #ffffff;
    }
    .cd-finish-edit-btn.is-hidden {
        display: none;
        opacity: 0;
        transform: translateY(-4px);
        pointer-events: none;
    }
    .cd-qr-fields {
        display: flex;
        flex-direction: column;
        gap: 8px;
        max-height: 150px;
        opacity: 1;
        overflow: hidden;
        transform: scaleY(1);
        transform-origin: top;
        transition: max-height 0.24s ease, opacity 0.18s ease, transform 0.22s ease, margin 0.24s ease;
    }
    .cd-qr-fields.is-hidden {
        max-height: 0;
        opacity: 0;
        margin-top: -8px;
        pointer-events: none;
        transform: scaleY(0.96);
    }
    .cd-check-row { display: flex; align-items: center; gap: 8px; color: #d1d1d6; font-size: 13px; cursor: pointer; }
    .cd-check-row input { width: auto; accent-color: #32aec6; }

    .btn-picker { width: 16px; height: 16px; border-radius: 50%; border: none; background: #666; color: white; font-size: 12px; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; box-shadow: 0 2px 4px rgba(0,0,0,0.5); transition: 0.2s; line-height: 1; }
    .btn-picker.active { background: #ff3b30; transform: scale(1.1); }
    .hover-help {
        position: relative;
    }
    .hover-help::after {
        content: attr(data-tooltip);
        position: absolute;
        left: calc(100% + 10px);
        top: 50%;
        transform: translate(0, -50%) scale(0.96);
        min-width: 132px;
        max-width: 190px;
        padding: 7px 9px;
        border-radius: 7px;
        border: 1px solid rgba(255,159,10,0.36);
        background: rgba(28,28,30,0.96);
        color: #f5f5f7;
        box-shadow: 0 8px 18px rgba(0,0,0,0.34);
        font-size: 11px;
        font-weight: 700;
        line-height: 1.35;
        text-align: left;
        white-space: normal;
        opacity: 0;
        pointer-events: none;
        z-index: 400;
        transition: opacity 0.16s ease, transform 0.18s ease;
    }
    .hover-help::before {
        content: "";
        position: absolute;
        left: calc(100% + 5px);
        top: 50%;
        width: 8px;
        height: 8px;
        border-left: 1px solid rgba(255,159,10,0.36);
        border-bottom: 1px solid rgba(255,159,10,0.36);
        background: rgba(28,28,30,0.96);
        transform: translate(0, -50%) rotate(45deg) scale(0.94);
        opacity: 0;
        pointer-events: none;
        z-index: 401;
        transition: opacity 0.16s ease, transform 0.18s ease;
    }
    .hover-help:hover::after,
    .hover-help:focus-visible::after {
        opacity: 1;
        transform: translate(4px, -50%) scale(1);
    }
    .hover-help:hover::before,
    .hover-help:focus-visible::before {
        opacity: 1;
        transform: translate(4px, -50%) rotate(45deg) scale(1);
    }
    .dynamic-cover-toggle.hover-help::after { left: auto; right: 0; top: auto; bottom: calc(100% + 8px); min-width: 240px; max-width: min(320px, calc(100vw - 64px)); border-color: rgba(50,174,198,.36); transform: translateY(0); }
    .dynamic-cover-toggle.hover-help::before { left: auto; right: 14px; top: auto; bottom: calc(100% + 4px); border-color: rgba(50,174,198,.36); transform: rotate(-45deg); }
    #simpleCdAnimationOption.hover-help::after { left: 0; right: auto; }
    #simpleCdAnimationOption.hover-help::before { left: 14px; right: auto; }
    .dynamic-cover-toggle.hover-help:hover::after, .dynamic-cover-toggle.hover-help:focus-visible::after { transform: translateY(0); }
    .dynamic-cover-toggle.hover-help:hover::before, .dynamic-cover-toggle.hover-help:focus-visible::before { transform: rotate(-45deg); }
    .product-feature-unavailable .dynamic-cover-toggle.hover-help::after, .product-feature-unavailable .dynamic-cover-toggle.hover-help::before { display: none; }

    .info-card { background: #18181a; padding: 10px; border-radius: 6px; border-left: 4px solid var(--primary); font-size: 13px; line-height: 1.5; color: #d1d1d6; }
    .val-text { font-family: monospace; min-width: 45px; text-align: right; font-size: 13px; color: #aeaeb2; }

    .mode-indicator { position: fixed; top: 40px; left: var(--crop-overlay-center-x, calc(50% + 170px)); transform: translateX(-50%); background: rgba(0,0,0,0.85); padding: 12px 24px; border-radius: 20px; font-size: 16px; pointer-events: none; opacity: 0; transition: opacity 0.2s; border: 1px solid var(--primary); color: var(--primary); font-weight: bold; box-shadow: 0 4px 12px rgba(0,0,0,0.5); z-index: 12000; }
    .mode-indicator.show { opacity: 1; }
    #appToast {
        z-index: 120000;
        top: 24px;
        left: 50%;
        width: max-content;
        max-width: calc(100vw - 48px);
        box-sizing: border-box;
        line-height: 1.5;
        overflow-wrap: anywhere;
        background-color: rgba(24,24,26,0.97);
    }
    #appToast.is-layout {
        border-color: var(--accent-purple);
        color: var(--accent-purple-hover);
    }
    .mode-indicator.success {
        border-color: #3CAE4E;
        color: #73df83;
        box-shadow: 0 4px 14px rgba(60,174,78,0.32);
    }
    .mode-indicator .toast-saved-filename { color: #f2f2f7; }
    .mode-indicator .toast-saved-filename.is-crop { color: var(--accent-orange-hover); }
    .mode-indicator .toast-saved-filename.is-layout { color: #d9b4ff; }
    .mode-indicator .toast-saved-filename.is-cover { color: var(--accent-blue-hover); }
    .mode-indicator.error { border-color: #ff3b30; color: #ff3b30; box-shadow: 0 4px 12px rgba(255, 59, 48, 0.4); }
    .sc-section {
        margin: 8px 0 3px;
        padding-top: 6px;
        border-top: 1px solid rgba(255,255,255,0.08);
        color: var(--primary);
        font-size: 11px;
        font-weight: 800;
        letter-spacing: 1px;
    }

    #bottomHintOverlay { position: absolute; bottom: 30px; left: var(--crop-overlay-center-local-x, 50%); transform: translate(-50%, 10px); background: rgba(28, 28, 30, 0.6); padding: 16px 24px; border-radius: 12px; border: 1px solid var(--primary); text-align: center; z-index: 100; box-shadow: 0 10px 30px rgba(0,0,0,0.8); backdrop-filter: blur(var(--glass-blur-popover)); -webkit-backdrop-filter: blur(var(--glass-blur-popover)); display: block; line-height: 1.6; opacity: 0; pointer-events: none; transition: opacity 0.2s ease, transform 0.2s ease; }
    #bottomHintOverlay.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }

    canvas.picking { cursor: crosshair !important; }
    canvas.picking.picking-point-hover { cursor: grab !important; }
    canvas.picking.picking-point-dragging { cursor: grabbing !important; }
    canvas.magic-wand-cursor {
        cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28'%3E%3Cg fill='none' stroke='%23ff9f0a' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 23 17.5 10.5'/%3E%3Cpath d='m16 9 3 3'/%3E%3Cpath d='M20 4v4M18 6h4M11 3v3M9.5 4.5h3M23 13v3M21.5 14.5h3'/%3E%3C/g%3E%3C/svg%3E") 18 10, crosshair !important;
    }

    .check-row {
        display: flex;
        align-items: center;
        gap: 8px;
        font-size: 13px;
        color: #f5f5f7;
        cursor: pointer;
    }
    .check-row input[type="checkbox"] {
        width: 16px;
        height: 16px;
        flex: 0 0 auto;
    }
    .switch-row {
        --switch-accent: var(--primary);
        width: 100%;
        min-height: 34px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        color: #f5f5f7;
        font-size: 13px;
        font-weight: 700;
        cursor: pointer;
        user-select: none;
    }
    .switch-row input[type="checkbox"] {
        position: absolute;
        opacity: 0;
        pointer-events: none;
    }
    .switch-control {
        width: 44px;
        height: 24px;
        flex: 0 0 44px;
        border-radius: 999px;
        border: 1px solid #48484a;
        background: #2c2c2e;
        position: relative;
        box-shadow: inset 0 1px 3px rgba(0,0,0,0.45);
        transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
    }
    .switch-control::after {
        content: "";
        position: absolute;
        width: 18px;
        height: 18px;
        top: 2px;
        left: 2px;
        border-radius: 50%;
        background: #d1d1d6;
        box-shadow: 0 2px 5px rgba(0,0,0,0.42);
        transition: transform 0.18s ease, background 0.18s ease;
    }
    .switch-row input[type="checkbox"]:checked + .switch-control {
        background: var(--switch-accent);
        border-color: var(--switch-accent);
        box-shadow: 0 0 0 1px rgba(255,255,255,0.08), 0 0 12px color-mix(in srgb, var(--switch-accent) 34%, transparent);
    }
    .switch-row input[type="checkbox"]:checked + .switch-control::after {
        transform: translateX(20px);
        background: #1c1c1e;
    }
    .switch-row:hover .switch-control {
        border-color: color-mix(in srgb, var(--switch-accent) 72%, #ffffff);
    }
    .switch-row.is-disabled {
        color: #6e6e73;
        cursor: not-allowed;
        opacity: 0.72;
    }
    .switch-row.is-disabled .switch-control {
        border-color: #3a3a3c;
        background: #242426;
        box-shadow: inset 0 1px 3px rgba(0,0,0,0.35);
    }
    .switch-row.is-disabled .switch-control::after {
        background: #636366;
    }
    .switch-row-orange { --switch-accent: var(--primary); }
    .switch-row-purple { --switch-accent: #BF5AF2; }
    .switch-row-cyan { --switch-accent: #32aec6; }
    .switch-row-green { --switch-accent: #3CAE4E; }
    .layout-extra-inch-switch {
        margin-top: 4px;
        max-height: 38px;
        opacity: 1;
        overflow: hidden;
        transform: translateY(0);
        transition: max-height 0.24s ease, opacity 0.18s ease, transform 0.22s ease, margin 0.22s ease;
    }
    .layout-extra-inch-switch.is-hidden {
        min-height: 0;
        max-height: 0;
        opacity: 0;
        margin-top: 0;
        pointer-events: none;
        transform: translateY(-5px);
    }
    .flex-row { display: flex; gap: 8px; align-items: center; }
    .speed-dot { background: var(--primary); border-radius: 50%; transition: background 0.1s, width 0.2s, height 0.2s; flex-shrink: 0; }


    .clear-data-confirm {
        background: #ff453a;
        color: #fff;
        border: 1px solid #ff453a;
        font-weight: 800;
    }
    .clear-data-actions .clear-data-confirm:hover:not(:disabled) {
        background: #ff5045;
        color: #fff;
        border-color: #ff5045;
        filter: none;
        box-shadow: 0 0 0 2px rgba(255,69,58,0.14);
    }
    .clear-data-actions .clear-data-confirm:focus-visible {
        outline-color: #ff453a;
        box-shadow: 0 0 0 3px rgba(255,69,58,0.2), 0 8px 22px rgba(255,69,58,0.24);
    }
    .clear-data-actions .clear-data-confirm:active:not(:disabled) {
        box-shadow: 0 0 12px rgba(255,69,58,0.16);
    }
    .clear-data-actions .simple-coverage-confirm-cancel:hover:not(:disabled),
    .clear-data-actions .simple-coverage-confirm-cancel:focus-visible {
        background: var(--surface-control-hover);
        border-color: #636366;
        box-shadow: var(--shadow-control-rest);
    }
    .clear-data-actions .simple-coverage-confirm-cancel:focus-visible {
        outline-color: var(--accent-green);
    }

    body.decorative-animations-off *:not(.settings-mini-game):not(.settings-mini-game *) {
        animation: none !important;
        scroll-behavior: auto !important;
    }
    body.decorative-animations-off .sidebar,
    body.decorative-animations-off .sidebar *,
    body.decorative-animations-off .sidebar-toggle-btn,
    body.decorative-animations-off .canvas-container,
    body.decorative-animations-off .filmstrip-bar,
    body.decorative-animations-off .filmstrip-toggle,
    body.decorative-animations-off .filmstrip-position-toggle,
    body.decorative-animations-off .filmstrip-scroll,
    body.decorative-animations-off .fs-item,
    body.decorative-animations-off .fs-item *,
    body.decorative-animations-off .fs-add-btn,
    body.decorative-animations-off .fs-action-group,
    body.decorative-animations-off #capacityTag,
    body.decorative-animations-off #canvasViewDock,
    body.decorative-animations-off #canvasZoomControl,
    body.decorative-animations-off .simple-mode-fab,
    body.decorative-animations-off .shortcut-panel,
    body.decorative-animations-off .settings-fab,
    body.decorative-animations-off .sunny-color-picker,
    body.decorative-animations-off .sunny-color-picker *,
    body.decorative-animations-off #settingsModal,
    body.decorative-animations-off #settingsModal *:not(.settings-mini-game):not(.settings-mini-game *),
    body.decorative-animations-off .modal-overlay:not(#settingsModal),
    body.decorative-animations-off #layoutModal *,
    body.decorative-animations-off #cdModal * {
        transition: none !important;
    }
    body.decorative-animations-off::before {
        display: none !important;
    }
    body.decorative-animations-off::after {
        filter: opacity(0);
        animation-play-state: paused;
        will-change: auto;
    }
    body.glass-effects-off *,
    body.glass-effects-off *::before,
    body.glass-effects-off *::after {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }
    body.glass-effects-off .modal-overlay {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }
    body.glass-effects-off .modal-content,
    body.glass-effects-off .toast,
    body.glass-effects-off .crop-mode-hint,
    body.glass-effects-off .shortcut-panel,
    body.glass-effects-off .simple-mode-fab,
    body.glass-effects-off .settings-fab,
    body.glass-effects-off #canvasViewDock,
    body.glass-effects-off #canvasZoomControl,
    body.glass-effects-off .sunny-color-picker {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        background-image: none !important;
    }
    body.glass-effects-off:has(> .modal-overlay.show) > :is(.workspace-topbar, .workspace-body) {
        filter: var(--modal-background-flat-filter) !important;
    }
    body.glass-effects-off .modal-content,
    body.glass-effects-off .sunny-color-picker {
        background-color: rgba(28,28,30,0.94) !important;
    }
    body.glass-effects-off .filmstrip-bar,
    body.glass-effects-off .filmstrip-toggle,
    body.glass-effects-off .filmstrip-position-toggle,
    body.glass-effects-off #canvasViewDock,
    body.glass-effects-off #canvasZoomControl,
    body.glass-effects-off .shortcut-panel,
    body.glass-effects-off .simple-mode-fab,
    body.glass-effects-off .settings-fab,
    body.glass-effects-off #bottomHintOverlay,
    body.glass-effects-off .toast,
    body.glass-effects-off .crop-mode-hint {
        background-color: rgba(28,28,30,0.88) !important;
    }

    body:has(> .modal-overlay.show) > :is(.workspace-topbar, .workspace-body) {
        filter: blur(var(--glass-blur-workspace));
        will-change: filter;
    }
    body:has(> .modal-overlay.show) > :is(.workspace-topbar, .workspace-body) * {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
    .modal-overlay { display: none; opacity: 0; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); z-index: 2000; align-items: center; justify-content: center; backdrop-filter: none; -webkit-backdrop-filter: none; transition: opacity 0.28s ease; }
    .modal-overlay.show { opacity: 1; }
    .modal-content { background: rgba(28, 28, 30, 0.5); backdrop-filter: none; -webkit-backdrop-filter: none; padding: 24px; border-radius: 12px; max-width: 95vw; display: flex; gap: 24px; box-shadow: 0 10px 40px rgba(0,0,0,0.8); border: 1px solid #48484a; flex-wrap: wrap; }
    #simpleModeModal > .modal-content { border-color: #0a84ff; }
    #layoutModal > .modal-content { border-color: #BF5AF2; }
    #cdModal > .modal-content { border-color: #32aec6; }
    .modal-content[tabindex="-1"]:focus,
    .modal-overlay[tabindex="-1"]:focus { outline: none; }
    .modal-section-heading {
        min-height: 36px;
        margin: 0;
        display: inline-flex;
        align-items: center;
        gap: 8px;
        font-size: 22px;
        font-weight: 800;
        line-height: 1.15;
        letter-spacing: 0;
    }
    .modal-section-heading svg {
        width: 22px;
        height: 22px;
        flex: 0 0 22px;
    }
    .spec-favorite-confirm-overlay {
        z-index: 3200;
        background: rgba(8, 5, 12, 0.78);
    }
    .spec-favorite-confirm-dialog {
        width: min(430px, calc(100vw - 36px));
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 24px;
        border: 1px solid rgba(191,90,242,0.72);
        border-radius: 8px;
        background: rgba(28, 24, 32, 0.84);
        box-shadow: 0 18px 50px rgba(0,0,0,0.66), 0 0 24px rgba(191,90,242,0.16);
        flex-wrap: nowrap;
    }
    .spec-favorite-confirm-icon {
        width: 44px;
        height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border: 1px solid rgba(191,90,242,0.58);
        border-radius: 50%;
        background: rgba(191,90,242,0.14);
        color: #d9b4ff;
    }
    .spec-favorite-confirm-dialog h3 {
        margin: 2px 0 0;
        color: #d9b4ff;
        font-size: 19px;
    }
    .spec-favorite-confirm-dialog p {
        margin: 0;
        color: #c7c7cc;
        font-size: 14px;
        line-height: 1.6;
    }
    .spec-favorite-confirm-dialog strong {
        color: #BF5AF2;
        font-size: 15px;
    }
    .spec-favorite-confirm-actions {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.45fr);
        gap: 10px;
        margin-top: 8px;
    }
    .spec-favorite-confirm-actions .btn {
        min-width: 0;
        height: 42px;
        margin: 0;
    }
    .spec-favorite-confirm-cancel {
        border-color: rgba(191,90,242,0.58);
        background: rgba(191,90,242,0.12);
        color: #d9b4ff;
    }
    .spec-favorite-confirm-cancel:hover {
        border-color: #BF5AF2;
        background: rgba(191,90,242,0.22);
        color: #fff;
    }
    .spec-favorite-confirm-danger {
        border-color: rgba(255,69,58,0.88);
        background: #c9362f;
        color: #fff;
        font-weight: 800;
    }
    .spec-favorite-confirm-danger:hover {
        border-color: #ff6961;
        background: #e0443c;
        filter: none;
    }
    .layout-modal-content {
        --layout-modal-padding: 16px;
        width: min(1580px, calc(100vw - 24px));
        max-width: calc(100vw - 24px);
        height: min(90vh, calc(100vh - 24px));
        max-height: calc(100vh - 32px);
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 16px;
        padding: var(--layout-modal-padding);
        overflow: hidden;
        min-height: 0;
    }
    .layout-control-pane {
        flex: 0 1 370px;
        display: flex;
        flex-direction: column;
        min-width: 340px;
        max-width: 380px;
        min-height: 0;
        max-height: 100%;
        overflow: hidden;
        border-right: 1px solid #333;
        padding-right: 16px;
    }
    .layout-control-scroll {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
        gap: 16px;
        padding-right: 2px;
        overscroll-behavior: contain;
    }
    .layout-control-scroll > h3,
    .layout-control-scroll > .control-group {
        flex-shrink: 0;
    }
    .layout-modal-heading {
        margin-top: calc(22px - var(--layout-modal-padding));
        margin-left: calc(22px - var(--layout-modal-padding));
        color: #BF5AF2;
    }
    .layout-action-row {
        display: flex;
        gap: 10px;
        padding-top: 14px;
        flex-shrink: 0;
        background: linear-gradient(180deg, rgba(28, 28, 30, 0), rgba(28, 28, 30, 0.82) 28%, rgba(28, 28, 30, 0.96));
    }
    .layout-preview-pane {
        flex: 2 1 0;
        min-width: 0;
        min-height: 0;
        background: #000;
        border-radius: 8px;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        padding: 10px 12px 8px;
        position: relative;
        overflow: hidden;
    }
    .layout-preview-toolbar {
        --layout-toolbar-divider-color: rgba(255,255,255,0.13);
        --layout-toolbar-divider-height: 24px;
        scrollbar-width: auto;
        scrollbar-color: rgba(191,90,242,0.82) rgba(191,90,242,0.12);
        width: 100%;
        flex: 0 0 auto;
        box-sizing: border-box;
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: 42px 42px;
        gap: 6px;
        padding: 7px 9px;
        border: 1px solid rgba(191, 90, 242, 0.34);
        border-radius: 8px;
        background: rgba(28, 28, 30, 0.96);
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
    }
    .layout-preview-toolbar::-webkit-scrollbar {
        height: 10px;
    }
    .layout-preview-toolbar::-webkit-scrollbar-track {
        border-radius: 6px;
        background: rgba(191,90,242,0.12);
    }
    .layout-preview-toolbar::-webkit-scrollbar-thumb {
        min-width: 34px;
        border: 2px solid rgba(191,90,242,0.12);
        border-radius: 6px;
        background: rgba(191,90,242,0.82);
    }
    .layout-preview-toolbar::-webkit-scrollbar-thumb:hover {
        background: #ca71f4;
    }
    .layout-preview-toolbar-row,
    .layout-cut-style-inline {
        min-width: 0;
        display: grid;
        align-items: center;
    }
    .layout-preview-toolbar-row {
        grid-template-columns: 58px minmax(0, 1fr) 118px;
        gap: 8px;
    }
    .layout-toolbar-row-label,
    .layout-cut-style-title {
        min-width: 0;
        display: inline-flex;
        align-items: center;
        align-self: stretch;
        position: relative;
        padding-right: 12px;
        box-sizing: border-box;
        color: #d9b4ff;
        font-size: 15px;
        font-weight: 900;
        line-height: 1;
        white-space: nowrap;
        user-select: none;
    }
    .layout-toolbar-row-label::after,
    .layout-cut-style-title::after {
        content: '';
        position: absolute;
        top: 50%;
        right: 0;
        width: 1px;
        height: var(--layout-toolbar-divider-height);
        transform: translateY(-50%);
        background: var(--layout-toolbar-divider-color);
        pointer-events: none;
    }
    body.interface-font-iansui .layout-toolbar-row-label,
    body.interface-font-iansui .layout-cut-style-title,
    body.interface-font-huninn .layout-toolbar-row-label,
    body.interface-font-huninn .layout-cut-style-title {
        font-weight: 400 !important;
        letter-spacing: 0.08em;
    }
    .layout-paper-toolbar-controls,
    .layout-paper-picker {
        min-width: 0;
        display: flex;
        align-items: center;
    }
    .layout-paper-toolbar-controls { width: 100%; }
    .layout-paper-toolbar-controls .layout-paper-picker {
        width: 100%;
        flex-direction: row;
        gap: 7px;
    }
    .layout-paper-option-group {
        min-width: 0;
        display: flex;
        align-items: center;
        gap: 5px;
    }
    .layout-paper-option-group { flex: 1 1 0; }
    .layout-paper-option-group[hidden] { display: none; }
    .layout-paper-toolbar-controls .layout-paper-type-row { flex: 0 0 104px; gap: 5px; }
    .layout-paper-toolbar-controls .layout-paper-type-btn { min-height: 38px; height: 38px; padding: 3px 5px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 2px; font-size: 11px; white-space: nowrap; }
    .layout-paper-group-label {
        flex: 0 0 auto;
        color: #aeaeb2;
        font-size: 10px;
        font-weight: 800;
        line-height: 1.15;
        white-space: nowrap;
    }
    .layout-paper-option-group.is-active-group .layout-paper-group-label {
        color: #d9b4ff;
    }
    .layout-paper-group-divider {
        width: 1px;
        height: var(--layout-toolbar-divider-height);
        flex: 0 0 1px;
        background: var(--layout-toolbar-divider-color);
    }
    .layout-paper-toolbar-controls .layout-paper-option-grid {
        flex: 1 1 auto;
        min-width: 0;
        max-height: none;
        grid-template-columns: repeat(4, minmax(48px, 1fr));
        gap: 5px;
    }
    .layout-paper-toolbar-controls .layout-paper-option-grid[data-layout-paper-options="fixed"] {
        grid-template-columns: repeat(4, minmax(64px, 1fr));
    }
    .layout-paper-toolbar-controls .layout-paper-option-btn {
        min-height: 38px;
        height: 38px;
    }
    .layout-paper-toolbar-controls .layout-paper-option-btn {
        padding: 3px 5px;
    }
    .layout-paper-toolbar-controls .layout-paper-option-btn span { font-size: 12px; }
    .layout-paper-toolbar-controls .layout-paper-option-btn small { font-size: 9px; }
    .layout-paper-toolbar-row .layout-unlimited-length-option {
        width: 118px;
        margin: 0;
    }
    .layout-paper-toolbar-row .layout-unlimited-length-option .switch-row {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        min-height: 38px;
        height: 38px;
        padding: 0 4px 0 6px;
        gap: 4px;
    }
    .layout-paper-toolbar-row .layout-unlimited-length-option .switch-row > span:first-child {
        min-width: 0;
        line-height: 1.15;
        text-align: left;
        white-space: nowrap;
    }
    .layout-paper-toolbar-row .layout-unlimited-length-option .switch-control {
        transform: scale(0.88);
        transform-origin: right center;
    }
    .layout-paper-width-display { display: none; }
    .layout-preview-canvas-stage {
        position: relative;
        flex: 1 1 auto;
        width: 100%;
        min-height: 0;
        max-height: none;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
        padding: 6px 0 2px;
        box-sizing: border-box;
    }
    .layout-selection-toolbar {
        position: absolute;
        z-index: 5;
        left: 50%;
        bottom: 12px;
        min-width: 292px;
        min-height: 50px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 6px 8px 6px 13px;
        border: 1px solid rgba(191,90,242,0.68);
        border-radius: 25px;
        box-sizing: border-box;
        background: rgba(24,22,27,0.94);
        box-shadow: 0 8px 26px rgba(0,0,0,0.52), 0 0 18px rgba(191,90,242,0.14);
        transform: translateX(-50%);
        backdrop-filter: blur(var(--glass-blur-floating));
        -webkit-backdrop-filter: blur(var(--glass-blur-floating));
    }
    .layout-selection-toolbar {
        opacity: 1;
        visibility: visible;
        transition: opacity .18s ease, visibility 0s;
    }
    .layout-selection-toolbar[hidden] {
        display: flex;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity .18s ease, visibility 0s linear .18s;
    }
    body.decorative-animations-off .layout-selection-toolbar,
    body.app-background-paused .layout-selection-toolbar { transition: none; }
    @media (prefers-reduced-motion: reduce) { .layout-selection-toolbar, .layout-selection-toolbar[hidden] { transition: none; } }
    .layout-selection-status {
        min-width: 94px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 1px;
        line-height: 1.2;
        white-space: nowrap;
    }
    .layout-selection-status strong {
        color: #f5f5f7;
        font-size: 12px;
        font-weight: 800;
    }
    .layout-selection-status span {
        color: #d9b4ff;
        font-size: 10px;
        font-weight: 750;
    }
    .layout-selection-actions {
        display: flex;
        align-items: center;
        gap: 6px;
    }
    .layout-selection-action {
        width: 38px;
        height: 38px;
        min-width: 38px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        margin: 0;
        padding: 0;
        border: 1px solid rgba(255,255,255,0.24);
        border-radius: 50%;
        color: #171719;
        cursor: pointer;
        box-shadow: 0 4px 12px rgba(0,0,0,0.28);
        transition: filter 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease, opacity 0.16s ease;
    }
    .layout-selection-action svg { pointer-events: none; }
    .layout-selection-action.is-duplicate { background: #3CAE4E; }
    .layout-selection-action.is-rotate { background: #BF5AF2; }
    .layout-selection-action.is-switch { background: #32aec6; }
    .layout-selection-action.is-delete { background: #ff453a; }
    .layout-selection-action:hover:not(:disabled) {
        filter: brightness(1.18);
        box-shadow: 0 5px 16px rgba(0,0,0,0.34), 0 0 14px currentColor;
        transform: translateY(-1px);
    }
    .layout-selection-action:active:not(:disabled) { transform: translateY(0) scale(0.96); }
    .layout-selection-action:focus-visible {
        outline: 2px solid #fff;
        outline-offset: 2px;
    }
    .layout-selection-action:disabled {
        border-color: rgba(255,255,255,0.12);
        background: #55555a;
        color: #b7b7bc;
        opacity: 0.62;
        cursor: default;
        box-shadow: none;
    }
    .layout-preview-pane #layoutPreviewCanvas {
        display: block;
        flex: 0 1 auto;
        width: auto;
        height: auto;
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
        background: transparent;
        box-shadow: 0 0 20px rgba(0,0,0,0.8);
    }
    .layout-preview-tools {
        width: min(100%, 760px);
        flex: 0 0 auto;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        margin-top: 10px;
    }
    .layout-paper-length-display {
        width: 100%;
        flex: 0 0 22px;
        align-self: stretch;
        display: flex;
        align-items: center;
        color: #BF5AF2;
        font-size: 14px;
        font-weight: 800;
        line-height: 1.2;
        white-space: nowrap;
        pointer-events: none;
    }
    .layout-cut-style-panel {
        position: static;
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }
    .layout-cut-style-title {
        height: 38px;
    }
    .layout-cut-style-inline {
        width: 100%;
        grid-template-columns: 58px minmax(0, 0.94fr) 1px minmax(0, 1.06fr);
        gap: 10px;
    }
    .layout-line-controls,
    .layout-frame-paper-controls {
        min-width: 0;
        display: grid;
        align-items: center;
        gap: 7px;
    }
    .layout-line-controls {
        grid-template-columns: 34px minmax(112px, 0.82fr) 82px minmax(98px, 0.62fr) 94px;
    }
    .layout-frame-paper-controls {
        grid-template-columns: 34px minmax(88px, 112px) 76px 1px 76px 1px minmax(0, 1fr) minmax(94px, 108px);
        gap: 8px;
        box-sizing: border-box;
    }
    .layout-frame-paper-controls > .sunny-select-shell[data-select-id="layoutPhotoBorderWidth"] {
        width: 100% !important;
        min-width: 0 !important;
    }
    .layout-line-controls > .purple-select,
    .layout-line-controls > .sunny-select-shell[data-select-id="watermarkSelect"] {
        width: 100% !important;
        min-width: 0 !important;
        grid-column: 2;
    }
    .layout-line-controls > .layout-line-color-field { grid-column: 3; }
    .layout-line-controls > .layout-cut-line-weight-field { grid-column: 4; }
    .layout-line-controls > .layout-cut-extension-toggle { grid-column: 5; }
    .layout-cut-style-row-label {
        height: 38px;
        padding-left: 0;
        box-sizing: border-box;
        display: inline-flex;
        align-items: center;
        color: #d9b4ff;
        font-size: 12px;
        font-weight: 800;
        line-height: 1;
        white-space: nowrap;
    }
    .layout-cut-style-inline .purple-select {
        width: 100%;
        min-width: 0;
        height: 38px;
        padding: 0 30px 0 9px;
        font-size: 13px;
        font-weight: 800;
        background-color: #242426;
    }
    .layout-cut-style-inline .layout-color-field {
        width: 100%;
        min-width: 0;
        min-height: 38px;
        height: 38px;
        padding: 0 2px;
        justify-content: flex-start;
        gap: 7px;
        border: 0;
        border-radius: 0;
        background: transparent;
        font-size: 12px;
    }
    .layout-cut-style-inline .layout-color-field > span {
        writing-mode: horizontal-tb;
        text-orientation: mixed;
        white-space: nowrap;
        letter-spacing: 0;
    }
    .layout-cut-style-inline .layout-color-field input[type="color"] {
        width: 30px;
        height: 30px;
    }
    .layout-border-width-field {
        width: 100%;
        min-width: 0;
        height: 38px;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: transparent;
        color: #d9b4ff;
        display: inline-flex;
        align-items: center;
        gap: 5px;
        font-size: 12px;
        font-weight: 800;
        white-space: nowrap;
    }
    .layout-cut-style-inline .layout-border-width-field .purple-select {
        flex: 1 1 auto;
        min-width: 0;
        height: 38px;
        padding: 0 22px 0 7px;
        border-radius: 6px;
        font-size: 12px;
    }
    .sunny-select-shell[data-select-id="layoutCutLineWeight"] .sunny-select-trigger {
        padding-left: 6px !important;
        padding-right: 22px !important;
    }
    .layout-cut-extension-toggle {
        width: 100%;
        min-width: 0;
        min-height: 38px;
        height: 38px;
        box-sizing: border-box;
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 4px;
        padding: 0 4px 0 7px;
        border: 0;
        border-radius: 0;
        background: transparent;
        color: #d9b4ff;
        font-size: 12px;
        font-weight: 800;
        line-height: 1;
    }
    .layout-cut-extension-toggle > span:first-child { white-space: nowrap; }
    .layout-cut-extension-toggle .switch-control {
        transform: scale(0.78);
        transform-origin: right center;
    }
    .layout-cut-extension-toggle:has(input:focus-visible) {
        outline: 2px solid rgba(202, 113, 244, 0.76);
        outline-offset: 1px;
        box-shadow: none;
    }
    .layout-color-field.is-disabled {
        opacity: 0.42;
        pointer-events: none;
    }
    .layout-cut-divider {
        width: 1px;
        height: var(--layout-toolbar-divider-height);
        flex: 0 0 1px;
        background: var(--layout-toolbar-divider-color);
    }
    .layout-appearance-divider {
        width: 1px;
        height: var(--layout-toolbar-divider-height);
        align-self: center;
        background: var(--layout-toolbar-divider-color);
        pointer-events: none;
    }
    .layout-cut-style-inline .layout-appearance-reset {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        grid-column: 8;
        width: 100%;
        min-width: 0;
        height: 38px;
        padding: 0 6px;
        box-sizing: border-box;
        font-size: 12px;
        line-height: 1.2;
        text-align: center;
        white-space: nowrap;
    }
    @media (max-height: 720px) {
        .layout-modal-content {
            --layout-modal-padding: 14px;
            height: calc(100vh - 16px);
            max-height: calc(100vh - 16px);
            padding: var(--layout-modal-padding);
            gap: 14px;
        }
        .layout-control-pane {
            max-width: 360px;
            padding-right: 14px;
        }
        .layout-control-scroll {
            gap: 12px;
        }
        .layout-action-row {
            padding-top: 10px;
        }
        .layout-preview-pane {
            padding: 8px 10px 6px;
        }
        .layout-preview-toolbar {
            grid-template-rows: 38px 38px;
            padding: 5px 7px;
        }
        .layout-paper-toolbar-controls .layout-paper-option-btn,
        .layout-paper-toolbar-controls .layout-paper-type-btn,
        .layout-paper-toolbar-row .layout-unlimited-length-option .switch-row,
        .layout-cut-style-title,
        .layout-cut-style-row-label,
        .layout-cut-style-inline .purple-select,
        .layout-cut-style-inline .layout-color-field,
        .layout-border-width-field,
        .layout-cut-extension-toggle,
        .layout-cut-style-inline .layout-appearance-reset {
            min-height: 34px;
            height: 34px;
        }
    }
    @media (max-width: 1500px) and (min-width: 761px) {
        .layout-modal-content { --layout-modal-padding: 10px; width: min(1420px, calc(100vw - 24px)); max-width: calc(100vw - 24px); gap: 10px; padding: var(--layout-modal-padding); }
        .layout-control-pane { flex-basis: clamp(304px, 26vw, 350px); min-width: 304px; max-width: 350px; padding-right: 10px; }
        .layout-preview-toolbar-row { grid-template-columns: 52px minmax(0, 1fr) 118px; gap: 6px; }
        .layout-paper-toolbar-row .layout-unlimited-length-option { width: 100%; }
        .layout-paper-toolbar-row .layout-unlimited-length-option .switch-row { padding-right: 6px; }
        .layout-paper-group-label { font-size: 9px; }
        .layout-paper-toolbar-controls .layout-paper-option-grid { gap: 4px; }
        .layout-cut-style-inline { grid-template-columns: 48px minmax(0, 0.96fr) 1px minmax(0, 1.04fr); gap: 6px; }
        .layout-line-controls { grid-template-columns: 26px minmax(72px, 1fr) 62px minmax(88px, 0.72fr) 78px; gap: 4px; }
        .layout-frame-paper-controls { grid-template-columns: 24px minmax(58px, 0.9fr) 54px 1px 54px 1px 50px 80px; gap: 4px; }
    }
    @media (max-width: 1080px) and (min-width: 761px) {
        .layout-preview-toolbar { overflow-x: auto; }
        .layout-cut-style-panel { min-width: 780px; }
    }
    @media (max-width: 760px) {
        .layout-modal-content {
            flex-direction: column;
            overflow-y: auto;
        }
        .layout-control-pane {
            flex: 0 0 auto;
            width: 100%;
            max-width: none;
            min-width: 0;
            max-height: none;
            border-right: 0;
            border-bottom: 1px solid #333;
            padding-right: 0;
            padding-bottom: 14px;
        }
        .layout-control-scroll {
            max-height: 38vh;
        }
        .layout-preview-pane {
            flex: 1 0 320px;
            min-height: 320px;
        }
        .layout-cut-style-inline {
            width: 100%;
            grid-template-columns: 40px minmax(0, 1fr);
            grid-template-rows: 38px 38px;
        }
        .layout-line-controls {
            grid-column: 2;
            grid-row: 1;
            grid-template-columns: 32px minmax(66px, 1fr) 68px 82px 80px;
        }
        .layout-frame-paper-controls {
            grid-column: 2;
            grid-row: 2;
            grid-template-columns: 32px 98px 76px 1px 76px 1px minmax(0, 1fr) 108px;
        }
        .layout-cut-divider {
            display: none;
        }
        .layout-preview-toolbar { overflow-x: auto; }
        .layout-preview-toolbar-row { min-width: 780px; }
        .layout-cut-style-panel { min-width: 780px; }
    }
    .layout-color-field {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        min-width: 0;
        min-height: 46px;
        padding: 7px 8px;
        border-radius: 10px;
        border: 1px solid #3a3a3c;
        background: rgba(24, 24, 26, 0.78);
        color: #d9b4ff;
        font-size: 13px;
        font-weight: 700;
        letter-spacing: 0;
        text-align: left;
        container-type: inline-size;
    }
    .layout-color-field span {
        line-height: 1.1;
        white-space: nowrap;
    }
    .layout-color-field input[type="color"] {
        flex: 0 0 auto;
    }
    .layout-cut-style-row {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(104px, 0.48fr);
        gap: 10px;
        align-items: stretch;
    }
    @container (max-width: 68px) {
        .layout-color-field span {
            writing-mode: vertical-rl;
            text-orientation: upright;
            white-space: normal;
            letter-spacing: 0.08em;
        }
    }
    .layout-cut-style-row .layout-color-field {
        margin: 0;
    }
    .layout-appearance-row {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
        gap: 10px;
        align-items: stretch;
        margin-top: 8px;
    }
    .layout-appearance-row .layout-color-field {
        margin: 0;
    }
    .layout-appearance-reset {
        width: auto;
        min-width: 58px;
        margin-top: 0;
        padding: 0 12px;
        font-weight: 700;
        white-space: nowrap;
    }
    .layout-favorite-save-wrap {
        position: relative;
        align-self: center;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        max-height: 44px;
        opacity: 1;
        transform: translateY(0);
        transition: max-height 0.24s ease, opacity 0.18s ease, transform 0.22s ease;
    }
    .layout-save-favorite-as-new {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 184px;
        min-width: 184px;
        height: 38px;
        margin: 0;
        padding: 0 18px;
        border-color: rgba(191,90,242,0.46);
        background: rgba(191,90,242,0.14);
        color: #d9b4ff;
        font-size: 15px;
        font-weight: 800;
        line-height: 1.2;
    }
    .btn.layout-save-favorite-as-new:hover:not(:disabled) {
        border-color: #BF5AF2;
        background: rgba(191,90,242,0.30);
        color: #ffffff;
        box-shadow: var(--glow-purple-soft);
    }
    .layout-save-favorite-as-new.is-hidden {
        display: none;
    }
    .layout-favorite-save-top {
        flex: 0 0 auto;
        margin: 16px auto 8px;
        z-index: 3;
    }
    .layout-favorite-save-wrap.is-hidden {
        max-height: 0;
        opacity: 0;
        transform: translateY(-5px);
        pointer-events: none;
    }
    .layout-save-favorite-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 184px;
        min-width: 184px;
        height: 38px;
        margin: 0;
        padding: 0 18px;
        background: var(--accent-purple);
        color: var(--ink-on-accent);
        border: 1px solid var(--accent-purple);
        font-size: 15px;
        font-weight: 800;
        line-height: 1.2;
        transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
    }
    .btn.layout-save-favorite-btn:hover:not(:disabled) {
        background: var(--accent-purple-hover);
        border-color: var(--accent-purple-hover);
        color: var(--ink-on-accent);
        filter: none;
        box-shadow: var(--glow-purple-soft);
    }
    .layout-delete-favorite-btn {
        position: absolute;
        left: calc(100% + 8px);
        width: 36px;
        height: 36px;
        border-color: rgba(255,69,58,0.72);
        background: rgba(255,69,58,0.16);
        color: #ff7b73;
        opacity: 0;
        transform: translateX(-12px) scale(0.82);
        pointer-events: none;
        transition: opacity 0.18s ease, transform 0.24s cubic-bezier(.2,.8,.2,1), background 0.18s ease;
    }
    .layout-favorite-save-wrap.has-match .layout-delete-favorite-btn {
        opacity: 1;
        transform: translateX(0) scale(1);
        pointer-events: auto;
    }
    .layout-delete-favorite-btn:hover {
        background: rgba(255,69,58,0.28);
        color: #fff;
    }
    .layout-favorite-list {
        display: flex;
        flex-direction: column;
        gap: 8px;
        min-height: 0;
    }
    .layout-favorite-group-heading {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
    }
    .layout-favorite-group-heading > label {
        margin: 0;
    }
    .layout-favorite-heading-actions {
        display: flex;
        align-items: center;
        gap: 8px;
    }
    .layout-favorite-manage-btn {
        min-width: 52px;
        height: 28px;
        padding: 0 10px;
        border: 1px solid rgba(191,90,242,0.46);
        border-radius: 7px;
        background: rgba(191,90,242,0.10);
        color: #d9b4ff;
        font: inherit;
        font-size: 12px;
        font-weight: 800;
        cursor: pointer;
        transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
    }
    .layout-favorite-manage-btn:hover {
        border-color: #BF5AF2;
        background: rgba(191,90,242,0.22);
        color: #fff;
    }
    .layout-favorite-empty {
        color: #8e8e93;
        font-size: 12px;
        line-height: 1.45;
    }
    .layout-favorite-item {
        width: 100%;
        min-height: 116px;
        display: grid;
        grid-template-columns: minmax(0, 1fr) 18px;
        grid-template-areas:
            "name name"
            "body grip";
        grid-template-rows: auto minmax(0, 1fr);
        align-items: start;
        column-gap: 8px;
        row-gap: 7px;
        padding: 10px 11px;
        border: 1px solid rgba(191,90,242,0.24);
        border-radius: 8px;
        background: rgba(24,24,26,0.72);
        color: #f5f5f7;
        text-align: left;
        cursor: pointer;
        opacity: 1;
        transform: translateY(0);
        transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease, opacity 0.18s ease;
    }
    .layout-favorite-list.is-reorderable .layout-favorite-item {
        cursor: grab;
    }
    .layout-favorite-list:not(.is-reorderable) .layout-favorite-item {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "name"
            "body";
    }
    .layout-favorite-item.is-static-snapshot {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "name"
            "body";
    }
    .layout-favorite-list:not(.is-reorderable) .layout-favorite-grip {
        display: none;
    }
    .layout-favorite-item.is-static-snapshot .layout-favorite-grip {
        display: none;
    }
    .layout-favorite-list.is-reorderable .layout-favorite-item:active {
        cursor: grabbing;
    }
    .layout-favorite-grip {
        grid-area: grip;
        width: 18px;
        height: 100%;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        align-self: stretch;
        color: #d9b4ff;
        opacity: 0;
        transform: scale(0.82);
        pointer-events: none;
        transition: opacity 0.16s ease, transform 0.18s ease;
    }
    .layout-favorite-grip svg {
        width: 18px;
        height: 18px;
        fill: none;
        stroke: currentColor;
        stroke-width: 2.2;
        stroke-linecap: round;
        stroke-linejoin: round;
    }
    .layout-favorite-list.is-reorderable .layout-favorite-grip {
        opacity: 0.88;
        transform: scale(1);
    }
    .layout-favorite-item.is-reorderable-snapshot .layout-favorite-grip {
        opacity: 0.88;
        transform: scale(1);
    }
    .layout-favorite-item.is-dragging {
        opacity: 0.48;
        cursor: grabbing;
        transform: scale(0.985);
        box-shadow: 0 8px 20px rgba(0,0,0,0.26);
    }
    .layout-favorite-item:hover,
    .layout-favorite-item.is-active {
        border-color: #BF5AF2;
        background: rgba(191,90,242,0.15);
    }
    .layout-favorite-item:active {
        transform: scale(0.985);
    }
    .layout-favorite-item.is-entering {
        opacity: 0;
        transform: translateY(-7px);
    }
    .layout-favorite-item.is-save-target {
        opacity: 0;
    }
    .layout-favorite-flight {
        position: fixed;
        z-index: 10050;
        margin: 0;
        pointer-events: none;
        overflow: hidden;
        transform-origin: center;
        box-shadow: 0 12px 34px rgba(0,0,0,0.46), 0 0 22px rgba(191,90,242,0.26);
        will-change: transform, opacity, filter;
    }
    .layout-favorite-removal-flight {
        position: fixed;
        z-index: 10049;
        margin: 0;
        pointer-events: none;
        overflow: hidden;
        border-color: rgba(255, 105, 97, 0.72);
        background: rgba(52, 28, 32, 0.92);
        transform-origin: center;
        box-shadow: 0 10px 26px rgba(0,0,0,0.34), 0 0 15px rgba(255,69,58,0.16);
        will-change: transform, opacity, filter;
    }
    .layout-favorite-thumbnail {
        width: 68px;
        height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
        border: 0;
        border-radius: 0;
        background: transparent;
    }
    .layout-favorite-thumbnail canvas {
        display: block;
        width: 68px;
        height: 44px;
        margin: 0;
        background: transparent;
        box-shadow: none;
        cursor: inherit;
        touch-action: auto;
    }
    .layout-favorite-thumbnail.is-card,
    .layout-favorite-thumbnail.is-card canvas {
        width: 88px;
        height: 56px;
    }
    .layout-favorite-paper {
        width: 100%;
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        gap: 10px;
        margin-bottom: 5px;
        color: #d9b4ff;
        font-weight: 900;
        text-align: left;
    }
    .layout-favorite-paper strong {
        font-size: 12.5px;
        line-height: 1.2;
    }
    .layout-favorite-border-width {
        flex-shrink: 0;
        margin-left: auto;
        color: #a991b7;
        font-size: 10.5px;
        font-weight: 800;
        line-height: 1.2;
        text-align: right;
        white-space: nowrap;
    }
    .layout-favorite-divider {
        width: 1px;
        height: 100%;
        background: rgba(255,255,255,0.12);
    }
    .layout-favorite-summary {
        align-self: start;
        min-width: 0;
        color: #d1d1d6;
        font-size: 13px;
        font-weight: 700;
        line-height: 1.45;
        white-space: pre-line;
    }
    .layout-favorite-content {
        min-width: 0;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        padding-top: 1px;
    }
    .layout-favorite-body {
        grid-area: body;
        min-width: 0;
        display: grid;
        grid-template-columns: 96px 1px minmax(0, 1fr);
        align-items: stretch;
        gap: 10px;
    }
    .layout-favorite-identity {
        min-width: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        gap: 5px;
    }
    .layout-favorite-name {
        grid-area: name;
        overflow: hidden;
        color: #f5f5f7;
        max-width: 100%;
        font-size: 16px;
        font-weight: 850;
        line-height: 1.25;
        text-align: left;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .layout-favorite-content .layout-favorite-summary {
        color: #b8b8bd;
        font-size: 12.5px;
    }
    .layout-favorite-list.is-compact .layout-favorite-item {
        min-height: 68px;
        box-sizing: border-box;
        grid-template-columns: 68px 1px auto minmax(0, 1fr);
        grid-template-areas: "thumb divider paper name";
        grid-template-rows: 1fr;
        gap: 10px;
        align-items: center;
    }
    .layout-favorite-list.is-compact :is(.layout-favorite-body, .layout-favorite-identity, .layout-favorite-content, .layout-favorite-paper) {
        display: contents;
    }
    .layout-favorite-list.is-compact .layout-favorite-thumbnail {
        grid-area: thumb;
    }
    .layout-favorite-list.is-compact .layout-favorite-divider {
        grid-area: divider;
    }
    .layout-favorite-list.is-compact .layout-favorite-thumbnail,
    .layout-favorite-list.is-compact .layout-favorite-thumbnail canvas {
        width: 68px;
        height: 44px;
    }
    .layout-favorite-list.is-compact .layout-favorite-name {
        font-size: 18px;
        white-space: normal;
        overflow-wrap: anywhere;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
    }
    .layout-favorite-list.is-compact .layout-favorite-paper strong {
        grid-area: paper;
        text-align: left;
        color: #d9b4ff;
        white-space: nowrap;
    }
    .layout-favorite-list.is-compact :is(.layout-favorite-summary, .layout-favorite-border-width, .layout-favorite-grip) {
        display: none;
    }

    .layout-favorite-manager-overlay {
        --modal-accent: #BF5AF2;
        --workspace-accent: #BF5AF2;
        z-index: 3150;
        background: rgba(8,5,12,0.82);
    }
    .layout-favorite-manager-dialog {
        width: min(760px, calc(100vw - 40px));
        max-height: min(760px, calc(100vh - 40px));
        display: flex;
        flex-direction: column;
        flex-wrap: nowrap;
        gap: 16px;
        padding: 22px;
        overflow: hidden;
        border-color: rgba(191,90,242,0.58);
        background: rgba(27,24,31,0.96);
        box-shadow: 0 22px 70px rgba(0,0,0,0.72), 0 0 28px rgba(191,90,242,0.12);
    }
    .layout-favorite-manager-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 18px;
    }
    .layout-favorite-manager-head h3 {
        margin: 0;
        color: #BF5AF2;
        font-size: 22px;
    }
    .layout-favorite-name-dialog h3 {
        margin: 4px 0 3px;
        color: #f5f5f7;
        font-size: 21px;
    }
    .layout-favorite-name-dialog p {
        margin: 0;
        color: #a9a9af;
        font-size: 13px;
        line-height: 1.45;
    }
    .layout-favorite-manager-close {
        flex: 0 0 auto;
        width: 36px;
        height: 36px;
        border-radius: 50%;
        border: none;
        background: rgba(0,0,0,0.38);
        color: #d1d1d6;
        font-size: 24px;
        line-height: 1;
    }
    .layout-favorite-manager-close svg {
        display: block;
        pointer-events: none;
    }
    .layout-favorite-manager-list {
        min-height: 130px;
        display: flex;
        flex-direction: column;
        gap: 9px;
        overflow: auto;
        padding: 2px 4px 2px 0;
        scrollbar-color: rgba(191,90,242,0.72) rgba(255,255,255,0.05);
    }
    .layout-favorite-manager-empty {
        min-height: 130px;
        display: grid;
        place-items: center;
        border: 1px dashed rgba(191,90,242,0.32);
        border-radius: 9px;
        color: #9b9ba1;
        font-size: 13px;
    }
    .layout-favorite-manager-item {
        position: relative;
        display: grid;
        grid-template-columns: 28px 50px minmax(160px, 0.9fr) minmax(200px, 1.1fr) auto;
        align-items: center;
        gap: 10px;
        padding: 10px;
        border: 1px solid rgba(191,90,242,0.24);
        border-radius: 9px;
        background: rgba(15,14,17,0.72);
        transition: border-color 0.18s ease, background 0.18s ease, opacity 0.18s ease, transform 0.26s cubic-bezier(.2,.78,.24,1), box-shadow 0.18s ease;
        will-change: transform;
    }
    .layout-favorite-manager-item:hover {
        border-color: rgba(191,90,242,0.56);
        background: rgba(191,90,242,0.08);
    }
    .layout-favorite-manager-item.is-dragging {
        z-index: 2;
        opacity: 0.42;
        transform: scale(0.985);
        box-shadow: 0 12px 28px rgba(0,0,0,0.38);
    }
    .layout-favorite-manager-item.is-reorder-animating {
        z-index: 1;
    }
    .layout-favorite-manager-grip {
        width: 28px;
        height: 38px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border: 0;
        background: transparent;
        color: #b78ecb;
        cursor: grab;
    }
    .layout-favorite-manager-grip:active {
        cursor: grabbing;
    }
    .layout-favorite-manager-grip svg {
        width: 18px;
        height: 18px;
        fill: none;
        stroke: currentColor;
        stroke-width: 2.6;
        stroke-linecap: round;
        stroke-linejoin: round;
        pointer-events: none;
    }
    .layout-favorite-manager-thumbnail {
        width: 50px;
        height: 38px;
        justify-self: center;
    }
    .layout-favorite-manager-thumbnail canvas {
        width: 50px;
        height: 38px;
    }
    .layout-favorite-manager-name {
        min-width: 0;
        height: 38px;
        padding: 0 10px;
        border-color: rgba(255,255,255,0.15);
        background: #18181a;
        color: #f5f5f7;
        font-weight: 750;
    }
    .layout-favorite-manager-name:focus,
    .layout-favorite-name-dialog input:focus {
        border-color: #BF5AF2 !important;
        box-shadow: 0 0 0 1px #BF5AF2, 0 0 16px rgba(191,90,242,0.18) !important;
        caret-color: #d9b4ff;
    }
    .layout-favorite-manager-name::selection,
    .layout-favorite-name-dialog input::selection {
        background: rgba(191,90,242,0.48);
        color: #fff;
    }
    .layout-favorite-manager-name.is-dirty {
        border-color: #BF5AF2;
        box-shadow: 0 0 0 1px rgba(191,90,242,0.25);
    }
    .layout-favorite-manager-meta {
        min-width: 0;
        color: #aaaab0;
        font-size: 11px;
        line-height: 1.45;
    }
    .layout-favorite-manager-meta strong {
        display: block;
        overflow: hidden;
        color: #d9b4ff;
        font-size: 12px;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .layout-favorite-manager-actions {
        display: flex;
        align-items: center;
        gap: 7px;
    }
    .layout-favorite-manager-actions button {
        width: auto;
        min-width: 56px;
        height: 34px;
        margin: 0;
        padding: 0 10px;
        font-size: 12px;
        font-weight: 800;
    }
    .layout-favorite-manager-edit {
        border-color: rgba(191,90,242,0.48);
        background: rgba(191,90,242,0.12);
        color: #d9b4ff;
    }
    .layout-favorite-manager-delete {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 34px !important;
        min-width: 34px !important;
        padding: 0 !important;
        border-color: rgba(255,69,58,0.48);
        background: rgba(255,69,58,0.10);
        color: #ff8a84;
    }
    .layout-favorite-manager-delete svg {
        flex: 0 0 auto;
    }
    .layout-favorite-manager-delete.is-confirming {
        border-color: #ff6961;
        background: #c9362f;
        color: #fff;
    }
    .layout-favorite-manager-edit:hover:not(:disabled),
    .layout-favorite-manager-dialog .btn-secondary:hover:not(:disabled) {
        border-color: #BF5AF2;
        background: rgba(191,90,242,0.26);
        color: #fff;
        box-shadow: 0 0 14px rgba(191,90,242,0.18);
    }
    .layout-favorite-manager-delete:hover:not(:disabled) {
        border-color: rgba(255,105,97,0.88);
        background: rgba(255,69,58,0.24);
        color: #fff;
        box-shadow: 0 0 14px rgba(255,69,58,0.14);
    }
    .layout-favorite-manager-footer {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 14px;
        padding-top: 14px;
        border-top: 1px solid rgba(191,90,242,0.20);
    }
    .layout-favorite-manager-footer .btn {
        width: auto;
        min-width: 108px;
        height: 40px;
        margin: 0;
    }
    .layout-favorite-manager-done,
    .layout-favorite-name-confirm {
        border-color: #BF5AF2;
        background: linear-gradient(135deg, #a947d8, #BF5AF2);
        color: #fff;
        font-weight: 850;
    }
    .layout-favorite-manager-done:hover:not(:disabled),
    .layout-favorite-name-confirm:hover:not(:disabled) {
        border-color: #d9b4ff;
        background: linear-gradient(135deg, #b851e6, #ca6cf3);
        color: #fff;
        box-shadow: 0 0 18px rgba(191,90,242,0.28);
    }
    .layout-favorite-name-overlay {
        --modal-accent: #BF5AF2;
        --workspace-accent: #BF5AF2;
        z-index: 3250;
        background: rgba(8,5,12,0.82);
    }
    .layout-favorite-name-dialog {
        width: min(430px, calc(100vw - 36px));
        display: flex;
        flex-direction: column;
        flex-wrap: nowrap;
        gap: 10px;
        padding: 22px;
        border-color: rgba(191,90,242,0.64);
        background: rgba(27,24,31,0.98);
    }
    .layout-favorite-name-dialog input {
        height: 44px;
        margin-top: 5px;
        border-color: rgba(191,90,242,0.45);
        font-size: 15px;
        font-weight: 750;
    }
    .layout-favorite-name-error {
        min-height: 18px;
        color: #ff7b73;
        font-size: 12px;
        font-weight: 700;
    }
    .layout-favorite-name-actions {
        display: grid;
        grid-template-columns: 1fr 1.35fr;
        gap: 9px;
    }
    .layout-favorite-name-actions .btn {
        height: 42px;
        margin: 0;
    }
    @media (max-width: 820px) {
        .layout-favorite-manager-item {
            grid-template-columns: 28px 50px minmax(0, 1fr) auto;
        }
        .layout-favorite-manager-meta {
            display: none;
        }
    }
    .layout-mode-section {
        max-height: 260px;
        opacity: 1;
        overflow: hidden;
        transform: translateY(0);
        transition: max-height 0.24s ease, opacity 0.18s ease, transform 0.22s ease, margin 0.22s ease;
    }
    .layout-mode-section.is-collapsed {
        max-height: 0;
        opacity: 0;
        margin: 0;
        pointer-events: none;
        transform: translateY(-4px);
    }
    .layout-mode-status {
        margin-top: 6px;
        color: #d9b4ff;
        font-size: 12px;
        font-weight: 700;
        line-height: 1.35;
        opacity: 0.88;
    }
    .layout-mode-status.is-free {
        color: #9be7a8;
    }
    .layout-mode-toggle {
        margin-top: 2px;
    }
    .layout-mode-toggle.is-collapsed,
    .layout-mode-status.is-collapsed {
        display: none;
    }
    .layout-favorite-applied-state {
        max-height: 240px;
        margin-top: 6px;
        padding: 9px 10px;
        overflow: hidden;
        border: 1px solid rgba(191, 90, 242, 0.42);
        border-radius: 8px;
        background: rgba(191, 90, 242, 0.08);
        opacity: 1;
        transform: translateY(0);
        transition: max-height 0.24s ease, opacity 0.18s ease, transform 0.22s ease, padding 0.22s ease, margin 0.22s ease;
    }
    .layout-mode-panels {
        min-width: 0;
    }
    .layout-mode-panels > .layout-basic-controls,
    .layout-mode-panels > .layout-mode-section,
    .layout-mode-panels > .layout-favorite-applied-state {
        margin-top: 0;
    }
    .layout-favorite-applied-state.is-collapsed {
        max-height: 0;
        margin: 0;
        padding-top: 0;
        padding-bottom: 0;
        border-width: 0;
        opacity: 0;
        pointer-events: none;
        transform: translateY(-4px);
    }
    .layout-favorite-applied-heading {
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        gap: 8px;
        color: #d9b4ff;
        font-size: 13px;
        font-weight: 800;
    }
    .layout-favorite-applied-heading strong {
        min-width: 0;
        color: #BF5AF2;
        font-size: 12px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .layout-favorite-applied-summary {
        margin-top: 5px;
        min-height: 18px;
        color: #f5f5f7;
        font-size: 12px;
        font-weight: 700;
        line-height: 1.4;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .layout-favorite-applied-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        margin-top: 7px;
    }
    .layout-favorite-applied-actions .btn {
        min-width: 0;
        min-height: 40px;
        height: auto;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 5px 7px;
        font-size: 12px;
        line-height: 1.25;
        text-align: center;
        white-space: normal;
    }
    .layout-basic-controls {
        margin-top: 4px;
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    .layout-spec-count-row {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(96px, 0.48fr);
        gap: 8px;
        align-items: stretch;
    }
    .layout-spec-select-wrap,
    .layout-count-select {
        min-width: 0;
    }
    .layout-spec-count-row select {
        width: 100%;
        height: 48px;
    }
    .layout-favorite-filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 12px; }
    .layout-favorite-filters .layout-paper-option-btn[hidden] { display: none; }
    .layout-favorite-filters .layout-paper-option-btn { flex: 1 1 58px; min-width: 0; min-height: 30px; padding: 4px; font-size: 12px; white-space: nowrap; }
    .layout-favorite-filters [data-layout-favorite-paper="current"] { flex-basis: 72px; flex-grow: 1.12; }
    .free-layout-add-buttons { display: flex; flex-direction: column; gap: 8px; }
    .layout-quantity-row { display: grid; grid-template-columns: 46px minmax(0, 1fr) 96px; align-items: center; gap: 8px; padding: 8px; border: 1px solid #48484a; border-radius: 8px; background: rgba(32,32,34,.88); transition: border-color .22s ease; }
    .layout-quantity-row.has-layout-count { border-color: var(--accent-purple); }
    body.decorative-animations-off .layout-quantity-row, body.app-background-paused .layout-quantity-row { transition: none; }
    @media (prefers-reduced-motion: reduce) { .layout-quantity-row { transition: none; } }
    .layout-spec-group-label, .layout-spec-group > summary { color: #d9b4ff; font-size: 13px; font-weight: 700; padding-block: 6px; }
    .layout-spec-group > summary { cursor: pointer; user-select: none; }
    .layout-spec-group-rows { display: flex; flex-direction: column; gap: 8px; padding-top: 4px; }
    .layout-spec-group[hidden] { display: none; }
    .layout-spec-group::details-content { interpolate-size: allow-keywords; block-size: 0; overflow: clip; transition: block-size .22s ease, content-visibility .22s allow-discrete; }
    .layout-spec-group[open]::details-content { block-size: auto; }
    body.decorative-animations-off .layout-spec-group::details-content { transition: none; }
    @media (prefers-reduced-motion: reduce) { .layout-spec-group::details-content { transition: none; } }
    .layout-spec-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
    .layout-spec-heading > label { margin: 0; }
    .layout-spec-heading-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
    .layout-arrangement-toggle { --switch-accent: var(--accent-purple); position: relative; width: auto; min-height: 26px; gap: 6px; font-size: 12px; white-space: nowrap; }
    .layout-arrangement-toggle > span:first-child { min-width: 4em; transition: color .18s ease; }
    .layout-arrangement-toggle input[type="checkbox"] { width: 1px; height: 1px; top: 50%; left: 0; margin: 0; }
    .layout-arrangement-note { margin-top: 6px; color: #aeaeb2; font-size: 12px; line-height: 1.4; }
    .layout-arrangement-note.is-error { color: #ff453a; }
    .layout-arrangement-note[hidden] { display: none; }
    body.decorative-animations-off .layout-arrangement-toggle *, body.app-background-paused .layout-arrangement-toggle * { transition: none; }
    @media (prefers-reduced-motion: reduce) { .layout-arrangement-toggle * { transition: none; } }
    .layout-quantity-preview { position: relative; width: 46px; height: 46px; grid-column: 1; grid-row: 1; }
    .layout-quantity-preview .layout-quantity-warning { width: 16px; height: 16px; top: -4px; left: auto; right: -4px; transform: none; pointer-events: auto; }
    .layout-quantity-preview .simple-spec-coverage-warning-icon { width: 12px; height: 12px; flex-basis: 12px; }
    .layout-quantity-thumb { width: 46px; height: 46px; background: #18181a; border-radius: 4px; transform: rotate(0deg); transition: transform .22s ease; }
    .layout-quantity-thumb.is-rotated { transform: rotate(90deg); }
    body.decorative-animations-off .layout-quantity-thumb { transition: none; }
    @media (prefers-reduced-motion: reduce) { .layout-quantity-thumb { transition: none; } }
    #layoutSpecGroup .layout-quantity-rotate { position: absolute; inset: 0; margin: auto; width: 32px; min-width: 32px; height: 32px; display: grid; place-items: center; transform: none; opacity: 0; pointer-events: none; transition: opacity .16s ease, filter .16s ease, box-shadow .16s ease; }
    #layoutSpecGroup .layout-quantity-preview:hover .layout-quantity-rotate,
    #layoutSpecGroup .layout-quantity-rotate:focus-visible { opacity: 1; pointer-events: auto; }
    body.decorative-animations-off #layoutSpecGroup .layout-quantity-rotate { transition: none; }
    @media (prefers-reduced-motion: reduce) { #layoutSpecGroup .layout-quantity-rotate { transition: none; } }
    .layout-quantity-rotate svg { width: 16px; height: 16px; }
    .layout-quantity-info { position: relative; z-index: 1; grid-column: 2; grid-row: 1; min-width: 0; overflow: hidden; display: flex; flex-direction: column; justify-content: center; gap: 4px; pointer-events: none; }
    .layout-quantity-info strong { display: block; min-width: 0; max-width: 100%; margin: 0; color: #f5f5f7; font-size: 16px; line-height: 20px; overflow-wrap: anywhere; }
    .layout-quantity-controls { position: relative; z-index: 2; grid-column: 3; grid-row: 1; width: 96px; justify-self: end; display: grid; grid-template-columns: 28px minmax(0, 1fr) 28px; gap: 4px; align-items: center; }
    #layoutSpecGroup .layout-quantity-promote { position: absolute; z-index: 3; top: 0; right: calc(100% + 4px); width: 56px; min-width: 0; height: 28px; padding: 0 5px; display: grid; place-items: center; line-height: 1; box-sizing: border-box; border: 1px solid var(--accent-purple); background: #2f2035; color: #e4baff; font-size: 11px; font-weight: 750; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .16s ease, background .16s ease, color .16s ease, box-shadow .16s ease; }
    #layoutSpecGroup .layout-quantity-row:hover .layout-quantity-promote,
    #layoutSpecGroup .layout-quantity-promote:focus-visible { opacity: 1; pointer-events: auto; }
    #layoutSpecGroup .layout-quantity-row.is-current-spec .layout-quantity-promote { opacity: 0; pointer-events: none; }
    #layoutSpecGroup .layout-quantity-promote:hover,
    #layoutSpecGroup .layout-quantity-promote:focus-visible { background: var(--accent-purple); color: #1c1c1e; box-shadow: var(--glow-purple-soft); }
    body.decorative-animations-off #layoutSpecGroup .layout-quantity-promote,
    body.app-background-paused #layoutSpecGroup .layout-quantity-promote { transition: none; }
    @media (prefers-reduced-motion: reduce) { #layoutSpecGroup .layout-quantity-promote { transition: none; } }
    #layoutSpecGroup .layout-quantity-step { min-width: 0; height: 28px; padding: 0; display: grid; place-items: center; line-height: 1; box-sizing: border-box; border: 1px solid var(--accent-purple); background: rgba(191,90,242,.12); color: #e4baff; font-size: 22px; }
    #layoutSpecGroup .layout-quantity-step:hover:not(:disabled) { background: var(--accent-purple); color: #1c1c1e; }
    #layoutSpecGroup .layout-quantity-step:disabled { opacity: .35; box-shadow: none; transform: none; cursor: not-allowed; }
    #layoutSpecGroup input[data-layout-spec-count] { width: 100%; min-width: 0; height: 28px; box-sizing: border-box; margin: 0; padding: 0 2px; border: 1px solid rgba(191,90,242,.44); border-radius: 8px; background: #18181a; color: #e9c8ff; font: inherit; font-size: 15px; line-height: 26px; text-align: center; appearance: textfield; }
    #layoutSpecGroup input[data-layout-spec-count]::-webkit-inner-spin-button, #layoutSpecGroup input[data-layout-spec-count]::-webkit-outer-spin-button { appearance: none; margin: 0; }
    #layoutSpecGroup input[data-layout-spec-count]:focus { outline: none; border-color: var(--accent-purple); box-shadow: 0 0 0 2px rgba(191,90,242,.18); }
    #layoutSpecGroup .layout-add-spec-select { width: 100%; height: 36px; margin-top: 10px; font-size: 13px; }
    #layoutSpecGroup .layout-add-spec-select[hidden] { display: none; }
    #freeLayoutControls { max-height: none; overflow: visible; }
    #layoutCountGroup {
        max-height: 132px;
        opacity: 1;
        overflow: hidden;
        transition: max-height 0.24s ease, opacity 0.18s ease, gap 0.2s ease, margin 0.2s ease;
    }
    #layoutCountGroup.is-collapsed {
        max-height: 0;
        opacity: 0;
        margin: 0;
        gap: 0;
        pointer-events: none;
    }

    #initInfoModal { z-index: 3000 !important; }

    #historyControls { position: absolute; left: 20px; top: 20px; display: none; z-index: 100; flex-direction: row; align-items: center; justify-content: center; box-shadow: 0 4px 10px rgba(0,0,0,0.5); gap: 0; border-radius: 20px; background: transparent; }
    .history-btn { --history-accent: #d1d1d6; padding: 6px 14px; font-size: 13px; font-weight: bold; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 4px; transition: background-color 0.07s ease-out, border-color 0.14s ease-out, color 0.14s ease-out, opacity 0.14s ease-out, transform 0.12s ease, box-shadow 0.14s ease-out; background: rgba(24,24,26,0.8); backdrop-filter: blur(var(--glass-blur-floating)); -webkit-backdrop-filter: blur(var(--glass-blur-floating)); }
    .undo-btn { color: #fff; border: 1.5px solid var(--primary); border-right: 0.75px solid var(--primary); border-radius: 20px 0 0 20px; }
    .undo-btn:active:not(:disabled) { background: var(--primary); color: #1c1c1e; }
    .undo-btn:disabled { background: rgba(0,0,0,0.6); cursor: not-allowed; }
    .redo-btn { color: #fff; border: 1.5px solid #3CAE4E; border-left: 0.75px solid #3CAE4E; border-radius: 0 20px 20px 0; }
    .redo-btn:active:not(:disabled) { background: #3CAE4E; color: #1c1c1e; }
    .redo-btn:disabled { background: rgba(0,0,0,0.6); cursor: not-allowed; }

    #loupe { display:none; position:fixed; width:160px; height:160px; border-radius:50%; border:3px solid rgba(235,235,240,0.82); pointer-events:none; z-index:1500; overflow:hidden; box-shadow:0 10px 28px rgba(0,0,0,0.85), inset 0 0 0 1px rgba(0,0,0,0.48); background:#2c2c2e; transition: width 0.12s ease, height 0.12s ease, border-color 0.12s ease; }
    #loupeCanvas { position:absolute; inset:0; width:100%; height:100%; border-radius:50%; }
    .loupe-center-marker { position:absolute; left:50%; top:50%; width:16px; height:16px; box-sizing:border-box; transform:translate(-50%,-50%); border:2px solid rgba(255,255,255,0.96); border-radius:50%; box-shadow:0 0 0 1px rgba(0,0,0,0.72), 0 1px 5px rgba(0,0,0,0.78); }
    .loupe-center-marker::after { content:''; position:absolute; left:50%; top:50%; width:3px; height:3px; transform:translate(-50%,-50%); border-radius:50%; background:rgba(255,255,255,0.82); }
    .loupe-badge { position:absolute; left:50%; bottom:10px; display:inline-flex; align-items:center; gap:4px; min-height:24px; padding:2px 8px; transform:translateX(-50%); border:1px solid rgba(255,255,255,0.30); border-radius:12px; color:#f5f5f7; background:rgba(20,20,22,0.74); box-shadow:0 2px 7px rgba(0,0,0,0.42); backdrop-filter:blur(var(--glass-blur-floating)); -webkit-backdrop-filter:blur(var(--glass-blur-floating)); font-size:11px; font-weight:800; white-space:nowrap; }
    .loupe-badge svg { flex:none; }
    #loupeConnector { display:none; position:fixed; height:1.5px; transform-origin:left center; pointer-events:none; z-index:1498; background:linear-gradient(90deg, rgba(255,159,10,0.84), rgba(235,235,240,0.34)); box-shadow:0 0 4px rgba(0,0,0,0.58); }
    #loupeSourceTarget { display:none; position:fixed; width:18px; height:18px; box-sizing:border-box; transform:translate(-50%,-50%); border:2px solid #ff9f0a; border-radius:50%; pointer-events:none; z-index:1501; box-shadow:0 0 0 1px rgba(0,0,0,0.80), 0 0 9px rgba(255,159,10,0.44); }
    #loupeSourceTarget::before, #loupeSourceTarget::after { content:''; position:absolute; left:50%; top:50%; background:#ff9f0a; box-shadow:0 0 0 1px rgba(0,0,0,0.34); }
    #loupeSourceTarget::before { width:32px; height:1.5px; transform:translate(-50%,-50%); }
    #loupeSourceTarget::after { width:1.5px; height:32px; transform:translate(-50%,-50%); }
    #loupe[style*="display: block"] + #loupeConnector,
    #loupe[style*="display: block"] + #loupeConnector + #loupeSourceTarget { display:block; }

    #btnHideLines { transition: background-color 0.2s, transform 0.1s; border: 1px solid #48484a; color: white; display: flex; align-items: center; justify-content: center; cursor: pointer; user-select: none; }
    #btnHideLines:hover { background: #48484a !important; }
    #btnHideLines.pressed { background: var(--primary) !important; color: #1c1c1e !important; border-color: var(--primary); transform: scale(0.95); }


    .history-btn svg {
        flex-shrink: 0;
        margin-bottom: 1px;
        transition: filter 0.14s ease-out;
    }

    #btnUndo:disabled, #btnRedo:disabled {
        color: #636366;
        border-color: #333336;
        opacity: 1;
        box-shadow: none;
    }

    #btnUndo {
        --history-accent: var(--primary);
    }

    #btnRedo {
        --history-accent: #3CAE4E;
    }

    #btnUndo:not(:disabled) {
        color: var(--history-accent);
        border-color: var(--history-accent);
    }

    #btnRedo:not(:disabled) {
        color: var(--history-accent);
        border-color: var(--history-accent);
    }

    .history-btn:not(:disabled) {
        box-shadow: 0 0 8px color-mix(in srgb, var(--history-accent) 8%, transparent);
    }

    #btnUndo:hover:not(:disabled),
    #btnUndo:focus-visible:not(:disabled),
    #btnRedo:hover:not(:disabled),
    #btnRedo:focus-visible:not(:disabled) {
        background: color-mix(in srgb, var(--history-accent) 14%, rgba(24,24,26,0.88));
        border-color: color-mix(in srgb, var(--history-accent) 72%, white 28%);
        box-shadow: 0 0 12px color-mix(in srgb, var(--history-accent) 22%, transparent);
    }

    #btnUndo:hover:not(:disabled) svg,
    #btnUndo:focus-visible:not(:disabled) svg,
    #btnRedo:hover:not(:disabled) svg,
    #btnRedo:focus-visible:not(:disabled) svg {
        filter: drop-shadow(0 0 4px color-mix(in srgb, var(--history-accent) 58%, transparent));
    }

    #btnUndo:focus-visible:not(:disabled),
    #btnRedo:focus-visible:not(:disabled) {
        position: relative;
        z-index: 1;
        outline: 2px solid color-mix(in srgb, var(--history-accent) 68%, white 32%);
        outline-offset: 2px;
    }

    #btnUndo:active:not(:disabled),
    #btnRedo:active:not(:disabled) {
        color: #1c1c1e;
        box-shadow: 0 0 8px color-mix(in srgb, var(--history-accent) 12%, transparent);
    }
/* Detailed preview shown while naming a new favorite layout. */
.layout-favorite-name-dialog {
    width: min(560px, calc(100vw - 36px));
    gap: 12px;
}
.layout-favorite-name-dialog .layout-favorite-name-heading {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    color: #BF5AF2;
    font-size: 22px;
}
.layout-favorite-name-heading svg { flex: 0 0 auto; }
.layout-favorite-name-dialog > input { margin-top: 0; }
.layout-favorite-name-error:empty { display: none; }
.layout-favorite-name-preview { min-width: 0; }
.layout-favorite-name-preview-card {
    display: grid;
    grid-template-columns: 120px 1px minmax(0, 1fr);
    align-items: center;
    gap: 16px;
    min-height: 118px;
    padding: 14px;
    border: 1px solid rgba(191,90,242,.58);
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(191,90,242,.13), rgba(255,255,255,.025));
    box-sizing: border-box;
}
.layout-favorite-name-preview-card .layout-favorite-thumbnail,
.layout-favorite-name-preview-card .layout-favorite-thumbnail canvas {
    width: 120px;
    height: 76px;
}
.layout-favorite-name-preview-card .layout-favorite-divider {
    width: 1px;
    height: 82px;
    background: rgba(191,90,242,.3);
}
.layout-favorite-name-preview-card .layout-favorite-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}
.layout-favorite-name-preview-card .layout-favorite-paper {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    color: #d9b4ff;
}
.layout-favorite-name-preview-card .layout-favorite-summary {
    color: #c7c7cc;
    line-height: 1.45;
    white-space: pre-line;
}
.layout-favorite-name-actions .btn:focus-visible {
    outline: 2px solid #BF5AF2;
    outline-offset: 3px;
    box-shadow: 0 0 18px rgba(191,90,242,.28);
}
@media (max-width: 560px) {
    .layout-favorite-name-preview-card { grid-template-columns: 92px 1px minmax(0, 1fr); gap: 10px; }
    .layout-favorite-name-preview-card .layout-favorite-thumbnail,
    .layout-favorite-name-preview-card .layout-favorite-thumbnail canvas { width: 92px; height: 62px; }
}
/* 「完全關閉」是全局互動契約：不讓後載入的元件樣式遺漏過渡。 */
body.decorative-animations-off *,
body.decorative-animations-off *::before,
body.decorative-animations-off *::after {
    animation-duration: 0s !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0s !important;
    transition-delay: 0s !important;
    scroll-behavior: auto !important;
}
/* Reserve classic vertical-scrollbar width across app panels so content does not shift when lists grow. */
:where(
    .sidebar-scroll,
    .filmstrip-scroll,
    .shortcut-panel:not(.mini),
    .spec-tool-content,
    .settings-page,
    .settings-page-scroll,
    .settings-transfer-list,
    .layout-control-scroll,
    .layout-favorite-manager-list,
    .cd-control-pane,
    .simple-mode-content,
    .simple-spec-grid,
    .simple-output-settings-scroll,
    .simple-output-preview-grid,
    .simple-output-summary-preview,
    .simple-coverage-confirm-list,
    .simple-file-list,
    .batch-source-list,
    .batch-recipe-panel,
    .batch-recipe-column,
    .batch-review-grid,
    .batch-output-panel,
    .batch-output-preview-list,
    .ugem-upload-body,
    .ugem-upload-prompt-card p,
    .ugem-upload-prompt-history,
    .sunny-select-menu
) {
    scrollbar-gutter: stable;
}
