:root {
  --bg: #fbf7f2;
  --surface: #ffffff;
  --ink: #1f2a24;
  --muted: #5f6b64;
  --line: #e7e0d6;
  --brand: #b3261e;
  --brand-ink: #ffffff;
  --accent: #1f5c46;
  --chip: #f2ece4;
  --chip-on: #1f5c46;
  --gold: #c99a2e;
  --shadow: 0 1px 2px rgba(30, 30, 20, .06), 0 8px 24px rgba(30, 30, 20, .06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121714; --surface: #1a211d; --ink: #eef2ee; --muted: #9eaba3; --line: #2b352f;
    --brand: #e0574d; --chip: #232c27; --chip-on: #3f9b78; --accent: #6fd0a8; --gold: #e2b955;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: Inter, system-ui, sans-serif; background: var(--bg); color: var(--ink);
  line-height: 1.5; -webkit-font-smoothing: antialiased;
}
h1, h2, h3, legend, .logo { font-family: Fraunces, Georgia, serif; }
button { font: inherit; cursor: pointer; }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); width: 100%;
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; margin-top: 6px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.top { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; max-width: 1100px; margin: 0 auto; }
.logo { font-size: 1.4rem; font-weight: 800; color: var(--ink); text-decoration: none; }
.logo span { color: var(--brand); }
.link-btn { background: none; border: 0; color: var(--ink); font-weight: 600; padding: 6px 8px; }
#shortlistCount { background: var(--brand); color: var(--brand-ink); border-radius: 99px; padding: 0 7px; font-size: .8rem; margin-left: 2px; }

.view { display: none; max-width: 1100px; margin: 0 auto; padding: 8px 16px 48px; }
.view.active { display: block; }

.hero { text-align: center; padding: 56px 0 24px; max-width: 640px; margin: 0 auto; }
.eyebrow { display: inline-block; background: var(--chip); color: var(--accent); font-weight: 600; font-size: .85rem; padding: 4px 12px; border-radius: 99px; margin: 0 0 16px; }
.hero h1 { font-size: clamp(2.2rem, 7vw, 3.6rem); line-height: 1.05; margin: 0 0 16px; letter-spacing: -.02em; }
.lede { font-size: 1.15rem; color: var(--muted); margin: 0 0 28px; }
.tiny { font-size: .85rem; color: var(--muted); }
.quick { text-align: center; max-width: 720px; margin: 8px auto 0; }
.quick .chips { justify-content: center; }

