/* ---------- Desktop & wallpaper ---------- */
.desktop { position: fixed; inset: 0; overflow: hidden; opacity: 0; transition: opacity .5s ease; }
.desktop.ready { opacity: 1; }

.wallpaper { position: absolute; inset: 0; overflow: hidden; background: #0b1026; }
.wp-layer { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: none; }
.wp-layer.show { display: block; }
#wpCanvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#wpGradient { background: linear-gradient(135deg, #0b1026, #14315c 45%, #4a1d6b); }
.wp-tint { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.12), rgba(0,0,0,.34)); }

/* ---------- Desktop icons ---------- */
.desktop-icons {
  position: absolute; top: 10px; left: 10px; right: 10px; bottom: calc(var(--taskbar-h) + 10px);
  display: flex; flex-direction: column; flex-wrap: wrap; align-content: flex-start;
  gap: 2px; pointer-events: none;
}
.d-icon {
  pointer-events: auto; width: 88px; padding: 8px 4px 6px; border-radius: var(--radius);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  text-align: center; cursor: default; border: 1px solid transparent;
}
.d-icon:hover { background: rgba(255,255,255,.12); }
.d-icon.sel { background: rgba(255,255,255,.18); border-color: rgba(255,255,255,.28); }
.d-icon .i { width: 42px; height: 42px; display: grid; place-items: center; }
.d-icon .i svg, .d-icon .i img { width: 42px; height: 42px; }
.d-icon .n {
  font-size: 12px; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.9);
  max-width: 82px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 1px 4px; border-radius: 3px;
}
.d-icon .n.wrap { white-space: normal; word-break: break-word; max-height: 32px; }

/* ---------- Widgets ---------- */
.widgets {
  position: absolute; left: 16px; bottom: calc(var(--taskbar-h) + 16px);
  display: flex; gap: 12px; z-index: 3;
}
.widgets.hidden { display: none; }
.widget-card {
  width: 250px; background: var(--surface); backdrop-filter: var(--blur);
  border: 1px solid var(--border); border-radius: 12px; padding: 14px;
  box-shadow: 0 12px 32px rgba(0,0,0,.35); color: var(--text);
}
.widget-clock { background: linear-gradient(150deg, rgba(0,120,212,.9), rgba(76,194,255,.75)); color: #fff; }
.wc-time { font-size: 34px; font-weight: 300; line-height: 1; }
.wc-date { font-size: 13px; opacity: .95; margin-top: 4px; }
.wc-weather { margin-top: 10px; font-size: 13px; opacity: .95; }
.wc-weather span { font-size: 18px; }
.wc-title { font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--text-3); margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; }
.widget-notes textarea {
  width: 100%; height: 74px; resize: none; background: var(--control); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 8px; outline: none; font-size: 12.5px; color: var(--text);
}
.meter { display: flex; align-items: center; gap: 8px; margin: 6px 0; font-size: 11.5px; color: var(--text-2); }
.meter > span { width: 34px; }
.meter .bar { flex: 1; height: 6px; background: var(--control); border-radius: 4px; overflow: hidden; }
.meter .bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .5s; }
.meter b { width: 34px; text-align: right; font-weight: 500; color: var(--text-3); }

/* ---------- Taskbar ---------- */
.taskbar {
  position: fixed; left: 0; right: 0; bottom: 0; height: var(--taskbar-h); z-index: 5000;
  background: var(--surface); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border-top: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 8px;
}
body.no-transparency .taskbar { background: var(--surface-solid); }
.taskbar-left { width: 200px; }
.taskbar-right { margin-left: auto; display: flex; align-items: center; gap: 2px; height: 100%; padding-right: 2px; }
.taskbar-center { display: flex; align-items: center; gap: 4px; flex: 1; justify-content: center; }

.tb-btn {
  width: 42px; height: 40px; border-radius: var(--radius); display: grid; place-items: center;
  color: var(--text); position: relative; transition: background .12s;
}
.tb-btn:hover { background: var(--hover); }
.tb-btn:active { background: var(--active); transform: scale(.94); }
.tb-btn.active::after {
  content: ""; position: absolute; bottom: 3px; left: 50%; transform: translateX(-50%);
  width: 16px; height: 3px; border-radius: 2px; background: var(--accent-2);
}
.tb-btn.running::after {
  content: ""; position: absolute; bottom: 3px; left: 50%; transform: translateX(-50%);
  width: 6px; height: 3px; border-radius: 2px; background: var(--text-3); transition: all .2s;
}
.tb-btn.running.active::after { width: 16px; background: var(--accent-2); }
.tb-start svg { width: 24px; height: 24px; color: var(--accent-2); }

