/* ── Recipe Roulette – scoped styles ──────────────────────────────────
   All selectors are under .rz-roulette to avoid theme conflicts.
   Fonts inherit from the active theme (Playfair Display + Lora).
   ─────────────────────────────────────────────────────────────────── */

.rz-roulette {
  --rz-cream:       #fdf8f4;
  --rz-parchment:   #f5ede3;
  --rz-terracotta:  #c0714f;
  --rz-terra-dark:  #a05a3a;
  --rz-terra-light: #e8c4b0;
  --rz-chocolate:   #2a1a0e;
  --rz-mid:         #7a5c4a;
  --rz-white:       #ffffff;
  --rz-shadow:      rgba(42, 26, 14, 0.15);
  --rz-card-w:      260px;
  --rz-card-h:      360px;

  font-family: 'Lora', Georgia, serif;
  color: var(--rz-chocolate);
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  padding: 0 1rem 2rem;
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
  box-sizing: border-box;
}

.rz-roulette *, .rz-roulette *::before, .rz-roulette *::after {
  box-sizing: border-box;
}

/* ── Utility ───────────────────────────────────────────────────────── */
.rz-hidden { display: none !important; }

@keyframes rz-fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes rz-slideUp {
  from { opacity: 0; transform: translateY(40px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes rz-shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

@keyframes rz-pulse {
  from { box-shadow: 0 4px 18px rgba(42,26,14,0.3); }
  to   { box-shadow: 0 4px 30px rgba(192,113,79,0.6); }
}

@keyframes rz-popIn {
  from { transform: scale(0.6); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

@keyframes rz-confettiFall {
  0%   { opacity: 1;   transform: translateX(0) translateY(0) rotate(0deg); }
  80%  { opacity: 0.9; }
  100% { opacity: 0;   transform: translateX(var(--rz-drift)) translateY(105vh) rotate(800deg); }
}

/* ── Hero ──────────────────────────────────────────────────────────── */
.rz-roulette .rz-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  animation: rz-fadeIn 0.6s ease;
  width: 100%;
}

.rz-roulette .rz-hero-text {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(1.2rem, 3.5vw, 1.7rem);
  color: var(--rz-mid);
  text-align: center;
  font-style: italic;
  margin: 0;
}

/* ── Primary button ────────────────────────────────────────────────── */
.rz-roulette .rz-btn-primary {
  background: var(--rz-terracotta);
  color: var(--rz-white);
  border: none;
  border-radius: 50px;
  font-family: 'Lora', Georgia, serif;
  font-weight: 700;
  font-size: clamp(1rem, 3vw, 1.25rem);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 1rem 2.8rem;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(192, 113, 79, 0.35);
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}

.rz-roulette .rz-btn-primary:hover {
  background: var(--rz-terra-dark);
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(192, 113, 79, 0.45);
}

.rz-roulette .rz-btn-primary:active { transform: translateY(0); }

.rz-roulette .rz-btn-primary.rz-loading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.2) 50%, transparent 100%);
  animation: rz-shimmer 1.2s infinite;
}

/* ── Filters ───────────────────────────────────────────────────────── */
.rz-roulette .rz-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: flex-end;
  background: #f9f9f9;
  border-radius: 16px;
  padding: 24px 28px;
  width: 100%;
  max-width: 600px;
}

.rz-roulette .rz-filter-group {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 160px;
}

.rz-roulette .rz-filter-label {
  display: block;
  font-family: 'Lora', Georgia, serif;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #666;
  margin-bottom: 8px;
}

.rz-roulette .rz-filter-select {
  width: 100%;
  padding: 12px 40px 12px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: 'Lora', Georgia, serif;
  background: #fff;
  color: #333;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.rz-roulette .rz-filter-select:focus {
  outline: none;
  border-color: #e25555;
  box-shadow: 0 0 0 3px rgba(226, 85, 85, 0.1);
}

/* No-match warning */
.rz-roulette .rz-no-match {
  font-family: 'Lora', Georgia, serif;
  font-size: 0.85rem;
  color: #e25555;
  margin: 0;
}

/* ── Carousel section ──────────────────────────────────────────────── */
#rz-carousel-section {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.8rem;
  animation: rz-slideUp 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

#rz-carousel-label {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(1rem, 2.5vw, 1.3rem);
  color: var(--rz-mid);
  letter-spacing: 0.08em;
  margin: 0;
}

/* ── Viewport ──────────────────────────────────────────────────────── */
#rz-carousel-viewport {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  position: relative;
  height: calc(var(--rz-card-h) + 20px);
  mask-image: linear-gradient(to right, transparent 0%, black 12%, black 88%, transparent 100%);
  -webkit-mask-image: linear-gradient(to right, transparent 0%, black 12%, black 88%, transparent 100%);
}

/* ── Track ─────────────────────────────────────────────────────────── */
#rz-carousel-track {
  display: flex;
  gap: 20px;
  position: absolute;
  top: 10px;
  left: 0;
  will-change: transform;
}

