:root {
  /* Accent sampled from the reference render: chartreuse lime on black. */
  --lime: #0a84ff;          /* systemBlue, dark */
  --lime-hi: #64d2ff;       /* systemCyan */
  --lime-lo: #0060df;
  --lime-glow: rgba(10, 132, 255, 0.34);
  --cyan: #64d2ff;
  --mono: #e7ecf3;

  --ground-0: #05070c;
  --ground-1: #0a0f18;
  --ground-2: #111826;

  /* Glass: a tinted pane, a bright top edge, an inner lift, a cast shadow. */
  --glass: rgba(18, 24, 35, 0.52);
  --glass-strong: rgba(12, 17, 26, 0.72);
  --glass-solid: rgba(10, 14, 22, 0.94);
  --glass-line: rgba(255, 255, 255, 0.14);
  --glass-line-soft: rgba(255, 255, 255, 0.07);
  --glass-edge: rgba(255, 255, 255, 0.30);
  --glass-inner: inset 0 1px 0 rgba(255, 255, 255, 0.16),
                 inset 0 -1px 0 rgba(0, 0, 0, 0.30);
  --blur: blur(28px) saturate(190%);
  --blur-lg: blur(44px) saturate(200%);

  --ink: #f1f5fb;
  --ink-2: #b8c2d4;
  --ink-3: #8994a8;

  --green: #34d95c;
  --red: #ff5f57;
  --yellow: #febc2e;

  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-pill: 999px;

  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;

  --font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter",
    "Segoe UI", system-ui, sans-serif;
  --font-mono: "SF Mono", "JetBrains Mono", ui-monospace, Menlo, monospace;

  --shadow-window: 0 40px 100px rgba(0, 0, 0, 0.68), 0 4px 14px rgba(0, 0, 0, 0.5);
  --shadow-dock: 0 16px 48px rgba(0, 0, 0, 0.55);

  --spring: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  --menubar-h: 28px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

html[data-theme="light"] {
  --ground-0: #e6eaf1;
  --ground-1: #eef1f7;
  --ground-2: #f7f9fc;
  --glass: rgba(255, 255, 255, 0.58);
  --glass-strong: rgba(255, 255, 255, 0.80);
  --glass-solid: rgba(252, 253, 255, 0.96);
  --glass-line: rgba(12, 20, 34, 0.14);
  --glass-line-soft: rgba(12, 20, 34, 0.08);
  --glass-edge: rgba(255, 255, 255, 0.9);
  --glass-inner: inset 0 1px 0 rgba(255, 255, 255, 0.9),
                 inset 0 -1px 0 rgba(12, 20, 34, 0.06);
  --ink: #0a1220;
  --ink-2: #3d4a63;
  --ink-3: #64708a;
  --lime: #007aff;          /* systemBlue, light */
  --lime-hi: #0a84ff;
  --lime-lo: #0040dd;
  --lime-glow: rgba(0, 122, 255, 0.22);
  --cyan: #32ade6;
  --mono: #10182a;
  --shadow-window: 0 36px 90px rgba(22, 34, 64, 0.24), 0 3px 10px rgba(22, 34, 64, 0.12);
  --shadow-dock: 0 14px 40px rgba(22, 34, 64, 0.2);
}

/* One glass recipe, applied everywhere. */
.glass {
  background: var(--glass);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--glass-line);
  box-shadow: var(--glass-inner);
  position: relative;
}
.glass::after {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--glass-edge), transparent);
  pointer-events: none;
  border-radius: inherit;
}

/* ---------------------------------------------------------------- base */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--ground-0);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  text-size-adjust: 100%;
}

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: var(--lime); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg, canvas { display: block; max-width: 100%; }

:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

.skip-link {
  position: fixed; top: -100px; left: var(--s-3); z-index: 999;
  padding: var(--s-2) var(--s-4); background: var(--glass-strong);
  border: 1px solid var(--glass-line); border-radius: var(--r-sm);
  transition: top 0.2s var(--ease-out);
}
.skip-link:focus { top: calc(var(--s-3) + var(--safe-t)); }

/* ---------------------------------------------------------------- stage */

#stage {
  position: fixed;
  inset: 0;
  isolation: isolate;
}

