/* IX INTERACTIVE — homepage splash. Nero, metallo, accento rosso (drago). */

:root {
  --bg: #05060a;
  --ink: #e8eaf0;
  --muted: #8b93a4;
  --red: #ff2a32;
  --red-deep: #c8161d;
  --steel-hi: #ffffff;
  --steel-mid: #b9c1cf;
  --steel-lo: #5b6472;
  --edge: rgba(255, 255, 255, 0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  overflow: hidden;
}

#bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}

/* Righe di scansione + vignetta CRT sopra il canvas. */
.crt {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(0, 0, 0, 0) 0px,
      rgba(0, 0, 0, 0) 2px,
      rgba(0, 0, 0, 0.18) 3px,
      rgba(0, 0, 0, 0) 4px
    ),
    radial-gradient(120% 120% at 50% 40%, rgba(0, 0, 0, 0) 55%, rgba(0, 0, 0, 0.72) 100%);
  mix-blend-mode: multiply;
}

main {
  position: relative;
  z-index: 2;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px 16px;
  gap: 22px;
}

.mark {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.kicker {
  font-size: clamp(10px, 2.4vw, 13px);
  letter-spacing: 0.62em;
  text-indent: 0.62em;
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 600;
}

/* Il logo: metallo cromato con riflesso che scorre. */
#title {
  position: relative;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: clamp(6px, 2.4vw, 22px);
  text-indent: clamp(6px, 2.4vw, 22px);
  font-size: clamp(34px, 11vw, 132px);
  line-height: 0.98;
  background: linear-gradient(
    180deg,
    var(--steel-hi) 0%,
    var(--steel-mid) 42%,
    var(--steel-lo) 60%,
    var(--steel-mid) 78%,
    var(--steel-hi) 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.6)) drop-shadow(0 0 26px rgba(255, 42, 50, 0.22));
}

/* Riflesso cromato animato che passa sopra le lettere. */
#title::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    rgba(255, 255, 255, 0) 40%,
    rgba(255, 255, 255, 0.85) 50%,
    rgba(255, 255, 255, 0) 60%
  );
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  animation: shine 6s linear infinite;
  pointer-events: none;
}

@keyframes shine {
  0% { background-position: 180% 0; }
  100% { background-position: -80% 0; }
}

/* Glitch: sdoppiamento RGB momentaneo, acceso dal client. */
#title.glitch {
  animation: jitter 0.17s steps(2) 1;
  text-shadow: 2px 0 rgba(255, 42, 50, 0.9), -2px 0 rgba(0, 200, 255, 0.8);
}

@keyframes jitter {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-2px, 1px); }
  50% { transform: translate(2px, -1px); }
  75% { transform: translate(-1px, 0); }
  100% { transform: translate(0, 0); }
}

.rule {
  width: min(320px, 70vw);
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--red), transparent);
  opacity: 0.7;
}

.tag {
  font-size: clamp(11px, 3vw, 15px);
  letter-spacing: 0.34em;
  text-indent: 0.34em;
  color: #cfd6e4;
  text-transform: uppercase;
  font-weight: 600;
}

.sub {
  max-width: 60ch;
  font-size: clamp(12px, 2.4vw, 15px);
  line-height: 1.7;
  color: var(--muted);
  letter-spacing: 0.02em;
}

footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px clamp(14px, 4vw, 34px);
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--muted);
}

footer .dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 10px var(--red);
  vertical-align: middle;
  margin-right: 8px;
}

footer .flag { color: #aeb6c6; }

/* Indicatore del canale ATPS. Nascosto finche' l'handshake non riesce. */
footer .atps {
  opacity: 0;
  transition: opacity 0.5s ease;
  letter-spacing: 0.2em;
  color: #7fe0a0;
}
footer .atps.on { opacity: 1; }
footer .atps.off { opacity: 1; color: var(--muted); }

/* Velo del lockdown antitamper. */
#veil {
  position: fixed;
  inset: 0;
  z-index: 9;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: #030305;
  text-align: center;
  padding: 24px;
}

