@font-face {
  font-family: "interregular";
  src: url("fonts/inter-variablefont_slntwght-webfont.woff2") format("woff2"), url("fonts/inter-variablefont_slntwght-webfont.woff") format("woff");
  font-weight: normal;
  font-style: normal;
}
@font-face {
  font-family: "Inter-Bold";
  src: url("fonts/Inter-Bold.eot");
  src: url("fonts/Inter-Bold.eot?#iefix") format("embedded-opentype"), url("fonts/Inter-Bold.woff2") format("woff2");
}
@font-face {
  font-family: "Inter-Medium";
  src: url("fonts/Inter-Medium.eot");
  src: url("fonts/Inter-Medium.eot?#iefix") format("embedded-opentype"), url("fonts/Inter-Medium.woff2") format("woff2");
}
:root {
  --primary-color: #6a11cb;
  --secondary-color: #2575fc;
  --accent-color: #ff9a76;
  --desert-orange: #ff8c42;
  --desert-yellow: #ffda3d;
  --desert-green: #17b890;
  --card-color: #ffeadb;
  --text-light: #ffffff;
  --text-dark: #333333;
}

body {
  background: url(../assets/images/fondo.png) no-repeat;
  background-size: cover;
  font-family: "interregular";
  position: relative;
  color: white;
  font-size: min(max(1.48vw, 16px), 20px);
  margin: 0;
  padding: 0;
  background-attachment: fixed;
}

.solapa {
  clip-path: polygon(100% 0, 100% 51%, 100% 100%, 100% 100%, 84% 47%, 53% 0);
  background-color: white;
  position: fixed;
  right: 0;
  top: 0;
  height: 90vh;
  width: 30vw;
}
@media (max-width: 575.98px) {
  .solapa {
    clip-path: polygon(100% 0, 100% 67%, 100% 100%, 101% 47%, 89% 21%, 6% 0);
  }
}

.pc {
  position: absolute;
  right: 1.5vw;
  top: 3vh;
  z-index: 1;
}
@media (max-width: 575.98px) {
  .pc {
    right: 2vw;
    top: 2vh;
  }
}
@media (max-width: 575.98px) {
  .pc img {
    max-width: 50px;
  }
}

.container {
  width: 90%;
  max-width: 1200px;
  height: calc(100vh - 40px);
  margin: auto;
  padding: 20px;
  position: relative;
}
.container .logo {
  position: absolute;
  left: 0;
}
@media (max-width: 1400px) {
  .container .logo {
    position: relative;
  }
}

h2 {
  font-size: min(max(3.33vw, 20px), 40px);
  text-align: left;
  font-weight: 800;
  font-family: "Inter-Bold";
}
h2 span {
  font-family: "interregular";
  font-weight: 300;
}

img.foto {
  width: 35%;
  max-width: 570px;
  right: 5%;
  bottom: 0;
  position: fixed;
}

#pantalla-inicial {
  width: 50%;
  max-width: 600px;
  text-align: center;
  position: absolute;
  top: 55%;
  left: 7%;
  -webkit-transform: translateY(-50%);
          transform: translateY(-50%);
}
@media (max-width: 767.98px) {
  #pantalla-inicial {
    width: 65%;
  }
}
#pantalla-inicial .titulo {
  padding: 0;
  -webkit-box-pack: justify;
      -ms-flex-pack: justify;
          justify-content: space-between;
}
#pantalla-inicial .titulo::before {
  content: "";
  width: 100vw;
  height: 100%;
  right: 0;
  top: 0;
  border: 1px solid white;
  position: absolute;
  z-index: 0;
}
#pantalla-inicial .titulo h1 {
  font-size: min(max(5.83vw, 40px), 70px);
  margin-right: 20px;
}
#pantalla-inicial .titulo h1 span {
  font-size: min(max(4.16vw, 30px), 50px);
}
#pantalla-inicial .titulo img {
  margin: 10px 0;
  margin-right: -15%;
  position: relative;
  z-index: 1;
}
@media (max-width: 767.98px) {
  #pantalla-inicial .titulo img {
    width: 35%;
  }
}
#pantalla-inicial h2 {
  max-width: 550px;
}
#pantalla-inicial .btn {
  width: 40%;
  max-width: 250px;
}