#wallpaper {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: url("/static/img/wallpaper-sm.jpg");
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 1s var(--ease-out), filter .8s var(--ease-out),
    transform .8s var(--ease-out);
}
@media (min-width: 1200px) {
  #wallpaper { background-image: url("/static/img/wallpaper.jpg"); }
}
.stage-ready #wallpaper, body:not(.stage-ready) #wallpaper { opacity: 1; }
.locked #wallpaper { filter: blur(10px) saturate(115%); transform: scale(1.05); }



#wallpaper-veil {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(115% 85% at 50% 45%, transparent 40%, rgba(2, 4, 8, 0.62) 100%),
    linear-gradient(180deg, rgba(2, 4, 8, 0.30) 0%, transparent 22%,
      transparent 74%, rgba(2, 4, 8, 0.42) 100%);
}
html[data-theme="light"] #wallpaper-veil {
  background:
    radial-gradient(115% 85% at 50% 45%, transparent 42%, rgba(206, 216, 232, 0.6) 100%),
    linear-gradient(180deg, rgba(226, 232, 244, 0.42) 0%, transparent 22%,
      transparent 74%, rgba(206, 216, 232, 0.45) 100%);
}

/* ---------------------------------------------------------------- boot */

#boot {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: var(--s-7);
  background: #000;
  color: #fff;
}
#boot[hidden] { display: none; }

.boot-mark {
  width: 76px;
  height: 76px;
  animation: boot-breathe 2.4s var(--ease-out) infinite alternate;
}
.boot-mark path, .boot-mark circle { stroke: #fff; }

@keyframes boot-breathe {
  from { opacity: 0.55; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

.boot-bar {
  width: 190px;
  height: 4px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.16);
  overflow: hidden;
}
.boot-bar span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--lime), var(--lime-hi));
  transition: width 0.35s var(--ease-out);
}
.boot-note {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  min-height: 1em;
}

/* ---------------------------------------------------------------- lock */

#lock {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  grid-template-rows: 1fr auto 1fr;
  justify-items: center;
  padding: calc(var(--s-7) + var(--safe-t)) var(--s-5)
    calc(var(--s-7) + var(--safe-b));
  text-align: center;
  transition: opacity 0.7s var(--ease-out), transform 0.8s var(--spring);
}
#lock[hidden] { display: none; }
#lock.dismissing { opacity: 0; transform: translateY(-14%) scale(1.06); }

.lock-clock {
  align-self: start;
  display: grid;
  gap: 2px;
  animation: rise 0.9s var(--ease-out) both;
}
.lock-time {
  font-size: clamp(64px, 15vw, 132px);
  font-weight: 250;
  letter-spacing: -0.04em;
  line-height: 0.92;
  font-variant-numeric: tabular-nums;
}
.lock-date {
  font-size: clamp(15px, 2.4vw, 21px);
  font-weight: 500;
  color: var(--ink-2);
}

.lock-identity {
  display: grid;
  justify-items: center;
  gap: var(--s-3);
  animation: rise 0.9s 0.12s var(--ease-out) both;
}
.avatar {
  width: 78px;
  height: 78px;
  border-radius: var(--r-pill);
  display: grid;
  place-content: center;
  font-size: 27px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #fff;
  background: linear-gradient(150deg, var(--lime), var(--lime-lo));
  box-shadow: 0 10px 30px var(--lime-glow);
}
.lock-name { font-size: 17px; font-weight: 600; }
.lock-role { font-size: 13px; color: var(--ink-2); }

.lock-enter {
  margin-top: var(--s-3);
  padding: 10px 22px;
  border-radius: var(--r-pill);
  background: var(--glass);
  border: 1px solid var(--glass-line);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  font-size: 14px;
  font-weight: 600;
  transition: transform 0.25s var(--spring), background 0.25s var(--ease-out);
}
.lock-enter:hover { transform: scale(1.04); background: var(--glass-strong); }
.lock-enter:active { transform: scale(0.97); }

.lock-hint {
  align-self: end;
  font-size: 12px;
  color: var(--ink-3);
  animation: pulse-hint 2.6s ease-in-out infinite;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}
@keyframes pulse-hint {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.9; }
}