#veil.on { display: flex; }

#veil .veil-title {
  font-size: clamp(28px, 9vw, 84px);
  font-weight: 800;
  letter-spacing: 0.24em;
  text-indent: 0.24em;
  color: var(--red);
  text-transform: uppercase;
  text-shadow: 0 0 24px rgba(255, 42, 50, 0.55);
}

#veil .veil-sub {
  color: var(--muted);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  font-size: 12px;
}

html[data-locked="1"] main,
html[data-locked="1"] footer { filter: blur(9px) grayscale(1); opacity: 0.25; }

@media (prefers-reduced-motion: reduce) {
  #title::after { animation: none; }
  #title.glitch { animation: none; text-shadow: none; }
}

@media (max-width: 560px) {
  .kicker { letter-spacing: 0.4em; text-indent: 0.4em; }
  footer { font-size: 9px; letter-spacing: 0.16em; }
}

/* ===================== AUTH: pulsante + modale ===================== */
.auth-top {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 5;
}
.auth-top #authBtn {
  font-family: inherit;
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--steel-mid);
  background: rgba(10, 12, 18, 0.6);
  border: 1px solid var(--edge);
  border-radius: 6px;
  padding: 8px 14px;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: color .15s, border-color .15s, box-shadow .15s;
}
.auth-top #authBtn:hover {
  color: var(--steel-hi);
  border-color: rgba(255, 42, 50, 0.5);
  box-shadow: 0 0 12px rgba(255, 42, 50, 0.25);
}
.auth-top #authBtn[data-in] { color: var(--red); border-color: rgba(255, 42, 50, 0.4); }

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(3, 4, 7, 0.72);
  backdrop-filter: blur(3px);
  padding: 16px;
}
.modal.on { display: flex; }
.modal-box {
  width: 100%;
  max-width: 340px;
  background: linear-gradient(180deg, #0c0e14, #070810);
  border: 1px solid var(--edge);
  border-radius: 12px;
  padding: 22px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 42, 50, 0.06);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.modal-tabs { display: flex; gap: 6px; margin-bottom: 4px; }
.modal-tabs button {
  flex: 1;
  font-family: inherit;
  font-size: 12px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--edge);
  border-radius: 6px;
  padding: 8px;
  cursor: pointer;
}
.modal-tabs button.active { color: var(--ink); border-color: rgba(255, 42, 50, 0.5); background: rgba(255, 42, 50, 0.06); }
.modal-box input {
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  background: #05060a;
  border: 1px solid var(--edge);
  border-radius: 6px;
  padding: 11px 12px;
  outline: none;
}
.modal-box input:focus { border-color: rgba(255, 42, 50, 0.55); }
#authSubmit {
  font-family: inherit;
  font-size: 13px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #fff;
  background: linear-gradient(180deg, var(--red), var(--red-deep));
  border: none;
  border-radius: 6px;
  padding: 12px;
  cursor: pointer;
  margin-top: 2px;
}
#authSubmit:disabled { opacity: .6; cursor: default; }
.modal-box .link {
  background: none;
  border: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  padding: 2px;
}
.modal-box .link:hover { color: var(--ink); }
.auth-error { color: var(--red); font-size: 12px; min-height: 14px; line-height: 1.3; }
.auth-note { color: var(--steel-lo); font-size: 11px; text-align: center; letter-spacing: .06em; }

/* utility: nascondi senza stile inline (compatibile con CSP) */
.hidden { display: none !important; }

