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

html, body, #game-container {
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
  font-family: 'Cinzel', serif;
  color: #f5f5f5;
  overflow: auto; /* scroll in fullscreen */
}

body.home {
  background: url("img/Home.webp") center center / cover no-repeat;
}

body.fight {
  background: url("img/Arena.webp") center center / cover no-repeat;
}

body.home #game-container {
  background: url("img/Home.webp") center center / cover no-repeat;
}

body.fight #game-container {
  background: url("img/Arena.webp") center center / cover no-repeat;
}

/* -------- CONTAINER -------- */
#game-container {
  height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column; /* verticale */
  align-items: center;    /* orizzontale */
  justify-content: center; /* verticale */
  text-align: center;
  position: relative; /* per posizionare Rules e Online */
  padding: 20px;
}

/* -------- HEADER FISSO -------- */
#rules-btn {
  position: absolute;
  top: 16px;
  left: 20px;
  cursor: pointer;
  font-size: 2.2rem;
  transition: transform 0.2s, color 0.2s;
}
#rules-btn:hover { transform: scale(1.2); color: gold; }

#GitHub-btn {
  position: absolute;
  top: 20px;
  left: 70px; /* accanto a Rules */
  padding: 5px 10px;
  background: crimson;
  color: white;
  border-radius: 5px;
  font-size: 1.2rem;
  text-decoration: none;
  transition: background 0.2s, transform 0.2s;
}
#GitHub-btn:hover {
  background: darkred;
  transform: scale(1.1);
}

#Reddit-btn {
  position: absolute;
  top: 20px;
  left: 150px; /* accanto a GitHub */
  padding: 5px 10px;
  background: crimson;
  color: white;
  border-radius: 5px;
  font-size: 1.2rem;
  text-decoration: none;
  transition: background 0.2s, transform 0.2s;
}
#Reddit-btn:hover {
  background: darkred;
  transform: scale(1.1);
}

#online-box, #fullscreen-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

#fullscreen-btn {
  cursor: pointer;
  font-size: 2rem;
  transition: transform 0.2s, color 0.2s;
}
#fullscreen-btn:hover { transform: scale(1.2); color: gold; }

/* -------- CONTENUTO CENTRALE -------- */
.arena-title, .favicon, .subtitle, .nick-box, #mode-box {
  z-index: 1; /* sopra il background */
}

/* -------- TITOLI -------- */
.arena-title {
  font-size: 4rem;
  margin: 10px 0;
  background: linear-gradient(45deg, #ff0000, #ff6600, #ffff00);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 2px 2px 8px black;
  animation: flame 2s infinite alternate;
}

@keyframes flame {
  from { text-shadow: 0 0 10px #ff3300, 0 0 20px #ff6600; }
  to   { text-shadow: 0 0 15px #ff6600, 0 0 25px #ffff00; }
}

.favicon {
  width: 64px;
  margin: 10px auto;
}

.subtitle {
  font-size: 1.2rem;
  margin-bottom: 20px;
  font-style: italic;
  color: black;
}

/* -------- NICKNAME -------- */
.nick-box { margin: 20px 0; }
#nickname {
  padding: 8px; border-radius: 5px; border: none; font-size: 1rem;
}
#confirm-nick {
  margin-left: 10px; padding: 8px 15px; background: crimson;
  color: white; border: none; border-radius: 5px;
  font-size: 1rem; cursor: pointer; transition: background 0.2s;
}
#confirm-nick:hover { background: darkred; }

/* -------- PERSONAGGI -------- */
.char-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin: 20px auto;
  max-width: 900px;
}

.char img {
  width: 90%;
  aspect-ratio: 1/1;
  object-fit: contain;
  border-radius: 5px;
}

@media (min-width: 1200px) and (min-height: 800px) {
  .char img { width: 75%; }
}

.char:hover { transform: scale(1.05); }

.char.selected {
  border: 3px solid gold;
  box-shadow: 0 0 15px gold;
}

/* -------- MODE -------- */
#mode-box { margin: 20px 0; }
#mode-box button {
  margin: 5px; padding: 10px 20px; font-size: 2rem;
  border-radius: 5px; border: none; background: #444;
  color: rgb(235, 11, 11); cursor: pointer; transition: background 0.2s;
}
#mode-box button:hover:enabled { background: #666; }
#mode-box button:disabled { opacity: 0.5; cursor: not-allowed; }

/* -------- RULES POPUP -------- */
#rules-popup {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
}
#rules-popup.hidden { display: none; }
.rules-content {
  background: #222; padding: 20px; border-radius: 10px;
  border: 2px solid crimson; max-width: 500px; color: #eee;
}
.rules-content h2 { margin-bottom: 10px; color: gold; }
.rules-content button {
  margin-top: 15px; padding: 8px 15px; border: none; background: crimson;
  color: white; border-radius: 12px; cursor: pointer;
}
.rules-content button:hover { background: darkred; }
#collection-banner {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.85);
  color: #fff;
  padding: 10px 20px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 20px;
  box-shadow: 0 0 15px rgba(0,0,0,0.5);
  font-family: sans-serif;
  z-index: 9999;
}

.banner-text {
  font-size: 16px;
  font-weight: bold;
}

.collection-btn {
  background: #FFD700;
  border: none;
  border-radius: 8px;
  padding: 5px 12px;
  cursor: pointer;
  font-weight: bold;
  transition: transform 0.2s, background 0.2s;
}

.collection-btn:hover {
  background: #ffc107;
  transform: scale(1.05);
}

/* -------- RESPONSIVE -------- */
@media (max-width: 768px) {
  .arena-title { font-size: 2.5rem; }
  .char-grid { grid-template-columns: repeat(2, 1fr); }
}