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

html {
  background: linear-gradient(135deg, #0a1628 0%, #0f2847 50%, #0a1e3d 100%);
  min-height: 100%;
  scrollbar-width: none;
}

html::-webkit-scrollbar { display: none; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(135deg, #0a1628 0%, #0f2847 50%, #0a1e3d 100%);
  background-attachment: fixed;
  color: #e0e8f0;
  min-height: 100vh;
  padding: 40px;
  padding-bottom: 60px;
  user-select: none;
}

.desktop {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 8px;
}

.icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100px;
  padding: 12px 8px;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
  position: relative;
}

.icon:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}

.icon:active {
  background: rgba(255, 255, 255, 0.14);
}

.icon svg {
  width: 56px;
  height: 56px;
  margin-bottom: 6px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
}

.icon-label {
  font-size: 11px;
  font-weight: 500;
  text-align: center;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
  line-height: 1.3;
  word-break: break-word;
}

.taskbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 36px;
  background: rgba(10, 16, 30, 0.85);
  backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 4px;
  font-size: 12px;
  color: #8899aa;
  z-index: 10000;
}

.taskbar-label {
  margin-right: 8px;
  white-space: nowrap;
}

.taskbar-tabs {
  display: flex;
  gap: 4px;
  overflow: hidden;
}

.taskbar-zoom {
  width: 24px;
  height: 24px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 4px;
  background: rgba(255,255,255,0.06);
  color: #8899aa;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  padding: 0;
}

