/* A desktop beneath the editor. All window behavior stays inside the page. */
:root { --workspace-chrome-height: 30px; }
#workspace-window { position: fixed; inset: 0; z-index: 10; display: flex; flex-direction: column; min-width: 0; background: #fff; transform: none; transform-origin: 50% calc(100% - 60px); opacity: 1; visibility: visible; box-shadow: 0 12px 70px #15143a3b; transition: transform .42s cubic-bezier(.65,.05,.36,1), opacity .3s ease, visibility 0s; }
#workspace-window.is-minimized { transform: scale(.075,.055); opacity: 0; visibility: hidden; pointer-events: none; transition: transform .42s cubic-bezier(.65,.05,.36,1), opacity .4s ease, visibility 0s .42s; }
.workspace-window-chrome { position: relative; z-index: 130; display: flex; align-items: center; flex: 0 0 var(--workspace-chrome-height); height: var(--workspace-chrome-height); border-bottom: 1px solid #e2e2e2; background: #f7f7f7; color: #6e6e73; user-select: none; }
.workspace-traffic-lights { position: absolute; top: 0; left: 12px; height: 30px; display: flex; gap: 8px; align-items: center; }
.workspace-light { display: block; position: relative; flex: 0 0 12px; width: 12px; height: 12px; border-radius: 50%; box-shadow: inset 0 0 0 1px #00000012; }
.workspace-close { background: #ff6058; }
.workspace-expand { background: #28c840; }
.workspace-minimize, .workspace-minimize:hover { display: grid; place-items: center; padding: 0; background: #ffbd2e; transition: box-shadow .15s ease; }
.workspace-minimize span { display: block; width: 7px; height: 2px; border-radius: 1px; background: #805500; opacity: 0; }
.workspace-traffic-lights:hover .workspace-minimize span, .workspace-minimize:focus-visible span, .workspace-minimize.is-targeted span { opacity: 1; }
.workspace-minimize:disabled { opacity: 1; cursor: default; }
.workspace-minimize.is-targeted { box-shadow: 0 0 0 4px #ffbd2e30, inset 0 0 0 1px #af7e1c55; }
.workspace-minimize.is-pressed { background: #d69a20; box-shadow: 0 0 0 6px #ffbd2e24, inset 0 1px 2px #79510050; }
.workspace-window-title { display: flex; gap: 7px; align-items: center; justify-content: center; margin: 0 auto; max-width: 42%; font-size: 11px; font-weight: 500; letter-spacing: .05px; }
#workspace-window-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workspace-title-symbol svg { width: 8px; height: 12px; stroke: none; }
.workspace-window-hint { position: absolute; right: 12px; max-width: 28%; font-size: 10px; color: #8a5bab; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#workspace-window-content { position: relative; flex: 1 1 0; min-height: 0; overflow: hidden; }
#workspace-window-content > #editor-app { position: absolute; inset: 0; height: 100%; }
#workspace-window-content > #file-browser, #workspace-window-content > #help-dialog { position: absolute; inset: 0; }
body.workspace-is-minimized .editor-context-menu { display: none; }

#simulated-desktop { position: fixed; inset: 0; z-index: 0; overflow: hidden; color: #fff; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: #19256b; user-select: none; visibility: hidden; transition: visibility 0s .46s; }
/* Reveal before minimizing; keep it behind the returning window until that
   transition finishes, then stop painting the concealed desktop entirely. */
body.workspace-is-minimized #simulated-desktop { visibility: visible; transition-delay: 0s; }
.desktop-wallpaper { position: absolute; inset: 0; overflow: hidden; background: radial-gradient(ellipse at 85% 15%,#73a5e9 0,transparent 53%),linear-gradient(125deg,#111b52 4%,#2d479d 45%,#9d8cd2 85%,#bd9cc4); }
.desktop-wallpaper::before { content: ""; position: absolute; inset: -35% -20% -60% -20%; background: linear-gradient(120deg,#18205c 18%,#5164ae 40%,#a0b8f2 52%,#c9b2e8 59%,#bfb2d5 60%,#7276b7 68%,#3b4482 78%); border-radius: 48%; transform: rotate(-28deg) translate(-6%,38%); box-shadow: -20px -14px 100px #a9bdf755; }
.desktop-wallpaper::after { content: ""; position: absolute; width: 122vw; height: 102vh; left: -58vw; top: -40vh; border-radius: 49%; background: linear-gradient(140deg,#4d69bc,#4f6aba 45%,#8eaff5 65%,#b0baf0 70%,#434b87 73%,#282864); transform: rotate(-30deg); box-shadow: 30px 40px 100px #19265477; }
.desktop-wallpaper i { position: absolute; z-index: 1; width: 120vw; height: 110vh; border: 1px solid #c8d5ff12; border-radius: 50%; transform: rotate(-30deg); top: -67vh; left: -68vw; }
.desktop-wallpaper i:nth-child(2) { top: -65vh; left: -65vw; }
.desktop-wallpaper i:nth-child(3) { top: -63vh; left: -62vw; }
.desktop-wallpaper i:nth-child(4) { top: -61vh; left: -59vw; }
.desktop-menubar { position: relative; z-index: 3; display: flex; align-items: center; justify-content: space-between; height: 30px; padding: 0 18px; background: #e2e9ff28; backdrop-filter: blur(25px); box-shadow: 0 1px #ffffff12; font-size: 12px; line-height: 18px; }
.desktop-menu-left, .desktop-menu-right { display: flex; align-items: center; gap: 22px; white-space: nowrap; }
.desktop-menu-left strong { font-size: 12px; font-weight: 600; }
.desktop-menubar .desktop-apple { width: 14px; height: 17px; fill: #fff; stroke: none; margin-right: 2px; }
.desktop-menu-right { gap: 18px; font-size: 11px; font-weight: 500; }
.desktop-menu-right svg { width: 18px; height: 14px; }
.desktop-folders { position: absolute; right: 25px; top: 62px; bottom: 120px; display: grid; grid-template-columns: 112px; grid-auto-rows: min-content; align-content: start; gap: 26px; }
.desktop-folder { display: flex; flex-direction: column; justify-content: flex-start; width: 112px; padding: 4px 4px 6px; gap: 4px; border: 1px solid transparent; border-radius: 6px; color: #fff; }
.desktop-folder > svg { width: 76px; height: 62px; flex-shrink: 0; stroke: none; filter: drop-shadow(0 3px 4px #10284c3a); }
.desktop-folder > span { display: block; padding: 2px 4px; font-size: 11px; font-weight: 500; line-height: 15px; text-align: center; text-shadow: 0 1px 3px #15245699; overflow-wrap: anywhere; }
.desktop-folder.is-selected { background: #cce5ff1c; border-color: #edf6ff55; }
.desktop-folder.is-selected > span { background: #236acb; border-radius: 4px; }
.desktop-folder-note { position: absolute; z-index: 4; top: 42px; left: 50%; transform: translateX(-50%); max-width: calc(100% - 32px); padding: 10px 14px; color: #eef2ff; background: #1b2147b8; border: 1px solid #c5d3ff26; border-radius: 10px; backdrop-filter: blur(14px); box-shadow: 0 8px 25px #1124561f; font-size: 12px; line-height: 18px; }
.desktop-live-card { position: absolute; left: 50%; bottom: 128px; transform: translateX(-50%); width: 360px; max-width: calc(100% - 48px); overflow: hidden; border: 1px solid #ffffff4a; border-radius: 14px; background: #ecf0ffa3; color: #2b2f4f; backdrop-filter: blur(30px) saturate(1.4); box-shadow: 0 18px 60px #1319343a,0 1px 3px #172c5d25; }
.desktop-live-top { display: flex; align-items: center; gap: 7px; padding: 12px 14px 11px; font-size: 11px; }
.desktop-live-top strong { font-weight: 600; }
.desktop-live-dot { width: 5px; height: 5px; border-radius: 50%; background: #1a9b5e; box-shadow: 0 0 0 3px #219d5c15; }
#desktop-return-countdown { margin-left: auto; color: #6b6d88; font-size: 10px; font-variant-numeric: tabular-nums; }
.desktop-live-restore { display: flex; flex-direction: column; width: calc(100% - 24px); margin: 0 12px; border: 1px solid #6d6d8b25; border-radius: 7px; overflow: hidden; background: #fff; }
.desktop-live-restore:hover { border-color: #6085d4; }
#desktop-live-preview { width: 100%; height: 140px; object-fit: contain; background: #f5f5f5; }
.desktop-preview-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; padding: 8px 10px; font-size: 10px; line-height: 14px; text-align: left; background: #ffffff; border-top: 1px solid #eee; }
#desktop-file-name { font-weight: 600; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
#desktop-integrity { flex-shrink: 0; color: #6a6c7b; font-variant-numeric: tabular-nums; }
.desktop-integrity-track { height: 3px; margin: 10px 14px 0; overflow: hidden; border-radius: 5px; background: #6d7caa25; }
.desktop-integrity-track i { display: block; width: 100%; height: 100%; background: #579375; transition: width .15s linear; }
.desktop-integrity-track i.is-low { background: #b97c63; }
.desktop-selected-layer { margin: 9px 14px 0; color: #62627d; font-size: 10px; line-height: 15px; text-align: center; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.desktop-keyboard-hints { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 7px 12px; padding: 12px 12px 14px; color: #5f627f; font-size: 10px; line-height: 16px; }
.desktop-keyboard-hints > span { display: inline-flex; gap: 5px; align-items: center; }
.desktop-keyboard-hints kbd { display: inline-block; padding: 1px 4px; border: 1px solid #8d94b43a; background: #fff5; border-radius: 4px; color: #404665; font-size: 10px; line-height: 14px; }
.desktop-dock { position: absolute; z-index: 4; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; padding: 11px 13px 14px; height: 78px; border: 1px solid #ffffff5a; border-radius: 22px; background: linear-gradient(130deg,#e1e9ff73,#e2e2ff3f); box-shadow: 0 8px 25px #14295840,inset 0 1px #ffffff40; backdrop-filter: blur(25px) saturate(1.3); }
.dock-icon { position: relative; flex: 0 0 48px; width: 48px; height: 48px; border-radius: 11px; transition: transform .16s ease; }
.dock-icon:hover { transform: translateY(-5px); }
.dock-icon > svg { width: 48px; height: 48px; stroke: none; filter: drop-shadow(0 2px 2px #10215433); }
.dock-figma-tile { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 10px; background: linear-gradient(#2f2f32,#222225); box-shadow: 0 2px 2px #1c254533,inset 0 1px #ffffff15; }
.dock-figma-tile svg { width: 22px; height: 33px; stroke: none; }
.dock-running-dot { position: absolute; bottom: -9px; left: 22px; width: 4px; height: 4px; border-radius: 50%; background: #263758; }
.dock-separator { height: 42px; width: 1px; background: #33467530; margin: 0 1px; }
.dock-tooltip { position: absolute; left: 50%; bottom: calc(100% + 14px); transform: translateX(-50%); display: none; width: max-content; max-width: 220px; padding: 6px 10px; border-radius: 6px; background: #f0f3fff2; color: #41465e; border: 1px solid #aab4d761; box-shadow: 0 3px 12px #172a4a20; font-size: 11px; line-height: 16px; pointer-events: none; }
.dock-icon:hover .dock-tooltip, .dock-icon:focus-visible .dock-tooltip { display: block; }
.dock-downloads > svg { width: 48px; height: 42px; }
.dock-trash > svg { width: 44px; height: 44px; }

#workspace-effects { position: fixed; inset: 0; z-index: 180; width: 100%; height: 100%; pointer-events: none; }
#workspace-cursor { position: fixed; top: 0; left: 0; z-index: 200; pointer-events: none; will-change: transform; filter: drop-shadow(0 1px 1px #00000026); }
#workspace-cursor > svg { display: block; flex: 0 0 auto; stroke: none; fill: none; overflow: visible; }
#workspace-cursor > img { display: block; width: 32px; height: 32px; }
#workspace-cursor.is-stolen { filter: drop-shadow(0 1px 1px #00000030) drop-shadow(0 0 3px #a36bde66); }
#workspace-cursor.is-bumped { filter: drop-shadow(0 0 4px #0d99ff99); }
body.workspace-pointer-visible, body.workspace-pointer-visible * { cursor: none !important; }

@media (max-width: 1100px) {
  .desktop-folders { right: 16px; top: 50px; gap: 16px; }
  .desktop-folder > svg { width: 66px; height: 54px; }
  .desktop-live-card { width: 340px; bottom: 115px; }
  .workspace-window-hint { max-width: 27%; }
}
@media (max-height: 650px) {
  .desktop-folders { grid-template-columns: repeat(2,106px); gap: 16px 6px; }
  .desktop-live-card { left: 35%; width: 320px; bottom: 112px; }
  #desktop-live-preview { height: 110px; }
}
@media (max-width: 700px) {
  .workspace-window-title { max-width: 50%; }
  .workspace-window-hint { display: none; }
  .desktop-menu-left { gap: 15px; }
  .desktop-menu-left > span:nth-of-type(n+3) { display: none; }
  .desktop-menu-right { gap: 10px; }
  .desktop-menu-right svg { display: none; }
  .desktop-folders { grid-template-columns: repeat(2,108px); gap: 12px 6px; }
  .desktop-folder > svg { width: 58px; height: 48px; }
  .desktop-live-card { left: 50%; width: 320px; }
}
@media (prefers-reduced-motion: reduce) {
  #workspace-window, #workspace-window.is-minimized { transition: opacity .08s linear,visibility 0s .08s; transform: none; }
  .dock-icon, .desktop-integrity-track i { transition: none; }
  .dock-icon:hover { transform: none; }
}