.task-list { display: flex; align-items: center; gap: 4px; margin-left: 4px; }
.task-item {
  height: 40px; min-width: 44px; padding: 0 10px; border-radius: var(--radius);
  display: flex; align-items: center; gap: 8px; position: relative; max-width: 180px;
  transition: background .12s;
}
.task-item:hover { background: var(--hover); }
.task-item.active { background: var(--active); }
.task-item .ti-ico { width: 20px; height: 20px; display: grid; place-items: center; flex: none; }
.task-item .ti-ico svg, .task-item .ti-ico img { width: 20px; height: 20px; }
.task-item .ti-label { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.task-item.minimized .ti-label { opacity: .6; }
.task-item::after {
  content: ""; position: absolute; bottom: 3px; left: 50%; transform: translateX(-50%);
  width: 6px; height: 3px; border-radius: 2px; background: var(--text-3); transition: all .2s;
}
.task-item.active::after { width: 16px; background: var(--accent-2); }

.tray-btn, .tray-clock {
  height: 38px; border-radius: var(--radius); display: grid; place-items: center;
  color: var(--text-2); padding: 0 7px; transition: background .12s;
}
.tray-btn:hover, .tray-clock:hover { background: var(--hover); color: var(--text); }
.tray-btn.group { display: flex; gap: 4px; }
.tray-btn.bell { position: relative; }
.tray-clock { display: flex; flex-direction: column; line-height: 1.15; padding: 0 9px; text-align: right; }
.tray-clock #clockTime { font-size: 12px; }
.tray-clock #clockDate { font-size: 12px; }
.tray-btn .dot { position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent-2); }
.show-desktop { width: 8px; height: 38px; border-left: 1px solid var(--border); margin-left: 4px; }
.show-desktop:hover { background: var(--hover); }

