:root {
  --fondo: #f2f2f2;
  --pannello: #1b1b1f;
  --pannello-bordo: rgba(255, 255, 255, 0.07);
  --pista: rgba(255, 255, 255, 0.11);
  --pieno: #f6f6f4;
  --caldo: #ffd9a3;
  --sole-chiaro: #e4e4e7;
  --sole-scuro: #27272a;
  --testo: #f4f4f5;
  --testo-2: #a1a1aa;
  --notte: #f59e0b;
  --h: min(64vh, 340px, 92vw);
}

* { box-sizing: border-box; margin: 0; }

html, body { height: 100%; }

body {
  background: var(--fondo);
  font-family: "Mona Sans Variable", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.stage {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
  user-select: none;
  -webkit-user-select: none;
}

.set {
  display: flex;
  align-items: center;
  gap: clamp(14px, 4vmin, 28px);
  padding: 6px;
}

/* the screen beside the panel: a small phone that really gets brighter */
.screen {
  position: relative;
  height: var(--h);
  width: calc(var(--h) * 0.49);
  border-radius: calc(var(--h) * 0.085);
  background: #0e0e10;
  padding: calc(var(--h) * 0.018);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 24px 46px -22px rgba(0, 0, 0, 0.42), inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  flex: none;
}
.screen__glass {
  position: relative;
  height: 100%;
  border-radius: calc(var(--h) * 0.07);
  overflow: hidden;
  background: #fbfaf8;
}
.screen__notch {
  position: absolute; left: 50%; top: calc(var(--h) * 0.032);
  width: 26%; height: calc(var(--h) * 0.026);
  transform: translateX(-50%);
  border-radius: 99px;
  background: #0e0e10;
}
.app {
  position: absolute; inset: 0;
  padding: calc(var(--h) * 0.085) calc(var(--h) * 0.04) 0;
  display: flex; flex-direction: column; gap: calc(var(--h) * 0.026);
}
.app__bar { display: flex; align-items: center; gap: 6%; }
.app__logo { width: 13%; aspect-ratio: 1; border-radius: 28%; background: linear-gradient(140deg, #f97316, #e11d48); }
.app__avatar { margin-left: auto; width: 12%; aspect-ratio: 1; border-radius: 50%; background: linear-gradient(140deg, #a5b4fc, #6366f1); }
.app__line { display: block; height: calc(var(--h) * 0.018); border-radius: 99px; background: #e4e2de; }
.app__line.w40 { width: 40%; }
.app__line.w70 { width: 74%; }
.app__line.w50 { width: 52%; }
.app__hero {
  position: relative; height: 34%;
  border-radius: calc(var(--h) * 0.03);
  overflow: hidden;
  background: linear-gradient(180deg, #fb923c 0%, #f472b6 52%, #7c3aed 100%);
}
.app__sunset {
  position: absolute; left: 50%; bottom: 18%;
  width: 34%; aspect-ratio: 1; border-radius: 50%;
  transform: translate(-50%, 30%);
  background: radial-gradient(circle, #fff7ed 0%, #fed7aa 60%, rgba(254, 215, 170, 0) 72%);
}
.app__hill {
  position: absolute; left: -10%; right: -10%; bottom: -30%; height: 58%;
  border-radius: 50% 50% 0 0;
  background: #3b1d5a;
}
.app__title { font-size: calc(var(--h) * 0.044); font-weight: 650; letter-spacing: -0.02em; color: #18181b; }
.app__chips { display: flex; gap: 6%; margin-top: 2px; }
.app__chips span { flex: 1; height: calc(var(--h) * 0.06); border-radius: calc(var(--h) * 0.02); background: #efede9; }
.app__chips span:first-child { background: #18181b; }

.screen__warm, .screen__dim, .screen__shine { position: absolute; inset: 0; pointer-events: none; }
.screen__warm { background: #ff9d3c; mix-blend-mode: multiply; opacity: 0; }
.screen__dim { background: #000; opacity: 0.4; }
.screen__shine {
  background: linear-gradient(118deg, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0) 38%);
}

/* the control centre panel */
.panel {
  height: var(--h);
  width: clamp(108px, calc(var(--h) * 0.42), 150px);
  border-radius: calc(var(--h) * 0.085);
  background: var(--pannello);
  border: 1px solid var(--pannello-bordo);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 24px 46px -22px rgba(0, 0, 0, 0.45);
  padding: calc(var(--h) * 0.05) calc(var(--h) * 0.045);
  display: flex; flex-direction: column; align-items: stretch;
  gap: calc(var(--h) * 0.04);
  color: var(--testo);
}
.panel__head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.panel__label { font-size: clamp(11px, calc(var(--h) * 0.04), 13px); color: var(--testo-2); font-weight: 520; letter-spacing: 0.01em; }
.panel__value {
  display: flex; align-items: flex-start;
  font-size: clamp(13px, calc(var(--h) * 0.05), 17px); font-weight: 640; letter-spacing: -0.02em;
  height: 1.15em; line-height: 1.15em; overflow: hidden;
}
.pct { color: var(--testo-2); font-weight: 520; margin-left: 1px; }
.digits { display: flex; }
.col { display: block; overflow: hidden; height: 1.15em; transition: width 0.25s; }
.col__strip { display: flex; flex-direction: column; will-change: transform; }
.col__strip span { height: 1.15em; display: block; text-align: center; }

.pill {
  position: relative;
  flex: 1;
  min-height: 0;
  width: 78%;
  align-self: center;
  touch-action: none;
  cursor: grab;
  outline: none;
}
.pill:active { cursor: grabbing; }
.pill:focus-visible .pill__track { box-shadow: 0 0 0 2px var(--notte); }
.pill__track {
  position: absolute; inset: 0;
  border-radius: calc(var(--h) * 0.075);
  background: var(--pista);
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.pill__fill {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 45%;
  background: var(--pieno);
}
.pill__edge {
  position: absolute; left: 0; right: 0; top: 0; height: 1px;
  background: rgba(0, 0, 0, 0.08);
}
.sun {
  position: absolute; left: 50%; bottom: calc(var(--h) * 0.03);
  width: calc(var(--h) * 0.11); height: calc(var(--h) * 0.11);
  margin-left: calc(var(--h) * -0.055);
  overflow: visible;
  pointer-events: none;
}
.sun__core { fill: var(--sun-colore, var(--sole-scuro)); }
.sun__rays line { stroke: var(--sun-colore, var(--sole-scuro)); stroke-width: 2.1; stroke-linecap: round; }

.night {
  display: flex; align-items: center; gap: 7px;
  border: 0; cursor: pointer;
  padding: calc(var(--h) * 0.028) calc(var(--h) * 0.03);
  border-radius: calc(var(--h) * 0.05);
  background: rgba(255, 255, 255, 0.08);
  color: var(--testo);
  font: inherit; text-align: left;
}
.night svg { width: clamp(15px, calc(var(--h) * 0.06), 20px); height: auto; flex: none; overflow: visible; }
.night__moon { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; }
.night__text { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.night__name { font-size: clamp(10px, calc(var(--h) * 0.036), 12px); font-weight: 600; white-space: nowrap; }
.night__state { font-size: clamp(9px, calc(var(--h) * 0.032), 11px); color: var(--testo-2); }
.night:focus-visible { outline: 2px solid var(--notte); outline-offset: 2px; }

.ghost {
  position: absolute; left: 0; top: 0;
  width: 22px; height: 22px;
  pointer-events: none;
  z-index: 5;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.25));
}
.ghost path { fill: #111113; stroke: #ffffff; stroke-width: 1.4; stroke-linejoin: round; }

@media (hover: hover) {
  .night:hover { background: rgba(255, 255, 255, 0.12); }
}
