:root {
  --fondo: #eeebe6;
  --fondo-alto: #f7f5f1;
  --inchiostro: #1b1b1f;
  --tenue: #77757c;
  --vetro: rgba(255, 255, 255, 0.52);
  --vetro-bordo: rgba(255, 255, 255, 0.85);
  --accento: #5b5bd6;
  --alone-a: #c9c4f2;
  --alone-b: #f3d2bd;
  --ico: 60px;
}

* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body {
  overflow: hidden;
  background: var(--fondo);
  color: var(--inchiostro);
  font-family: "Mona Sans Variable", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.stage {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

/* the wallpaper: a warm paper with two soft lights and a little grain */
.wall { position: absolute; inset: 0; background: radial-gradient(120% 90% at 50% 0%, var(--fondo-alto), var(--fondo) 70%); }
.wall__glow { position: absolute; border-radius: 50%; filter: blur(60px); opacity: 0.7; }
.wall__glow--a { width: 46vmax; height: 46vmax; left: -12vmax; top: 18%; background: var(--alone-a); opacity: 0.45; }
.wall__glow--b { width: 40vmax; height: 40vmax; right: -14vmax; top: 34%; background: var(--alone-b); opacity: 0.5; }
.wall__grain {
  position: absolute; inset: 0; opacity: 0.08; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='.8'/></svg>");
}

.head {
  position: absolute; left: 0; right: 0; top: 9vh;
  display: flex; flex-direction: column; align-items: center; gap: 0.5em;
  font-size: clamp(12px, min(1.6vw, 2.4vh), 15px);
}
.head__os {
  display: inline-flex; align-items: center; gap: 0.45em;
  font-weight: 650; font-stretch: 112%; letter-spacing: 0.01em;
}
.head__os svg { width: 1.05em; height: 1.05em; }
.head__hint { color: var(--tenue); font-size: 0.92em; }

/* the suggestions shelf: a soft frosted strip the apps are taken from */
.shelf { position: absolute; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: calc(var(--ico) * 0.46); }
.shelf__label { font-size: clamp(10px, min(1.25vw, 2vh), 12px); color: var(--tenue); letter-spacing: 0.06em; text-transform: uppercase; font-weight: 600; }
.shelf__tray {
  display: block;
  border-radius: 999px;
  border: 1px dashed rgba(27, 27, 31, 0.16);
  background: rgba(255, 255, 255, 0.28);
}

/* the dock: frosted glass, a light rim on top, a soft shadow under */
.dock {
  position: absolute; left: 0; top: 0;
  border-radius: calc(var(--ico) * 0.42);
  background: var(--vetro);
  border: 1px solid var(--vetro-bordo);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 -1px 0 rgba(0, 0, 0, 0.04) inset,
    0 18px 40px -18px rgba(40, 32, 70, 0.35),
    0 4px 12px -6px rgba(40, 32, 70, 0.18);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  backdrop-filter: blur(18px) saturate(1.4);
  will-change: transform, width;
}
.dock__shine {
  position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 45%);
}
.dock.is-target { border-color: rgba(91, 91, 214, 0.35); }

.dock-count {
  position: absolute; left: 0; right: 0; text-align: center;
  font-size: clamp(10px, min(1.3vw, 2vh), 12.5px); color: var(--tenue);
  font-variant-numeric: tabular-nums;
}
.dock-count span { display: inline-block; color: var(--inchiostro); font-weight: 650; min-width: 0.7em; }

/* the icons: one element for the physics (position, lean), one child for the look */
.icons { position: absolute; inset: 0; pointer-events: none; }
.ico {
  position: absolute; left: 0; top: 0;
  width: var(--ico); height: var(--ico);
  margin: calc(var(--ico) / -2) 0 0 calc(var(--ico) / -2);
  pointer-events: auto; cursor: grab;
  will-change: transform;
  touch-action: none;
}
.ico.is-held { cursor: grabbing; z-index: 5; }
.ico__face {
  position: absolute; inset: 0;
  border-radius: 23%;
  display: grid; place-items: center;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.45) inset,
    0 -1px 0 rgba(0, 0, 0, 0.12) inset,
    0 6px 14px -6px rgba(30, 24, 60, 0.45),
    0 1px 3px rgba(30, 24, 60, 0.18);
  transition: box-shadow 0.25s;
}
.ico.is-held .ico__face {
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.45) inset,
    0 -1px 0 rgba(0, 0, 0, 0.12) inset,
    0 22px 30px -12px rgba(30, 24, 60, 0.45),
    0 6px 10px -4px rgba(30, 24, 60, 0.22);
}
.ico__face::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.38), rgba(255, 255, 255, 0) 48%);
}
.ico__face svg { width: 62%; height: 62%; position: relative; z-index: 1; }
.ico__run {
  position: absolute; left: 50%; bottom: calc(var(--ico) * -0.2);
  width: calc(var(--ico) * 0.16); height: 2px; border-radius: 2px;
  margin-left: calc(var(--ico) * -0.08);
  background: rgba(27, 27, 31, 0.45);
  opacity: 0; transition: opacity 0.3s;
}
.ico.is-running .ico__run { opacity: 1; }
.ico.is-held .ico__run, .ico.is-off .ico__run { opacity: 0; }

.ico[data-app="notes"] .ico__face { background: linear-gradient(180deg, #ffd85a, #f5b81f); }
.ico[data-app="mail"] .ico__face { background: linear-gradient(180deg, #5aa2ff, #2b6ae6); }
.ico[data-app="cal"] .ico__face { background: linear-gradient(180deg, #ffffff, #ece9f2); }
.ico[data-app="tunes"] .ico__face { background: linear-gradient(180deg, #ff6b8b, #e2335e); }
.ico[data-app="photos"] .ico__face { background: linear-gradient(180deg, #ffffff, #efedf3); }
.ico[data-app="maps"] .ico__face { background: linear-gradient(180deg, #7ad48f, #34a853); }
.ico[data-app="weather"] .ico__face { background: linear-gradient(180deg, #5cc2ff, #2e7fe8); }

/* the name above the icon under the pointer */
.tip {
  position: absolute; left: 50%; bottom: calc(100% + var(--ico) * 0.2);
  transform: translateX(-50%) translateY(4px);
  padding: 0.32em 0.7em; border-radius: 0.5em;
  background: rgba(27, 27, 31, 0.86); color: #fff;
  font-size: clamp(10px, calc(var(--ico) * 0.2), 12.5px); font-weight: 560; white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity 0.18s, transform 0.25s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.ico.is-hover .tip { opacity: 1; transform: translateX(-50%) translateY(0); }
.ico.is-held .tip { opacity: 0; }

/* the puff when an icon leaves the dock */
.puffs { position: absolute; inset: 0; pointer-events: none; }
.puff { position: absolute; left: 0; top: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.95); box-shadow: 0 1px 4px rgba(30, 24, 60, 0.2); }

.toast {
  position: absolute; left: 50%; bottom: 7vh; transform: translateX(-50%);
  padding: 0.5em 0.95em; border-radius: 999px;
  background: rgba(27, 27, 31, 0.88); color: #fff;
  font-size: clamp(11px, min(1.4vw, 2.2vh), 13px); white-space: nowrap;
  opacity: 0; pointer-events: none;
}

.cursor { position: absolute; left: 0; top: 0; width: 22px; height: 22px; pointer-events: none; z-index: 20; opacity: 0; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.25)); }
