/*
  Starforged: Eclipse — sito di sviluppo.
  Stesso linguaggio dell'interfaccia del gioco (skill dgw-ui-style, HudStyle.cs):
  pannelli piatti grigio acciaio con gli angoli tagliati a 45°, accento azzurro
  ghiaccio per ciò che è scelto o attivo, ambra per titoli d'accento e missioni,
  rosso per errori e pericolo, verde per le conferme. Titoli in Science Gothic
  maiuscolo, numeri in monospazio.
*/
@font-face {
  font-family: "Science Gothic";
  src: url("fonts/ScienceGothic-Bd.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}

:root {
  --bg: #0a0c0f;
  --panel: #101317;
  --panel-a: rgba(16, 19, 23, 0.86);
  --line: #2b323a;
  --slot: #161a1f;
  --slot-line: #3d4651;
  --accent: #7fc8e8;
  --fire: #ff4a4a;
  --shield: #00f0ff;
  --hull: #00e676;
  --amber: #ffb300;
  --muted: #93a0ad;
  --text: #e8edf2;
  --safe: #003319;
  --cut: 8px;
  --cut-s: 4px;
  --title: "Science Gothic", "Segoe UI", system-ui, sans-serif;
  --body: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: Consolas, "Cascadia Mono", "SFMono-Regular", Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 var(--body);
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; }
a { color: var(--accent); text-decoration: none; }
a:hover, a:focus-visible { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3, .title {
  font-family: var(--title);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.2;
  margin: 0 0 0.6em;
  overflow-wrap: anywhere;
}
h1 { font-size: clamp(1.5rem, 4.6vw, 2.4rem); color: var(--text); }
h2 { font-size: clamp(1.15rem, 3.2vw, 1.5rem); color: var(--amber); }
h3 { font-size: 1.02rem; color: var(--text); }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.num, td.n, th.n { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.skip { position: absolute; left: -999px; top: 0; background: var(--accent); color: #000; padding: 8px 12px; z-index: 50; }
.skip:focus { left: 8px; }

/* Barra in alto */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(10, 12, 15, 0.94);
  border-bottom: 1px solid var(--line);
}
.topbar-in {
  max-width: 1180px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 16px;
}
.brand {
  font-family: var(--title); text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text); font-size: 1.02rem; white-space: nowrap; display: flex; align-items: center; gap: 10px;
}
.brand small { color: var(--amber); font-size: 0.72rem; letter-spacing: 0.18em; }
.brand:hover { text-decoration: none; color: var(--accent); }
.nav { margin-left: auto; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.nav a {
  font-family: var(--title); text-transform: uppercase; font-size: 0.78rem; letter-spacing: 0.06em;
  color: var(--muted); padding: 8px 10px;
}
.nav a:hover { color: var(--text); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); }
.nav a.cta { color: #061016; background: var(--accent); clip-path: var(--clip-s); padding: 8px 14px; margin-left: 6px; }
.nav a.cta:hover { background: #a8dcf2; }
.menu-btn { display: none; }

/* Angoli tagliati: lo stesso poligono per il filo e per il fondo interno. */
:root {
  --clip: polygon(var(--cut) 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% calc(100% - var(--cut)),
    calc(100% - var(--cut)) 100%, var(--cut) 100%, 0 calc(100% - var(--cut)), 0 var(--cut));
  --clip-s: polygon(var(--cut-s) 0, calc(100% - var(--cut-s)) 0, 100% var(--cut-s), 100% calc(100% - var(--cut-s)),
    calc(100% - var(--cut-s)) 100%, var(--cut-s) 100%, 0 calc(100% - var(--cut-s)), 0 var(--cut-s));
}
.panel {
  position: relative;
  background: var(--line);
  clip-path: var(--clip);
  padding: 18px 20px;
  margin: 0 0 18px;
}
.panel::before {
  content: ""; position: absolute; inset: 1px; z-index: 0;
  background: var(--panel-a); clip-path: var(--clip);
}
.panel::after {
  content: ""; position: absolute; left: var(--cut); right: var(--cut); top: 0; height: 2px; z-index: 1;
  background: var(--slot-line);
}
.panel > * { position: relative; z-index: 2; }
.panel > :last-child { margin-bottom: 0; }
.panel.accent::after { background: var(--accent); }
.panel.amber::after { background: var(--amber); }
.quest {
  border-left: 3px solid var(--amber); background: rgba(16, 19, 23, 0.6);
  padding: 12px 16px; margin: 0 0 16px;
}
.quest.info { border-left-color: var(--accent); }
.quest.warn { border-left-color: var(--fire); }
.quest.ok { border-left-color: var(--hull); }
.quest > :last-child { margin-bottom: 0; }

.badge {
  display: inline-block; font-family: var(--title); text-transform: uppercase; font-size: 0.68rem;
  letter-spacing: 0.08em; padding: 3px 8px; border: 1px solid var(--slot-line); color: var(--muted);
  clip-path: var(--clip-s); background: var(--slot); white-space: nowrap;
}
.badge.safe { color: var(--hull); border-color: var(--hull); background: var(--safe); }
.badge.fire { color: var(--fire); border-color: var(--fire); }
.badge.amber { color: var(--amber); border-color: var(--amber); }
.badge.accent { color: var(--accent); border-color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px;
  font-family: var(--title); text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.9rem;
  color: var(--text); background: var(--slot-line); clip-path: var(--clip-s);
  padding: 0; border: 0; cursor: pointer; position: relative;
}
.btn > span {
  display: block; margin: 1px; padding: 10px 20px; background: var(--slot); clip-path: var(--clip-s);
}
.btn:hover { text-decoration: none; background: var(--accent); }
.btn.primary { background: var(--accent); }
.btn.primary > span { background: #14303d; color: #e6f6ff; }
.btn.primary:hover > span { background: #1b4253; }
.btn[disabled] { opacity: 0.5; cursor: wait; }

main { max-width: 1180px; margin: 0 auto; padding: 24px 16px 40px; }
.crumbs { font-size: 0.85rem; color: var(--muted); margin: 0 0 14px; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--accent); }
.lead { font-size: 1.08rem; color: #cfd7df; max-width: 70ch; }

.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); }
.grid > .panel { margin: 0; }
.stat-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 18px; }
.stat {
  flex: 1 1 140px; background: var(--slot); border: 1px solid var(--line); padding: 10px 14px; clip-path: var(--clip-s);
}
.stat b { display: block; font-family: var(--mono); font-size: 1.35rem; color: var(--text); }
.stat span { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.faction { text-align: center; }
.faction img { width: 120px; height: 120px; object-fit: contain; }
.faction .motto { color: #cfd7df; font-style: italic; }
.section { margin: 36px 0; }

/* Tabelle */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 0 18px; border: 1px solid var(--line); background: rgba(16, 19, 23, 0.7); }
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th {
  font-family: var(--title); text-transform: uppercase; font-weight: 700; font-size: 0.7rem; letter-spacing: 0.07em;
  color: var(--muted); background: var(--slot); white-space: nowrap; position: sticky; top: 0;
}
td.n, th.n { text-align: right; white-space: nowrap; }
tbody tr:hover { background: rgba(127, 200, 232, 0.06); }
tbody tr:target { background: rgba(255, 179, 0, 0.12); }
td img.icon { width: 32px; height: 32px; object-fit: contain; vertical-align: middle; margin-right: 8px; }
td .cell-name { display: inline-flex; align-items: center; min-width: 0; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; font-family: var(--mono); overflow-wrap: anywhere; }
.detail-head { display: grid; gap: 18px; grid-template-columns: minmax(0, 340px) 1fr; align-items: start; }
.detail-head img.hero-img { width: 100%; background: #000; border: 1px solid var(--line); }
.detail-head img.emblem { width: 160px; }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: 4px 0; border-bottom: 1px solid var(--line); }
ul.links { padding-left: 1.1em; margin: 0 0 1em; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }

/* Wiki */
.wiki-cats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); margin: 0 0 24px; }
.wiki-cat {
  display: block; background: var(--slot-line); clip-path: var(--clip-s); color: var(--text);
}
.wiki-cat > span { display: block; margin: 1px; padding: 14px 16px; background: var(--slot); clip-path: var(--clip-s); }
.wiki-cat b { font-family: var(--title); text-transform: uppercase; letter-spacing: 0.05em; display: block; }
.wiki-cat em { font-style: normal; color: var(--muted); font-size: 0.86rem; }
.wiki-cat:hover { background: var(--accent); text-decoration: none; }
.search { position: relative; margin: 0 0 22px; }
.search input { width: 100%; }
.search-results { list-style: none; margin: 6px 0 0; padding: 0; border: 1px solid var(--line); background: var(--panel); max-height: 60vh; overflow-y: auto; }
.search-results:empty { display: none; }
.search-results li a { display: block; padding: 10px 12px; border-bottom: 1px solid var(--line); color: var(--text); }
.search-results li a:hover, .search-results li a:focus { background: var(--slot); text-decoration: none; }
.search-results li small { color: var(--muted); display: block; font-size: 0.8rem; }
.wiki-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; }
.wiki-main, .wiki-side { min-width: 0; }
.wiki-side ul { list-style: none; padding: 0; margin: 0; position: sticky; top: 70px; }
.wiki-side a { display: block; padding: 6px 10px; color: var(--muted); border-left: 2px solid transparent; font-size: 0.92rem; }
.wiki-side a[aria-current="page"] { color: var(--accent); border-left-color: var(--accent); }
.wiki-side a:hover { color: var(--text); text-decoration: none; }
.toc { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0 0 18px; font-size: 0.9rem; }

/* Moduli */
form .field { margin: 0 0 14px; }
label, .label { display: block; font-family: var(--title); text-transform: uppercase; font-size: 0.74rem; letter-spacing: 0.07em; color: var(--muted); margin: 0 0 5px; }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="number"] {
  width: 100%; min-height: 44px; padding: 10px 12px; font: 16px var(--body); color: var(--text);
  background: var(--slot); border: 1px solid var(--slot-line); border-radius: 0; outline: none;
}
input:focus { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
input[aria-invalid="true"] { border-color: var(--fire); }
.date-row { display: flex; align-items: center; gap: 6px; }
.date-row input { width: 5.2em; text-align: center; font-family: var(--mono); }
.date-row input.year { width: 6.6em; }
.date-row span { color: var(--muted); }
.check { display: flex; gap: 10px; align-items: flex-start; font: 0.95rem/1.45 var(--body); text-transform: none; letter-spacing: normal; color: var(--text); }
.check input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }
.hint { font-size: 0.82rem; color: var(--muted); margin: 4px 0 0; }
.error { font-size: 0.86rem; color: var(--fire); margin: 5px 0 0; }
.error:empty { display: none; }
.form-status { margin: 14px 0 0; padding: 10px 14px; border-left: 3px solid var(--accent); background: var(--slot); }
.form-status:empty { display: none; }
.form-status.bad { border-left-color: var(--fire); }
.form-status.good { border-left-color: var(--hull); }
.register-wrap { max-width: 560px; margin: 0 auto; }
.register-wrap .panel + section, .register-wrap section + .form-links { margin-top: 18px; }
.form-links { margin: 14px 0 18px; font-size: 0.92rem; }
/* .btn è inline-flex: senza questa regola l'attributo hidden non lo nasconderebbe. */
.btn[hidden] { display: none; }

kbd {
  font-family: var(--mono); font-size: 0.85em; padding: 2px 7px; color: var(--text);
  background: var(--slot); border: 1px solid var(--slot-line); border-bottom-width: 2px; white-space: nowrap;
}

footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 0.86rem; }
.footer-in { max-width: 1180px; margin: 0 auto; padding: 20px 16px 30px; display: flex; flex-wrap: wrap; gap: 8px 22px; justify-content: space-between; }
footer a { color: var(--muted); }
footer a:hover { color: var(--accent); }