/* recupero: pulsante download + input file */
.auth-top { display: flex; gap: 8px; align-items: center; }
#recDownBtn {
  font-family: inherit; font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--steel-lo); background: rgba(10,12,18,0.6); border: 1px solid var(--edge);
  border-radius: 6px; padding: 7px 10px; cursor: pointer; backdrop-filter: blur(4px);
}
#recDownBtn:hover { color: var(--steel-mid); border-color: rgba(255,42,50,0.4); }
#recoverForm { display: flex; flex-direction: column; gap: 12px; }
#recoverForm input[type="file"] { font-family: inherit; font-size: 12px; color: var(--muted); background: #05060a; border: 1px dashed var(--edge); border-radius: 6px; padding: 12px; cursor: pointer; }
#recSubmit {
  font-family: inherit; font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: #fff;
  background: linear-gradient(180deg, var(--red), var(--red-deep)); border: none; border-radius: 6px; padding: 12px; cursor: pointer;
}
#recSubmit:disabled { opacity: .6; cursor: default; }

/* ===================== ABOUT US: pulsante + pannello ===================== */
.about-top {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 5;
  display: flex;
  gap: 8px;
}
.about-top button {
  font-family: inherit;
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--steel-mid);
  background: rgba(10, 12, 18, 0.6);
  border: 1px solid var(--edge);
  border-radius: 6px;
  padding: 8px 14px;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: color .15s, border-color .15s, box-shadow .15s;
}
.about-top button:hover {
  color: var(--steel-hi);
  border-color: rgba(255, 42, 50, 0.5);
  box-shadow: 0 0 12px rgba(255, 42, 50, 0.25);
}
.modal-box.about {
  max-width: 540px;
  text-align: left;
  gap: 0;
  max-height: 85vh;
  overflow-y: auto;
}
.about-title {
  color: var(--red);
  font-size: 16px;
  letter-spacing: .18em;
  text-transform: uppercase;
  margin-bottom: 14px;
  text-shadow: 0 0 14px rgba(255, 42, 50, 0.35);
}
.about-body p {
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.75;
  margin-bottom: 12px;
}
.about-body b { color: var(--ink); }
.about-body .muted { color: var(--steel-lo); }
.about-motto {
  color: var(--steel-mid) !important;
  letter-spacing: .1em;
  text-transform: uppercase;
  font-size: 12px !important;
  border-top: 1px solid var(--edge);
  padding-top: 14px;
  margin-top: 4px;
}
.modal-box.about .link { margin-top: 8px; align-self: flex-start; }

/* ---- passkey (WebAuthn): login a prova di phishing ---- */
.passkey-btn {
  font-family: inherit; font-size: 12px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--steel-mid); background: rgba(10,12,18,0.6); border: 1px solid var(--edge);
  border-radius: 6px; padding: 11px; cursor: pointer; margin-top: 2px;
}
.passkey-btn:hover { color: #fff; border-color: rgba(255,42,50,0.45); }
#passkeyAddBtn {
  font-family: inherit; font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--steel-lo); background: rgba(10,12,18,0.6); border: 1px solid var(--edge);
  border-radius: 6px; padding: 7px 10px; cursor: pointer; backdrop-filter: blur(4px);
}
#passkeyAddBtn:hover { color: var(--steel-mid); border-color: rgba(255,42,50,0.4); }

/* ---- blindatura anti-clone: avviso a tutto schermo ---- */
#cloneWarn {
  display: none; position: fixed; inset: 0; z-index: 9999;
  background: rgba(3,4,7,0.97); align-items: center; justify-content: center; padding: 24px;
  backdrop-filter: blur(6px);
}
#cloneWarn.on { display: flex; }
#cloneWarn .clone-box {
  max-width: 560px; text-align: center; border: 1px solid rgba(255,42,50,0.5);
  border-radius: 12px; padding: 32px 28px; background: linear-gradient(180deg, rgba(20,6,8,0.9), rgba(8,5,7,0.9));
  box-shadow: 0 0 60px rgba(255,42,50,0.15);
}
#cloneWarn .clone-mark { font-size: 46px; line-height: 1; margin-bottom: 12px; }
#cloneWarn .clone-title {
  color: #fff; font-size: 18px; font-weight: 700; letter-spacing: .02em; line-height: 1.35; margin-bottom: 14px;
}
#cloneWarn .clone-sub { color: var(--steel-mid); font-size: 14px; line-height: 1.6; }
#cloneWarn .clone-domain {
  margin-top: 18px; color: var(--red); font-size: 13px; letter-spacing: .04em; word-break: break-all;
  border-top: 1px solid var(--edge); padding-top: 14px;
}