.taskbar-zoom:hover { background: rgba(255,255,255,0.12); color: #cde; }

.taskbar-zoom-label {
  font-size: 10px;
  color: #667;
  min-width: 32px;
  text-align: center;
  font-family: 'SF Mono', monospace;
  cursor: pointer;
}

.taskbar-zoom-label:hover { color: #aab; }

.desktop-switcher {
  display: flex;
  gap: 3px;
  margin-right: 8px;
}

.desktop-btn {
  width: 22px;
  height: 22px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 4px;
  background: rgba(255,255,255,0.04);
  color: #667;
  cursor: pointer;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  padding: 0;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
}

.desktop-btn:hover { background: rgba(255,255,255,0.1); color: #aab; }

.desktop-btn.active {
  background: rgba(255,255,255,0.15);
  color: #cde;
  border-color: rgba(255,255,255,0.25);
}

.taskbar-tab {
  display: flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px;
  color: #8899aa;
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.1s;
}

.taskbar-tab:hover {
  background: rgba(255,255,255,0.12);
  color: #aabbcc;
}

.taskbar-tab.active {
  background: rgba(255,255,255,0.15);
  color: #ccdde8;
  border-color: rgba(255,255,255,0.2);
}

.window-update-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 30px;
  background: linear-gradient(90deg, #1a3a5c, #1e4a6e);
  border-bottom: 1px solid rgba(100,180,255,0.3);
  color: #8cc8ff;
  font-size: 12px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}

.window-update-banner:hover {
  background: linear-gradient(90deg, #1e4a6e, #24587e);
  color: #b0ddff;
}

.window-update-banner button {
  background: rgba(100,180,255,0.2);
  border: 1px solid rgba(100,180,255,0.3);
  color: #8cc8ff;
  padding: 2px 10px;
  border-radius: 3px;
  font-size: 11px;
  cursor: pointer;
}

.window-update-banner button:hover {
  background: rgba(100,180,255,0.3);
  color: #b0ddff;
}

.window.minimized { display: none; }

.window.backgrounded { z-index: 1 !important; }

.window.backgrounded .window-titlebar { display: none; }

.taskbar-tab.backgrounded {
  opacity: 0.5;
  font-style: italic;
}

.window.maximized {
  left: 0 !important;
  top: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  border-radius: 0;
  border: none;
}

.window.maximized .resize-handle { display: none; }

.window.maximized .window-titlebar { border-radius: 0; }

.window {
  position: fixed;
  background: #1a2235;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 2px 8px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
  min-width: 200px;
  min-height: 120px;
  z-index: 1000;
  overflow: hidden;
}

.window.active {
  box-shadow: 0 12px 48px rgba(0,0,0,0.6), 0 4px 12px rgba(0,0,0,0.4);
  border-color: rgba(255,255,255,0.2);
}

.window-titlebar {
  display: flex;
  align-items: center;
  height: 32px;
  background: rgba(15, 20, 35, 0.95);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding: 0 8px;
  cursor: grab;
  flex-shrink: 0;
}

.window-titlebar:active { cursor: grabbing; }

.window-title {
  flex: 1;
  font-size: 12px;
  font-weight: 500;
  color: #8899aa;
  padding-left: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.window-btn {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: #667788;
  cursor: pointer;
  border-radius: 4px;
  font-size: 14px;
  line-height: 1;
  transition: background 0.1s, color 0.1s;
  text-decoration: none;
}

.window-btn:hover {
  background: rgba(255,255,255,0.12);
  color: #aabbcc;
}

.window-close {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: #667788;
  cursor: pointer;
  border-radius: 4px;
  font-size: 16px;
  line-height: 1;
  transition: background 0.1s, color 0.1s;
}

.window-close:hover {
  background: #e04050;
  color: #fff;
}

.window iframe {
  flex: 1;
  border: none;
  width: 100%;
  height: 100%;
  background: #0f1923;
}

.resize-handle { position: absolute; }

.resize-handle-e {
  top: 0;
  right: -3px;
  width: 6px;
  height: 100%;
  cursor: e-resize;
}

.resize-handle-s {
  bottom: -3px;
  left: 0;
  width: 100%;
  height: 6px;
  cursor: s-resize;
}

.resize-handle-se {
  bottom: -4px;
  right: -4px;
  width: 12px;
  height: 12px;
  cursor: se-resize;
}

.resize-handle-w {
  top: 0;
  left: -3px;
  width: 6px;
  height: 100%;
  cursor: w-resize;
}

.resize-handle-n {
  top: -3px;
  left: 0;
  width: 100%;
  height: 6px;
  cursor: n-resize;
}

.resize-handle-ne {
  top: -4px;
  right: -4px;
  width: 12px;
  height: 12px;
  cursor: ne-resize;
}

.resize-handle-nw {
  top: -4px;
  left: -4px;
  width: 12px;
  height: 12px;
  cursor: nw-resize;
}

.resize-handle-sw {
  bottom: -4px;
  left: -4px;
  width: 12px;
  height: 12px;
  cursor: sw-resize;
}

.window-btn.window-refine {
  font-size: 11px;
  width: auto;
  padding: 0 6px;
  color: #a78bfa;
}

.window-btn.window-refine:hover {
  background: rgba(167, 139, 250, 0.2);
  color: #c4b5fd;
}

.window-btn.window-edit {
  font-size: 11px;
  width: auto;
  padding: 0 6px;
  color: #5b8def;
}

.window-btn.window-edit:hover {
  background: rgba(91, 141, 239, 0.2);
  color: #7fadff;
}

.icon .icon-delete {
  display: none;
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(224, 64, 80, 0.9);
  color: #fff;
  font-size: 12px;
  line-height: 18px;
  text-align: center;
  cursor: pointer;
  border: none;
}

.icon:hover .icon-delete { display: block; }

.context-menu {
  display: none;
  position: fixed;
  z-index: 100000;
  background: rgba(15, 20, 35, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  padding: 4px 0;
  min-width: 140px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

.context-menu.visible { display: block; }

.context-menu-item {
  padding: 6px 14px;
  font-size: 12px;
  color: #aab;
  cursor: pointer;
  display: block;
  width: 100%;
  background: none;
  border: none;
  text-align: left;
  font-family: inherit;
}

.context-menu-item:hover { background: rgba(255,255,255,0.08); color: #e0e8f0; }

.context-menu-sep { height: 1px; background: rgba(255,255,255,0.08); margin: 4px 0; }

.folder-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100px;
  padding: 12px 8px;
  border-radius: 8px;
  color: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
  position: relative;
}

.folder-icon:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}

.folder-icon:active { background: rgba(255, 255, 255, 0.14); }

.folder-icon svg {
  width: 56px;
  height: 56px;
  margin-bottom: 6px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
}

.folder-icon .icon-label {
  font-size: 11px;
  font-weight: 500;
  text-align: center;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
  line-height: 1.3;
  word-break: break-word;
}

.folder-icon .folder-badge {
  position: absolute;
  top: 4px;
  right: 8px;
  font-size: 9px;
  color: #667;
  background: rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 1px 5px;
  min-width: 16px;
  text-align: center;
}

.folder-panel {
  display: none;
  position: fixed;
  z-index: 50000;
  background: rgba(15, 20, 35, 0.95);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 12px;
  min-width: 220px;
  max-width: 440px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.5);
}

.folder-panel.visible { display: block; }

.folder-panel-title {
  font-size: 13px;
  font-weight: 600;
  color: #cde;
  margin-bottom: 10px;
  padding: 0 4px;
}

.folder-panel-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.folder-panel .icon {
  width: 88px;
  padding: 8px 6px;
}

.folder-panel .icon svg {
  width: 44px;
  height: 44px;
  margin-bottom: 4px;
}

.folder-panel .icon-label { font-size: 10px; }

.folder-drop-target {
  outline: 2px dashed rgba(167, 139, 250, 0.5);
  outline-offset: -2px;
  background: rgba(167, 139, 250, 0.08) !important;
}

.drag-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 99999;
}

.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.6);
  z-index: 200000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.visible { display: flex; }

.modal {
  background: #1a2235;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  padding: 16px;
  min-width: 340px;
  max-width: 500px;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 48px rgba(0,0,0,0.6);
}

.modal-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  color: #e0e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-close {
  background: none;
  border: none;
  color: #667;
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
  border-radius: 4px;
}

.modal-close:hover { color: #e04050; background: rgba(224,64,80,0.15); }

.modal-body { overflow-y: auto; flex: 1; }

.perm-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.6);
  z-index: 300000;
  align-items: center;
  justify-content: center;
}

.perm-overlay.visible { display: flex; }

.perm-dialog {
  background: #1a2235;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  padding: 20px;
  min-width: 340px;
  max-width: 420px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.6);
  text-align: center;
}