.titulo {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  width: 100%;
  position: relative;
  -webkit-box-pack: start;
      -ms-flex-pack: start;
          justify-content: flex-start;
  -webkit-box-align: center;
      -ms-flex-align: center;
          align-items: center;
  z-index: 1;
}
.titulo h1 {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
      -ms-flex-direction: column;
          flex-direction: column;
  text-align: left;
  white-space: nowrap;
  font-size: min(max(5vw, 40px), 60px);
  font-family: "Inter-Bold";
  margin: 0;
  padding: 0;
}
.titulo h1 span {
  font-size: min(max(3.33vw, 20px), 40px);
  font-family: "interregular";
}
.titulo img {
  width: 30%;
  max-width: 200px;
  position: relative;
  z-index: 1;
}

.btn {
  background-color: #EE2724;
  font-size: min(max(2.5vw, 20px), 30px);
  font-family: "Inter-Bold";
  padding: 4% 8%;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  max-width: 300px;
  -webkit-box-pack: justify;
      -ms-flex-pack: justify;
          justify-content: space-between;
  gap: 40px;
  border-radius: 0;
  border: 1px solid white;
  color: white;
  text-decoration: none;
  -webkit-transition: all 0.3s ease-in-out;
  transition: all 0.3s ease-in-out;
  -webkit-box-align: center;
      -ms-flex-align: center;
          align-items: center;
}
.btn:hover {
  background-color: #F78F1E;
}
.btn:hover img {
  width: 8%;
}
.btn img {
  width: 6%;
  -webkit-transition: all 0.3s ease-in-out;
  transition: all 0.3s ease-in-out;
}
@media (max-width: 767.98px) {
  .btn img {
    width: 10px;
  }
}

#overlay {
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  position: fixed;
  left: 0;
  top: 0;
  -webkit-transition: all 0.5s ease-in;
  transition: all 0.5s ease-in;
  z-index: 1;
}

.oculto {
  display: none;
}

#pantalla-final {
  position: fixed;
  top: 50%;
  left: 50%;
  -webkit-transform: translate(-50%, -50%);
          transform: translate(-50%, -50%);
  width: 90%;
  max-width: 480px;
  margin: auto;
  display: none;
  z-index: 2;
}
#pantalla-final > img {
  position: absolute;
  width: 50%;
}
#pantalla-final > img:nth-child(1) {
  top: -80px;
  left: 70%;
}
#pantalla-final > img:nth-child(2) {
  bottom: -80px;
  right: 70%;
}
#pantalla-final .bloque {
  background-color: white;
  padding: 20px;
  border-radius: 10px;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
      -ms-flex-direction: column;
          flex-direction: column;
  margin-top: 30px;
  color: #F78F1E;
  font-family: "Inter-Bold";
  text-align: center;
}
#pantalla-final .bloque .puntaje {
  background-color: rgba(217, 217, 217, 0.2);
  border-radius: 10px;
  padding: 10px;
  margin-top: 20px;
  color: #EE2724;
}
#pantalla-final .bloque .puntaje .completion-time {
  font-size: min(max(2.22vw, 20px), 30px);
}
#pantalla-final .bloque h2 {
  font-size: min(max(2.96vw, 30px), 40px);
  margin: 0 auto;
  text-align: center;
}
#pantalla-final .bloque #jugar-denuevo {
  background-color: #F78F1E;
  font-size: 1rem;
  font-family: "Inter-Bold";
  padding: 20px 40px;
  width: -webkit-fit-content;
  width: -moz-fit-content;
  width: fit-content;
  margin: 20px auto;
  border-radius: 16px;
  border: 1px solid transparent;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  color: white;
  text-decoration: none;
  -webkit-transition: all 0.3s ease-in-out;
  transition: all 0.3s ease-in-out;
}
#pantalla-final .bloque #jugar-denuevo:hover {
  background-color: #EE2724;
  border: 1px solid #EE2724;
}

@-webkit-keyframes float {
  0% {
    -webkit-transform: translateY(100vh) rotate(0deg) scale(0.5);
            transform: translateY(100vh) rotate(0deg) scale(0.5);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    -webkit-transform: translateY(-100px) rotate(360deg) scale(0.5);
            transform: translateY(-100px) rotate(360deg) scale(0.5);
    opacity: 0;
  }
}

