/* ========== Windows 12 — Fluent / Mica ========== */
:root {
  --accent: #4cc2ff;
  --accent-2: #0078d4;
  --bg: #0a1733;
  --fg: #ffffff;
  --fg-dim: rgba(255,255,255,0.7);
  --fg-faint: rgba(255,255,255,0.4);
  --panel: rgba(32, 32, 32, 0.65);
  --panel-2: rgba(40, 40, 40, 0.85);
  --panel-border: rgba(255,255,255,0.08);
  --hover: rgba(255,255,255,0.06);
  --hover-strong: rgba(255,255,255,0.12);
  --titlebar: rgba(28,28,28,0.6);
  --shadow: 0 20px 60px rgba(0,0,0,0.55);
  --radius: 10px;
  --radius-lg: 14px;
  --tb-h: 52px;
  --easing: cubic-bezier(0.22, 1, 0.36, 1);
}

body.theme-light {
  --bg: #f3f3f3;
  --fg: #1a1a1a;
  --fg-dim: rgba(0,0,0,0.7);
  --fg-faint: rgba(0,0,0,0.4);
  --panel: rgba(243, 243, 243, 0.78);
  --panel-2: rgba(252, 252, 252, 0.92);
  --panel-border: rgba(0,0,0,0.08);
  --hover: rgba(0,0,0,0.05);
  --hover-strong: rgba(0,0,0,0.08);
  --titlebar: rgba(248,248,248,0.7);
  --shadow: 0 20px 60px rgba(0,0,0,0.20);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; height: 100%; width: 100%;
  font-family: 'Segoe UI Variable', 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--fg);
  background: var(--bg);
  overflow: hidden;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input { font: inherit; color: inherit; }
.hidden { display: none !important; }