/* ---------------------------------------------------------------- desk */

#desk {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: none;
}
.unlocked #desk { display: block; }

/* menu bar (desktop / tablet) */

#menubar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: calc(var(--menubar-h) + var(--safe-t));
  padding: var(--safe-t) var(--s-4) 0;
  display: flex;
  align-items: center;
  gap: var(--s-4);
  font-size: 13px;
  font-weight: 500;
  background: var(--glass);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border-bottom: 1px solid var(--glass-line-soft);
  z-index: 40;
  transform: translateY(-100%);
  transition: transform 0.6s var(--spring);
  box-shadow: var(--glass-inner);
}
.unlocked #menubar { transform: none; }

.menu-mark { width: 15px; height: 15px; flex: none; }
.menu-mark path, .menu-mark circle { stroke: var(--ink); }
.menu-item {
  padding: 2px 8px;
  border-radius: var(--r-xs);
  white-space: nowrap;
  transition: background 0.15s;
}
.menu-item:hover { background: var(--glass-line); }
.menu-item.is-app { font-weight: 700; }
.menu-right { margin-left: auto; display: flex; align-items: center; gap: var(--s-3); }
.menu-clock { font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }
.menu-icon { width: 16px; height: 16px; opacity: 0.85; }
.menu-icon path, .menu-icon rect, .menu-icon circle { stroke: var(--ink); }

/* windows (desktop) */

#windows { position: absolute; inset: 0; z-index: 20; }

.window {
  position: absolute;
  display: flex;
  flex-direction: column;
  min-width: 320px;
  min-height: 220px;
  border-radius: var(--r-lg);
  background: var(--glass-strong);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border: 1px solid var(--glass-line);
  box-shadow: var(--glass-inner), var(--shadow-window);
  overflow: hidden;
  transform-origin: center bottom;
  animation: window-in 0.42s var(--spring) both;
}
.window.is-closing { animation: window-out 0.24s var(--ease-out) both; }
.window.is-minimizing { animation: window-min 0.4s var(--ease-out) both; }
.window.is-max {
  inset: calc(var(--menubar-h) + var(--safe-t) + 6px) 6px 6px 6px !important;
  width: auto !important;
  height: auto !important;
  border-radius: var(--r-md);
}
.window.is-dragging { transition: none; will-change: transform; }
.window:not(.is-front) { box-shadow: 0 18px 50px rgba(0, 0, 0, 0.4); }
.window:not(.is-front) .titlebar-title { opacity: 0.5; }

@keyframes window-in {
  from { opacity: 0; transform: scale(0.9) translateY(24px); }
  to { opacity: 1; transform: none; }
}
@keyframes window-out {
  to { opacity: 0; transform: scale(0.94); }
}
@keyframes window-min {
  to { opacity: 0; transform: scale(0.3) translateY(60vh); }
}

.titlebar {
  height: 40px;
  flex: none;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 0 var(--s-3);
  border-bottom: 1px solid var(--glass-line-soft);
  cursor: grab;
  user-select: none;
}
.titlebar:active { cursor: grabbing; }

.lights { display: flex; gap: 8px; flex: none; }
.light {
  width: 12px; height: 12px;
  border-radius: var(--r-pill);
  display: grid; place-content: center;
  border: 0.5px solid rgba(0, 0, 0, 0.18);
}
.light svg { width: 7px; height: 7px; opacity: 0; transition: opacity 0.12s; }
.lights:hover .light svg { opacity: 0.65; }
.light--close { background: var(--red); }
.light--min { background: var(--yellow); }
.light--zoom { background: var(--green); }
.light:focus-visible svg { opacity: 0.85; }

.titlebar-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  flex: 1;
  text-align: center;
  padding-right: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.window-body {
  flex: 1;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.resize-handle {
  position: absolute;
  right: 0; bottom: 0;
  width: 18px; height: 18px;
  cursor: nwse-resize;
  touch-action: none;
}

/* ---------------------------------------------------------------- dock */

#dock {
  position: absolute;
  left: 50%;
  bottom: calc(10px + var(--safe-b));
  transform: translateX(-50%) translateY(140%);
  z-index: 45;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 7px;
  border-radius: var(--r-xl);
  background: var(--glass);
  backdrop-filter: blur(34px) saturate(180%);
  -webkit-backdrop-filter: blur(34px) saturate(180%);
  border: 1px solid var(--glass-line);
  box-shadow: var(--glass-inner), var(--shadow-dock);
  max-width: calc(100vw - 20px);
  transition: transform 0.7s var(--spring);
}
.unlocked #dock { transform: translateX(-50%); }

