/* Deskthru: a macOS-inspired desktop for the browser.
   Glass menu bar and dock, soft wave wallpapers, rounded icons, blue selection pills.
   Follows the system light/dark setting. */

:root {
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', Inter, 'Segoe UI', system-ui, sans-serif;
  --accent: #2f6fe4;
  --menu-h: 28px;
  --bar-bg: rgba(246, 246, 248, .55);
  --bar-text: #1d1d1f;
  --pop-bg: rgba(240, 240, 242, .82);
  --pop-border: rgba(0, 0, 0, .14);
  --pop-text: #1d1d1f;
  --sep: rgba(0, 0, 0, .12);
  --muted: #6e6e73;
  --win-bg: #f3f3f5;
  --win-text: #1d1d1f;
  --dock-bg: rgba(255, 255, 255, .28);
  --dock-border: rgba(255, 255, 255, .45);
  --shadow: 0 10px 40px rgba(0, 0, 0, .22), 0 0 0 .5px rgba(0, 0, 0, .2);
  --icon: 96px;
  --tile: 124px;
  --tile-h: 150px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bar-bg: rgba(30, 30, 32, .5);
    --bar-text: #f5f5f7;
    --pop-bg: rgba(44, 44, 46, .82);
    --pop-border: rgba(255, 255, 255, .14);
    --pop-text: #f5f5f7;
    --sep: rgba(255, 255, 255, .14);
    --muted: #a1a1a6;
    --win-bg: #262628;
    --win-text: #f5f5f7;
    --dock-bg: rgba(40, 40, 44, .35);
    --dock-border: rgba(255, 255, 255, .18);
    --shadow: 0 10px 40px rgba(0, 0, 0, .5), 0 0 0 .5px rgba(255, 255, 255, .15);
  }
}