/* ========== Wallpaper ========== */
.wallpaper {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 30% 20%, #1e3a8a 0%, #0a1733 45%, #050b1f 100%),
              linear-gradient(135deg, #0a1733, #1e3a8a);
  background-blend-mode: screen;
  overflow: hidden;
}
.wallpaper::before {
  content: ""; position: absolute; inset: -10%;
  background:
    radial-gradient(ellipse 600px 400px at 70% 30%, rgba(76,194,255,0.35), transparent 70%),
    radial-gradient(ellipse 500px 500px at 20% 80%, rgba(124,58,237,0.30), transparent 70%),
    radial-gradient(ellipse 700px 350px at 85% 85%, rgba(0,120,212,0.30), transparent 70%);
  filter: blur(8px);
  animation: wp 22s ease-in-out infinite alternate;
}
.wallpaper::after {
  content: ""; position: absolute; inset: 0;
  background-image:
    radial-gradient(rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 4px 4px;
  opacity: 0.4;
  pointer-events: none;
}
@keyframes wp {
  0%   { transform: translate(0,0) scale(1); }
  100% { transform: translate(-2%, -1%) scale(1.05); }
}

body.theme-light .wallpaper {
  background: radial-gradient(ellipse at 30% 20%, #cfe6ff 0%, #f3f3f3 60%, #e8eef5 100%);
}
body.theme-light .wallpaper::before {
  background:
    radial-gradient(ellipse 600px 400px at 70% 30%, rgba(76,194,255,0.35), transparent 70%),
    radial-gradient(ellipse 500px 500px at 20% 80%, rgba(124,58,237,0.18), transparent 70%);
}

/* ========== Boot / Lock / Login / Shutdown ========== */
.boot, .shutdown {
  position: fixed; inset: 0;
  background: #000;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 32px; z-index: 9999;
}
.boot-logo svg { filter: drop-shadow(0 4px 30px rgba(76,194,255,0.5)); }
.boot-spinner {
  position: relative; width: 60px; height: 18px;
}
.boot-spinner div {
  position: absolute; top: 6px; width: 6px; height: 6px;
  background: #fff; border-radius: 50%;
  animation: dots 1.6s linear infinite;
}
.boot-spinner div:nth-child(1) { left: 0;  animation-delay: 0s; }
.boot-spinner div:nth-child(2) { left: 12px; animation-delay: 0.16s; }
.boot-spinner div:nth-child(3) { left: 24px; animation-delay: 0.32s; }
.boot-spinner div:nth-child(4) { left: 36px; animation-delay: 0.48s; }
.boot-spinner div:nth-child(5) { left: 48px; animation-delay: 0.64s; }
@keyframes dots {
  0%, 50%, 100% { opacity: 0.2; transform: scale(0.7); }
  25% { opacity: 1; transform: scale(1.2); }
}
.boot-text { color: #ddd; font-size: 14px; letter-spacing: 0.5px; }

/* Lock screen */
.lock { position: fixed; inset: 0; z-index: 9000; }
.lock-bg, .login-bg {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 30% 30%, #1e3a8a 0%, #050b1f 80%);
}
.lock-bg::after, .login-bg::after {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 800px 500px at 70% 30%, rgba(76,194,255,0.35), transparent 70%),
    radial-gradient(ellipse 500px 500px at 20% 80%, rgba(124,58,237,0.30), transparent 70%);
}
.lock-content {
  position: absolute; left: 0; right: 0; bottom: 12%;
  display: flex; flex-direction: column; align-items: center;
  text-shadow: 0 2px 16px rgba(0,0,0,0.6);
}
.lock-time { font-size: 96px; font-weight: 200; line-height: 1; }
.lock-date { font-size: 22px; font-weight: 300; margin-top: 6px; opacity: 0.9; }
.lock-hint { margin-top: 36px; font-size: 13px; opacity: 0.7; }

/* Login */
.login { position: fixed; inset: 0; z-index: 9000; }
.login-card {
  position: absolute; left: 50%; top: 45%;
  transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center;
  gap: 14px; min-width: 280px;
}
.login-avatar {
  width: 124px; height: 124px; border-radius: 50%;
  background: rgba(255,255,255,0.1);
  display: flex; align-items: center; justify-content: center;
  font-size: 60px;
  border: 2px solid rgba(255,255,255,0.2);
  backdrop-filter: blur(12px);
}
.login-name { font-size: 28px; font-weight: 300; }
.login-input input {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 4px;
  padding: 10px 14px;
  width: 280px;
  outline: none;
  text-align: center;
  backdrop-filter: blur(12px);
  color: white;
}
.login-input input::placeholder { color: rgba(255,255,255,0.6); }
.login-input input:focus { border-color: var(--accent); }
.login-options {
  position: absolute; bottom: -200px;
  display: flex; gap: 16px;
}
.login-opt {
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(0,0,0,0.3);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  transition: background 0.15s;
}
.login-opt:hover { background: rgba(0,0,0,0.5); }

/* ========== Desktop ========== */
.desktop { position: fixed; inset: 0; }

/* Desktop icons */
.desktop-icons {
  position: absolute; top: 16px; left: 16px;
  display: grid; grid-auto-flow: column; grid-template-rows: repeat(8, 96px);
  gap: 4px;
  z-index: 1;
}
.dicon {
  width: 86px; padding: 8px 4px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  border-radius: 6px;
  cursor: pointer;
  text-align: center;
  transition: background 0.1s;
}
.dicon:hover { background: rgba(255,255,255,0.12); }
.dicon.selected { background: rgba(76,194,255,0.25); outline: 1px solid rgba(76,194,255,0.5); }
.dicon-img { font-size: 38px; line-height: 1; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5)); }
.dicon-name {
  font-size: 12px; color: white; text-shadow: 0 1px 2px rgba(0,0,0,0.8);
  word-break: break-word;
}

/* ========== Taskbar ========== */
.taskbar {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: var(--tb-h);
  background: var(--titlebar);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border-top: 1px solid var(--panel-border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 4px 0 8px;
  z-index: 1000;
}
.tb-tray-left, .tb-tray-right {
  display: flex; align-items: center; gap: 4px;
}
.tb-tray-left { min-width: 200px; }
.tb-tray-right { min-width: 200px; justify-content: flex-end; }
.tb-center {
  display: flex; align-items: center; gap: 4px;
  position: absolute; left: 50%; transform: translateX(-50%);
}
.tb-icon {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
  font-size: 18px;
  position: relative;
  transition: background 0.12s;
}
.tb-icon:hover { background: var(--hover); }
.tb-icon.active::after {
  content: ""; position: absolute; bottom: 2px; left: 50%;
  transform: translateX(-50%);
  width: 16px; height: 3px;
  background: var(--accent); border-radius: 2px;
}
.tb-icon.has-window::after {
  content: ""; position: absolute; bottom: 4px; left: 50%;
  transform: translateX(-50%);
  width: 6px; height: 3px;
  background: var(--fg-dim); border-radius: 2px;
}
.tb-icon.has-window.active::after {
  width: 18px; background: var(--accent);
}
.tb-divider { width: 1px; height: 24px; background: var(--panel-border); margin: 0 4px; }
.tb-apps { display: flex; gap: 4px; }
.tb-tray-icons {
  display: flex; gap: 4px;
  padding: 6px 8px; border-radius: 6px;
  font-size: 14px;
  transition: background 0.12s;
}
.tb-tray-icons:hover { background: var(--hover); }
.tb-clock {
  display: flex; flex-direction: column; align-items: flex-end;
  padding: 4px 10px;
  font-size: 12px; line-height: 1.2;
  border-radius: 6px;
  transition: background 0.12s;
}
.tb-clock:hover { background: var(--hover); }
.tb-bell { width: 36px; height: 36px; border-radius: 6px; font-size: 14px; transition: background 0.12s; }
.tb-bell:hover { background: var(--hover); }
.tb-show-desktop {
  width: 6px; height: 100%;
  margin-left: 2px;
  border-left: 1px solid var(--panel-border);
}
.tb-show-desktop:hover { background: var(--hover); }

/* ========== Start menu ========== */
.start {
  position: absolute; bottom: calc(var(--tb-h) + 10px); left: 50%;
  transform: translateX(-50%);
  width: 640px; max-height: 700px;
  background: var(--panel-2);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 24px;
  display: flex; flex-direction: column; gap: 18px;
  z-index: 999;
  animation: pop-up 0.22s var(--easing);
}
@keyframes pop-up {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.start-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--hover);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  padding: 8px 12px;
}
.start-search input {
  flex: 1; background: none; border: 0; outline: none;
}
.start-section { display: flex; flex-direction: column; gap: 10px; }
.start-head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px;
}
.start-head button { font-size: 12px; color: var(--fg-dim); padding: 4px 10px; border-radius: 4px; }
.start-head button:hover { background: var(--hover); }
.start-pinned {
  display: grid; grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}
