/* ============================================================
   Web Desktop OS — Windows & macOS Simulator
   style.css
   ============================================================ */

/* ===== Reset ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; user-select: none; -webkit-user-select: none; }
body { background: #000; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input { font-family: inherit; }

/* ===== CSS Variables: Windows 11 Theme ===== */
.theme-windows {
  --wallpaper: linear-gradient(135deg, #0078D4 0%, #00BCF2 40%, #50E6FF 70%, #A8F0FF 100%);
  --taskbar-bg: rgba(32, 32, 32, 0.78);
  --taskbar-border: rgba(255,255,255,0.08);
  --window-bg: rgba(243, 243, 243, 0.96);
  --titlebar-bg: rgba(243, 243, 243, 0.96);
  --titlebar-height: 32px;
  --window-border: rgba(0,0,0,0.08);
  --window-radius: 8px;
  --accent: #0078D4;
  --accent-hover: #106EBE;
  --text-primary: #1a1a1a;
  --text-secondary: #616161;
  --text-inverse: #ffffff;
  --hover-bg: rgba(0,0,0,0.06);
  --active-bg: rgba(0,120,212,0.15);
  --startmenu-bg: rgba(243, 243, 243, 0.92);
  --shadow-window: 0 8px 32px rgba(0,0,0,0.28), 0 2px 8px rgba(0,0,0,0.15);
  --shadow-elevation: 0 16px 48px rgba(0,0,0,0.35);
  --icon-text-shadow: 0 1px 3px rgba(0,0,0,0.6);
  --menubar-height: 0px;
  --dock-height: 0px;
  --taskbar-height: 48px;
}

/* ===== CSS Variables: macOS Theme ===== */
.theme-macos {
  --wallpaper: linear-gradient(160deg, #FF6B9D 0%, #C06EFF 25%, #7C8CFF 50%, #5AC8FA 75%, #98F5D9 100%);
  --taskbar-bg: transparent;
  --taskbar-border: transparent;
  --window-bg: rgba(246, 246, 246, 0.98);
  --titlebar-bg: rgba(246, 246, 246, 0.98);
  --titlebar-height: 38px;
  --window-border: rgba(0,0,0,0.1);
  --window-radius: 10px;
  --accent: #007AFF;
  --accent-hover: #0056CC;
  --text-primary: #1d1d1f;
  --text-secondary: #86868b;
  --text-inverse: #ffffff;
  --hover-bg: rgba(0,0,0,0.05);
  --active-bg: rgba(0,122,255,0.12);
  --startmenu-bg: rgba(246, 246, 246, 0.95);
  --shadow-window: 0 10px 40px rgba(0,0,0,0.25), 0 4px 12px rgba(0,0,0,0.12);
  --shadow-elevation: 0 20px 60px rgba(0,0,0,0.3);
  --icon-text-shadow: 0 1px 4px rgba(0,0,0,0.5);
  --menubar-height: 28px;
  --dock-height: 80px;
  --taskbar-height: 0px;
}

/* ===== Boot Screen ===== */
#boot-screen {
  position: fixed; inset: 0; z-index: 9999;
  background: #0a0a0a;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 24px; color: #ccc;
  transition: opacity 0.6s ease;
}
#boot-screen.hide { opacity: 0; pointer-events: none; }
.boot-logo { color: #fff; opacity: 0.9; animation: bootPulse 2s ease-in-out infinite; }
@keyframes bootPulse { 0%,100% { opacity: 0.7; } 50% { opacity: 1; } }
.boot-spinner {
  width: 32px; height: 32px; border: 3px solid rgba(255,255,255,0.15);
  border-top-color: #fff; border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.boot-text { font-size: 13px; letter-spacing: 1px; }

/* ===== Desktop ===== */
#desktop {
  position: relative; width: 100vw; height: 100vh;
  background: var(--wallpaper);
  background-size: cover; background-position: center;
  transition: background 0.5s ease;
  min-width: 800px;
}

/* ===== Desktop Icons ===== */
#desktop-icons {
  position: absolute; top: calc(var(--menubar-height) + 16px); left: 16px;
  display: flex; flex-direction: column; flex-wrap: wrap;
  gap: 4px; height: calc(100vh - var(--menubar-height) - var(--dock-height) - var(--taskbar-height) - 40px);
  align-content: flex-start;
}
.desktop-icon {
  width: 80px; padding: 8px 4px; border-radius: 6px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  cursor: pointer; transition: background 0.15s;
}
.desktop-icon:hover { background: rgba(255,255,255,0.15); }
.desktop-icon.selected { background: rgba(0,120,212,0.3); }
.desktop-icon .icon-svg { width: 40px; height: 40px; flex-shrink: 0; }
.desktop-icon span {
  font-size: 12px; color: #fff; text-align: center; line-height: 1.3;
  text-shadow: var(--icon-text-shadow);
  word-break: break-all; max-width: 76px;
}

/* ===== Icon System (CSS-drawn) ===== */
.icon-folder {
  background: linear-gradient(135deg, #FFC107, #FF9800);
  border-radius: 4px; position: relative;
}
.icon-folder::before {
  content: ''; position: absolute; top: -3px; left: 0;
  width: 45%; height: 6px; background: #FFB300; border-radius: 3px 3px 0 0;
}
.icon-notepad {
  background: #fff; border-radius: 3px; position: relative;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.icon-notepad::before {
  content: ''; position: absolute; top: 8px; left: 6px; right: 6px; height: 2px;
  background: #ddd; box-shadow: 0 5px 0 #ddd, 0 10px 0 #ddd, 0 15px 0 #ddd, 0 20px 0 #ddd;
}
.icon-calc {
  background: linear-gradient(180deg, #4a4a4a, #2a2a2a);
  border-radius: 6px; position: relative; overflow: hidden;
}
.icon-calc::before {
  content: ''; position: absolute; top: 5px; left: 5px; right: 5px; height: 8px;
  background: #7dd87d; border-radius: 2px;
}
.icon-calc::after {
  content: ''; position: absolute; bottom: 5px; left: 5px; right: 5px; height: 18px;
  background:
    linear-gradient(#666,#666) 0 0/22% 45% no-repeat,
    linear-gradient(#666,#666) 39% 0/22% 45% no-repeat,
    linear-gradient(#666,#666) 78% 0/22% 45% no-repeat,
    linear-gradient(#f90,#f90) 0 100%/22% 45% no-repeat,
    linear-gradient(#666,#666) 39% 100%/22% 45% no-repeat,
    linear-gradient(#666,#666) 78% 100%/22% 45% no-repeat;
}
.icon-browser {
  background: conic-gradient(from 0deg, #EA4335 0deg 90deg, #FBBC05 90deg 180deg, #34A853 180deg 270deg, #4285F4 270deg 360deg);
  border-radius: 50%; position: relative;
}
.icon-browser::after {
  content: ''; position: absolute; inset: 28%; background: #fff; border-radius: 50%;
}
.icon-browser::before {
  content: ''; position: absolute; inset: 38%; background: #4285F4; border-radius: 50%; z-index: 1;
}
.icon-terminal {
  background: #1e1e1e; border-radius: 5px; position: relative;
}
.icon-terminal::before {
  content: '>_'; position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: #4ec9b0; font-size: 16px; font-weight: bold; font-family: monospace;
}
.icon-settings {
  background: linear-gradient(135deg, #8e8e93, #636366);
  border-radius: 50%; position: relative;
}
.icon-settings::before {
  content: ''; position: absolute; inset: 30%; background: #fff; border-radius: 50%;
}
.icon-settings::after {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(circle at 50% 0%, #636366 3px, transparent 3px),
    radial-gradient(circle at 100% 50%, #636366 3px, transparent 3px),
    radial-gradient(circle at 50% 100%, #636366 3px, transparent 3px),
    radial-gradient(circle at 0% 50%, #636366 3px, transparent 3px);
}
.icon-about {
  background: linear-gradient(135deg, #5AC8FA, #007AFF);
  border-radius: 50%; position: relative;
}
.icon-about::after {
  content: 'i'; position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 20px; font-weight: bold; font-style: italic;
}
.icon-finder {
  background: linear-gradient(180deg, #5AC8FA, #007AFF);
  border-radius: 8px; position: relative;
}
.icon-finder::before {
  content: ''; position: absolute; top: 30%; left: 25%;
  width: 10px; height: 12px; background: #fff; border-radius: 50%;
}
.icon-finder::after {
  content: ''; position: absolute; top: 30%; right: 25%;
  width: 10px; height: 12px; background: #fff; border-radius: 50%;
}
.icon-launchpad {
  background: rgba(255,255,255,0.25); backdrop-filter: blur(10px);
  border-radius: 8px; position: relative;
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 3px; padding: 8px;
}
.icon-launchpad::before {
  content: ''; position: absolute; inset: 8px;
  background:
    radial-gradient(circle, #fff 2px, transparent 2px) 0 0/33% 33%,
    radial-gradient(circle, #fff 2px, transparent 2px) 50% 0/33% 33%,
    radial-gradient(circle, #fff 2px, transparent 2px) 100% 0/33% 33%,
    radial-gradient(circle, #fff 2px, transparent 2px) 0 50%/33% 33%,
    radial-gradient(circle, #fff 2px, transparent 2px) 50% 50%/33% 33%,
    radial-gradient(circle, #fff 2px, transparent 2px) 100% 50%/33% 33%,
    radial-gradient(circle, #fff 2px, transparent 2px) 0 100%/33% 33%,
    radial-gradient(circle, #fff 2px, transparent 2px) 50% 100%/33% 33%,
    radial-gradient(circle, #fff 2px, transparent 2px) 100% 100%/33% 33%;
}
.icon-trash {
  background: linear-gradient(180deg, #e0e0e0, #bdbdbd);
  border-radius: 4px 4px 6px 6px; position: relative;
}
.icon-trash::before {
  content: ''; position: absolute; top: -4px; left: 20%; right: 20%; height: 5px;
  background: #9e9e9e; border-radius: 2px 2px 0 0;
}
.icon-trash::after {
  content: ''; position: absolute; top: 4px; left: 30%; right: 30%; bottom: 6px;
  background: repeating-linear-gradient(90deg, #757575 0, #757575 2px, transparent 2px, transparent 6px);
}
.icon-paint {
  background: conic-gradient(#FF3B30, #FF9500, #FFCC00, #34C759, #007AFF, #5856D6, #FF3B30);
  border-radius: 50%; position: relative;
}
.icon-paint::after {
  content: ''; position: absolute; inset: 30%; background: #fff; border-radius: 50%;
}

/* ===== Window System ===== */
.window {
  position: absolute; min-width: 300px; min-height: 200px;
  background: var(--window-bg);
  border: 1px solid var(--window-border);
  border-radius: var(--window-radius);
  box-shadow: var(--shadow-window);
  display: flex; flex-direction: column; overflow: hidden;
  animation: windowOpen 0.2s ease-out;
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
@keyframes windowOpen {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}
.window.closing { animation: windowClose 0.15s ease-in forwards; }
@keyframes windowClose {
  to { opacity: 0; transform: scale(0.9); }
}
.window.minimized { display: none; }
.window.maximized {
  border-radius: 0; border: none;
  top: var(--menubar-height) !important; left: 0 !important;
  width: 100vw !important; height: calc(100vh - var(--menubar-height) - var(--dock-height) - var(--taskbar-height)) !important;
}

/* Window Title Bar */
.window-titlebar {
  height: var(--titlebar-height); flex-shrink: 0;
  display: flex; align-items: center;
  background: var(--titlebar-bg);
  cursor: move; position: relative;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

/* Windows-style titlebar */
.theme-windows .window-titlebar {
  justify-content: space-between; padding: 0 0 0 12px;
}
.theme-windows .window-title {
  font-size: 12px; color: var(--text-primary); font-weight: 500;
  display: flex; align-items: center; gap: 8px;
}
.theme-windows .window-title .win-title-icon { width: 16px; height: 16px; }
.theme-windows .window-controls { display: flex; height: 100%; }
.theme-windows .win-ctrl-btn {
  width: 46px; height: 100%; display: flex; align-items: center; justify-content: center;
  transition: background 0.15s; color: var(--text-primary);
}
.theme-windows .win-ctrl-btn:hover { background: var(--hover-bg); }
.theme-windows .win-ctrl-btn.close:hover { background: #E81123; color: #fff; }
.theme-windows .win-ctrl-btn svg { width: 12px; height: 12px; }

/* macOS-style titlebar */
.theme-macos .window-titlebar {
  justify-content: center; padding: 0 12px;
}
.theme-macos .window-title {
  font-size: 13px; color: var(--text-primary); font-weight: 600;
}
.theme-macos .window-controls {
  position: absolute; left: 12px; display: flex; gap: 8px; align-items: center;
}
.theme-macos .mac-ctrl-btn {
  width: 12px; height: 12px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: filter 0.15s;
}
.theme-macos .mac-ctrl-btn:hover { filter: brightness(0.85); }
.theme-macos .mac-ctrl-btn.close { background: #FF5F57; }
.theme-macos .mac-ctrl-btn.minimize { background: #FEBC2E; }
.theme-macos .mac-ctrl-btn.maximize { background: #28C840; }
.theme-macos .mac-ctrl-btn svg { width: 8px; height: 8px; opacity: 0; fill: rgba(0,0,0,0.5); }
.theme-macos .window-controls:hover .mac-ctrl-btn svg { opacity: 1; }

/* Window Body */
.window-body {
  flex: 1; overflow: auto; position: relative;
  background: var(--window-bg);
}

/* ===== Windows Taskbar ===== */
#win-taskbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--taskbar-height);
  background: var(--taskbar-bg);
  backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px);
  border-top: 1px solid var(--taskbar-border);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.taskbar-center { display: flex; align-items: center; gap: 4px; }
.taskbar-btn {
  width: 40px; height: 40px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s; color: #fff; position: relative;
}
.taskbar-btn:hover { background: rgba(255,255,255,0.1); }
.taskbar-btn.active { background: rgba(255,255,255,0.15); }
.taskbar-btn.active::after {
  content: ''; position: absolute; bottom: 2px; left: 50%; transform: translateX(-50%);
  width: 16px; height: 3px; border-radius: 2px; background: var(--accent);
}
.start-btn svg { fill: #fff; }
.search-btn { color: rgba(255,255,255,0.7); }
.tb-icon { width: 24px; height: 24px; }
.taskbar-right {
  position: absolute; right: 8px; display: flex; align-items: center; gap: 8px;
  height: 100%;
}
.tray-icons { display: flex; align-items: center; gap: 6px; color: rgba(255,255,255,0.8); }
.tray-item { display: flex; align-items: center; padding: 4px; border-radius: 4px; }
.tray-item:hover { background: rgba(255,255,255,0.1); }
.tray-clock {
  display: flex; flex-direction: column; align-items: flex-end;
  color: #fff; font-size: 11px; line-height: 1.3; padding: 0 8px;
  border-radius: 4px;
}
.tray-clock:hover { background: rgba(255,255,255,0.1); }

/* ===== Windows Start Menu ===== */
#win-start-menu {
  position: fixed; bottom: calc(var(--taskbar-height) + 8px);
  left: 50%; transform: translateX(-50%) translateY(20px);
  width: 620px; height: 640px; max-height: 70vh;
  background: var(--startmenu-bg);
  backdrop-filter: blur(40px); -webkit-backdrop-filter: blur(40px);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 12px;
  box-shadow: var(--shadow-elevation);
  display: none; flex-direction: column;
  padding: 24px; z-index: 200;
  opacity: 0; transition: opacity 0.2s, transform 0.2s;
}
#win-start-menu.show { display: flex; opacity: 1; transform: translateX(-50%) translateY(0); }
.start-search {
  display: flex; align-items: center; gap: 8px;
  background: #fff; border: 1px solid #d1d1d1; border-radius: 6px;
  padding: 8px 12px; margin-bottom: 20px;
}
.start-search input {
  flex: 1; border: none; outline: none; font-size: 13px; background: transparent;
}
.start-section { margin-bottom: 20px; }
.start-section-header {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 12px;
}
.start-all-apps-btn {
  font-size: 11px; color: var(--text-secondary); background: var(--hover-bg);
  padding: 4px 10px; border-radius: 4px;
}
.start-apps-grid {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px;
}
.start-app {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px 4px; border-radius: 6px; cursor: pointer; transition: background 0.15s;
}
.start-app:hover { background: var(--hover-bg); }
.sa-icon { width: 32px; height: 32px; }
.start-app span { font-size: 11px; color: var(--text-primary); text-align: center; }
.start-recommended { display: flex; flex-direction: column; gap: 4px; }
.rec-item {
  display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 6px; cursor: pointer;
}
.rec-item:hover { background: var(--hover-bg); }
.rec-icon { width: 28px; height: 28px; flex-shrink: 0; }
.rec-info { display: flex; flex-direction: column; }
.rec-title { font-size: 12px; color: var(--text-primary); }
.rec-sub { font-size: 11px; color: var(--text-secondary); }
.start-footer {
  margin-top: auto; display: flex; justify-content: space-between; align-items: center;
  padding-top: 16px; border-top: 1px solid rgba(0,0,0,0.06);
}
.start-user { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #50E6FF);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 600; font-size: 14px;
}
.start-user span { font-size: 13px; color: var(--text-primary); }
.start-power {
  width: 36px; height: 36px; border-radius: 6px; display: flex; align-items: center; justify-content: center;
  color: var(--text-primary);
}
.start-power:hover { background: var(--hover-bg); }

/* ===== macOS Menu Bar ===== */
#mac-menubar {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--menubar-height);
  background: rgba(255,255,255,0.25);
  backdrop-filter: blur(30px) saturate(180%); -webkit-backdrop-filter: blur(30px) saturate(180%);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 12px; z-index: 100;
  font-size: 13px; color: var(--text-primary);
  border-bottom: 1px solid rgba(0,0,0,0.05);
}
.mb-left, .mb-right { display: flex; align-items: center; gap: 4px; }
.mb-item {
  padding: 3px 10px; border-radius: 4px; cursor: pointer;
  display: flex; align-items: center; gap: 4px;
  transition: background 0.15s;
}
.mb-item:hover { background: rgba(0,0,0,0.1); }
.mb-apple { padding: 3px 8px; }
.mb-app-name { font-weight: 700; }
.mb-clock { font-weight: 500; cursor: default; }
.mb-clock:hover { background: transparent; }

/* ===== macOS Dock ===== */
#mac-dock {
  position: fixed; bottom: 8px; left: 50%; transform: translateX(-50%);
  height: var(--dock-height);
  background: rgba(255,255,255,0.2);
  backdrop-filter: blur(30px) saturate(180%); -webkit-backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 18px;
  display: flex; align-items: flex-end; gap: 4px;
  padding: 8px 10px; z-index: 100;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.dock-item {
  width: 56px; height: 56px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; position: relative;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.dock-item:hover { transform: translateY(-12px) scale(1.15); }
.dock-item.running::after {
  content: ''; position: absolute; bottom: -4px; left: 50%; transform: translateX(-50%);
  width: 4px; height: 4px; border-radius: 50%; background: rgba(0,0,0,0.5);
}
.dock-icon { width: 48px; height: 48px; }
.dock-divider {
  width: 1px; height: 40px; background: rgba(0,0,0,0.15); margin: 0 4px; align-self: center;
}

/* ===== macOS Launchpad ===== */
#mac-launchpad {
  position: fixed; inset: 0; z-index: 150;
  background: rgba(0,0,0,0.3);
  backdrop-filter: blur(30px) saturate(150%); -webkit-backdrop-filter: blur(30px) saturate(150%);
  display: none; flex-direction: column; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.25s;
}
#mac-launchpad.show { display: flex; opacity: 1; }
.launchpad-search { margin-bottom: 40px; }
.launchpad-search input {
  width: 280px; padding: 10px 16px; border-radius: 10px;
  border: none; background: rgba(255,255,255,0.15);
  color: #fff; font-size: 14px; text-align: center; outline: none;
}
.launchpad-search input::placeholder { color: rgba(255,255,255,0.6); }
.launchpad-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 32px 40px;
  max-width: 700px;
}
.lp-app {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  cursor: pointer; transition: transform 0.15s;
}
.lp-app:hover { transform: scale(1.05); }
.lp-icon { width: 64px; height: 64px; border-radius: 14px; box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
.lp-app span { font-size: 12px; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,0.5); }

/* ===== Context Menu ===== */
#context-menu {
  position: fixed; z-index: 300;
  background: var(--window-bg);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--window-border);
  border-radius: 8px; padding: 6px; min-width: 200px;
  box-shadow: var(--shadow-elevation);
  display: none;
}
#context-menu.show { display: block; }
.ctx-item {
  padding: 8px 14px; font-size: 13px; color: var(--text-primary);
  border-radius: 5px; cursor: pointer; transition: background 0.1s;
}
.ctx-item:hover { background: var(--accent); color: #fff; }
.ctx-divider { height: 1px; background: rgba(0,0,0,0.08); margin: 4px 8px; }

/* ===== Theme Switch Button ===== */
#theme-switch-btn {
  position: fixed; top: calc(var(--menubar-height) + 12px); right: 140px;
  z-index: 50; display: flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 20px;
  background: rgba(0,0,0,0.4); color: #fff;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  font-size: 12px; font-weight: 500;
  transition: background 0.2s, transform 0.15s;
  border: 1px solid rgba(255,255,255,0.15);
}
#theme-switch-btn:hover { background: rgba(0,0,0,0.6); transform: translateY(-1px); }
#theme-switch-btn:active { transform: translateY(0); }
#theme-switch-btn .ts-icon { display: none; }
#desktop.theme-windows #theme-switch-btn .ts-win { display: block; }
#desktop.theme-macos #theme-switch-btn .ts-mac { display: block; }

/* ===== Download Source Button ===== */
#download-source-btn {
  position: fixed; top: calc(var(--menubar-height) + 12px); right: 12px;
  z-index: 50; display: flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 20px;
  background: rgba(0,0,0,0.4); color: #fff;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  font-size: 12px; font-weight: 500;
  transition: background 0.2s, transform 0.15s;
  border: 1px solid rgba(255,255,255,0.15);
}
#download-source-btn:hover { background: rgba(0,0,0,0.6); transform: translateY(-1px); }
#download-source-btn:active { transform: translateY(0); }

/* ===== Toast ===== */
#toast {
  position: fixed; bottom: calc(var(--taskbar-height) + var(--dock-height) + 20px);
  left: 50%; transform: translateX(-50%) translateY(20px);
  background: rgba(0,0,0,0.8); color: #fff;
  padding: 12px 24px; border-radius: 8px; font-size: 13px;
  z-index: 500; opacity: 0; transition: opacity 0.3s, transform 0.3s;
  pointer-events: none; backdrop-filter: blur(10px);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== App: Notepad ===== */
.app-notepad { width: 100%; height: 100%; display: flex; flex-direction: column; }
.notepad-toolbar {
  height: 36px; display: flex; align-items: center; gap: 4px;
  padding: 0 8px; border-bottom: 1px solid rgba(0,0,0,0.06);
  background: var(--titlebar-bg);
}
.notepad-toolbar button {
  padding: 4px 10px; font-size: 12px; border-radius: 4px; color: var(--text-primary);
}
.notepad-toolbar button:hover { background: var(--hover-bg); }
.notepad-textarea {
  flex: 1; width: 100%; border: none; outline: none; resize: none;
  padding: 12px 16px; font-size: 14px; line-height: 1.6;
  background: transparent; color: var(--text-primary);
  font-family: "Consolas", "Monaco", monospace;
}

/* ===== App: Calculator ===== */
.app-calculator { width: 100%; height: 100%; display: flex; flex-direction: column; padding: 12px; gap: 10px; background: #2a2a2a; }
.calc-display {
  flex: 0 0 80px; display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-end;
  padding: 0 12px; color: #fff; overflow: hidden;
}
.calc-expression { font-size: 14px; color: #999; min-height: 18px; }
.calc-result { font-size: 42px; font-weight: 300; line-height: 1; }
.calc-buttons { flex: 1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.calc-btn {
  border-radius: 8px; font-size: 18px; font-weight: 500;
  display: flex; align-items: center; justify-content: center;
  transition: filter 0.1s; color: #fff; background: #4a4a4a;
}
.calc-btn:hover { filter: brightness(1.2); }
.calc-btn:active { filter: brightness(0.9); }
.calc-btn.func { background: #3a3a3a; }
.calc-btn.op { background: #f90; }
.calc-btn.equal { background: #f90; }
.calc-btn.zero { grid-column: span 2; }

/* ===== App: Browser ===== */
.app-browser { width: 100%; height: 100%; display: flex; flex-direction: column; }
.browser-toolbar {
  height: 42px; display: flex; align-items: center; gap: 8px;
  padding: 0 12px; border-bottom: 1px solid rgba(0,0,0,0.08);
  background: var(--titlebar-bg);
}
.browser-nav-btn {
  width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
}
.browser-nav-btn:hover { background: var(--hover-bg); }
.browser-address {
  flex: 1; height: 30px; display: flex; align-items: center; gap: 8px;
  background: var(--hover-bg); border-radius: 15px; padding: 0 14px;
  font-size: 12px; color: var(--text-primary);
}
.browser-address input { flex: 1; border: none; outline: none; background: transparent; font-size: 12px; }
.browser-content { flex: 1; overflow: auto; background: #fff; padding: 40px; }
.browser-home { max-width: 600px; margin: 0 auto; text-align: center; }
.browser-home h1 {
  font-size: 48px; font-weight: 300; margin-bottom: 24px;
  background: linear-gradient(90deg, #4285F4, #EA4335, #FBBC05, #34A853);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.browser-search-box {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid #dfe1e5; border-radius: 24px; padding: 10px 16px;
  box-shadow: 0 1px 6px rgba(32,33,36,0.1);
}
.browser-search-box input { flex: 1; border: none; outline: none; font-size: 14px; }
.browser-links { margin-top: 24px; display: flex; gap: 16px; justify-content: center; }
.browser-links a { color: var(--accent); font-size: 13px; text-decoration: none; }
.browser-links a:hover { text-decoration: underline; }

/* ===== App: File Manager ===== */
.app-files { width: 100%; height: 100%; display: flex; }
.files-sidebar {
  width: 180px; flex-shrink: 0; background: rgba(0,0,0,0.03);
  border-right: 1px solid rgba(0,0,0,0.06); padding: 12px 8px;
  display: flex; flex-direction: column; gap: 2px;
}
.files-sidebar-title { font-size: 11px; color: var(--text-secondary); padding: 8px 10px 4px; font-weight: 600; text-transform: uppercase; }
.files-sidebar-item {
  display: flex; align-items: center; gap: 8px; padding: 6px 10px;
  border-radius: 6px; font-size: 13px; color: var(--text-primary); cursor: pointer;
}
.files-sidebar-item:hover { background: var(--hover-bg); }
.files-sidebar-item.active { background: var(--active-bg); color: var(--accent); }
.files-sidebar-item .fs-icon { width: 16px; height: 16px; flex-shrink: 0; }
.files-main { flex: 1; padding: 16px; overflow: auto; }
.files-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 12px; }
.file-item {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px 6px; border-radius: 8px; cursor: pointer; text-align: center;
}
.file-item:hover { background: var(--hover-bg); }
.file-item .fi-icon { width: 48px; height: 48px; }
.file-item span { font-size: 12px; color: var(--text-primary); word-break: break-all; }

/* ===== App: Terminal ===== */
.app-terminal { width: 100%; height: 100%; background: #1e1e1e; padding: 12px; overflow: auto; font-family: "Consolas", "Monaco", monospace; font-size: 13px; color: #d4d4d4; }
.terminal-line { white-space: pre-wrap; word-break: break-all; line-height: 1.5; }
.terminal-prompt { color: #4ec9b0; }
.terminal-input-line { display: flex; align-items: center; }
.terminal-input-line .terminal-prompt { flex-shrink: 0; }
.terminal-input {
  flex: 1; background: transparent; border: none; outline: none;
  color: #d4d4d4; font-family: inherit; font-size: inherit; margin-left: 6px;
}
.terminal-cursor { display: inline-block; width: 8px; height: 15px; background: #d4d4d4; animation: blink 1s step-end infinite; vertical-align: middle; }
@keyframes blink { 50% { opacity: 0; } }

/* ===== App: Settings ===== */
.app-settings { width: 100%; height: 100%; display: flex; }
.settings-sidebar {
  width: 200px; flex-shrink: 0; padding: 16px 8px;
  background: rgba(0,0,0,0.02); border-right: 1px solid rgba(0,0,0,0.06);
}
.settings-nav-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  border-radius: 8px; font-size: 13px; color: var(--text-primary); cursor: pointer;
  margin-bottom: 2px;
}
.settings-nav-item:hover { background: var(--hover-bg); }
.settings-nav-item.active { background: var(--active-bg); color: var(--accent); font-weight: 500; }
.settings-main { flex: 1; padding: 24px 32px; overflow: auto; }
.settings-section { margin-bottom: 32px; }
.settings-section h3 { font-size: 18px; margin-bottom: 16px; color: var(--text-primary); }
.settings-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0; border-bottom: 1px solid rgba(0,0,0,0.06);
}
.settings-row label { font-size: 14px; color: var(--text-primary); }
.settings-row .settings-desc { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.theme-switcher { display: flex; gap: 12px; }
.theme-option {
  width: 120px; padding: 12px; border: 2px solid transparent; border-radius: 10px;
  cursor: pointer; text-align: center; transition: all 0.2s;
}
.theme-option:hover { border-color: var(--accent); }
.theme-option.active { border-color: var(--accent); background: var(--active-bg); }
.theme-preview {
  width: 100%; height: 60px; border-radius: 6px; margin-bottom: 8px;
}
.theme-preview.win-preview { background: linear-gradient(135deg, #0078D4, #50E6FF); }
.theme-preview.mac-preview { background: linear-gradient(160deg, #FF6B9D, #5AC8FA); }
.theme-option span { font-size: 12px; color: var(--text-primary); font-weight: 500; }
.wallpaper-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.wallpaper-thumb {
  aspect-ratio: 16/10; border-radius: 8px; cursor: pointer;
  border: 3px solid transparent; transition: border-color 0.2s;
}
.wallpaper-thumb:hover { border-color: var(--accent); }
.wallpaper-thumb.active { border-color: var(--accent); }

/* ===== App: About ===== */
.app-about { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px; text-align: center; }
.about-logo { width: 80px; height: 80px; margin-bottom: 20px; }
.about-logo.icon-about { border-radius: 50%; }
.app-about h2 { font-size: 24px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.app-about .about-version { font-size: 13px; color: var(--text-secondary); margin-bottom: 24px; }
.about-specs { width: 100%; max-width: 360px; text-align: left; }
.about-spec-row {
  display: flex; justify-content: space-between; padding: 8px 0;
  border-bottom: 1px solid rgba(0,0,0,0.06); font-size: 13px;
}
.about-spec-row .spec-label { color: var(--text-secondary); }
.about-spec-row .spec-value { color: var(--text-primary); font-weight: 500; }

/* ===== App: Paint ===== */
.app-paint { width: 100%; height: 100%; display: flex; flex-direction: column; }
.paint-toolbar {
  height: 44px; display: flex; align-items: center; gap: 8px;
  padding: 0 12px; border-bottom: 1px solid rgba(0,0,0,0.06);
  background: var(--titlebar-bg);
}
.paint-color { width: 24px; height: 24px; border-radius: 4px; cursor: pointer; border: 2px solid transparent; }
.paint-color.active { border-color: var(--accent); }
.paint-size { width: 60px; }
.paint-canvas-wrap { flex: 1; overflow: hidden; background: #fff; }
.paint-canvas { display: block; cursor: crosshair; }

/* ===== Utility: Theme-based visibility ===== */
/* Windows theme (default): show Win chrome, hide Mac chrome */
#desktop.theme-windows #mac-menubar,
#desktop.theme-windows #mac-dock,
#desktop.theme-windows #mac-launchpad {
  display: none !important;
}

/* macOS theme: hide Win chrome, show Mac chrome */
#desktop.theme-macos #win-taskbar,
#desktop.theme-macos #win-start-menu {
  display: none !important;
}
#desktop.theme-macos #mac-menubar {
  display: flex;
}
#desktop.theme-macos #mac-dock {
  display: flex;
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.35); }