/*
  Home a scorrimento (richiesta del 16/11): apertura a eclissi solo in CSS,
  poi scene in parallasse per fazioni e navi (site.js sposta gli strati con
  la proprietà «translate» e fa comparire i blocchi «.reveal»).
  Ogni animazione mette lo stato di partenza nel suo «from»: lo stile normale
  è quello finale, così con prefers-reduced-motion (animazioni spente) o senza
  JavaScript la pagina mostra subito tutto.
*/
/* Tinte delle fazioni: quelle delle stazioni del gioco (SpaceMapView.FactionColor). */
.f1 { --faction: #e6454d; }
.f2 { --faction: #4991f2; }
.f3 { --faction: #41d98d; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.dev-note { margin-top: 16px; font-size: 0.85rem; color: var(--muted); }
.eyebrow {
  font-family: var(--title); text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.74rem;
  color: var(--muted); margin: 0 0 0.6em;
}
[data-depth] { translate: 0 var(--py, 0px); }

/* Apertura */
.intro {
  position: relative; overflow: hidden; isolation: isolate;
  min-height: calc(100vh - 61px); min-height: calc(100svh - 61px);
  display: flex; align-items: center; justify-content: center;
  background: #030407; border-bottom: 1px solid var(--line);
}
.intro-sky {
  position: absolute; inset: -6% 0 -36%; z-index: -2;
  background: url("img/sfondi/stelle.png") center / 512px repeat;
  animation: fade-in 1.4s ease-out both;
}
.intro-nebula {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.2;
  -webkit-mask-image: radial-gradient(ellipse at 50% 42%, #000 0%, rgba(0, 0, 0, 0.55) 38%, transparent 72%);
  mask-image: radial-gradient(ellipse at 50% 42%, #000 0%, rgba(0, 0, 0, 0.55) 38%, transparent 72%);
}
.intro::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 26%; z-index: -1;
  background: linear-gradient(180deg, rgba(10, 12, 15, 0), var(--bg));
}
.intro-in {
  position: relative; width: 100%; max-width: 1180px; padding: 32px 16px 96px; text-align: center;
  opacity: calc(1 - var(--leave, 0) * 1.6);
}
.intro-stage { --sun: min(300px, 52vw); position: relative; padding: calc(var(--sun) * 0.3) 0; margin: 0 0 8px; }
.intro-title { position: relative; z-index: 1; margin: 0; }
.intro-logo {
  display: block; width: min(680px, 94%); margin: 0 auto;
  filter: brightness(1) blur(0) drop-shadow(0 6px 24px rgba(0, 0, 0, 0.8));
  animation: logo-reveal 4.5s 0.3s cubic-bezier(0.4, 0.1, 0.3, 1) both;
}
.intro-lead { margin: 0 auto 22px; max-width: 62ch; text-shadow: 0 1px 4px #000; animation: rise 0.8s 4.8s ease-out both; }
.intro-actions { animation: rise 0.8s 5.05s ease-out both; }
.intro-note { animation: rise 0.8s 5.3s ease-out both; }

.eclipse {
  position: absolute; left: 50%; top: 50%; width: var(--sun); height: var(--sun);
  margin: calc(var(--sun) / -2) 0 0 calc(var(--sun) / -2);
}
.eclipse > div { position: absolute; border-radius: 50%; }
/* La luce del sole ancora scoperto: si spegne mentre la luna lo copre. */
.eclipse-glow {
  inset: -120%; opacity: 0.5;
  background: radial-gradient(circle closest-side, rgba(255, 246, 228, 0.5) 0%, rgba(200, 226, 245, 0.16) 30%,
    rgba(127, 200, 232, 0.05) 55%, transparent 100%);
  animation: glow-dim 4.6s 0.3s ease-in-out both;
}
.eclipse-sun {
  inset: 0;
  background: radial-gradient(circle closest-side, #fff 0 88%, #fff3dc 96%, rgba(255, 236, 205, 0) 100%);
  box-shadow: 0 0 30px 8px rgba(255, 246, 230, 0.75), 0 0 110px 36px rgba(170, 215, 240, 0.25);
}
.eclipse-moon {
  inset: -1.5%;
  background: radial-gradient(circle at 36% 32%, #141920 0%, #07090c 55%, #020304 100%);
  box-shadow: inset 0 0 22px rgba(0, 0, 0, 0.9);
  animation: moon-pass 4.5s 0.3s cubic-bezier(0.4, 0.1, 0.3, 1) both;
}
/* Corona: anello bianco sul bordo della luna e raggi sottili che girano piano. */
.eclipse-corona {
  inset: -70%;
  background:
    radial-gradient(circle closest-side, transparent 41%, rgba(255, 255, 255, 0.95) 43%, rgba(214, 236, 250, 0.42) 48%,
      rgba(127, 200, 232, 0.12) 64%, transparent 92%),
    repeating-conic-gradient(from 0deg, rgba(220, 238, 250, 0) 0deg 4deg, rgba(220, 238, 250, 0.2) 5deg 6deg,
      rgba(220, 238, 250, 0) 7deg 11deg);
  -webkit-mask-image: radial-gradient(circle closest-side, transparent 40%, #000 44%, rgba(0, 0, 0, 0.35) 66%, transparent 96%);
  mask-image: radial-gradient(circle closest-side, transparent 40%, #000 44%, rgba(0, 0, 0, 0.35) 66%, transparent 96%);
  animation: corona-in 1.4s 4.3s ease-out both, corona-turn 200s 5.7s linear infinite;
}
/* Anello di diamante: l'ultimo spicchio di sole prima della totalità. */
.eclipse-flash {
  left: 99%; top: 44%; width: 22%; height: 22%; margin: -11% 0 0 -11%; opacity: 0;
  background: radial-gradient(circle closest-side, #fff 0 18%, rgba(255, 255, 255, 0.65) 34%, rgba(200, 230, 255, 0.16) 62%, transparent);
  animation: flash 0.9s 4.2s ease-out both;
}
.eclipse-flash::after {
  content: ""; position: absolute; left: -350%; right: -350%; top: 50%; height: 2px; margin-top: -1px;
  background: linear-gradient(90deg, transparent, rgba(220, 240, 255, 0.85), transparent);
}
.scroll-cue {
  position: absolute; left: 50%; bottom: 18px; translate: -50% 0; display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-family: var(--title); text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.7rem; color: var(--muted);
  animation: rise 0.8s 5.6s ease-out both;
}
.scroll-cue::after {
  content: ""; width: 12px; height: 12px; border: solid var(--accent); border-width: 0 2px 2px 0; rotate: 45deg;
  animation: bob 1.8s 6.4s ease-in-out infinite;
}
.scroll-cue:hover { color: var(--text); text-decoration: none; }

@keyframes fade-in { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes glow-dim { from { opacity: 1; transform: scale(1.18); } }
/* La luna parte già su metà del sole e lo copre piano. */
@keyframes moon-pass { from { transform: translate(-50%, 9%); } }
@keyframes corona-in { from { opacity: 0; scale: 0.72; } }
@keyframes corona-turn { to { rotate: 360deg; } }
@keyframes flash { from { opacity: 0; scale: 0.3; } 30% { opacity: 1; scale: 1.5; } to { opacity: 0; scale: 0.8; } }
@keyframes bob { 50% { translate: 0 5px; } }
/* Il logo si scopre da sinistra a destra insieme alla luna (stessa durata e
   curva di moon-pass): a sole coperto è tutto visibile. La maschera esiste
   solo nell'animazione, così senza movimento il logo è già intero. */
@keyframes logo-reveal {
  from {
    opacity: 0.35;
    -webkit-mask-image: linear-gradient(90deg, #000 0 46%, transparent 55% 100%);
    mask-image: linear-gradient(90deg, #000 0 46%, transparent 55% 100%);
    -webkit-mask-size: 220% 100%; mask-size: 220% 100%;
    -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
    -webkit-mask-position: 100% 0; mask-position: 100% 0;
    filter: brightness(2.6) blur(6px) drop-shadow(0 6px 24px rgba(0, 0, 0, 0.8));
  }
  to {
    opacity: 1;
    -webkit-mask-image: linear-gradient(90deg, #000 0 46%, transparent 55% 100%);
    mask-image: linear-gradient(90deg, #000 0 46%, transparent 55% 100%);
    -webkit-mask-size: 220% 100%; mask-size: 220% 100%;
    -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
    -webkit-mask-position: 0 0; mask-position: 0 0;
    filter: brightness(1) blur(0) drop-shadow(0 6px 24px rgba(0, 0, 0, 0.8));
  }
}

/* Scene a strati: fondale lontano, pianeta, poi emblema o nave e testo. */
.home-main { max-width: none; padding: 0; }
.home-rest { max-width: 1180px; margin: 0 auto; padding: 32px 16px 40px; }
.story { position: relative; padding: 72px 0 24px; overflow: hidden; scroll-margin-top: 56px; }
.story-head { max-width: 760px; margin: 0 auto 8px; padding: 0 16px; text-align: center; }
.story-head h2 { font-size: clamp(1.4rem, 4.2vw, 2.2rem); }
.story-head p:last-child { color: #cfd7df; }
.scene { position: relative; display: flex; align-items: center; min-height: 88vh; overflow: hidden; isolation: isolate; }
.scene-far {
  position: absolute; left: 0; top: -22%; width: 100%; height: 144%; object-fit: cover; z-index: -3; opacity: 0.8;
}
.scene::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(180deg, var(--bg) 0%, rgba(10, 12, 15, 0) 20%, rgba(10, 12, 15, 0) 80%, var(--bg) 100%),
    linear-gradient(90deg, rgba(10, 12, 15, 0.85) 0%, rgba(10, 12, 15, 0.3) 60%, rgba(10, 12, 15, 0) 100%);
}
.scene.flip::before {
  background:
    linear-gradient(180deg, var(--bg) 0%, rgba(10, 12, 15, 0) 20%, rgba(10, 12, 15, 0) 80%, var(--bg) 100%),
    linear-gradient(270deg, rgba(10, 12, 15, 0.85) 0%, rgba(10, 12, 15, 0.3) 60%, rgba(10, 12, 15, 0) 100%);
}
.faction-scene::after {
  content: ""; position: absolute; inset: 0; z-index: -2;
  background: radial-gradient(ellipse at 28% 50%, color-mix(in srgb, var(--faction) 20%, transparent), transparent 60%);
}
.faction-scene.flip::after {
  background: radial-gradient(ellipse at 72% 50%, color-mix(in srgb, var(--faction) 20%, transparent), transparent 60%);
}
.scene-planet { position: absolute; z-index: -2; width: min(44vw, 520px); right: 5%; top: 10%; }
.flip .scene-planet { right: auto; left: 5%; }
.scene-in {
  position: relative; width: 100%; max-width: 1180px; margin: 0 auto; padding: 48px 16px;
  display: grid; grid-template-columns: minmax(0, 240px) minmax(0, 540px); gap: 36px; align-items: center;
}
.flip .scene-in { grid-template-columns: minmax(0, 540px) minmax(0, 240px); justify-content: end; }
.flip .scene-emblem { order: 2; }
.scene-emblem img {
  display: block; width: 100%; max-width: 240px; margin: 0 auto;
  filter: drop-shadow(0 0 26px color-mix(in srgb, var(--faction) 55%, transparent));
}
.scene-text { margin: 0; }
.scene-text h3 { font-size: clamp(1.3rem, 3.4vw, 2rem); }
.faction-scene .scene-text h3 { color: var(--faction); }
.faction-scene .panel::after { background: var(--faction); }
.scene-text .motto { font-size: 1.12rem; font-style: italic; color: #dfe6ec; }

.ships { isolation: isolate; }
.ships-sky {
  position: absolute; left: 0; right: 0; top: -15%; bottom: -15%; z-index: -3; opacity: 0.5;
  background: url("img/sfondi/stelle.png") center / 512px repeat;
}
.ship-scene {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; align-items: center;
  max-width: 1180px; margin: 0 auto; padding: 40px 16px; min-height: 72vh; overflow: visible; isolation: auto;
}
.ship-scene::before { content: none; }
.ship-scene.flip .ship-visual { order: 2; }
/* «screen» toglie il nero delle illustrazioni: la nave si fonde col cielo dietro. */
.ship-visual { position: relative; mix-blend-mode: screen; }
.ship-visual::before {
  content: ""; position: absolute; inset: 12%; border-radius: 50%;
  background: radial-gradient(circle closest-side, rgba(127, 200, 232, 0.16), transparent);
}
.ship-visual img { position: relative; display: block; width: 100%; max-width: 520px; margin: 0 auto; }
/* Abilità sotto le statistiche: icona, nome con tipo e tempi, spiegazione. */
.abilities-title {
  margin: 4px 0 6px; font-family: var(--title); text-transform: uppercase; letter-spacing: 0.08em;
  font-size: 0.78rem; color: var(--amber);
}
.abilities { list-style: none; padding: 0; margin: 0 0 14px; }
.ability {
  display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 12px; align-items: start;
  padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 0.95rem;
}
.ability p { margin: 0; }
.ability .ability-name { margin-bottom: 2px; }
.ability-icon {
  display: block; width: 48px; height: 48px; background: var(--slot); border: 1px solid var(--slot-line);
  clip-path: var(--clip-s); object-fit: contain; padding: 4px;
}
.ability-icon.passive { position: relative; }
.ability-icon.passive::after {
  content: "P"; position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--title); font-size: 1.1rem; color: var(--muted);
}
.ship-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0 0 14px; }
.ship-stats div { background: var(--slot); border: 1px solid var(--line); padding: 8px 10px; clip-path: var(--clip-s); }
.ship-stats dt {
  font-family: var(--title); text-transform: uppercase; letter-spacing: 0.02em; font-size: 0.6rem; color: var(--muted);
  overflow-wrap: anywhere;
}
.ship-stats dd { margin: 0; font-family: var(--mono); font-size: 1.08rem; }
.ship-price { color: var(--muted); }

/* Fazioni: territorio, credo e rivali sotto la storia. */
.faction-facts { display: grid; gap: 8px; margin: 0 0 14px; }
.faction-facts div { border-left: 2px solid var(--faction); padding: 2px 0 2px 12px; }
.faction-facts dt {
  font-family: var(--title); text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.66rem; color: var(--faction);
}
.faction-facts dd { margin: 0; color: #dfe6ec; font-size: 0.95rem; }

/* Tutorial: un passo per scena, numero fantasma e icona in parallasse. */
.tutorial { isolation: isolate; padding-bottom: 56px; }
.tutorial-sky {
  position: absolute; inset: 0; z-index: -3; opacity: 0.35;
  background: url("img/sfondi/stelle.png") center / 512px repeat;
}
.tutorial::after {
  content: ""; position: absolute; inset: 0; z-index: -2; pointer-events: none;
  background: radial-gradient(ellipse at 50% 0%, rgba(127, 200, 232, 0.1), transparent 55%),
    linear-gradient(180deg, var(--bg) 0%, rgba(10, 12, 15, 0) 6%, rgba(10, 12, 15, 0) 94%, var(--bg) 100%);
}
.tutorial-toc {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; max-width: 980px; margin: 18px auto 8px; padding: 0 16px;
}
.tutorial-toc a {
  padding: 6px 10px; background: var(--slot); border: 1px solid var(--line); clip-path: var(--clip-s);
  font-size: 0.85rem; color: var(--text);
}
.tutorial-toc a:hover { border-color: var(--accent); text-decoration: none; }
.tutorial-toc .num { color: var(--accent); }
.steps { list-style: none; max-width: 1060px; margin: 0 auto; padding: 0 16px; position: relative; }
.steps::before {
  content: ""; position: absolute; left: calc(16px + 43px); top: 40px; bottom: 40px; width: 2px;
  background: linear-gradient(180deg, transparent, rgba(127, 200, 232, 0.35) 6%, rgba(127, 200, 232, 0.35) 94%, transparent);
}
.step {
  position: relative; display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 24px; align-items: start;
  padding: 36px 0; scroll-margin-top: 64px;
}
.step-ghost {
  position: absolute; right: 0; top: 4px; z-index: -1; pointer-events: none;
  font-family: var(--title); font-size: clamp(5rem, 16vw, 11rem); line-height: 1; color: rgba(127, 200, 232, 0.06);
}
.step.flip .step-ghost { right: auto; left: 30%; }
.step-mark {
  position: relative; width: 88px; height: 88px; display: grid; place-items: center;
  background: var(--panel); border: 1px solid var(--slot-line); clip-path: var(--clip);
}
.step-mark img { width: 56px; height: 56px; object-fit: contain; }
.step-mark .num { position: absolute; left: 8px; top: 4px; font-size: 0.78rem; color: var(--accent); }
.step-body { margin: 0; }
.step-body h3 { font-size: clamp(1.15rem, 3vw, 1.6rem); }
.step-lead { font-size: 1.04rem; color: #dfe6ec; }
.step-how { margin: 0 0 14px; padding-left: 20px; }
.step-how li { margin: 0 0 8px; }
.step-how li::marker { color: var(--accent); }
.step-tip { padding: 10px 12px; border-left: 3px solid var(--amber); background: rgba(255, 179, 0, 0.06); color: #e9e2cf; }
.step-tip b {
  display: block; font-family: var(--title); text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.7rem; color: var(--amber);
}
.step-more { margin: 0; }
.tutorial-end { text-align: center; color: var(--muted); margin: 16px 16px 0; }

/* Eventi: scene come le fazioni, col colore ambra degli avvisi. */
.event-scene { --faction: var(--amber); }
.event-scene::after {
  content: ""; position: absolute; inset: 0; z-index: -2;
  background: radial-gradient(ellipse at 28% 50%, rgba(255, 179, 0, 0.14), transparent 60%);
}
.event-scene.flip::after { background: radial-gradient(ellipse at 72% 50%, rgba(255, 179, 0, 0.14), transparent 60%); }
.event-scene .scene-in { grid-template-columns: minmax(0, 320px) minmax(0, 540px); }
.event-scene.flip .scene-in { grid-template-columns: minmax(0, 540px) minmax(0, 320px); }
.event-scene.flip .event-visual { order: 2; }
.event-scene.no-visual .scene-in, .event-scene.no-visual.flip .scene-in { grid-template-columns: minmax(0, 620px); }
.event-scene .panel::after { background: var(--amber); }
.event-scene .scene-text h3 { color: var(--amber); }
.event-visual img {
  display: block; width: 100%; max-width: 320px; margin: 0 auto;
  filter: drop-shadow(0 0 30px rgba(255, 179, 0, 0.28));
}
.event-emblems { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; justify-items: center; }
.event-emblems img { max-width: 140px; filter: drop-shadow(0 0 18px color-mix(in srgb, var(--faction) 55%, transparent)); }
.event-emblems img:first-child { grid-column: 1 / -1; }
.event-reward { color: #e9e2cf; }
.event-reward b {
  font-family: var(--title); text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.7rem; color: var(--amber); margin-right: 6px;
}

/* Download: tre pulsanti non ancora attivi. */
.downloads { position: relative; padding: 72px 16px; border-top: 1px solid var(--line); text-align: center; scroll-margin-top: 56px; }
.downloads-in { max-width: 860px; margin: 0 auto; }
.downloads h2 { font-size: clamp(1.4rem, 4.2vw, 2.2rem); }
.store-list {
  list-style: none; padding: 0; margin: 22px 0 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px;
}
.store {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; text-align: left; height: 100%;
  background: var(--slot); border: 1px solid var(--slot-line); clip-path: var(--clip); cursor: not-allowed; opacity: 0.85;
}
/* La scheda di Windows con un rilascio è un collegamento: niente divieto, colori del testo. */
a.store { cursor: pointer; opacity: 1; color: var(--text); }
a.store:hover { text-decoration: none; border-color: var(--accent); }
a.store .store-text em { color: var(--hull); }
.store-text { display: flex; flex-direction: column; line-height: 1.25; }
.store-text small { color: var(--muted); font-size: 0.75rem; }
.store-text b { font-family: var(--title); text-transform: uppercase; letter-spacing: 0.06em; font-size: 1.05rem; }
.store-text em { font-style: normal; font-size: 0.75rem; color: var(--amber); }
.store-glyph { position: relative; flex: none; width: 34px; height: 34px; }
.store-glyph::before, .store-glyph::after { content: ""; position: absolute; border: 2px solid var(--accent); }
/* PC: schermo e base. */
.store.pc .store-glyph::before { left: 2px; right: 2px; top: 5px; height: 18px; border-radius: 2px; }
.store.pc .store-glyph::after { left: 11px; right: 11px; bottom: 4px; height: 0; border-width: 2px 0 0; }
/* Telefoni: cornice e tasto. */
.store.android .store-glyph::before, .store.ios .store-glyph::before { left: 9px; right: 9px; top: 1px; bottom: 1px; border-radius: 4px; }
.store.android .store-glyph::after, .store.ios .store-glyph::after { left: 15px; width: 4px; bottom: 5px; height: 0; border-width: 2px 0 0; }

/* Chiusura col fondale dell'eclissi del gioco. */
.finale {
  position: relative; padding: 88px 16px; border-top: 1px solid var(--line);
  background: #05070a url("img/fondale.jpg") 18% 30% / cover no-repeat;
}
.finale::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, var(--bg) 0%, rgba(10, 12, 15, 0.35) 30%, rgba(10, 12, 15, 0.55) 100%);
}
.finale .panel { max-width: 640px; margin: 0 auto; }

/* Comparsa allo scorrimento: solo con JavaScript, altrimenti tutto è già visibile. */
.js .reveal {
  opacity: 0; transform: translateY(44px);
  transition: opacity 0.9s ease-out, transform 1.1s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.js .reveal.from-left { transform: translateX(-90px) scale(0.92); }
.js .reveal.from-right { transform: translateX(90px) scale(0.92); }
.js .scene-text.reveal { transition-delay: 0.15s; }
.js .reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
@media (prefers-reduced-motion: reduce) {
  .intro *, .intro *::before, .intro *::after { animation: none !important; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  [data-depth] { translate: none; }
  .intro-in { opacity: 1; }
}

@media (max-width: 860px) {
  .wiki-layout { grid-template-columns: minmax(0, 1fr); }
  .wiki-side ul { position: static; display: flex; flex-wrap: wrap; gap: 4px; }
  .wiki-side a { border-left: 0; border-bottom: 2px solid transparent; padding: 6px 8px; }
  .wiki-side a[aria-current="page"] { border-bottom-color: var(--accent); }
  .detail-head { grid-template-columns: 1fr; }
  .detail-head img.hero-img { max-width: 360px; }
}
@media (max-width: 760px) {
  .menu-btn {
    display: inline-flex; margin-left: auto; min-height: 40px; min-width: 44px; align-items: center; justify-content: center;
    font-family: var(--title); font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--text); background: var(--slot); border: 1px solid var(--slot-line); cursor: pointer; padding: 0 12px;
  }
  .js .nav { display: none; }
  .js .nav.open { display: flex; }
  .nav { flex-basis: 100%; flex-direction: column; align-items: stretch; margin: 0; }
  .topbar-in { flex-wrap: wrap; }
  .nav a { padding: 12px 6px; border-top: 1px solid var(--line); }
  .nav a.cta { margin: 8px 0 4px; text-align: center; }
  .nav a[aria-current="page"] { box-shadow: inset 3px 0 0 var(--accent); }
  .brand small { display: none; }
  .intro-in { padding: 24px 16px 88px; }
  .story { padding-top: 56px; }
  .scene { min-height: 0; }
  .scene::before, .scene.flip::before {
    background: linear-gradient(180deg, var(--bg) 0%, rgba(10, 12, 15, 0.2) 18%, rgba(10, 12, 15, 0.55) 60%, var(--bg) 100%);
  }
  .scene-in, .flip .scene-in { grid-template-columns: minmax(0, 1fr); gap: 18px; padding: 36px 16px; justify-content: stretch; }
  .flip .scene-emblem { order: 0; }
  .scene-emblem img { max-width: 132px; }
  .scene-planet, .flip .scene-planet { width: 64vw; left: auto; right: -12%; top: 2%; opacity: 0.6; }
  .faction-scene::after, .faction-scene.flip::after {
    background: radial-gradient(ellipse at 50% 22%, color-mix(in srgb, var(--faction) 20%, transparent), transparent 60%);
  }
  .ship-scene { grid-template-columns: minmax(0, 1fr); gap: 8px; min-height: 0; padding: 28px 16px; }
  .ship-scene.flip .ship-visual { order: 0; }
  .ship-visual img { max-width: 320px; }
  .ship-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .step { grid-template-columns: 56px minmax(0, 1fr); gap: 14px; padding: 24px 0; }
  .steps::before { left: calc(16px + 27px); }
  .step-mark { width: 56px; height: 56px; }
  .step-mark img { width: 36px; height: 36px; }
  .step-mark .num { display: none; }
  .step.flip .step-ghost { left: auto; right: 0; }
  .event-scene .scene-in, .event-scene.flip .scene-in, .event-scene.no-visual .scene-in { grid-template-columns: minmax(0, 1fr); }
  .event-scene.flip .event-visual { order: 0; }
  .event-visual img { max-width: 200px; }
  .event-emblems img { max-width: 92px; }
  .event-scene::after, .event-scene.flip::after {
    background: radial-gradient(ellipse at 50% 22%, rgba(255, 179, 0, 0.14), transparent 60%);
  }
  .store-list { grid-template-columns: minmax(0, 1fr); }
  .downloads { padding: 52px 16px; }
  .finale { padding: 56px 16px; }
  .panel { padding: 14px 14px; }
  dl.kv { grid-template-columns: 1fr; gap: 0 0; }
  dl.kv dd { margin: 0 0 8px; }
  th, td { padding: 7px 8px; }
}

/* Download (A4.3): impronta SHA-256 intera e selezionabile, comando da copiare. */
.hash { display: block; font-family: var(--mono); overflow-wrap: anywhere; user-select: all; padding: 10px 12px; background: var(--slot); border: 1px solid var(--slot-line); }
#contenuto pre { font-family: var(--mono); padding: 10px 12px; background: var(--slot); border: 1px solid var(--slot-line); overflow-x: auto; }