.start-app {
  display: flex; flex-direction: column; align-items: center;
  gap: 6px; padding: 12px 4px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s;
}
.start-app:hover { background: var(--hover); }
.start-app .ic { font-size: 28px; line-height: 1; }
.start-app .nm { font-size: 11px; text-align: center; line-height: 1.3; }
.start-recommended {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}
.start-rec {
  display: flex; align-items: center; gap: 10px;
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s;
}
.start-rec:hover { background: var(--hover); }
.start-rec .ic { font-size: 24px; }
.start-rec .nm { font-size: 12px; }
.start-rec .meta { font-size: 11px; color: var(--fg-faint); }
.start-foot {
  display: flex; justify-content: space-between; align-items: center;
  border-top: 1px solid var(--panel-border);
  padding-top: 12px;
}
.start-user { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border-radius: 4px; cursor: pointer; }
.start-user:hover { background: var(--hover); }
.start-user .avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 14px; }
#startPower { width: 36px; height: 36px; border-radius: 50%; transition: background 0.12s; }
#startPower:hover { background: var(--hover); }

/* ========== Search popup ========== */
.search-pop {
  position: absolute; bottom: calc(var(--tb-h) + 10px); left: 50%;
  transform: translateX(-50%);
  width: 640px; height: 600px;
  background: var(--panel-2);
  backdrop-filter: blur(40px) saturate(180%);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  z-index: 998;
  display: flex; flex-direction: column;
  animation: pop-up 0.22s var(--easing);
}
.search-input-wrap {
  padding: 16px;
  display: flex; gap: 10px; align-items: center;
  border-bottom: 1px solid var(--panel-border);
}
.search-input-wrap input {
  flex: 1; background: none; border: 0; outline: none; font-size: 16px;
}
.search-tabs { display: flex; gap: 4px; padding: 8px 16px; border-bottom: 1px solid var(--panel-border); }
.search-tabs button { padding: 6px 14px; border-radius: 4px; font-size: 12px; }
.search-tabs button:hover { background: var(--hover); }
.search-tabs button.active { background: var(--accent-2); color: white; }
.search-results { flex: 1; overflow-y: auto; padding: 8px; }
.search-empty { padding: 24px; text-align: center; color: var(--fg-faint); }
.search-result {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
}
.search-result:hover { background: var(--hover); }
.search-result .ic { font-size: 22px; }

