@import url('https://fonts.googleapis.com/css2?family=Mochiy+Pop+One&family=Poppins:wght@400;700&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
/* Responsive sizing variables */
:root {
  /* Card width will scale between a small and large value based on viewport */
  --card-min-width: clamp(45px, 12vw, 110px);
  /* Aspect ratio width / height (matches original 80x110 -> 8 / 11) */
  --card-aspect-ratio: 8 / 11;
  --card-gap: 8px;

  /* Derived, proportional values (based on --card-min-width) */
  --card-font-size: calc(var(--card-min-width) * 0.175); /* ~14px at 80px */
  --card-label-font-size: calc(var(--card-min-width) * 0.17);
  --card-hover-translate: calc(var(--card-min-width) * 0.06);
  --empty-foundation-fs: calc(var(--card-min-width) * 0.36);
}
body {
  font-family: 'Poppins', Arial, sans-serif;
  
  min-height: 100vh;
  padding: 10px;
  user-select: none;
}
body.background00{
  background: linear-gradient(to right, #FFC0CB, #ADD8E6, #FFE4E1);
}
body.background01{
  background: url('img/backgrounds/background01.jpg') no-repeat center center fixed;
}
body.background02{
  background: url('img/backgrounds/background02.jpg') no-repeat center center fixed;
}
body.background03{
  background: url('img/backgrounds/background03.jpg') no-repeat center center fixed;
}
h1, h2, h3, h4, h5, h6 {
  font-family: "Mochiy Pop One", sans-serif;
}
h1 img{max-height: 100px; vertical-align: middle;}
.game_cover{
  background: #fff;
  position:absolute;
  top:0; left:0; right:0; bottom:0;
  z-index:1000;
}
.game-container {
  max-width: 1400px;
  min-height: 80vh;

  margin: 0 auto;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 30px;
  padding: 20px;
  backdrop-filter: blur(5px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}
.header {
  text-align: center;
  color: white;
  margin-bottom: 20px;
  background: linear-gradient(to right, rgba(105, 90, 205, 0.4), rgba(105, 90, 205, 0.8));
  border-radius: 20px;
  width: 100%;
  padding: 20px;
  border:#fff 5px dashed;
  position:relative
}
.header h1 {
  color: rgb(255, 255, 255);
}
.controls {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 20px;
  position:relative;
}

button, .button {
  font-family: 'Poppins', Arial, sans-serif;
    background: #fffbb9;
    color: #4B0082;
    border: 2px solid #FFC0CB;
    padding: 12px 24px;
    border-radius: 25px; 
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 
        inset 0 2px 4px rgba(255, 255, 255, 0.6), 
        0 4px 6px rgba(0, 0, 0, 0.1); 
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    text-decoration: none;
}
.button-icon {
    font-size: 18px;
    line-height: 1;
}

.button-text {
    white-space: nowrap;
}

.button:hover, button:hover {
    background: #FFC0CB; 
    transform: translateY(-3px); 
    box-shadow: 
        inset 0 2px 4px rgba(255, 255, 255, 0.8),
        0 6px 8px rgba(0, 0, 0, 0.15);
}

.button:active, button:active {
    transform: translateY(0); /* Vuelve a su posición original al hacer clic */
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}
button.secondary {
background: #D8BFD8; /* Lila pastel al pasar el cursor */

}

button.secondary:hover {
    background: #f5b3eb; /* Trigo (un amarillo pálido) */
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
}

button.secondary:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
button.debug {
  background: #17a2b8;
}
button.debug:hover {
  background: #138496;
}
button:disabled {
  background: #ccc; /* A light gray background */
  color: #666; /* A darker gray text color */
  cursor: not-allowed; /* Change the cursor */
  opacity: 0.7; /* Make it slightly transparent */
  transform: none; /* Prevent the hover effect */
  box-shadow: none; /* Remove any shadows */
}



/* Dropdown contenedor */
.dropdown {
  position: relative;
  display: inline-block;
}

/* Botón de menú (usa tu mismo estilo base de button) */
.dropdown-toggle {
  background: #fffbb9;
  border: 2px solid #FFC0CB;
  border-radius: 25px;
}

/* Contenedor del menú */
.dropdown-menu {
  display: none;
  position: absolute;
  top: 110%; /* bajo el botón */
  left: 0;
  background: #ffffffc4;
  border: 2px solid #FFf;
  border-radius: 15px;
  box-shadow: 0 6px 12px rgba(0,0,0,0.15);
  min-width: 180px;
  z-index: 1000;
  flex-direction: column;
  gap: 10px;
  padding: 10px;
}

/* Cada opción hereda tus estilos de botón */
.dropdown-menu button {
  width: 100%;
  justify-content: flex-start;
  font-size: 13px;
}

/* Mostrar menú al activar */
.dropdown-menu.show {
  display: flex;
}

/* Responsivo */
@media (max-width: 600px) {
  .controls {
    align-items: center;
  }
  .dropdown-menu {
    left: 50%;
    transform: translateX(-50%);
    min-width: 200px;
  }
}


.game-board {
  display: grid;
  grid-template-columns: repeat(7, minmax(var(--card-min-width), 1fr));
  gap: var(--card-gap);
  margin-bottom: calc(var(--card-gap) + 5px);

  transform-origin: top center;
  transition: transform 0.3s ease;

  position:relative;
  z-index: 99;
}
.top-row {
  display: grid;
  grid-template-columns: minmax(var(--card-min-width), 1fr) minmax(var(--card-min-width), 1fr) 1fr repeat(4, minmax(var(--card-min-width), 1fr));
  gap: var(--card-gap);
  margin-bottom: 20px;

  transform-origin: top center;
  transition: transform 0.3s ease;
}
.spacer {
  height: 30px; /* base */
}
.card-pile {
  min-height: calc(var(--card-min-width) * 1.5); /* proportional to card size */
  border: 2px dashed rgba(255, 255, 255, 0.3);
  border-radius: 10px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 5px;
  cursor: pointer;
}
.foundation {
  background: rgba(255, 255, 255, 0.3);
}
.tableau {
  min-height: calc(var(--card-min-width) * 2.8);
}
.card {
  width: var(--card-min-width);
  aspect-ratio: var(--card-aspect-ratio);
  border-radius: calc(var(--card-min-width) * 0.1);
  border: 2px solid #333;
  background: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: absolute;
  font-size: var(--card-font-size);
  font-weight: bold;
  transition: all 0.5s ease;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);

  overflow: hidden;

  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  color: transparent; /* Makes the text (value/suit) invisible */

  transition: all .2s;
  transition: opacity .5s;
}

/* Flip animation: use 3D transform to rotate card on Y axis */
.card-flip-container {
  perspective: 1000px;
}
.card.flip-anim {
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(.4, .0, .2, 1), opacity 0.2s;
}
.card.flip-anim .card-face {
  backface-visibility: hidden;
  position: absolute;
  inset: 0;
}
.card-face {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.card.flip-anim .card-back {
  transform: rotateY(0deg);
}
.card.flip-anim.flipped {
  transform: rotateY(180deg);
}
.card.flip-anim.flipped .card-front {
  transform: rotateY(180deg);
}
.card.flip-anim .card-front {
  transform: rotateY(180deg);
}

.card-front {
  /* ensure the front face is visible even though .card sets color:transparent */
  color: initial;
}

/* ensure face-down/back image is shown on the back face */
.card .card-back {
  background-image: url("img/cards/back/back01.jpg");
  background-size: cover;
  background-position: center;
}

.card-label {
  position: absolute; /* Permite posicionar el elemento */
  top: 0px; /* Margen desde la parte superior */
  left: 0px; /* Margen desde la izquierda */
  font-size: var(--card-label-font-size);
  font-weight: bold;
  color: black; /* Color del texto, puedes elegir el que desees */
  line-height: 1; /* Para evitar espacio extra entre el valor y el palo */
  text-align: center;
  pointer-events: none; /* Asegura que el clic en la tarjeta no sea bloqueado por el texto */
  text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8); /* Opcional: para que se vea mejor sobre la imagen */

  background: #ffffffd3;
  padding: 3px 5px;
  border-radius: 5px;
}

/* Puedes añadir un estilo para los palos rojos si lo deseas */
.card.red .card-label {
  color: red;
}
.card:hover {
 transform: translateY(calc(-1 * var(--card-hover-translate)));
  z-index: 100;
}
.card.red {
  color: #d32f2f;
}
.card.black {
  color: #333;
}
/* New CSS using a background image */
.card.face-down {
  background-image: url("img/cards/back/back01.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border: 1px solid white;
  color: transparent;
}
.card.selected {
  border-color: #ffeb3b;
  box-shadow: 0 0 20px rgba(255, 235, 59, 0.8);
}

.waste-pile{
  background: rgba(0, 187, 255, 0.2);
  border-style: solid;

}
.stock-pile {
  background: rgba(0, 255, 170, 0.2);
  border-style: solid;

}
.empty-foundation::before {
  content: "♠♥♦♣";
  color: rgba(255, 255, 255, 0.3);
  font-size: var(--empty-foundation-fs);
}
.score {
  text-align: center;
  color: white;
  font-size: 18px;
  background: #d59bff99;
  padding:10px;
  border-radius: 20px;
}
.win-message {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #fdfdfd;
  color: rgb(162, 131, 209);
  padding: 30px 50px;
  border-radius: 15px;
  font-size: 24px;
  font-weight: bold;
  text-align: center;
  display: none;
  z-index: 2000;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
.win-message button {
  margin: 0 auto;
}

.puzzle-section {
  width: 100%;
  text-align: center;
  color: rgb(89, 89, 89);
  margin-top: 30px;
}
.hidden-image-wrapper { 
  display: flex; 
  justify-content: center; 
  flex-wrap: wrap; 
  gap: 20px; 
  margin-top: 25px;
}
.hidden-image-container {
  position: relative;
  max-width: 45%;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  overflow: hidden;
  border: 3px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}
.hidden-image-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.image-overlay {
  font-family: "Mochiy Pop One", sans-serif;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}
.image-panel {
  background: linear-gradient(to bottom, #B2EBF2, #E1BEE7, #FFAB91);
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: bold;
  color: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition:
    opacity 0.8s ease-in-out,
    transform 0.8s ease-in-out;
  opacity: 1;
  transform: scale(1);
}
.image-panel.revealed {
  opacity: 0;
  transform: scale(1.1);
  pointer-events: none;
}
.win-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000;
  display: none;
}

.scale-wrapper {
    display: block;
    margin: 0;
    padding: 0;
}

.card.dragging { 
  opacity: 0; 
  transform: scale(1.05); 
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
  border: 2px solid rgba(255, 235, 59, 0.8);
}

/* When dragging the top card from the waste pile, keep it visible so the
   pile doesn't appear empty. The element has a data-pile="waste" attribute
   set in JS, so we can selectively override the global dragging style. */
.card.dragging[data-pile="waste"] {
  opacity: 1;
  /* keep the visual emphasis but avoid hiding the card */
  transform: scale(1.03);
  z-index: 200;
}
.pile-drag-over { outline: 2px dashed rgba(255,255,255,0.25); }
.invalid-drop { animation: shake 0.25s; }
@keyframes shake {
  0% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-4px); }
  100% { transform: translateX(0); }
}




        .player {
            display: grid;
            grid-template-columns: 60px 200px 80px 80px 80px 120px;
            gap: 10px;
            padding: 12px;
            border-bottom: 1px solid #eee;
            align-items: center;
        }
        .header {
            background: #f8f9fa;
            font-weight: bold;
            border-bottom: 2px solid #ddd;
            border-radius: 5px;
            text-wrap: nowrap;
        }
        .sortable {
            cursor: pointer;
            user-select: none;
            transition: background-color 0.2s;
            padding: 8px;
            border-radius: 4px;
        }
        .sortable:hover {
            background: #e9ecef;
        }
        .sortable.active {
            background: #007bff;
            color: white;
        }
        .sort-arrow {
            font-size: 12px;
            margin-left: 5px;
        }
        .rank { 
            text-align: center; 
            font-weight: bold;
        }
        .back-btn {
            background: #007bff;
            color: white;
            padding: 10px 20px;
            text-decoration: none;
            border-radius: 20px;
            margin-bottom: 20px;
            display: inline-block;
        }
        .back-btn:hover {
            background: #0056b3;
        }
        .loading {
            text-align: center;
            padding: 20px;
            font-style: italic;
        }
        .error {
            color: red;
            text-align: center;
            padding: 20px;
        }
        .sort-info {
            background: #e3f2fd;
            padding: 10px;
            border-radius: 5px;
            margin-bottom: 15px;
            text-align: center;
            font-size: 14px;
        }

        /* Overlay base */
.overlay {
  display: none; /* oculto por defecto */
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(233, 135, 218, 0.6); /* fondo semitransparente morado */
  z-index: 2000;
  justify-content: center;
  align-items: center;
}
#help, #credits, #skins, #dailyPrizes {display: none;}
/* Botón de cerrar */
.close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
}

#help, #credits, #skins, #dailyPrizes {
  padding:20px 50px;
  color:#333;
  background:#ADD8E6;
  max-width: 700px;
  max-height: 85%;
  overflow-y: scroll;
  border:#ffffff 5px dashed;
  border-radius:20px;
  box-shadow:  0 4px 6px rgba(0, 0, 0, 0.5);
}
.logo{
  max-width: 50%;
  margin: auto;
  display: block;
}
/* Animación */
@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

