/* Game 3: memory flowers. Image slots live in assets/flowers/*.png */
.fl {
  --plum: #24143d;
  --gold: #ffd76a;
  --pink: #f4a9c6;
  --cream: #fff5e6;
  --rose: #c45f93;
  --ease: cubic-bezier(0.05, 0.7, 0.1, 1);
  position: fixed;
  inset: 0;
  z-index: 6;
  color: var(--cream);
  font-family: Figtree, system-ui, sans-serif;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.fl[hidden] { display: none; }
.fl.is-on { opacity: 1; }

.fl-hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: max(0.9rem, env(safe-area-inset-top)) 1.1rem 1.4rem;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  background: linear-gradient(180deg, rgba(36, 20, 61, 0.7), transparent);
  pointer-events: none;
}
.fl-title {
  margin: 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 500;
  font-size: clamp(1.3rem, 4vw, 1.85rem);
}
.fl-score {
  margin: 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.35rem;
  color: var(--gold);
}

.fl-bed {
  position: absolute;
  left: 50%;
  bottom: max(1.2rem, env(safe-area-inset-bottom));
  width: min(92vw, 28rem);
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem 0.7rem;
  transform: translateX(-50%);
  pointer-events: auto;
}
.fl-bed li { display: flex; justify-content: center; }

.fl-bud {
  position: relative;
  width: 100%;
  max-width: 9.2rem;
  aspect-ratio: 4 / 5;
  padding: 0;
  border: 1.5px solid rgba(255, 215, 106, 0.35);
  border-radius: 18px;
  overflow: hidden;
  background: rgba(36, 20, 61, 0.45);
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 10px 22px rgba(18, 8, 36, 0.45);
  transition: transform 0.4s var(--ease), filter 0.4s, border-color 0.4s, box-shadow 0.4s;
}
.fl-bud:not(.is-open) {
  transform: scale(0.82);
  border-radius: 50% 50% 46% 46%;
  filter: none;
  background:
    radial-gradient(circle at 40% 32%, #ffe4f0, #e89ab8 48%, #7a3a62);
}
.fl-bud:not(.is-open) img { opacity: 0 !important; }
.fl-bud:not(.is-open) .fl-ph { opacity: 1; filter: none; }
.fl-bud.is-open {
  transform: scale(1);
  border-radius: 18px;
  border-color: var(--gold);
  box-shadow: 0 0 0 1px rgba(255, 215, 106, 0.5), 0 12px 28px rgba(255, 190, 90, 0.28);
  animation: fl-bloom 0.55s var(--ease);
}
@keyframes fl-bloom {
  0% { transform: scale(0.72); filter: brightness(0.8); }
  60% { transform: scale(1.06); }
  100% { transform: scale(1); }
}
.fl-ph {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 40% 30%, #ffe4f0, #e89ab8 55%, #9a4d78);
  font-size: 2rem;
  line-height: 1;
}
.fl-bud img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  pointer-events: none;
}
.fl-bud.has-art img { opacity: 1; }
.fl-bud.has-art .fl-ph { opacity: 0; }
.fl-bud.is-empty img { display: none; }
.fl-bud:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; border-radius: 16px; }

.fl-card {
  position: absolute;
  left: 50%;
  top: 42%;
  width: min(92vw, 24rem);
  padding: 0.85rem 0.9rem 1.15rem;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(52, 30, 86, 0.92), rgba(36, 20, 61, 0.94));
  border: 1px solid rgba(255, 215, 106, 0.4);
  box-shadow: 0 22px 50px rgba(12, 4, 26, 0.5);
  text-align: center;
  transform: translate(-50%, -46%) scale(0.96);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s, transform 0.28s var(--ease);
}
.fl-card.is-on { opacity: 1; transform: translate(-50%, -50%); pointer-events: auto; }
.fl-card[hidden] { display: none; }
.fl-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.86rem;
  letter-spacing: 0.04em;
  color: var(--pink);
}
.fl-card h2 {
  margin: 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 500;
  font-size: clamp(1.15rem, 4.2vw, 1.45rem);
  line-height: 1.35;
}
.fl-card p { margin: 0.7rem 0 0; opacity: 0.9; line-height: 1.4; }
.fl-btn {
  margin-top: 1rem;
  min-height: 48px;
  padding: 0.7rem 1.2rem;
  width: 100%;
  border: 0;
  border-radius: 999px;
  font: 600 1rem Figtree, sans-serif;
  color: var(--plum);
  background: linear-gradient(180deg, #ffeeb4, #ffd76a);
  cursor: pointer;
}
.fl-card-art {
  width: 100%;
  aspect-ratio: 4 / 5;
  max-height: 38vh;
  height: auto;
  margin: 0 auto 0.65rem;
  pointer-events: none;
  border-radius: 16px;
}
.fl-bouquet {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem;
  margin: 0.7rem 0 0;
  padding: 0;
  list-style: none;
}
.fl-bud.is-mini {
  width: 52px;
  max-width: 52px;
  height: 64px;
  aspect-ratio: auto;
  pointer-events: none;
  transform: none;
  filter: none;
}
.fl-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

@media (max-height: 520px) and (orientation: landscape) {
  .fl-bed { width: min(96vw, 34rem); grid-template-columns: repeat(6, 1fr); bottom: 0.4rem; }
  .fl-card { top: 38%; }
}
