:root {
  --fondo: #ffffff;
  --carta: #ffffff;
  --testo: #18181b;
  --testo-2: #71717a;
  --testo-3: #a1a1aa;
  --bordo: rgba(17, 17, 19, 0.11);
  --accento: #6d5efc;
  --accento-tenue: #f1efff;
}

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

/* the answer card: GSAP owns nothing on it but a 1px settle; the edge glow is a child */
.card {
  position: relative;
  width: min(430px, 100%);
  padding: clamp(14px, 3.6vh, 20px) 20px clamp(12px, 3vh, 16px);
  background: var(--carta);
  border: 1px solid var(--bordo);
  border-radius: 18px;
  box-shadow: 0 1px 1px rgba(17, 17, 19, 0.03), 0 10px 30px -14px rgba(17, 17, 19, 0.16);
}
.card__edge {
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(100deg, transparent 0%, transparent 35%, var(--accento) 50%, transparent 65%, transparent 100%);
  background-size: 260% 100%;
  background-position: 100% 0;
  -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: 0;
  pointer-events: none;
}

.ask {
  margin: 0 0 12px auto;
  width: fit-content;
  max-width: 88%;
  padding: 7px 12px;
  border-radius: 12px 12px 4px 12px;
  background: #f4f4f5;
  color: #3f3f46;
  font-size: 13px;
  line-height: 1.4;
}

.who {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 13px;
}
.who__mark {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: linear-gradient(145deg, #8b7fff, var(--accento));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 2px 6px -2px rgba(109, 94, 252, 0.6);
}
.who__mark svg { width: 13px; height: 13px; fill: #ffffff; }
.who__name { font-weight: 620; }
.who__state {
  position: relative;
  display: block;
  overflow: hidden;
  height: 18px;
  color: var(--testo-3);
  font-size: 12px;
}
.who__line { display: block; line-height: 18px; white-space: nowrap; }

/* the clip animates its height; the text and the light band sit inside */
.answer {
  position: relative;
  overflow: hidden;
}
.answer__text {
  font-size: 15px;
  line-height: 1.55;
  letter-spacing: -0.003em;
  color: var(--testo);
  padding-bottom: 2px;
}
.w { display: inline-block; white-space: pre; will-change: transform, opacity, filter; }
.sweep {
  position: absolute;
  top: -10%;
  bottom: -10%;
  left: 0;
  width: 46%;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(109, 94, 252, 0.10) 35%, rgba(170, 160, 255, 0.34) 50%, rgba(109, 94, 252, 0.10) 65%, rgba(255, 255, 255, 0) 100%);
  filter: blur(6px);
  opacity: 0;
  pointer-events: none;
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: clamp(10px, 2.6vh, 14px);
  padding-top: clamp(8px, 2vh, 12px);
  border-top: 1px solid rgba(17, 17, 19, 0.07);
}

/* the button: GSAP owns its transform (scale, y); the soft background is a child */
.regen {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 14px 0 10px;
  border: 1px solid var(--bordo);
  border-radius: 999px;
  background: #ffffff;
  color: var(--testo);
  font: inherit;
  font-size: 13.5px;
  font-weight: 540;
  cursor: pointer;
  outline: none;
  box-shadow: 0 1px 2px rgba(17, 17, 19, 0.05);
}
.regen:focus-visible { box-shadow: 0 0 0 3px rgba(109, 94, 252, 0.28); }
.regen__bg {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--accento-tenue);
  opacity: 0;
}
.regen__icon { position: relative; display: grid; place-items: center; width: 18px; height: 18px; }
.regen__icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.regen__label { position: relative; }

.pager {
  display: flex;
  align-items: center;
  gap: 2px;
  overflow: hidden;
  color: var(--testo-2);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
.pager__btn {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--testo-2);
  cursor: pointer;
  outline: none;
}
.pager__btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.pager__btn:disabled { color: #d4d4d8; cursor: default; }
.pager__btn:focus-visible { box-shadow: 0 0 0 2px rgba(109, 94, 252, 0.35); }
.pager__count { display: inline-flex; align-items: center; gap: 3px; padding: 0 2px; }
.pager__of { color: var(--testo-3); }
.slot { position: relative; display: inline-block; height: 18px; min-width: 7px; overflow: hidden; }
.slot span { display: block; height: 18px; line-height: 18px; text-align: center; }
.slot span + span { position: absolute; left: 0; right: 0; top: 0; }

@media (hover: hover) {
  .pager__btn:not(:disabled):hover { background: #f4f4f5; color: var(--testo); }
}

.ghost {
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  fill: #18181b;
  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;
  visibility: hidden;
}

@media (max-height: 430px) {
  .ask { margin-bottom: 8px; }
  .answer__text { font-size: 14px; line-height: 1.5; }
}
