:root {
  --fondo: #000000;
  --carta: #121214;
  --carta-2: #0d0d0f;
  --inchiostro: #f2efea;
  --testo-2: #a19b93;
  --testo-3: #6b665f;
  --linea: rgba(255, 255, 255, 0.07);
  --linea-2: rgba(255, 255, 255, 0.1);
  --campo: rgba(255, 255, 255, 0.025);
  --accento: #ff8a3d;
  --richiesta: color-mix(in srgb, var(--accento) 72%, white);
}

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

html, body { height: 100%; }

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

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

.card {
  --mx: 18%;
  --my: 0%;
  --heat: 0;
  position: relative;
  width: min(372px, 100%);
  background: linear-gradient(180deg, var(--carta) 0%, var(--carta-2) 100%);
  border-radius: 20px;
  padding: 16px 16px 13px;
  isolation: isolate;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 1px 2px rgba(0, 0, 0, 0.6),
    0 10px 24px -10px rgba(0, 0, 0, 0.8),
    0 40px 90px -40px rgba(0, 0, 0, 1),
    0 36px 110px -50px color-mix(in srgb, var(--accento) calc(var(--heat) * 34%), transparent);
}
/* the 1px edge that catches a light where the pointer is */
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  padding: 1px;
  border-radius: inherit;
  background: radial-gradient(150px 150px at var(--mx) var(--my), color-mix(in srgb, var(--accento) 75%, white), transparent 70%);
  -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.85;
  pointer-events: none;
  z-index: 3;
}
/* a soft wash of the same light on the surface, and a fine grain */
.card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(260px 200px at var(--mx) var(--my), color-mix(in srgb, var(--accento) 7%, transparent), transparent 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: -1;
}

/* the label row */
.head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 0 2px 9px;
}
.head__label { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; font-weight: 600; letter-spacing: 0.002em; font-variation-settings: "wdth" 104; }
.head__icon { width: 15px; height: 15px; color: var(--accento); }
.head__icon path { fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.head__opt { font-size: 12px; color: var(--testo-3); }

/* the field: a real textarea with transparent text over a mirror that draws every letter */
.box {
  position: relative;
  height: clamp(92px, 24vh, 112px);
  border-radius: 12px;
  background: var(--campo);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px var(--linea-2), inset 0 2px 6px rgba(0, 0, 0, 0.45);
  transition: box-shadow 0.3s, background 0.3s;
}
/* the field warms up from the bottom as the note fills */
.box::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 90% at 50% 120%, color-mix(in srgb, var(--accento) 16%, transparent), transparent 70%);
  opacity: var(--heat);
  pointer-events: none;
}
.box.is-active {
  background: rgba(255, 255, 255, 0.035);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accento) 55%, transparent), inset 0 2px 6px rgba(0, 0, 0, 0.45), 0 0 0 4px color-mix(in srgb, var(--accento) 12%, transparent), 0 0 24px -6px color-mix(in srgb, var(--accento) 45%, transparent);
}
.box__scroll { position: absolute; inset: 0; pointer-events: none; }
.box__mirror,
.box__input {
  font: inherit;
  font-size: 14.5px;
  line-height: 21px;
  letter-spacing: 0;
  padding: 10px 12px;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: normal;
}
.box__mirror { position: relative; color: var(--inchiostro); min-height: 100%; }
.box__mirror .w { display: inline-block; white-space: pre; }
.box__mirror .c { display: inline-block; will-change: transform; }
.box__mirror .is-req { color: var(--richiesta); }
.box__tints { position: absolute; inset: 0; }
.tint {
  position: absolute;
  height: 19px;
  border-radius: 5px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accento) 20%, transparent), color-mix(in srgb, var(--accento) 12%, transparent));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accento) 16%, transparent);
  transform-origin: 0 50%;
}
.box__caret {
  position: absolute;
  left: 0;
  top: 0;
  width: 1.5px;
  height: 18px;
  border-radius: 1px;
  background: var(--accento);
  box-shadow: 0 0 8px color-mix(in srgb, var(--accento) 80%, transparent);
  opacity: 0;
}
.box__input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  color: transparent;
  caret-color: var(--accento);
  overflow: auto;
  scrollbar-width: none;
}
.box__input::-webkit-scrollbar { display: none; }
.box__input::placeholder { color: var(--testo-3); }
.box__input::selection { background: color-mix(in srgb, var(--accento) 30%, transparent); color: transparent; }

/* the quick requests */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 11px;
}
.chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px 0 9px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.025));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.09), inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 1px 2px rgba(0, 0, 0, 0.5);
  color: var(--inchiostro);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.3s, color 0.3s, box-shadow 0.3s;
}
.chip__icon {
  flex: none;
  width: 14px;
  height: 14px;
  color: var(--testo-2);
  transition: color 0.3s;
}
.chip__icon path { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.chip__label { position: relative; display: inline-block; white-space: nowrap; }
/* a thin sheen that crosses the chip when it switches on */
.chip__glint {
  position: absolute;
  top: 0;
  left: 0;
  width: 40%;
  height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.22), transparent);
  opacity: 0;
  pointer-events: none;
}
.chip.is-on {
  background: linear-gradient(180deg, color-mix(in srgb, var(--accento) 20%, transparent), color-mix(in srgb, var(--accento) 10%, transparent));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accento) 45%, transparent), inset 0 1px 0 color-mix(in srgb, var(--accento) 30%, transparent), 0 0 18px -6px color-mix(in srgb, var(--accento) 70%, transparent);
  color: var(--richiesta);
}
.chip.is-on .chip__icon { color: var(--accento); }
.chip:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 2px #000, 0 0 0 4px color-mix(in srgb, var(--accento) 70%, transparent);
}
@media (hover: hover) {
  .chip:hover { background: linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.04)); }
  .chip.is-on:hover { background: linear-gradient(180deg, color-mix(in srgb, var(--accento) 26%, transparent), color-mix(in srgb, var(--accento) 13%, transparent)); }
}

/* the foot */
.foot {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 11px 2px 0;
  font-size: 12px;
  color: var(--testo-3);
}
.foot__count { font-variant-numeric: tabular-nums; display: inline-flex; }
.foot__count [data-countnum] { display: inline-block; color: var(--testo-2); }
.foot__count.is-full [data-countnum] { color: var(--accento); }

/* the letters that fly from a chip to the field */
.flyer {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 4;
  pointer-events: none;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 500;
  color: var(--richiesta);
  text-shadow: 0 0 14px color-mix(in srgb, var(--accento) 70%, transparent);
  transform-origin: 0 50%;
}

/* the drawn pointer of the autopilot */
.pointer {
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  pointer-events: none;
  opacity: 0;
  z-index: 5;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6));
}
.pointer path { fill: #f6f4f0; stroke: #000; stroke-width: 1.2; stroke-linejoin: round; }

@media (max-width: 380px) {
  .card { padding: 13px 13px 11px; }
  .chip { height: 30px; font-size: 12.5px; padding: 0 10px 0 8px; }
}
