@font-face {
  font-family: 'Amsterdam';
  src: url('../fonts/Amsterdam.otf') format('truetype');
}
* {
  margin: 0;
  padding: 0;
  box-sizing: content-box;
}
body {
  background-image: url('../images/fondo-cartoon.jpg');
  background-size: cover;
  font-family: 'Amsterdam';
  min-height: 100vh;
  position: relative;
  margin: 0;
  padding: 0;
  overflow-y: auto;
}
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(8px);
  z-index: -1;
}
header {
  display: flex;
  flex-direction: column;
}
header h1 {
  font-family: 'Amsterdam';
  text-shadow: 5px 5px 5px #fff;
  padding: 1vh;
  font-size: 5rem;
  text-align: center;
  margin: 1rem;
}
header div {
  display: flex;
  flex-direction: row; /* Keep this for now, will adjust below */
  justify-content: space-between; /* Keep this for now, will adjust below */
  align-items: center;
  flex-wrap: wrap; /* Added */
  justify-content: space-around; /* Added */
  gap: 1rem; /* Added */
}
header div button {
  cursor: pointer;
  margin-left: 2rem;
  border: none;
  border-radius: 1rem;
  font-family: 'Amsterdam';
  font-size: 2rem;
  text-shadow: 2px 2px 5px #fff;
  background-color: #39a9d2;
  padding: 0.5rem;
  box-shadow: 10px 5px 10px black;
}
header div button:active {
  transform: scale(0.95);
  box-shadow: 5px 2.5px 5px black;
}

header p {
  display: flex;
  align-items: flex-end;
  font-weight: bold;
  font-size: xx-large;
  text-shadow: 2px 2px 5px #d4d4d4;
  align-self: flex-end;
  margin-right: 0; /* Changed from 12rem to 0 */
  padding: 0.8rem;
}
header p span {
  text-shadow: 2px 2px 3px black;
  margin-left: 0.5rem;
}

.intentos-base {
  color: rgb(0, 164, 57);
}

.intentos-warning {
  color: orange;
}

.intentos-danger {
  color: red;
}

/* New difficulty selection styles */
.difficulty-selection {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: 2rem;
}

.difficulty-selection span {
  font-weight: bold;
  font-size: 1.5rem;
  text-shadow: 2px 2px 5px #d4d4d4;
}

.difficulty-button {
  cursor: pointer;
  border: 2px solid #39a9d2;
  border-radius: 0.5rem;
  font-family: 'Amsterdam';
  font-size: 1.2rem;
  text-shadow: 1px 1px 3px #fff;
  background-color: #e0f2f7; /* Light blue */
  padding: 0.3rem 0.8rem;
  box-shadow: 5px 2px 5px black;
  transition: all 0.2s ease;
}

.difficulty-button:hover {
  background-color: #c0e0eb; /* Slightly darker blue on hover */
  transform: translateY(-1px);
  box-shadow: 6px 3px 6px black;
}

.difficulty-button.active {
  background-color: #39a9d2; /* Active color */
  color: white;
  text-shadow: 1px 1px 3px black;
  box-shadow: 3px 1px 3px black;
  transform: translateY(0);
}

.difficulty-button:active {
  transform: scale(0.98);
  box-shadow: 2px 1px 2px black;
}


main {
  min-height: calc(100vh - 220px);
  height: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 2vh;
  justify-content: center;
  align-items: center;
  overflow: visible;
  padding: 2vh;
}

