@font-face{
    font-family:'HK Grotesk Wide';
    src:url('../Font/HK%20Grotesque%20Wide/HKGroteskWide-Light.otf') format('opentype');
    font-style:normal;
    font-weight:300;
    font-display:swap;
}
@font-face{
    font-family:'HK Grotesk Wide';
    src:url('../Font/HK%20Grotesque%20Wide/HKGroteskWide-Regular.otf') format('opentype');
    font-style:normal;
    font-weight:400;
    font-display:swap;
}
@font-face{
    font-family:'HK Grotesk Wide';
    src:url('../Font/HK%20Grotesque%20Wide/HKGroteskWide-Medium.otf') format('opentype');
    font-style:normal;
    font-weight:500;
    font-display:swap;
}
@font-face{
    font-family:'HK Grotesk Wide';
    src:url('../Font/HK%20Grotesque%20Wide/HKGroteskWide-SemiBold.otf') format('opentype');
    font-style:normal;
    font-weight:600;
    font-display:swap;
}
@font-face{
    font-family:'HK Grotesk Wide';
    src:url('../Font/HK%20Grotesque%20Wide/HKGroteskWide-Bold.otf') format('opentype');
    font-style:normal;
    font-weight:700;
    font-display:swap;
}
@font-face{
    font-family:'HK Grotesk Wide';
    src:url('../Font/HK%20Grotesque%20Wide/HKGroteskWide-Black.otf') format('opentype');
    font-style:normal;
    font-weight:900;
    font-display:swap;
}

