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

/* === BASE === */

body {
  font-family: 'Fredoka', sans-serif;
  background: #fce8c9 url("https://cdn.shopify.com/s/files/1/0615/8522/7975/files/Pet_Pwr_Petsecor.png?v=1752680902") no-repeat center 75% fixed;
  background-size: cover;
  color: #8a4d96;
  margin: 0;
  padding: 0;
  text-align: center;
  position: relative;
  z-index: 0;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}


body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-color: rgba(255, 255, 255, 0.8);
  z-index: -1;
}


/* === LOGO === */
#logo {
  margin: 20px 0 -38px;
}
#logo img {
  width: 90px;
  height: auto;
}

/* === HEADER === */
h1 {
  font-size: 2.2em;
  font-weight: bold;
  color: #6d3685;
  margin-top: 40px;
}
h2 {
  font-size: 1.2em;
  color: #8a4d96;
}
.controls {
  margin: 2rem auto;
  display: flex;
  justify-content: center;
  gap: 2rem;
  font-size: 1rem;
  color: #6d3685;
  margin-top: 20px;
  font-weight: bold;
}

.refresh {
  cursor: pointer;
  font-size: 1.2rem;
  color: #6d3685;
  transition: color 0.3s;
}
.refresh:hover {
  color: #a45ac5;
}

/* === GRIGLIA === */
#main, #gridWrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}
#main {
  margin: 20px auto;
  padding: 0 10px;
  max-width: 100vw;
}
#gridScaler {
  transform: scale(1);
  transform-origin: top center;
}
#grid {
  display: grid;
  grid-template-columns: repeat(15, minmax(clamp(20px, 6vw, 32px), 1fr));
  gap: clamp(2px, 0.8vw, 5px);
  padding: 20px 0;
  border-radius: 12px;
  box-sizing: border-box;
  width: 100%;
  background: transparent;
}
.box {
  aspect-ratio: 1/1;
  width: 100%;
  font-size: clamp(12px, 3.5vw, 18px);
  background-color: transparent;
  border: none;
  color: #8a4d96;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  cursor: pointer;
}
.box.highlight {
  background-color: rgba(92, 58, 79, 0.4);
}
.box.found {
  background-color: #d1a7f3 !important;
  color: white !important;
}

/* === LISTA PAROLE === */
#listContainer {
  margin: 20px 0;
}
#list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  max-width: 800px;
  margin: 0 auto;
}
#list li {
  font-size: 16px;
  color: #8a4d96;
}
#list li.found {
  text-decoration: line-through;
  color: #d1a7f3;
}

/* === PULSANTI === */
#restart, #shopBtn {
  margin-top: 20px;
  background-color: #d1a7f3;
  color: white;
  font-weight: bold;
  font-size: 16px;
  padding: 10px 20px;
  border-radius: 8px;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
}

/* === POPUP === */
.popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(5px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}
.popup {
  position: relative;
  background: white;
  border-radius: 16px;
  padding: 30px 20px;
  max-width: 90%;
  width: 340px;
  text-align: center;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}
.popup-text {
  color: #8a4d96;
  font-size: 16px;
  line-height: 1.5;
  margin-bottom: 20px;
}
.popup-text .code {
  font-size: 18px;
  font-weight: bold;
  color: #8a4d96;
}
.close-btn {
  position: absolute;
  top: 10px;
  right: 14px;
  font-size: 20px;
  color: #8a4d96;
  cursor: pointer;
  font-weight: bold;
}

/* === MAZE CANVAS === */
#mazeContainer {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  position: relative;
  z-index: 1; /* sopra lo sfondo */
}
#mazeCanvas {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  background-color: transparent; /* assicurati sia trasparente */
}

/* === MENU DI GIOCO === */
#menu {
  margin: 20px 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.custom-select select,
#diffSelect {
  font-family: 'Fredoka', sans-serif;
  font-size: 16px;
  padding: 10px;
  border-radius: 8px;
  border: 2px solid #d1a7f3;
  background-color: white;
  color: #8a4d96;
  font-weight: bold;
  cursor: pointer;
}

/* === NASCONDI VECCHI ELEMENTI NON USATI === */
#Message-Container,
#startMazeBtn,
#okBtn {
  display: none !important;
}

/* === MEDIA QUERY === */
@media (max-width: 1024px) {
  #gridScaler { transform: scale(0.95); }
}
@media (max-width: 768px) {
  #gridScaler { transform: scale(0.9); }
}
@media (max-width: 600px) {
  #gridScaler { transform: scale(0.85); }
}
@media (max-width: 400px) {
  #gridScaler { transform: scale(0.8); }
}
