:root {
  --fondo: #0a0a0a;
  --finestra: #111113;
  --barra: #17171a;
  --bordo: rgba(255, 255, 255, 0.08);
  --testo: #ededef;
  --grigio: #8b8b93;
  --spento: #55555c;
  --accento: #6ee7b7;
  --errore: #f2b8b5;
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  background: var(--fondo);
  color: var(--testo);
  font-family: "Mona Sans Variable", system-ui, sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.stage {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(12px, 3vmin, 40px);
  /* a soft light behind the window, so the black is not flat */
  background: radial-gradient(60% 50% at 50% 42%, rgba(110, 231, 183, 0.06), transparent 70%), var(--fondo);
}

.term {
  --fs: clamp(9.5px, min(1.6vw, 2.6vh), 15.5px);
  position: relative;
  width: min(780px, 100%);
  border-radius: 14px;
  background: var(--finestra);
  border: 1px solid var(--bordo);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 30px 80px -30px rgba(0, 0, 0, 0.9), 0 12px 30px -18px rgba(110, 231, 183, 0.12);
  overflow: hidden;
}

.term__bar {
  display: flex;
  align-items: center;
  gap: 12px;
  height: calc(var(--fs) * 2.9);
  padding: 0 calc(var(--fs) * 0.9);
  background: var(--barra);
  border-bottom: 1px solid var(--bordo);
}

/* the window keys: three short grey segments, not coloured dots */
.term__keys { display: flex; gap: 6px; }
.term__keys i {
  width: calc(var(--fs) * 1.05);
  height: calc(var(--fs) * 0.32);
  border-radius: 3px;
  background: #2c2c31;
}

.term__title {
  flex: 1;
  text-align: center;
  font: 500 calc(var(--fs) * 0.86) / 1 "JetBrains Mono Variable", ui-monospace, monospace;
  color: var(--grigio);
  letter-spacing: 0.01em;
}

.term__copy {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: calc(var(--fs) * 1.9);
  padding: 0 calc(var(--fs) * 0.7);
  border: 1px solid var(--bordo);
  border-radius: 8px;
  background: #1d1d21;
  color: var(--testo);
  font: 500 calc(var(--fs) * 0.82) / 1 "Mona Sans Variable", system-ui, sans-serif;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
}
@media (hover: hover) {
  .term__copy:hover { background: #24242a; border-color: rgba(255, 255, 255, 0.14); }
}
.term__copy:focus-visible { outline: 2px solid var(--accento); outline-offset: 2px; }
.term__copy.is-done { border-color: rgba(110, 231, 183, 0.35); }
.term__icon { width: calc(var(--fs) * 1.05); height: calc(var(--fs) * 1.05); fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.term__icon--done { position: absolute; left: calc(var(--fs) * 0.7); stroke: var(--accento); opacity: 0; }

.term__body {
  position: relative;
  height: calc(var(--fs) * 1.62 * 15 + var(--fs) * 2);
  padding: calc(var(--fs) * 1) calc(var(--fs) * 1.2);
  overflow: hidden;
  font: 400 var(--fs) / 1.62 "JetBrains Mono Variable", ui-monospace, monospace;
  /* the oldest lines fade out at the top as the log scrolls */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 calc(var(--fs) * 1.2));
  mask-image: linear-gradient(to bottom, transparent 0, #000 calc(var(--fs) * 1.2));
}

.term__lines { will-change: transform; }

.line { display: flex; align-items: center; gap: 0.6em; white-space: pre; min-height: 1.62em; }
.line--gap { min-height: 0.8em; }
.prompt { color: var(--accento); }
.path { color: #9aa7ff; }
.cmd { color: var(--testo); }
.dim { color: var(--grigio); }
.off { color: var(--spento); }
.ok { color: var(--accento); }
.time { margin-left: auto; color: var(--spento); }
.err { color: var(--errore); }

.cursor {
  display: inline-block;
  width: 0.62em;
  height: 1.15em;
  margin-left: 1px;
  transform: translateY(0.12em);
  background: var(--testo);
  border-radius: 1px;
}

.tick { width: 1.05em; height: 1.05em; flex: none; fill: none; stroke: var(--accento); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chev { width: 0.9em; height: 0.9em; flex: none; fill: none; stroke: var(--accento); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.opt { display: flex; align-items: center; gap: 0.6em; padding-left: 1.4em; color: var(--grigio); }
.opt.is-on { color: var(--testo); }
.opt__mark { width: 0.9em; display: inline-flex; }

.bar { letter-spacing: -0.02em; }
.bar .fill { color: var(--accento); }
.bar .rest { color: #2e2e34; }

.ready {
  margin-top: 0.5em;
  padding: 0.75em 1em;
  border: 1px solid rgba(110, 231, 183, 0.28);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(110, 231, 183, 0.07), rgba(110, 231, 183, 0.02));
  white-space: normal;
}
.ready__head { display: flex; align-items: center; gap: 0.6em; color: var(--testo); font-weight: 600; }
.ready__next { margin-top: 0.35em; color: var(--grigio); }
.ready__next b { color: var(--testo); font-weight: 500; }

.pointer {
  position: absolute;
  left: 0;
  top: 0;
  width: calc(var(--fs) * 1.6);
  height: calc(var(--fs) * 1.6);
  fill: #fff;
  stroke: #0a0a0a;
  stroke-width: 1.4;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
  opacity: 0;
  pointer-events: none;
  z-index: 3;
}

@media (max-width: 420px) {
  .term__title { text-align: left; }
  .term__body { height: calc(var(--fs) * 1.62 * 16 + var(--fs) * 2); padding-inline: calc(var(--fs) * 0.9); }
}