/* ========== Widgets ========== */
.widgets {
  position: absolute; bottom: calc(var(--tb-h) + 10px); left: 10px;
  width: 460px; max-height: 700px;
  background: var(--panel-2);
  backdrop-filter: blur(40px) saturate(180%);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 16px;
  z-index: 998;
  display: flex; flex-direction: column; gap: 14px;
  animation: slide-left 0.22s var(--easing);
  overflow: auto;
}
@keyframes slide-left {
  from { opacity: 0; transform: translateX(-10px); }
  to   { opacity: 1; transform: translateX(0); }
}
.widgets-header input {
  width: 100%; padding: 8px 12px;
  background: var(--hover); border: 1px solid var(--panel-border);
  border-radius: 6px; outline: none;
}
.widgets-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px;
}
.widget {
  background: var(--hover);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 14px;
  font-size: 12px;
  display: flex; flex-direction: column; gap: 6px;
}
.w-title { font-weight: 600; font-size: 11px; color: var(--fg-dim); text-transform: uppercase; letter-spacing: 0.5px; }
.w-temp { font-size: 36px; font-weight: 200; }
.w-cond { font-size: 11px; color: var(--fg-dim); }
.stock { display: flex; justify-content: space-between; }
.up { color: #4ade80; }
.down { color: #ef4444; }
.w-bigdate { font-size: 32px; font-weight: 200; }
.event { padding: 4px 0; font-size: 11px; border-top: 1px solid var(--panel-border); }
.todo { padding: 3px 0; font-size: 12px; }
.todo.done { color: var(--fg-faint); text-decoration: line-through; }

/* ========== Quick settings ========== */
.quick-settings {
  position: absolute; bottom: calc(var(--tb-h) + 10px); right: 10px;
  width: 380px;
  background: var(--panel-2);
  backdrop-filter: blur(40px) saturate(180%);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 18px;
  z-index: 998;
  display: flex; flex-direction: column; gap: 16px;
  animation: pop-up-right 0.22s var(--easing);
}
@keyframes pop-up-right {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.qs-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
}
.qs-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 12px 6px;
  border-radius: 6px;
  background: var(--hover);
  font-size: 11px;
  transition: background 0.12s;
}
.qs-btn:hover { background: var(--hover-strong); }
.qs-btn.active { background: var(--accent-2); color: white; }
.qs-btn span:first-child { font-size: 18px; }
.qs-slider {
  display: flex; align-items: center; gap: 12px;
}
.qs-slider input[type="range"] {
  flex: 1;
  -webkit-appearance: none; appearance: none;
  height: 4px; background: var(--hover-strong); border-radius: 2px;
  outline: none;
}
.qs-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px; background: white;
  border-radius: 50%; border: 4px solid var(--accent);
  cursor: pointer;
}
.qs-foot {
  display: flex; justify-content: flex-end; gap: 4px;
  border-top: 1px solid var(--panel-border);
  padding-top: 10px;
}
.qs-icon {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.12s;
}
.qs-icon:hover { background: var(--hover); }

/* ========== Notification center ========== */
.notifs {
  position: absolute; bottom: calc(var(--tb-h) + 10px); right: 10px;
  width: 380px; max-height: 600px;
  background: var(--panel-2);
  backdrop-filter: blur(40px) saturate(180%);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 14px;
  z-index: 998;
  display: flex; flex-direction: column; gap: 12px;
  animation: pop-up-right 0.22s var(--easing);
}
.notifs-cal {
  background: var(--hover); border: 1px solid var(--panel-border);
  border-radius: var(--radius); padding: 12px;
  font-size: 12px;
}
.notifs-cal .head { display: flex; justify-content: space-between; margin-bottom: 8px; font-weight: 600; }
.notifs-cal .grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.notifs-cal .grid div { padding: 4px 0; font-size: 11px; border-radius: 4px; }
.notifs-cal .grid div.dow { color: var(--fg-faint); font-weight: 600; }
.notifs-cal .grid div.today { background: var(--accent-2); color: white; }
.notifs-cal .grid div.muted { color: var(--fg-faint); }

