/* Wallpaper, menu bar, menus, windows, Dock, desktop icons, notifications. */

/* ---------- wallpaper ---------- */
.wallpaper {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 90% at 85% 10%, rgba(108, 116, 216, 0.35), transparent 55%),
    radial-gradient(90% 70% at 10% 95%, rgba(108, 116, 216, 0.22), transparent 60%),
    radial-gradient(70% 60% at 50% 40%, rgba(58, 66, 102, 0.55), transparent 70%),
    linear-gradient(160deg, #222a4d 0%, var(--navy) 35%, #141a31 65%, var(--deep) 100%);
}
.wallpaper-glow {
  position: absolute;
  inset: -20%;
  background: radial-gradient(40% 30% at 70% 35%, rgba(255, 201, 74, 0.07), transparent 70%);
  animation: glow 18s ease-in-out infinite alternate;
}
@keyframes glow { to { transform: translate(-6%, 4%) scale(1.1); } }
.wallpaper-stars { position: absolute; inset: 0; width: 100%; height: 100%; }

.windows-layer { position: absolute; inset: 0; z-index: 5; pointer-events: none; overflow: clip; }
.windows-layer > * { pointer-events: auto; }
.overlay-layer { position: absolute; inset: 0; z-index: 40; pointer-events: none; overflow: clip; }
.overlay-layer > * { pointer-events: auto; }

/* ---------- menu bar ---------- */
.menubar {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 30;
  height: var(--menubar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  background: linear-gradient(rgba(10, 12, 24, 0.28), rgba(10, 12, 24, 0.12));
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  font-size: 13px;
  color: #fff;
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.25);
}
.menubar-left, .menubar-right { display: flex; align-items: center; height: 100%; min-width: 0; }
.menubar-left { overflow: hidden; }
.menubar-item {
  height: 22px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 9px;
  border-radius: 6px;
  white-space: nowrap;
  font-weight: 500;
}
.menubar-title:hover, .menubar-item.is-open, button.menubar-item:active { background: rgba(255, 255, 255, 0.18); }
.menubar-apple { padding: 0 11px 0 9px; }
.menubar-app b { font-weight: 700; }
.menubar-static { padding: 0 7px; opacity: 0.95; }
.menubar-clock { padding: 0 6px 0 9px; font-variant-numeric: tabular-nums; }
.menubar-lang span { font-size: 12px; font-weight: 600; }
.sound-ico { position: relative; display: inline-flex; }
.sound-ico.is-muted { opacity: 0.55; }
.sound-ico.is-muted::after {
  content: ""; position: absolute; left: -1px; right: -1px; top: 50%; height: 1.6px;
  background: #fff; transform: rotate(-38deg); border-radius: 1px; box-shadow: 0 0 0 1px rgba(20, 24, 40, 0.6);
}
.menubar-reword { padding: 0 8px; }
.status-wand { transition: none; }
.status-wand .sf-s { transition: opacity 0.06s linear; }
.status-wand.is-red { --sf-p: var(--red); --sf-s: var(--red); filter: drop-shadow(0 0 3px rgba(255, 69, 58, 0.7)); }
.menubar-reword.is-quit .status-wand { animation: quit 2.4s ease; }
@keyframes quit { 0% { opacity: 1; } 15%, 70% { opacity: 0; transform: scale(0.5); } 100% { opacity: 1; transform: none; } }