@keyframes float {
  0% {
    -webkit-transform: translateY(100vh) rotate(0deg) scale(0.5);
            transform: translateY(100vh) rotate(0deg) scale(0.5);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    -webkit-transform: translateY(-100px) rotate(360deg) scale(0.5);
            transform: translateY(-100px) rotate(360deg) scale(0.5);
    opacity: 0;
  }
}
@-webkit-keyframes fadeIn {
  from {
    opacity: 0;
    -webkit-transform: translateY(20px);
            transform: translateY(20px);
  }
  to {
    opacity: 1;
    -webkit-transform: translateY(0);
            transform: translateY(0);
  }
}
@keyframes fadeIn {
  from {
    opacity: 0;
    -webkit-transform: translateY(20px);
            transform: translateY(20px);
  }
  to {
    opacity: 1;
    -webkit-transform: translateY(0);
            transform: translateY(0);
  }
}
/* Game screen styles continue below */
#game-screen {
  color: #EE2724;
  font-family: "Inter-Bold";
  font-size: min(max(1.18vw, 16px), 20px);
  margin: auto;
  padding: 20px 0;
}
#game-screen .titulo {
  position: absolute;
  left: -20px;
  top: 20%;
  color: white;
}
#game-screen .titulo h1 {
  font-size: min(max(4.16vw, 30px), 50px);
}
#game-screen .titulo h1 span {
  font-size: min(max(2.5vw, 20px), 30px);
}

.blTop {
  border-radius: 20px 20px 0 0;
  padding: 40px 20px 20px;
  background: rgb(255, 255, 255);
  margin: auto;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
      -ms-flex-direction: column;
          flex-direction: column;
  gap: 20px;
  max-width: min(85%, 500px);
}
@media (max-width: 1400px) {
  .blTop {
    max-width: min(85%, 400px);
  }
}

.difficulty-controls {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-pack: justify;
      -ms-flex-pack: justify;
          justify-content: space-between;
  -webkit-box-align: center;
      -ms-flex-align: center;
          align-items: center;
  display: none;
}

.difficulty-controls select {
  padding: 10px;
  font-size: min(max(1.18vw, 16px), 16px);
  border: 1px solid #d9d9d9;
  border-radius: 25px;
  width: 100%;
  max-width: 45%;
  color: #EE2724;
  -webkit-transition: all 0.3s ease;
  transition: all 0.3s ease;
  font-family: "Inter-Bold";
  -webkit-appearance: none;
     -moz-appearance: none;
          appearance: none;
  background: url(../assets/iconos/fl.svg) 96% center no-repeat;
}

.difficulty-controls select:focus {
  border-color: var(--desert-yellow);
  -webkit-box-shadow: 0 0 0 3px rgba(106, 17, 203, 0.2);
          box-shadow: 0 0 0 3px rgba(106, 17, 203, 0.2);
  outline: none;
}

.blInfo {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
      -ms-flex-direction: column;
          flex-direction: column;
  gap: 15px;
  color: white;
}

.blInfo .timer-display, .game-stats div {
  padding: 10px 20px;
  background-color: #F78F1E;
  border-radius: 20px;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-pack: justify;
      -ms-flex-pack: justify;
          justify-content: space-between;
  font-size: min(max(1.18vw, 12px), 16px);
}

.blInfo .timer-display {
  width: 42%;
}

.blInfo .game-stats {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  gap: 10px;
}

.blInfo .game-stats div {
  width: 100%;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
}

.game-container {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  margin-top: 8%;
  margin: auto;
  background: rgb(255, 255, 255);
  padding: 20px;
  border-radius: 20px;
}

/* Easy difficulty (4x4) */
.game-container.easy {
  border-radius: 0 0 20px 20px;
  max-width: min(85%, 500px);
  gap: 10px;
}

.game-container.easy .card {
  width: 100%;
  padding-top: 100%;
}

/* Medium difficulty (6x6) */
.game-container.medium {
  max-width: min(95%, 600px);
  gap: 8px;
}

.game-container.medium .card {
  width: 100%;
  padding-top: 100%;
}

/* Hard difficulty (10x10) */
.game-container.hard {
  max-width: min(95%, 900px);
  gap: 6px;
}

