/* macOS 27 — Liquid Glass design system */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --accent: #0a84ff;
  --text: #1d1d1f;
  --text-2: rgba(60, 60, 67, .6);
  --sep: rgba(0, 0, 0, .09);
  --glass-bg: rgba(255, 255, 255, .42);
  --glass-strong: rgba(255, 255, 255, .62);
  --sidebar-bg: rgba(255, 255, 255, .34);
  --content-bg: rgba(255, 255, 255, .78);
  --menu-bg: rgba(250, 250, 252, .55);
  --hover: rgba(0, 0, 0, .05);
  --win-shadow: 0 24px 68px rgba(0, 0, 0, .38), 0 0 0 .5px rgba(0, 0, 0, .15);
  --glass-edge: inset 0 1px 0 rgba(255,255,255,.55), inset 0 -1px 0 rgba(255,255,255,.12),
                inset 1px 0 0 rgba(255,255,255,.22), inset -1px 0 0 rgba(255,255,255,.22);
}
body.dark {
  --text: #f5f5f7;
  --text-2: rgba(235, 235, 245, .55);
  --sep: rgba(255, 255, 255, .12);
  --glass-bg: rgba(40, 40, 46, .48);
  --glass-strong: rgba(44, 44, 50, .68);
  --sidebar-bg: rgba(35, 35, 40, .38);
  --content-bg: rgba(30, 30, 34, .82);
  --menu-bg: rgba(40, 40, 46, .55);
  --hover: rgba(255, 255, 255, .07);
  --glass-edge: inset 0 1px 0 rgba(255,255,255,.18), inset 0 -1px 0 rgba(255,255,255,.05),
                inset 1px 0 0 rgba(255,255,255,.08), inset -1px 0 0 rgba(255,255,255,.08);
}