.notifs-list { display: flex; flex-direction: column; gap: 8px; flex: 1; overflow-y: auto; min-height: 80px; }
.notif {
  background: var(--hover);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 12px;
  display: flex; gap: 10px;
}
.notif .ic { font-size: 18px; }
.notif .body .nm { font-weight: 600; }
.notif .body .ms { color: var(--fg-dim); }
.notifs-foot { display: flex; gap: 8px; justify-content: flex-end; }
.notifs-foot button { padding: 6px 10px; border-radius: 4px; font-size: 12px; color: var(--fg-dim); }
.notifs-foot button:hover { background: var(--hover); color: var(--fg); }

/* ========== Task view ========== */
.taskview {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(40px);
  z-index: 950;
  display: flex; flex-direction: column;
  padding: 80px 60px 100px;
  animation: fade-in 0.18s var(--easing);
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.taskview-grid {
  flex: 1;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px; align-content: center;
  overflow-y: auto;
}
.tv-tile {
  background: var(--panel-2);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  height: 200px;
  padding: 12px;
  cursor: pointer;
  display: flex; flex-direction: column;
  transition: transform 0.15s;
}
.tv-tile:hover { transform: scale(1.02); border-color: var(--accent); }
.tv-tile .head { display: flex; align-items: center; gap: 8px; font-size: 12px; margin-bottom: 8px; }
.tv-tile .preview { flex: 1; background: var(--hover); border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 48px; opacity: 0.5; }
.taskview-desktops { display: flex; gap: 12px; justify-content: center; margin-top: 16px; }
.vd { padding: 10px 16px; background: var(--panel); border: 1px solid var(--panel-border); border-radius: 6px; font-size: 12px; cursor: pointer; display: flex; align-items: center; gap: 8px; }
.vd:hover { border-color: var(--accent); }
.vd.active { border-color: var(--accent); background: var(--hover); }
.vd span { font-size: 16px; opacity: 0.6; }

/* ========== Context menu ========== */
.ctx-menu {
  position: absolute;
  background: var(--panel-2);
  backdrop-filter: blur(40px) saturate(180%);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 6px;
  min-width: 220px;
  z-index: 9500;
  font-size: 13px;
  animation: ctx-in 0.15s var(--easing);
}
@keyframes ctx-in { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
.ctx-item { padding: 8px 12px; border-radius: 4px; cursor: pointer; }
.ctx-item:hover { background: var(--hover); }
.ctx-sep { height: 1px; background: var(--panel-border); margin: 4px 0; }

/* ========== Toasts ========== */
.toasts {
  position: absolute; bottom: calc(var(--tb-h) + 10px); right: 10px;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-end;
  z-index: 970;
  pointer-events: none;
}
.toast {
  background: var(--panel-2);
  backdrop-filter: blur(40px);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  min-width: 280px;
  max-width: 360px;
  box-shadow: var(--shadow);
  animation: toast-in 0.25s var(--easing);
  pointer-events: auto;
}
.toast .nm { font-weight: 600; font-size: 13px; }
.toast .ms { font-size: 12px; color: var(--fg-dim); margin-top: 2px; }
.toast.fade-out { animation: toast-out 0.25s var(--easing) forwards; }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes toast-out {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(20px); }
}

/* ========== Windows ========== */
.windows-host { position: absolute; inset: 0 0 var(--tb-h) 0; pointer-events: none; }
.win {
  position: absolute;
  background: var(--panel-2);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  overflow: hidden;
  pointer-events: auto;
  min-width: 320px; min-height: 200px;
  transform-origin: center;
  animation: win-in 0.18s var(--easing);
}
@keyframes win-in {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}
.win.minimized { display: none; }
.win.maximized { border-radius: 0; }
.win.dragging { transition: none; user-select: none; }

.win-titlebar {
  display: flex; align-items: center;
  height: 36px;
  background: var(--titlebar);
  -webkit-app-region: drag;
  cursor: grab;
  flex-shrink: 0;
}
.win-titlebar.dragging { cursor: grabbing; }
.win-title {
  flex: 1;
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px;
  font-size: 12px;
  overflow: hidden; white-space: nowrap;
}
.win-title .ic { font-size: 14px; }
.win-controls { display: flex; height: 100%; }
.win-ctrl {
  width: 46px; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  transition: background 0.12s;
}
.win-ctrl:hover { background: var(--hover); }
.win-ctrl.close:hover { background: #c42b1c; color: white; }

.win-body {
  flex: 1;
  overflow: hidden;
  display: flex; flex-direction: column;
  background: var(--panel-2);
}
.win.focused { box-shadow: 0 30px 80px rgba(0,0,0,0.7); border-color: rgba(255,255,255,0.16); }
.win:not(.focused) .win-titlebar { opacity: 0.85; }

.win-resize {
  position: absolute; right: 0; bottom: 0;
  width: 14px; height: 14px;
  cursor: nwse-resize;
  z-index: 5;
}
.win-resize-r { position: absolute; right: 0; top: 0; width: 4px; height: 100%; cursor: ew-resize; }
.win-resize-b { position: absolute; left: 0; bottom: 0; width: 100%; height: 4px; cursor: ns-resize; }
.win-resize-l { position: absolute; left: 0; top: 0; width: 4px; height: 100%; cursor: ew-resize; }
.win-resize-t { position: absolute; left: 0; top: 0; width: 100%; height: 4px; cursor: ns-resize; }

/* Snap preview */
.snap-preview {
  position: absolute;
  background: rgba(76,194,255,0.18);
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  pointer-events: none;
  z-index: 800;
  transition: all 0.12s var(--easing);
}

/* ========== App: File Explorer ========== */
.fe { display: grid; grid-template-rows: auto auto 1fr auto; height: 100%; }
.fe-toolbar {
  display: flex; align-items: center; gap: 4px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--panel-border);
}
.fe-toolbar button {
  width: 28px; height: 28px; border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
}
.fe-toolbar button:hover { background: var(--hover); }
.fe-addr {
  flex: 1; margin: 0 8px; padding: 5px 10px;
  background: var(--hover); border: 1px solid var(--panel-border);
  border-radius: 4px; font-size: 12px;
}
.fe-search {
  width: 200px; padding: 5px 10px;
  background: var(--hover); border: 1px solid var(--panel-border);
  border-radius: 4px; font-size: 12px; outline: none;
}
.fe-cmd {
  display: flex; align-items: center; gap: 4px;
  padding: 4px 12px;
  border-bottom: 1px solid var(--panel-border);
  font-size: 12px;
}
.fe-cmd button { padding: 4px 10px; border-radius: 4px; display: flex; gap: 4px; align-items: center; }
.fe-cmd button:hover { background: var(--hover); }
.fe-main { display: grid; grid-template-columns: 220px 1fr; min-height: 0; }
.fe-sidebar {
  border-right: 1px solid var(--panel-border);
  padding: 8px; overflow-y: auto;
  font-size: 12px;
}
.fe-side-grp { padding: 6px 4px; color: var(--fg-faint); font-size: 11px; }
.fe-side-item {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px; border-radius: 4px;
  cursor: pointer;
}
.fe-side-item:hover { background: var(--hover); }
.fe-side-item.active { background: var(--hover-strong); }
.fe-files { overflow-y: auto; padding: 8px; }
.fe-grid { display: grid; grid-template-columns: repeat(auto-fill, 96px); gap: 8px; }
.fe-file {
  display: flex; flex-direction: column; align-items: center;
  padding: 10px 4px;
  border-radius: 4px;
  cursor: pointer;
  text-align: center;
}
.fe-file:hover { background: var(--hover); }
.fe-file.selected { background: rgba(76,194,255,0.25); }
.fe-file .ic { font-size: 38px; }
.fe-file .nm { font-size: 11px; margin-top: 4px; word-break: break-word; }
.fe-status {
  border-top: 1px solid var(--panel-border);
  padding: 4px 12px; font-size: 11px; color: var(--fg-dim);
}

/* ========== App: Notepad ========== */
.np { display: grid; grid-template-rows: auto 1fr auto; height: 100%; }
.np-menu {
  display: flex; gap: 2px;
  padding: 4px 8px;
  border-bottom: 1px solid var(--panel-border);
  font-size: 12px;
}
.np-menu button { padding: 4px 10px; border-radius: 4px; }
.np-menu button:hover { background: var(--hover); }
.np-area {
  width: 100%; height: 100%;
  border: 0; outline: 0; resize: none;
  background: transparent; color: var(--fg);
  font-family: 'Consolas', 'Cascadia Code', monospace;
  font-size: 13px; line-height: 1.6;
  padding: 12px;
}
.np-status {
  display: flex; justify-content: space-between;
  padding: 4px 12px;
  border-top: 1px solid var(--panel-border);
  font-size: 11px; color: var(--fg-dim);
}

/* ========== App: Calculator ========== */
.calc { display: grid; grid-template-rows: 1fr; height: 100%; padding: 12px; gap: 8px; }
.calc-display {
  text-align: right;
  font-size: 38px; font-weight: 300;
  padding: 24px 16px 12px;
  word-break: break-all;
  min-height: 80px;
  display: flex; flex-direction: column; justify-content: flex-end;
}
.calc-display .sub { font-size: 14px; color: var(--fg-dim); min-height: 18px; }
.calc-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px;
  flex: 1;
}
.calc-btn {
  background: var(--hover);
  border-radius: 4px;
  font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.1s;
}
.calc-btn:hover { background: var(--hover-strong); }
.calc-btn.op { background: rgba(76,194,255,0.15); }
.calc-btn.eq { background: var(--accent-2); color: white; }
.calc-btn.eq:hover { background: var(--accent); }

