/* ============================================================
   WHAT FLOWER ARE YOU? — Stylesheet
   Dark jewel-tone "midnight garden" · glossy · positive · dimensional
   ============================================================ */

:root {
  --bg0:        #161222;
  --card:       rgba(34, 28, 52, 0.55);
  --card-line:  rgba(255, 255, 255, 0.12);

  --sun:        #ffd257;
  --gold:       #ffcf6a;
  --marigold:   #ffb14e;
  --orange:     #ff9450;
  --coral:      #ff8a68;
  --pink:       #ff8fbf;
  --leaf:       #a6e06b;
  --leaf-deep:  #7ccf57;
  --teal:       #57d6c2;
  --violet:     #c39bff;

  --cream:      #f5ecd8;
  --soft:       #c3b49a;

  --shadow:     0 40px 90px -38px rgba(0, 0, 0, 0.85);
  --radius:     30px;
  --font-th:    'Prompt', 'Segoe UI', system-ui, sans-serif;
  --font-en:    'Cormorant Garamond', Georgia, serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  min-height: 100vh;
  font-family: var(--font-th);
  color: var(--cream);
  background:
    radial-gradient(1200px 820px at 50% -8%,  #35284f 0%, transparent 58%),
    radial-gradient(1000px 900px at 8% 40%,   #2a1f45 0%, transparent 55%),
    radial-gradient(1050px 900px at 100% 60%, #123a37 0%, transparent 55%),
    radial-gradient(1100px 900px at 50% 120%, #1c3a2e 0%, transparent 60%),
    var(--bg0);
  background-attachment: fixed;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 34px 18px 66px;
  position: relative;
  overflow-x: hidden;
}

/* ============================================================
   Flower garden background (transparent cut-outs, glowing on dark)
   ============================================================ */
.defs { position: absolute; }
.collage {
  position: fixed;
  inset: -6%;
  z-index: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  align-content: center;
  justify-content: center;
  overflow: hidden;
  pointer-events: none;
}
.collage__f {
  flex: 0 0 auto;
  height: auto;
  align-self: center;
  margin: -12px -7px;
  /* soft dark grounding shadow + a whisper of glow so blooms feel luminous */
  filter:
    drop-shadow(0 10px 16px rgba(0, 0, 0, 0.55))
    drop-shadow(0 0 10px rgba(255, 244, 214, 0.1))
    saturate(1.08) brightness(1.03);
  animation: sink 1.1s ease both;
}
@keyframes sink { from { opacity: 0; } to { opacity: 1; } }

.collage-veil {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  /* keep blooms vivid; deepen the far edges for a glossy vignette */
  background:
    radial-gradient(ellipse 70% 55% at 50% 44%, rgba(60, 48, 92, 0.28) 0%, transparent 66%),
    radial-gradient(ellipse 110% 100% at 50% 46%, transparent 46%, rgba(8, 6, 16, 0.62) 100%);
}
.grain {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.35;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
}

/* ============================================================
   Language control
   ============================================================ */
.controls { position: fixed; top: 18px; right: 18px; z-index: 20; display: flex; gap: 8px; }
.ctrl {
  font-family: var(--font-th);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  min-width: 48px;
  height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1.5px solid rgba(255, 210, 87, 0.55);
  background: rgba(34, 28, 52, 0.7);
  backdrop-filter: blur(8px);
  color: var(--gold);
  cursor: pointer;
  transition: transform 0.15s, background 0.2s, border-color 0.2s, box-shadow 0.2s;
  box-shadow: 0 8px 22px -10px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}
.ctrl:hover { transform: translateY(-1px); border-color: var(--sun); background: rgba(46, 38, 68, 0.85); }

/* ============================================================
   Shell & buttons
   ============================================================ */
.screen { position: relative; z-index: 1; width: 100%; max-width: 640px; animation: rise 0.7s cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }

.btn {
  font-family: var(--font-th);
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 999px;
  padding: 15px 36px;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.25s ease, filter 0.25s, opacity 0.2s;
  letter-spacing: 0.02em;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn:not(:disabled):hover { transform: translateY(-2px); }
.btn:not(:disabled):active { transform: translateY(0); }
.btn--primary {
  background: linear-gradient(135deg, var(--sun) 0%, var(--orange) 55%, var(--coral) 100%);
  color: #3a1e10;
  box-shadow: 0 16px 34px -12px rgba(255, 138, 80, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.btn--primary:not(:disabled):hover { filter: brightness(1.06); box-shadow: 0 22px 40px -12px rgba(255, 138, 80, 0.75); }
.btn--ghost { background: rgba(166, 224, 107, 0.1); color: var(--leaf); border: 1.5px solid rgba(166, 224, 107, 0.5); }
.btn--ghost:not(:disabled):hover { background: rgba(166, 224, 107, 0.18); }

/* glossy glass panel */
.intro, .quiz, .result {
  background: var(--card);
  backdrop-filter: blur(12px) saturate(1.1);
  -webkit-backdrop-filter: blur(12px) saturate(1.1);
  border: 1px solid var(--card-line);
  border-radius: var(--radius);
  box-shadow:
    var(--shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 -1px 0 rgba(0, 0, 0, 0.25);
}

/* ============================================================
   Intro
   ============================================================ */
.intro { text-align: center; padding: 48px 42px 44px; }
.intro__crest { display: flex; align-items: flex-end; justify-content: center; gap: 4px; margin-bottom: 14px; }
.crest { display: block; }
.crest--main { width: 66px; animation: sway 9s ease-in-out infinite; }
.crest--side { width: 42px; opacity: 0.94; margin-bottom: 10px; animation: bob 5s ease-in-out infinite; }
.crest--side:last-child { animation-delay: -2.4s; }
.crest .bloom-svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 3px 8px rgba(0,0,0,0.5)); }
@keyframes sway { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

.intro__eyebrow { font-family: var(--font-en); font-style: italic; font-size: 1.26rem; font-weight: 500; color: var(--gold); letter-spacing: 0.08em; margin-bottom: 2px; }
.intro__title {
  font-family: var(--font-en);
  font-weight: 700;
  font-size: clamp(2.7rem, 9.2vw, 4.1rem);
  line-height: 1.0;
  letter-spacing: 0.02em;
  color: var(--cream);
  text-shadow: 0 2px 26px rgba(0, 0, 0, 0.5);
}
.intro__title span { color: var(--coral); }
.intro__subtitle { font-size: 1.3rem; font-weight: 600; color: var(--leaf); margin-top: 14px; }
.intro__desc { font-weight: 300; font-size: 1.02rem; line-height: 1.9; color: var(--cream); opacity: 0.9; max-width: 442px; margin: 16px auto 28px; }
.intro .btn--primary { padding: 16px 50px; font-size: 1.08rem; }
.intro__note { font-weight: 300; font-size: 0.8rem; line-height: 1.75; color: var(--soft); max-width: 432px; margin: 28px auto 0; }

/* ============================================================
   Quiz
   ============================================================ */
.quiz { padding: 34px 34px 30px; }
.quiz__top { display: flex; align-items: center; gap: 16px; margin-bottom: 26px; }
.progress { flex: 1; height: 7px; background: rgba(255, 255, 255, 0.12); border-radius: 999px; overflow: hidden; }
.progress__bar { height: 100%; background: linear-gradient(90deg, var(--sun), var(--coral) 55%, var(--leaf)); border-radius: 999px; transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1); }
.quiz__count { font-family: var(--font-en); font-weight: 600; font-size: 1.08rem; color: var(--gold); white-space: nowrap; }
.quiz__count span { font-weight: 400; color: var(--soft); }

.quiz__question { font-weight: 600; font-size: clamp(1.24rem, 4.4vw, 1.52rem); line-height: 1.6; color: var(--cream); margin-bottom: 24px; }

.options { display: flex; flex-direction: column; gap: 12px; }
.option {
  display: flex;
  align-items: center;
  gap: 16px;
  text-align: left;
  width: 100%;
  padding: 15px 20px;
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  font-family: var(--font-th);
  color: var(--cream);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.15s, box-shadow 0.2s;
}
.option:hover { border-color: var(--gold); background: rgba(255, 210, 87, 0.12); transform: translateX(3px); box-shadow: 0 10px 24px -14px rgba(0, 0, 0, 0.7); }
.option__letter {
  flex: none;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 210, 87, 0.16);
  color: var(--gold);
  font-family: var(--font-en);
  font-weight: 700;
  font-size: 1.2rem;
  transition: background 0.2s, color 0.2s;
}
.option__text { font-weight: 300; font-size: 1.01rem; line-height: 1.55; }
.option--selected { border-color: var(--sun); background: linear-gradient(135deg, rgba(255, 210, 87, 0.22), rgba(255, 138, 80, 0.2)); }
.option--selected .option__letter { background: linear-gradient(135deg, var(--sun), var(--orange)); color: #3a1e10; }

.quiz__nav { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 26px; }
.quiz__nav .btn { padding: 12px 28px; font-size: 0.95rem; }
.quiz__dots { display: flex; gap: 7px; flex-wrap: wrap; justify-content: center; max-width: 200px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(255, 255, 255, 0.16); transition: background 0.25s, transform 0.25s; }
.dot--done { background: var(--sun); }
.dot--active { background: var(--coral); transform: scale(1.5); }

/* ============================================================
   Result — bloom glowing on the midnight garden
   ============================================================ */
.result { text-align: center; padding: 42px 40px 44px; }
.result__eyebrow { font-family: var(--font-en); font-style: italic; font-weight: 500; font-size: 1.22rem; letter-spacing: 0.06em; color: var(--gold); margin-bottom: 6px; }

.result__stage { width: min(94%, 430px); margin: 0 auto 6px; animation: bloomIn 1s cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes bloomIn { from { opacity: 0; transform: scale(0.92) translateY(10px); } to { opacity: 1; transform: none; } }

.result__garland { position: relative; height: 78px; margin: 0 auto -8px; z-index: 2; }
.garland__bloom { position: absolute; display: block; }
.garland__bloom .bloom-svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 3px 7px rgba(0,0,0,0.5)); }

.result__art { position: relative; padding: 4px 0 2px; }
.result__wash {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 96%;
  height: 92%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  /* warm halo so the bloom glows off the dark */
  background: radial-gradient(circle, rgba(255, 224, 150, 0.4) 0%, rgba(255, 150, 90, 0.16) 46%, transparent 72%);
  filter: blur(30px);
  z-index: 0;
}
.result__img {
  position: relative;
  z-index: 1;
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 56vh;
  margin: 0 auto;
  object-fit: contain;
  filter: drop-shadow(0 18px 26px rgba(0, 0, 0, 0.6)) drop-shadow(0 0 16px rgba(255, 244, 214, 0.14));
  opacity: 0;
  transform: scale(0.96);
  transition: opacity 0.8s ease, transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}
.result__img.is-loaded { opacity: 1; transform: scale(1); }

.result__name-en { font-family: var(--font-en); font-weight: 700; font-size: clamp(2.7rem, 9vw, 3.9rem); line-height: 1.05; color: var(--cream); letter-spacing: 0.015em; margin-top: 6px; text-shadow: 0 2px 20px rgba(0,0,0,0.5); }
.result__name-th { font-weight: 600; font-size: 1.45rem; color: var(--coral); margin-top: 4px; }

.result__flourish { display: flex; justify-content: center; margin: 16px 0 6px; }
.flourish-svg { width: 190px; height: auto; filter: drop-shadow(0 2px 5px rgba(0,0,0,0.5)); }

.chips { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 12px 0 22px; }
.chip { font-size: 0.88rem; font-weight: 400; color: var(--teal); background: rgba(87, 214, 194, 0.12); border: 1px solid rgba(87, 214, 194, 0.42); padding: 7px 17px; border-radius: 999px; }
.chip b { font-weight: 600; color: var(--cream); }

.result__prediction { font-weight: 300; font-size: 1.08rem; line-height: 2; color: var(--cream); opacity: 0.94; max-width: 480px; margin: 0 auto 30px; }
.result__actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.result__note { font-weight: 300; font-size: 0.8rem; line-height: 1.75; color: var(--soft); margin-top: 24px; }

/* ============================================================
   Footer
   ============================================================ */
.site-footer { position: relative; z-index: 1; margin-top: 34px; font-family: var(--font-en); font-style: italic; font-size: 0.94rem; letter-spacing: 0.05em; color: var(--leaf); opacity: 0.72; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 540px) {
  body { padding: 18px 12px 48px; }
  .intro { padding: 40px 24px 36px; }
  .quiz { padding: 26px 20px 24px; }
  .result { padding: 34px 20px 34px; }
  .option { padding: 14px 16px; gap: 13px; }
  .option__letter { width: 32px; height: 32px; font-size: 1.05rem; }
  .quiz__dots { max-width: 130px; }
  .quiz__nav .btn { padding: 11px 20px; }
  .result__img { max-height: 50vh; }
  .collage__f { margin: -10px -6px; }
}
