:root {
  --fondo: #000000;
  --superficie: #111111;
  --campo: #181818;
  --bordo: rgba(255, 255, 255, 0.08);
  --bordo-forte: rgba(255, 255, 255, 0.16);
  --testo: #f4f4f5;
  --testo-2: #8b8b92;
  --testo-3: #5b5b62;
  --filo: #8fb4ff;
  --tasto: #1c1c1f;
}

* { 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: clamp(14px, 4vmin, 40px);
}

.chat {
  width: min(560px, 100%);
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 2.2vh, 16px);
}

.chat__thread {
  position: relative;
  height: clamp(150px, 34vh, 180px);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 10px;
  padding: 0 4px;
}

.chat__ask {
  align-self: flex-end;
  max-width: 82%;
  padding: 9px 14px;
  border-radius: 16px 16px 4px 16px;
  background: #1d1d20;
  border: 1px solid var(--bordo);
  font-size: clamp(13px, 1.6vw + 6px, 14.5px);
  line-height: 1.4;
  opacity: 0;
}

.chat__think {
  position: absolute;
  left: 4px;
  bottom: 0;
  font-size: 14px;
  font-variation-settings: "wdth" 100;
  font-weight: 500;
  color: transparent;
  background: linear-gradient(90deg, var(--testo-3) 0%, var(--testo-3) 35%, #e9ecf5 50%, var(--testo-3) 65%, var(--testo-3) 100%);
  background-size: 300% 100%;
  background-position: 100% 0;
  -webkit-background-clip: text;
  background-clip: text;
  opacity: 0;
}

.chat__answer {
  max-width: 92%;
  font-size: clamp(13.5px, 1.6vw + 6.5px, 15px);
  line-height: 1.5;
  color: #d9d9de;
  min-height: 1.5em;
}

.chat__answer .w { display: inline-block; opacity: 0; filter: blur(4px); }

.chat__answer b { font-weight: 600; color: var(--testo); font-variant-numeric: tabular-nums; }

.composer {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 68px;
  padding: 0 13px 0 20px;
  border-radius: 34px;
  background: var(--superficie);
  border: 1px solid var(--bordo);
  box-shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: border-color 0.25s ease;
}

.composer:focus-within { border-color: var(--bordo-forte); }

.composer__clip {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: var(--testo-2);
  stroke-width: 1.5;
  stroke-linecap: round;
}

.composer__label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.composer__field {
  flex: 1;
  min-width: 0;
  height: 100%;
  background: none;
  border: 0;
  outline: 0;
  color: var(--testo);
  font: inherit;
  font-size: 16px;
  caret-color: var(--filo);
}

.composer__field::placeholder { color: var(--testo-3); }

.send {
  position: relative;
  width: 48px;
  height: 48px;
  flex: none;
}

.send__metal {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 92px;
  height: 92px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.send__btn {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  border-radius: 50%;
  background: radial-gradient(120% 120% at 30% 20%, #2a2a2e 0%, var(--tasto) 55%, #0c0c0d 100%);
  color: var(--testo);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), inset 0 -1px 0 rgba(0, 0, 0, 0.6);
}

.send__btn:disabled { cursor: default; }

.send__btn:focus-visible { outline: 2px solid var(--filo); outline-offset: 10px; }

.send__face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.send__icon {
  grid-area: 1 / 1;
  width: 20px;
  height: 20px;
}

.send__icon--arrow {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.send__icon--stop { fill: currentColor; opacity: 0; }

.chat__foot {
  text-align: center;
  font-size: 11.5px;
  color: var(--testo-3);
}

.ghost {
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  fill: #f4f4f5;
  stroke: #000;
  stroke-width: 1.2;
  stroke-linejoin: round;
  pointer-events: none;
  opacity: 0;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.5));
}

@media (max-width: 420px) {
  .composer { height: 58px; padding: 0 12px 0 15px; border-radius: 29px; }
  .composer__field { font-size: 14px; }
  .send, .send__btn { width: 40px; height: 40px; }
  .send__metal { width: 80px; height: 80px; }
}