.btn { border: 0; border-radius: 12px; padding: 12px 20px; font-weight: 600; transition: transform .1s, opacity .2s; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--brand); color: var(--brand-ink); }
.btn.ghost { background: var(--chip); color: var(--ink); }
.btn.big { font-size: 1.1rem; padding: 16px 32px; }
.btn[disabled] { opacity: .5; cursor: default; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
.quiz-card { max-width: 640px; margin: 24px auto; padding: 0 0 20px; overflow: hidden; }
.quiz-card form { padding: 24px 24px 0; }
.progress { height: 6px; background: var(--chip); }
.progress .bar { height: 100%; width: 25%; background: var(--accent); transition: width .3s; }
fieldset { border: 0; padding: 0; margin: 0; display: none; }
fieldset.active { display: block; }
legend { font-size: 1.6rem; font-weight: 800; margin-bottom: 14px; padding: 0; }
label { display: block; font-weight: 600; margin: 16px 0 4px; }
.label { font-weight: 600; margin: 16px 0 8px; }
.opt, .hint { font-weight: 400; color: var(--muted); font-size: .9rem; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button {
  background: var(--chip); color: var(--ink); border: 1px solid transparent; border-radius: 99px;
  padding: 8px 14px; font-size: .92rem; transition: background .15s, color .15s;
}
.chips button:hover { border-color: var(--line); }
.chips button.on { background: var(--chip-on); color: #fff; }

.nav { display: flex; justify-content: space-between; margin-top: 24px; }
.error { color: var(--brand); font-weight: 500; min-height: 1.2em; margin: 12px 0 0; }
.error.center { text-align: center; }

.results-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 16px 0 12px; }
.results-head h2 { font-size: clamp(1.6rem, 5vw, 2.3rem); margin: 0; line-height: 1.1; }
.results-head p { margin: 6px 0 0; }
.actions { display: flex; gap: 8px; }
.filter { margin-bottom: 16px; }
.notice { background: var(--chip); border-left: 4px solid var(--gold); padding: 10px 14px; border-radius: 8px; font-size: .92rem; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.gift { position: relative; padding: 18px; display: flex; flex-direction: column; gap: 8px; animation: pop .35s ease both; }
.gift.wow { border-color: var(--gold); }
.gift .badge { position: absolute; top: 14px; right: 50px; background: var(--gold); color: #1f1a0e; font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; text-transform: uppercase; letter-spacing: .04em; }
.gift .emoji { font-size: 2.2rem; line-height: 1; }
.gift h3 { margin: 4px 0 0; font-size: 1.15rem; line-height: 1.25; }
.gift .cat { font-size: .78rem; color: var(--accent); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.gift p { margin: 0; color: var(--muted); font-size: .94rem; flex: 1; }
.gift .buy { text-align: center; text-decoration: none; margin-top: 6px; }
.heart { position: absolute; top: 10px; right: 10px; background: var(--chip); border: 0; width: 34px; height: 34px; border-radius: 50%; font-size: 1rem; color: var(--muted); }
.heart.on { color: var(--brand); }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Star Of Mine feature */
.star-feature {
  grid-column: 1 / -1; position: relative; overflow: hidden; border-radius: 22px; color: #eef0ff;
  background: radial-gradient(120% 140% at 85% 20%, #2b3a78 0%, #141a3d 45%, #0a0d22 100%);
  display: grid; grid-template-columns: 1.3fr 1fr; gap: 24px; padding: 32px; box-shadow: 0 12px 40px rgba(20, 26, 70, .35);
  animation: pop .5s ease both;
}
.sky { position: absolute; inset: 0; pointer-events: none; }
.sky i { position: absolute; width: var(--s); height: var(--s); border-radius: 50%; background: #fff; opacity: .7; animation: twinkle 3s ease-in-out infinite; animation-delay: var(--d); }
@keyframes twinkle { 0%, 100% { opacity: .2; } 50% { opacity: 1; } }
.shoot { position: absolute; top: 12%; left: -10%; width: 120px; height: 2px; background: linear-gradient(90deg, transparent, #fff); transform: rotate(-18deg); animation: shoot 7s ease-in 2s infinite; opacity: 0; }
@keyframes shoot { 0% { opacity: 0; transform: translate(0, 0) rotate(-18deg); } 3% { opacity: 1; } 12% { opacity: 0; transform: translate(70vw, -22vh) rotate(-18deg); } 100% { opacity: 0; } }
.star-copy, .cert { position: relative; }
.star-badge { display: inline-block; background: rgba(255, 214, 120, .15); color: #ffd678; border: 1px solid rgba(255, 214, 120, .4); font-size: .8rem; font-weight: 600; padding: 4px 12px; border-radius: 99px; }
.star-feature h3 { font-size: clamp(1.6rem, 4vw, 2.3rem); line-height: 1.1; margin: 14px 0 10px; color: #fff; }
.star-feature p { color: #c9cdf0; font-size: 1.05rem; margin: 0 0 14px; }
.star-feature ul { list-style: none; padding: 0; margin: 0 0 20px; display: grid; gap: 6px; }
.star-feature li::before { content: "✦"; color: #ffd678; margin-right: 8px; }
.star-cta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.star-btn { background: linear-gradient(135deg, #ffd678, #f2a93b); color: #1b1640; text-decoration: none; font-size: 1.05rem; padding: 14px 24px; box-shadow: 0 0 24px rgba(255, 200, 90, .45); }
.star-btn:hover { box-shadow: 0 0 36px rgba(255, 200, 90, .7); }
.from { color: #c9cdf0; font-size: .9rem; }
.from b { color: #fff; }
.cert { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; }
.glow { width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle, rgba(255, 230, 160, .9) 0%, rgba(255, 200, 90, .25) 40%, transparent 70%); animation: pulse 3s ease-in-out infinite; }
.glow span { font-size: 2.4rem; color: #fff; text-shadow: 0 0 18px #ffd678; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.12); } }
.cert-card { background: #fbf6e9; color: #2a2346; border-radius: 6px; padding: 16px 22px; text-align: center; min-width: 230px; border: 3px double #c99a2e; transform: rotate(-2deg); box-shadow: 0 10px 30px rgba(0, 0, 0, .4); }
.cert-card small { display: block; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: #6b6488; }
.cert-card strong { display: block; font-family: "Dancing Script", Fraunces, cursive; font-size: 2.2rem; line-height: 1.2; margin: 4px 0; color: #1b1640; }
.cert em { font-size: .75rem; color: #8f95c4; }
.more-divider { grid-column: 1 / -1; text-align: center; color: var(--muted); font-weight: 600; margin: 8px 0 -4px; }
.more-divider span { background: var(--bg); padding: 0 12px; }

.loading { text-align: center; padding: 40px 0; color: var(--muted); }
.spinner { width: 40px; height: 40px; border: 4px solid var(--chip); border-top-color: var(--brand); border-radius: 50%; margin: 0 auto 12px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.pager { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 28px; }
.pager button { min-width: 44px; }
.pager .cur { background: var(--accent); color: #fff; }

.drawer { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: none; z-index: 20; }
.drawer.open { display: block; }
.drawer-inner { position: absolute; right: 0; top: 0; bottom: 0; width: min(420px, 100%); background: var(--bg); padding: 20px; overflow-y: auto; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; }
.drawer-head h3 { margin: 0; font-size: 1.4rem; }
.sl-item { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.sl-item .emoji { font-size: 1.6rem; }
.sl-item a { color: var(--ink); font-weight: 600; }
.sl-item .who { color: var(--muted); font-size: .85rem; }
.sl-item button { margin-left: auto; }

footer { max-width: 1100px; margin: 0 auto; padding: 24px 16px 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: .82rem; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(80px); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 10px; transition: transform .25s; z-index: 30; }
.toast.show { transform: translateX(-50%) translateY(0); }

@media (max-width: 520px) {
  .row { grid-template-columns: 1fr; gap: 0; }
  .quiz-card form { padding: 20px 16px 0; }
  .hero { padding-top: 32px; }
  .logo { font-size: 1.1rem; white-space: nowrap; }
  .sl-label { display: none; }
  .top { padding: 14px 16px; }
  .filter { flex-wrap: nowrap; overflow-x: auto; margin-right: -16px; padding-right: 16px; scrollbar-width: none; }
  .filter button { flex: none; }
  .star-feature { grid-template-columns: 1fr; padding: 24px 18px; }
  .cert { order: -1; }
  .star-btn { width: 100%; text-align: center; }
}
