#resultsPanel, #rye {
  transition: opacity 0.3s ease;
}

/* Ingredientes centrados en cuadrícula con baldas alineadas */
.ingredients-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  gap: 10px;
  justify-items: center;
  padding: 10px;

  /* Fondo madera clara */
  background: linear-gradient(
      90deg,
      #f4d9a6 0%,
      #f1d29a 25%,
      #f6e0b7 50%,
      #f1d29a 75%,
      #f4d9a6 100%
  );

  /* Marco tipo madera */
  border: 12px solid #8b5a2b;
  border-radius: 8px;

  /* Sombra para efecto profundidad */
  box-shadow:
    inset 0 0 8px rgba(0,0,0,0.25),
    0 4px 10px rgba(0,0,0,0.3);
}

.ingredient {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;           
  background: #f3f3f3;
  border-radius: 6px;
  cursor: grab;
  transition: transform 0.2s ease, background 0.2s ease;
  z-index: 1;
}

.ingredient:active {
  cursor: grabbing;
}

.ingredient img {
  width: 80px;            
  height: 80px;           
  object-fit: contain;
}

.ingredient p {
  margin: 0;
  font-size: 13px;
  text-align: center;
  word-wrap: break-word;
}

@media (hover: hover) {
  .ingredient:hover {
    background: #e2e2e2;
    transform: scale(1.3);
    z-index: 2;
  }
}

.ingredient.used {
  opacity: 1;
  border: 2px solid #28a745;
  background: #e8f5e9;
  position: relative;
}

.ingredient.used::after {
  content: "✓";
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 16px;
  color: #28a745;
  font-weight: bold;
}

.ingredient.incompatible {
  opacity: 0.25;
  filter: grayscale(100%);
  cursor: not-allowed;
  transform: none;
}

/* Móvil: lista horizontal de ingredientes */
@media (max-width: 767px) {
  .ingredients-list {
    display: flex;
    overflow-x: auto;
    gap: 10px;
    padding: 10px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }

  .ingredients-list::-webkit-scrollbar {
    height: 8px;
  }

  .ingredients-list::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.2);
    border-radius: 4px;
  }

  .ingredient {
    flex: 0 0 auto;
    width: 60px;
    scroll-snap-align: center;
  }
}


/* ===============================
   Nota instrucciones
   =============================== */

.note {
  position: relative;
  width: 90%;
  margin: 20px auto 0px auto;

  background: #fff8c6;
  border: 1px solid #e6d98c;
  border-radius: 4px;

  box-shadow: 3px 6px 10px rgba(0,0,0,0.25);
  transform: rotate(-2deg);

  font-family: "Comic Sans MS", "Segoe UI", cursive;

  z-index: 5;
}

/* chincheta */
.note::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);

  width: 14px;
  height: 14px;
  background: #d32f2f;
  border-radius: 50%;

  box-shadow:
    0 2px 2px rgba(0,0,0,0.4),
    inset -2px -2px 4px rgba(0,0,0,0.3);
}

#instructions-section {
  font-family: 'Caveat', cursive;
}

#instructions-section h3 {
  text-align: center; /* el título sigue centrado */
  margin-top: 1rem;
  font-size: 2.1rem;
}

#instructions-section p {
  text-align: left; /* las instrucciones alineadas a la izquierda */
  margin-left: 2.1rem;
  font-size: 1.6rem;
  margin-bottom: 0.1em;
}

#rye_logo {
  transform: rotate(5deg);
  max-height: 100px;
  float: right;
}

/* ===============================
   Bocadillo vertical
   =============================== */
.sandwich-slots {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;

  max-width: 100%;
  overflow: hidden;

  margin-top: 40px;
  padding: 70px 30px; /* espacio para los panes */

  /* bandeja */
  background: linear-gradient(#e0e0e0, #cfcfcf);
  border-radius: 20px;
  box-shadow:
    inset 0 3px 6px rgba(0,0,0,0.2),
    0 8px 15px rgba(0,0,0,0.3);
}

.sandwich-slots .slots-row {
    display: flex;
    flex-direction: column; /* para que los slots queden verticales */
    gap: 25px;             /* separa los slots entre sí */
  }

.sandwich-slots .actions p {
    font-size: 1.3rem;
  }

/* pan superior */
.sandwich-slots::before {
  content: "";
  position: absolute;
  top: -25px;
  width: 100%;
  height: 60px;

  background: linear-gradient(#f5c16c, #e3a84d);
  border-radius: 40px 40px 20px 20px;

  box-shadow:
    inset 0 -6px 10px rgba(0,0,0,0.2),
    0 4px 6px rgba(0,0,0,0.25);
}

/* pan inferior */
.sandwich-slots::after {
  content: "";
  position: absolute;
  bottom: -25px;
  width: 100%;
  height: 50px;

  background: linear-gradient(#e3a84d, #d49335);
  border-radius: 20px 20px 35px 35px;

  box-shadow:
    inset 0 5px 8px rgba(0,0,0,0.2),
    0 4px 6px rgba(0,0,0,0.25);
}

/* slots de ingredientes */

.slot {
  width: 95px;
  height: 95px;
  border: 2px dashed #bbb;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fafafa;
  transition: all 0.25s ease;
}

.slot.filled {
  border-style: solid;
}

.slot.filled img {
  animation: ingredientDrop 0.25s ease;
  cursor: pointer;
}

@keyframes ingredientDrop {
  from {
    transform: scale(0.6);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

#cookBtn {
  font-size: 1.2rem;
  padding: 10px 20px;
  border-radius: 12px;
  transition: 0.2s all;
  background: linear-gradient(45deg, #a81590, #2f1cda);
}

#cookBtn:hover {
  background-color: #222; 
  transform: scale(1.05);
}

#cookBtn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

#cookBtn.clicked {
  transform: scale(2);
  transition: transform 0.15s ease;
}

#clearBtn {
  font-size: 1.1rem;
  padding: 10px 18px;
  border-radius: 12px;
  transition: 0.2s all;
}

#clearBtn:hover {
  background-color: #f8f9fa;
  color: #000;
  transform: scale(1.05);
}

@keyframes trashShake {
  0% { transform: rotate(0deg); }
  25% { transform: rotate(-15deg); }
  50% { transform: rotate(15deg); }
  75% { transform: rotate(-10deg); }
  100% { transform: rotate(0deg); }
}

#clearBtn.animate {
  animation: trashShake 0.4s ease-in-out;
}

