body {
  position: relative;
  font-family: sans-serif;
  text-align: center;
  color: white;
  background-color: #111;
  background-image: url("img/fondo.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  animation: flicker 2s infinite;
  overflow-x: hidden;
}

@keyframes flicker {
  0%, 100% { opacity: 1; }
  48% { opacity: 0.97; }
  49% { opacity: 0.92; }
  50% { opacity: 0.98; }
  52% { opacity: 0.94; }
  55% { opacity: 1; }
}

.game-header {
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #222;
  padding: 10px 15px;
  margin: 10px auto;
  width: 90%;
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
}

.arrow {
  transition: transform 0.3s ease;
}

.collapsed + .grid {
  display: none;
}

.collapsed .arrow {
  transform: rotate(-90deg);
}




#logo-link {
  display: inline-block;
  margin: 0;
}

#logo-img {
  max-width: 320px;
  height: auto;
  display: block;
  margin: 0;
  cursor: pointer;
}

h1 {
  margin-top: 0;
}





input {
  padding: 10px;
  font-size: 16px;
  width: 300px;
  margin: 20px auto;
  display: block;
}

#results {
  font-size: 20px;
  margin: 10px;
}

#found {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
}

.found-name {
  padding: 10px 20px;
  background-color: #333;
  border-radius: 8px;
}

.grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
  margin: 20px;
}


.card {
  text-align: center;
  background-color: #222;
  padding: 6px;
  border-radius: 10px;
  width: 90px;
}



.card img {
  width: 60px;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
  image-rendering: auto;
}




.fake-button {
  background-color: #333;
  color: white;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: bold;
  min-width: 140px;
  text-align: center;
}

#timer {
  background-color: #333;
  color: white;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: bold;
  min-width: 120px;
  text-align: center;
}

.styled-btn {
  background-color: #333;
  color: white;
  border: none;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  transition: background-color 0.2s ease, transform 0.1s ease;
}

.styled-btn:hover {
  background-color: #444;
  transform: scale(1.03);
}



.name-hidden {
  visibility: hidden;
  margin-top: 8px;
  color: #ccc;
}

.name-visible {
  visibility: visible;
  color: white;
}

#ranking {
  margin-top: 10px;
  font-size: 16px;
  padding: 10px;
  background-color: #1c1c1c;
  border-radius: 8px;
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
}

#ranking h3 {
  margin-bottom: 8px;
  color: #ffd700;
}

#ranking div {
  padding: 4px 0;
  border-bottom: 1px solid #333;
}

.silhouette {
  filter: grayscale(100%) brightness(0.6) contrast(0);
}

#side-buttons {
  display: flex;
  flex-direction: row;
  justify-content: center;
  gap: 20px; /* <-- mueve esto aquí */
  margin-bottom: 10px;
}

@media (max-width: 600px) {
  #side-buttons {
    flex-direction: column;
    align-items: center;
    gap: 20px; /* menos espacio en vertical en móviles */
  }
}


#side-buttons button {
  background-color: #333;
  color: white;
  border: none;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  transition: background-color 0.2s ease, transform 0.1s ease;
}

#side-buttons button:hover {
  background-color: #444;
  transform: scale(1.03);
}


body::before {
  content: "";
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  background-image: url("img/fondo.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  z-index: -1;
  animation: flickerBG 3s infinite;
  opacity: 1;
  pointer-events: none;
}

@keyframes flickerBG {
  0%   { opacity: 1; }
  3%   { opacity: 0.85; }
  6%   { opacity: 1; }
  10%  { opacity: 0.9; }
  14%  { opacity: 0.95; }
  19%  { opacity: 0.87; }
  25%  { opacity: 1; }
  37%  { opacity: 0.93; }
  45%  { opacity: 1; }
  52%  { opacity: 0.85; }
  60%  { opacity: 0.99; }
  70%  { opacity: 1; }
  85%  { opacity: 0.94; }
  100% { opacity: 1; }
}



@media (max-width: 600px) {
  .card {
    width: 80px;
    padding: 6px;
  }

  .card img {
    width: 45px;
    height: 60px;
  }

  .grid {
    gap: 10px;
  }

  .name-visible,
  .name-hidden {
    font-size: 12px;
  }
}


#results {
  font-size: 18px;
  white-space: nowrap;
  color: #ccc;
}


.card div {
  display: block;
  max-width: 100%;
  text-align: center;
  word-break: break-word;
  line-height: 1.1;
  font-size: 14px;
  padding: 0 2px;
  white-space: normal;   
  word-break: keep-all;   
}


#sticky-header {
  position: sticky;
  top: 0;
  background-color: #111;
  padding: 10px 0;
  z-index: 100;
  border-bottom: 1px solid #333;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}

@supports (backdrop-filter: blur(5px)) {
  #sticky-header {
    backdrop-filter: blur(6px);
    background-color: rgba(17, 17, 17, 0.8);
  }
}

#input-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 auto;
  width: fit-content;
}

@media (max-width: 600px) {
  #input-wrapper {
    flex-direction: column;
    gap: 8px;
  }

  #input-wrapper input {
    width: 90vw;
  }
}


#footer {
  background-color: rgba(0, 0, 0, 0.7);
  padding: 20px 10px;
  color: #ccc;
  font-size: 14px;
  text-align: center;
  margin-top: 60px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

#footer a {
  color: #ffd700;
  text-decoration: none;
  font-weight: bold;
}

#footer a:hover {
  text-decoration: underline;
}

html, body {
  height: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1 0 auto;
}

footer {
  flex-shrink: 0;
}


.card img.revealed {
  animation: popin 0.4s ease-out;
}

.revealed {
  animation: popin 0.4s ease;
}

@keyframes popin {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
  }
}