/* ── Card ──────────────────────────────────────────────────────────── */
.rz-roulette .rz-roulette-card {
  flex-shrink: 0;
  width: var(--rz-card-w);
  height: var(--rz-card-h);
  border-radius: 18px;
  overflow: hidden;
  background: var(--rz-white);
  box-shadow: 0 4px 18px var(--rz-shadow);
  display: flex;
  flex-direction: column;
  transition: transform 0.3s, box-shadow 0.3s;
  position: relative;
}

.rz-roulette .rz-roulette-card img {
  width: 100%;
  height: 76%;
  object-fit: cover;
  display: block;
}

.rz-roulette .rz-roulette-card .rz-card-title {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0.5rem 0.75rem;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--rz-chocolate);
  background: var(--rz-white);
  line-height: 1.3;
  margin: 0;
}

.rz-roulette .rz-roulette-card.rz-center {
  transform: scale(1.06);
  box-shadow: 0 8px 32px rgba(192, 113, 79, 0.35);
}

/* ── Stop button ───────────────────────────────────────────────────── */
#rz-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
}

#rz-stop-btn {
  background: var(--rz-chocolate);
  color: var(--rz-white);
  border: none;
  border-radius: 50px;
  font-family: 'Lora', Georgia, serif;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 0.85rem 3rem;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(42, 26, 14, 0.3);
  transition: background 0.2s, transform 0.15s;
  animation: rz-pulse 1s ease-in-out infinite alternate;
}

#rz-stop-btn:hover {
  background: #4a2e1a;
  transform: scale(1.04);
  animation: none;
}

/* ── Result ────────────────────────────────────────────────────────── */
#rz-result-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.6rem;
  animation: rz-fadeIn 0.5s ease;
}

#rz-result-headline {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(1.1rem, 3vw, 1.6rem);
  color: var(--rz-mid);
  text-align: center;
  margin: 0;
}

#rz-result-card {
  width: min(300px, 85vw);
  border-radius: 22px;
  overflow: hidden;
  background: var(--rz-white);
  box-shadow: 0 12px 50px rgba(192, 113, 79, 0.4);
  animation: rz-popIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 3px solid var(--rz-terracotta);
}

#rz-result-card img {
  width: 100%;
  aspect-ratio: 3/2;
  object-fit: cover;
  display: block;
}

#rz-result-card .rz-card-title {
  padding: 1rem 1.2rem;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(1rem, 3vw, 1.25rem);
  font-weight: 700;
  text-align: center;
  color: var(--rz-chocolate);
  margin: 0;
}

/* ── Result action buttons ─────────────────────────────────────────── */
.rz-roulette .rz-result-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
}

#rz-open-btn {
  background: var(--rz-terracotta);
  color: var(--rz-white);
  text-decoration: none;
  border-radius: 50px;
  font-family: 'Lora', Georgia, serif;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 1rem 2.8rem;
  box-shadow: 0 6px 24px rgba(192, 113, 79, 0.4);
  transition: background 0.2s, transform 0.15s;
  display: inline-block;
}

#rz-open-btn:hover {
  background: var(--rz-terra-dark);
  transform: translateY(-2px);
  color: var(--rz-white);
  text-decoration: none;
}

#rz-again-btn {
  background: none;
  border: 2px solid var(--rz-terracotta);
  color: var(--rz-terracotta);
  border-radius: 50px;
  font-family: 'Lora', Georgia, serif;
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.7rem 2rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

#rz-again-btn:hover {
  background: var(--rz-terracotta);
  color: var(--rz-white);
}

/* ── Confetti (fixed overlay, pointer-events off) ──────────────────── */
.rz-confetti-wrap {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  overflow: hidden;
}

.rz-confetti-piece {
  position: absolute;
  top: -16px;
  border-radius: 2px;
  animation: rz-confettiFall var(--rz-dur) var(--rz-delay) ease-in forwards;
}

/* ── Responsive ────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .rz-roulette {
    gap: 1.2rem;
    padding: 0 0.75rem 1.5rem;
  }

  .rz-roulette .rz-hero {
    gap: 1rem;
  }

  .rz-roulette .rz-filters {
    flex-direction: row;   /* keep side-by-side as long as it fits */
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px;
    max-width: 100%;
  }

  .rz-roulette .rz-filter-group {
    min-width: calc(50% - 6px); /* two columns */
    flex: 1 1 calc(50% - 6px);
  }

  .rz-roulette .rz-filter-label {
    font-size: 0.7rem;
    margin-bottom: 5px;
  }

  .rz-roulette .rz-filter-select {
    padding: 10px 32px 10px 12px;
    font-size: 0.9rem;
  }

  .rz-roulette .rz-btn-primary {
    padding: 0.9rem 2rem;
    font-size: 0.95rem;
  }

  .rz-roulette {
    --rz-card-w: 200px;
    --rz-card-h: 290px;
  }
}
