:root {
  --fondo: #f6f5f2;
  --inchiostro: #111113;
  --grigio: #6d6c72;
  --grigio-chiaro: #a4a3a9;
  --linea: rgba(17, 17, 19, 0.09);
  --tinta: #6a4cf6;
  --tinta-2: #e9a3ff;
  --bianco: #ffffff;
}

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

html, body { height: 100%; overflow: hidden; }

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

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

/* a soft light behind the box, one colour only */
.stage::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 46%;
  width: min(90vw, 620px);
  height: min(50vh, 340px);
  transform: translate(-50%, -50%);
  background: radial-gradient(closest-side, rgba(106, 76, 246, 0.12), rgba(106, 76, 246, 0));
  pointer-events: none;
}

.hero {
  position: relative;
  width: min(100%, 680px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(8px, 2.4vh, 18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 560;
  color: var(--grigio);
  letter-spacing: 0.01em;
}

.brand__mark { width: 18px; height: 18px; fill: var(--tinta); }

.title {
  font-size: clamp(22px, min(6.4vw, 7.4vh), 46px);
  font-weight: 620;
  font-variation-settings: "wdth" 96;
  letter-spacing: -0.025em;
  line-height: 1.08;
  text-align: center;
  margin-bottom: clamp(2px, 1vh, 8px);
}

/* the prompt box, with a beam of light running on its border */
.box {
  position: relative;
  width: 100%;
  border-radius: 20px;
  padding: 1px;
  background: var(--linea);
  box-shadow: 0 1px 2px rgba(17, 17, 19, 0.04), 0 14px 40px -12px rgba(40, 30, 90, 0.18);
  transition: box-shadow 0.3s ease;
}

.box__beam {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: conic-gradient(from calc(var(--a, 0) * 1deg), rgba(106, 76, 246, 0) 0deg, rgba(106, 76, 246, 0) 215deg, var(--tinta-2) 290deg, var(--tinta) 335deg, rgba(106, 76, 246, 0) 360deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  opacity: var(--beam, 0.85);
  pointer-events: none;
}

.box.is-focus { box-shadow: 0 0 0 4px rgba(106, 76, 246, 0.1), 0 14px 40px -12px rgba(40, 30, 90, 0.22); }

.box__inner {
  position: relative;
  border-radius: 19px;
  background: var(--bianco);
  padding: clamp(10px, 2.2vh, 16px) clamp(12px, 3vw, 16px) clamp(8px, 1.6vh, 12px);
}

.box__field { position: relative; display: block; }

.box__input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  font-size: clamp(14px, min(4vw, 2.6vh), 17px);
  line-height: 1.5;
  height: 1.5em;
  color: var(--inchiostro);
  caret-color: var(--tinta);
}

.box__ph {
  position: absolute;
  left: 0;
  top: 0;
  font-size: clamp(14px, min(4vw, 2.6vh), 17px);
  line-height: 1.5;
  color: var(--grigio-chiaro);
  pointer-events: none;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
}

.box__caret {
  display: inline-block;
  width: 1.5px;
  height: 1.05em;
  margin-left: 1px;
  vertical-align: -0.16em;
  background: var(--tinta);
  border-radius: 1px;
}

.box__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: clamp(8px, 2vh, 14px);
}

.box__tools { display: flex; gap: 6px; }

.tool {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 11px 0 9px;
  border-radius: 999px;
  border: 1px solid var(--linea);
  background: var(--bianco);
  color: var(--grigio);
  font: inherit;
  font-size: 13px;
  font-weight: 520;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.tool svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.tool--round { width: 32px; padding: 0; justify-content: center; }
.tool[aria-pressed="true"] { color: var(--tinta); border-color: rgba(106, 76, 246, 0.3); background: rgba(106, 76, 246, 0.06); }
.tool:focus-visible, .send:focus-visible, .pill:focus-visible { outline: 2px solid var(--tinta); outline-offset: 2px; }

@media (hover: hover) {
  .tool:hover { background: #f4f4f5; color: var(--inchiostro); }
}

/* the send button: grey and off, black when there is something to send, a stop square while the answer comes */
.send {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 0;
  background: #e7e6ea;
  color: #a9a8ae;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}

.send:disabled { cursor: default; }
.send.is-on { background: var(--inchiostro); color: var(--bianco); box-shadow: 0 6px 14px -6px rgba(17, 17, 19, 0.45); }
.send__arrow { grid-area: 1 / 1; width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.send__stop { grid-area: 1 / 1; width: 10px; height: 10px; border-radius: 2.5px; background: currentColor; opacity: 0; transform: scale(0.4); }

/* below the box: the suggestions and, in their place, the answer */
.below {
  position: relative;
  width: 100%;
  height: clamp(80px, 22vh, 104px);
  margin-top: clamp(0px, 0.6vh, 4px);
}

.rows {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  -webkit-mask: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  mask: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}

.row { position: relative; overflow: hidden; height: 36px; }
.row__track { position: absolute; left: 0; top: 0; display: flex; gap: 8px; white-space: nowrap; will-change: transform; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px 0 11px;
  border-radius: 999px;
  border: 1px solid var(--linea);
  background: rgba(255, 255, 255, 0.82);
  color: #3b3a40;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  flex: none;
  white-space: nowrap;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s, color 0.2s;
}

.pill svg { width: 15px; height: 15px; fill: none; stroke: var(--tinta); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.pill.is-hover { background: var(--bianco); border-color: rgba(106, 76, 246, 0.28); color: var(--inchiostro); box-shadow: 0 6px 16px -8px rgba(40, 30, 90, 0.3); }

@media (hover: hover) {
  .pill:hover { background: var(--bianco); border-color: rgba(106, 76, 246, 0.28); color: var(--inchiostro); box-shadow: 0 6px 16px -8px rgba(40, 30, 90, 0.3); }
}

.flyer {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  margin: 0;
}

.answer {
  position: absolute;
  inset: 0;
  padding: 2px clamp(4px, 2vw, 14px);
  opacity: 0;
  visibility: hidden;
}

.answer__head {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 560;
  margin-bottom: clamp(6px, 1.4vh, 10px);
}

.answer__head svg { width: 15px; height: 15px; fill: var(--tinta); }

/* the shimmer on the word and on the grey lines while the answer is on its way */
.answer__state {
  background: linear-gradient(90deg, var(--grigio) 0%, var(--grigio) 40%, #d8d6de 50%, var(--grigio) 60%, var(--grigio) 100%);
  background-size: 250% 100%;
  background-position: calc(var(--sh, 0) * 1%) 0;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.answer__lines { display: grid; gap: 8px; }
.answer__lines span {
  display: block;
  height: 9px;
  border-radius: 5px;
  background: linear-gradient(90deg, #e9e8ec 0%, #e9e8ec 40%, #f7f6f9 50%, #e9e8ec 60%, #e9e8ec 100%);
  background-size: 250% 100%;
  background-position: calc(var(--sh, 0) * 1%) 0;
  transform-origin: left center;
}
.answer__lines span:nth-child(1) { width: 92%; }
.answer__lines span:nth-child(2) { width: 78%; }
.answer__lines span:nth-child(3) { width: 54%; }

.answer__text {
  position: absolute;
  left: clamp(4px, 2vw, 14px);
  right: clamp(4px, 2vw, 14px);
  top: calc(13px * 1.2 + clamp(6px, 1.4vh, 10px) + 2px);
  font-size: clamp(13px, 3.6vw, 14px);
  line-height: 1.5;
  color: #3b3a40;
}

.answer__text .w { display: inline-block; white-space: pre; }

.cursor {
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  z-index: 10;
  fill: var(--inchiostro);
  stroke: var(--bianco);
  stroke-width: 1.4;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.18));
  pointer-events: none;
  opacity: 0;
}

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 420px) {
  .tool[data-search] span { display: none; }
  .tool[data-search] { width: 32px; padding: 0; justify-content: center; }
}
