:root {
  --ink: #1d1442;
  --bg: #fff7e8;
  --purple: #7b4dff;
  --pink: #ff4f9a;
  --yellow: #ffd23f;
  --teal: #12c2b0;
  --green: #18b86b;
  --card: #ffffff;
  --shadow: 0 6px 0 var(--ink);
  --radius: 22px;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  font-family: "Nunito", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Background blobs */
.blobs span {
  position: fixed; z-index: -1; border-radius: 50%; filter: blur(2px); opacity: .55;
  animation: float 14s ease-in-out infinite;
}
.blobs span:nth-child(1) { width: 380px; height: 380px; background: var(--yellow); top: -120px; left: -100px; }
.blobs span:nth-child(2) { width: 300px; height: 300px; background: var(--pink); bottom: -90px; right: -60px; animation-delay: -5s; }
.blobs span:nth-child(3) { width: 220px; height: 220px; background: var(--teal); top: 40%; right: 12%; opacity: .35; animation-delay: -9s; }
@keyframes float { 50% { transform: translate(30px, 24px) scale(1.06); } }

main { max-width: 860px; margin: 0 auto; padding: 28px 18px 40px; }

.screen { display: none; animation: pop .35s ease; }
.screen.active { display: block; }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.98); } }

h1, h2, h3, .logo, .btn, .pill { font-family: "Fredoka", "Nunito", sans-serif; }