/* ========== App: Settings ========== */
.set { display: grid; grid-template-columns: 240px 1fr; height: 100%; }
.set-sidebar {
  background: var(--hover);
  padding: 16px 8px;
  overflow-y: auto;
  border-right: 1px solid var(--panel-border);
}
.set-side-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer; font-size: 13px;
}
.set-side-item:hover { background: var(--hover-strong); }
.set-side-item.active { background: var(--hover-strong); border-left: 3px solid var(--accent); padding-left: 9px; }
.set-content {
  padding: 24px 32px;
  overflow-y: auto;
}
.set-title { font-size: 22px; font-weight: 300; margin: 0 0 18px; }
.set-card {
  background: var(--hover);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 10px;
}
.set-row {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.set-label { font-size: 13px; }
.set-desc { font-size: 11px; color: var(--fg-dim); margin-top: 2px; }
.set-btn {
  padding: 6px 14px;
  background: var(--hover-strong);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  font-size: 12px;
}
.set-btn:hover { background: rgba(255,255,255,0.18); }
.set-select {
  padding: 5px 10px;
  background: var(--hover-strong);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  font-size: 12px;
  outline: none;
}
.toggle {
  position: relative;
  width: 40px; height: 20px;
  background: var(--hover-strong);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s;
}
.toggle::after {
  content: ""; position: absolute;
  top: 4px; left: 4px;
  width: 12px; height: 12px;
  background: var(--fg);
  border-radius: 50%;
  transition: all 0.15s;
}
.toggle.on { background: var(--accent-2); }
.toggle.on::after { left: 24px; background: white; }
.wallpaper-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  margin-top: 8px;
}
.wp-thumb {
  height: 70px; border-radius: 6px;
  cursor: pointer;
  border: 2px solid transparent;
  background-size: cover; background-position: center;
}
.wp-thumb.active { border-color: var(--accent); }

