:root {
  --fondo: #0a0a0b;
  --carta: #111114;
  --pulsante: #16161a;
  --testo: #f2f2f4;
  --grigio: #8a8a94;
  --spento: #5c5c66;
  --luce: #9ecbff;
  --luce2: #d4b0ff;
  --bordo: rgba(255, 255, 255, 0.08);
  --mia: #1c2230;
}

* { 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;
}

.stage {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
  background: radial-gradient(min(80vw, 620px) min(50vh, 360px) at 50% 72%, rgba(158, 203, 255, 0.06), transparent 70%);
}

/* ---------- the chat card */
.card {
  position: relative;
  width: min(100%, 430px);
  padding: clamp(14px, 3vh, 20px) clamp(14px, 3.6vw, 20px) clamp(12px, 2.6vh, 18px);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0) 40%), var(--carta);
  box-shadow: inset 0 0 0 1px var(--bordo), inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 30px 60px -30px rgba(0, 0, 0, 0.9);
}

.card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: clamp(10px, 2vh, 14px);
  margin-bottom: clamp(10px, 2vh, 14px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 13px;
}
.card__chan { display: flex; align-items: center; gap: 6px; font-weight: 560; font-size: 13.5px; }
.card__hash { width: 15px; height: 15px; fill: none; stroke: var(--grigio); stroke-width: 1.5; stroke-linecap: round; }
.card__app { color: var(--spento); font-weight: 520; letter-spacing: 0.01em; }

/* ---------- the message received */
.msg { display: flex; gap: 10px; align-items: flex-start; }
.msg__avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(140deg, #3a3550, #23293a);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  color: #d9d6ec;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.msg__main { position: relative; min-width: 0; overflow: hidden; border-radius: 6px; }
.msg__who { display: flex; align-items: baseline; gap: 8px; font-size: 13px; font-weight: 580; }
.msg__time { color: var(--spento); font-weight: 450; font-size: 12px; }
.msg__text {
  margin-top: 3px;
  color: #c4c4cc;
  font-size: clamp(13px, min(3.5vw, 1.9vh + 6px), 14.5px);
  line-height: 1.5;
}
/* a soft light that reads the message while the AI thinks */
.msg__sweep {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 120px;
  margin-left: -120px;
  background: linear-gradient(90deg, transparent, rgba(158, 203, 255, 0.10) 40%, rgba(212, 176, 255, 0.12) 60%, transparent);
  filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  mix-blend-mode: screen;
}

/* ---------- the slot under the message: suggestions, then the reply */
.slot {
  position: relative;
  height: clamp(104px, 21vh, 122px);
  margin: clamp(8px, 1.8vh, 12px) 0 clamp(8px, 1.8vh, 12px) 40px;
}
.fan, .out { position: absolute; inset: 0; }
.fan { display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-start; gap: clamp(5px, 1.2vh, 8px); }

.pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  height: clamp(28px, 5.4vh, 33px);
  padding: 0 13px 0 10px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #1c1c22, #15151a);
  box-shadow: inset 0 0 0 1px rgba(158, 203, 255, 0.16), 0 10px 22px -14px rgba(0, 0, 0, 0.9);
  color: #e8e8ee;
  font: inherit;
  font-size: clamp(12.5px, min(3.4vw, 1.8vh + 6px), 13.5px);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.pill:focus-visible { outline: 2px solid var(--luce); outline-offset: 3px; }
.pill__spark { flex: none; width: 11px; height: 11px; fill: var(--luce); opacity: 0.85; }
.pill__text { position: relative; overflow: hidden; text-overflow: ellipsis; }
/* the glint that runs over each suggestion as it arrives */
.pill__glint {
  position: absolute;
  top: -20%;
  bottom: -20%;
  left: 0;
  width: 60px;
  margin-left: -60px;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.16) 45%, rgba(212, 176, 255, 0.16) 55%, transparent);
  pointer-events: none;
}
@media (hover: hover) {
  .pill:hover { box-shadow: inset 0 0 0 1px rgba(158, 203, 255, 0.32), 0 10px 22px -14px rgba(0, 0, 0, 0.9); }
}