.logo { font-size: 30px; font-weight: 700; letter-spacing: -.5px; }
.logo span { background: var(--purple); color: #fff; padding: 0 10px; border-radius: 12px; margin-left: 4px; display: inline-block; transform: rotate(-4deg); }
.small-logo { font-size: 22px; }

h1 { font-size: clamp(38px, 7vw, 62px); line-height: 1.02; margin: 26px 0 14px; }
h1 em { font-style: normal; color: var(--pink); text-decoration: underline wavy var(--yellow) 5px; text-underline-offset: 8px; }
h2 { font-size: clamp(24px, 4.4vw, 32px); margin: 18px 0 10px; }
h3 { font-size: 22px; margin: 0 0 12px; }

.lead { font-size: 19px; line-height: 1.5; max-width: 640px; }
.small { font-size: 15px; opacity: .75; }
.eyebrow { font-weight: 800; text-transform: uppercase; letter-spacing: 2px; color: var(--purple); margin: 22px 0 0; }

.tag-most { background: var(--green); color: #fff; padding: 0 8px; border-radius: 8px; }
.tag-least { background: var(--pink); color: #fff; padding: 0 8px; border-radius: 8px; }

.facts { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 12px; margin: 22px 0 28px; }
.facts li { background: #fff; border: 3px solid var(--ink); border-radius: 999px; padding: 8px 16px; font-weight: 800; box-shadow: 0 4px 0 var(--ink); }
.facts span { margin-right: 6px; }

/* Buttons */
.btn {
  font-size: 20px; font-weight: 600; border: 3px solid var(--ink); background: var(--purple); color: #fff;
  border-radius: 16px; padding: 12px 26px; cursor: pointer; box-shadow: var(--shadow);
  transition: transform .12s, box-shadow .12s, opacity .2s;
}
.btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 0 var(--ink); }
.btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 2px 0 var(--ink); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.big { font-size: 26px; padding: 16px 40px; background: var(--pink); }
.btn.ghost { background: #fff; color: var(--ink); font-size: 17px; }

.actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 22px; flex-wrap: wrap; }
.actions.center { justify-content: center; }

/* Quiz */
.topbar { display: flex; align-items: center; gap: 14px; }
.progress { flex: 1; height: 18px; background: #fff; border: 3px solid var(--ink); border-radius: 999px; overflow: hidden; }
#progressFill { height: 100%; width: 0; background: repeating-linear-gradient(45deg, var(--teal), var(--teal) 12px, #0fae9e 12px, #0fae9e 24px); transition: width .5s ease; }
.round-label { font-weight: 800; white-space: nowrap; }

.step-hint { margin: 6px 0 16px; min-height: 40px; }
.pill { display: inline-block; font-size: 18px; font-weight: 600; padding: 6px 16px; border-radius: 999px; border: 3px solid var(--ink); color: #fff; }
.pill.most { background: var(--green); }
.pill.least { background: var(--pink); }
.pill.done { background: var(--purple); }

.cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.card {
  position: relative; background: var(--card); border: 3px solid var(--ink); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 16px; text-align: left; cursor: pointer; font: inherit; color: inherit;
  display: flex; align-items: center; gap: 14px; min-height: 108px;
  transition: transform .15s, background .2s, box-shadow .15s;
  animation: deal .4s ease backwards;
}
.card:nth-child(2) { animation-delay: .06s; } .card:nth-child(3) { animation-delay: .12s; } .card:nth-child(4) { animation-delay: .18s; }
@keyframes deal { from { opacity: 0; transform: translateY(30px) rotate(-3deg); } }
.card:hover { transform: translateY(-3px) rotate(-.6deg); }
.card:focus-visible { outline: 4px solid var(--yellow); outline-offset: 3px; }
.card .emoji { font-size: 40px; line-height: 1; flex-shrink: 0; }
.card .text { font-size: 19px; font-weight: 800; line-height: 1.25; }
.card.most { background: #d9fbe9; border-color: var(--green); box-shadow: 0 6px 0 var(--green); }
.card.least { background: #ffe0ee; border-color: var(--pink); box-shadow: 0 6px 0 var(--pink); }
.card.dim { opacity: .55; }
.card .badge {
  position: absolute; top: -14px; right: -10px; font-family: "Fredoka", sans-serif; font-weight: 600;
  font-size: 15px; color: #fff; padding: 4px 12px; border-radius: 999px; border: 3px solid var(--ink);
  transform: rotate(6deg); animation: stamp .25s ease;
}
.card.most .badge { background: var(--green); }
.card.least .badge { background: var(--pink); }
@keyframes stamp { from { transform: scale(1.8) rotate(-10deg); opacity: 0; } }

/* Picture rounds */
.cards.pictures .card { flex-direction: column; justify-content: center; text-align: center; min-height: 190px; }
.cards.pictures .card .emoji { font-size: 76px; filter: drop-shadow(0 4px 0 rgba(29,20,66,.15)); }
.cards.pictures .card .text { font-size: 18px; }

/* Loading */
#loading { text-align: center; padding-top: 18vh; }
.spinner span { display: inline-block; font-size: 80px; animation: flip 1s ease-in-out infinite; }
@keyframes flip { 50% { transform: rotateY(180deg) scale(1.1); } }
#loadingText { font-size: 22px; font-weight: 800; }

/* Results */
.type-badges { display: flex; gap: 14px; flex-wrap: wrap; margin: 20px 0; }
.type-badge { flex: 1 1 220px; border: 3px solid var(--ink); border-radius: var(--radius); padding: 16px; color: #fff; box-shadow: var(--shadow); }
.type-badge .big-emoji { font-size: 38px; }
.type-badge strong { display: block; font-family: "Fredoka", sans-serif; font-size: 24px; }
.type-badge p { margin: 6px 0 0; font-weight: 700; }

.panel { background: #fff; border: 3px solid var(--ink); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin: 22px 0; }
.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 130px 1fr 44px; align-items: center; gap: 10px; font-weight: 800; }
.bar-track { height: 22px; border: 3px solid var(--ink); border-radius: 999px; background: #f4efff; overflow: hidden; }
.bar-fill { height: 100%; width: 0; transition: width 1s cubic-bezier(.2,.9,.3,1.2); }

.section-title { font-size: 28px; margin-top: 30px; }
.picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.pick { background: #fff; border: 3px solid var(--ink); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); animation: deal .45s ease backwards; }
.pick h4 { font-family: "Fredoka", sans-serif; font-size: 21px; margin: 0 0 4px; }
.pick .area { display: inline-block; font-size: 13px; font-weight: 800; background: var(--yellow); border-radius: 999px; padding: 2px 10px; margin-bottom: 8px; }
.pick .why { margin: 6px 0 10px; font-weight: 700; }
.pick .desc { margin: 0 0 8px; opacity: .8; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips span { font-size: 12.5px; font-weight: 700; background: #eee8ff; border-radius: 999px; padding: 3px 9px; }
.chips-label { font-size: 13px; font-weight: 800; margin: 8px 0 4px; }

.next-step { background: #e6fffa; }
.more summary { font-family: "Fredoka", sans-serif; font-size: 20px; font-weight: 600; cursor: pointer; }
.more-list { display: grid; gap: 10px; margin-top: 14px; }
.more-item { border-top: 2px dashed #ddd; padding-top: 10px; }
.more-item strong { font-size: 17px; }
.more-item .chips { margin-top: 6px; }

footer { text-align: center; font-size: 13px; opacity: .6; padding: 10px 18px 30px; }

/* Confetti */
#confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 10; }
#confetti i { position: absolute; top: -20px; width: 12px; height: 18px; border-radius: 3px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

@media (max-width: 560px) {
  .cards { grid-template-columns: 1fr; gap: 14px; }
  .cards.pictures { grid-template-columns: repeat(2, 1fr); }
  .cards.pictures .card { min-height: 160px; padding: 14px 10px; }
  .cards.pictures .card .emoji { font-size: 58px; }
  .cards.pictures .card .text { font-size: 15.5px; }
  .card { min-height: 84px; }
  .bar-row { grid-template-columns: 100px 1fr 40px; font-size: 15px; }
  .actions .btn { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media print {
  .blobs, footer, .actions, #confetti { display: none !important; }
  body { background: #fff; }
  .screen { display: none !important; }
  #results { display: block !important; }
  .more[open], .more { display: block; }
  .pick, .panel, .type-badge { box-shadow: none; break-inside: avoid; }
}
