:root {
  --fondo: #0b0b0d;
  --card: #141417;
  --bordo: rgba(255, 255, 255, 0.07);
  --testo: #ececef;
  --grigio: #8b8b93;
  --pulsante: #1a1a1e;
  --luce: #9fd8ff;
  --griglia-a: #1b1b1f;
  --griglia-b: #232328;
}

* { 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;
}

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

.editor {
  width: min(330px, 100%);
  background: var(--card);
  border: 1px solid var(--bordo);
  border-radius: 22px;
  padding: min(16px, 3.2vh) min(16px, 4vw);
  box-shadow: 0 30px 70px -30px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.editor__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: min(12px, 2.4vh);
}

.editor__brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 640;
  font-stretch: 108%;
  letter-spacing: -0.01em;
}

.editor__logo {
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border-radius: 7px;
  background: linear-gradient(160deg, #2a2a2f, #1b1b1f);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.editor__logo svg { width: 15px; height: 15px; fill: none; stroke: var(--luce); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.chip {
  font-size: 11px;
  font-weight: 560;
  color: var(--grigio);
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--bordo);
}

.roll { position: relative; display: inline-flex; overflow: hidden; vertical-align: bottom; }
.roll__in { display: inline-block; white-space: nowrap; }

/* ---- the photo: under the scene, the transparent grid that shows when the room is wiped away ---- */
.shot {
  position: relative;
  width: 100%;
  height: min(196px, 36vh);
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--bordo);
  background: repeating-conic-gradient(var(--griglia-a) 0 25%, var(--griglia-b) 0 50%) 0 0 / 14px 14px;
}

.scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.sweep { fill: none; stroke: var(--luce); stroke-width: 3; opacity: 0; }

.trace { fill: none; stroke: #ecf8ff; stroke-width: 1.3; stroke-linejoin: round; stroke-linecap: round; opacity: 0; }
.trace--glow { stroke: var(--luce); stroke-width: 4.5; }

.head { fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; opacity: 0; }
.head--glow { stroke: var(--luce); stroke-width: 9; }

.shot__cap {
  position: absolute;
  right: 8px; bottom: 8px;
  font-size: 11px;
  font-weight: 520;
  color: rgba(255, 255, 255, 0.9);
  pointer-events: none;
}

.pill {
  display: inline-flex;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(12, 12, 14, 0.55);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

/* ---- the button and the undo beside it ---- */
.actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: min(16px, 3vh);
}

.cut-wrap {
  position: relative;
  flex: 1;
  height: min(52px, 10.5vh);
}

.cut {
  position: absolute;
  inset: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--testo);
  font: inherit;
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  -webkit-tap-highlight-color: transparent;
}

.cut:focus-visible { outline: 2px solid var(--luce); outline-offset: 3px; }

/* the ring of light that runs while it works: a turning conic gradient clipped by the pill, under the face */
.cut__ring { position: absolute; inset: 0; border-radius: inherit; overflow: hidden; }
.cut__spin {
  position: absolute;
  left: 50%; top: 50%;
  width: 400px; height: 400px;
  margin: -200px 0 0 -200px;
  background: conic-gradient(from 0deg, rgba(159, 216, 255, 0) 0deg, rgba(159, 216, 255, 0) 250deg, var(--luce) 320deg, #fff 345deg, rgba(159, 216, 255, 0) 360deg);
  opacity: 0;
}

.cut__face {
  position: absolute;
  inset: 1px;
  border-radius: inherit;
  background: linear-gradient(180deg, #212126, var(--pulsante));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* the rim that catches the light where the pointer is */
.cut__rim {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: radial-gradient(70px 60px at var(--x, 50%) var(--y, 0%), rgba(214, 240, 255, var(--rim, 0.14)), rgba(255, 255, 255, 0.05) 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);
  pointer-events: none;
}

.cut__label {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 100%;
  font-size: 14px;
  font-weight: 600;
  font-stretch: 104%;
  letter-spacing: -0.005em;
}

.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--luce); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }
.ic__ok { stroke-dasharray: 22; stroke-dashoffset: 22; }

.undo {
  width: min(52px, 10.5vh);
  height: min(52px, 10.5vh);
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--bordo);
  background: var(--pulsante);
  color: var(--grigio);
  cursor: pointer;
  opacity: 0.35;
  pointer-events: none;
  -webkit-tap-highlight-color: transparent;
}

.undo.is-on { pointer-events: auto; }
.undo:focus-visible { outline: 2px solid var(--luce); outline-offset: 3px; }
.undo svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

@media (hover: hover) {
  .undo.is-on:hover { color: var(--testo); }
}

.editor__hint {
  margin-top: min(10px, 2vh);
  text-align: center;
  font-size: 12px;
  color: var(--grigio);
}

.pointer {
  position: absolute; left: 0; top: 0;
  width: 20px; height: 20px;
  fill: #fff; stroke: #111; stroke-width: 1.4; stroke-linejoin: round;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.5));
  opacity: 0;
  pointer-events: none;
  z-index: 50;
}

@media (max-height: 360px) {
  .editor__hint { display: none; }
}
