/* Desktop shell — top bar, wallpaper, desktop icons, popovers, toasts */

#screen {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

#desktop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(1200px 800px at 18% -8%, var(--wall-c) 0%, transparent 55%),
    radial-gradient(1400px 900px at 108% 112%, var(--wall-b) 0%, transparent 52%),
    linear-gradient(160deg, var(--wall-a) 0%, var(--wall-b) 100%);
  transition: background 0.5s ease;
}

/* faint Debian swirl watermark */
#wallpaper-swirl {
  position: absolute;
  right: -140px;
  bottom: -160px;
  width: 640px;
  height: 640px;
  color: #fff;
  opacity: 0.07;
  transform: rotate(-12deg);
  pointer-events: none;
}
#wallpaper-swirl .icon { width: 100%; height: 100%; }

#wallpaper-credit {
  position: absolute;
  right: 14px;
  bottom: 10px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  user-select: none;
}

/* ---------------- top bar ---------------- */

#topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 32px;
  display: flex;
  align-items: stretch;
  background: var(--panel-bg);
  color: var(--panel-fg);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  font-size: 13px;
  z-index: 5000;
  user-select: none;
}

.tb-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  color: var(--panel-fg);
  border-radius: 0;
  transition: background 0.12s;
}
.tb-btn:hover { background: rgba(255, 255, 255, 0.13); }
.tb-btn.open { background: rgba(255, 255, 255, 0.22); }

#activities-btn { font-weight: 500; }

#tb-center {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  transform: translateX(-50%);
  display: flex;
}
.tb-clock {
  font-weight: 600;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
}

#tb-right {
  margin-left: auto;
  display: flex;
}
#status-btn { gap: 9px; }

#hotcorner {
  position: absolute;
  top: 0;
  left: 0;
  width: 28px;
  height: 24px;
  z-index: 5001;
}

/* ---------------- desktop icons ---------------- */

#desktop-icons {
  position: absolute;
  top: 44px;
  left: 10px;
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  column-gap: 6px;
  max-height: calc(100% - 70px);
  user-select: none;
}

.desk-icon {
  width: 92px;
  padding: 9px 4px 7px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  border-radius: 10px;
  cursor: default;
  text-align: center;
}
.desk-icon .icon { width: 46px; height: 46px; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.28)) drop-shadow(0 0 1px rgba(255, 255, 255, 0.22)); }
.desk-icon span {
  font-size: 12px;
  line-height: 1.25;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.65), 0 0 8px rgba(0, 0, 0, 0.35);
  word-break: break-word;
  max-width: 100%;
}
.desk-icon:hover { background: rgba(255, 255, 255, 0.12); }
.desk-icon.selected {
  background: color-mix(in srgb, var(--accent) 38%, transparent);
  outline: 1px solid color-mix(in srgb, var(--accent) 60%, transparent);
}

/* ---------------- popovers (clock / system) ---------------- */

.popover {
  position: absolute;
  top: 38px;
  background: rgba(28, 28, 30, 0.96);
  color: #fff;
  border-radius: 14px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.09);
  z-index: 5002;
  animation: pop-in 0.16s ease;
  font-size: 13px;
}
@keyframes pop-in {
  from { opacity: 0; transform: translateY(-6px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

#calendar-popover { left: 50%; transform: translateX(-50%); width: 380px; padding: 14px; }

.cal-date {
  font-size: 15px;
  font-weight: 700;
  padding: 2px 4px 10px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.cal-date .cal-week { font-size: 11px; color: #bbb; font-weight: 400; }

.notif-title {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #bbb;
  padding: 10px 4px 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.notif {
  display: flex;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  margin-bottom: 6px;
}
.notif .icon { width: 26px; height: 26px; color: var(--accent); }
.notif b { display: block; font-size: 13px; font-weight: 600; }
.notif small { color: #aaa; font-size: 11px; }
.notif p { margin: 3px 0 0; font-size: 12.5px; color: #ddd; line-height: 1.45; }
.notif .goto { margin-left: auto; align-self: center; color: var(--accent); font-size: 12px; }
.notif .goto:hover { text-decoration: underline; }

#system-popover { right: 8px; width: 300px; padding: 14px; }

.sys-row {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}
.seg {
  flex: 1;
  display: flex;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 9px;
  padding: 3px;
}
.seg button {
  flex: 1;
  padding: 5px 0;
  border-radius: 7px;
  color: #ddd;
  font-size: 12px;
}
.seg button.on {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.accent-row { display: flex; gap: 9px; padding: 4px 2px 12px; }
.accent-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  padding: 0;
}
.accent-dot.on { border-color: #fff; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.25); }

.sys-actions {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sys-actions button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 9px;
  color: #eee;
  font-size: 13px;
  text-align: left;
}
.sys-actions button:hover { background: rgba(255, 255, 255, 0.1); }
.sys-actions .danger:hover { background: rgba(215, 10, 83, 0.35); }

/* ---------------- toasts ---------------- */

#toasts {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 6000;
  pointer-events: none;
}
.toast {
  background: rgba(28, 28, 30, 0.95);
  color: #fff;
  padding: 10px 18px;
  border-radius: 99px;
  font-size: 13px;
  box-shadow: var(--shadow-flat);
  border: 1px solid rgba(255, 255, 255, 0.1);
  animation: toast-in 0.22s ease;
  max-width: min(80vw, 560px);
}
.toast.fade { opacity: 0; transition: opacity 0.4s; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* ---------------- power overlay ---------------- */

#power-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: #000;
  color: #ccc;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.power-box .icon.big { width: 54px; height: 54px; color: var(--accent); }
.power-box p { font-size: 17px; margin: 18px 0 4px; color: #eee; }
.power-box p.dim { font-size: 13px; color: #888; }
