:root {
  --fondo: #000000;
  --blocco: #0c0c0f;
  --blocco-alto: #141418;
  --testo: #ecebf2;
  --testo-spento: rgba(236, 235, 242, 0.46);
  --accento: #7ff0c4;
  --parola: #b8a6ff;
  --stringa: #f1c890;
  --funzione: #ffffff;
  --attributo: #9fd0ff;
}

* { 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 block: graphite, a hairline that catches the light on top, a soft shadow under it */
.code {
  position: relative;
  width: min(430px, calc(100vw - 32px));
  border-radius: 14px;
  background: linear-gradient(180deg, var(--blocco-alto) 0%, var(--blocco) 46px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 0 0 1px rgba(255, 255, 255, 0.07),
    0 24px 60px -28px rgba(0, 0, 0, 0.9),
    0 0 0 1px rgba(127, 240, 196, calc(var(--alone, 0) * 0.16)),
    0 18px 50px -24px rgba(127, 240, 196, calc(var(--alone, 0) * 0.35));
}

.code__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 46px;
  padding: 0 9px 0 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.tabs { display: flex; gap: 2px; }
.tab {
  height: 26px;
  padding: 0 clamp(7px, 2.2vw, 10px);
  border-radius: 8px;
  line-height: 26px;
  font-size: 12px;
  font-weight: 520;
  font-stretch: 104%;
  color: var(--testo-spento);
  white-space: nowrap;
}
.tab.is-on {
  color: var(--testo);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* the Copy pill */
.copy {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 11px 0 9px;
  border-radius: 14px;
  color: var(--testo);
  background: linear-gradient(180deg, #23232a 0%, #18181d 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 0 0 1px rgba(255, 255, 255, calc(0.08 + var(--sopra, 0) * 0.08)),
    inset 0 0 0 1px rgba(127, 240, 196, calc(var(--fatto, 0) * 0.5)),
    0 4px 12px -6px rgba(0, 0, 0, 0.9);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  outline: none;
  isolation: isolate;
  z-index: 2;
}
.copy::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  transition: box-shadow 0.25s ease;
}
.copy:focus-visible::after { box-shadow: 0 0 0 2px #000000, 0 0 0 4px var(--accento); }

.copy__light {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  pointer-events: none;
  z-index: -1;
}
.copy__light::before {
  content: "";
  position: absolute;
  left: var(--mx, 50%);
  top: var(--my, 0%);
  width: 90px;
  height: 60px;
  margin: -30px 0 0 -45px;
  background: radial-gradient(closest-side, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0));
  opacity: var(--sopra, 0);
}

.copy__icon { display: block; width: 14px; height: 14px; overflow: visible; }
.sheet { fill: #1b1b21; stroke: currentColor; stroke-width: 1.3; }
.sheet--back { stroke: rgba(236, 235, 242, 0.62); }
.tick {
  fill: none;
  stroke: var(--accento);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 14;
  stroke-dashoffset: 14;
}

.copy__words {
  position: relative;
  display: block;
  height: 16px;
  overflow: hidden;
}
.copy__label {
  position: absolute;
  left: 0;
  top: 0;
  line-height: 16px;
  font-size: 12.5px;
  font-weight: 560;
  font-stretch: 100%;
  white-space: nowrap;
}
.copy__label--done { color: var(--accento); opacity: 0; }

/* the code */
.code__body {
  position: relative;
  padding: 14px 0 16px;
  font-family: "JetBrains Mono Variable", "JetBrains Mono", ui-monospace, monospace;
  font-size: clamp(10.4px, 3.05vw, 13px);
  line-height: 1.8;
  font-variant-ligatures: none;
  overflow: hidden;
  border-radius: 0 0 14px 14px;
}
.code__body code { display: flex; flex-direction: column; }
.ln { position: relative; display: flex; padding-right: 12px; }
.ln__glow {
  position: absolute;
  inset: 0 0 0 0;
  background: linear-gradient(90deg, rgba(127, 240, 196, 0.16), rgba(127, 240, 196, 0.07) 70%, rgba(127, 240, 196, 0.02));
  box-shadow: inset 2px 0 0 var(--accento);
  transform-origin: 0 50%;
  transform: scaleX(0);
  opacity: 0;
  pointer-events: none;
}
.ln__n {
  position: relative;
  flex: 0 0 clamp(30px, 9vw, 40px);
  padding-right: clamp(10px, 3vw, 14px);
  text-align: right;
  color: rgba(236, 235, 242, 0.24);
  user-select: none;
}
.ln__t { position: relative; white-space: pre; color: rgba(236, 235, 242, 0.84); }
@media (hover: hover) {
  .ln:hover .ln__n { color: rgba(236, 235, 242, 0.5); }
}

.t-k { color: var(--parola); }
.t-s, .t-n { color: var(--stringa); }
.t-f { color: var(--funzione); font-weight: 560; }
.t-v { color: rgba(236, 235, 242, 0.86); }
.t-a { color: var(--attributo); }
.t-c { color: #e7e2ff; font-style: italic; }
.t-p { color: rgba(236, 235, 242, 0.42); }

/* the ghost copy of the block that lifts and goes back into the pill */
.ghostcopy {
  position: absolute;
  left: 0;
  top: 46px;
  width: 100%;
  height: 100px;
  border-radius: 12px;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  background: rgba(24, 26, 30, 0.5);
  box-shadow:
    inset 0 0 0 1px rgba(127, 240, 196, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 14px 30px -12px rgba(0, 0, 0, 0.95),
    0 0 24px -6px rgba(127, 240, 196, 0.25);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  z-index: 1;
}
.ghostcopy__in .ln__glow { display: none; }
.ghostcopy__in .code__body { border-radius: 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));
  z-index: 5;
}
