:root {
  --fondo: #000000;
  --pillola: #101012;
  --pillola-alta: #1e1e22;
  --testo: #f3f2f7;
  --testo-spento: rgba(243, 242, 247, 0.5);
  --accento: #8f7cff;
  --accento-chiaro: #c7bcff;
  --accento-scuro: #5a45e0;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--fondo);
  color: var(--testo);
  font-family: "Mona Sans Variable", "Mona Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

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

/* the pill: graphite, a hairline edge that takes the light on top, a glow under it only while tracing */
.btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  width: min(264px, calc(100vw - 32px));
  height: 60px;
  padding: 0 20px 0 10px;
  border-radius: 30px;
  color: var(--testo);
  background: linear-gradient(180deg, var(--pillola-alta) 0%, var(--pillola) 62%, #0b0b0d 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.11),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06),
    inset 0 -1px 0 rgba(0, 0, 0, 0.6),
    0 10px 30px -12px rgba(143, 124, 255, calc(var(--alone, 0) * 0.55)),
    0 0 0 1px rgba(143, 124, 255, calc(var(--alone, 0) * 0.28));
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  outline: none;
  isolation: isolate;
}
.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: 0 0 0 0 transparent;
  transition: box-shadow 0.25s ease;
}
.btn:focus-visible::after {
  box-shadow: 0 0 0 3px #000000, 0 0 0 5px var(--accento);
}

/* a cool light under the pointer, inside the graphite */
.btn__light {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  pointer-events: none;
  z-index: -1;
}
.btn__light::before {
  content: "";
  position: absolute;
  left: var(--mx, 30%);
  top: var(--my, 0%);
  width: 200px;
  height: 130px;
  margin: -65px 0 0 -100px;
  background: radial-gradient(closest-side, rgba(199, 188, 255, 0.15), rgba(199, 188, 255, 0));
  opacity: var(--luce, 0);
}

/* the tile: a 40px canvas with the transparency checks, the leaf and its anchors */
.tile {
  position: relative;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05), 0 4px 10px -4px rgba(0, 0, 0, 0.9);
}
.art { display: block; width: 40px; height: 40px; overflow: visible; }
.art__shadow { fill: rgba(0, 0, 0, 0.55); }
.art__grid line { stroke: rgba(10, 6, 40, 0.42); stroke-width: 0.5; }
.art__edge { fill: none; stroke: rgba(255, 255, 255, 0.55); stroke-width: 0.6; stroke-linejoin: round; }
.art__rib { fill: none; stroke: rgba(255, 255, 255, 0.5); stroke-width: 0.7; stroke-linecap: round; }
.art__rim { fill: none; stroke: rgba(255, 255, 255, 0.09); stroke-width: 1; }
.node__handle { stroke: rgba(255, 255, 255, 0.7); stroke-width: 0.6; }
.node__knob { fill: #ffffff; }
.node__anchor { fill: #0d0b1c; stroke: #ffffff; stroke-width: 0.8; }

/* the words: three lines in one row, one shows at a time */
.btn__words {
  position: relative;
  flex: 1;
  height: 22px;
  overflow: hidden;
}
.btn__label {
  position: absolute;
  left: 0;
  top: 0;
  line-height: 22px;
  font-size: 16px;
  font-weight: 580;
  font-stretch: 100%;
  letter-spacing: -0.005em;
  white-space: nowrap;
}
[data-busy] { color: var(--testo-spento); font-weight: 520; }
[data-busy], [data-done] { opacity: 0; }

/* the file type on the right: PNG, the percent while tracing, then SVG */
.btn__side {
  position: relative;
  height: 22px;
  min-width: 38px;
  overflow: hidden;
}
.btn__tag {
  position: absolute;
  right: 0;
  top: 2px;
  height: 18px;
  padding: 0 6px;
  border-radius: 5px;
  line-height: 18px;
  font-size: 11px;
  font-weight: 620;
  font-stretch: 112%;
  letter-spacing: 0.04em;
  color: var(--testo-spento);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  white-space: nowrap;
}
.btn__tag--pct { box-shadow: none; padding: 0; font-variant-numeric: tabular-nums; letter-spacing: 0; opacity: 0; }
.btn__tag--svg {
  color: #14102e;
  background: linear-gradient(180deg, var(--accento-chiaro), var(--accento));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
  opacity: 0;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.ghost {
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  margin: -3px 0 0 -4px;
  fill: #ffffff;
  stroke: #111114;
  stroke-width: 1.4;
  stroke-linejoin: round;
  pointer-events: none;
  opacity: 0;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6));
}