.card { /* Changed from section to .card */
  border-radius: 10px;
  height: calc((100vh - 320px) / 2);
  width: calc((100vw - 18vw) / 8);
  font-size: calc((100vh - 320px) / 4);
  align-items: center;
  justify-content: center;
  position: relative;
  /* Button resets */
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  /* Heredamos familia y peso, sin tocar el font-size anterior */
  font-family: inherit;
  font-weight: inherit;
  color: inherit; /* Inherit color from body */
  cursor: pointer; /* Ensure cursor is pointer */
  -webkit-appearance: none; /* Remove default button styles for Webkit browsers */
  -moz-appearance: none; /* Remove default button styles for Mozilla browsers */
  appearance: none; /* Remove default button styles */
}
.content {
  display: flex;
  border: 4px solid black;
  box-shadow: 10px 5px 10px black;
  background: rgb(102, 102, 102);
  background: rgb(203, 129, 1);
  background: linear-gradient(
    0deg,
    rgba(203, 129, 1, 1) 0%,
    rgba(250, 238, 55, 1) 96%
  );
  text-shadow: 1px 1px 3px white;
  border-radius: 10px;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  transition: transform 0.4s;
  transform-style: preserve-3d;
  font-size: inherit; /* Hereda el tamaño de .card para escalar con tus media queries */
  line-height: 1;
}
.front,
.back {
  backface-visibility: hidden;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.back {
  border-radius: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  width: 100%;
  transform: rotateY(180deg);
  background: radial-gradient(#db88db, rgb(245 46 110 / 100%));
  text-shadow: 5px 5px 10px black;
  font-family: 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', sans-serif;
}
.card.par .content {
  transform: rotateY(180deg);
  transition: transform 0.3s;
}

.card.flipped .content {
  transform: rotateY(180deg);
  transition: transform 0.3s;
}

.card:hover {
  cursor: pointer;
}

.cardsOk {
  border: 2px solid green;
  box-shadow: 0px 0px 30px 0px rgba(5, 150, 60, 1);
}

.cardsOk:hover {
  cursor: no-drop;
}
.victory-modal {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(135deg, #6e8efb, #ff6b95);
  padding: 2rem;
  border-radius: 20px;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
  text-align: center;
  z-index: 1000;
  animation: modalAppear 0.5s ease-out;
}

.victory-modal.show {
  display: block;
}

.victory-modal h2 {
  color: white;
  font-size: 3rem;
  margin-bottom: 1rem;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.victory-modal p {
  color: white;
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
}

.victory-modal button {
  background: white;
  border: none;
  padding: 0.8rem 2rem;
  border-radius: 50px;
  font-size: 1.2rem;
  color: #6e8efb;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  font-family: 'Amsterdam';
}

.victory-modal button:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(3px);
  z-index: 999;
}

.modal-overlay.show {
  display: block;
}

@keyframes modalAppear {
  from {
    opacity: 0;
    transform: translate(-50%, -60%);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

@keyframes escalar {
  50% {
    transform: scale(1.15);
  }
  100% {
    transform: scale(1);
  }
}

.card.par {
  animation: escalar 0.5s ease-in-out;
  transform-origin: center center;
}

@media screen and (max-width: 1200px) {
  header h1 {
    font-size: 4rem;
    margin: 0.5rem;
  }

  .card { /* Changed from section to .card */
    height: calc((100vh - 280px) / 2);
    width: calc((100vw - 12vw) / 6);
    font-size: calc((100vh - 280px) / 5);
  }
}

@media screen and (max-width: 800px) {
  header {
    flex-direction: column;
  }

  header h1 {
    font-size: 3rem;
    margin: 0.5rem;
  }

  header div button {
    margin-left: 1rem;
    font-size: 1.5rem;
    padding: 0.3rem;
  }

  header p {
    margin: 0;
    font-size: 1.5rem;
    margin-right: 1rem;
  }

  .card { /* Changed from section to .card */
    height: calc((100vh - 250px) / 3);
    width: calc((100vw - 8vw) / 4);
    font-size: calc((100vh - 250px) / 6);
  }
}

@media screen and (max-width: 500px) {
  header h1 {
    font-size: 2rem;
    margin: 0.3rem;
  }

  header div button {
    margin-left: 0.5rem;
    font-size: 1.2rem;
    padding: 0.2rem;
  }

  header p {
    font-size: 1.2rem;
    margin-right: 0.5rem;
  }

  main {
    padding: 1vh;
    gap: 1.5vh;
    margin-bottom: 2vh;
  }

  .card { /* Changed from section to .card */
    height: 140px;
    width: calc((100vw - 6vw) / 3);
    font-size: 70px;
  }

  .content {
    font-size: 0.8em;
  }
}

@media screen and (min-width: 801px) {
  body {
    overflow: hidden;
  }

  main {
    height: calc(100vh - 220px);
    overflow: hidden;
    padding: 0 2vw;
  }
}

@media screen and (max-height: 600px) {
  header h1 {
    font-size: 2rem;
    margin: 0.3rem;
  }

  .card { /* Changed from section to .card */
    height: calc((100vh - 150px) / 2);
    width: calc(((100vw - 150px) / 2) * 0.7);
    font-size: calc((100vh - 150px) / 5);
  }
}