@media (max-width: 768px) {
.hidden-image-container {

  max-width: 80%;

}

    .controls {
        gap: 10px;
    }

    button {
        padding: 12px 16px;
        font-size: 12px;
        min-width: 50px;
        border-radius: 20px;
    }

    .button-text {
       font-size: 9px;
    }

    .button-icon {
        font-size: 20px;
    }

}
.splash-overlay {
  position: fixed;
  inset: 0; /* top:0; right:0; bottom:0; left:0 */
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgb(180, 174, 255);
  z-index: 3000; /* higher than other overlays */
  animation: splashFadeIn 300ms ease forwards;
}
.splash-content {
  background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(255,250,250,0.92));
  background-image: url('img/splash_portrait.jpg'); /* Portrait default */
  background-repeat: no-repeat;
  background-position: center center;
  background-size: cover;
  position: relative;
  width: 90vw;
  height: 90vh;
  max-height: 90%;
  padding: 20px;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0,0,0,0.45);
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: #25bffb 10px solid;
}

.tutorial-img{
  height: 100%;
  max-height: 100px;
  float: right;
}
#tutorialCloseBtn{
  position: absolute;
  top: -3px;
  right: -3px;
  width: 30px;
  height: 30px;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #444;
  padding: 8px;
  transition: all 0.3s ease;
  background: #00ddff5c;
}
#tutorialCloseBtn:hover {
  color: #000;
  background: #13e0ff30;
}
            