/* ---------- menus ---------- */
.menu {
  position: fixed;
  z-index: 60;
  min-width: 180px;
  max-width: 420px;
  padding: 5px;
  border-radius: 12px;
  background: var(--glass);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45), 0 0 0 0.5px rgba(0, 0, 0, 0.6);
  color: var(--text);
  font-size: 13px;
  animation: menu-in 0.12s ease-out;
}
@keyframes menu-in { from { opacity: 0; transform: translateY(-3px); } }
.menu-item {
  display: flex;
  align-items: center;
  height: 24px;
  padding: 0 10px 0 4px;
  border-radius: 7px;
  white-space: nowrap;
  outline: none;
}
.menu-item.is-active { background: var(--accent); color: #fff; }
.menu-item.is-active .menu-shortcut, .menu-item.is-active .menu-arrow, .menu-item.is-active .menu-detail { color: rgba(255, 255, 255, 0.85); }
.menu-item.is-disabled { color: var(--text-3); }
.menu-item.is-disabled.is-active { background: rgba(255, 255, 255, 0.1); color: var(--text-3); }
.menu-check { width: 18px; text-align: center; font-size: 12px; flex: none; }
.menu-icon { width: 18px; margin-right: 4px; display: inline-flex; justify-content: center; }
.menu-label { flex: 1; overflow: hidden; text-overflow: ellipsis; padding-right: 18px; }
.menu-detail { margin-left: 8px; color: var(--text-3); }
.menu-shortcut { color: var(--text-3); letter-spacing: 0.04em; font-feature-settings: "tnum"; }
.menu-arrow { color: var(--text-2); font-size: 15px; line-height: 1; margin-right: -2px; }
.menu-sep { height: 1px; margin: 5px 10px; background: rgba(255, 255, 255, 0.12); }
.menu-header { padding: 4px 22px 2px; font-size: 11px; font-weight: 600; color: var(--text-3); }
.menu-item.is-wrap { height: auto; min-height: 24px; padding-top: 4px; padding-bottom: 4px; white-space: normal; max-width: 340px; line-height: 1.35; }
.menu-item.is-warning .menu-label { color: var(--yellow); }
.menu-item.is-warning.is-active .menu-label { color: #fff; }
.menu-item.is-site .menu-label { color: var(--gold-pale); }
.menu-item.is-site.is-active { background: linear-gradient(90deg, var(--lilac), #8a6fd8); }
.menu-item.is-site.is-active .menu-label { color: #fff; }
.menu.is-quick { min-width: 190px; }

/* ---------- windows ---------- */
.win {
  position: absolute;
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  background: var(--win-bg);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5), 0 10px 24px rgba(0, 0, 0, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.1);
  overflow: hidden;
  user-select: text;
  -webkit-user-select: text;
  transition: box-shadow 0.2s ease;
}
.win:not(.is-front) { box-shadow: 0 16px 40px rgba(0, 0, 0, 0.38), inset 0 0 0 1px rgba(255, 255, 255, 0.07); }
.win.is-opening { animation: win-open 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.1); }
.win.is-closing { animation: win-close 0.16s ease-in forwards; }
.win.is-minimized { animation: win-min 0.3s ease-in forwards; pointer-events: none; }
@keyframes win-open { from { opacity: 0; transform: scale(0.94); } }
@keyframes win-close { to { opacity: 0; transform: scale(0.96); } }
@keyframes win-min { to { opacity: 0; transform: translateY(60vh) scale(0.2); } }

.win-titlebar {
  position: relative;
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 52px;
  padding: 0 14px 0 20px;
  user-select: none;
  -webkit-user-select: none;
}
.win-lights { display: flex; gap: 8px; flex: none; }
.light { width: 12px; height: 12px; border-radius: 50%; position: relative; box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.25); }
.light.close { background: #FF5F57; }
.light.min { background: #FEBC2E; }
.light.zoom { background: #28C840; }
.win:not(.is-front) .light { background: rgba(255, 255, 255, 0.18); }
.win-lights:hover .light::after { position: absolute; inset: 0; display: grid; place-items: center; font-size: 9px; font-weight: 800; line-height: 12px; color: rgba(0, 0, 0, 0.55); }
.win-lights:hover .light.close::after { content: "×"; }
.win-lights:hover .light.min::after { content: "–"; }
.win-lights:hover .light.zoom::after { content: "+"; }
.win-title {
  position: absolute; left: 50%; transform: translateX(-50%);
  font-weight: 600; font-size: 13px; color: var(--text-2); pointer-events: none; white-space: nowrap;
}
.win.is-front .win-title { color: var(--text); }
.win-body { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }

.win-toolbar { flex: 1; display: flex; align-items: center; gap: 6px; min-width: 0; margin-left: 10px; }
.toolbar-spacer { flex: 1; }
.tool-btn {
  height: 30px; min-width: 34px; padding: 0 9px; border-radius: 15px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-2);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.tool-btn:not(:disabled):hover { color: var(--text); background: rgba(255, 255, 255, 0.13); }
.tool-btn:disabled { opacity: 0.55; }
.tool-sep { width: 1px; height: 18px; background: var(--sep); }
.tool-text { font-weight: 600; font-size: 13px; }

/* ---------- Dock ---------- */
.dock {
  position: absolute;
  left: 50%;
  bottom: 8px;
  z-index: 25;
  transform: translateX(-50%);
  max-width: calc(100vw - 16px);
}
.dock-shelf {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 6px 7px;
  border-radius: 26px;
  background: rgba(60, 64, 90, 0.28);
  backdrop-filter: blur(26px) saturate(1.6);
  -webkit-backdrop-filter: blur(26px) saturate(1.6);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  overflow-x: auto;
  scrollbar-width: none;
}
.dock-shelf::-webkit-scrollbar { display: none; }
.dock-item {
  position: relative;
  flex: none;
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  text-decoration: none;
  transition: transform 0.18s cubic-bezier(0.3, 1.4, 0.5, 1);
  cursor: default;
}
.dock-item:hover { transform: translateY(-4px) scale(1.06); }
.dock-item:active .app-ico, .dock-item:active .app-ico-img { filter: brightness(0.7); }
.dock-item.is-bouncing { animation: bounce 0.7s ease; }
@keyframes bounce { 30% { transform: translateY(-18px); } 55% { transform: none; } 75% { transform: translateY(-6px); } }
.dock-dot { position: absolute; bottom: -4px; width: 4px; height: 4px; border-radius: 50%; background: rgba(255, 255, 255, 0.75); opacity: 0; }
.dock-item.is-running .dock-dot { opacity: 1; }
.dock-sep { flex: none; width: 1px; height: 46px; margin: 0 4px 4px; background: rgba(255, 255, 255, 0.22); align-self: center; }
.dock-tip {
  position: absolute; bottom: calc(100% + 12px); left: 50%; transform: translateX(-50%);
  padding: 4px 10px; border-radius: 7px; white-space: nowrap;
  background: var(--glass-strong); border: 1px solid var(--glass-border);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  font-size: 13px; color: var(--text);
  opacity: 0; pointer-events: none; transition: opacity 0.12s ease;
}
.dock-item:hover .dock-tip, .dock-item:focus-visible .dock-tip { opacity: 1; }

/* App icons: macOS squircles drawn in CSS. */
.app-ico, .app-ico-img {
  width: 54px; height: 54px; border-radius: 12.5px; flex: none;
  display: grid; place-items: center; position: relative; overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35), inset 0 0 0 0.5px rgba(255, 255, 255, 0.2);
}
.app-ico-img { object-fit: cover; box-shadow: none; overflow: visible; border-radius: 0; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.35)); }
.ico-mail { background: linear-gradient(#3aa0ff, #0a64e8); color: #fff; }
.ico-messages { background: linear-gradient(#6bf27a, #1fbf3a); color: #fff; }
.ico-terminal { background: linear-gradient(#3a3a3e, #151517); color: #e8e8e8; }
.term-prompt { font: 700 17px/1 var(--mono); letter-spacing: -0.04em; margin: -6px 0 0 -12px; }
.ico-notes { background: #fbfbf8; }
.notes-top { position: absolute; inset: 0 0 auto; height: 15px; background: linear-gradient(#ffd84a, #f7c51c); }
.notes-lines { position: absolute; inset: 22px 9px 8px; background: repeating-linear-gradient(transparent 0 6px, #d9d6c9 6px 7px); }
.ico-settings { background: none; box-shadow: none; overflow: visible; }
.ico-settings img { width: 54px; height: 54px; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.35)); }
.ico-badge {
  position: absolute; right: -2px; bottom: -2px; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; background: linear-gradient(#9da3b5, #626879); color: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5), inset 0 0 0 0.5px rgba(255, 255, 255, 0.4);
}
.ico-download { background: linear-gradient(#3aa0ff, #0a64e8); color: #fff; }
.ico-github { background: linear-gradient(#2e2e33, #101012); color: #fff; }
.ico-keys { background: linear-gradient(#2a3260, var(--navy)); color: var(--gold); }
.ico-install { background: linear-gradient(#c79b62, #9a6b34); color: #fff4df; }
.ico-tour { background: linear-gradient(135deg, var(--lilac), #3a3f8a); color: var(--gold-pale); }

/* ---------- desktop icons ---------- */
.desk-icons {
  position: absolute;
  top: calc(var(--menubar-h) + 16px);
  right: 14px;
  z-index: 3;
  display: grid;
  gap: 6px;
  justify-items: center;
}
.desk-icon {
  width: 92px;
  display: grid;
  justify-items: center;
  gap: 5px;
  padding: 6px 4px;
  text-decoration: none;
  cursor: default;
}
.desk-tile { padding: 3px; border-radius: 15px; border: 2px solid transparent; }
.desk-icon .app-ico, .desk-icon .app-ico-img { width: 50px; height: 50px; }
.desk-icon .ico-settings img { width: 50px; height: 50px; }
.desk-label {
  max-width: 92px; padding: 1px 5px; border-radius: 5px;
  font-size: 12px; font-weight: 500; line-height: 1.25; text-align: center; color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}
.desk-icon.is-selected .desk-tile { background: rgba(255, 255, 255, 0.14); border-color: rgba(255, 255, 255, 0.18); }
.desk-icon.is-selected .desk-label { background: var(--accent); text-shadow: none; }

/* ---------- notifications ---------- */
.notif-stack {
  position: absolute;
  top: calc(var(--menubar-h) + 8px);
  right: 10px;
  z-index: 50;
  width: min(356px, calc(100vw - 20px));
  display: grid;
  gap: 8px;
  pointer-events: none;
}
.notif {
  position: relative;
  display: grid;
  grid-template-columns: 38px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 12px 14px 12px 12px;
  border-radius: 22px;
  background: rgba(40, 40, 46, 0.7);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  pointer-events: auto;
  animation: notif-in 0.42s cubic-bezier(0.2, 0.9, 0.3, 1.05);
}
.notif.is-clickable { cursor: pointer; }
.notif.is-leaving { animation: notif-out 0.26s ease-in forwards; }
@keyframes notif-in { from { opacity: 0; transform: translateX(110%); } }
@keyframes notif-out { to { opacity: 0; transform: translateX(110%); } }
.notif-icon img, .notif-icon .app-ico { width: 36px; height: 36px; }
.notif-head { display: flex; justify-content: space-between; gap: 8px; }
.notif-title { font-weight: 700; font-size: 13px; }
.notif-time { font-size: 12px; color: var(--text-3); flex: none; }
.notif-body { font-size: 13px; color: var(--text); margin-top: 1px; white-space: pre-line; overflow-wrap: anywhere; }
.notif.is-error .notif-title { color: #fff; }
.notif-actions { grid-column: 3; grid-row: 1; display: flex; flex-direction: column; gap: 6px; }
.notif-action {
  padding: 5px 12px; border-radius: 13px; font-size: 12px; font-weight: 600;
  background: rgba(255, 255, 255, 0.14); cursor: pointer; white-space: nowrap;
}
.notif-action:hover { background: rgba(255, 255, 255, 0.22); }
.notif-close {
  position: absolute; left: -6px; top: -6px; width: 20px; height: 20px; border-radius: 50%;
  background: rgba(70, 70, 76, 0.95); border: 1px solid var(--glass-border);
  font-size: 13px; line-height: 17px; color: var(--text); opacity: 0; transition: opacity 0.12s ease;
}
.notif:hover .notif-close, .notif-close:focus-visible { opacity: 1; }
