:root {
  --walnut: #2A170E;
  --walnut-2: #3A2214;
  --cranberry: #8E1F2F;
  --pumpkin: #E8871E;
  --gold: #F5C242;
  --olive: #5B6B2E;
  --cream: #FFF4DC;
  --ink: #2A170E;
  --muted: #6D5646;
  --radius: 20px;
  --display: "Fraunces", "Georgia", "Times New Roman", serif;
  --body: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: var(--body);
  color: var(--cream);
  background:
    radial-gradient(900px 500px at 50% -10%, #5A2E17 0%, transparent 70%),
    radial-gradient(700px 400px at 100% 100%, #4A1620 0%, transparent 70%),
    var(--walnut);
  overflow-x: hidden;
}

button { font: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

/* ---------- Top bar ---------- */
.topbar { position: relative; z-index: 2; padding: 18px 24px; }
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--cream); text-decoration: none;
  font-family: var(--display); font-weight: 900; font-size: 1.2rem;
}
.brand-icon { font-size: 1.5rem; }

main { position: relative; z-index: 2; flex: 1; display: flex; justify-content: center; padding: 8px 20px 32px; }
.screen { display: none; width: 100%; max-width: 640px; }
.screen.is-active { display: block; }

/* ---------- Hero ---------- */
.hero { text-align: center; padding-top: 4px; }
.turkey { width: min(360px, 82vw); height: auto; display: block; margin: 0 auto -6px; overflow: visible; }

.feather {
  transform-box: view-box;
  transform-origin: 200px 232px;
  animation: fan 900ms cubic-bezier(.2, 1.4, .4, 1) both;
  animation-delay: var(--d);
}
@keyframes fan {
  from { transform: rotate(0deg) scale(.85); opacity: .0; }
  to   { transform: rotate(var(--a)) scale(1); opacity: 1; }
}
.feather { transform: rotate(var(--a)); }
.bird { animation: bob 3.2s ease-in-out 1.4s infinite; transform-box: fill-box; transform-origin: center bottom; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }

.title {
  margin: 8px 0 12px;
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(2.8rem, 11vw, 4.8rem);
  line-height: .98;
  letter-spacing: -0.02em;
  color: var(--cream);
  text-shadow: 3px 3px 0 var(--cranberry), 6px 6px 0 var(--pumpkin);
}
.lede { margin: 0 auto 28px; max-width: 30ch; font-size: 1.2rem; line-height: 1.5; color: #F1DDB8; }

/* ---------- Buttons ---------- */
.btn {
  border: 0; border-radius: 999px;
  padding: 16px 34px; font-weight: 700; font-size: 1.1rem;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn-primary {
  background: var(--pumpkin); color: var(--walnut);
  box-shadow: 0 5px 0 #A45A0C, 0 12px 24px rgba(0,0,0,.35);
}
.btn-primary:hover { transform: translateY(-2px); background: #F29A33; }
.btn-primary:active { transform: translateY(3px); box-shadow: 0 2px 0 #A45A0C; }
.btn-ghost { background: transparent; color: var(--ink); border: 2px solid var(--ink); }
.btn-ghost:hover { background: rgba(42,23,14,.08); }

.counter { margin: 30px 0 0; display: inline-flex; align-items: baseline; gap: 10px; flex-wrap: wrap; justify-content: center;
  padding: 10px 20px; border-radius: 999px; background: rgba(255,244,220,.08); border: 1px solid rgba(255,244,220,.18); }
.counter-num { font-family: var(--display); font-weight: 900; font-size: 1.6rem; color: var(--gold); font-variant-numeric: tabular-nums; }
.counter-label { color: #F1DDB8; }

/* ---------- Card ---------- */
.card {
  background: var(--cream); color: var(--ink);
  border-radius: var(--radius); padding: 28px;
  box-shadow: 0 24px 60px rgba(0,0,0,.45);
  border-top: 8px solid var(--pumpkin);
}

/* ---------- Quiz ---------- */
.progress-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.progress-text { font-weight: 700; color: var(--muted); }
.btn-back { background: none; border: 0; color: var(--cranberry); font-weight: 700; padding: 6px 4px; }
.btn-back[hidden] { visibility: hidden; display: inline; }
.progress { height: 10px; border-radius: 99px; background: #E8D8B6; overflow: hidden; margin-bottom: 26px; }
.progress-fill { height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--cranberry), var(--pumpkin), var(--gold)); transition: width .35s ease; }

.question { margin: 0 0 22px; font-family: var(--display); font-weight: 700; font-size: clamp(1.4rem, 5vw, 1.85rem); line-height: 1.25; outline: none; }

.options { display: grid; gap: 12px; }
.option {
  text-align: left; width: 100%;
  padding: 16px 18px; border-radius: 14px;
  background: #fff; color: var(--ink);
  border: 2px solid #E3D2AE; font-size: 1.05rem; line-height: 1.4;
  transition: border-color .15s, background .15s, transform .15s, box-shadow .15s;
}
.option:hover { border-color: var(--pumpkin); transform: translateX(4px); box-shadow: -5px 0 0 var(--pumpkin); }
.option.is-selected { border-color: var(--cranberry); background: #FBE7D6; box-shadow: -5px 0 0 var(--cranberry); font-weight: 700; }
.option-enter { animation: slideIn .35s ease both; }
@keyframes slideIn { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }

/* ---------- Loading ---------- */
.loading { text-align: center; padding: 80px 0; font-family: var(--display); font-size: 1.5rem; }
.spinner { font-size: 4rem; display: inline-block; animation: spin 1.2s linear infinite; margin-bottom: 14px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Result ---------- */
.result-card { text-align: center; border-top-color: var(--cranberry); animation: pop .6s cubic-bezier(.2, 1.3, .4, 1) both; }
@keyframes pop { from { opacity: 0; transform: scale(.92) translateY(14px); } to { opacity: 1; transform: none; } }
.result-badge {
  width: 112px; height: 112px; margin: -70px auto 12px; border-radius: 50%;
  display: grid; place-items: center; font-size: 3.6rem;
  background: radial-gradient(circle at 30% 30%, var(--gold), var(--pumpkin));
  border: 6px solid var(--cream); box-shadow: 0 10px 24px rgba(0,0,0,.35);
}
.result-title { margin: 0 0 10px; font-family: var(--display); font-weight: 900; font-size: clamp(1.9rem, 7vw, 2.6rem); line-height: 1.05; color: var(--cranberry); outline: none; }
.result-subtitle { margin: 0 auto 16px; max-width: 46ch; font-size: 1.15rem; line-height: 1.5; }
.chips { list-style: none; margin: 0 0 26px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chips li { padding: 6px 14px; border-radius: 99px; background: var(--olive); color: var(--cream); font-weight: 700; font-size: .95rem; }

.section-h { margin: 0 0 12px; font-family: var(--display); font-size: 1.15rem; color: var(--ink); }
.skills { list-style: none; margin: 0 0 24px; padding: 0; display: grid; gap: 10px; text-align: left; }
.skills li { padding: 14px 16px; border-radius: 12px; background: #fff; border: 2px solid #E8D8B6; border-left: 8px solid var(--pumpkin); line-height: 1.45; }
.skills li:nth-child(2) { border-left-color: var(--gold); }
.skills li:nth-child(3) { border-left-color: var(--olive); }
.skills strong { color: var(--cranberry); }
.skills em { font-style: italic; font-weight: 700; }

.grateful { padding: 18px; border-radius: 14px; background: #F6E3B8; margin-bottom: 26px; }
.grateful p { margin: 0; font-size: 1.1rem; line-height: 1.5; font-family: var(--display); font-weight: 700; }

.result-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.result-actions .btn-primary { background: var(--cranberry); color: var(--cream); box-shadow: 0 5px 0 #5A111C; }
.result-actions .btn-primary:hover { background: #A5263A; }
.share-note { min-height: 1.4em; margin: 12px 0 0; color: var(--olive); font-weight: 700; }
.result-count { margin: 4px 0 0; color: var(--muted); font-size: .95rem; }
.result-count span { font-weight: 700; font-variant-numeric: tabular-nums; }

.error-card { text-align: center; }
.error-card h2 { font-family: var(--display); margin-top: 0; color: var(--cranberry); }

.footer { position: relative; z-index: 2; text-align: center; padding: 14px; color: #BFA583; font-size: .9rem; }

/* ---------- Falling leaves ---------- */
.leaves { position: fixed; inset: 0; pointer-events: none; z-index: 1; overflow: hidden; }
.leaf { position: absolute; top: -10vh; font-size: var(--s); opacity: .5; animation: fall var(--t) linear var(--dl) infinite; }
@keyframes fall {
  0%   { transform: translate3d(0,-10vh,0) rotate(0deg); }
  50%  { transform: translate3d(var(--x),55vh,0) rotate(180deg); }
  100% { transform: translate3d(calc(var(--x) * -.5),115vh,0) rotate(360deg); }
}
.burst { position: fixed; top: 0; font-size: 1.6rem; pointer-events: none; z-index: 5; animation: burst 2.4s ease-in forwards; }
@keyframes burst { from { transform: translateY(-10vh) rotate(0); opacity: 1; } to { transform: translateY(105vh) rotate(540deg); opacity: .9; } }

@media (max-width: 480px) {
  .card { padding: 22px 18px; }
  .btn { padding: 15px 28px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .feather { transform: rotate(var(--a)); opacity: 1; }
  .leaves { display: none; }
}
