@font-face { font-family: "JetBrains Mono"; src: url(fonts/jetbrains-mono-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url(fonts/jetbrains-mono-latin-700-normal.woff2) format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Oswald"; src: url(fonts/oswald-latin-700-normal.woff2) format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --nero: #01030a;
  --cobalto: #1673ff;
  --ciano: #5ae6ff;
  --ghiaccio: #d8ecff;
  --testo: #a9c6e8;
  --tenue: #6d8fb8;
  --vetro: rgba(3, 9, 24, .6);
  --bordo: rgba(70, 150, 255, .34);
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --marchio: "Oswald", Impact, "Arial Narrow", sans-serif;
}

* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body {
  background: var(--nero);
  color: var(--testo);
  font: 400 14px/1.55 var(--mono);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--cobalto); color: #fff; }
a { color: var(--ciano); }
:focus-visible { outline: 2px solid var(--ciano); outline-offset: 2px; }

/* Fondali */
.sfondo, .velo, .righe, .pioggia { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.sfondo { object-fit: cover; z-index: 0; background: var(--nero); }
.velo {
  z-index: 1;
  background:
    radial-gradient(ellipse 70% 62% at 50% 44%, rgba(1, 3, 10, .12), rgba(1, 3, 10, .62) 100%),
    linear-gradient(to bottom, rgba(1, 3, 10, .4), transparent 18%, transparent 74%, rgba(1, 3, 10, .7));
}
.righe {
  z-index: 2;
  opacity: .5;
  background: repeating-linear-gradient(to bottom, rgba(0, 0, 0, .34) 0 1px, transparent 1px 3px);
}
.pioggia { z-index: 8; opacity: 0; transition: opacity .5s; }
.pioggia.attiva { opacity: .85; }

/* Avvio */
.avvio {
  position: fixed; inset: 0; z-index: 20;
  padding: clamp(16px, 4vw, 48px);
  background: var(--nero);
  color: var(--cobalto);
  font-size: clamp(11px, 1.5vw, 14px);
  white-space: pre-wrap;
  overflow: hidden;
  transition: opacity .35s;
  animation: via 0s linear 4s forwards; /* senza JS la schermata se ne va da sola */
}
.avvio b { color: var(--ciano); font-weight: 400; }
.avvio.finito { opacity: 0; pointer-events: none; }
.avvio[hidden] { display: none; }
@keyframes via { to { visibility: hidden; } }

/* Barra */
.barra, .piede {
  position: fixed; left: 0; right: 0; z-index: 5;
  display: flex; justify-content: space-between; gap: 16px;
  padding: 14px clamp(16px, 3vw, 32px);
  font-size: 11px; letter-spacing: .08em; color: var(--tenue);
}
.barra { top: 0; text-transform: uppercase; }
.piede { bottom: 0; }
.piede a { color: var(--tenue); text-decoration: none; }
.piede a:hover { color: var(--ciano); }
.piede a::before { content: "> "; color: var(--cobalto); }
.stato { display: inline-flex; align-items: center; gap: 8px; }
.led { width: 7px; height: 7px; border-radius: 50%; background: var(--ciano); box-shadow: 0 0 10px var(--ciano); animation: battito 2.4s infinite; }
@keyframes battito { 50% { opacity: .35; } }

/* Scena */
.scena {
  position: relative; z-index: 4;
  min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: clamp(14px, 2.6vh, 26px);
  padding: 56px 16px 52px;
}

/* Marchio */
.marchio { display: flex; align-items: center; gap: clamp(10px, 1.6vw, 22px); font: 700 clamp(58px, 11.5vw, 148px)/.98 var(--marchio); color: #fff; text-transform: uppercase; }
.stella {
  width: 1.82em; height: auto; flex: none;
  fill: var(--cobalto);
  transform: rotate(-4deg);
  filter: drop-shadow(0 0 .22em rgba(22, 115, 255, .85));
  animation: stella 7s infinite;
}
@keyframes stella {
  0%, 91%, 100% { transform: rotate(-4deg); fill: var(--cobalto); }
  92% { transform: rotate(-4deg) translateX(-6px) skewX(9deg); fill: var(--ciano); }
  94% { transform: rotate(-4deg) translateX(5px) skewX(-7deg); }
  96% { transform: rotate(-4deg); fill: #fff; }
}
.parole { display: flex; flex-direction: column; }
.parola { position: relative; display: block; letter-spacing: .012em; text-shadow: 0 0 .28em rgba(22, 115, 255, .7); }
.parola::before, .parola::after {
  content: attr(data-t);
  position: absolute; inset: 0;
  text-shadow: none;
  opacity: 0;
  pointer-events: none;
}
.parola::before { color: var(--ciano); animation: taglio-a 5.3s infinite steps(1); }
.parola::after { color: var(--cobalto); animation: taglio-b 5.3s infinite steps(1); }
.parola:last-child::before, .parola:last-child::after { animation-delay: -1.9s; }
@keyframes taglio-a {
  0%, 88%, 100% { opacity: 0; }
  89% { opacity: 1; transform: translateX(-.05em); clip-path: inset(12% 0 62% 0); }
  91% { opacity: 1; transform: translateX(.04em); clip-path: inset(58% 0 14% 0); }
  93% { opacity: 1; transform: translateX(-.02em); clip-path: inset(34% 0 44% 0); }
  95% { opacity: 0; }
}
@keyframes taglio-b {
  0%, 88%, 100% { opacity: 0; }
  90% { opacity: 1; transform: translateX(.06em); clip-path: inset(66% 0 8% 0); }
  92% { opacity: 1; transform: translateX(-.04em); clip-path: inset(6% 0 70% 0); }
  94% { opacity: 0; }
}

.motto { color: var(--ghiaccio); font-size: clamp(12px, 1.5vw, 15px); letter-spacing: .06em; min-height: 1.55em; text-align: center; }
.cancelletto { color: var(--cobalto); }

/* Terminale */
.terminale {
  width: min(680px, 100%);
  background: var(--vetro);
  border: 1px solid var(--bordo);
  border-radius: 6px;
  box-shadow: 0 0 40px rgba(22, 115, 255, .18), inset 0 0 30px rgba(22, 115, 255, .05);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  overflow: hidden;
}
.term-titolo {
  display: flex; align-items: center; gap: 12px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--bordo);
  font-size: 11px; color: var(--tenue);
}
.punti { display: inline-flex; gap: 5px; }
.punti i { width: 8px; height: 8px; border: 1px solid var(--bordo); border-radius: 50%; }
.punti i:first-child { background: var(--cobalto); border-color: var(--cobalto); }
.term-corpo { min-height: 62px; max-height: clamp(150px, 28vh, 260px); padding: 10px 12px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--bordo) transparent; cursor: text; }
.term-storia { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; }
.term-storia .c { color: var(--ghiaccio); }
.term-storia .ok { color: var(--ciano); }
.term-storia .ko { color: #ff7a90; }
.term-storia .t { color: var(--tenue); }
.term-storia a { color: var(--ciano); }
.term-riga { display: flex; align-items: baseline; gap: 8px; font-size: 13px; }
.prompt { flex: none; color: var(--tenue); }
.p-utente { color: var(--ciano); }
.p-dir { color: var(--cobalto); }
#term-input {
  flex: 1; min-width: 0;
  background: none; border: 0; outline: 0;
  color: #fff; caret-color: var(--ciano);
  font: inherit;
}

.comandi { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.comandi button {
  padding: 5px 12px;
  background: rgba(3, 9, 24, .6);
  border: 1px solid var(--bordo);
  border-radius: 3px;
  color: var(--testo);
  font: inherit; font-size: 12px;
  cursor: pointer;
  transition: color .15s, border-color .15s, box-shadow .15s;
}
.comandi button::before { content: "$ "; color: var(--cobalto); }
.comandi button:hover { color: #fff; border-color: var(--ciano); box-shadow: 0 0 14px rgba(90, 230, 255, .3); }

.senza-js { position: fixed; bottom: 44px; left: 0; right: 0; z-index: 6; text-align: center; }

.scossa { animation: scossa .32s steps(2) 2; }
@keyframes scossa {
  0%, 100% { transform: none; }
  25% { transform: translate(-4px, 2px); filter: hue-rotate(60deg); }
  75% { transform: translate(5px, -2px); filter: invert(.12); }
}

@media (max-width: 640px) {
  .nascondi-piccolo:last-child { display: none; }
  .stella { width: 1.6em; }
}
@media (max-height: 620px) {
  .marchio { font-size: clamp(44px, 16vh, 100px); }
  .term-corpo { max-height: 110px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .avvio { display: none; }
}