.scroll-top-btn {
  position: fixed;
  bottom: 30px;
  left: 5vw;
  z-index: 2000;
  background: gray;
  color: white;
  border: none;
  padding: 12px 16px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.scroll-top-btn.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.scroll-top-btn:hover {
  transform: translateY(-4px);
}

/* Tarjetas de resultados estilo flex con tres columnas */
.result-card {
  display: flex;
  align-items: stretch;
  gap: 16px;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 10px;
  margin-bottom: 16px;
  background: #fff;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Imagen ocupa aproximadamente un tercio */

.result-card img {
  border-radius: 8px;
  object-fit: cover;
}

.categories {
  font-size: 0.75rem;
  color: #888;
}

.snippet {
  hyphens: auto;          /* activa el corte automático */
  -webkit-hyphens: auto;  /* soporte Safari / iOS */
  -ms-hyphens: auto;      /* soporte IE */
  word-wrap: break-word;  /* asegura que largas palabras se rompan si hace falta */
  overflow-wrap: break-word;
  white-space: pre-line;
  margin: 0 0 15px 0;
  font-family: 'Minion Pro', sans-serif;
  font-style: italic;
  color: #333;
  line-height: 1.6;
  position: relative;
  padding-left: 15px;
  border-left: 3px solid #ddd;
}

/* comilla izquierda */
.snippet::before {
  content: "“";
  position: absolute;
  left: 0;
  top: 0;
  font-size: 2em;
  color: #bbb;
  line-height: 1;
}

.quote-mark {
  color: #bbb;
}


.meta {
  display: flex;
  gap: 15px;
  font-size: 0.9rem;
  color: #777;
  margin-bottom: 8px;
}

.tag {
  display: inline-block;
  background: #f1f1f1;
  color: #555;
  padding: 4px 10px;
  margin: 3px 5px 3px 0;
  border-radius: 20px;
  font-size: 0.8rem;
}

.divider {
  opacity: 0.15;
  margin: 10px 0 15px;
}

.caption {
  font-size: 0.9rem;
  color: #888;
}

.download-count {
  display: flex;
  align-items: center;
  font-size: 0.9rem;
  color: #555;
  margin-left: 10px;
}

/* ===== Animaciones base ===== */

@keyframes fallDown {
  0% {
    transform: translateY(0);
    opacity: 1;
  }
  100% {
    transform: translateY(120vh);
    opacity: 0;
  }
}

@keyframes riseUp {
  0% {
    transform: translateY(120vh);
    opacity: 0;
  }
  80% {
    transform: translateY(-10px);
    opacity: 1;
  }
  100% {
    transform: translateY(0);
  }
}

/* Clases helper */
.fall {
  animation: fallDown 0.5s ease-in forwards;
}

.rise {
  animation: riseUp 0.6s cubic-bezier(0.25, 1.25, 0.5, 1) forwards;
}

/* Gap horizontal en móvil */
@media (max-width: 767px) {
  .slot {
    width: 70px;
    height: 70px;
  }

  .sandwich-slots .slots-row {
    flex-direction: row;    /* fila horizontal en móvil */
    gap: 15px;
    justify-content: center;
  }

  .sandwich-slots {
    padding-top: 70px;      /* espacio superior */
  }

  .slots-row {
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 12px;
  }

  /* Acciones: texto + botones en fila debajo */
  .sandwich-slots .actions {
    display: flex;
    flex-direction: column; /* texto arriba, botones abajo */
    gap: 8px;
    width: 100%;
    align-items: center;
  }

  #cookBtn,
  #clearBtn {
    font-size: 1rem;
    padding: 8px 14px;
    width: 80%;
    max-width: 200px;
    margin: 0 auto;
  }

  .sandwich-slots .actions p {
    font-size: 0.9rem;
    text-align: center;
    margin-bottom: 5px;
  }

  .ingredient img {
    -webkit-user-drag: none;
    user-select: none;
    -webkit-touch-callout: none; /* 👈 iOS: quita el menú */
    pointer-events: none; /* 👈 clave */
  }
}