/* the reply once sent, on the right like your own messages */
.out { display: flex; flex-direction: column; align-items: flex-end; justify-content: flex-end; gap: 5px; visibility: hidden; }
.out__bubble {
  max-width: 92%;
  padding: 8px 12px;
  border-radius: 16px 16px 5px 16px;
  background: linear-gradient(180deg, #232b3c, var(--mia));
  box-shadow: inset 0 0 0 1px rgba(158, 203, 255, 0.14);
  color: var(--testo);
  font-size: clamp(13px, min(3.5vw, 1.9vh + 6px), 14px);
  line-height: 1.4;
}
.out__state { display: flex; align-items: center; gap: 4px; color: var(--grigio); font-size: 11.5px; }
.out__state svg { width: 14px; height: 14px; fill: none; stroke: var(--luce); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- the composer: Suggest reply, the field, Send */
.composer { display: flex; align-items: center; gap: 8px; }

.btnwrap { position: relative; flex: none; }

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: clamp(36px, 6.4vh, 40px);
  padding: 0 14px 0 11px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--testo);
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 14px 30px -16px rgba(0, 0, 0, 0.95);
}
.btn:focus-visible { outline: 2px solid var(--luce); outline-offset: 4px; }

.btn__ring, .btn__halo {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  overflow: hidden;
  opacity: 0;
}
.btn__halo { inset: -4px; filter: blur(10px); pointer-events: none; }
.btn__spin {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 240px;
  height: 240px;
  margin: -120px 0 0 -120px;
  background: conic-gradient(from 0deg, transparent 0deg, rgba(158, 203, 255, 0) 40deg, var(--luce) 110deg, #ffffff 150deg, var(--luce2) 190deg, rgba(212, 176, 255, 0) 260deg, transparent 360deg);
}
.btn__face {
  position: absolute;
  inset: 1px;
  border-radius: 999px;
  overflow: hidden;
  background: linear-gradient(180deg, #1d1d22, var(--pulsante));
  box-shadow: inset 0 0 0 1px var(--bordo), inset 0 1px 0 rgba(255, 255, 255, 0.07);
}
.btn__shine {
  position: absolute;
  left: 0;
  top: 0;
  width: 80px;
  height: 80px;
  margin: -40px 0 0 -40px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 255, 255, 0.16), transparent);
  opacity: 0;
}
.btn__in { position: relative; display: inline-flex; align-items: center; gap: 7px; }
.btn__spark { flex: none; width: 16px; height: 16px; fill: var(--luce); }
.btn__label {
  position: relative;
  display: inline-block;
  height: 1.25em;
  line-height: 1.25em;
  font-size: 13.5px;
  font-weight: 560;
  white-space: nowrap;
  overflow: hidden;
}
.btn__label .w { display: inline-block; white-space: pre; }
.btn__label .w.old { position: absolute; left: 0; top: 0; }
.btn__label .c { display: inline-block; }

.field {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  height: clamp(36px, 6.4vh, 40px);
  padding: 0 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07);
  font-size: clamp(13px, min(3.5vw, 1.9vh + 6px), 14px);
  white-space: nowrap;
  overflow: hidden;
}
.field__ph { position: absolute; left: 12px; right: 12px; color: var(--spento); overflow: hidden; text-overflow: ellipsis; }
.field__text { color: var(--testo); overflow: hidden; text-overflow: clip; direction: ltr; }
.field__caret { flex: none; width: 1.5px; height: 1.15em; margin-left: 1px; border-radius: 1px; background: var(--luce); opacity: 0; }

.send {
  flex: none;
  display: grid;
  place-items: center;
  width: clamp(36px, 6.4vh, 40px);
  height: clamp(36px, 6.4vh, 40px);
  border: 0;
  border-radius: 50%;
  background: #1a1a1f;
  box-shadow: inset 0 0 0 1px var(--bordo);
  color: var(--spento);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.send svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.send:disabled { cursor: default; }
.send:focus-visible { outline: 2px solid var(--luce); outline-offset: 3px; }

/* ---------- the drawn pointer of the autopilot */
.ghost {
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  fill: #fff;
  stroke: #0a0a0b;
  stroke-width: 1.2;
  stroke-linejoin: round;
  opacity: 0;
  pointer-events: none;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.5));
  z-index: 5;
}
.flyer { position: fixed; z-index: 4; pointer-events: none; }