/* ---------- Start menu ---------- */
.start-menu {
  position: fixed; left: 50%; bottom: calc(var(--taskbar-h) + 8px); transform: translateX(-50%) translateY(16px);
  width: 640px; max-width: calc(100vw - 24px); height: 680px; max-height: calc(100vh - var(--taskbar-h) - 24px);
  z-index: 6000; background: var(--surface); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-fly);
  display: flex; flex-direction: column; opacity: 0; transition: opacity .18s, transform .22s cubic-bezier(.2,.9,.3,1);
  padding: 24px 24px 0;
}
body.no-transparency .start-menu { background: var(--surface-solid); }
.start-menu:not(.hidden) { opacity: 1; transform: translateX(-50%) translateY(0); }
.start-search {
  display: flex; align-items: center; gap: 10px; padding: 8px 14px;
  background: var(--control); border: 1px solid var(--border-strong); border-radius: 20px; color: var(--text-2);
}
.start-search input { flex: 1; background: none; border: 0; outline: none; color: var(--text); }
.start-search input::placeholder { color: var(--text-3); }
.start-body { flex: 1; overflow-y: auto; margin-top: 20px; }
.start-head { display: flex; justify-content: space-between; align-items: center; padding: 0 2px 12px; font-weight: 600; font-size: 13px; }
.start-all { font-size: 12px; color: var(--text); padding: 5px 10px; border-radius: var(--radius-sm); background: var(--control); display: flex; align-items: center; gap: 4px; }
.start-all:hover { background: var(--control-hover); }
.pinned-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px 6px; }
.pin-item {
  padding: 12px 6px 10px; border-radius: var(--radius); display: flex; flex-direction: column;
  align-items: center; gap: 8px; text-align: center; transition: background .12s;
}
.pin-item:hover { background: var(--hover); }
.pin-item .i { width: 34px; height: 34px; display: grid; place-items: center; }
.pin-item .i svg, .pin-item .i img { width: 34px; height: 34px; }
.pin-item .n { font-size: 11.5px; color: var(--text); max-width: 88px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.all-apps { display: flex; flex-direction: column; gap: 2px; padding-bottom: 10px; }
.all-apps .aa-letter { font-size: 12px; font-weight: 600; color: var(--text-2); padding: 12px 8px 4px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.all-apps .aa-item { display: flex; align-items: center; gap: 12px; padding: 7px 8px; border-radius: var(--radius); }
.all-apps .aa-item:hover { background: var(--hover); }
.all-apps .aa-item .i { width: 22px; height: 22px; }
.all-apps .aa-item svg, .all-apps .aa-item img { width: 22px; height: 22px; }
.all-apps .aa-item .n { font-size: 13px; }

.search-results { display: flex; flex-direction: column; gap: 4px; padding-bottom: 14px; }
.sr-group { font-size: 12px; font-weight: 600; color: var(--text-2); padding: 12px 6px 6px; }
.sr-item { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: var(--radius); }
.sr-item:hover { background: var(--hover); }
.sr-item .i { width: 24px; height: 24px; display: grid; place-items: center; }
.sr-item .i svg, .sr-item .i img { width: 24px; height: 24px; }
.sr-item .meta { min-width: 0; flex: 1; }
.sr-item .n { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-item .p { font-size: 11px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-empty { padding: 30px; text-align: center; color: var(--text-3); font-size: 13px; }

.start-foot {
  height: 62px; margin: 0 -24px; padding: 0 34px; display: flex; align-items: center; justify-content: space-between;
  border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 12px 12px;
}
.start-user { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: var(--radius); }
.start-user:hover { background: var(--hover); }
.start-power { display: flex; gap: 4px; }
.icon-btn { width: 34px; height: 34px; border-radius: var(--radius); display: grid; place-items: center; color: var(--text); font-size: 15px; }
.icon-btn:hover { background: var(--hover); }

/* ---------- Flyouts ---------- */
.flyout {
  position: fixed; z-index: 6000; background: var(--surface); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-fly);
  opacity: 0; transform: translateY(10px); transition: opacity .16s, transform .2s cubic-bezier(.2,.9,.3,1);
}
.flyout:not(.hidden) { opacity: 1; transform: translateY(0); }
body.no-transparency .flyout { background: var(--surface-solid); }

.quick-settings { right: 12px; bottom: calc(var(--taskbar-h) + 10px); width: 360px; padding: 18px; }
.qs-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.qs-tile {
  background: var(--control); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 12px 6px; display: flex; flex-direction: column; align-items: center; gap: 6px;
  color: var(--text-2); transition: all .15s;
}
.qs-tile span { font-size: 18px; }
.qs-tile small { font-size: 11px; }
.qs-tile:hover { background: var(--control-hover); }
.qs-tile.active { background: var(--accent); color: #fff; border-color: transparent; }
.qs-sliders { margin-top: 16px; display: flex; flex-direction: column; gap: 14px; }
.qs-sliders label { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.qs-sliders input[type=range] { flex: 1; -webkit-appearance: none; height: 4px; border-radius: 3px; background: var(--border-strong); outline: none; }
.qs-sliders input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); border: 3px solid #fff; cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.qs-foot { margin-top: 16px; display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--text-2); }

.notif-center { right: 12px; bottom: calc(var(--taskbar-h) + 10px); width: 380px; max-height: 70vh; padding: 16px; overflow-y: auto; }
.nc-head { display: flex; justify-content: space-between; align-items: center; font-weight: 600; font-size: 13px; margin-bottom: 12px; }
.mini { font-size: 11px; color: var(--text-3); padding: 3px 8px; border-radius: var(--radius-sm); }
.mini:hover { background: var(--hover); color: var(--text); }
.notif-list { display: flex; flex-direction: column; gap: 8px; }
.notif-empty { text-align: center; color: var(--text-3); font-size: 12.5px; padding: 24px 0; }
.notif {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 12px 14px; display: flex; gap: 10px; animation: toastIn .25s ease;
}
.notif .t-ico { font-size: 18px; }
.notif .t-body { flex: 1; }
.notif .t-title { font-size: 12.5px; font-weight: 600; }
.notif .t-msg { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.nc-cal { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 14px; }
.nc-cal-head { font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.nc-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.nc-cal-grid .dow { font-size: 11px; color: var(--text-3); text-align: center; padding: 4px 0; }
.nc-cal-grid .day { font-size: 12px; text-align: center; padding: 7px 0; border-radius: 50%; color: var(--text-2); }
.nc-cal-grid .day:hover { background: var(--hover); }
.nc-cal-grid .day.out { color: var(--text-3); opacity: .45; }
.nc-cal-grid .day.today { background: var(--accent); color: #fff; font-weight: 600; }

.tray-flyout { right: 12px; bottom: calc(var(--taskbar-h) + 10px); padding: 10px; display: flex; gap: 6px; }

/* ---------- Context menu ---------- */
.context-menu {
  position: fixed; z-index: 7500; min-width: 220px; padding: 5px;
  background: var(--surface-2); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-fly);
  animation: ctxIn .14s ease;
}
@keyframes ctxIn { from { opacity: 0; transform: scale(.97); } }
body.no-transparency .context-menu { background: var(--surface-solid); }
.ctx-item {
  display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: var(--radius-sm);
  font-size: 13px; color: var(--text); width: 100%; text-align: left;
}
.ctx-item:hover { background: var(--hover); }
.ctx-item.disabled { opacity: .4; pointer-events: none; }
.ctx-item .ci { width: 16px; text-align: center; font-size: 14px; }
.ctx-item .ck { margin-left: auto; font-size: 11px; color: var(--text-3); }
.ctx-sep { height: 1px; background: var(--border); margin: 5px 8px; }

/* ---------- Snap preview & drop overlay ---------- */
.snap-preview {
  position: fixed; z-index: 4000; pointer-events: none;
  background: rgba(0, 120, 212, .22); border: 1px solid rgba(76, 194, 255, .7);
  border-radius: 8px; backdrop-filter: blur(4px); transition: all .14s ease;
}
.drop-overlay {
  position: fixed; inset: 0; z-index: 4500; pointer-events: none;
  background: rgba(0, 120, 212, .18); border: 3px dashed rgba(76,194,255,.8);
  display: grid; place-items: center; color: #fff; font-size: 22px; font-weight: 300;
}
