:root {
  --fondo: #ffffff;
  --carta: #ffffff;
  --inchiostro: #15171c;
  --grigio: #6c717e;
  --tenue: #a7acb8;
  --linea: rgba(21, 23, 28, 0.07);
  --binario: #f1f2f5;
  /* the light of each scene, from the warmest to the coolest */
  --luce-morning: #ffad5c;
  --luce-focus: #8fb6ff;
  --luce-movie: #7a6cff;
  --luce-night: #ff7442;
  /* the colour temperature scale, 1800 K to 6500 K */
  --scala: linear-gradient(90deg, #ff7a3a 0%, #ffae5e 22%, #ffe0b8 48%, #f4f6ff 68%, #a9c6ff 100%);
  --font: 'Mona Sans Variable', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--fondo);
  color: var(--inchiostro);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }

.stage {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(10px, 3vh, 32px) 12px;
}

/* the widget */
.scenes {
  --tint: #ffad5c;
  --mx: 50%;
  position: relative;
  width: min(372px, 94vw);
  padding: clamp(16px, 3.4vh, 22px) 18px 16px;
  border-radius: 30px;
  background: var(--carta);
  overflow: hidden;
  isolation: isolate;
  box-shadow:
    0 0 0 1px var(--linea),
    0 1px 1px rgba(21, 23, 28, 0.03),
    0 4px 10px -4px rgba(21, 23, 28, 0.08),
    0 22px 44px -18px rgba(21, 23, 28, 0.16);
}
/* the light of the room, falling from the top right corner */
.scenes__light {
  position: absolute; inset: -40% -30% 30% 20%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--tint) 44%, transparent), color-mix(in srgb, var(--tint) 14%, transparent) 55%, transparent 100%);
  opacity: var(--glow, 1);
  pointer-events: none;
  z-index: -1;
}
/* a wave of light that leaves the lens when a scene arrives */
.scenes__wash {
  position: absolute; left: 0; top: 0;
  width: 520px; height: 520px; margin: -260px 0 0 -260px;
  border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--tint) 26%, transparent), transparent 70%);
  opacity: 0;
  pointer-events: none;
  z-index: -1;
}
/* a 1px edge that catches the tint at the top */
.scenes__edge {
  position: absolute; inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(170deg, color-mix(in srgb, var(--tint) 55%, white) 0%, transparent 38%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.8;
  pointer-events: none;
}

.scenes__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: clamp(14px, 3vh, 22px);
}
.scenes__now { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.scenes__room { font-size: 12.5px; font-weight: 500; color: var(--grigio); letter-spacing: 0.01em; }
.scenes__name {
  position: relative;
  display: block;
  height: 1.15em;
  margin: 4px 0 6px;
  font-size: clamp(26px, 4.6vh, 31px);
  font-weight: 620;
  letter-spacing: -0.025em;
  line-height: 1.15;
  overflow: hidden;
}
.scenes__word { position: absolute; left: 0; top: 0; white-space: nowrap; font-stretch: 100%; }
.scenes__meta { font-size: 12.5px; color: var(--grigio); font-variant-numeric: tabular-nums; }
.scenes__sep { color: var(--tenue); margin: 0 2px; }
.scenes__num { font-variant-numeric: tabular-nums; }

.warmth { display: flex; flex-direction: column; align-items: flex-end; padding-top: 2px; flex: none; }
.warmth__value { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.warmth__bar {
  position: relative;
  width: 104px; height: 4px;
  margin: 9px 0 6px;
  border-radius: 4px;
  background: var(--scala);
  box-shadow: inset 0 0 0 0.5px rgba(21, 23, 28, 0.12);
}
.warmth__mark {
  position: absolute; left: 0; top: 50%;
  width: 4px; height: 14px; margin: -7px 0 0 -2px;
  border-radius: 3px;
  background: #fff;
  box-shadow: 0 0 0 0.5px rgba(21, 23, 28, 0.25), 0 1px 3px rgba(21, 23, 28, 0.25);
}
.warmth__ends { display: flex; justify-content: space-between; width: 104px; font-size: 10px; color: var(--tenue); letter-spacing: 0.02em; }

/* the track with the four scenes */
.track {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  height: 72px;
  padding: 4px;
  border-radius: 22px;
  background: var(--binario);
  box-shadow: inset 0 1px 2px rgba(21, 23, 28, 0.06), inset 0 0 0 1px rgba(21, 23, 28, 0.03);
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}
/* the light under the glass: a coloured glow that rides with the lens */
.track__glow {
  position: absolute; left: 0; top: 50%;
  width: 70px; height: 46px; margin: -23px 0 0 -35px;
  border-radius: 50%;
  background: var(--tint);
  filter: blur(14px);
  opacity: 0.55;
  pointer-events: none;
}
.lens {
  position: absolute; left: 4px; top: 4px; bottom: 4px;
  width: calc((100% - 8px) / 4);
  pointer-events: none;
  z-index: 1;
}
.lens__body {
  position: absolute; inset: 0;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.62));
  -webkit-backdrop-filter: blur(8px) saturate(1.8);
  backdrop-filter: blur(8px) saturate(1.8);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 1),
    inset 0 -1px 0 rgba(21, 23, 28, 0.05),
    0 0 0 0.5px rgba(21, 23, 28, 0.08),
    0 1px 2px rgba(21, 23, 28, 0.08),
    0 6px 14px -6px color-mix(in srgb, var(--tint) 70%, rgba(21, 23, 28, 0.4));
  overflow: hidden;
}
/* a thin highlight that slides across the glass while it moves */
.lens__shine {
  position: absolute; top: -20%; bottom: -20%; left: 0;
  width: 22px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.9), transparent);
  transform: translateX(var(--shine, -40px)) skewX(-18deg);
  opacity: 0.7;
}

.seg {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: 18px;
  color: var(--grigio);
  transition: color 0.3s;
  -webkit-tap-highlight-color: transparent;
}
.seg:focus-visible { outline: 2px solid color-mix(in srgb, var(--tint) 80%, var(--inchiostro)); outline-offset: -2px; }
.seg[aria-checked="true"] { color: var(--inchiostro); }
.seg__icon {
  width: 22px; height: 22px;
  fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
  overflow: visible;
}
.ic__play, .ic__star { fill: currentColor; stroke-width: 1; }
.ic__core { fill: currentColor; fill-opacity: 0; }
.seg[aria-checked="true"] .ic__core { fill-opacity: 1; transition: fill-opacity 0.3s; }
.seg__label { font-size: 11.5px; font-weight: 560; letter-spacing: 0.005em; font-stretch: 100%; }
@media (hover: hover) {
  .seg:hover { color: var(--inchiostro); }
}

.pointer {
  position: absolute; left: 0; top: 0;
  width: 22px; height: 22px;
  fill: #15171c; stroke: #fff; stroke-width: 1.4; stroke-linejoin: round;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.25));
  pointer-events: none;
  opacity: 0;
  z-index: 20;
}

@media (max-width: 360px) {
  .scenes { padding-left: 14px; padding-right: 14px; }
  .warmth__bar, .warmth__ends { width: 84px; }
  .seg__label { font-size: 10.5px; }
}