/* ---- catalogo giochi ---- */
.modal-box.games {
  max-width: 720px;
  text-align: left;
  gap: 0;
  max-height: 88vh;
  overflow-y: auto;
}
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 8px;
}
.game-card {
  border: 1px solid var(--edge);
  border-radius: 10px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(20,22,30,0.5), rgba(8,9,14,0.5));
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.game-card:hover {
  border-color: rgba(255,42,50,0.4);
  box-shadow: 0 8px 30px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,42,50,0.08);
  transform: translateY(-2px);
}
.game-cover {
  aspect-ratio: 3 / 2;
  overflow: hidden;
  background: #05060a;
  border-bottom: 1px solid var(--edge);
}
.game-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.game-info { padding: 14px 15px 16px; }
.game-title {
  color: var(--ink);
  font-size: 15px;
  letter-spacing: .04em;
  margin-bottom: 8px;
}
.game-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.game-tags span {
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--steel-mid);
  border: 1px solid var(--edge);
  border-radius: 4px;
  padding: 3px 7px;
  background: rgba(255,42,50,0.05);
}
.game-desc { color: var(--muted); font-size: 13px; line-height: 1.6; }
.modal-box.games .link { margin-top: 4px; align-self: flex-start; }

/* ---- prezzo sulla card + pagina acquisto ---- */
.game-card { cursor: pointer; }
.game-cover { position: relative; }
.game-price {
  position: absolute; top: 10px; right: 10px;
  font-size: 13px; font-weight: 700; letter-spacing: .03em;
  color: #fff; background: linear-gradient(180deg, var(--red), var(--red-deep));
  border-radius: 6px; padding: 5px 10px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.08);
}
.modal-box.buy { max-width: 460px; text-align: left; gap: 12px; max-height: 90vh; overflow-y: auto; }
.buy-cover { border-radius: 10px; overflow: hidden; border: 1px solid var(--edge); aspect-ratio: 3 / 2; background: #05060a; }
.buy-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.buy-title { color: var(--ink); font-size: 18px; letter-spacing: .03em; }
.buy-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 4px; }
.buy-price { color: #fff; font-size: 22px; font-weight: 800; letter-spacing: .02em; }
.buy-cta {
  font-family: inherit; font-size: 13px; letter-spacing: .1em; text-transform: uppercase;
  color: #fff; background: linear-gradient(180deg, var(--red), var(--red-deep));
  border: none; border-radius: 8px; padding: 12px 22px; cursor: pointer;
}
.buy-cta:hover { box-shadow: 0 0 16px rgba(255,42,50,0.4); }
.buy-note { color: var(--steel-mid); font-size: 12.5px; line-height: 1.6; min-height: 0; display: none; border-top: 1px solid var(--edge); padding-top: 12px; }
.buy-note.on { display: block; }

/* ---- stato posseduto / riscatta codice / scarica licenza ---- */
a.buy-cta { text-decoration: none; display: inline-block; text-align: center; }
.buy-owned { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 4px; }
.owned-badge {
  color: #7fe0a0; font-size: 14px; font-weight: 700; letter-spacing: .04em;
  border: 1px solid rgba(127,224,160,0.4); border-radius: 8px; padding: 8px 14px;
  background: rgba(127,224,160,0.07);
}
.buy-redeem { border-top: 1px solid var(--edge); padding-top: 12px; }
.redeem-label { display: block; color: var(--steel-lo); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 8px; }
.redeem-row { display: flex; gap: 8px; }
.redeem-row input {
  flex: 1; font-family: inherit; font-size: 14px; letter-spacing: .08em; color: var(--ink);
  background: #05060a; border: 1px solid var(--edge); border-radius: 6px; padding: 10px 12px; outline: none;
  text-transform: uppercase;
}
.redeem-row input:focus { border-color: rgba(255,42,50,0.55); }
.redeem-row button {
  font-family: inherit; font-size: 12px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--steel-mid); background: rgba(10,12,18,0.6); border: 1px solid var(--edge);
  border-radius: 6px; padding: 10px 16px; cursor: pointer;
}
.redeem-row button:hover { color: #fff; border-color: rgba(255,42,50,0.45); }
.redeem-row button:disabled { opacity: .6; cursor: default; }

/* ---- azioni "posseduto": scarica gioco + licenza ---- */
.owned-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.owned-actions .link { font-size: 12px; }

/* ---- gestione dispositivi (attivazioni / reinstallo) ---- */
.devices-box { border-top: 1px solid var(--edge); padding-top: 12px; margin-top: 4px; }
.devices-label { color: var(--steel-lo); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 8px; }
.devices-list { display: flex; flex-direction: column; gap: 6px; }
.device-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--muted); }
.device-name { color: var(--steel-mid); }
.device-off {
  font-family: inherit; font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--steel-lo); background: transparent; border: 1px solid var(--edge);
  border-radius: 5px; padding: 4px 9px; cursor: pointer;
}
.device-off:hover { color: var(--red); border-color: rgba(255,42,50,0.45); }
.device-off:disabled { opacity: .5; cursor: default; }
.devices-hint { color: var(--steel-lo); font-size: 11px; line-height: 1.5; margin-top: 8px; }

