@import url('https://fonts.googleapis.com/css2?family=VT323&display=swap');

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'VT323', monospace;
  background-color: #0b0f1a;
  color: #e6e6e6;
  text-align: center;
}

/* ================= TITOLO ================= */

h1 {
  margin: 30px 0 5px;
  font-size: 52px;
  letter-spacing: 3px;
  color: #ffffff;
}

h1::after {
  content: "F4NTUZ";
  display: block;                   /* rimane sotto il titolo */
  margin-top: 6px;
  font-size: 16px;
  letter-spacing: 2px;
  color: #00ff88;
  opacity: 1;

  /* Sfondo tipo evidenziatore */
  background-color: rgba(0, 0, 0, 0.6);  /* nero semi-trasparente */
  padding: 2px 6px;                       /* margine interno */
  border-radius: 4px;                      /* bordi arrotondati */

  width: fit-content;                      /* il blocco si adatta alla larghezza del testo */
  margin-left: auto;                       /* centraggio orizzontale */
  margin-right: auto;
}


/* ================= HUD ================= */

.hud {
  display: flex;
  justify-content: center;
  gap: 30px;
  font-size: 22px;
  letter-spacing: 2px;
  margin: 15px 0 5px;
  color: #00ff88;
}

.hud span {
  color: #ffffff;
}

/* ================= GRIGLIA ================= */

#grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(50, 20px);
  grid-template-rows: repeat(50, 20px);
  width: max-content;
  margin: 30px auto;
  padding: 14px;
  background-color: #ffffff;
  border-radius: 10px;
  box-shadow:
    0 0 0 3px #00ff88,
    0 0 0 8px #0b0f1a,
    0 25px 60px rgba(0,0,0,0.7);
}

#grid::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0,0,0,0.02),
    rgba(0,0,0,0.02) 1px,
    transparent 1px,
    transparent 3px
  );
}

/* ================= CELLE ================= */

.cell {
  width: 20px;
  height: 20px;
  background-color: #ffffff;
  border: 1px solid #f2f2f2;
  cursor: pointer;
  transition: background-color 0.12s ease;
}

.cell:hover {
  background-color: #eafff5;
}

.cell.selected {
  background-color: #00ff88;
  animation: pixelPulse 0.15s steps(2);
}

.cell.occupied {
  background-color: #444;
  cursor: not-allowed;
}

@keyframes pixelPulse {
  from { opacity: 0.6; }
  to { opacity: 1; }
}

/* ================= CONTROLLI ================= */

#controls {
  margin: 20px 0 30px;
  font-size: 22px;
  color: #ffffff;
  background-color: rgba(11,15,26,0.85);
  padding: 15px 20px;
  border-radius: 10px;

  /* Contorno stile titolo */
  border: 4px solid #fff;
  box-shadow: 
    0 0 15px rgba(255,255,255,0.6),
    0 0 20px #00ff88,
    0 0 30px #00ff88;

  display: inline-block;
  text-align: center;
}

#controls span {
  color: #ffffff;
  text-shadow: 1px 1px 2px #000;
}

#controls button {
  font-family: 'VT323', monospace;
  font-size: 22px;
  padding: 10px 26px;
  background-color: transparent;
  border: 2px solid #00ff88;
  color: #00ff88;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.18s ease;
  text-shadow: 1px 1px 2px #000;
}

#controls button:hover {
  background-color: #00ff88;
  color: #0b0f1a;
  box-shadow: 0 0 10px #00ff88, 0 0 20px #00ff88;
}

#controls button:active {
  animation: shake 0.15s;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-2px); }
  75% { transform: translateX(2px); }
}

/* ================= MODALE ================= */

.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(5,8,20,0.88);
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-content {
  width: 360px;
  padding: 26px;
  background: #11162a;
  border-radius: 8px;
  border: 1px solid #00ff88;
  box-shadow:
    0 0 0 2px rgba(0,255,136,0.15),
    0 20px 50px rgba(0,0,0,0.6);
  text-align: center;
}

/* ================= INPUT ================= */

.modal label {
  display: block;
  margin-bottom: 12px;
  font-size: 18px;
}

.modal input {
  width: 100%;
  padding: 6px;
  margin-top: 6px;
  font-family: 'VT323', monospace;
  font-size: 18px;
  background-color: #0b0f1a;
  border: 1px solid #333;
  color: #ffffff;
}

/* ================= PREVIEW ================= */

#previewContainer {
  margin: 14px 0;
  padding: 8px;
  background-color: #0b0f1a;
  border: 1px solid #333;
}

#previewImg {
  max-width: 100%;
  max-height: 120px;
}

/* ================= PAYPAL ================= */

#paypal-button-container {
  margin: 15px 0;
}

/* ================= OVERLAY ================= */

.overlay-img {
  position: absolute;
  z-index: 10;
  cursor: pointer;
}

/* ================= ARCADE HORIZON BACKGROUND ================= */

.background-signature {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background: radial-gradient(
    ellipse at top,
    rgba(255,0,150,0.15),
    rgba(11,15,26,0.0) 70%
  );
}

.background-signature::before {
  content: "";
  position: absolute;
  left: -50%;
  right: -50%;
  bottom: -40%;
  height: 120%;
  background:
    repeating-linear-gradient(
      to right,
      rgba(0,255,255,0.15),
      rgba(0,255,255,0.15) 1px,
      transparent 1px,
      transparent 80px
    ),
    repeating-linear-gradient(
      to top,
      rgba(0,255,255,0.25),
      rgba(0,255,255,0.25) 1px,
      transparent 1px,
      transparent 60px
    );
  transform: perspective(600px) rotateX(65deg);
  transform-origin: bottom center;
  animation: gridMove 18s linear infinite;
}

.background-signature::after {
  content: "";
  position: absolute;
  top: 15%;
  left: 50%;
  width: 500px;
  height: 300px;
  transform: translateX(-50%);
  background: radial-gradient(
    ellipse,
    rgba(255,0,150,0.25),
    transparent 70%
  );
  filter: blur(20px);
}

@keyframes gridMove {
  from { background-position-y: 0; }
  to { background-position-y: 600px; }
}

/* porta il contenuto sopra */
body > * {
  position: relative;
  z-index: 1;
}

/* ================= TITOLI ARCADE PIXEL TRANSPARENT ================= */

.title-wrapper {
  display: inline-block;
  padding: 5px 30px;
  margin: 30px auto;
  position: relative;
  z-index: 1;
  background: transparent;
  border: 4px solid #fff;
  border-radius: 8px;
  box-shadow: 0 0 15px rgba(255,255,255,0.6);
  font-family: inherit;
  text-align: center;
  color: #fff;
  text-shadow:
     1px 1px 0 #000,
     2px 2px 0 #ff00ff,
     -1px -1px 0 #00ffff;
}

.title-wrapper h1 {
  margin: 0;
  font-size: 3rem;
  font-weight: inherit;
}

/* ==================== SFONDO UNICO GIF ==================== */
.background-gif {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  pointer-events: none;
  background-image: url("https://cdna.artstation.com/p/assets/images/images/058/100/038/original/yurii-ray-all-open.gif?1673381116");
  background-repeat: no-repeat;
  background-position: center center;
  background-size: cover;
  opacity: 1;
  filter: none;
  animation: driftBackground 15s ease-in-out infinite;
}

@keyframes driftBackground {
  0% { transform: translateX(0); }
  50% { transform: translateX(10px); }
  100% { transform: translateX(0); }
}
