:root {
  --fondo: #000000;
  --chip: #121214;
  --chip-alto: #1b1b1f;
  --bordo: rgba(255, 255, 255, 0.09);
  --testo: #f3f3f5;
  --tenue: #8d8d96;
  --accento: #7b93ff;
  --accento-velo: rgba(123, 147, 255, 0.16);
  --tip: rgba(28, 28, 32, 0.92);
}

* { box-sizing: border-box; }
html { font-size: clamp(13px, min(1.45vw, 2.5vh), 22px); }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--fondo);
  color: var(--testo);
  font-family: "Mona Sans Variable", system-ui, sans-serif;
  font-variation-settings: "wdth" 100;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.stage {
  height: 100%;
  display: grid;
  place-items: center;
}

/* the kit keeps room above for the tooltip and below for the drawn pointer, so the frame of the preview holds both */
.kit { position: relative; padding: 5.6rem 1.2rem 3.2rem; }

/* ---- the reactions ---- */
.bar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.bar__rule {
  width: 1px;
  height: 1.4rem;
  margin: 0 0.15rem;
  background: var(--bordo);
}

.chip {
  appearance: none;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  height: 2.6rem;
  padding: 0 0.85rem 0 0.7rem;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--chip-alto), var(--chip));
  color: var(--testo);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 560;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px var(--bordo), inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 6px 14px -8px rgba(0, 0, 0, 0.9);
  transition: box-shadow 0.25s ease, background 0.25s ease;
  -webkit-tap-highlight-color: transparent;
  isolation: isolate;
}
.chip--add { padding: 0 0.72rem; }
.chip:focus-visible { outline: 2px solid var(--accento); outline-offset: 3px; }
.chip[aria-pressed="true"] {
  background: linear-gradient(180deg, rgba(123, 147, 255, 0.24), rgba(123, 147, 255, 0.12));
  box-shadow: inset 0 0 0 1px rgba(123, 147, 255, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 8px 18px -10px rgba(123, 147, 255, 0.7);
}
.chip.is-on:not([aria-pressed="true"]) {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 8px 16px -8px rgba(0, 0, 0, 0.9);
}

/* a soft light inside the chip that follows the pointer */
.chip__light {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(3rem 2rem at var(--lx, 50%) var(--ly, 0%), rgba(255, 255, 255, 0.12), transparent 70%);
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
  z-index: -1;
}
.chip.is-on .chip__light { opacity: 1; }

.chip__icon {
  display: grid;
  place-items: center;
  width: 1.3rem;
  height: 1.3rem;
}
.chip__icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  overflow: visible;
}
.chip__icon .ic-dot { fill: currentColor; stroke: none; }
.chip__icon .ic-in { fill: none; }
.chip[aria-pressed="true"] .chip__icon { color: var(--accento); }
.chip[aria-pressed="true"] .chip__icon .ic-in { fill: var(--accento-velo); }

/* the count rolls in its own little window */
.chip__n {
  position: relative;
  display: inline-block;
  height: 1.2em;
  min-width: 1.2ch;
  overflow: hidden;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.chip__n .num { display: block; }
.chip__n .num + .num { position: absolute; left: 0; top: 0; }
.chip[aria-pressed="true"] .chip__n { color: #dfe5ff; }

/* the little burst of strokes when you add yours */
.chip__burst {
  position: absolute;
  left: 1.35rem;
  top: 50%;
  width: 0;
  height: 0;
  pointer-events: none;
}
.chip__burst i {
  position: absolute;
  left: -1px;
  top: -0.3rem;
  width: 2px;
  height: 0.55rem;
  border-radius: 2px;
  background: var(--accento);
  transform-origin: 1px 1.35rem;
  opacity: 0;
}

/* ---- the tooltip ---- */
.tip {
  position: absolute;
  left: 0;
  bottom: calc(3.2rem + 2.6rem + 0.8rem);
  z-index: 3;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.tip__in {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.62rem 0.95rem 0.62rem 0.7rem;
  border-radius: 0.9rem;
  background: var(--tip);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 18px 32px -14px rgba(0, 0, 0, 0.95), 0 2px 8px rgba(0, 0, 0, 0.5);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  overflow: hidden;
  white-space: nowrap;
}
.tip__faces {
  position: relative;
  flex: none;
  height: 1.75rem;
}
.face {
  position: absolute;
  top: 0;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.62rem;
  font-weight: 640;
  letter-spacing: 0.02em;
  color: #111114;
  box-shadow: 0 0 0 2px #1c1c20;
}
.face--you { color: #0d1233; }
.tip__words { min-width: 0; }
.tip__who {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.25;
}
.tip__how {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin: 0.1rem 0 0;
  font-size: 0.74rem;
  color: var(--tenue);
  line-height: 1.25;
}
.tip__icon {
  display: inline-grid;
  width: 0.9rem;
  height: 0.9rem;
  color: var(--testo);
}
.tip__icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tip__icon .ic-dot { fill: currentColor; stroke: none; }
.tip__tail {
  position: absolute;
  top: calc(100% - 1px);
  left: 0;
  width: 1.1rem;
  height: 0.55rem;
  overflow: visible;
}
.tip__tail-fill { fill: var(--tip); }
.tip__tail-edge { fill: none; stroke: rgba(255, 255, 255, 0.1); stroke-width: 1; }

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

@media (hover: hover) {
  .chip:hover { background: linear-gradient(180deg, #202025, #141417); }
  .chip[aria-pressed="true"]:hover { background: linear-gradient(180deg, rgba(123, 147, 255, 0.3), rgba(123, 147, 255, 0.15)); }
}