/* ========== App: Edge ========== */
.edge { display: grid; grid-template-rows: auto auto 1fr; height: 100%; }
.edge-tabs {
  display: flex; gap: 2px;
  padding: 4px 4px 0;
  background: var(--hover);
  border-bottom: 1px solid var(--panel-border);
}
.edge-tab {
  padding: 6px 14px;
  background: var(--panel-2);
  border-radius: 6px 6px 0 0;
  font-size: 12px;
  display: flex; align-items: center; gap: 8px;
  max-width: 200px;
  cursor: pointer;
}
.edge-tab.active { background: var(--panel); }
.edge-tab .x { opacity: 0.5; padding-left: 4px; }
.edge-tab .x:hover { opacity: 1; }
.edge-toolbar {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--panel-border);
}
.edge-toolbar button {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.edge-toolbar button:hover { background: var(--hover); }
.edge-url {
  flex: 1; padding: 6px 14px;
  background: var(--hover); border: 1px solid transparent;
  border-radius: 18px;
  font-size: 12px;
}
.edge-url:focus { background: var(--panel); border-color: var(--accent); }
.edge-content {
  background: white;
  color: #222;
  overflow: auto;
  padding: 28px 36px;
}
body.theme-dark .edge-content { background: #1a1a1a; color: #ddd; }
.edge-content h1 { margin-top: 0; }
.edge-content a { color: var(--accent-2); }

/* ========== App: Photos ========== */
.photos { display: grid; grid-template-rows: auto 1fr; height: 100%; }
.photos-bar {
  display: flex; padding: 10px 14px;
  border-bottom: 1px solid var(--panel-border);
  font-size: 13px; gap: 16px;
}
.photos-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
  padding: 12px;
  overflow-y: auto;
}
.photo-tile {
  height: 130px; border-radius: 6px;
  cursor: pointer;
  background-size: cover; background-position: center;
  border: 2px solid transparent;
  transition: transform 0.15s;
}
.photo-tile:hover { transform: scale(1.02); border-color: var(--accent); }

/* ========== App: Terminal ========== */
.term {
  background: #0c0c0c; color: #cccccc;
  font-family: 'Cascadia Code', 'Consolas', monospace;
  font-size: 13px;
  padding: 12px 14px;
  height: 100%; overflow-y: auto;
  white-space: pre-wrap; word-break: break-all;
}
.term .prompt { color: #16c60c; }
.term .path { color: #3b78ff; }
.term .err { color: #e74856; }
.term-input { background: none; border: 0; outline: 0; color: inherit; font: inherit; flex: 1; }
.term-line { display: flex; gap: 6px; }

/* ========== App: About ========== */
.about {
  padding: 28px 36px;
  display: flex; flex-direction: column; gap: 18px;
  overflow: auto; height: 100%;
}
.about h1 {
  margin: 0;
  font-size: 38px; font-weight: 200;
  background: linear-gradient(135deg, #5cc8ff, #0078d4);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.about-spec { display: grid; grid-template-columns: 160px 1fr; gap: 6px 14px; font-size: 13px; }
.about-spec dt { color: var(--fg-dim); }

/* ========== App: Clock ========== */
.clock { display: grid; grid-template-rows: 1fr auto; height: 100%; padding: 24px; }
.clock-time {
  text-align: center;
  font-size: 80px; font-weight: 200;
  display: flex; align-items: center; justify-content: center;
}
.clock-tabs { display: flex; gap: 8px; justify-content: center; padding-top: 12px; border-top: 1px solid var(--panel-border); }
.clock-tabs button { padding: 6px 14px; border-radius: 4px; font-size: 12px; }
.clock-tabs button.active { background: var(--accent-2); color: white; }

/* ========== App: Store ========== */
.store { padding: 24px 32px; height: 100%; overflow-y: auto; }
.store h2 { margin: 0 0 14px; font-weight: 300; }
.store-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
.store-tile {
  background: var(--hover); border-radius: var(--radius);
  padding: 14px; cursor: pointer;
  transition: background 0.15s;
}
.store-tile:hover { background: var(--hover-strong); }
.store-tile .ic { font-size: 36px; }
.store-tile .nm { font-size: 13px; margin-top: 8px; font-weight: 600; }
.store-tile .ct { font-size: 11px; color: var(--fg-dim); }
.store-tile .pr { font-size: 12px; color: var(--accent); margin-top: 6px; }

/* ========== Misc ========== */
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(128,128,128,0.3); border-radius: 6px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(128,128,128,0.5); border: 3px solid transparent; background-clip: padding-box; }