/* ---- Report a Bug (chat feedback) ---- */
.modal-box.bug { max-width: 480px; text-align: left; gap: 12px; max-height: 88vh; }
.bug-note { color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.bug-feed {
  display: flex; flex-direction: column; gap: 10px;
  max-height: 46vh; overflow-y: auto; padding: 6px 2px;
  border-top: 1px solid var(--edge); border-bottom: 1px solid var(--edge);
}
.bug-empty { color: var(--steel-lo); font-size: 12.5px; text-align: center; padding: 18px 0; }
.bug-msg { max-width: 85%; border-radius: 10px; padding: 9px 12px; }
.bug-msg.from-user { align-self: flex-end; background: rgba(255,42,50,0.10); border: 1px solid rgba(255,42,50,0.25); }
.bug-msg.from-studio { align-self: flex-start; background: rgba(127,224,160,0.08); border: 1px solid rgba(127,224,160,0.25); }
.bug-who { color: var(--steel-lo); font-size: 10.5px; letter-spacing: .04em; margin-bottom: 4px; }
.bug-text { color: var(--ink); font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.bug-compose { display: flex; gap: 8px; align-items: flex-end; }
.bug-compose textarea {
  flex: 1; font-family: inherit; font-size: 14px; color: var(--ink);
  background: #05060a; border: 1px solid var(--edge); border-radius: 6px; padding: 10px 12px;
  outline: none; resize: vertical; min-height: 44px;
}
.bug-compose textarea:focus { border-color: rgba(255,42,50,0.55); }
.bug-compose button {
  font-family: inherit; font-size: 13px; letter-spacing: .08em; text-transform: uppercase;
  color: #fff; background: linear-gradient(180deg, var(--red), var(--red-deep));
  border: none; border-radius: 6px; padding: 11px 18px; cursor: pointer;
}
.bug-compose button:disabled { opacity: .6; cursor: default; }


/* ===== Domande Frequenti (FAQ) ===== */
.faq-body { text-align: left; }
.faq-sec { margin: 12px 0; }
.faq-sec:first-child { margin-top: 4px; }
.faq-head { color: var(--ink); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; font-size: 12px; opacity: .7; margin: 0 0 4px; }
.faq-q { color: var(--ink); font-weight: 600; margin: 10px 0 2px; }
.faq-warn { margin: 12px 0 4px; padding: 12px 14px; border: 1px solid rgba(255, 42, 50, 0.45); border-left-width: 3px; border-radius: 8px; background: rgba(255, 42, 50, 0.06); }
.faq-warn p { margin: 0 0 8px; }
.faq-warn p:last-child { margin-bottom: 0; }