.dock-item > .tile { width: 100%; height: 100%; }
.dock-item {
  position: relative;
  width: 52px;
  height: 52px;
  flex: none;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: bottom center;
  transition: transform 0.22s var(--spring), filter 0.22s var(--ease-out);
}
.dock-item .glyph { width: 58%; height: auto; aspect-ratio: 1; }
.dock-item::after {
  content: "";
  position: absolute;
  bottom: -5px; left: 50%;
  width: 4px; height: 4px;
  border-radius: var(--r-pill);
  background: var(--ink);
  opacity: 0;
  transform: translateX(-50%);
  transition: opacity 0.2s;
}
.dock-item.is-open::after { opacity: 0.7; }
.dock-item:active { transform: scale(0.9) !important; }
.dock-sep {
  width: 1px;
  align-self: stretch;
  margin: 6px 3px;
  background: var(--glass-line);
  flex: none;
}

.dock-label {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  padding: 4px 10px;
  border-radius: var(--r-sm);
  background: var(--glass-strong);
  border: 1px solid var(--glass-line);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s, transform 0.16s var(--ease-out);
}
.dock-item:hover .dock-label,
.dock-item:focus-visible .dock-label {
  opacity: 1;
  transform: translateX(-50%);
}

/* app tile glyph colours */
.tile {
  border-radius: 22.5%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.tile--finder { background: linear-gradient(180deg, #4aa3ff 0%, #0a6ee0 100%); }
.tile--blue   { background: linear-gradient(180deg, #46a0ff 0%, #0a63d8 100%); }
.tile--safari { background: linear-gradient(180deg, #f2f7ff 0%, #cfe0f5 100%); }
.tile--safari .glyph { stroke: #0a84ff; stroke-width: 1.8; }
.tile--green  { background: linear-gradient(180deg, #5fdd6e 0%, #1aa32f 100%); }
.tile--orange { background: linear-gradient(180deg, #ffb44a 0%, #f0820a 100%); }
.tile--purple { background: linear-gradient(180deg, #c07af5 0%, #8a3fd6 100%); }
.tile--pink   { background: linear-gradient(180deg, #ff7a9c 0%, #e0325c 100%); }
.tile--grey   { background: linear-gradient(180deg, #8d93a1 0%, #5a6072 100%); }
.tile--dark   { background: linear-gradient(180deg, #3a4152 0%, #14181f 100%); }
.tile--mono   { background: linear-gradient(180deg, #f7f9fc 0%, #d3dae6 100%); }
.tile--mono .glyph { stroke: #1c2333; }
.tile--lime, .tile--deep, .tile--cyan, .tile--night, .tile--slate {
  background: linear-gradient(180deg, #46a0ff 0%, #0a63d8 100%);
}

.glyph { width: 58%; height: auto; aspect-ratio: 1; }
.dock-item::after {
  content: "";
  position: absolute;
  bottom: -5px; left: 50%;
  width: 4px; height: 4px;
  border-radius: var(--r-pill);
  background: var(--ink);
  opacity: 0;
  transform: translateX(-50%);
  transition: opacity 0.2s;
}
.dock-item.is-open::after { opacity: 0.7; }
.dock-item:active { transform: scale(0.9) !important; }
.dock-sep {
  width: 1px;
  align-self: stretch;
  margin: 6px 3px;
  background: var(--glass-line);
  flex: none;
}

.dock-label {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  padding: 4px 10px;
  border-radius: var(--r-sm);
  background: var(--glass-strong);
  border: 1px solid var(--glass-line);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s, transform 0.16s var(--ease-out);
}
.dock-item:hover .dock-label,
.dock-item:focus-visible .dock-label {
  opacity: 1;
  transform: translateX(-50%);
}

/* app tile glyph colours */
.tile {
  border-radius: 22.5%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.tile--lime { background: linear-gradient(160deg, #cdff4a, #86bd00); }
.tile--lime .glyph { stroke: #0a1400; }
.tile--deep { background: linear-gradient(160deg, #1d2a10, #0a1206);
  box-shadow: inset 0 0 0 1px rgba(180, 240, 26, 0.3); }
.tile--deep .glyph { stroke: var(--lime); }
.tile--cyan { background: linear-gradient(160deg, #5df0dc, #0f8a7a); }
.tile--cyan .glyph { stroke: #04211d; }
.tile--slate { background: linear-gradient(160deg, #38445c, #171e2c); }
.tile--mono { background: linear-gradient(160deg, #ffffff, #c6cfdd); }
.tile--mono .glyph { stroke: #10182a; }
.tile--night { background: linear-gradient(160deg, #2a3346, #0c1119); }
.glyph { stroke: #fff; stroke-width: 1.9; fill: none;
  stroke-linecap: round; stroke-linejoin: round; }
/* Apple's icon grid: continuous-corner squircle, top gloss, hairline, drop. */
.tile {
  border-radius: 22.37%;
  box-shadow:
    inset 0 1.5px 0 rgba(255, 255, 255, 0.45),
    inset 0 0 0 0.5px rgba(0, 0, 0, 0.16),
    0 1px 1px rgba(0, 0, 0, 0.20),
    0 8px 20px rgba(0, 0, 0, 0.32);
}
.tile::before {
  content: "";
  position: absolute;
  inset: 0 0 45% 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255,255,255,.30), rgba(255,255,255,0));
  pointer-events: none;
}
.tile { position: relative; }

/* ---------------------------------------------------------------- iOS */

#home {
  position: absolute;
  inset: 0;
  z-index: 15;
  display: none;
  flex-direction: column;
  padding: calc(var(--safe-t) + 44px) 22px calc(var(--safe-b) + 108px);
}
.shell-phone.unlocked #home,
.shell-tablet.unlocked #home { display: flex; }

#statusbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: calc(var(--safe-t) + 44px);
  padding: var(--safe-t) 26px 0;
  display: none;
  align-items: center;
  font-size: 14px;
  font-weight: 600;
  z-index: 50;
  pointer-events: none;
}
.shell-phone #statusbar { display: flex; }
.status-time { font-variant-numeric: tabular-nums; }
.status-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.status-right .menu-icon { width: 17px; height: 17px; }

.home-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px 14px;
  align-content: start;
}
.shell-tablet .home-grid { grid-template-columns: repeat(6, 1fr); gap: 26px 20px; }

.home-app {
  display: grid;
  justify-items: center;
  gap: 7px;
  animation: tile-in 0.5s var(--spring) both;
}
.home-app .tile { width: 100%; aspect-ratio: 1; max-width: 68px; }
.home-app .glyph { width: 54%; height: auto; aspect-ratio: 1; }
.home-app-label {
  font-size: 11.5px;
  font-weight: 500;
  text-align: center;
  line-height: 1.2;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}
html[data-theme="light"] .home-app-label { text-shadow: none; }
.home-app:active .tile { transform: scale(0.9); transition: transform 0.12s; }

@keyframes tile-in {
  from { opacity: 0; transform: scale(0.6); }
  to { opacity: 1; transform: none; }
}

#homedock {
  position: absolute;
  left: 14px; right: 14px;
  bottom: calc(var(--safe-b) + 12px);
  display: none;
  gap: 14px;
  padding: 12px;
  border-radius: var(--r-xl);
  background: var(--glass);
  backdrop-filter: blur(34px) saturate(180%);
  -webkit-backdrop-filter: blur(34px) saturate(180%);
  border: 1px solid var(--glass-line);
  z-index: 44;
  box-shadow: var(--glass-inner);
}
.widget {
  margin-top: auto;
  padding: 18px;
  border-radius: var(--r-xl);
  background: var(--glass);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid var(--glass-line);
  display: grid;
  gap: 10px;
  animation: tile-in 0.6s 0.25s var(--spring) both;
  box-shadow: var(--glass-inner);
}
.widget-eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.widget-thesis {
  font-size: clamp(16px, 4.2vw, 20px);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.32;
  background: linear-gradient(100deg, var(--ink) 35%, var(--lime) 75%, var(--lime-hi));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.widget-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.widget-btn {
  padding: 8px 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--glass-line);
  background: var(--glass-line-soft);
  font-size: 13px;
  font-weight: 600;
  transition: transform 0.2s var(--spring);
}
.widget-btn:active { transform: scale(0.96); }
.shell-desktop .widget { display: none; }

.shell-phone.unlocked #homedock,
.shell-tablet.unlocked #homedock { display: flex; }
#homedock .home-app { flex: 1; }
#homedock .home-app-label { display: none; }

.home-indicator {
  position: absolute;
  bottom: calc(var(--safe-b) + 5px);
  left: 50%;
  transform: translateX(-50%);
  width: 134px; height: 5px;
  border-radius: var(--r-pill);
  background: var(--ink);
  opacity: 0.35;
  z-index: 60;
  display: none;
  pointer-events: none;
}
.shell-phone.unlocked .home-indicator { display: block; }

/* full-screen app sheet for phone / tablet */

.sheet {
  position: absolute;
  inset: 0;
  z-index: 55;
  display: flex;
  flex-direction: column;
  background: var(--glass-strong);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  animation: sheet-in 0.42s var(--spring) both;
  box-shadow: var(--glass-inner);
}
.sheet.is-closing { animation: sheet-out 0.3s var(--ease-out) both; }
.shell-tablet .sheet {
  inset: calc(var(--safe-t) + 20px) 20px calc(var(--safe-b) + 96px);
  border-radius: var(--r-xl);
  border: 1px solid var(--glass-line);
  box-shadow: var(--shadow-window);
  overflow: hidden;
}

@keyframes sheet-in {
  from { opacity: 0; transform: scale(0.86); }
  to { opacity: 1; transform: none; }
}
@keyframes sheet-out {
  to { opacity: 0; transform: scale(0.9); }
}

.navbar {
  flex: none;
  min-height: 52px;
  padding: calc(var(--safe-t) + 8px) var(--s-4) 8px;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  border-bottom: 1px solid var(--glass-line-soft);
  background: var(--glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.shell-tablet .navbar { padding-top: 8px; }
.navbar-back {
  display: flex; align-items: center; gap: 3px;
  color: var(--lime); font-size: 15px; font-weight: 500;
  padding: 6px 4px; margin: -6px -4px;
}
.navbar-title {
  font-size: 16px; font-weight: 600; letter-spacing: -0.01em;
  position: absolute; left: 50%; transform: translateX(-50%);
  pointer-events: none;
}
.shell-tablet .navbar-title { position: static; transform: none; margin-left: var(--s-2); }
.sheet-body {
  flex: 1;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--safe-b) + 90px);
}
.shell-tablet .sheet-body { padding-bottom: var(--s-5); }

/* ---------------------------------------------------------------- spotlight */

#spotlight {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: none;
  justify-content: center;
  align-items: flex-start;
  padding: 14vh var(--s-4) var(--s-4);
  background: rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
#spotlight.is-open { display: flex; }
.spot-panel {
  width: min(620px, 100%);
  border-radius: var(--r-lg);
  background: var(--glass-strong);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border: 1px solid var(--glass-line);
  box-shadow: var(--glass-inner), var(--shadow-window);
  overflow: hidden;
  animation: window-in 0.3s var(--spring) both;
}
.spot-field {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-4);
  border-bottom: 1px solid var(--glass-line-soft);
}
.spot-field input {
  flex: 1; background: none; border: 0; outline: none;
  font-size: 20px; font-weight: 400; letter-spacing: -0.01em;
}
.spot-field input::placeholder { color: var(--ink-3); }
.spot-results { max-height: 46vh; overflow: auto; padding: var(--s-2); }
.spot-row {
  display: flex; align-items: center; gap: var(--s-3);
  width: 100%; padding: 9px var(--s-3);
  border-radius: var(--r-sm); text-align: left;
}
.spot-row[aria-selected="true"] { background: var(--sys-blue); color: #fff; }
.spot-row-kind { margin-left: auto; font-size: 11px; opacity: 0.6; }
.spot-empty { padding: var(--s-5); text-align: center; color: var(--ink-3); }

/* ---------------------------------------------------------------- misc */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-b) + 96px);
  transform: translate(-50%, 20px);
  z-index: 80;
  padding: 11px 18px;
  border-radius: var(--r-pill);
  background: var(--glass-strong);
  border: 1px solid var(--glass-line);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: var(--shadow-dock);
  font-size: 13px; font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.4s var(--spring);
  max-width: calc(100vw - 32px);
  text-align: center;
}
.toast.is-shown { opacity: 1; transform: translate(-50%, 0); }

/* ---------------------------------------------------------------- responsive */

@media (max-width: 1023px) {
  #windows, #dock { display: none; }
}

@media (min-width: 1024px) {
  #home, #homedock, #statusbar { display: none !important; }
}

@media (max-width: 699px) {
  #menubar { display: none; }
}

@media (min-width: 700px) and (max-width: 1023px) {
  #menubar { display: flex; }
}

/* ---------------------------------------------------------------- motion */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  #wallpaper { transition: none; }
}

@media (prefers-contrast: more) {
  :root { --glass-line: rgba(255, 255, 255, 0.32); --ink-2: #d3dae9; }
  .window, .sheet, #dock, #menubar { backdrop-filter: none; background: var(--ground-1); }
}

::selection { background: var(--lime); color: #0a1400; }
html[data-theme="light"] ::selection { background: var(--lime); color: #fff; }


/* ---------------------------------------------------------------- v3 */

/* Surfaces over the wallpaper never follow the theme: the photo is always dark. */
#lock, #menubar, #statusbar, .home-app-label, .widget, .home-indicator {
  --ink: #ffffff;
  --ink-2: rgba(255, 255, 255, 0.82);
  --ink-3: rgba(255, 255, 255, 0.62);
}
#lock, #menubar { color: #fff; }
.lock-time { color: #fff; text-shadow: 0 2px 24px rgba(0, 0, 0, 0.55); }
.lock-date, .lock-role { color: rgba(255, 255, 255, 0.88);
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.5); }
.lock-name { color: #fff; text-shadow: 0 1px 10px rgba(0, 0, 0, 0.5); }
.lock-hint { color: rgba(255, 255, 255, 0.7); }
.lock-enter { background: rgba(255, 255, 255, 0.20); color: #fff;
  border-color: rgba(255, 255, 255, 0.34); }
.lock-enter:hover { background: rgba(255, 255, 255, 0.30); }
#menubar { background: rgba(0, 0, 0, 0.30); border-bottom-color: rgba(255,255,255,.12); }
.menu-mark path, .menu-mark circle { stroke: #fff; }
.menu-icon path, .menu-icon rect, .menu-icon circle { stroke: #fff; }
.menu-item:hover { background: rgba(255, 255, 255, 0.18); }
.widget-thesis { background: none; color: #fff; -webkit-text-fill-color: #fff; }
.widget-btn { background: rgba(255,255,255,.18); border-color: rgba(255,255,255,.3);
  color: #fff; }

/* macOS system colours for controls */
:root {
  --sys-blue: #0a84ff;
  --sys-blue-press: #0060df;
  --sys-fill: rgba(120, 130, 150, 0.20);
  --sys-fill-hover: rgba(120, 130, 150, 0.32);
  --sys-field: rgba(255, 255, 255, 0.06);
  --sys-field-line: rgba(255, 255, 255, 0.16);
}
html[data-theme="light"] {
  --sys-blue: #007aff;
  --sys-blue-press: #0040dd;
  --sys-fill: rgba(0, 0, 0, 0.06);
  --sys-fill-hover: rgba(0, 0, 0, 0.11);
  --sys-field: #ffffff;
  --sys-field-line: rgba(0, 0, 0, 0.18);
}

.tile--art { padding: 0; }
.tile--art .art { width: 100%; height: 100%; display: block; }
.dock-item .art, .home-app .art { width: 100%; height: 100%; }
.dock-item > .tile, .home-app .tile { overflow: hidden; }

html[data-wall="portrait"] #wallpaper {
  background-image: url("/static/img/portrait.jpg") !important;
}