.game-container.hard .card {
  width: 100%;
  padding-top: 100%;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
  .game-container.easy {
    gap: 8px;
  }
  .game-container.medium {
    gap: 6px;
  }
  .game-container.hard {
    gap: 4px;
  }
  .card-back img {
    width: 90%;
    height: 90%;
  }
}
.card {
  position: relative;
  -webkit-perspective: 1000px;
          perspective: 1000px;
  cursor: pointer;
  -ms-touch-action: manipulation;
      touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.card-inner {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  -webkit-transform-style: preserve-3d;
          transform-style: preserve-3d;
  -webkit-transition: -webkit-transform 0.6s;
  transition: -webkit-transform 0.6s;
  transition: transform 0.6s;
  transition: transform 0.6s, -webkit-transform 0.6s;
}

.card.flipped .card-inner {
  -webkit-transform: rotateY(180deg);
          transform: rotateY(180deg);
}

.card-front,
.card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden;
          backface-visibility: hidden;
  border-radius: 10px;
}

.card-front {
  background: #EE2724;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-pack: center;
      -ms-flex-pack: center;
          justify-content: center;
  -webkit-box-align: center;
      -ms-flex-align: center;
          align-items: center;
}

.card-front::after {
  content: "?";
  font-size: 2.5rem;
  font-weight: bold;
  color: rgba(255, 255, 255, 0.9);
}

.card-back {
  background-color: #ffffff;
  -webkit-transform: rotateY(180deg);
          transform: rotateY(180deg);
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-pack: center;
      -ms-flex-pack: center;
          justify-content: center;
  -webkit-box-align: center;
      -ms-flex-align: center;
          align-items: center;
}

.card-back img {
  width: 100%;
  height: 100%;
  border-radius: 10px;
}

.card.matched .card-inner {
  -webkit-transform: rotateY(180deg);
          transform: rotateY(180deg);
}

.card.matched .card-back {
  -webkit-animation: happyBounce 0.6s ease-in-out;
          animation: happyBounce 0.6s ease-in-out;
}

@-webkit-keyframes happyBounce {
  0%, 100% {
    -webkit-transform: rotateY(180deg) scale(1);
            transform: rotateY(180deg) scale(1);
  }
  50% {
    -webkit-transform: rotateY(180deg) scale(1.1);
            transform: rotateY(180deg) scale(1.1);
  }
}

@keyframes happyBounce {
  0%, 100% {
    -webkit-transform: rotateY(180deg) scale(1);
            transform: rotateY(180deg) scale(1);
  }
  50% {
    -webkit-transform: rotateY(180deg) scale(1.1);
            transform: rotateY(180deg) scale(1.1);
  }
}
canvas.confetti {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 9999;
}

/* Add these new animations */
@-webkit-keyframes shake {
  0%, 100% {
    -webkit-transform: rotateY(180deg) translateX(0);
            transform: rotateY(180deg) translateX(0);
  }
  20%, 60% {
    -webkit-transform: rotateY(180deg) translateX(-5px);
            transform: rotateY(180deg) translateX(-5px);
  }
  40%, 80% {
    -webkit-transform: rotateY(180deg) translateX(5px);
            transform: rotateY(180deg) translateX(5px);
  }
}
@keyframes shake {
  0%, 100% {
    -webkit-transform: rotateY(180deg) translateX(0);
            transform: rotateY(180deg) translateX(0);
  }
  20%, 60% {
    -webkit-transform: rotateY(180deg) translateX(-5px);
            transform: rotateY(180deg) translateX(-5px);
  }
  40%, 80% {
    -webkit-transform: rotateY(180deg) translateX(5px);
            transform: rotateY(180deg) translateX(5px);
  }
}
@-webkit-keyframes flipIn {
  from {
    -webkit-transform: rotateY(0);
            transform: rotateY(0);
  }
  to {
    -webkit-transform: rotateY(180deg);
            transform: rotateY(180deg);
  }
}
@keyframes flipIn {
  from {
    -webkit-transform: rotateY(0);
            transform: rotateY(0);
  }
  to {
    -webkit-transform: rotateY(180deg);
            transform: rotateY(180deg);
  }
}
.card.flipped .card-inner {
  -webkit-animation: flipIn 0.6s ease-out forwards;
          animation: flipIn 0.6s ease-out forwards;
}

.card.no-match .card-inner {
  -webkit-animation: shake 0.5s ease-in-out;
          animation: shake 0.5s ease-in-out;
}

/* Update the existing matched animation */
.card.matched .card-back {
  -webkit-animation: happyBounce 0.6s ease-in-out;
          animation: happyBounce 0.6s ease-in-out;
}

