:root {
  --fondo: #ffffff;
  --nero: #111113;
  --nero-2: #232326;
  --testo: #18181b;
  --testo-2: #6b6b73;
  --testo-3: #a1a1aa;
  --bordo: rgba(17, 17, 19, 0.09);
  --bianco: #ffffff;
  --accento: #ff3b30;
}

* { box-sizing: border-box; margin: 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 {
  overflow: hidden;
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
}

/* as big as the widest state (the recording bar) and the saved card under it: the preview frames this box */
.frame {
  position: relative;
  width: min(300px, 92vw);
  height: 196px;
  display: grid;
  justify-items: center;
  align-content: start;
  padding-top: 44px;
}

/* ---- the button: one black pill whose width GSAP sets for each state ---- */
.rec {
  position: relative;
  height: 52px;
  border: 0;
  padding: 0;
  border-radius: 999px;
  background: var(--nero);
  color: var(--bianco);
  font: inherit;
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08) inset, 0 8px 22px -10px rgba(17, 17, 19, 0.5), 0 2px 5px -2px rgba(17, 17, 19, 0.3);
  outline: none;
}
.rec:focus-visible { box-shadow: 0 0 0 3px var(--fondo), 0 0 0 5px var(--accento); }

/* a soft sheen on top of the black, so it reads as a material and not a hole */
.rec::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0) 55%);
  pointer-events: none;
  z-index: 2;
}

.layer {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: max-content;
  display: flex;
  align-items: center;
  white-space: nowrap;
}

.layer--idle { gap: 10px; padding: 0 22px 0 18px; }
.mark { width: 22px; height: 20px; display: block; }
.mark svg { width: 100%; height: 100%; overflow: visible; display: block; }
.mark__screen, .mark__stand { fill: none; stroke: rgba(255, 255, 255, 0.86); stroke-width: 1.6; stroke-linecap: round; }
.mark__lens { fill: var(--accento); }
.label {
  font-size: 15px;
  font-weight: 560;
  font-stretch: 100%;
  letter-spacing: -0.005em;
  display: inline-block;
}

.layer--count { width: 52px; justify-content: center; opacity: 0; visibility: hidden; }
.ring { position: absolute; inset: 0; width: 52px; height: 52px; transform: rotate(-90deg); }
.ring__track { fill: none; stroke: rgba(255, 255, 255, 0.14); stroke-width: 2; }
.ring__run { fill: none; stroke: var(--accento); stroke-width: 2; stroke-linecap: round; }
.digit {
  position: relative;
  width: 20px;
  height: 26px;
  overflow: hidden;
  font-size: 22px;
  font-weight: 640;
  line-height: 26px;
  text-align: center;
}
.digit span { position: absolute; left: 0; right: 0; top: 0; }

.layer--live { gap: 0; padding: 0 8px 0 8px; opacity: 0; visibility: hidden; }
.stop {
  width: 36px; height: 36px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.06);
  transition: background-color 0.2s;
}
.stop__shape {
  width: 14px; height: 14px;
  background: var(--accento);
  border-radius: 50%;
  display: block;
}
.time {
  display: flex;
  margin: 0 12px 0 12px;
  font-size: 16px;
  font-weight: 560;
  font-stretch: 92%;
  letter-spacing: 0.01em;
  height: 22px;
  line-height: 22px;
}
.time .col { position: relative; display: inline-block; width: 0.62em; height: 22px; overflow: hidden; text-align: center; }
.time .col span { position: absolute; left: 0; right: 0; top: 0; }
.time .sep { display: inline-block; width: 0.32em; text-align: center; color: rgba(255, 255, 255, 0.55); }
.time.is-paused { color: rgba(255, 255, 255, 0.5); }
.hair { width: 1px; height: 20px; background: rgba(255, 255, 255, 0.16); }
.pause {
  width: 36px; height: 36px;
  margin-left: 6px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  transition: background-color 0.2s;
}
.pause svg { width: 18px; height: 18px; display: block; overflow: visible; }
.pause__bar { fill: rgba(255, 255, 255, 0.9); }
.pause__play { fill: rgba(255, 255, 255, 0.9); opacity: 0; }

@media (hover: hover) {
  .stop:hover { background: rgba(255, 59, 48, 0.18); }
  .pause:hover { background: rgba(255, 255, 255, 0.1); }
}

.hint {
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--testo-3);
  letter-spacing: 0.005em;
}

/* ---- the clip once saved: a small card under the button ---- */
.saved {
  position: absolute;
  left: 50%;
  top: 112px;
  width: min(268px, 88vw);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px 10px 10px;
  border-radius: 16px;
  background: var(--bianco);
  border: 1px solid var(--bordo);
  box-shadow: 0 14px 30px -18px rgba(17, 17, 19, 0.35), 0 2px 6px -3px rgba(17, 17, 19, 0.12);
  transform: translateX(-50%);
  opacity: 0;
  visibility: hidden;
}
.thumb {
  position: relative;
  flex: 0 0 auto;
  width: 66px; height: 44px;
  border-radius: 8px;
  overflow: hidden;
  background: linear-gradient(160deg, #f4f4f5, #e4e4e7);
  border: 1px solid rgba(17, 17, 19, 0.08);
}
.thumb__bar { position: absolute; left: 0; right: 0; top: 0; height: 9px; background: #ffffff; display: flex; gap: 2px; align-items: center; padding-left: 4px; border-bottom: 1px solid rgba(17, 17, 19, 0.06); }
.thumb__bar i { width: 3px; height: 3px; border-radius: 1px; background: #d4d4d8; }
.thumb__lines { position: absolute; left: 7px; top: 15px; display: grid; gap: 4px; }
.thumb__lines i { display: block; height: 3px; border-radius: 2px; background: #c4c4ca; }
.thumb__lines i:nth-child(1) { width: 34px; background: #a1a1aa; }
.thumb__lines i:nth-child(2) { width: 46px; }
.thumb__lines i:nth-child(3) { width: 26px; }
.thumb__len {
  position: absolute;
  right: 4px; bottom: 4px;
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(17, 17, 19, 0.78);
  color: #ffffff;
  font-size: 9px;
  font-weight: 600;
  line-height: 12px;
}
.saved__text { display: grid; gap: 2px; min-width: 0; }
.saved__text b { display: flex; align-items: center; gap: 5px; font-size: 13.5px; font-weight: 600; color: var(--testo); }
.saved__text span { font-size: 12px; color: var(--testo-2); white-space: nowrap; }
.tick { width: 15px; height: 15px; flex: 0 0 auto; }
.tick path { fill: none; stroke: #16a34a; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* the drawn pointer of the autopilot */
.ghost {
  position: fixed;
  left: 0; top: 0;
  width: 22px; height: 22px;
  fill: #111113;
  stroke: #ffffff;
  stroke-width: 1.4;
  stroke-linejoin: round;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  z-index: 10;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.2));
}

@media (max-width: 360px) {
  .label { font-size: 14px; }
  .layer--idle { padding: 0 18px 0 15px; }
}
