:root {
  --fondo: #ffffff;
  --carta: #ffffff;
  --testo: #17171a;
  --testo-2: #6a6a72;
  --testo-3: #a3a3ab;
  --bordo: rgba(17, 17, 19, 0.1);
  --riga: rgba(17, 17, 19, 0.07);
  --binario: #efeff1;
  --accento: #ee7a2b;
  --accento-tenue: #fff3e9;
  --sole: #f5b53d;
  --focus: #6d5efc;
}

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

html, body { height: 100%; }

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

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

/* the card, on its own */
.card {
  position: relative;
  width: min(372px, calc(100vw - 32px));
  background: var(--carta);
  border-radius: 22px;
  box-shadow: 0 0 0 1px var(--bordo), 0 1px 2px rgba(17, 17, 19, 0.04), 0 22px 44px -26px rgba(17, 17, 19, 0.38);
  padding: 14px 16px 16px;
  user-select: none;
  -webkit-user-select: none;
}

.card__head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.card__mark {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: #f4f4f5;
}
.card__mark svg { width: 17px; height: 17px; fill: none; stroke: var(--testo); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.card__who { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.card__hotel { font-size: 14px; font-weight: 620; font-stretch: 104%; }
.card__room { font-size: 12.5px; color: var(--testo-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* one line high: the old word leaves before the new one comes in */
.card__badge {
  margin-left: auto;
  flex: none;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: #f4f4f5;
  color: var(--testo-2);
  font-size: 12px;
  font-weight: 560;
  line-height: 24px;
  overflow: hidden;
  white-space: nowrap;
  transition: background-color 0.35s ease, color 0.35s ease;
}
.card__badge > span { display: block; }
.card.is-done .card__badge { background: var(--accento-tenue); color: var(--accento); }

/* the sky: the arc of the day and the sun riding it */
.sky {
  height: clamp(64px, 15vh, 96px);
  margin: 6px -4px 0;
}
.sky__svg { display: block; width: 100%; height: 100%; overflow: visible; }
.sky__arc { fill: none; stroke: var(--riga); stroke-width: 1.2; stroke-dasharray: 2 5; stroke-linecap: round; }
.sky__trail { fill: none; stroke: var(--sole); stroke-width: 1.6; stroke-linecap: round; opacity: 0.85; }
.sky__horizon { stroke: var(--bordo); stroke-width: 1; }
#sky-glow stop { stop-color: var(--sole); }
.sun__disc { fill: var(--sole); }
.sun__shine { fill: #ffffff; opacity: 0.55; }
.sun__rays line { stroke: var(--sole); stroke-width: 1.6; stroke-linecap: round; }

/* the time, big, and the price beside it */
.readout {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}
.readout__time {
  height: 46px;
  overflow: hidden;
  font-size: 42px;
  line-height: 46px;
  font-weight: 560;
  font-stretch: 112%;
  letter-spacing: -0.02em;
}
.readout__time > span { display: block; }
.readout__side { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; padding-bottom: 5px; }
.readout__price, .readout__note { overflow: hidden; white-space: nowrap; }
.readout__price { height: 20px; font-size: 15px; line-height: 20px; font-weight: 600; }
.readout__note { height: 16px; font-size: 12px; line-height: 16px; color: var(--testo-2); }
.readout__price > span, .readout__note > span { display: block; text-align: right; }
.card.is-late .readout__price { color: var(--accento); }

/* the track of the day, from eleven to four */
.track { margin-top: 12px; touch-action: none; cursor: pointer; }
.track__rail {
  position: relative;
  height: 30px;
}
.track__rail::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 12px;
  height: 6px;
  border-radius: 3px;
  background: var(--binario);
}
/* after two o'clock the day is on request: a light hatch on the rail */
.track__request {
  position: absolute;
  top: 12px;
  height: 6px;
  right: 0;
  width: 40%;
  border-radius: 0 3px 3px 0;
  background: repeating-linear-gradient(135deg, rgba(17, 17, 19, 0.07) 0 2px, transparent 2px 5px);
}
.track__fill {
  position: absolute;
  left: 0;
  top: 12px;
  height: 6px;
  width: 0;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--sole), var(--accento));
}
.track__ticks { position: absolute; inset: 0; pointer-events: none; }
.track__ticks i {
  position: absolute;
  top: 22px;
  width: 1px;
  height: 4px;
  background: var(--testo-3);
  opacity: 0.6;
  transform: translateX(-0.5px);
}
.track__ticks i.is-half { height: 2px; opacity: 0.35; }
.track__ticks i.is-past { background: var(--accento); opacity: 0.9; }

.handle {
  position: absolute;
  left: 0;
  top: 3px;
  width: 24px;
  height: 24px;
  margin-left: -12px;
  border-radius: 50%;
  outline: none;
  cursor: grab;
  touch-action: none;
}
.handle__knob {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 0 1px rgba(17, 17, 19, 0.12), 0 2px 6px rgba(17, 17, 19, 0.18), inset 0 -1px 0 rgba(17, 17, 19, 0.06);
}
.handle__knob::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  border-radius: 2px;
  background: var(--accento);
  transform: rotate(45deg) scale(0.75);
  opacity: 0.95;
}
.handle:focus-visible .handle__knob { box-shadow: 0 0 0 3px #ffffff, 0 0 0 5px var(--focus); }
.track.is-dragging .handle { cursor: grabbing; }
.card.is-done .track { cursor: default; }
.card.is-done .handle { cursor: default; }

.track__labels {
  display: flex;
  justify-content: space-between;
  margin-top: 2px;
  font-size: 11px;
  color: var(--testo-3);
}
.track__labels span { width: 0; display: flex; justify-content: center; }
.track__labels span.is-past { color: var(--testo-2); }

/* the button: an action until it is confirmed, then the confirmation itself */
.cta {
  position: relative;
  width: 100%;
  height: 50px;
  margin-top: 14px;
  border: 0;
  border-radius: 14px;
  background: var(--testo);
  color: #ffffff;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  font-stretch: 106%;
  cursor: pointer;
  overflow: hidden;
  transition: background-color 0.35s ease, color 0.35s ease;
}
.cta:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.cta.is-idle { background: #f4f4f5; color: var(--testo-2); cursor: default; }
.cta.is-done { background: var(--accento-tenue); color: var(--accento); }
.cta__sweep {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--sole), var(--accento));
  transform: scaleX(0);
  transform-origin: left center;
}
.cta__label {
  position: relative;
  display: block;
  height: 22px;
  line-height: 22px;
  overflow: hidden;
}
.cta__label > span { display: inline-flex; align-items: center; gap: 7px; }
.cta__check { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

@media (hover: hover) {
  .handle:hover .handle__knob { box-shadow: 0 0 0 1px rgba(17, 17, 19, 0.16), 0 3px 9px rgba(17, 17, 19, 0.22), inset 0 -1px 0 rgba(17, 17, 19, 0.06); }
  .cta:not(.is-idle):not(.is-done):hover { background: #2a2a30; }
  .cta.is-done:hover { background: #ffe9d6; }
}

/* the drawn pointer of the autopilot */
.ghost {
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  fill: #17171a;
  stroke: #ffffff;
  stroke-width: 1.3;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.22));
  pointer-events: none;
  opacity: 0;
  z-index: 5;
}

/* short screens: a lower sky and a tighter card */
@media (max-height: 460px) {
  .card { padding: 10px 14px 12px; }
  .sky { height: 54px; margin-top: 2px; }
  .readout { margin-top: 4px; }
  .readout__time { font-size: 34px; height: 40px; line-height: 40px; }
  .track { margin-top: 6px; }
  .cta { height: 44px; margin-top: 8px; }
}
@media (max-width: 360px) {
  .card__room { font-size: 12px; }
  .readout__time { font-size: 36px; }
}