@media (orientation: landscape) {
  .splash-content {
    background-image: url('img/splash_landscape.jpg');
  }
    /* Mobile adjustments */
    :root {
      --card-gap: 10px;
    }
    :root {
      /* smaller card on narrow screens */
      --card-min-width: clamp(48px, 18vw, 110px);
    }
}

@media (orientation: portrait) {
  #tutorialInstruction {
    bottom:50% !important;
    transform: translateY(95%) !important;
    top:auto !important;
  }

}

  /* Larger screens - increase card size and spacing */
  @media (min-width: 1200px) {
    :root {
      --card-gap: 20px;
      --card-min-width: clamp(80px, 18vw, 120px);
    }
    .game-container {
      padding: 28px;
    }
  }

  /* Extra large displays - make game board and top-row visibly bigger */
  @media (min-width: 1600px) {
    :root {
      --card-min-width: clamp(100px, 18vw, 130px);
      --card-gap: 24px;
    }
    .game-board, .top-row {
      transform: scale(1.02);
    }
  }
.splash-logo {
  max-width: 60%;
  max-height: 40%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  z-index: 30;
  position: relative;
}

/* overlay layer so logo/button remain readable over the background image */
.splash-content::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 239, 197, 0.35);
  backdrop-filter: blur(2px);
  z-index: 10;
}

