:root {
  --fondo: #ffffff;
  --win: #ffffff;
  --bordo: #e9e9ee;
  --bordo-2: #dedee5;
  --carta: #f6f6f9;          /* the user bubbles and the preview card */
  --testo: #15151a;
  --testo-2: #5d5c66;
  --testo-3: #9e9da8;
  --accento: #3554e0;        /* the single accent: Create link, the toggle, the link icon */
  --accento-chiaro: #e9edfd;
  --ombra: 22, 22, 34;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
html { font-size: clamp(11px, min(3.2vw, 2.6vh), 15px); }
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;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
svg { display: block; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.stage { height: 100vh; display: grid; place-items: center; padding: 2vh 3vw; }

/* the conversation window */
.win {
  position: relative;
  width: min(30em, 94vw);
  height: 25em;
  max-height: 94vh;
  background: var(--win);
  border: 1px solid var(--bordo);
  border-radius: 1.1em;
  box-shadow: 0 1px 1px rgba(var(--ombra), .04), 0 10px 28px -8px rgba(var(--ombra), .14), 0 30px 60px -30px rgba(var(--ombra), .18);
  overflow: hidden;
}

.bar {
  height: 3.6em;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: .7em;
  padding: 0 .8em 0 1em;
  border-bottom: 1px solid var(--bordo);
}
.mark, .who {
  width: 1.9em; height: 1.9em; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--testo); color: #fff;
}
.mark svg, .who svg { width: 58%; height: 58%; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.bar__t { display: grid; min-width: 0; line-height: 1.2; }
.bar__name { font-weight: 620; font-size: .95em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar__sub { font-size: .76em; color: var(--testo-3); }

/* the Share pill */
.share {
  position: relative;
  height: 2.3em;
  display: inline-flex; align-items: center; gap: .4em;
  padding: 0 .875em;
  border-radius: 999px;
  border: 1px solid var(--bordo-2);
  background: #fff;
  font-size: .86em; font-weight: 580;
  box-shadow: 0 1px 1px rgba(var(--ombra), .05);
}
.share__ico { width: 1.05em; height: 1.05em; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
@media (hover: hover) {
  .share:hover { border-color: #cfcfd8; box-shadow: 0 1px 1px rgba(var(--ombra), .06), 0 4px 10px -4px rgba(var(--ombra), .2); }
  .x:hover { background: var(--carta); }
  .make:hover { filter: brightness(1.06); }
  .copy:hover { background: #eef0f6; }
}
.share:focus-visible, .x:focus-visible, .make:focus-visible, .copy:focus-visible, .tog:focus-visible { outline: 2px solid var(--accento); outline-offset: 2px; }

/* the chat */
.chat { padding: 1.1em 1.1em; display: grid; gap: .75em; align-content: start; }
.msg { font-size: .9em; line-height: 1.42; max-width: 82%; }
.msg--me {
  justify-self: end;
  background: var(--carta);
  padding: .6em .85em;
  border-radius: 1em 1em .3em 1em;
}
.msg--ai { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .6em; align-items: start; max-width: 90%; }
.msg--ai .who { width: 1.6em; height: 1.6em; }
.msg--ai p { padding-top: .15em; }

/* the panel that grows out of the pill */
.panel {
  position: absolute;
  z-index: 3;
  background: #fff;
  border: 1px solid var(--bordo-2);
  border-radius: 1em;
  box-shadow: 0 1px 2px rgba(var(--ombra), .06), 0 14px 34px -10px rgba(var(--ombra), .26), 0 40px 70px -40px rgba(var(--ombra), .3);
  will-change: clip-path;
}
.panel[hidden] { display: none; }
.panel__in { padding: .85em .95em 1em; display: grid; gap: .8em; }
.panel__head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
.panel__t { font-weight: 640; font-size: .95em; }
.x { width: 1.9em; height: 1.9em; border-radius: 50%; display: grid; place-items: center; color: var(--testo-2); }
.x svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }

/* the preview card */
.prev {
  position: relative;
  display: grid; gap: .4em;
  padding: .75em .8em .7em;
  background: var(--carta);
  border: 1px solid var(--bordo);
  border-radius: .75em;
}
.prev__t { font-size: .78em; font-weight: 620; }
.mini { font-size: .68em; line-height: 1.35; max-width: 86%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini--me { justify-self: end; background: #fff; border: 1px solid var(--bordo); padding: .35em .6em; border-radius: .8em .8em .25em .8em; }
.mini--ai { color: var(--testo-2); padding: .1em 0; }
.prev__d { font-size: .66em; color: var(--testo-3); margin-top: .1em; }

.row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .8em; }
.row__t { font-size: .8em; color: var(--testo-2); display: grid; min-width: 0; }
.row__a { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* the small toggle */
.tog {
  position: relative;
  width: 2.3em; height: 1.35em;
  border-radius: 999px;
  background: #d9d9e1;
  transition: background-color .25s;
}
.tog.is-on { background: var(--accento); }
.tog__k {
  position: absolute; top: .15em; left: .15em;
  width: 1.05em; height: 1.05em; border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(var(--ombra), .25);
}

/* the slot: the Create link button and the link row share the same cell, so nothing jumps */
.slot { display: grid; }
.slot > * { grid-area: 1 / 1; }
.make {
  position: relative;
  height: 2.7em;
  border-radius: 999px;
  background: var(--accento);
  color: #fff;
  font-size: .86em; font-weight: 600;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 1px 1px rgba(var(--ombra), .12), 0 6px 14px -6px rgba(53, 84, 224, .55);
}
.make[disabled] { opacity: .45; cursor: default; }
/* both labels out of the flow and centred on their own: the hidden one never widens the button */
.make__l { position: absolute; inset: 0; display: grid; place-items: center; white-space: nowrap; }
.make__run {
  position: absolute; left: 0; bottom: 0;
  width: 100%; height: 2px;
  background: rgba(255,255,255,.85);
  transform-origin: 0 50%;
  transform: scaleX(0);
}

.link {
  height: 2.7em;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: .5em;
  padding: 0 .3em 0 .75em;
  border: 1px solid var(--bordo-2);
  border-radius: 999px;
  background: #fff;
  visibility: hidden;
}
.link__ico { color: var(--accento); }
.link__ico svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
.link__u {
  font-family: "JetBrains Mono Variable", ui-monospace, monospace;
  font-size: .76em;
  white-space: nowrap; overflow: hidden;
  color: var(--testo);
  /* a long address fades out at the end instead of being cut */
  -webkit-mask-image: linear-gradient(90deg, #000 82%, transparent);
          mask-image: linear-gradient(90deg, #000 82%, transparent);
}
.copy {
  position: relative;
  width: 6.6em; height: 2.1em;
  border-radius: 999px;
  background: var(--carta);
  font-size: .78em; font-weight: 600;
}
.copy__l { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: .3em; white-space: nowrap; }
.copy__l svg { width: 1.05em; height: 1.05em; fill: none; stroke: var(--accento); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.copy__l [data-tick] { stroke-dasharray: 1; stroke-dashoffset: 1; }
.copy__l[data-cl="1"] { opacity: 0; }
.make__l[data-ml="1"] { opacity: 0; }