:root { --accent:#c77b6b; --app-red:#ef4027; --r-sm:10px; --r-md:14px; --accent-glass:rgba(199,123,107,0.22); --mobile-keyboard-inset:0px; --app-font:'HK Grotesk Wide',-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif; --ai-input-font-size:14px; }
[data-theme="light"] {
    --bg:#f0f0f0; --dot:#ccc;
    --surface:#fff; --surface-2:#f2f2f2; --border:#e0e0e0;
    --text:#1a1a1a; --text-mid:#6b6b6b; --text-dim:#aaa;
    --ctx-bg:#1c1c1e; --ctx-text:#f0f0f0;
    --wf-drop:#0f1115;
    --shadow:0 2px 10px rgba(0,0,0,0.07); --shadow-lg:0 8px 28px rgba(0,0,0,0.1);
    --toolbar-surface:#f5f5f5; --toolbar-border:#ddd;
}
[data-theme="dark"] {
    --bg:#0d0f12; --dot:#1c2026;
    --surface:#171a1f; --surface-2:#1d2128; --border:#2a2f39;
    --text:#f0f0f0; --text-mid:#a0a0a8; --text-dim:#6b6b70;
    --ctx-bg:#111113; --ctx-text:#f0f0f0;
    --wf-drop:#ffffff;
    --shadow:0 2px 10px rgba(0,0,0,0.3); --shadow-lg:0 8px 28px rgba(0,0,0,0.45);
    --toolbar-surface:#0e1116; --toolbar-border:#1a1d25;
}
*,*::before,*::after{box-sizing:border-box;user-select:none;}
body,html{margin:0;padding:0;width:100%;height:100%;min-width:0;min-height:0;background:var(--bg);color:var(--text);font-family:var(--app-font);font-weight:300;overflow:hidden;overscroll-behavior:none;transition:background .25s,color .25s;}
button,input,textarea,select,option{font-family:var(--app-font)!important;}
#ui-container,#ui-container *{font-family:var(--app-font)!important;}

/* Lucide should render stroke-only, never filled blobs. */
svg.lucide{
    fill:none!important;
    stroke:currentColor!important;
    stroke-width:2;
    stroke-linecap:round;
    stroke-linejoin:round;
    vector-effect:non-scaling-stroke;
}
html{height:100dvh;}
body{position:fixed;inset:0;height:100dvh;max-height:100dvh;-webkit-overflow-scrolling:auto;}
#ui-container{position:fixed;inset:0;width:100vw;height:100dvh;max-height:100dvh;overflow:hidden;background:var(--bg);}

/* Keep iPad/iOS text sizing stable while focusing form controls. */
html,body{-webkit-text-size-adjust:100%;}

.auth-screen{position:fixed;inset:0;z-index:1200;display:flex;align-items:center;justify-content:center;overflow:hidden;}
.auth-screen.hidden{display:none;}
.auth-bg{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;filter:brightness(.92) contrast(1.06) saturate(1.05);transform:scale(1.015);}
.auth-overlay{position:absolute;inset:0;background:linear-gradient(180deg,rgba(5,7,10,.34),rgba(7,10,14,.56));}
.auth-card{position:relative;z-index:1;width:min(430px,calc(100vw - 30px));border-radius:16px;padding:22px 20px 18px;background:rgba(14,18,25,.62);border:1px solid rgba(255,255,255,.2);backdrop-filter:blur(16px) saturate(1.1);box-shadow:0 22px 52px rgba(0,0,0,.45);display:flex;flex-direction:column;gap:10px;}
.auth-brand{font-size:11px;letter-spacing:.13em;text-transform:uppercase;color:rgba(234,240,255,.86);opacity:1;}
.auth-title{margin:0;font-size:31px;line-height:1.04;color:#ffffff;letter-spacing:-.02em;font-weight:900;}
.auth-subtitle{margin:0 0 8px;font-size:14px;color:rgba(228,236,255,.92);font-weight:300;}
.auth-step{display:flex;flex-direction:column;gap:8px;}
.auth-step.hidden{display:none;}
.auth-label{font-size:12px;color:rgba(239,245,255,.88);font-weight:300;}
.auth-input{height:42px;border-radius:10px;border:1px solid rgba(255,255,255,.26);padding:0 12px;background:rgba(7,11,18,.62);color:#fff;font-size:14px;font-family:inherit;font-weight:300;outline:none;}
.auth-input::placeholder{color:rgba(238,244,255,.56);}
.auth-input:focus{border-color:rgba(239,64,39,.85);box-shadow:0 0 0 1px rgba(239,64,39,.42);}
.auth-primary{height:40px;border-radius:10px;border:1px solid rgba(239,64,39,.7);background:var(--app-red);color:#fff;font-size:13px;font-family:inherit;font-weight:600;cursor:pointer;box-shadow:0 8px 22px rgba(239,64,39,.26);}
.auth-secondary{height:36px;border-radius:10px;border:1px solid rgba(255,255,255,.22);background:rgba(255,255,255,.08);color:#fff;font-size:12px;font-family:inherit;cursor:pointer;}
.auth-status{margin-top:4px;min-height:18px;font-size:12px;color:rgba(235,242,255,.92);font-weight:300;}
.auth-status.error{color:#ffb7ac;}
body.auth-locked #ui-container{display:none;}

/* Viewport */
#viewport{position:absolute;inset:0;width:100%;height:100%;overflow:hidden;background-color:var(--bg);background-image:radial-gradient(var(--dot) 1px,transparent 1px);background-size:24px 24px;cursor:default;transition:background-color .25s;touch-action:none;}
#viewport.is-panning{cursor:grabbing!important;}
#viewport.is-cmd-zoom{cursor:ns-resize!important;}
#canvas{position:absolute;top:0;left:0;width:0;height:0;transform-origin:0 0;}
#sketch-draft-layer{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:14;display:none;}
body.sketch-mode #sketch-draft-layer{display:block;cursor:crosshair;}

/* Theme Toggle */
#theme-toggle{width:30px;height:30px;padding:0;border-radius:8px;border:1px solid transparent;background:transparent;display:flex;align-items:center;justify-content:center;cursor:pointer;color:var(--text-mid);transition:background .14s ease,border-color .14s ease,color .14s ease;}
#theme-toggle:hover{background:var(--surface);border-color:var(--border);color:var(--text);}
#theme-toggle svg{width:16px;height:16px;fill:currentColor;}

.space-switcher{position:absolute;top:14px;left:50%;transform:translateX(-50%);display:flex;align-items:center;padding:3px;border-radius:11px;border:1px solid var(--border);background:color-mix(in srgb,var(--surface) 84%,transparent);backdrop-filter:blur(10px);box-shadow:var(--shadow);z-index:310;}
.space2-grid-mode-corner{position:absolute;top:14px;left:12px;z-index:338;pointer-events:auto;display:flex;align-items:center;}
.space2-grid-mode-corner.hidden{display:none;}
.space2-top-sync{position:absolute;top:14px;left:12px;z-index:338;pointer-events:auto;display:flex;align-items:center;}
.space2-top-sync.hidden{display:none;}
.space2-top-corner{position:absolute;top:14px;right:12px;z-index:338;pointer-events:auto;display:flex;align-items:center;gap:8px;}
.space2-top-corner.hidden{display:none;}
.space2-top-icon-btn.hidden{display:none !important;}
.sketch-fab-wrap:has(#bar-sketch-btn.hidden) .sketch-menu{display:none !important;}
.space2-top-import{height:40px;padding:0 14px;border-radius:12px;border:1px solid var(--border);background:var(--surface);box-shadow:var(--shadow);color:var(--text);font-size:12px;font-family:inherit;font-weight:600;letter-spacing:.01em;cursor:pointer;transition:transform .14s ease,box-shadow .14s ease,border-color .14s ease;display:flex;align-items:center;gap:8px;flex-shrink:0;}
.space2-top-import:hover{transform:translateY(-1px);box-shadow:var(--shadow-lg);border-color:color-mix(in srgb,var(--accent) 32%,var(--border));}
.space2-top-import svg{width:15px;height:15px;fill:currentColor;opacity:.94;}
.space2-top-import span{display:block;}
.space-toggle{position:relative;overflow:hidden;width:210px;height:30px;border-radius:8px;background:transparent;padding:0;display:flex;align-items:center;gap:2px;-webkit-tap-highlight-color:transparent;}
.space-toggle-btn{position:relative;z-index:2;flex:1 1 0;min-width:0;height:30px;border:none;border-radius:8px;background:transparent;color:var(--text-mid);font-size:12px;font-weight:300;font-family:var(--app-font)!important;cursor:pointer;transition:color .16s ease,opacity .16s ease;}
.space-toggle-btn:focus-visible{outline:2px solid color-mix(in srgb,var(--accent) 55%,transparent);outline-offset:2px;}
.space-toggle-btn[aria-selected="true"]{color:var(--text);font-weight:900;}
.space-toggle-thumb{position:absolute;top:0;left:0;width:104px;height:30px;border-radius:8px;background:color-mix(in srgb,var(--app-red) 14%,var(--surface));border:1px solid color-mix(in srgb,var(--app-red) 42%,var(--border));box-shadow:0 1px 3px rgba(0,0,0,.06),0 2px 12px rgba(239,64,39,.14);backdrop-filter:blur(10px);z-index:1;will-change:left;}

.space2-panel{position:absolute;inset:52px 16px 18px;z-index:170;border:none;border-radius:0;background:transparent;backdrop-filter:none;box-shadow:none;display:flex;flex-direction:column;overflow:visible;--space2-sidebar-width:238px;}
.space2-panel.hidden{display:none;}
.space2-head{display:flex;flex-direction:column;gap:8px;pointer-events:auto;}
.space2-head-row{display:flex;align-items:center;gap:8px;}
.space2-sidebar-head{position:static;top:auto;z-index:auto;padding:2px 0 6px;border-radius:0;border:none;background:transparent;backdrop-filter:none;box-shadow:none;display:flex;flex-direction:row;flex-wrap:nowrap;align-items:center;gap:8px;min-width:0;}
.space2-sidebar-head .space2-search-wrap{flex:1 1 0;min-width:0;width:auto;max-width:none;overflow:hidden;}
.space2-search-wrap{height:40px;width:320px;max-width:min(58vw,420px);flex-shrink:1;display:flex;align-items:center;gap:8px;padding:0 12px;border-radius:12px;border:1px solid var(--border);background:var(--surface);box-shadow:var(--shadow);transition:border-color .2s ease,background .2s ease,box-shadow .2s ease;min-width:0;overflow:hidden;}
.space2-search-wrap:focus-within{width:min(58vw,420px);box-shadow:var(--shadow-lg);border-color:color-mix(in srgb,var(--accent) 35%,var(--border));}
.space2-search-wrap svg{width:14px;height:14px;fill:var(--text-dim);opacity:.9;}
#space2-search{border:none;outline:none;background:transparent;color:var(--text);font-size:14px;width:100%;font-family:var(--app-font)!important;font-weight:300;}
.space2-sync-indicator{display:none !important;}
.space2-sync-btn{height:26px;padding:0 11px;border-radius:10px;border:1px solid var(--border);background:color-mix(in srgb,var(--surface) 90%,transparent);color:var(--text);font-size:11px;font-weight:700;letter-spacing:.01em;display:inline-flex;align-items:center;gap:7px;cursor:pointer;box-shadow:var(--shadow);transition:border-color .16s ease,transform .16s ease,box-shadow .16s ease;}
.space2-sync-btn::before{content:'';width:7px;height:7px;border-radius:50%;background:color-mix(in srgb,var(--text-mid) 72%,transparent);display:block;flex:0 0 auto;}
.space2-sync-btn:hover{transform:translateY(-1px);border-color:color-mix(in srgb,var(--accent) 34%,var(--border));box-shadow:var(--shadow-lg);}
.space2-sync-btn:disabled{opacity:.58;cursor:not-allowed;transform:none;box-shadow:var(--shadow);}
.space2-sync-btn[data-state="ok"]::before{background:#31b26b;}
.space2-sync-btn[data-state="error"]::before{background:#d25a5a;}
.space2-sync-btn[data-state="syncing"]::before{width:9px;height:9px;border:1.5px solid color-mix(in srgb,var(--border) 84%,transparent);border-top-color:var(--accent);background:transparent;animation:space2SyncSpin .8s linear infinite;}
.space2-sync-dot{width:7px;height:7px;border-radius:50%;background:color-mix(in srgb,var(--text-mid) 72%,transparent);}
.space2-sync-indicator[data-state="syncing"]{color:var(--text);}
.space2-sync-indicator[data-state="syncing"] .space2-sync-dot{width:9px;height:9px;border:1.5px solid color-mix(in srgb,var(--border) 84%,transparent);border-top-color:var(--accent);background:transparent;animation:space2SyncSpin .8s linear infinite;}
.space2-sync-indicator[data-state="ok"] .space2-sync-dot{background:#31b26b;}
.space2-sync-indicator[data-state="error"] .space2-sync-dot{background:#d25a5a;}
.space2-sync-indicator[data-state="offline"] .space2-sync-dot{background:color-mix(in srgb,var(--text-dim) 65%,transparent);}
@keyframes space2SyncSpin{to{transform:rotate(360deg);}}
.space2-top-icon-btn{width:30px;height:30px;padding:0;border-radius:8px;border:1px solid transparent;background:transparent;backdrop-filter:none;box-shadow:none;color:var(--text-mid);display:flex;align-items:center;justify-content:center;cursor:pointer;transition:background .14s ease,border-color .14s ease,color .14s ease;}
.space2-top-icon-btn:hover{background:var(--surface);border-color:var(--border);color:var(--text);}
.space2-top-icon-btn svg{width:16px;height:16px;fill:currentColor;}
.sketch-fab-wrap{position:relative;display:flex;align-items:center;}
.space2-camera-float{border-color:color-mix(in srgb,var(--app-red) 42%,var(--border));background:color-mix(in srgb,var(--app-red) 14%,var(--surface));color:var(--app-red);}
.space2-camera-float:hover{border-color:color-mix(in srgb,var(--app-red) 56%,var(--border));background:color-mix(in srgb,var(--app-red) 20%,var(--surface));}
.space2-mobile-notch{display:none;}

.space2-view-switch{display:inline-flex;align-items:center;gap:3px;flex:0 0 auto;width:max-content;max-width:max-content;height:38px;padding:3px;border-radius:11px;border:1px solid var(--border);background:var(--surface);box-shadow:var(--shadow);}
.space2-view-switch.hidden{display:none;}
.space2-view-toggle{position:relative;width:82px;height:30px;border:none;border-radius:8px;background:transparent;padding:0;display:flex;align-items:center;justify-content:space-between;cursor:pointer;color:var(--text-mid);}
.space2-view-icon{position:absolute;top:0;z-index:2;width:41px;height:30px;display:flex;align-items:center;justify-content:center;opacity:.88;transition:color .14s ease,opacity .14s ease;}
.space2-view-icon-discover{left:0;}
.space2-view-icon-grid{right:0;}
.space2-view-icon svg{width:14px;height:14px;fill:currentColor;}
.space2-view-thumb{position:absolute;top:2px;left:2px;width:38px;height:26px;border-radius:7px;background:var(--surface);border:1px solid var(--border);box-shadow:0 1px 3px rgba(0,0,0,.14);transition:left .2s cubic-bezier(.4,0,.2,1);z-index:1;}
.space2-view-toggle.is-grid .space2-view-thumb{left:42px;}
.space2-view-toggle:not(.is-grid) .space2-view-icon-discover{color:var(--text);opacity:1;}
.space2-view-toggle.is-grid .space2-view-icon-grid{color:var(--text);opacity:1;}
.space2-sidebar .space2-view-switch{align-self:flex-start;}

.space2-grid-mode-switch{display:inline-flex;align-items:center;gap:3px;flex:0 0 auto;width:max-content;max-width:max-content;height:38px;padding:3px;border-radius:11px;border:1px solid var(--border);background:var(--surface);box-shadow:var(--shadow);}
.space2-grid-mode-switch.hidden{display:none;}
.space2-grid-mode-toggle{position:relative;width:82px;height:30px;border:none;border-radius:8px;background:transparent;padding:0;display:flex;align-items:center;justify-content:space-between;cursor:pointer;color:var(--text-mid);}
.space2-grid-mode-icon{position:absolute;top:0;z-index:2;width:41px;height:30px;display:flex;align-items:center;justify-content:center;opacity:.88;transition:color .14s ease,opacity .14s ease;}
.space2-grid-mode-icon-masonry{left:0;}
.space2-grid-mode-icon-infinite{right:0;}
.space2-grid-mode-icon svg{width:14px;height:14px;fill:currentColor;}
.space2-grid-mode-thumb{position:absolute;top:2px;left:2px;width:38px;height:26px;border-radius:7px;background:var(--surface);border:1px solid var(--border);box-shadow:0 1px 3px rgba(0,0,0,.14);transition:left .2s cubic-bezier(.4,0,.2,1);z-index:1;}
.space2-grid-mode-toggle.is-infinite .space2-grid-mode-thumb{left:42px;}
.space2-grid-mode-toggle:not(.is-infinite) .space2-grid-mode-icon-masonry{color:var(--text);opacity:1;}
.space2-grid-mode-toggle.is-infinite .space2-grid-mode-icon-infinite{color:var(--text);opacity:1;}
.space2-sidebar .space2-grid-mode-switch{align-self:flex-start;}

.space2-card-action-dot{display:grid;grid-template-columns:repeat(3,3px);grid-template-rows:repeat(3,3px);gap:2px;}
.space2-card-action-dot b{display:block;width:3px;height:3px;border-radius:999px;background:currentColor;opacity:.95;}

.space2-mode-dock{position:relative;background:var(--toolbar-surface);border:1px solid var(--toolbar-border);border-bottom:none;border-radius:14px 14px 0 0;padding:5px 6px 6px 6px;display:flex!important;align-items:center;z-index:20;margin-bottom:-4px;pointer-events:auto;}
.space2-mode-dock.hidden{display:none;}
.space2-mode-btn{position:relative;display:flex;align-items:center;justify-content:center;gap:6px;padding:7px 14px;border-radius:10px;border:none;background:transparent;color:#7a7c85;font-size:13px;font-family:inherit;cursor:pointer;transition:color .2s,background .2s;border:1px solid transparent;white-space:nowrap;z-index:1;min-width:118px;}
[data-theme="dark"] .space2-mode-btn{color:#a9adb8;}
.space2-mode-btn svg{width:14px;height:14px;fill:currentColor;flex-shrink:0;}
.space2-mode-btn:hover{background:var(--surface-2);color:var(--text);}
.space2-mode-btn-camera{color:var(--app-red);border-color:color-mix(in srgb,var(--app-red) 45%,transparent);background:color-mix(in srgb,var(--app-red) 10%,transparent);}
.space2-mode-btn-camera:hover{color:var(--app-red);border-color:color-mix(in srgb,var(--app-red) 62%,transparent);background:color-mix(in srgb,var(--app-red) 16%,transparent);}
.space2-btn{height:34px;padding:0 12px;border-radius:9px;border:1px solid var(--border);background:var(--surface);color:var(--text);font-size:12px;font-family:inherit;cursor:pointer;}
.space2-btn svg{width:13px;height:13px;fill:currentColor;}
.space2-btn.primary{background:color-mix(in srgb,var(--surface) 82%,transparent);border-color:color-mix(in srgb,var(--accent) 34%,var(--border));color:var(--text);backdrop-filter:blur(10px);}
.space2-body{flex:1;min-height:0;height:100%;display:flex;position:relative;overflow:hidden;padding-top:12px;box-sizing:border-box;}
.space2-sidebar{width:var(--space2-sidebar-width);min-width:0;border:1px solid color-mix(in srgb,var(--border) 82%,transparent);border-radius:14px;background:color-mix(in srgb,var(--surface) 70%,transparent);backdrop-filter:blur(12px);display:flex;flex-direction:column;padding:12px 10px;gap:10px;overflow:hidden;transition:width .18s cubic-bezier(.4,0,.2,1),padding .18s cubic-bezier(.4,0,.2,1),opacity .14s ease;position:absolute;left:8px;top:18px;bottom:8px;height:auto;z-index:20;margin:0;box-shadow:0 8px 28px rgba(0,0,0,.24);}
.space2-panel.sidebar-collapsed .space2-sidebar{width:0;padding-left:0;padding-right:0;opacity:0;pointer-events:none;border-color:transparent;margin-left:0;}
.space2-side-view-toggle{display:flex;gap:6px;flex-wrap:wrap;padding:2px 2px 6px;}
.space2-sash{width:20px;cursor:col-resize;position:absolute;left:calc(2px + var(--space2-sidebar-width));top:18px;bottom:8px;z-index:21;flex-shrink:0;transition:left .18s cubic-bezier(.4,0,.2,1);}
.space2-sash::before{content:'';position:absolute;left:6px;top:42%;width:5px;height:64px;transform:translateY(-50%);border-radius:999px;background:var(--app-red);border:1px solid color-mix(in srgb,var(--app-red) 80%,#fff 20%);box-shadow:0 2px 10px rgba(239,64,39,.25);transition:background .14s ease,border-color .14s ease,opacity .14s ease;opacity:.88;}
.space2-sash:hover::before,.space2-panel.space2-resizing .space2-sash::before{background:color-mix(in srgb,var(--app-red) 92%,#fff 8%);border-color:var(--app-red);opacity:1;}
.space2-panel:not(.sidebar-collapsed) .space2-sash{width:30px;}
.space2-panel:not(.sidebar-collapsed) .space2-sash::before{left:2px;width:9px;height:86px;}
.space2-panel.sidebar-collapsed .space2-sash{position:absolute;left:-1px;top:0;bottom:0;width:22px;}
.space2-sidebar-actions{display:flex;flex-direction:column;gap:8px;}
.space2-side-title{font-size:11px;letter-spacing:.08em;text-transform:uppercase;color:var(--text-dim);padding:0 4px;}
.space2-collections{display:flex;flex-direction:column;gap:4px;}
.space2-col-row{display:flex;align-items:center;gap:4px;}
.space2-col-row .space2-col-item{flex:1;}
.space2-col-row.active .space2-col-item{background:var(--surface);color:var(--text);border-color:var(--border);}
.space2-col-action{width:28px;height:28px;border-radius:7px;border:1px solid transparent;background:transparent;color:var(--text-dim);display:flex;align-items:center;justify-content:center;cursor:pointer;}
.space2-col-action svg{width:14px;height:14px;fill:currentColor;}
.space2-col-action:hover{background:var(--surface);border-color:var(--border);color:var(--text);}
.space2-discover-controls{display:none;flex-direction:column;gap:8px;border-top:1px solid var(--border);padding-top:10px;}
.space2-panel.discover-view .space2-discover-controls{display:flex;}
.space2-panel.discover-view .space2-sidebar-actions,.space2-panel.discover-view .space2-side-title,.space2-panel.discover-view .space2-collections{display:none;}
.space2-sidebar-footer{margin-top:auto;padding-top:8px;display:flex;align-items:center;justify-content:flex-start;gap:8px;}
.space2-sidebar-settings{width:30px;height:30px;min-width:30px;padding:0;border-radius:8px;border:1px solid var(--border);background:var(--surface-2);color:var(--text-mid);display:flex;align-items:center;justify-content:center;cursor:pointer;box-shadow:none;backdrop-filter:none;outline:none;transition:background .14s ease,border-color .14s ease,color .14s ease;}
.space2-sidebar-settings svg{width:14px;height:14px;fill:currentColor;opacity:.92;}
.space2-sidebar-settings:hover{background:var(--surface);border-color:var(--border);color:var(--text);}
.space2-sidebar-settings:focus-visible{box-shadow:0 0 0 2px color-mix(in srgb,var(--border) 75%,transparent);}
.space2-sidebar-sync{height:30px;padding:0 10px;border-radius:8px;font-size:11px;line-height:1;box-shadow:none;backdrop-filter:none;}
.space2-panel.sidebar-collapsed .space2-sidebar-footer{display:none;}
.space2-col-item{height:34px;border-radius:8px;border:1px solid transparent;background:transparent;color:var(--text-mid);font-size:13px;font-family:inherit;padding:0 10px;text-align:left;cursor:pointer;display:flex;align-items:center;justify-content:space-between;gap:8px;}
.space2-col-item:hover{background:var(--surface);color:var(--text);}
.space2-col-item.active{background:var(--surface);color:var(--text);border-color:var(--border);}
.space2-grid{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;padding:18px 20px 20px;background:transparent;position:relative;border-radius:0;--space2-grid-gap:16px;--space2-grid-content-height:0px;}
.space2-grid::after{content:'';display:block;height:var(--space2-grid-content-height);}
.space2-grid.feed-mode{--space2-grid-gap:14px;}
.space2-grid.infinite-mode{overflow:hidden;touch-action:none;cursor:grab;}
.space2-grid.infinite-mode::after{display:none;}
.space2-grid.infinite-mode.space2-grid-dragging{cursor:grabbing;}
.space2-grid.infinite-mode .space2-item:hover{transform:none;}
.space2-grid.is-drag-over{background:color-mix(in srgb,var(--surface) 90%,transparent);outline:2px dashed color-mix(in srgb,var(--accent) 62%,var(--border));outline-offset:-8px;}
.space2-grid-add{position:absolute;top:10px;right:10px;z-index:8;height:34px;min-width:34px;padding:0 11px;border-radius:var(--r-sm);border:1px solid color-mix(in srgb,var(--accent) 26%,var(--border));background:color-mix(in srgb,var(--surface) 76%,transparent);backdrop-filter:blur(12px);color:var(--text);font-size:17px;line-height:1;display:flex;align-items:center;justify-content:center;cursor:pointer;box-shadow:var(--shadow);transition:transform .14s,box-shadow .14s,border-color .14s,opacity .14s ease;opacity:1;}
.space2-item .space2-grid-add{opacity:0;pointer-events:none;}
.space2-item:hover .space2-grid-add{opacity:1;pointer-events:auto;}
.space2-grid-add:hover{transform:translateY(-1px);box-shadow:var(--shadow-lg);border-color:color-mix(in srgb,var(--accent) 44%,var(--border));}
.space2-item{display:block;width:100%;margin:0;border-radius:12px;overflow:hidden;cursor:pointer;transition:transform .14s ease,box-shadow .14s ease,opacity .24s ease;position:absolute;background:transparent;border:none;text-align:left;padding:0;min-width:0;left:0;top:0;}
.space2-item:hover{transform:translateY(-3px);box-shadow:0 10px 30px rgba(0,0,0,.18);}
.space2-item.img-pending{opacity:1;}
.space2-item.img-loaded{filter:blur(0);opacity:1;}
.space2-card-actions{position:absolute;top:10px;right:10px;display:flex;gap:6px;opacity:0;transition:opacity .15s;z-index:2;}
.space2-item:hover .space2-card-actions{opacity:1;}
.space2-card-action-left{position:absolute;top:10px;left:10px;opacity:0;transition:opacity .15s;z-index:2;}
.space2-item:hover .space2-card-action-left{opacity:1;}
.space2-card-action{width:30px;height:30px;border-radius:9px;border:1px solid color-mix(in srgb,var(--accent) 24%,var(--border));background:color-mix(in srgb,var(--surface) 76%,transparent);color:var(--text);display:flex;align-items:center;justify-content:center;cursor:pointer;backdrop-filter:blur(12px);box-shadow:var(--shadow);padding:0;}
.space2-card-action svg{width:14px;height:14px;fill:currentColor;}
.space2-card-action:hover{transform:translateY(-1px);box-shadow:var(--shadow-lg);border-color:color-mix(in srgb,var(--accent) 38%,var(--border));}
.space2-thumb-shell{position:relative;width:100%;min-height:160px;border-radius:12px;overflow:hidden;background:color-mix(in srgb,var(--surface-2) 92%,transparent);}
.space2-thumb-shell.shell-ratio{min-height:0;aspect-ratio:var(--shell-ar, auto);}
.space2-media-badge{position:absolute;bottom:8px;left:8px;z-index:3;width:28px;height:28px;border-radius:8px;background:rgba(0,0,0,.65);backdrop-filter:blur(6px);display:flex;align-items:center;justify-content:center;color:#fff;font-size:11px;font-weight:700;line-height:1;}
.space2-media-badge svg{width:14px;height:14px;stroke:currentColor;fill:none;stroke-width:2;}
.space2-badge-gif{font-size:10px;font-weight:800;letter-spacing:.5px;}
.space2-yt-thumb{width:100%;height:auto;display:block;opacity:1;transition:opacity .2s ease;position:relative;z-index:1;}
.space2-yt-play-btn{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);z-index:4;width:44px;height:44px;border-radius:12px;background:rgba(0,0,0,.7);backdrop-filter:blur(8px);border:1px solid rgba(255,255,255,.15);display:flex;align-items:center;justify-content:center;color:#fff;cursor:pointer;transition:transform .15s ease,background .15s ease;}
.space2-yt-play-btn:hover{transform:translate(-50%,-50%) scale(1.08);background:rgba(0,0,0,.85);}
.space2-yt-play-btn svg{width:20px;height:20px;stroke:currentColor;fill:currentColor;stroke-width:1.5;margin-left:2px;}
.space2-yt-pause-btn{position:absolute;top:8px;right:8px;z-index:5;width:30px;height:30px;border-radius:8px;background:rgba(0,0,0,.65);backdrop-filter:blur(6px);border:1px solid rgba(255,255,255,.12);display:flex;align-items:center;justify-content:center;color:#fff;cursor:pointer;opacity:0;transition:opacity .15s ease;}
.space2-yt-card:hover .space2-yt-pause-btn{opacity:1;}
.space2-yt-pause-btn svg{width:14px;height:14px;stroke:currentColor;fill:none;stroke-width:2;}
.space2-yt-player-wrap{position:absolute;inset:0;z-index:2;border-radius:12px;overflow:hidden;background:#000;}
.space2-yt-playing .space2-thumb-skeleton{opacity:0 !important;}
.space2-video-thumb{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;display:block;}
.space2-audio-shell{display:flex;align-items:center;justify-content:center;min-height:120px;background:linear-gradient(135deg,color-mix(in srgb,var(--surface-2) 95%,transparent),color-mix(in srgb,var(--accent) 8%,transparent));}
.space2-audio-icon{display:flex;align-items:center;justify-content:center;color:var(--accent);opacity:.5;}
.space2-audio-icon svg{width:40px;height:40px;stroke:currentColor;fill:none;stroke-width:1.5;}
.space2-audio-card{background:color-mix(in srgb,var(--surface-2) 50%,transparent);}
.space2-upload-card{width:min(380px,calc(100% - 32px));}
.space2-thumb{width:100%;height:auto;display:block;border-radius:12px;background:var(--surface-2);opacity:0;position:relative;z-index:1;}
.space2-item.img-loaded .space2-thumb{opacity:1;}
.space2-thumb-skeleton{position:absolute;inset:0;background:linear-gradient(110deg,transparent 30%,rgba(255,255,255,0.12) 48%,rgba(255,255,255,0.18) 50%,rgba(255,255,255,0.12) 52%,transparent 70%);background-size:220% 100%;animation:space2ThumbShimmer 1.35s linear infinite;transition:opacity .22s ease;z-index:3;pointer-events:none;}
.space2-item.img-loaded .space2-thumb-skeleton{opacity:0;pointer-events:none;}
.space2-item.has-px-canvas .space2-thumb-skeleton{opacity:0;}

/* Pixelation loading canvas */
.space2-px-canvas{position:absolute;inset:0;width:100%;height:100%;display:none;z-index:2;image-rendering:pixelated;image-rendering:-moz-crisp-edges;image-rendering:crisp-edges;}
.space2-px-canvas.px-active{display:block;opacity:1;}
.space2-ai-hub{position:absolute;left:50%;bottom:14px;transform:translateX(-50%);width:min(680px,calc(100% - 28px));z-index:330;display:flex;flex-direction:column;align-items:center;gap:8px;pointer-events:none;--space2-ai-sheet-max:min(92vh,1200px);--space2-ai-sheet-bottom:54px;}
.space2-ai-hub.hidden{display:none;}
.space2-ai-hub:not(.chat-open){gap:2px;}
.space2-ai-hub:not(.chat-open) #space2-mode-dock{margin-bottom:-3px;}
.space2-ai-hub:not(.chat-open) .space2-ai-bar-wrap{margin-top:-1px;}
.space2-ai-hub.chat-open #space2-mode-dock{display:none!important;pointer-events:none;opacity:0;}
.space2-ai-chat-sheet{position:absolute;left:0;right:0;bottom:var(--space2-ai-sheet-bottom);z-index:40;width:100%;max-height:var(--space2-ai-sheet-max);opacity:0;transform:translateY(10px) scaleY(.965);transform-origin:bottom center;will-change:transform,opacity;overflow:hidden;visibility:hidden;border-radius:var(--r-md);background:transparent;border:1px solid transparent;box-shadow:none;pointer-events:none;transition:transform .28s cubic-bezier(.2,.7,.2,1),opacity .22s ease,border-color .16s ease,box-shadow .16s ease,background .16s ease,visibility 0s linear .28s;}
.space2-ai-hub.chat-open .space2-ai-chat-sheet{opacity:1;transform:translateY(0) scaleY(1);visibility:visible;pointer-events:auto;background:var(--surface);border-color:var(--border);box-shadow:var(--shadow-lg);transition:transform .28s cubic-bezier(.2,.7,.2,1),opacity .22s ease,border-color .16s ease,box-shadow .16s ease,background .16s ease,visibility 0s;}
.space2-ai-chat-head{height:38px;padding:0 10px;border-bottom:1px solid color-mix(in srgb,var(--border) 88%,transparent);display:flex;align-items:center;justify-content:space-between;gap:10px;}
.space2-ai-chat-title{font-size:12px;font-weight:600;color:var(--text-mid);letter-spacing:.01em;}
.space2-ai-chat-control{width:28px;height:28px;border-radius:8px;border:1px solid var(--border);background:var(--surface-2);color:var(--text);font-size:16px;line-height:1;display:flex;align-items:center;justify-content:center;cursor:pointer;}
.space2-ai-chat-control:hover{border-color:color-mix(in srgb,var(--accent) 34%,var(--border));color:var(--accent);}
.space2-ai-chat-scroll{max-height:calc(var(--space2-ai-sheet-max) - 39px);min-height:94px;overflow:auto;padding:10px 10px 12px;display:flex;flex-direction:column;gap:8px;overscroll-behavior:contain;touch-action:pan-y;scrollbar-width:thin;scrollbar-color:rgba(163,176,201,.48) transparent;}
.space2-ai-chat-scroll::-webkit-scrollbar{width:9px;}
.space2-ai-chat-scroll::-webkit-scrollbar-track{background:transparent;}
.space2-ai-chat-scroll::-webkit-scrollbar-thumb{background:linear-gradient(180deg,rgba(190,200,219,.45),rgba(140,155,183,.45));border-radius:999px;border:2px solid transparent;background-clip:padding-box;}
.space2-ai-msg{max-width:min(94%,560px);padding:8px 10px;border-radius:12px;font-size:12px;line-height:1.45;white-space:pre-wrap;word-break:break-word;animation:space2AiMsgIn .22s ease;}
.space2-ai-msg.user{align-self:flex-end;background:color-mix(in srgb,var(--accent) 18%,var(--surface));border:1px solid color-mix(in srgb,var(--accent) 38%,var(--border));color:var(--text);}
.space2-ai-msg.assistant{align-self:flex-start;background:color-mix(in srgb,var(--surface-2) 92%,transparent);border:1px solid color-mix(in srgb,var(--border) 92%,transparent);color:var(--text);}
.space2-ai-msg.system{align-self:center;max-width:100%;background:transparent;border:none;color:var(--text-dim);font-size:11px;padding:0;}
.space2-ai-msg.is-streaming{opacity:.82;}
.space2-ai-msg.has-image::before{content:'Context image attached';display:block;font-size:10px;color:var(--text-dim);margin-bottom:4px;letter-spacing:.02em;text-transform:uppercase;}
@keyframes space2AiMsgIn{from{opacity:0;transform:translateY(6px);}to{opacity:1;transform:translateY(0);}}
.space2-ai-output{width:100%;border-radius:12px;padding:7px 10px;background:color-mix(in srgb,var(--surface) 92%,transparent);border:1px solid color-mix(in srgb,var(--border) 90%,transparent);box-shadow:var(--shadow);font-size:11px;line-height:1.35;color:var(--text-dim);white-space:pre-wrap;pointer-events:auto;}
.space2-ai-output.hidden{display:none;}
.space2-ai-capture-preview{width:min(360px,100%);display:flex;align-items:center;gap:8px;padding:6px 8px;border-radius:var(--r-md);background:var(--surface);border:1px solid var(--border);box-shadow:var(--shadow);pointer-events:auto;}
.space2-ai-capture-preview.hidden{display:none;}
.space2-ai-capture-preview img{width:68px;height:42px;border-radius:7px;object-fit:cover;border:1px solid var(--border);display:block;background:var(--surface-2);}
.space2-ai-capture-actions{display:flex;gap:8px;margin-left:auto;}
.space2-ai-cap-btn{width:28px;height:28px;border-radius:8px;border:1px solid var(--border);background:var(--surface-2);color:var(--text);font-size:14px;line-height:1;display:flex;align-items:center;justify-content:center;cursor:pointer;}
.space2-ai-cap-btn.ok{border-color:color-mix(in srgb,var(--accent) 45%,var(--border));color:var(--accent);}
.space2-ai-bar-wrap{width:100%;pointer-events:auto;}
.space2-ai-bar{width:100%;min-height:54px;border-radius:var(--r-md);padding:6px 8px;display:flex;align-items:center;gap:7px;background:var(--toolbar-surface);border:1px solid var(--toolbar-border);box-shadow:var(--shadow-lg);transition:border-color .2s ease,box-shadow .2s ease;}
.space2-ai-hub.chat-open .space2-ai-bar{box-shadow:0 12px 30px rgba(0,0,0,.2);}
.space2-ai-eye,.space2-ai-send,.space2-ai-history-toggle{width:34px;height:34px;border-radius:8px;border:1px solid var(--border);background:var(--surface-2);display:flex;align-items:center;justify-content:center;color:var(--text-mid);cursor:pointer;flex-shrink:0;}
.space2-ai-eye svg{width:16px;height:16px;fill:currentColor;}
.space2-ai-history-toggle svg{width:15px;height:15px;fill:currentColor;}
.space2-ai-eye.active{border-color:color-mix(in srgb,var(--accent) 48%,var(--border));color:var(--accent);background:color-mix(in srgb,var(--accent) 14%,var(--surface));}
.space2-ai-eye:hover,.space2-ai-send:hover,.space2-ai-history-toggle:hover{color:var(--text);border-color:color-mix(in srgb,var(--accent) 35%,var(--border));}
.space2-ai-history-toggle.active{color:var(--accent);border-color:color-mix(in srgb,var(--accent) 44%,var(--border));background:color-mix(in srgb,var(--accent) 14%,var(--surface));}
.space2-ai-send{background:#111;border-color:#111;color:#fff;}
[data-theme="dark"] .space2-ai-send{background:#fff;border-color:#fff;color:#111;}
[data-theme="light"] .space2-ai-send{background:#111;border-color:#111;color:#fff;}
.space2-ai-send svg{width:16px;height:16px;}
#space2-ai-input{flex:1;min-width:0;height:34px;border:none;outline:none;background:transparent;color:var(--text);font-size:var(--ai-input-font-size);line-height:34px;font-family:inherit;font-weight:300;resize:none;max-height:100px;min-height:34px;padding:0 4px;align-self:center;}
#space2-ai-input::placeholder{color:var(--text-dim);}
.space2-ai-model-wrap{position:relative;flex-shrink:0;}
.space2-ai-model-btn{height:34px;max-width:200px;padding:0 10px;border-radius:8px;border:1px solid var(--border);background:var(--surface-2);display:flex;align-items:center;gap:6px;color:var(--text);font-size:12px;font-family:inherit;cursor:pointer;}
.space2-ai-model-btn span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:180px;}
.space2-ai-model-btn svg{width:14px;height:14px;fill:currentColor;opacity:.72;}
.space2-ai-model-wrap .model-dropdown{left:auto;right:0;bottom:calc(100% + 10px);max-height:240px;overflow:auto;min-width:220px;}
.space2-ai-model-wrap{display:none !important;}
.space2-ai-attach-chip{height:30px;padding:0;display:flex;align-items:center;gap:6px;flex-shrink:0;}
.space2-ai-attach-chip.hidden{display:none;}
.space2-ai-attach-chip .prompt-thumb{width:30px;height:30px;border-radius:6px;object-fit:cover;border:1px solid var(--border);display:block;background:var(--surface-2);}
.space2-ai-attach-thumb-wrap{overflow:visible;}
.space2-ai-attach-chip .prompt-thumb-badge{top:-5px;right:-5px;bottom:auto;min-width:14px;height:14px;line-height:14px;padding:0 3px;font-size:10px;background:var(--surface);color:var(--text);border:1px solid var(--border);box-shadow:0 1px 3px rgba(0,0,0,0.2);}
.space2-ai-attach-chip .prompt-thumb-badge:hover{border-color:color-mix(in srgb,var(--accent) 35%,var(--border));color:var(--accent);}
.space2-capture-overlay{position:absolute;inset:0;z-index:340;background:rgba(0,0,0,.18);cursor:crosshair;pointer-events:auto;}
.space2-capture-overlay.hidden{display:none;}
.space2-capture-box{position:absolute;border:1.5px solid color-mix(in srgb,var(--accent) 78%,#fff 22%);background:rgba(255,255,255,.08);box-shadow:0 0 0 9999px rgba(0,0,0,.18);display:none;}
.space2-capture-handle{position:absolute;width:14px;height:14px;border-radius:999px;background:var(--surface);border:1px solid color-mix(in srgb,var(--accent) 60%,var(--border));box-shadow:0 1px 6px rgba(0,0,0,.28);}
.space2-capture-handle.nw{left:-8px;top:-8px;cursor:nwse-resize;}
.space2-capture-handle.ne{right:-8px;top:-8px;cursor:nesw-resize;}
.space2-capture-handle.sw{left:-8px;bottom:-8px;cursor:nesw-resize;}
.space2-capture-handle.se{right:-8px;bottom:-8px;cursor:nwse-resize;}
.space2-capture-actions{position:absolute;left:50%;bottom:calc(18px + env(safe-area-inset-bottom));transform:translateX(-50%);display:flex;gap:10px;z-index:345;pointer-events:auto;}
.space2-capture-actions.hidden{display:none;}
.space2-meta{display:flex;flex-direction:column;gap:3px;padding:8px 2px 0;}
.space2-name{font-size:13px;font-weight:900;color:var(--text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.space2-desc{font-size:11px;color:var(--text-dim);line-height:1.25;display:-webkit-box;line-clamp:2;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;min-height:2.5em;font-weight:300;}
.space2-gen-row{display:flex;align-items:center;gap:8px;min-height:1.3em;}
.space2-echo-ring{position:relative;width:13px;height:13px;display:inline-block;flex-shrink:0;}
.space2-echo-ring span{position:absolute;left:50%;top:50%;width:3px;height:3px;border-radius:999px;background:var(--app-red);transform:translate(-50%,-50%);opacity:.2;animation:space2EchoRing 1.1s ease-in-out infinite;}
.space2-echo-ring span:nth-child(1){transform:translate(-50%,-50%) translateY(-6px);animation-delay:0ms;}
.space2-echo-ring span:nth-child(2){transform:translate(-50%,-50%) translate(4.2px,-4.2px);animation-delay:90ms;}
.space2-echo-ring span:nth-child(3){transform:translate(-50%,-50%) translateX(6px);animation-delay:180ms;}
.space2-echo-ring span:nth-child(4){transform:translate(-50%,-50%) translate(4.2px,4.2px);animation-delay:270ms;}
.space2-echo-ring span:nth-child(5){transform:translate(-50%,-50%) translateY(6px);animation-delay:360ms;}
.space2-echo-ring span:nth-child(6){transform:translate(-50%,-50%) translate(-4.2px,4.2px);animation-delay:450ms;}
.space2-echo-ring span:nth-child(7){transform:translate(-50%,-50%) translateX(-6px);animation-delay:540ms;}
.space2-echo-ring span:nth-child(8){transform:translate(-50%,-50%) translate(-4.2px,-4.2px);animation-delay:630ms;}
.space2-name.is-generating,.space2-desc.is-generating{
    color:color-mix(in srgb,var(--text) 94%,#fff 6%);
    background-image:linear-gradient(110deg,color-mix(in srgb,var(--text-dim) 70%,transparent) 0%,color-mix(in srgb,var(--text) 98%,#fff 2%) 46%,color-mix(in srgb,var(--text-dim) 74%,transparent) 100%);
    background-size:220% 100%;
    -webkit-background-clip:text;
    background-clip:text;
    -webkit-text-fill-color:transparent;
    animation:space2TextSheen 1.9s linear infinite;
}
@keyframes space2ThumbShimmer{
    from{background-position:200% 0;}
    to{background-position:-20% 0;}
}
@keyframes space2EchoRing{
    0%,100%{opacity:.2;transform:scale(1) translateZ(0);}
    45%{opacity:1;transform:scale(1.35) translateZ(0);}
}
@keyframes space2TextSheen{
    from{background-position:220% 0;}
    to{background-position:-20% 0;}
}


.space2-item-card{width:calc(100vw - 28px);height:calc(100vh - 28px);max-width:none;max-height:none;background:color-mix(in srgb,var(--surface) 94%,transparent);border:1px solid var(--border);border-radius:16px;box-shadow:var(--shadow-lg);padding:12px;backdrop-filter:blur(8px);}
.space2-item-layout{height:100%;display:grid;grid-template-columns:minmax(0,1.6fr) minmax(320px,.8fr);gap:12px;}
.space2-item-preview{border:1px solid var(--border);border-radius:12px;background:color-mix(in srgb,var(--surface-2) 95%,transparent);min-height:0;height:100%;display:flex;align-items:center;justify-content:center;overflow:hidden;}
.space2-item-preview img{width:100%;height:100%;object-fit:contain;max-height:92vh;}
.space2-item-form{display:flex;flex-direction:column;}
.space2-item-desc{min-height:100px;resize:vertical;padding:10px;border-radius:10px;border:1px solid var(--border);background:var(--surface-2);color:var(--text);font-family:inherit;font-size:13px;outline:none;}
.space2-item-desc:focus{border-color:var(--accent);}
.space2-assign-title{font-size:12px;color:var(--text-mid);margin:10px 0 6px;}
.space2-assign-list{display:flex;flex-wrap:wrap;gap:7px;max-height:140px;overflow:auto;padding-right:2px;}
.space2-check{display:inline-flex;align-items:center;gap:7px;font-size:12px;color:var(--text);background:color-mix(in srgb,var(--surface-2) 88%,transparent);border:1px solid var(--border);border-radius:999px;padding:5px 10px;cursor:pointer;user-select:none;transition:border-color .14s ease,background .14s ease,color .14s ease;}
.space2-check-ind{width:14px;height:14px;border-radius:999px;border:1px solid color-mix(in srgb,var(--border) 82%,var(--text-dim));display:flex;align-items:center;justify-content:center;background:transparent;color:transparent;font-size:11px;line-height:1;transition:background .14s ease,border-color .14s ease,color .14s ease;}
.space2-check.active{border-color:color-mix(in srgb,var(--accent) 42%,var(--border));background:color-mix(in srgb,var(--accent) 14%,var(--surface));}
.space2-check.active .space2-check-ind{background:var(--accent);border-color:var(--accent);color:#fff;}
.space2-check:hover{border-color:color-mix(in srgb,var(--accent) 30%,var(--border));}

.space2-lightbox{position:fixed;inset:0;z-index:960;background:rgba(4,6,9,.78);backdrop-filter:blur(10px);display:flex;flex-direction:column;align-items:center;justify-content:center;padding:18px;opacity:0;pointer-events:none;transition:opacity .24s ease;}
.space2-lightbox.hidden{display:none;}
.space2-lightbox.is-open{opacity:1;pointer-events:auto;}
.space2-lightbox-stage{max-width:calc(100vw - 36px);max-height:calc(100vh - 160px);display:flex;align-items:center;justify-content:center;}
.space2-lightbox-stage img,.space2-lightbox-stage video{display:block;width:auto;height:auto;max-width:calc(100vw - 36px);max-height:calc(100vh - 160px);object-fit:contain;border:none;border-radius:14px;box-shadow:0 20px 70px rgba(0,0,0,.44);background:transparent;}
.space2-lightbox-stage iframe{display:block;width:min(1200px,calc(100vw - 36px));aspect-ratio:16/9;height:auto;border:none;border-radius:14px;box-shadow:0 20px 70px rgba(0,0,0,.44);background:transparent;}
.space2-lightbox-stage audio{width:min(560px,calc(100% - 32px));}
.space2-lightbox-close,.space2-lightbox-edit{position:absolute;top:20px;height:42px;border-radius:11px;border:1px solid color-mix(in srgb,var(--border) 86%,transparent);background:color-mix(in srgb,var(--surface) 78%,transparent);backdrop-filter:blur(10px);color:var(--text);display:inline-flex;align-items:center;justify-content:center;gap:8px;font-size:12px;cursor:pointer;}
.space2-lightbox-close{right:20px;width:42px;padding:0;}
.space2-lightbox-close svg,.space2-lightbox-edit svg{width:16px;height:16px;fill:currentColor;}
.space2-lightbox-edit{right:72px;padding:0 14px;}
.space2-lightbox-close:hover,.space2-lightbox-edit:hover{background:color-mix(in srgb,var(--surface) 92%,transparent);}
.space2-lightbox-nav{position:absolute;top:50%;transform:translateY(-50%);width:40px;height:40px;border-radius:50%;border:none;background:rgba(255,255,255,.08);backdrop-filter:blur(8px);color:#fff;display:flex;align-items:center;justify-content:center;cursor:pointer;opacity:0;transition:opacity .2s ease;z-index:2;}
.space2-lightbox-nav:hover{background:rgba(255,255,255,.15);}
.space2-lightbox:hover .space2-lightbox-nav{opacity:1;}
.space2-lightbox-nav-prev{left:12px;}
.space2-lightbox-nav-next{right:12px;}
.space2-lightbox-nav svg{width:20px;height:20px;stroke:currentColor;fill:none;stroke-width:2;}
.space2-lightbox-thumb-strip{position:absolute;bottom:16px;left:50%;transform:translateX(-50%);display:flex;gap:5px;align-items:center;max-width:calc(100vw - 80px);overflow-x:auto;padding:4px 10px;border-radius:12px;background:rgba(0,0,0,.45);backdrop-filter:blur(8px);-webkit-overflow-scrolling:touch;scrollbar-width:none;z-index:2;}
.space2-lightbox-thumb-strip::-webkit-scrollbar{display:none;}
.space2-lightbox-thumb-item{width:32px;height:32px;border-radius:6px;overflow:hidden;flex-shrink:0;cursor:pointer;opacity:.4;transition:all .25s ease;border:1.5px solid transparent;}
.space2-lightbox-thumb-item img,.space2-lightbox-thumb-item video{width:100%;height:100%;object-fit:cover;display:block;}
.space2-lightbox-thumb-item.active{opacity:1;width:42px;height:42px;border-radius:8px;border-color:rgba(255,255,255,.55);box-shadow:0 0 16px rgba(255,255,255,.18);}
.space2-lightbox-thumb-item:hover{opacity:.75;}

body.space-2 #viewport,
body.space-2 #toolbar-hub,
body.space-2 #context-toolbar,
body.space-2 #multi-toolbar,
body.space-2 #note-toolbar,
body.space-2 #favorites-panel{display:none!important;}
body.space-2 #board-dock{display:none!important;}
body.space-2 #space2-view-switch{display:flex!important;}
body.space-2 #space2-ai-hub{display:flex!important;}
body:not(.space-2) #space2-ai-hub{display:none!important;}
/* Dock: hidden by default everywhere, shown only in Space 2 on mobile/tablet */
#space2-mode-dock{display:none!important;}
body.space-2 #space2-mode-dock{display:flex!important;}

/* Workflow Dock + Canvas Nodes (mac app only) */
.workflow-dock{position:relative;z-index:320;display:flex;flex-direction:column;gap:8px;align-items:flex-start;}
.workflow-dock.hidden{display:none;}
.workflow-launch-card{width:38px;height:38px;min-height:38px;border-radius:11px;border:1px solid var(--border);background:var(--surface);color:var(--text-mid);box-shadow:var(--shadow);padding:0;cursor:pointer;display:flex;align-items:center;justify-content:center;flex-direction:row;gap:0;text-align:center;transition:transform .14s ease,color .14s ease,box-shadow .14s ease,border-color .14s ease;}
.workflow-launch-card:hover{transform:translateY(-1px);box-shadow:var(--shadow-lg);}
.workflow-launch-card svg{width:17px;height:17px;fill:currentColor;opacity:.95;}
.workflow-launch-title{display:block;font-size:12.5px;font-weight:600;line-height:1.1;}
.workflow-launch-sub{display:block;font-size:11px;color:var(--text-mid);line-height:1.2;}

.workflow-stack{position:absolute;left:0;top:calc(100% + 10px);width:136px;display:flex;flex-direction:column;gap:6px;transform-origin:top left;}
.workflow-stack.hidden{display:none;}
.workflow-card{width:128px;min-height:74px;border-radius:10px;border:1px solid var(--border);background:linear-gradient(160deg,var(--surface),var(--surface-2));padding:8px 9px;text-align:left;cursor:pointer;box-shadow:var(--shadow);position:relative;transition:transform .18s ease,box-shadow .18s ease;}
.workflow-card:hover{box-shadow:var(--shadow-lg);}
.workflow-card-thumb{transform:translateY(0) rotate(-4deg);}
.workflow-card-thumb:hover{transform:translateY(2px) rotate(-2deg);}
.workflow-card-title{font-size:12.5px;font-weight:600;color:var(--text);line-height:1.15;}
.workflow-card-sub{margin-top:4px;font-size:11px;color:var(--text-mid);}

.workflow-active-card{position:absolute;left:0;top:calc(100% + 96px);width:128px;min-height:72px;border-radius:10px;border:1px solid var(--border);background:color-mix(in srgb,var(--surface) 91%,transparent);backdrop-filter:blur(4px);box-shadow:var(--shadow);padding:9px 10px 8px;display:flex;flex-direction:column;gap:2px;transform:rotate(2deg);}
.workflow-active-card.hidden{display:none;}
.workflow-active-line{font-size:12px;font-weight:500;color:var(--text);line-height:1.1;}
.workflow-active-close{position:absolute;right:-8px;top:-8px;width:18px;height:18px;border:none;border-radius:999px;background:color-mix(in srgb,var(--surface) 88%,transparent);color:var(--text);font-size:13px;line-height:18px;text-align:center;cursor:pointer;box-shadow:0 2px 8px rgba(0,0,0,.28);padding:0;border:1px solid color-mix(in srgb,var(--accent) 26%,var(--border));}

.wf-lines-layer{position:absolute;left:-50000px;top:-50000px;width:100000px;height:100000px;overflow:visible;pointer-events:none;z-index:52;}
.wf-link{stroke:color-mix(in srgb,var(--accent) 78%,#fff 22%);stroke-width:2;fill:none;opacity:.9;}
.wf-link.inactive{stroke-dasharray:7 5;opacity:.42;}

.wf-node{position:absolute;width:220px;border-radius:10px;border:1px solid var(--border);background:var(--surface);box-shadow:var(--shadow);z-index:53;}
.wf-node.detached{opacity:.52;}
.wf-node.wf-drop-target{border-color:var(--wf-drop);box-shadow:0 0 0 2px color-mix(in srgb,var(--wf-drop) 28%,transparent),var(--shadow-lg);}
.canvas-node.wf-drag-source{z-index:70!important;}
.wf-node-header{height:32px;display:flex;align-items:center;justify-content:space-between;padding:0 10px;border-bottom:1px solid var(--border);cursor:grab;}
.wf-node-title{font-size:12px;font-weight:600;color:var(--text);}
.wf-node-detach{width:18px;height:18px;border-radius:999px;border:1px solid var(--border);background:var(--surface-2);color:var(--accent);font-size:14px;line-height:16px;display:flex;align-items:center;justify-content:center;cursor:pointer;padding:0;}
.wf-node-detach.active{background:rgba(239,64,39,.16);border-color:rgba(239,64,39,.45);}
.wf-node-body{padding:10px;display:flex;flex-direction:column;gap:8px;}
.wf-preview{width:100%;height:88px;border-radius:8px;border:1px dashed var(--border);background:var(--surface-2);display:flex;align-items:center;justify-content:center;overflow:hidden;font-size:11px;color:var(--text-mid);}
.wf-preview img{width:100%;height:100%;object-fit:cover;}
.wf-upload{height:30px;border-radius:7px;border:1px solid var(--border);background:var(--surface-2);color:var(--text-mid);font-size:12px;cursor:pointer;}
.wf-colors{display:flex;gap:6px;}
.wf-colors input{width:100%;height:30px;border:none;border-radius:7px;background:transparent;cursor:pointer;padding:0;}
.wf-input,.wf-textarea{width:100%;border-radius:7px;border:1px solid var(--border);background:var(--surface-2);color:var(--text);font-size:12px;padding:7px 8px;font-family:inherit;}
.wf-textarea{resize:vertical;min-height:66px;max-height:140px;}
.wf-textarea{overflow-y:auto;}
@supports(overflow: overlay) { .wf-textarea { overflow-y: overlay; } }
.wf-textarea::-webkit-scrollbar{width:7px;}
.wf-textarea::-webkit-scrollbar-track{background:transparent;}
.wf-textarea::-webkit-scrollbar-thumb{background:rgba(128,142,170,.42);border-radius:999px;border:2px solid transparent;background-clip:padding-box;}
[data-theme="dark"] .wf-textarea::-webkit-scrollbar-thumb{background:rgba(162,178,208,.35);}
.wf-action-btn{height:34px;border-radius:9px;border:1px solid color-mix(in srgb,var(--accent) 32%,var(--border));background:color-mix(in srgb,var(--surface) 82%,transparent);color:var(--text);font-size:12px;font-weight:600;cursor:pointer;backdrop-filter:blur(10px);}
.wf-prompt-ta{background:transparent;}
.wf-prompt-row{display:flex;align-items:center;justify-content:flex-start;}
.wf-prompt-magic{width:28px;height:28px;border-radius:7px;border:1px solid var(--border);background:var(--surface-2);color:#111;display:flex;align-items:center;justify-content:center;cursor:pointer;}
[data-theme="dark"] .wf-prompt-magic{color:#fff;}
.wf-prompt-magic:hover{border-color:var(--accent);color:var(--accent);}
.wf-prompt-magic svg{width:14px;height:14px;}

.wf-dd{position:relative;}
.wf-dd-btn{width:100%;display:flex;align-items:center;justify-content:space-between;gap:8px;padding:7px 9px;border-radius:7px;border:1px solid var(--border);background:var(--surface-2);color:var(--text);font-size:12px;cursor:pointer;font-family:inherit;}
.wf-dd-btn svg{width:13px;height:13px;fill:currentColor;opacity:.85;}
.wf-dd .model-dropdown{top:calc(100% + 6px);bottom:auto;left:0;min-width:100%;max-height:190px;overflow-y:auto;z-index:390;}

.wf-port{position:absolute;width:12px;height:12px;border-radius:50%;background:#fff;border:2px solid color-mix(in srgb,var(--accent) 78%,#fff 22%);z-index:54;cursor:pointer;}
.wf-port.in{left:-7px;top:50%;transform:translateY(-50%);}
.wf-port.out{right:-7px;top:50%;transform:translateY(-50%);}
.wf-port.active{box-shadow:0 0 0 4px rgba(239,64,39,0.2);}

/* Context Toolbar (images) */
.context-toolbar{position:absolute;z-index:200;background:var(--ctx-bg);border-radius:var(--r-sm);padding:4px;display:flex;gap:2px;box-shadow:var(--shadow-lg);transform:translateX(-50%) translateY(-100%) translateY(-10px);}
.context-toolbar.hidden{display:none;}
.ctx-btn{width:34px;height:34px;border-radius:7px;border:none;background:transparent;display:flex;align-items:center;justify-content:center;cursor:pointer;color:var(--ctx-text);transition:background .15s;}
.ctx-btn:hover{background:rgba(255,255,255,0.12);}
.ctx-btn svg{width:18px;height:18px;fill:currentColor;}
.ctx-sep{width:1px;background:rgba(255,255,255,0.15);margin:4px 2px;}
.ctx-btn.is-active{color:#ffd54a;background:rgba(255,213,74,0.16);}

/* Note Toolbar */
.note-toolbar{position:absolute;z-index:200;background:var(--ctx-bg);border-radius:var(--r-sm);padding:4px;display:flex;align-items:center;gap:2px;box-shadow:var(--shadow-lg);transform:translateX(-50%) translateY(-100%) translateY(-10px);white-space:nowrap;}
.note-toolbar.hidden{display:none;}
.nt-btn{width:30px;height:30px;border-radius:6px;border:none;background:transparent;display:flex;align-items:center;justify-content:center;cursor:pointer;color:var(--ctx-text);font-size:12px;font-family:inherit;font-weight:500;transition:background .15s;flex-shrink:0;}
.nt-btn:hover{background:rgba(255,255,255,0.1);}
.nt-btn svg{width:14px;height:14px;fill:currentColor;}
.nt-btn.active{background:rgba(255,255,255,0.18);}
.nt-btn.is-active{color:#ffd54a;background:rgba(255,213,74,0.18);}
.nt-sep{width:1px;background:rgba(255,255,255,0.15);margin:3px 2px;align-self:stretch;}
.nt-color-swatch{width:22px;height:22px;border-radius:4px;border:2px solid rgba(255,255,255,0.25);cursor:pointer;flex-shrink:0;margin:0 2px;}
.nt-font-select{background:rgba(255,255,255,0.08);border:1px solid rgba(255,255,255,0.15);color:var(--ctx-text);font-size:11px;border-radius:5px;padding:2px 5px;font-family:inherit;cursor:pointer;outline:none;max-width:90px;color-scheme:dark;}
.nt-font-select option{background:#1b1d22;color:#f0f0f0;}
.nt-size-input{width:58px;max-width:58px;text-align:center;cursor:text;padding-right:4px;}
.nt-size-input::-webkit-outer-spin-button,.nt-size-input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0;}
.color-picker-popup{position:absolute;bottom:calc(100% + 10px);left:50%;transform:translateX(-50%);background:var(--surface);border:1px solid var(--border);border-radius:var(--r-md);box-shadow:var(--shadow-lg);padding:8px 10px;display:flex;flex-wrap:nowrap;gap:6px;width:max-content;max-width:min(90vw,420px);overflow-x:auto;z-index:400;}
.color-picker-popup.hidden{display:none;}
.color-swatch{width:28px;height:28px;border-radius:6px;cursor:pointer;border:2px solid transparent;transition:transform .15s,border-color .15s;}
.color-swatch:hover{transform:scale(1.12);}
.color-swatch.selected{border-color:var(--accent);}

/* Selection box */
#selection-box{position:absolute;background:rgba(239,64,39,0.06);border:1.5px solid var(--accent);pointer-events:none;z-index:500;display:none;}
.multi-selection-box{position:absolute;border:1.5px solid var(--accent);box-shadow:0 0 0 0.5px rgba(239,64,39,0.2);pointer-events:none;z-index:48;display:none;}
#viewport.drag-over::after{content:'';position:absolute;inset:0;border:2px dashed var(--accent);pointer-events:none;}

/* ── Bottom Bar ── */
#toolbar-hub{position:absolute;bottom:20px;left:50%;transform:translateX(-50%);width:min(680px,calc(100% - 28px));display:flex;flex-direction:column;align-items:center;z-index:180;pointer-events:none;}
#bottom-bar{position:relative;width:100%;pointer-events:auto;background:var(--toolbar-surface);border:1px solid var(--toolbar-border);border-radius:var(--r-md);box-shadow:var(--shadow-lg);transition:background .25s,border-color .25s;z-index:30;}
.bar-prompt-area{padding:10px 12px 4px 12px;display:flex;align-items:flex-start;gap:8px;}
.thumb-list{display:flex;gap:4px;flex-shrink:0;align-self:center;}
.prompt-thumb{width:30px;height:30px;border-radius:6px;object-fit:cover;border:1px solid var(--border);}
.prompt-thumb-wrap{position:relative;width:30px;height:30px;flex-shrink:0;}
.prompt-thumb-badge{position:absolute;right:-5px;bottom:-5px;min-width:16px;height:16px;padding:0 4px;border-radius:999px;background:#000;color:#fff;font-size:10px;line-height:16px;text-align:center;font-weight:600;box-shadow:0 1px 4px rgba(0,0,0,0.35);}
#ai-prompt-input{flex:1;border:none;outline:none;background:transparent;font-size:var(--ai-input-font-size);color:var(--text);line-height:1.5;resize:none;font-family:inherit;font-weight:300;padding:2px 0;user-select:text;min-height:22px;max-height:80px;overflow-y:auto;}
@supports(overflow: overlay) { #ai-prompt-input { overflow-y: overlay; } }
#ai-prompt-input::placeholder{color:var(--text-dim);}
#ai-prompt-input::-webkit-scrollbar{width:8px;}
#ai-prompt-input::-webkit-scrollbar-track{background:transparent;}
#ai-prompt-input::-webkit-scrollbar-thumb{background:rgba(128,142,170,.42);border-radius:999px;border:2px solid transparent;background-clip:padding-box;}
[data-theme="dark"] #ai-prompt-input::-webkit-scrollbar-thumb{background:rgba(162,178,208,.35);}
.bar-menu-btn{color:var(--text-mid);background:transparent;border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;width:28px;height:28px;border-radius:6px;flex-shrink:0;}
.bar-menu-btn:hover{background:var(--surface-2);}
.bar-menu-btn svg{width:16px;height:16px;fill:currentColor;}
.prompt-magic-btn{width:30px;height:30px;border-radius:8px;border:1px solid var(--border);background:var(--surface-2);color:#111;display:flex;align-items:center;justify-content:center;cursor:pointer;flex-shrink:0;margin-top:1px;}
[data-theme="dark"] .prompt-magic-btn{color:#fff;}
.prompt-magic-btn svg{width:14px;height:14px;}
.prompt-magic-btn:hover{border-color:var(--accent);color:var(--accent);}
.bar-controls{padding:4px 10px 10px;display:flex;align-items:center;gap:7px;flex-wrap:nowrap;}
.bar-ctrl-btn{display:flex;align-items:center;gap:5px;padding:5px 10px;background:var(--surface-2);border:1px solid var(--border);border-radius:var(--r-sm);font-size:12px;color:var(--text-mid);cursor:pointer;font-family:var(--app-font)!important;font-weight:300;white-space:nowrap;transition:border-color .15s,color .15s;}
.bar-ctrl-btn:hover{border-color:var(--accent);color:var(--text);}
.bar-ctrl-btn svg{width:13px;height:13px;fill:currentColor;}
.mode-switcher,.bar-ctrl-btn,#bar-note-btn,#bar-upload-btn{background:var(--surface-2);}
[data-theme="dark"] .bar-ctrl-btn,[data-theme="dark"] #bar-note-btn,[data-theme="dark"] #bar-upload-btn{background:var(--surface);border-color:#40444d;color:#b5b8c2;}
.bar-spacer{flex:1;min-width:0;}
#bar-note-btn,#bar-upload-btn{display:flex;align-items:center;gap:5px;padding:5px 10px;background:var(--surface-2);border:1px solid var(--border);border-radius:var(--r-sm);font-size:12px;color:var(--text-mid);cursor:pointer;font-family:inherit;white-space:nowrap;transition:border-color .15s,color .15s;}
#bar-note-btn:hover,#bar-upload-btn:hover{border-color:var(--accent);color:var(--text);}
#bar-note-btn svg,#bar-upload-btn svg{width:13px;height:13px;fill:currentColor;}
#bar-sketch-btn.active{border-color:color-mix(in srgb,var(--accent) 52%,var(--border));color:var(--accent);background:color-mix(in srgb,var(--accent) 14%,var(--surface));}
.sketch-menu{position:absolute;right:0;top:calc(100% + 8px);display:flex;flex-direction:column;align-items:center;gap:6px;padding:8px;background:var(--surface);border:1px solid var(--border);border-radius:12px;box-shadow:var(--shadow-lg);z-index:420;min-width:44px;}
.sketch-menu.hidden{display:none;}
.sketch-tool-btn,.sketch-size-btn{width:30px;height:30px;border-radius:8px;border:1px solid var(--border);background:var(--surface-2);color:var(--text-mid);display:flex;align-items:center;justify-content:center;cursor:pointer;padding:0;}
.sketch-tool-btn svg{width:14px;height:14px;fill:currentColor;}
.sketch-tool-btn.active,.sketch-size-btn.active{border-color:color-mix(in srgb,var(--accent) 52%,var(--border));color:var(--accent);background:color-mix(in srgb,var(--accent) 14%,var(--surface));}
.sketch-size-stack{display:flex;flex-direction:column;gap:6px;align-items:center;}
.sketch-size-dot{display:block;border-radius:999px;background:currentColor;opacity:.95;}
.sketch-size-dot.size-sm{width:4px;height:4px;}
.sketch-size-dot.size-md{width:7px;height:7px;}
.sketch-size-dot.size-lg{width:10px;height:10px;}
#bar-gen-btn{background:var(--text);color:var(--surface);border:none;border-radius:var(--r-sm);padding:6px 16px;font-size:13px;font-weight:500;cursor:pointer;font-family:inherit;transition:opacity .15s;white-space:nowrap;flex-shrink:0;}
#bar-gen-btn:hover{opacity:.82;}

/* Hamburger dropdown */
.bar-extra-menu{position:absolute;bottom:calc(100% + 8px);right:8px;background:var(--surface);border:1px solid var(--border);border-radius:var(--r-md);box-shadow:var(--shadow-lg);padding:6px 0;z-index:400;min-width:190px;}
.bar-extra-menu.hidden{display:none;}
.extra-menu-item{display:flex;align-items:center;gap:10px;padding:9px 14px;font-size:13px;color:var(--text);background:transparent;border:none;cursor:pointer;text-align:left;width:100%;font-family:var(--app-font)!important;font-weight:300;transition:background .15s;position:relative;}
.extra-menu-item:hover{background:var(--surface-2);}
.extra-menu-item svg{width:16px;height:16px;fill:currentColor;flex-shrink:0;}
.extra-menu-item.mode-item.active{color:var(--accent);}
.extra-menu-item.mode-item.active svg{fill:var(--accent);}
.mode-check{margin-left:auto;font-size:13px;color:var(--accent);}
.extra-sep{height:1px;background:var(--border);margin:4px 0;}

/* Dropdowns */
.model-dropdown,.size-dropdown{position:absolute;bottom:calc(100% + 8px);left:0;background:var(--surface);border:1px solid var(--border);border-radius:var(--r-md);box-shadow:var(--shadow-lg);padding:6px 0;z-index:400;min-width:180px;}
[data-theme="dark"] .model-dropdown,[data-theme="dark"] .size-dropdown{background:var(--surface);border-color:#40444d;}
.model-dropdown{max-height:240px;overflow-y:auto;}
.model-dropdown.hidden,.size-dropdown.hidden{display:none;}
.model-opt,.size-opt{display:flex;align-items:center;gap:8px;padding:9px 16px;font-size:13px;color:var(--text);background:transparent;border:none;cursor:pointer;text-align:left;width:100%;font-family:inherit;}
.model-opt:hover,.size-opt:hover{background:var(--surface-2);}
.model-opt.active,.size-opt.active{color:var(--accent);}
.model-group-label{padding:7px 14px 4px;font-size:11px;text-transform:uppercase;letter-spacing:.06em;color:var(--text-dim);}
.model-divider{height:1px;background:var(--border);margin:6px 10px;}

/* ── Canvas Nodes ── */
.canvas-node{position:absolute;transform-origin:center center;touch-action:none;}
.canvas-node.selected{z-index:50;}
.node-inner{position:relative;display:inline-block;line-height:0;touch-action:none;}
.canvas-node.sketch-card .node-inner{border-radius:10px;background:transparent;}
.sketch-canvas{display:block;border-radius:10px;touch-action:none;cursor:crosshair;background:transparent;}
body.sketch-mode .sketch-canvas{cursor:crosshair;}
.canvas-node.selected .node-inner::before{content:'';position:absolute;inset:-1px;border:1.5px solid var(--accent);pointer-events:none;z-index:5;box-shadow:0 0 0 0.5px rgba(239,64,39,0.2);}
.multi-select .canvas-node.selected .node-inner::before{display:none;}
.canvas-node img,.canvas-node video{display:block;pointer-events:none;}

/* Scale handles */
.scale-handle{position:absolute;width:10px;height:10px;background:var(--app-red);border:1.5px solid rgba(255,255,255,.95);border-radius:3px;z-index:20;display:none;transform-origin:center center;box-shadow:0 0 0 1px rgba(0,0,0,0.18),0 1px 4px rgba(239,64,39,.25);touch-action:none;}
.canvas-node.selected .scale-handle{display:block;}
.multi-select .canvas-node.selected .scale-handle{display:none;}
.scale-handle.tl{top:-8px;left:-8px;}
.scale-handle.tr{top:-8px;right:-8px;}
.scale-handle.bl{bottom:-8px;left:-8px;}
.scale-handle.br{bottom:-8px;right:-8px;}

/* Rotation zones (invisible, cursor-only) */
.rot-zone{position:absolute;width:28px;height:28px;z-index:25;display:none;pointer-events:none;}
.canvas-node.selected .rot-zone{display:block;pointer-events:auto;}
.rot-zone.tl{top:-14px;left:-14px;}
.rot-zone.tr{top:-14px;right:-14px;}
.rot-zone.bl{bottom:-14px;left:-14px;}
.rot-zone.br{bottom:-14px;right:-14px;}

/* Dedicated rotate handle */
.rotate-handle{position:absolute;bottom:-34px;left:50%;margin-left:-6px;width:12px;height:12px;z-index:26;display:none;cursor:grab;transform-origin:center center;border-radius:50%;background:var(--app-red);border:1.5px solid rgba(255,255,255,.95);box-shadow:0 0 0 1px rgba(0,0,0,.18),0 1px 4px rgba(239,64,39,.28);touch-action:none;}
.canvas-node.selected .rotate-handle{display:block;}
.multi-select .canvas-node.selected .rotate-handle{display:none;}
.rotate-handle:active{cursor:grabbing;}

.node-inner.alpha-preview{
    background-image:linear-gradient(45deg,rgba(0,0,0,0.06) 25%,transparent 25%,transparent 75%,rgba(0,0,0,0.06) 75%,rgba(0,0,0,0.06)),linear-gradient(45deg,rgba(0,0,0,0.06) 25%,transparent 25%,transparent 75%,rgba(0,0,0,0.06) 75%,rgba(0,0,0,0.06));
    background-position:0 0,8px 8px;
    background-size:16px 16px;
}

.media-player{position:relative;display:inline-block;line-height:0;border-radius:12px;overflow:hidden;background:#0f0f11;}
.media-player .media-el{display:block;max-width:100%;}
.media-controls{position:absolute;left:12px;right:12px;bottom:10px;height:46px;border-radius:10px;background:rgba(12,12,14,0.72);backdrop-filter:blur(3px);display:flex;align-items:center;gap:10px;padding:0 10px;color:#ececf1;z-index:8;pointer-events:none;opacity:0;transition:opacity .16s;}
.canvas-node.selected .media-controls,.media-player:hover .media-controls{pointer-events:auto;opacity:1;}
.media-play{width:30px;height:30px;border-radius:8px;border:none;background:rgba(255,255,255,0.08);color:#fff;display:flex;align-items:center;justify-content:center;cursor:pointer;}
.media-play svg{width:16px;height:16px;fill:currentColor;}
.media-seek{flex:1;appearance:none;height:4px;border-radius:4px;background:rgba(255,255,255,0.2);outline:none;cursor:pointer;}
.media-seek::-webkit-slider-thumb{appearance:none;width:12px;height:12px;border-radius:50%;background:#fff;border:none;}
.media-time{font-size:12px;color:#d4d5db;min-width:84px;text-align:right;}

.favorites-panel{position:absolute;top:10px;left:50%;transform:translateX(-50%);width:min(780px,calc(100% - 40px));background:var(--surface);border:1px solid var(--border);border-radius:14px;box-shadow:var(--shadow-lg);padding:8px 10px 10px;z-index:220;}
.favorites-panel.hidden{display:none;}
.favorites-title{font-size:11px;color:var(--text-dim);letter-spacing:.08em;text-transform:uppercase;padding:2px 2px 7px;}
.favorites-strip{display:flex;gap:8px;overflow-x:auto;padding-bottom:2px;}
.favorites-thumb{width:68px;height:52px;border-radius:8px;border:1px solid var(--border);object-fit:cover;background:var(--surface-2);cursor:pointer;flex-shrink:0;}

.control-corner{position:absolute;left:14px;top:14px;z-index:220;display:flex;align-items:flex-start;gap:8px;}
.space2-discover-corner{height:38px;padding:0 12px;border:1px solid var(--border);border-radius:11px;background:color-mix(in srgb,var(--surface) 92%,transparent);color:var(--text);display:flex;align-items:center;gap:8px;cursor:pointer;box-shadow:var(--shadow);font:600 12px/1 inherit;backdrop-filter:blur(10px);transition:transform .14s ease,color .14s ease,box-shadow .14s ease,border-color .14s ease;}
.space2-discover-corner.hidden{display:none;}
.space2-discover-corner:hover{transform:translateY(-1px);box-shadow:var(--shadow-lg);border-color:color-mix(in srgb,var(--accent) 30%,var(--border));}
.space2-discover-corner svg{width:16px;height:16px;fill:currentColor;opacity:.92;}
.board-dock{position:relative;}
.board-dock.hidden{display:none;}
.board-menu-trigger{width:38px;height:38px;border:1px solid var(--border);border-radius:11px;background:var(--surface);color:var(--text-mid);display:flex;align-items:center;justify-content:center;cursor:pointer;box-shadow:var(--shadow);padding:0;transition:transform .14s ease,color .14s ease,box-shadow .14s ease;}
.board-menu-trigger:hover{color:var(--text);transform:translateY(-1px);box-shadow:var(--shadow-lg);}
.board-menu-trigger:active{transform:translateY(0);}
.board-menu-trigger svg{width:17px;height:17px;fill:currentColor;}
.board-quick-menu{position:absolute;left:0;top:calc(100% + 10px);display:flex;flex-direction:column;gap:8px;z-index:222;padding:9px;border-radius:12px;border:1px solid var(--border);background:color-mix(in srgb,var(--surface) 95%,transparent);backdrop-filter:blur(6px);box-shadow:var(--shadow-lg);min-width:170px;}
.board-quick-menu.hidden{display:none;}
.board-fan-grid{display:grid;grid-template-columns:repeat(3,42px);gap:8px;justify-content:start;}
.board-fan-btn{width:42px;height:42px;border-radius:10px;border:1px solid var(--border);background:linear-gradient(160deg,var(--surface),var(--surface-2));color:var(--text);font-size:13px;font-weight:600;font-family:inherit;cursor:pointer;box-shadow:var(--shadow);transform-origin:bottom center;transition:transform .16s ease,box-shadow .16s ease,border-color .16s ease;}
.board-fan-btn:hover{transform:translateY(-2px) scale(1.06);box-shadow:var(--shadow-lg);}
.board-fan-btn.active{border-color:var(--accent);color:var(--accent);}
.board-manage-btn{height:32px;border-radius:9px;border:1px solid var(--border);background:var(--surface);color:var(--text-mid);font-size:12px;font-family:inherit;cursor:pointer;}
.board-manage-btn:hover{color:var(--text);border-color:var(--accent);}
.board-panel{position:absolute;left:0;top:calc(100% + 54px);width:310px;max-height:420px;background:var(--surface);border:1px solid var(--border);border-radius:14px;box-shadow:var(--shadow-lg);padding:8px;display:flex;flex-direction:column;gap:8px;}
.board-panel.hidden{display:none;}
.board-panel-title{padding:2px 6px 4px;font-size:11px;letter-spacing:.08em;text-transform:uppercase;color:var(--text-dim);}
.board-list{overflow:auto;display:flex;flex-direction:column;gap:2px;max-height:314px;padding-right:2px;}
.board-item{display:flex;align-items:center;gap:8px;padding:8px;border-radius:9px;border:1px solid transparent;cursor:pointer;}
.board-item:hover{background:var(--surface-2);}
.board-item.active{background:var(--surface-2);border-color:var(--border);}
.board-item-name{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:13px;}
.board-item-count{font-size:12px;color:var(--text-mid);}
.board-actions{display:flex;gap:3px;opacity:.85;}
.board-action{width:22px;height:22px;border-radius:6px;border:none;background:transparent;color:var(--text-mid);display:flex;align-items:center;justify-content:center;cursor:pointer;}
.board-action:hover{background:var(--surface);color:var(--text);}
.board-action svg{width:13px;height:13px;fill:currentColor;}
.board-new-btn{height:34px;border:1px solid color-mix(in srgb,var(--accent) 32%,var(--border));border-radius:10px;background:color-mix(in srgb,var(--surface) 82%,transparent);color:var(--text);font-size:13px;cursor:pointer;backdrop-filter:blur(10px);}

.settings-help{font-size:12px;color:var(--text-mid);padding:8px 2px 0;min-height:18px;}
.settings-toggle-row{display:flex;align-items:flex-start;gap:10px;margin-top:8px;}
.settings-square-toggle{display:flex;align-items:flex-start;gap:10px;cursor:pointer;line-height:1.35;}
.settings-square-toggle input{position:absolute;opacity:0;pointer-events:none;}
.settings-square-box{width:16px;height:16px;border-radius:4px;border:1px solid var(--border);background:var(--surface-2);display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;margin-top:1px;}
.settings-square-box::after{content:'';width:10px;height:10px;background:var(--accent);opacity:0;transform:scale(.75);transition:opacity .14s ease,transform .14s ease;border-radius:2px;}
.settings-square-toggle input:checked + .settings-square-box{border-color:color-mix(in srgb,var(--accent) 45%,var(--border));}
.settings-square-toggle input:checked + .settings-square-box::after{opacity:1;transform:scale(1);}
.settings-square-text{font-size:12px;color:var(--text-mid);}
.move-board-list{display:flex;flex-direction:column;gap:4px;max-height:320px;overflow:auto;margin-top:6px;}
.move-board-item{height:44px;border-radius:10px;border:1px solid var(--border);background:var(--surface-2);display:flex;align-items:center;justify-content:space-between;padding:0 12px;color:var(--text);font-size:13px;cursor:pointer;}
.move-board-item:hover{border-color:var(--accent);}

/* Note Card */
.canvas-node.note-card .node-inner,.canvas-node.chat-card .node-inner{padding:20px;width:420px;height:220px;border-radius:10px;box-shadow:var(--shadow);line-height:1.2;cursor:default;overflow:visible;}
.canvas-node.note-card .node-inner{background:#fff9c4;}
.canvas-node.chat-card .node-inner{background:rgba(242,246,255,0.68);border:1px solid rgba(160,175,198,0.45);backdrop-filter:blur(6px);}
[data-theme="dark"] .canvas-node.chat-card .node-inner{background:rgba(34,40,52,0.72);border-color:rgba(98,112,140,0.48);}
.note-content{outline:none;font-size:30px;line-height:1.35;user-select:none;white-space:pre-wrap;min-width:0;min-height:100%;max-height:100%;overflow-y:auto;overflow-x:hidden;padding-right:8px;color:#3a3a3a;font-family:inherit;pointer-events:auto;overscroll-behavior:contain;overflow-wrap:anywhere;}
.note-content.editing{user-select:text;}
.note-content::-webkit-scrollbar{width:8px;}
.note-content::-webkit-scrollbar-track{background:transparent;}
.note-content::-webkit-scrollbar-thumb{background:rgba(128,142,170,.42);border-radius:999px;border:2px solid transparent;background-clip:padding-box;}
[data-theme="dark"] .note-content::-webkit-scrollbar-thumb{background:rgba(162,178,208,.35);}

/* AI Placeholder */
.ai-placeholder{overflow:hidden;position:relative;background:linear-gradient(130deg,rgba(236,239,248,0.9),rgba(245,246,252,0.9));border:1px solid rgba(170,182,208,0.35);box-shadow:inset 0 0 0 1px rgba(255,255,255,0.2);}
[data-theme="dark"] .ai-placeholder{background:linear-gradient(130deg,rgba(44,49,62,0.88),rgba(30,34,44,0.9));border-color:rgba(90,106,136,0.45);box-shadow:inset 0 0 0 1px rgba(190,210,248,0.07);}

/* Border trim sweep */
.ai-placeholder::before{
    content:'';
    position:absolute;
    inset:0;
    border-radius:inherit;
    padding:1px;
    background:linear-gradient(90deg,transparent 28%,rgba(89,125,224,0.86) 50%,transparent 72%) 0 0/240% 100% no-repeat;
    animation:traceSweep 2.1s linear infinite;
    z-index:2;
    pointer-events:none;
    mask:linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask:linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite:xor;
    mask-composite:exclude;
}
[data-theme="dark"] .ai-placeholder::before{
    background:linear-gradient(90deg,transparent 30%,rgba(178,205,255,0.78) 50%,transparent 70%) 0 0/240% 100% no-repeat;
}

/* Soft in-box haze for depth */
.ai-placeholder::after{
    content:'';
    position:absolute;
    inset:0;
    background:radial-gradient(ellipse at 50% 85%, rgba(132,156,214,0.2), transparent 62%);
    opacity:.78;
    pointer-events:none;
    z-index:1;
}
[data-theme="dark"] .ai-placeholder::after{
    background:radial-gradient(ellipse at 50% 85%, rgba(182,205,255,0.12), transparent 62%);
    opacity:.56;
}

/* Moving Spotlight */
.ai-placeholder .sheen{
    position:absolute;
    width:180%;
    height:86%;
    left:-40%;
    bottom:-68%;
    background:radial-gradient(ellipse at center, rgba(255,255,255,0.98) 0%, rgba(255,255,255,0.62) 24%, rgba(255,255,255,0.28) 42%, transparent 72%);
    animation:sheenRise 1.55s cubic-bezier(.35,0,.22,1) infinite;
    mix-blend-mode: overlay;
    z-index:2;
    pointer-events:none;
}
[data-theme="dark"] .ai-placeholder .sheen{
    background:radial-gradient(ellipse at center, rgba(220,236,255,0.58) 0%, rgba(206,226,255,0.3) 28%, rgba(196,218,255,0.14) 44%, transparent 70%);
}
.ai-placeholder .sheen.sheen-2{
    width:160%;
    height:70%;
    left:-28%;
    bottom:-74%;
    animation:sheenRise2 1.9s cubic-bezier(.35,0,.22,1) infinite;
    opacity:1;
}

@keyframes traceSweep {
    0% { background-position:180% 0; }
    100% { background-position:-160% 0; }
}
@keyframes sheenRise {
    0% { transform:translate3d(0,0,0) scale(1.02); opacity:0; }
    16% { opacity:.9; }
    72% { opacity:.42; }
    100% { transform:translate3d(0,-175%,0) scale(1.08); opacity:0; }
}
@keyframes sheenRise2 {
    0% { transform:translate3d(0,0,0) scale(1); opacity:0; }
    20% { opacity:.74; }
    74% { opacity:.34; }
    100% { transform:translate3d(0,-188%,0) scale(1.06); opacity:0; }
}

.gen-reveal{opacity:.52;filter:blur(17px) saturate(.92);transform:scale(1.01);animation:genReveal 1.02s cubic-bezier(.2,.7,.2,1) forwards;will-change:filter,opacity,transform;}
@keyframes genReveal{to{opacity:1;filter:blur(0) saturate(1);transform:scale(1);}}

/* ── Floating Mode Switcher ── */
#mode-switcher {
    position: relative;
    background: rgba(255,255,255,0.96);
    border: 1px solid #e6e6e8;
    border-bottom: none;
    border-radius: 14px 14px 0 0;
    padding: 5px 6px 6px 6px;
    display: flex;
    align-items: center;
    z-index: 20;
    margin-bottom: -1px;
    pointer-events: auto;
}
[data-theme="dark"] #mode-switcher {
    background: var(--surface);
    border-color: #40444d;
}
[data-theme="light"] #mode-switcher {
    background: rgba(255,255,255,0.96);
    border-color: #e6e6e8;
}
.mode-sw-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: #7a7c85;
    font-size: 13px;
    font-family: var(--app-font)!important;
    cursor: pointer;
    transition: color .2s;
    white-space: nowrap;
    z-index: 1;
    min-width: 92px;
    font-weight:300;
}
[data-theme="dark"] .mode-sw-btn {
    color: #a9adb8;
}
.mode-sw-btn svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
    flex-shrink: 0;
}
.mode-sw-btn .mode-icon-img {
    width: 14px;
    height: 14px;
    display: block;
    object-fit: contain;
    flex-shrink: 0;
}
.mode-sw-btn .mode-icon-svg {
    width: 15px;
    height: 15px;
    display: block;
    flex-shrink: 0;
    fill: currentColor;
}
[data-theme="dark"] .mode-sw-btn .mode-icon-img {
    filter: brightness(0) invert(1);
}
.settings-modal{position:absolute;inset:0;z-index:500;background:rgba(0,0,0,.2);display:flex;align-items:center;justify-content:center;backdrop-filter:blur(2px);}
.settings-modal.hidden{display:none;}
@media (max-width:760px){
    .space2-item-modal{inset:0;padding:14px 0 calc(12px + env(safe-area-inset-bottom));align-items:flex-start;}
}
.settings-card{width:min(420px,calc(100% - 32px));background:var(--surface);border:1px solid var(--border);border-radius:14px;box-shadow:var(--shadow-lg);padding:16px;}
@media (min-width:761px){
    body:not(.is-mobile-shell):not(.is-mac-app) #settings-modal .settings-card,
    body:not(.is-mobile-shell):not(.is-mac-app) #space2-settings-modal .settings-card{
        width:min(500px,calc(100% - 40px));
        padding:20px;
    }
    body:not(.is-mobile-shell):not(.is-mac-app) #settings-modal .settings-actions,
    body:not(.is-mobile-shell):not(.is-mac-app) #space2-settings-modal .settings-actions{
        gap:10px;
        margin-top:16px;
    }
}
.settings-title{font-size:15px;font-weight:600;color:var(--text);margin-bottom:10px;}
.settings-label{display:block;font-size:12px;color:var(--text-mid);margin-bottom:6px;}
.settings-input{width:100%;height:36px;border:1px solid var(--border);border-radius:10px;background:var(--surface-2);color:var(--text);padding:0 10px;font-family:var(--app-font)!important;font-size:13px;font-weight:300;outline:none;}
.settings-input:focus{border-color:var(--accent);}
.settings-inline-row{display:flex;gap:8px;align-items:center;}
.settings-inline-row .settings-input{flex:1;}
.settings-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:14px;}
.settings-btn{height:32px;padding:0 12px;border-radius:8px;border:1px solid var(--border);background:var(--surface-2);color:var(--text);font-size:12px;font-family:inherit;cursor:pointer;}
.settings-btn.primary{background:var(--text);color:var(--surface);border-color:transparent;}
.mode-sw-btn.active {
    color: #1f222a;
    font-weight: 900;
}
[data-theme="dark"] .mode-sw-btn.active {
    color: #f3f4f6;
}
#space2-columns-select{appearance:auto;color-scheme:light;}
[data-theme="dark"] #space2-columns-select{color-scheme:dark;}
[data-theme="light"] #space2-columns-select{color-scheme:light;}
/* Sliding pill underneath active button */
#mode-slider {
    position: absolute;
    top: 5px;
    height: calc(100% - 10px);
    border-radius: 9px;
    background: #ffffff;
    border: 1px solid #ececf0;
    box-shadow: 0 1px 4px rgba(15,17,24,0.06);
    transition: left .22s cubic-bezier(.4,0,.2,1), width .22s cubic-bezier(.4,0,.2,1);
    z-index: 0;
}
[data-theme="dark"] #mode-slider {
    overflow: hidden;
    background: #2b2e35;
    border-color: #40444d;
    box-shadow: none;
}

/* ── Media Browser ── */
#media-browser-modal {
    position: absolute;
    inset: 0;
    z-index: 600;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}
#media-browser-modal.hidden {
    display: none;
}
.mb-container {
    width: min(960px, calc(100% - 40px));
    height: min(680px, calc(100% - 40px));
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.mb-topbar {
    height: 52px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 16px;
    background: var(--surface-2);
}
.mb-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    min-width: 140px;
}
.mb-search-wrap {
    display: flex;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0 10px;
    height: 32px;
    width: 240px;
    gap: 8px;
}
.mb-search-wrap svg {
    width: 14px;
    height: 14px;
    fill: var(--text-dim);
}
#mb-search {
    border: none;
    background: transparent;
    outline: none;
    color: var(--text);
    font-size: 13px;
    width: 100%;
}
.mb-top-rhs {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}
.mb-icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-mid);
    cursor: pointer;
}
.mb-icon-btn:hover { background: var(--surface); color: var(--text); border-color: var(--border); }
.mb-icon-btn.active { background: var(--surface); color: var(--accent); border-color: var(--border); }
.mb-icon-btn svg { width: 16px; height: 16px; fill: currentColor; }
.mb-sep { width: 1px; height: 18px; background: var(--border); margin: 0 4px; }
.mb-pill-dropdown {
    height: 32px;
    padding: 0 12px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 12px;
    cursor: pointer;
}
.mb-size-slider {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-mid);
    margin-left: 8px;
}
.mb-size-slider input[type="range"] {
    width: 80px;
    accent-color: var(--accent);
}
.mb-body {
    flex: 1;
    display: flex;
    min-height: 0;
}
.mb-sidebar {
    width: 180px;
    border-right: 1px solid var(--border);
    background: var(--surface-2);
    display: flex;
    flex-direction: column;
    padding: 12px 8px;
    overflow-y: auto;
}
.mb-sec {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-dim);
    padding: 0 8px 6px;
}
.mb-nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 32px;
    padding: 0 8px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-mid);
    font-size: 13px;
    cursor: pointer;
    text-align: left;
    width: 100%;
}
.mb-nav-item:hover { background: var(--surface); color: var(--text); }
.mb-nav-item.active { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
[data-theme="light"] .mb-nav-item.active { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.mb-nav-item svg { width: 14px; height: 14px; fill: currentColor; }
.mb-nav-item .badge { margin-left: auto; font-size: 11px; background: var(--border); padding: 2px 6px; border-radius: 10px; color: var(--text); }
.mb-main {
    flex: 1;
    background: var(--bg);
    overflow-y: auto;
    padding: 16px;
}
.mb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}
.mb-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    transition: transform .15s, box-shadow .15s;
    user-select: none;
}
.mb-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}
.mb-item.selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(239,64,39,0.2);
}
.mb-thumb-wrap {
    width: 100%;
    aspect-ratio: 1;
    background: var(--surface-2);
    position: relative;
}
.mb-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.mb-check {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.6);
    background: rgba(0,0,0,0.3);
    pointer-events: none;
    opacity: 0;
    transition: opacity .15s;
}
.mb-item:hover .mb-check, .mb-item.selected .mb-check { opacity: 1; }
.mb-item.selected .mb-check {
    background: var(--accent);
    border-color: var(--accent);
}
.mb-details {
    padding: 8px 10px;
}
.mb-filename {
    font-size: 12px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}
.mb-meta {
    font-size: 11px;
    color: var(--text-dim);
    display: flex;
    justify-content: space-between;
}
.mb-bottom-bar {
    height: 52px;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
    display: flex;
    align-items: center;
    padding: 0 16px;
    justify-content: space-between;
}
.mb-selection-info {
    font-size: 13px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 12px;
}
.mb-text-btn {
    background: transparent;
    border: none;
    color: var(--text-mid);
    font-size: 12px;
    cursor: pointer;
}
.mb-text-btn:hover { text-decoration: underline; color: var(--text); }
.mb-actions {
    display: flex;
    gap: 8px;
}
.mb-action-circle {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.mb-action-circle:hover { filter: brightness(0.9); }
.mb-action-circle.danger { color: color-mix(in srgb,var(--accent) 78%,#fff 22%); }
.mb-action-circle svg { width: 14px; height: 14px; fill: currentColor; }

#preview-content {
    width: 100vw;
    height: 100vh;
    padding: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#preview-content img, #preview-content video {
    max-width: min(94vw, 1400px);
    max-height: 88vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 22px 64px rgba(0,0,0,0.55);
}

/* Discover panel */
.space2-discover{flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden;position:relative;background:transparent;}
.space2-discover.hidden{display:none;}
.discover-tabs{display:flex;gap:4px;}
.discover-tab{height:30px;padding:0 12px;border-radius:7px;border:1px solid transparent;background:transparent;color:var(--text-mid);font-size:12px;font-family:inherit;cursor:pointer;transition:color .14s,background .14s,border-color .14s;}
.discover-tab.active{background:var(--surface);border-color:var(--border);color:var(--text);}
.discover-tab:hover:not(.active){color:var(--text);}
.discover-feed{position:relative;z-index:1;flex:1;overflow:auto;padding:34px 20px 20px;columns:5;column-gap:16px;background:transparent;border-radius:0;}
.discover-feed.is-loading{columns:auto;display:flex;align-items:center;justify-content:center;padding:0;}
.discover-card{display:inline-block;width:100%;margin:0 0 18px;break-inside:avoid;border-radius:12px;overflow:hidden;cursor:pointer;position:relative;background:transparent;border:none;transition:transform .14s ease,box-shadow .14s ease;}
.discover-card:hover{transform:translateY(-3px);box-shadow:0 10px 30px rgba(0,0,0,.2);}
.discover-card:hover .discover-card-actions{opacity:1;}
.discover-card img{width:100%;height:auto;display:block;border-radius:12px;}
.discover-card-info{padding:8px 2px 0;}
.discover-card-title{font-size:13px;font-weight:600;color:var(--text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.discover-card-src{font-size:11px;color:var(--text-dim);}
.discover-card-actions{position:absolute;top:10px;right:10px;display:flex;gap:6px;opacity:0;transition:opacity .15s;}
.discover-save-btn{width:30px;height:30px;padding:0;border-radius:9px;border:1px solid color-mix(in srgb,var(--accent) 24%,var(--border));background:color-mix(in srgb,var(--surface) 76%,transparent);color:var(--text);font-size:11px;font-weight:600;cursor:pointer;backdrop-filter:blur(12px);display:flex;align-items:center;justify-content:center;box-shadow:var(--shadow);transition:transform .14s ease,box-shadow .14s ease,border-color .14s ease;}
.discover-save-btn svg{width:14px;height:14px;fill:currentColor;}
.discover-save-btn:hover{transform:translateY(-1px);box-shadow:var(--shadow-lg);border-color:color-mix(in srgb,var(--accent) 38%,var(--border));}
.discover-save-btn[data-state]{border-color:color-mix(in srgb,var(--accent) 42%,var(--border));color:var(--accent);}

.collection-dropdown-menu{position:fixed;min-width:180px;max-width:240px;background:var(--surface);border:1px solid var(--border);border-radius:10px;box-shadow:var(--shadow-lg);padding:6px;display:flex;flex-direction:column;gap:3px;z-index:460;}
.collection-dropdown-item{height:30px;border:none;border-radius:7px;background:transparent;color:var(--text);font:500 12px/1.2 inherit;display:flex;align-items:center;padding:0 9px;cursor:pointer;text-align:left;}
.collection-dropdown-item:hover{background:var(--surface-2);}
.collection-dropdown-item.active{color:var(--accent);}
.collection-dropdown-item.danger{color:#d15f5f;}
.collection-dropdown-sep{height:1px;background:var(--border);margin:4px 2px;}
.collection-dropdown-empty{padding:8px 9px;color:var(--text-dim);font-size:11px;}
.discover-manage{position:absolute;inset:18px 0 0 0;z-index:5;background:color-mix(in srgb,var(--surface) 78%,transparent);backdrop-filter:blur(14px);display:flex;flex-direction:column;padding:18px;gap:12px;border-radius:16px 16px 0 0;border:1px solid color-mix(in srgb,var(--border) 80%,transparent);}
.discover-manage.hidden{display:none;}
.discover-manage-title{font-size:13px;font-weight:600;color:var(--text);}
.discover-custom-list{display:flex;flex-direction:column;gap:8px;max-height:240px;overflow:auto;}
.discover-source-list{display:flex;flex-direction:column;gap:8px;overflow:auto;min-height:0;}
.discover-custom-item{display:flex;align-items:center;gap:8px;padding:8px 10px;border-radius:9px;border:1px solid var(--border);background:var(--surface-2);}
.discover-custom-item-name{flex:1;font-size:12px;color:var(--text);}
.discover-custom-del{width:24px;height:24px;border-radius:6px;border:none;background:transparent;color:var(--text-dim);cursor:pointer;display:flex;align-items:center;justify-content:center;}
.discover-custom-del:hover{color:var(--accent);}
.discover-source-item{display:flex;align-items:center;gap:8px;padding:9px 10px;border-radius:10px;border:1px solid color-mix(in srgb,var(--border) 80%,transparent);background:color-mix(in srgb,var(--surface-2) 70%,transparent);cursor:pointer;}
.discover-source-item:hover{background:color-mix(in srgb,var(--surface-2) 90%,transparent);}
.discover-source-meta{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px;}
.discover-source-name{font-size:12px;color:var(--text);font-weight:600;}
.discover-source-url{font-size:11px;color:var(--text-dim);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.discover-source-del{width:24px;height:24px;border-radius:6px;border:none;background:transparent;color:var(--text-dim);cursor:pointer;display:flex;align-items:center;justify-content:center;flex-shrink:0;font-size:12px;}
.discover-source-del:hover{color:var(--accent);background:color-mix(in srgb,var(--accent) 12%,transparent);}
.discover-source-badge{font-size:10px;color:var(--text-dim);background:color-mix(in srgb,var(--border) 60%,transparent);padding:2px 6px;border-radius:5px;flex-shrink:0;white-space:nowrap;}
.discover-manage-add{display:flex;gap:8px;align-items:center;}
.discover-manage-add .settings-input{flex:1;min-width:0;}
.discover-empty{position:relative;z-index:1;flex:1;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:8px;color:var(--text-dim);font-size:13px;}
.discover-loading{position:relative;z-index:2;display:flex;align-items:center;justify-content:center;min-height:100%;width:100%;height:100%;}
.discover-loading .spinner{width:26px;height:26px;border-radius:999px;border:2px solid color-mix(in srgb,var(--border) 80%,transparent);border-top-color:var(--text-mid);animation:discoverSpin .75s linear infinite;}
@keyframes discoverSpin{to{transform:rotate(360deg);}}

.space2-grid,.discover-feed,.discover-custom-list,.discover-source-list{scrollbar-width:thin;scrollbar-color:rgba(168,176,199,.32) transparent;}
.space2-grid::-webkit-scrollbar,.discover-feed::-webkit-scrollbar,.discover-custom-list::-webkit-scrollbar,.discover-source-list::-webkit-scrollbar{width:10px;}
.space2-grid::-webkit-scrollbar-track,.discover-feed::-webkit-scrollbar-track,.discover-custom-list::-webkit-scrollbar-track,.discover-source-list::-webkit-scrollbar-track{background:transparent;}
.space2-grid::-webkit-scrollbar-thumb,.discover-feed::-webkit-scrollbar-thumb,.discover-custom-list::-webkit-scrollbar-thumb,.discover-source-list::-webkit-scrollbar-thumb{background:rgba(168,176,199,.24);border-radius:999px;border:2px solid transparent;background-clip:padding-box;backdrop-filter:blur(8px);}

@media (max-width:980px){
    .space2-item-layout{grid-template-columns:1fr;}
    .control-corner{top:10px;left:10px;gap:6px;flex-direction:column;align-items:flex-start;}
    .board-dock{order:1;}
    .workflow-dock{order:2;}
    .space2-item-card{height:calc(100vh - 18px);width:calc(100vw - 18px);padding:10px;}
    body.space-2 #space2-mode-dock{display:flex!important;}
    .space2-mode-dock{padding:4px 5px 5px;border-radius:12px 12px 0 0;margin-bottom:2px;}
    .space2-mode-btn{min-width:44px;width:44px;padding:8px 0;font-size:0;gap:0;}
    .space2-mode-btn svg{width:16px;height:16px;}
    .space2-sidebar-head{display:flex;flex-wrap:nowrap;align-items:center;gap:8px;padding:2px 0 6px;min-width:0;}
    .space2-sidebar-head .space2-view-switch{flex:0 0 auto;align-self:auto;width:max-content;max-width:max-content;}
    .space2-sidebar-head .space2-search-wrap{width:auto;max-width:none;min-width:0;height:36px;flex:1 1 auto;box-shadow:none;}
    .space2-sidebar-head .space2-search-wrap:focus-within{width:auto;}
}

@media (max-width:760px){
    #ui-container{height:100dvh;max-height:100dvh;overflow:hidden;}
    #viewport{width:100vw;height:100dvh;overflow:hidden;overscroll-behavior:none;}
    .space-switcher{top:10px;}
    .space2-grid-mode-corner{display:none !important;}
    .space2-top-sync{top:10px;left:10px;}
    .space-toggle{width:194px;height:30px;}
    .space-toggle-thumb{width:96px;height:30px;}
    .space2-panel{inset:8px 10px 8px 10px;}
    .space2-panel{--space2-sidebar-width:198px;}
    .space2-sidebar{overflow:auto;padding-top:8px;padding-bottom:10px;-webkit-overflow-scrolling:touch;top:10px;box-shadow:4px 0 18px rgba(0,0,0,.16);}
    .space2-head{gap:8px;}
    .space2-sidebar-head{display:flex;flex-wrap:nowrap;align-items:center;justify-content:flex-start;gap:4px;padding:2px 0 2px;min-width:0;}
    .space2-head-row{justify-content:flex-start;align-items:center;gap:6px;}
    .space2-sidebar-head .space2-view-switch{flex:0 0 auto;align-self:auto;width:max-content;max-width:max-content;margin-right:2px;order:1;justify-self:start;height:32px;padding:2px;border-radius:10px;}
    .space2-sidebar-head .space2-grid-mode-switch{flex:0 0 auto;align-self:auto;width:max-content;max-width:max-content;order:2;height:32px;padding:2px;border-radius:10px;}
    .space2-sidebar-head .space2-search-wrap{width:auto;max-width:none;min-width:100px;height:32px;flex:0 1 auto;box-shadow:none;margin-left:0;order:3;padding:0 10px;overflow:hidden;}
    .space2-sidebar-head .space2-search-wrap:focus-within{width:auto;}
    .space2-sync-indicator{height:24px;padding:0 8px;font-size:10px;}
    .space2-top-icon-btn{width:36px;height:36px;border-radius:10px;flex-shrink:0;}
    .space2-top-icon-btn svg{width:18px;height:18px;}
    .space2-view-switch{height:32px;padding:2px;border-radius:10px;box-shadow:none;align-self:flex-start;}
    .space2-view-toggle{height:28px;width:68px;}
    .space2-view-icon{top:0;width:32px;height:28px;}
    .space2-view-icon-discover{left:0;}
    .space2-view-icon-grid{left:34px;right:auto;}
    .space2-view-thumb{top:2px;left:2px;width:30px;height:24px;border-radius:7px;transition:left .2s cubic-bezier(.4,0,.2,1);}
    .space2-view-toggle.is-grid .space2-view-thumb{left:34px;}
    .space2-grid-mode-switch{height:32px;padding:2px;border-radius:10px;box-shadow:none;align-self:flex-start;}
    .space2-grid-mode-toggle{height:28px;width:68px;}
    .space2-grid-mode-icon{top:0;width:32px;height:28px;}
    .space2-grid-mode-icon-masonry{left:0;}
    .space2-grid-mode-icon-infinite{left:34px;right:auto;}
    .space2-grid-mode-thumb{top:2px;left:2px;width:30px;height:24px;border-radius:7px;transition:left .2s cubic-bezier(.4,0,.2,1);}
    .space2-grid-mode-toggle.is-infinite .space2-grid-mode-thumb{left:34px;}
    body.space-2 #space2-mode-dock{display:flex!important;}
    .space2-mode-dock{padding:4px 5px 5px;border-radius:12px 12px 0 0;margin-bottom:-2px;}
    .space2-mode-btn{min-width:44px;width:44px;padding:8px 0;font-size:0;gap:0;}
    .space2-mode-btn svg{width:16px;height:16px;}
    .board-fan-grid{grid-template-columns:repeat(3,38px);}
    .board-fan-btn{width:38px;height:38px;}
    #toolbar-hub{bottom:0;width:calc(100% - 12px);padding-bottom:env(safe-area-inset-bottom);}
    #mode-switcher{padding:4px 5px 5px;border-radius:12px 12px 0 0;}
    .mode-sw-btn{min-width:44px;width:44px;padding:8px 0;font-size:0;gap:0;}
    .mode-sw-btn svg,.mode-sw-btn .mode-icon-img,.mode-sw-btn .mode-icon-svg{width:16px;height:16px;}
    .bar-prompt-area{padding:8px 10px 4px;gap:6px;}
    .prompt-magic-btn{width:28px;height:28px;border-radius:8px;}
    .prompt-magic-btn svg{width:13px;height:13px;}
    .bar-controls{padding:4px 8px 8px;gap:6px;overflow:visible;}
    #bar-note-btn,#bar-upload-btn,#size-btn{width:34px;height:32px;padding:0;font-size:0;gap:0;justify-content:center;flex-shrink:0;}
    #bar-note-btn svg,#bar-upload-btn svg{width:15px;height:15px;}
    #size-btn{justify-content:center;padding:0 8px;min-width:40px;width:auto;}
    #size-btn #size-label{display:none;}
    #size-btn svg:last-child{display:none;}
    #bar-gen-btn{font-size:12px;}
    #model-wrapper{min-width:0;max-width:none;flex:1 1 auto;}
    #bar-gen-btn{height:32px;padding:0 12px;min-width:88px;white-space:nowrap;flex-shrink:0;}
}

body.is-mobile-shell .mode-sw-btn{min-width:44px;width:44px;padding:8px 0;font-size:0;gap:0;}
body.is-mobile-shell .mode-sw-btn svg,
body.is-mobile-shell .mode-sw-btn .mode-icon-img,
body.is-mobile-shell .mode-sw-btn .mode-icon-svg{width:16px;height:16px;}
body.is-mobile-shell #theme-toggle{width:36px;height:36px;border-radius:10px;border:1px solid var(--border);background:color-mix(in srgb,var(--surface) 88%,transparent);backdrop-filter:blur(10px);box-shadow:var(--shadow);color:var(--text);}
body.is-mobile-shell #theme-toggle:hover{background:color-mix(in srgb,var(--surface) 92%,transparent);border-color:color-mix(in srgb,var(--border) 90%,var(--accent) 10%);}

@media (max-width:390px){
    #toolbar-hub{width:calc(100% - 10px);}
    .space2-ai-hub{width:calc(100% - 10px);}
    .space2-panel{inset:8px 8px 8px 8px;}
}

@media (max-width:1280px){
    .discover-feed{columns:4;}
}

@media (max-width:980px){
    .discover-feed{columns:3;}
}

@media (max-width:760px){
    :root{--ai-input-font-size:16px;}
    .space2-sidebar{top:44px;bottom:118px;padding-top:10px;padding-bottom:12px;}
    .space2-sash{top:44px;bottom:118px;}
    .space2-panel.sidebar-collapsed .space2-sash{top:44px;bottom:118px;}
    .space2-grid{padding:56px 10px calc(142px + env(safe-area-inset-bottom)) 10px;--space2-grid-gap:10px;touch-action:pan-y;-webkit-overflow-scrolling:touch;box-shadow:none;}
    .space2-grid.infinite-mode{touch-action:none;-webkit-overflow-scrolling:auto;}
    .space2-grid.feed-mode{--space2-grid-gap:16px;}
    .discover-feed{padding:24px 10px 10px;columns:1;column-gap:0;}
    .discover-card{margin-bottom:16px;}
    .space2-ai-hub{position:fixed;left:50%;transform:translateX(-50%);width:calc(100% - 12px);bottom:calc(-8px + var(--mobile-keyboard-inset));gap:6px;padding-bottom:env(safe-area-inset-bottom);--space2-ai-sheet-max:calc(90dvh - 44px);transition:bottom .2s ease;}
    .space2-ai-hub:not(.chat-open){gap:0;}
    .space2-ai-hub:not(.chat-open) #space2-mode-dock{margin-bottom:-3px;}
    .space2-ai-hub:not(.chat-open) .space2-ai-bar-wrap{margin-top:-1px;}
    .space2-ai-bar{min-height:50px;border-radius:12px;padding:5px 6px;gap:6px;background:var(--toolbar-surface);backdrop-filter:none;border:1px solid var(--toolbar-border);box-shadow:none;}
    #bottom-bar{border-radius:12px;background:var(--toolbar-surface);backdrop-filter:none;border-color:var(--toolbar-border);box-shadow:none;}
    .space2-mode-dock{background:var(--toolbar-surface);backdrop-filter:none;border-color:var(--toolbar-border);box-shadow:none;border-radius:12px;}
    .space2-ai-eye,.space2-ai-send,.space2-ai-history-toggle{width:32px;height:32px;border-radius:8px;}
    .space2-ai-model-btn{height:32px;max-width:132px;padding:0 8px;}
    #space2-search{font-size:16px;}
    #space2-ai-input::placeholder{font-size:12px;}
    #ai-prompt-input::placeholder{font-size:12px;}
    input[type="text"],input[type="search"],input[type="email"],input[type="password"],input[type="number"],textarea,select{font-size:16px!important;}
    .space2-panel{inset:8px 10px 8px 10px;}
    .space2-item-card{height:calc(100dvh - 30px - env(safe-area-inset-bottom));width:calc(100vw - 12px);padding:8px;}
    .space2-item-layout{grid-template-columns:1fr;grid-template-rows:minmax(40vh,52vh) minmax(0,1fr);gap:8px;}
    .space2-item-preview{height:100%;min-height:0;}
    .space2-item-preview img{object-fit:contain;max-height:100%;}
    .space2-item-form{overflow:auto;min-height:0;}
    .space2-lightbox{padding:8px;}
    .space2-lightbox-stage{max-width:calc(100vw - 16px);max-height:calc(100vh - 160px);}
    .space2-lightbox-stage img,.space2-lightbox-stage video,.space2-lightbox-stage iframe{max-width:calc(100vw - 16px);max-height:calc(100vh - 160px);border-radius:10px;}
    .space2-lightbox-close,.space2-lightbox-edit{top:max(8px,env(safe-area-inset-top));}
    .space2-lightbox-close{right:8px;width:38px;height:38px;border-radius:9px;}
    .space2-lightbox-edit{right:52px;height:38px;border-radius:9px;padding:0 8px;font-size:11px;}
    .space2-lightbox-thumb-strip{bottom:8px;max-width:calc(100vw - 40px);padding:3px 8px;gap:4px;}
    .space2-lightbox-thumb-item{width:28px;height:28px;}
    .space2-lightbox-thumb-item.active{width:36px;height:36px;}
    .space2-lightbox-nav{width:32px;height:32px;}
    .space2-lightbox-nav-prev{left:6px;}
    .space2-lightbox-nav-next{right:6px;}
    .discover-tabs{flex-direction:column;align-items:stretch;}
    .discover-tab{height:34px;justify-content:flex-start;text-align:left;}
}

/* iPad/tablet: prevent focus zoom on toolbar/search/chat inputs. */
@media (min-width:761px) and (max-width:1366px) and (hover:none) and (pointer:coarse){
    #space2-search,
    #space2-ai-input,
    #ai-prompt-input,
    .settings-input{font-size:16px!important;}
}

/* Mobile hard-overrides: keep controls visible above scrolling media */
@media (max-width:760px){
    body.is-mobile-shell.space-2 .space2-panel::before,
    body.is-mobile-shell.space-2 .space2-panel::after{
        content:'';
        position:absolute;
        left:0;
        right:0;
        pointer-events:none;
        z-index:24;
    }
    body.is-mobile-shell.space-2 .space2-panel::before{
        top:0;
        height:34px;
        background:linear-gradient(to bottom,var(--bg),rgba(0,0,0,0));
    }
    body.is-mobile-shell.space-2 .space2-panel::after{
        bottom:-2px;
        height:20px;
        background:linear-gradient(to top,var(--bg),rgba(0,0,0,0));
    }

    body.is-mobile-shell.space-2 #space2-top-sync{top:10px;left:10px;z-index:360;}
    body.is-mobile-shell.space-2 #space2-top-corner{top:10px;right:10px;z-index:360;}
    body.is-mobile-shell.space-2 #space2-top-corner #theme-toggle{
        width:36px;
        height:36px;
        border-radius:10px;
        border:1px solid color-mix(in srgb,var(--border) 90%,transparent) !important;
        background:color-mix(in srgb,var(--surface) 80%,transparent) !important;
        -webkit-backdrop-filter:blur(10px) saturate(1.05);
        backdrop-filter:blur(10px) saturate(1.05);
        box-shadow:0 6px 16px rgba(0,0,0,.18) !important;
        color:var(--text) !important;
    }

    body.is-mobile-shell.space-2 .space2-sidebar{
        top:54px !important;
        bottom:138px !important;
        padding-top:10px !important;
        padding-bottom:12px !important;
    }
    body.is-mobile-shell.space-2 .space2-sash{
        top:54px !important;
        bottom:138px !important;
    }
    body.is-mobile-shell.space-2 .space2-panel.sidebar-collapsed .space2-sash{
        top:54px !important;
        bottom:138px !important;
    }

    body.is-mobile-shell.space-2 .space2-grid{padding-top:56px !important;}
    body.is-mobile-shell.space-2 .space2-grid.feed-mode{--space2-grid-gap:18px;}

    body.is-mobile-shell.space-2 .space2-mode-dock,
    body.is-mobile-shell.space-2 .space2-ai-bar,
    body.is-mobile-shell.space-2 #bottom-bar{
        background:var(--surface) !important;
        border-color:var(--border) !important;
        -webkit-backdrop-filter:none !important;
        backdrop-filter:none !important;
        box-shadow:none !important;
    }

    body.is-mobile-shell .space2-capture-overlay{cursor:default;}
    body.is-mobile-shell .space2-capture-actions{display:flex;}

    body.is-mobile-shell.space-2 #space2-ai-input::placeholder{font-size:12px !important;}

/* ════ Rabbit R1 Overrides ════ */
body.r1-mode, body.r1-mode html{width:240px!important;height:282px!important;overflow:hidden!important;position:relative!important}
body.r1-mode{inset:auto!important;min-width:0!important;min-height:0!important;max-height:none!important}
body.r1-mode #ui-container{width:240px;height:282px;inset:0!important;max-height:none;overflow-y:auto!important;overflow-x:hidden!important;-webkit-overflow-scrolling:touch}
body.r1-mode .auth-card{width:min(220px,calc(100vw - 20px));padding:14px 14px 12px;}
body.r1-mode .auth-title{font-size:18px;}
body.r1-mode .auth-subtitle{font-size:11px;}
body.r1-mode .auth-input{height:30px;font-size:12px;}
body.r1-mode .auth-primary{height:30px;font-size:11px;}
body.r1-mode .auth-secondary{height:28px;font-size:10px;}
body.r1-mode .auth-status{font-size:10px;}
body.r1-mode #space-toggle{height:24px;}
body.r1-mode .space-toggle-btn{font-size:9px;}
body.r1-mode .space-switcher{top:4px;}
body.r1-mode .space2-panel{inset:28px 2px 2px;--space2-sidebar-width:36px}
body.r1-mode .space2-sidebar{width:36px!important;padding:4px 3px!important;gap:4px;left:2px;top:4px;bottom:2px;background:transparent;backdrop-filter:none;border:none;border-radius:6px}
body.r1-mode .space2-sidebar .space2-head{display:none}
body.r1-mode .space2-sidebar .space2-side-title{display:none}
body.r1-mode .space2-sidebar .space2-collections{display:none}
body.r1-mode .space2-sidebar .space2-sidebar-footer{display:none}
body.r1-mode .space2-sidebar .space2-discover-controls{display:none}
body.r1-mode .space2-sash{display:none}
body.r1-mode .space2-grid{padding:30px 4px calc(4px) 42px;--space2-grid-gap:3px}
body.r1-mode .space2-grid.feed-mode{--space2-grid-gap:4px}
body.r1-mode .space2-grid.infinite-mode{touch-action:pan-y}
body.r1-mode #space2-ai-hub{display:none!important}
body.r1-mode #toolbar-hub{display:none!important}
body.r1-mode #control-corner{display:none}
body.r1-mode #context-toolbar{display:none!important}
body.r1-mode #multi-toolbar{display:none!important}
body.r1-mode #note-toolbar{display:none!important}
body.r1-mode #favorites-panel{display:none!important}
body.r1-mode .space2-grid-mode-corner{display:none!important}
body.r1-mode .space2-top-corner{top:2px;right:2px}
body.r1-mode .space2-top-icon-btn{width:24px;height:24px;border-radius:5px}
body.r1-mode .space2-top-icon-btn svg{width:12px;height:12px}
body.r1-mode #space2-sync-btn{display:none}
body.r1-mode .discover-feed{padding:4px;columns:1;column-gap:0}
body.r1-mode .discover-card{margin-bottom:4px}
body.r1-mode .space2-item-card{height:auto;width:calc(100vw - 8px);padding:4px}
body.r1-mode .settings-card{width:calc(100% - 8px);padding:8px}
body.r1-mode .mb-container{flex-direction:column}
body.r1-mode .mb-sidebar{width:100%;flex-direction:row;padding:4px;overflow-x:auto}
body.r1-mode .mb-main{padding:4px}
body.r1-mode .mb-grid{grid-template-columns:repeat(2,1fr);gap:4px}
body.r1-mode .mb-topbar{flex-wrap:wrap;gap:4px;padding:4px}
body.r1-mode .mb-top-rhs{display:none}
body.r1-mode .mb-actions{gap:4px}
body.r1-mode .preview-overlay{display:none!important}
}