.splash-content > * {
  position: relative; /* bring children above the ::before overlay */
  z-index: 20;
}

@keyframes splashFadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

@media (max-width: 600px) {
  .splash-content { padding: 18px 20px; }
  .splash-logo { max-width: 240px; }
}

#skins{
  width: 80%;
  max-width: 700px;
}
.skin-options {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
  margin-top: 20px;
}
.skin-option.locked .skin-image {
  filter: grayscale(100%) brightness(0.6);
  cursor: not-allowed;
  position: relative;
  opacity: 0.6;
  pointer-events: none; /* Disable interaction */
}
.skin-option {
  margin: 10px;
}
@media (max-width: 500px) {
  .skin-option {
    margin: 0px;
    max-width: 80px;
  }
}
.skin-image {
  height: 100px;
  border-radius: 10px;

  cursor: pointer;
  border: 3px solid #fff;
  transition: all 0.3s ease;
}
.skin-image:hover {
  transform: scale(1.05);
  border-color: #ffeb3b;
  box-shadow: 0 0 20px rgba(255, 235, 59, 0.8);
}
.skin-image.selected {
  border-color: #3bb7ff;
  box-shadow: 0 0 20px rgba(59, 183, 255, 0.8);

}
#dailyPrizes{
  position:relative;
}
.closePrizes{
  position:absolute; 
  right:8px; 
  top:8px; 
  background:transparent; 
  border:none;
  font-size:22px; 
  cursor:pointer;
  font-size: 11px;
  box-shadow: inset #5c99ac 0px 0px 10px;
}
.closePrizes:hover{
  background: transparent;
}
#dailyPrizes button{
  margin:auto;
}
#dailyPrizes p{
  font-size: 12px;
}
.capyprize {
  width: 175px;
  height: 200px;
  background: url('img/capi_prizes.png') no-repeat left center;

  margin: 0 auto 15px auto;
  /* para que se repita animación */
  animation: prizeAnim 1s steps(2) infinite;
}
@keyframes prizeAnim {
  from {
    background-position: 0 0;
  }
  to {
    background-position: -350px 0; /* 175px * 2 */
  }
}
#prizeHistoryList{
  max-height: 300px;
  overflow-y: auto;
  margin-top: 15px;
  text-align: left;
  border: 1px solid #ccc;
  padding: 10px;
  background: #f9f9f9;
  border-radius: 18px;
  display: flex;
  flex-wrap: wrap;           /* permite que bajen de línea */
  gap: 10px;                 /* separación entre items */
}
#prizeHistoryList li{
  flex: 1 1 calc(33.333% - 10px); /* 3 por fila */
  border-bottom: 1px solid #eee;
  padding: 6px;
  font-size: 14px;
  list-style: none;
  background: #d6efff;
  border-radius: 10px;
  text-align: center;
  position:relative
}
#prizeHistoryList li span{
  position: absolute;
  bottom: 6px;
  right: 10px;
  font-size: 10px;
  color: #ff4545;
  background:#ffffff72;
  border:#37c3ff 2px solid;
  border-radius: 10px;
  font-weight: 800;
  padding:3px 7px;
}
#prizeHistoryList li.locked{
  background: #b4b4b4;
  color: #999;
  filter: grayscale(70%);
  opacity: .7;
}

/* Daily claim notification toast */
.claim-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: linear-gradient(135deg,#fffef2,#fffbec);
  color: #222;
  padding: 12px 16px;
  border-radius: 10px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.18);
  z-index: 100000;
  font-weight: 600;
  min-width: 180px;
  text-align: center;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 260ms ease, transform 260ms ease;
  cursor: pointer;
}
.claim-notification.visible {
  opacity: 1;
  transform: translateY(0);
}

.claim-notification {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-direction: column;
}
.claim-notification-img {
  width: 120px;
  height: 120px;
  object-fit: contain;
  flex: 0 0 120px;
}
.claim-notification-text {
  font-weight: 700;
  color: #222;
  text-align: left;
}
.claim-area{
  position: relative;
background: #ff6e6e;
  border-radius: 20px;
  padding: 10px;
  margin-bottom: 10px;
  border: #fff 5px solid;
  transition: all 2s;
}
.claim-area:hover{
  background: #ff4c4c;
}
.claim-area button{
  margin-bottom: 10px;
}

