:root {
  --fondo: #ffffff;
  --testo: #15161a;
  --testo-2: #565a66;
  --testo-3: #a7aab3;
  --linea: #e9eaee;
  --traccia: #f4f4f6;
  --bolla: #f2f2f5;
  --accento: #5a4bf0;        /* the single accent: Fenwick's violet, on the mark, the rail and the checks */
  --accento-velo: #efedfe;
  --ombra: 21, 22, 26;
}

* { 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;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.stage {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 12px;
  /* everything inside is in em: the piece grows with the width and with the height of the window */
  font-size: clamp(9px, min(3.3vw, 2.9vh), 18px);
}

/* the conversation keeps the height it has with everything open, so opening the steps never moves the page */
.chat {
  width: min(29em, calc(100vw - 24px));
  height: 25.6em;
  display: flex;
  flex-direction: column;
  --sh: 120%;
}

/* ---------------------------------------------------------------- the question */
.ask {
  align-self: flex-end;
  max-width: 82%;
  padding: 0.62em 0.95em 0.66em;
  border-radius: 1.15em 1.15em 0.35em 1.15em;
  background: var(--bolla);
  font-size: 0.9em;
  line-height: 1.38;
  color: var(--testo);
  font-stretch: 96%;
}

.reply { margin-top: 1.15em; display: flex; flex-direction: column; }

/* ---------------------------------------------------------------- the thinking row */
.think {
  display: flex;
  align-items: center;
  align-self: flex-start;
  height: 2.2em;
  padding: 0 0.7em 0 0;
  border-radius: 0.7em;
  font-size: 0.9em;
  color: var(--testo-2);
  transition: background-color 0.25s;
}
.think:disabled { cursor: default; }
.think:focus-visible { outline: 2px solid var(--accento); outline-offset: 2px; }
@media (hover: hover) {
  .think:not(:disabled):hover { background: var(--traccia); }
  .think:not(:disabled):hover .think__chev { color: var(--testo); }
}
.think__mark {
  width: 2.1em;
  height: 1.15em;
  fill: var(--accento);
  flex: none;
}
.roll {
  position: relative;
  display: inline-block;
  height: 1.35em;
  overflow: hidden;
  line-height: 1.35;
  font-weight: 520;
}
.roll__line { display: block; white-space: nowrap; }
.roll__line + .roll__line { position: absolute; left: 0; top: 0; }
.think__time {
  display: inline-block;
  overflow: hidden;
  white-space: nowrap;
  margin-left: 0.5em;
  color: var(--testo-3);
  font-variant-numeric: tabular-nums;
}
.think__chev {
  width: 1.05em;
  height: 1.05em;
  margin-left: 0.3em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: var(--testo-3);
  transition: color 0.25s;
}

/* the shimmer: one highlight that crosses every shimmering word at the same moment (--sh lives on .chat) */
.shimmer,
.step.is-active .step__text {
  background: linear-gradient(100deg, var(--testo-3) 0 38%, var(--testo) 50%, var(--testo-3) 62% 100%);
  background-size: 260% 100%;
  background-position: var(--sh) 0;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------------------------------------------------------------- the steps */
.steps {
  position: relative;
  overflow: hidden;
}
.steps__list { list-style: none; padding: 0.25em 0 0.45em; }
.rail {
  position: absolute;
  left: calc(2.1em * 0.9 / 2 - 0.5px);
  top: 1.4em;
  height: calc(2.55em * 0.9 * 3);
  width: 1px;
  background: var(--linea);
  transform-origin: 50% 0;
  transform: scaleY(0);
}
.rail--fill { background: var(--accento); }
.step {
  position: relative;
  display: flex;
  align-items: center;
  height: 2.55em;
  font-size: 0.9em;
}
.node {
  position: relative;
  flex: none;
  width: 2.1em;
  height: 2.1em;
  margin-right: 0.75em;
  border-radius: 50%;
  background: var(--fondo);
  box-shadow: inset 0 0 0 1px var(--linea);
  display: grid;
  place-items: center;
}
.node__bg {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--accento-velo);
  box-shadow: inset 0 0 0 1px rgba(90, 75, 240, 0.22);
  opacity: 0;
}
.node svg {
  grid-area: 1 / 1;
  width: 1.05em;
  height: 1.05em;
  fill: none;
  stroke-width: 1.45;
  stroke-linecap: round;
  stroke-linejoin: round;
  position: relative;
}
.node__icon { stroke: var(--testo-2); }
.node__icon * { stroke-dasharray: 1; stroke-dashoffset: 1; }
.node__check { stroke: var(--accento); stroke-width: 1.7; }
.node__check path { stroke-dasharray: 1; stroke-dashoffset: 1; }
.step__text {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--testo);
}
.step.is-done .step__text { color: var(--testo-2); }
.step__meta {
  flex: none;
  margin-left: 0.8em;
  font-size: 0.88em;
  color: var(--testo-3);
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- the answer */
.answer {
  margin-top: 0.55em;
  font-size: 0.98em;
  line-height: 1.55;
  color: var(--testo);
  text-wrap: pretty;
}
.answer strong { font-weight: 620; }
.w { display: inline-block; white-space: pre; }

.foot {
  display: flex;
  align-items: center;
  gap: 0.45em;
  margin-top: 0.95em;
}
.src {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  height: 2em;
  padding: 0 0.75em 0 0.35em;
  border-radius: 1em;
  box-shadow: inset 0 0 0 1px var(--linea);
  font-size: 0.76em;
  color: var(--testo-2);
  white-space: nowrap;
}
.src__mark {
  display: grid;
  place-items: center;
  width: 1.4em;
  height: 1.4em;
  border-radius: 0.4em;
  background: var(--traccia);
  font-size: 0.82em;
  font-weight: 650;
  color: var(--testo);
}
.again {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  height: 2em;
  padding: 0 0.75em 0 0.6em;
  border-radius: 1em;
  font-size: 0.76em;
  color: var(--testo-2);
  transition: background-color 0.25s, color 0.25s;
}
.again svg {
  width: 1.15em;
  height: 1.15em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.again:focus-visible { outline: 2px solid var(--accento); outline-offset: 2px; }
@media (hover: hover) {
  .again:hover { background: var(--traccia); color: var(--testo); }
}

@media (max-width: 380px) {
  .src + .src { display: none; }
  .step__meta { display: none; }
}