html, body { height: 100%; overflow: hidden; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", system-ui, sans-serif;
  font-size: 13px; color: var(--text);
  -webkit-font-smoothing: antialiased;
  user-select: none; cursor: default;
}
input, textarea, [contenteditable] { user-select: text; cursor: text; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: default; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(128,128,128,.4); border-radius: 4px; background-clip: padding-box; border: 2px solid transparent; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Wallpaper / desktop ---------- */
#desktop { position: fixed; inset: 0; transition: background 1s ease; }
body[data-wallpaper="tahoe"] #desktop {
  background:
    radial-gradient(120% 90% at 15% 85%, #1637a0 0%, transparent 55%),
    radial-gradient(100% 80% at 85% 90%, #7a2ea0 0%, transparent 55%),
    radial-gradient(90% 70% at 70% 15%, #2f7cd8 0%, transparent 60%),
    radial-gradient(70% 60% at 30% 20%, #6ec3f0 0%, transparent 55%),
    linear-gradient(160deg, #3a6fd8 0%, #2a3f9e 45%, #131c52 100%);
}
body[data-wallpaper="dunes"] #desktop {
  background:
    radial-gradient(110% 80% at 20% 90%, #b0306a 0%, transparent 55%),
    radial-gradient(90% 70% at 85% 80%, #e0713d 0%, transparent 55%),
    radial-gradient(80% 60% at 60% 10%, #f6c76b 0%, transparent 60%),
    linear-gradient(165deg, #f2a05a 0%, #c85585 55%, #5c2560 100%);
}
body[data-wallpaper="aurora"] #desktop {
  background:
    radial-gradient(100% 80% at 80% 15%, #1fd1a5 0%, transparent 55%),
    radial-gradient(90% 70% at 20% 30%, #2b6be4 0%, transparent 55%),
    radial-gradient(110% 80% at 60% 95%, #0b3d4a 0%, transparent 60%),
    linear-gradient(170deg, #0e4d64 0%, #0a2540 60%, #050d1e 100%);
}
body[data-wallpaper="graphite"] #desktop {
  background:
    radial-gradient(100% 80% at 75% 20%, #5a5f6b 0%, transparent 55%),
    radial-gradient(90% 70% at 20% 85%, #33363e 0%, transparent 60%),
    linear-gradient(165deg, #4a4e58 0%, #26282e 55%, #101114 100%);
}
body[data-wallpaper="halo"] #desktop {
  background:
    radial-gradient(60% 50% at 50% 42%, #f7d9b0 0%, rgba(247,217,176,0) 60%),
    radial-gradient(90% 75% at 50% 45%, #e88b6a 0%, transparent 65%),
    radial-gradient(130% 100% at 50% 50%, #7a3f8f 0%, transparent 75%),
    linear-gradient(180deg, #2d1b52 0%, #0f0a24 100%);
}

/* ---------- Glass primitives ---------- */
.glass {
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(28px) saturate(190%);
  backdrop-filter: blur(28px) saturate(190%);
  box-shadow: 0 10px 40px rgba(0, 0, 0, .28), var(--glass-edge);
  border-radius: 22px;
}

/* ---------- Boot ---------- */
#boot {
  position: fixed; inset: 0; z-index: 10000; background: #000;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 60px;
  transition: opacity .6s ease;
}
#boot.done { opacity: 0; pointer-events: none; }
#boot svg { width: 74px; height: 74px; fill: #fff; }
#boot .bar { width: 220px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.22); overflow: hidden; }
#boot .bar i { display: block; height: 100%; width: 0; background: #fff; border-radius: 3px; transition: width 1.5s ease; }

/* ---------- Menu bar ---------- */
#menubar {
  position: fixed; top: 0; left: 0; right: 0; height: 30px; z-index: 5000;
  display: flex; align-items: center; justify-content: space-between; padding: 0 10px;
  color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,.35);
  background: linear-gradient(rgba(0,0,0,.14), rgba(0,0,0,0));
  font-size: 13.5px;
}
.mb-left, .mb-right { display: flex; align-items: center; height: 100%; }
.mb-item {
  display: flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px;
  border-radius: 7px; white-space: nowrap;
}
.mb-item:hover, .mb-item.open { background: rgba(255, 255, 255, .22); }
.mb-item.app-name { font-weight: 700; }
.mb-item svg { width: 16px; height: 16px; fill: currentColor; filter: drop-shadow(0 1px 2px rgba(0,0,0,.3)); }
.mb-item.apple svg { width: 15px; height: 15px; }

/* Dropdown menus */
.menu-panel {
  position: fixed; min-width: 220px; padding: 5px; z-index: 6000;
  background: var(--menu-bg);
  -webkit-backdrop-filter: blur(40px) saturate(200%);
  backdrop-filter: blur(40px) saturate(200%);
  border-radius: 14px;
  box-shadow: 0 18px 50px rgba(0,0,0,.35), var(--glass-edge);
  color: var(--text); text-shadow: none; font-size: 13.5px;
  transform-origin: top left; animation: menu-in .13s ease;
}
@keyframes menu-in { from { opacity: 0; transform: scale(.96) translateY(-4px); } }
.menu-item {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 5px 12px; border-radius: 8px;
}
.menu-item:hover { background: var(--accent); color: #fff; }
.menu-item .shortcut { opacity: .55; font-size: 12.5px; }
.menu-sep { height: 1px; background: var(--sep); margin: 5px 10px; }

/* ---------- Dock ---------- */
#dock-wrap { position: fixed; bottom: 8px; left: 0; right: 0; display: flex; justify-content: center; z-index: 5000; pointer-events: none; }
#dock {
  pointer-events: auto;
  display: flex; align-items: flex-end; gap: 7px; padding: 7px 10px;
  border-radius: 26px;
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(30px) saturate(190%);
  backdrop-filter: blur(30px) saturate(190%);
  box-shadow: 0 12px 40px rgba(0,0,0,.3), var(--glass-edge);
}
.dock-icon { position: relative; width: 52px; height: 52px; flex: 0 0 auto; transition: width .09s ease-out, height .09s ease-out; }
.dock-icon .icon-img {
  width: 100%; height: 100%; border-radius: 22.5%; overflow: hidden;
  box-shadow: 0 3px 9px rgba(0,0,0,.28);
}
.dock-icon .icon-img svg { width: 100%; height: 100%; display: block; }
.dock-icon .dot {
  position: absolute; bottom: -6px; left: 50%; transform: translateX(-50%);
  width: 4px; height: 4px; border-radius: 50%; background: rgba(255,255,255,.85);
  opacity: 0; transition: opacity .2s;
}
.dock-icon.running .dot { opacity: 1; }
.dock-icon .tip {
  position: absolute; bottom: calc(100% + 12px); left: 50%; transform: translateX(-50%);
  padding: 4px 12px; border-radius: 10px; white-space: nowrap; font-size: 13px;
  background: var(--menu-bg); color: var(--text);
  -webkit-backdrop-filter: blur(30px) saturate(180%); backdrop-filter: blur(30px) saturate(180%);
  box-shadow: 0 6px 20px rgba(0,0,0,.25), var(--glass-edge);
  opacity: 0; pointer-events: none; transition: opacity .12s;
}
.dock-icon:hover .tip { opacity: 1; }
.dock-icon.bounce { animation: dock-bounce .5s ease 2; }
@keyframes dock-bounce { 0%,100% { transform: translateY(0); } 40% { transform: translateY(-22px); } }
.dock-sep { width: 1px; align-self: stretch; margin: 6px 2px; background: var(--sep); }

/* ---------- Windows ---------- */
.window {
  position: absolute; display: flex; flex-direction: column;
  border-radius: 14px; overflow: hidden;
  background: var(--content-bg);
  -webkit-backdrop-filter: blur(50px) saturate(180%);
  backdrop-filter: blur(50px) saturate(180%);
  box-shadow: var(--win-shadow), var(--glass-edge);
  animation: win-in .22s cubic-bezier(.2, .9, .3, 1.1);
}
@keyframes win-in { from { opacity: 0; transform: scale(.92); } }
.window.closing { transition: all .18s ease-in; opacity: 0; transform: scale(.92); }
.window.mini { transition: all .3s cubic-bezier(.5, 0, .8, .4); opacity: 0; transform-origin: bottom center; }
.window:not(.focused) { box-shadow: 0 12px 34px rgba(0,0,0,.22), var(--glass-edge); }
.window:not(.focused) .titlebar { opacity: .65; }

.titlebar {
  height: 40px; flex: 0 0 auto; display: flex; align-items: center; position: relative;
  padding: 0 12px; background: var(--glass-bg);
  border-bottom: 1px solid var(--sep);
}
.win-title {
  position: absolute; left: 50%; transform: translateX(-50%);
  font-weight: 600; font-size: 13px; color: var(--text-2);
  max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.traffic { display: flex; gap: 8px; }
.tl { width: 12px; height: 12px; border-radius: 50%; position: relative; box-shadow: inset 0 0 0 .5px rgba(0,0,0,.15); }
.tl.close { background: #ff5f57; } .tl.min { background: #febc2e; } .tl.max { background: #28c840; }
.window:not(.focused) .tl { background: rgba(128,128,128,.45); }
.tl svg { position: absolute; inset: 0; margin: auto; width: 8px; height: 8px; opacity: 0; stroke: rgba(0,0,0,.55); stroke-width: 1.6; fill: none; }
.traffic:hover .tl svg { opacity: 1; }
.win-content { flex: 1; position: relative; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }

/* resize handles */
.rz { position: absolute; z-index: 30; }
.rz.n { top: -4px; left: 8px; right: 8px; height: 8px; cursor: ns-resize; }
.rz.s { bottom: -4px; left: 8px; right: 8px; height: 8px; cursor: ns-resize; }
.rz.e { right: -4px; top: 8px; bottom: 8px; width: 8px; cursor: ew-resize; }
.rz.w { left: -4px; top: 8px; bottom: 8px; width: 8px; cursor: ew-resize; }
.rz.ne { top: -5px; right: -5px; width: 12px; height: 12px; cursor: nesw-resize; }
.rz.sw { bottom: -5px; left: -5px; width: 12px; height: 12px; cursor: nesw-resize; }
.rz.nw { top: -5px; left: -5px; width: 12px; height: 12px; cursor: nwse-resize; }
.rz.se { bottom: -5px; right: -5px; width: 12px; height: 12px; cursor: nwse-resize; }

/* ---------- Shared app helpers ---------- */
.app-toolbar {
  flex: 0 0 auto; height: 46px; display: flex; align-items: center; gap: 8px; padding: 0 12px;
  border-bottom: 1px solid var(--sep); background: var(--glass-bg);
}
.tb-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 28px; height: 26px; padding: 0 6px; border-radius: 7px; color: var(--text-2);
}
.tb-btn:hover { background: var(--hover); color: var(--text); }
.tb-btn.active { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.tb-btn svg { width: 17px; height: 17px; }
.app-body { display: flex; flex: 1; min-height: 0; }
.app-sidebar {
  width: 200px; flex: 0 0 auto; display: flex; flex-direction: column; gap: 1px;
  padding: 10px 8px; overflow-y: auto;
  background: var(--sidebar-bg); border-right: 1px solid var(--sep);
  -webkit-backdrop-filter: blur(30px) saturate(180%); backdrop-filter: blur(30px) saturate(180%);
}
.sb-item {
  display: flex; align-items: center; gap: 8px; padding: 5px 9px; border-radius: 8px;
  font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sb-item:hover { background: var(--hover); }
.sb-item.active { background: color-mix(in srgb, var(--accent) 80%, transparent); color: #fff; }
.sb-item.active svg { color: #fff !important; }
.sb-item svg { width: 16px; height: 16px; flex: 0 0 auto; color: var(--accent); }
.field {
  background: var(--hover); border: 1px solid var(--sep); border-radius: 8px;
  padding: 4px 10px; font-size: 13px; color: var(--text); outline: none;
}
.field:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }

/* ---------- Control Center ---------- */
#cc-panel {
  position: fixed; top: 36px; right: 10px; width: 330px; z-index: 5500; padding: 12px;
  display: none; grid-template-columns: 1fr 1fr; gap: 10px;
  color: var(--text); text-shadow: none;
}
#cc-panel.show { display: grid; animation: menu-in .15s ease; }
.cc-card { background: color-mix(in srgb, var(--glass-strong) 70%, transparent); border-radius: 16px; padding: 10px; box-shadow: var(--glass-edge); }
.cc-card.wide { grid-column: 1 / -1; }
.cc-row { display: flex; align-items: center; gap: 9px; padding: 5px 2px; }
.cc-toggle {
  width: 30px; height: 30px; border-radius: 50%; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  background: rgba(128,128,128,.28); color: var(--text); transition: all .2s;
}
.cc-toggle.on { background: var(--accent); color: #fff; }
.cc-toggle svg { width: 15px; height: 15px; }
.cc-label { font-size: 12.5px; font-weight: 600; line-height: 1.2; }
.cc-label small { display: block; font-weight: 400; color: var(--text-2); font-size: 11px; }
.cc-slider { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; border-radius: 11px; background: rgba(128,128,128,.3); outline: none; }
.cc-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.3); cursor: pointer;
}
.cc-title { font-size: 12px; font-weight: 600; margin: 2px 0 6px; }

/* ---------- Spotlight ---------- */
#spotlight {
  position: fixed; top: 24%; left: 50%; transform: translateX(-50%); width: 640px; z-index: 7000;
  display: none; flex-direction: column; overflow: hidden; border-radius: 18px;
}
#spotlight.show { display: flex; animation: menu-in .15s ease; }
#spotlight input {
  background: transparent; border: 0; outline: none; font-size: 22px; padding: 14px 18px;
  color: var(--text); width: 100%; font-weight: 300;
}
#spotlight .results { max-height: 340px; overflow-y: auto; border-top: 1px solid var(--sep); padding: 6px; }
#spotlight .results:empty { display: none; }
.sp-item { display: flex; align-items: center; gap: 12px; padding: 7px 12px; border-radius: 10px; }
.sp-item.sel { background: var(--accent); color: #fff; }
.sp-item .icon-img { width: 30px; height: 30px; border-radius: 22.5%; overflow: hidden; flex: 0 0 auto; }
.sp-item .icon-img svg { width: 100%; height: 100%; display: block; }

/* ---------- Overlays & dialogs ---------- */
#brightness-overlay { position: fixed; inset: 0; background: #000; opacity: 0; pointer-events: none; z-index: 9000; transition: opacity .2s; }
#sleep-overlay { position: fixed; inset: 0; background: #000; opacity: 0; pointer-events: none; z-index: 9500; transition: opacity .8s; }
#sleep-overlay.on { opacity: 1; pointer-events: auto; }

.os-dialog {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 8000;
  width: 300px; padding: 24px 20px 16px; text-align: center; color: var(--text); text-shadow: none;
  animation: menu-in .15s ease;
}
.os-dialog h3 { font-size: 15px; margin: 10px 0 2px; }
.os-dialog p { font-size: 12.5px; color: var(--text-2); margin: 2px 0; }
.os-dialog .btn-row { display: flex; gap: 8px; margin-top: 16px; }
.os-btn {
  flex: 1; padding: 6px 0; border-radius: 9px; font-size: 13px;
  background: var(--hover); box-shadow: inset 0 0 0 .5px var(--sep);
}
.os-btn.primary { background: var(--accent); color: #fff; }
.os-btn:active { filter: brightness(.9); }