.perm-dialog .perm-icon { font-size: 28px; margin-bottom: 8px; }
.perm-dialog .perm-title { font-size: 14px; font-weight: 600; color: #e0e8f0; margin-bottom: 6px; }
.perm-dialog .perm-detail { font-size: 12px; color: #8899aa; margin-bottom: 16px; line-height: 1.5; }
.perm-dialog .perm-app { color: #4a9eff; font-weight: 500; }
.perm-dialog .perm-buttons { display: flex; gap: 8px; justify-content: center; }

.perm-dialog .perm-btn {
  padding: 6px 20px;
  font-size: 12px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: #8899aa;
  cursor: pointer;
  font-family: inherit;
}

.perm-dialog .perm-btn:hover { background: rgba(255,255,255,0.12); color: #cde; }
.perm-dialog .perm-btn.allow { color: #34d399; border-color: rgba(52,211,153,0.3); }
.perm-dialog .perm-btn.allow:hover { background: rgba(52,211,153,0.15); }
.perm-dialog .perm-btn.deny { color: #f87171; border-color: rgba(248,113,113,0.3); }
.perm-dialog .perm-btn.deny:hover { background: rgba(248,113,113,0.15); }

.perm-remember {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #667788;
  margin-bottom: 12px;
  cursor: pointer;
  justify-content: center;
}

.perm-remember input { cursor: pointer; }