body[data-size="s"] { --icon: 72px; --tile: 100px; --tile-h: 124px; }
body[data-size="l"] { --icon: 128px; --tile: 156px; --tile-h: 186px; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 13.5px;
  background: #1b1430;
  color: var(--bar-text);
  overflow: hidden;
  user-select: none;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, a { font: inherit; color: inherit; }

/* ---------- Wallpapers (light / dark variants) ---------- */
#wallpaper { position: fixed; inset: 0; z-index: 0; }
#wallpaper svg { width: 100%; height: 100%; display: block; }
#wallpaper .sky1 { stop-color: var(--sky1); }
#wallpaper .sky2 { stop-color: var(--sky2); }
#wallpaper .glow { stop-color: var(--glow); }
#wallpaper .w1 { fill: var(--w1); } #wallpaper .w2 { fill: var(--w2); } #wallpaper .w3 { fill: var(--w3); }
#wallpaper .w4 { fill: var(--w4); } #wallpaper .w5 { fill: var(--w5); }
#wallpaper path { transition: fill .6s; }

body[data-wallpaper="dune"] { --sky1: #f8dcc8; --sky2: #f2b49c; --glow: #fff3d6; --w1: #f0a07e; --w2: #e27d66; --w3: #c85d5d; --w4: #93405a; --w5: #50294b; }
body[data-wallpaper="lagoon"] { --sky1: #dff2ff; --sky2: #aed8f4; --glow: #ffffff; --w1: #8ccaee; --w2: #58a8de; --w3: #3886c8; --w4: #2364a8; --w5: #163f7a; }
body[data-wallpaper="dusk"] { --sky1: #f2def6; --sky2: #d4c0f0; --glow: #fff0fa; --w1: #b89ce6; --w2: #9677d8; --w3: #7455c2; --w4: #5539a3; --w5: #34226e; }
@media (prefers-color-scheme: dark) {
  body[data-wallpaper="dune"] { --sky1: #160f22; --sky2: #3a1e36; --glow: #b4564e; --w1: #4e2540; --w2: #6c2e44; --w3: #8e3c46; --w4: #b4554a; --w5: #d97c58; }
  body[data-wallpaper="lagoon"] { --sky1: #050f22; --sky2: #0b2447; --glow: #2c86bf; --w1: #102f5e; --w2: #154a86; --w3: #1b64a2; --w4: #2780bb; --w5: #3f9ecf; }
  body[data-wallpaper="dusk"] { --sky1: #0f0a20; --sky2: #20143c; --glow: #8a5fd0; --w1: #2b1f5c; --w2: #3c2b7c; --w3: #573d9c; --w4: #7653b6; --w5: #9d72cb; }
}

/* ---------- Menu bar ---------- */
#menubar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--menu-h); z-index: 20;
  display: flex; align-items: center; justify-content: space-between; padding: 0 10px;
  background: var(--bar-bg);
  backdrop-filter: blur(30px) saturate(1.8); -webkit-backdrop-filter: blur(30px) saturate(1.8);
  box-shadow: 0 .5px 0 var(--sep);
}
.menus, .status { display: flex; align-items: center; height: 100%; gap: 2px; }
.menu-title, .link {
  height: 22px; padding: 0 9px; border: 0; border-radius: 5px; background: none; cursor: default;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.menu-title.strong { font-weight: 700; }
.menu-title.brand svg { width: 16px; height: 16px; }
.menu-title.open, .menu-title:focus-visible, .link:hover, .link:focus-visible { background: rgba(127, 127, 127, .28); outline: none; }
.link svg { width: 15px; height: 15px; }
.link.off { color: #e5484d; }
.link.on svg { color: #1f9d55; }
@media (prefers-color-scheme: dark) { .link.on svg { color: #3dd68c; } .link.off { color: #ff6369; } }
#clock { padding: 0 8px; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- Dropdown & context menus ---------- */
.dropdown {
  position: fixed; z-index: 30; min-width: 220px; padding: 5px;
  background: var(--pop-bg); color: var(--pop-text);
  backdrop-filter: blur(40px) saturate(1.8); -webkit-backdrop-filter: blur(40px) saturate(1.8);
  border-radius: 9px; box-shadow: var(--shadow);
  border: .5px solid var(--pop-border);
}
.dropdown button, .dropdown a {
  display: flex; align-items: center; width: 100%; padding: 4px 10px 4px 24px; position: relative;
  border: 0; border-radius: 5px; background: none; text-align: left; text-decoration: none; cursor: default;
}
.dropdown button:hover, .dropdown a:hover, .dropdown button:focus-visible, .dropdown a:focus-visible { background: var(--accent); color: #fff; outline: none; }
.dropdown [aria-checked="true"]::before { content: '✓'; position: absolute; left: 8px; font-size: 12px; }
.dropdown hr { border: 0; height: 1px; background: var(--sep); margin: 5px 10px; }
.menu-label { display: block; padding: 3px 10px; font-size: 12px; font-weight: 600; color: var(--muted); }

/* ---------- Desktop (icons fill from the top-right, like a Mac) ---------- */
#desk {
  position: fixed; top: var(--menu-h); left: 0; right: 0; bottom: 0; z-index: 1;
  padding: 10px 14px 104px;
  display: grid; direction: rtl;
  grid-auto-flow: column;
  grid-template-rows: repeat(auto-fill, var(--tile-h));
  grid-auto-columns: var(--tile);
  gap: 4px 6px; align-content: start;
  overflow: auto hidden; scrollbar-width: thin;
}
.item {
  direction: ltr; width: var(--tile); height: var(--tile-h);
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding-top: 4px;
  outline: none; cursor: default;
}
.icon {
  width: calc(var(--icon) + 12px); height: calc(var(--icon) + 12px); flex: none;
  display: grid; place-items: center;
  border-radius: 8px; border: 1.5px solid transparent;
}
.icon svg { width: var(--icon); height: var(--icon); filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .25)); }
.icon img { max-width: var(--icon); max-height: var(--icon); display: block; }
.icon img.app-pic { width: var(--icon); height: var(--icon); object-fit: contain; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .3)); }
.icon img.thumb { border: 3px solid #fff; border-radius: 2px; box-shadow: 0 2px 6px rgba(0, 0, 0, .35); background: #fff; max-width: calc(var(--icon) - 6px); max-height: calc(var(--icon) - 6px); }
.item[aria-selected="true"] .icon { background: rgba(0, 0, 0, .22); border-color: rgba(255, 255, 255, .35); }
.item.launching .icon > * { animation: launch .45s ease-out; }
@keyframes launch { 40% { transform: scale(1.12); opacity: .7; } }

.label {
  max-width: 100%; padding: 1px 5px; border-radius: 4px;
  font-size: 12.5px; font-weight: 500; line-height: 1.25; text-align: center;
  color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .75), 0 0 6px rgba(0, 0, 0, .35);
  overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
body[data-size="l"] .label { font-size: 13.5px; }
.item[aria-selected="true"] .label { background: var(--accent); text-shadow: none; -webkit-line-clamp: 5; position: relative; z-index: 1; }

/* ---------- Dock ---------- */
#dock {
  position: fixed; left: 50%; bottom: 8px; transform: translateX(-50%); z-index: 15;
  display: flex; align-items: flex-end; gap: 6px; padding: 6px 8px;
  background: var(--dock-bg); border: .5px solid var(--dock-border); border-radius: 22px;
  backdrop-filter: blur(30px) saturate(1.6); -webkit-backdrop-filter: blur(30px) saturate(1.6);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .25);
}
.dock-item {
  position: relative; width: 60px; height: 60px; padding: 0; border: 0; background: none; cursor: default;
  transition: transform .18s cubic-bezier(.3, .7, .4, 1.3); transform-origin: bottom center;
}
.dock-item svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .25)); }
.dock-item:hover, .dock-item:focus-visible { transform: scale(1.4) translateY(-6px); outline: none; z-index: 1; }
.dock-item:hover + .dock-item, .dock-item:has(+ .dock-item:hover) { transform: scale(1.15) translateY(-2px); }
.dock-item.bounce { animation: bounce .6s ease-out; }
@keyframes bounce { 30% { transform: translateY(-18px); } 60% { transform: translateY(0); } 80% { transform: translateY(-6px); } }
.dock-sep { width: 1px; align-self: stretch; margin: 6px 4px; background: var(--dock-border); }
.tip {
  position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%) scale(.71);
  padding: 3px 10px; border-radius: 6px; white-space: nowrap; pointer-events: none;
  font-size: 13px; background: var(--pop-bg); color: var(--pop-text); box-shadow: var(--shadow);
  backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px);
  opacity: 0; transition: opacity .12s;
}
.dock-item:hover .tip, .dock-item:focus-visible .tip { opacity: 1; }

/* ---------- Notifications ---------- */
#notices {
  position: fixed; top: calc(var(--menu-h) + 10px); right: 12px; z-index: 25;
  display: flex; flex-direction: column; gap: 8px; width: min(350px, calc(100vw - 24px));
}
.notice {
  display: grid; grid-template-columns: 38px 1fr auto; gap: 10px; align-items: center;
  padding: 11px 12px; border-radius: 16px;
  background: var(--pop-bg); color: var(--pop-text); box-shadow: var(--shadow);
  backdrop-filter: blur(40px) saturate(1.8); -webkit-backdrop-filter: blur(40px) saturate(1.8);
  animation: slide-in .35s cubic-bezier(.2, .9, .3, 1.2);
}
.notice.out { animation: slide-out .3s ease-in forwards; }
@keyframes slide-in { from { transform: translateX(110%); } }
@keyframes slide-out { to { transform: translateX(110%); opacity: 0; } }
.notice svg { width: 38px; height: 38px; }
.notice b { display: block; font-weight: 600; }
.notice p { margin: 1px 0 0; font-size: 13px; color: var(--muted); line-height: 1.35; }
.notice.bad b { color: #e5484d; }
.notice .actions { display: flex; flex-direction: column; gap: 4px; }
.notice .actions button {
  border: 0; border-radius: 7px; padding: 4px 10px; font-size: 12.5px; font-weight: 500;
  background: rgba(127, 127, 127, .2); cursor: default;
}
.notice .actions button:hover { background: rgba(127, 127, 127, .35); }

/* ---------- Logo watermark ---------- */
.watermark {
  position: fixed; right: 24px; bottom: 22px; z-index: 0; width: 190px; height: auto;
  filter: brightness(0) invert(1); opacity: .2; pointer-events: none;
}
@media (max-width: 900px) { .watermark { bottom: 96px; width: 150px; } }

/* ---------- Pro ---------- */
.pro-chip {
  height: 20px; margin-right: 4px; padding: 0 9px; border: 0; border-radius: 99px; cursor: default;
  background: linear-gradient(135deg, #4facfe, #7b5cff); color: #fff;
  font-size: 11.5px; font-weight: 700; letter-spacing: .04em;
}
.pro-chip.active { background: rgba(127, 127, 127, .25); color: inherit; }
.pro-tag {
  margin-left: auto; padding: 0 6px; border-radius: 4px; font-size: 10px; font-weight: 700; letter-spacing: .05em;
  background: linear-gradient(135deg, #4facfe, #7b5cff); color: #fff;
}

.scrim {
  position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px; overflow: auto;
  background: rgba(10, 8, 20, .3);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  animation: fade .2s ease-out;
}
@keyframes fade { from { opacity: 0; } }
.window {
  width: min(480px, 100%); max-height: calc(100vh - 32px); overflow: auto;
  background: var(--win-bg); color: var(--win-text);
  border-radius: 14px; box-shadow: 0 25px 70px rgba(0, 0, 0, .4), 0 0 0 .5px var(--pop-border);
  animation: open .22s cubic-bezier(.2, .9, .3, 1.1);
}
@keyframes open { from { transform: scale(.95); opacity: 0; } }
.titlebar { position: relative; height: 38px; display: flex; align-items: center; padding: 0 14px; border-bottom: 1px solid var(--sep); }
.titlebar-title { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 600; font-size: 13px; pointer-events: none; }
.lights { display: flex; gap: 8px; position: relative; z-index: 1; }
.light { width: 12px; height: 12px; border-radius: 50%; border: 0; padding: 0; box-shadow: inset 0 0 0 .5px rgba(0, 0, 0, .2); }
.light.red { background: #ff5f57; cursor: default; }
.light.yellow { background: #febc2e; }
.light.green { background: #28c840; }

.btn {
  min-width: 96px; padding: 6px 16px; border-radius: 8px; border: .5px solid var(--pop-border);
  background: rgba(127, 127, 127, .14); font-weight: 500; cursor: default;
}
.btn.primary { background: var(--accent); color: #fff; border-color: transparent; }
.btn.big { padding: 10px 28px; font-size: 15px; font-weight: 600; }
.btn.small { min-width: 0; padding: 2px 10px; font-size: 12px; }
.btn:hover:not(:disabled) { filter: brightness(1.08); }
.btn:disabled { opacity: .5; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.pro-body { padding: 24px 28px 6px; text-align: center; }
.pro-badge {
  display: inline-block; padding: 3px 12px; border-radius: 99px;
  background: linear-gradient(135deg, #4facfe, #7b5cff); color: #fff; font-weight: 800; font-size: 12px; letter-spacing: .12em;
}
.pro-body h2 { margin: 12px 0 8px; font-size: 21px; letter-spacing: -.01em; }
.pro-body p { margin: 0 0 12px; font-size: 13.5px; line-height: 1.55; }
.pro-body .price { font-size: 14px; color: var(--muted); }
.pro-body .price b { font-size: 22px; color: var(--win-text); margin-right: 4px; }
.pro-body .fine, .pro-serial .fine { font-size: 12px; color: var(--muted); }
.pro-serial { margin: 10px 28px 0; padding: 14px 0 0; border-top: 1px solid var(--sep); }
.pro-serial label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; }
.row { display: flex; gap: 8px; }
.row.center { justify-content: center; flex-wrap: wrap; }
.pro-serial input {
  flex: 1; min-width: 0; padding: 7px 10px; border-radius: 8px;
  border: 1px solid var(--pop-border); background: rgba(127, 127, 127, .1); color: inherit;
  font: 13px ui-monospace, 'SF Mono', Consolas, monospace; letter-spacing: .03em;
}
.pro-serial input:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.serial-line code { font: 13px ui-monospace, 'SF Mono', Consolas, monospace; padding: 3px 8px; border-radius: 6px; background: rgba(127, 127, 127, .16); }
.pro-msg { min-height: 20px; margin: 10px 28px 18px; font-size: 13px; text-align: center; }
.pro-msg.bad { color: #e5484d; }
.pro-msg.good { color: #1a8a4a; }
@media (prefers-color-scheme: dark) { .pro-msg.bad { color: #ff6369; } .pro-msg.good { color: #3dd68c; } }


/* ---------- Small screens ---------- */
@media (max-width: 640px) {
  body[data-size] { --icon: 68px; --tile: 96px; --tile-h: 118px; }
  #desk { direction: ltr; grid-auto-flow: row; grid-template-rows: none; grid-template-columns: repeat(auto-fill, var(--tile)); justify-content: space-evenly; overflow: hidden auto; }
  .hide-sm, .link span { display: none; }
  .dock-item { width: 50px; height: 50px; }
  .watermark { width: 110px; right: 12px; bottom: 82px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; transition-duration: .001s !important; }
}