@keyframes happyBounce {
  0%, 100% {
    -webkit-transform: rotateY(180deg) scale(1);
            transform: rotateY(180deg) scale(1);
  }
  50% {
    -webkit-transform: rotateY(180deg) scale(1.1);
            transform: rotateY(180deg) scale(1.1);
  }
}
/* Music Control Button Styles */
.music-control {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 100;
}

#music-toggle {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(45deg, var(--desert-orange), var(--desert-yellow));
  -webkit-box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
          box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-pack: center;
      -ms-flex-pack: center;
          justify-content: center;
  -webkit-box-align: center;
      -ms-flex-align: center;
          align-items: center;
  -webkit-transition: all 0.3s ease;
  transition: all 0.3s ease;
  overflow: hidden;
}

#music-toggle:hover {
  -webkit-transform: translateY(-3px);
          transform: translateY(-3px);
  -webkit-box-shadow: 0 8px 15px rgba(0, 0, 0, 0.3);
          box-shadow: 0 8px 15px rgba(0, 0, 0, 0.3);
}

#music-toggle:active {
  -webkit-transform: translateY(0);
          transform: translateY(0);
  -webkit-box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
          box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

#music-toggle svg {
  fill: var(--text-dark);
  width: 24px;
  height: 24px;
  -webkit-transition: all 0.3s ease;
  transition: all 0.3s ease;
}

#music-toggle:hover svg {
  -webkit-transform: scale(1.1);
          transform: scale(1.1);
}

/* Enhanced mobile responsiveness */
@media (max-width: 768px) {
  .difficulty-controls {
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
        -ms-flex-direction: column;
            flex-direction: column;
    gap: 10px;
  }
}
@media (max-width: 480px) {
  .logo img {
    max-width: 150px;
  }
  .blTop {
    padding: 30px 10px 0;
    gap: 15px;
  }
  .difficulty-controls select {
    padding: 5px 10px;
    max-width: 65%;
  }
  .blInfo {
    gap: 10px;
  }
  .blInfo .timer-display {
    margin: auto;
    width: 45%;
  }
  #game-screen .titulo {
    position: relative;
    left: auto;
    top: auto;
    text-align: center;
    margin: 10px;
  }
  #game-screen .titulo h1 {
    -webkit-box-orient: horizontal;
    -webkit-box-direction: normal;
        -ms-flex-direction: row;
            flex-direction: row;
  }
  #game-screen .titulo h1 span {
    display: none;
  }
  .game-container.easy,
  .game-container.medium,
  .game-container.hard {
    gap: 4px;
    padding: 20px 10px;
    border-radius: 0 0 20px 20px;
    max-width: min(90%, 500px);
  }
  .music-control {
    bottom: 15px;
    right: 15px;
  }
  .game-container.easy {
    gap: 6px;
  }
  .game-container.medium {
    gap: 4px;
  }
  .game-container.hard {
    gap: 3px;
  }
  #music-toggle {
    width: 45px;
    height: 45px;
  }
  #music-toggle svg {
    width: 20px;
    height: 20px;
  }
  .card-front::after {
    font-size: 1.8rem;
  }
}
/* Extra small screens */
@media (max-width: 380px) {
  .blInfo .timer-display, .game-stats div {
    font-size: min(max(1.18vw, 10px), 16px);
  }
  .music-control {
    bottom: 10px;
    right: 10px;
  }
  #music-toggle {
    width: 40px;
    height: 40px;
  }
  #music-toggle svg {
    width: 18px;
    height: 18px;
  }
}
/* Fix touch actions for mobile */
.card {
  -ms-touch-action: manipulation;
      touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* Fix for iOS devices */
* {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -moz-user-select: none;
   -ms-user-select: none;
       user-select: none;
}

@media (max-height: 780px) {
  #game-screen {
    padding: 10px 0;
  }
  .blTop, .game-container.easy {
    max-width: min(90%, 450px);
  }
}
/* Support for landscape mode */
@media (max-height: 500px) and (orientation: landscape) {
  #game-screen {
    padding: 0;
  }
  .game-container {
    margin: 10px auto;
    padding: 10px;
  }
  .music-control {
    bottom: 10px;
    right: 10px;
  }
  #music-toggle {
    width: 40px;
    height: 40px;
  }
}