:root {
  --bg: #fbf8f3;
  --bg-2: #ffffff;
  --card: #ffffff;
  --card-2: #fffdf9;
  --line: #e8e2ee;
  --soft: #f3effa;
  --text: #1f1633;
  --muted: #6b6480;
  --gold: #f0bb1f;
  --gold-ink: #9a6b00;
  --pink: #d6336c;
  --blue: #1d8fc4;
  --good: #1fa55a;
  --bad: #e5484d;
  --shadow: 0 10px 30px rgba(60, 40, 90, .08);
  --radius: 18px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html, body { min-height: 100%; }

body {
  font-family: "Poppins", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, #fdebc8 0%, transparent 60%),
    radial-gradient(900px 500px at 110% 10%, #fbdce8 0%, transparent 55%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 50; width: 100%; height: 100%; }

.app { max-width: 720px; margin: 0 auto; padding: 32px 16px 64px; }

.screen { display: none; animation: fadeUp .45s ease both; }
.screen.active { display: block; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- START ---------- */
#screen-start { text-align: center; padding-top: 4vh; }
.logo { font-size: 48px; letter-spacing: 10px; margin-bottom: 8px; filter: drop-shadow(0 6px 14px rgba(240,187,31,.35)); }
h1 {
  font-family: "Cinzel", serif; font-weight: 800;
  font-size: clamp(38px, 8vw, 64px); line-height: 1.05;
  background: linear-gradient(90deg, #b07a00, #d98c00 45%, var(--pink));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
h1 em { font-style: normal; color: var(--text); -webkit-text-fill-color: var(--text); }
.tagline { color: var(--muted); margin: 16px auto 22px; max-width: 460px; line-height: 1.6; }

.chips { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 28px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: var(--card); border: 1px solid var(--line);
}
.chip.hp { color: var(--gold-ink); border-color: rgba(240,187,31,.55); background: #fff8e6; }
.chip.fr { color: var(--pink); border-color: rgba(214,51,108,.35); background: #fdf0f5; }
.chip.ss { color: var(--blue); border-color: rgba(29,143,196,.35); background: #eef8fd; }

.name-field { display: block; max-width: 360px; margin: 0 auto 22px; text-align: left; }
.name-field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.name-field input {
  width: 100%; padding: 14px 16px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--bg-2); color: var(--text);
  font: inherit; font-size: 16px; outline: none; transition: border-color .2s;
}
.name-field input:focus { border-color: var(--gold); }

.challenge-banner {
  margin: 0 auto 22px; max-width: 460px; padding: 12px 16px; border-radius: 12px;
  background: linear-gradient(90deg, #fff4d6, #fde6ef);
  border: 1px solid rgba(240,187,31,.55); font-weight: 500;
}

/* ---------- BUTTONS ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; font-size: 16px; cursor: pointer;
  padding: 14px 26px; border-radius: 999px; border: 0; color: #1b1400;
  transition: transform .15s, box-shadow .2s, opacity .2s;
}
.btn.primary { background: linear-gradient(90deg, var(--gold), #f7d35c); box-shadow: 0 8px 20px rgba(240,187,31,.35); }
.btn.primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(240,187,31,.5); }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.ghost:hover { border-color: var(--muted); }
.btn.big { font-size: 18px; padding: 16px 40px; }
.btn:disabled { opacity: .35; cursor: not-allowed; box-shadow: none; }

/* ---------- QUIZ ---------- */
.quiz-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.counter { color: var(--muted); font-weight: 500; font-size: 14px; }
.live-score { font-weight: 600; font-size: 14px; color: var(--gold-ink); }

.progress { height: 8px; border-radius: 99px; background: #ece6f2; overflow: hidden; margin-bottom: 22px; }
#progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), var(--pink)); transition: width .4s ease; }

.card {
  background: linear-gradient(180deg, var(--card-2), var(--card));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px 22px; margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.card h2 { font-size: clamp(19px, 3.6vw, 23px); font-weight: 600; line-height: 1.45; margin-bottom: 20px; }

.options { list-style: none; display: grid; gap: 12px; }
.option {
  position: relative; display: flex; align-items: center; gap: 14px;
  width: 100%; text-align: left; font: inherit; font-size: 16px; color: var(--text);
  padding: 15px 52px 15px 16px; border-radius: 14px; cursor: pointer;
  background: var(--bg-2); border: 1.5px solid var(--line);
  transition: border-color .2s, background .2s, transform .12s;
}
.option:hover:not(:disabled) { border-color: var(--gold); transform: translateX(3px); }
.option .letter {
  flex: none; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  font-weight: 700; font-size: 14px; background: var(--soft); color: var(--muted);
}
.option .mark {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%) scale(0);
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 800; font-size: 16px; color: #fff; transition: transform .3s cubic-bezier(.3,1.6,.5,1);
}
.option:disabled { cursor: default; }
.option.correct { border-color: var(--good); background: #eaf8f0; }
.option.correct .mark { background: var(--good); transform: translateY(-50%) scale(1); }
.option.correct .letter { background: var(--good); color: #fff; }
.option.wrong { border-color: var(--bad); background: #fdeeee; animation: shake .35s; }
.option.wrong .mark { background: var(--bad); transform: translateY(-50%) scale(1); }
.option.wrong .letter { background: var(--bad); color: #fff; }
.option.dim { opacity: .55; }

@keyframes shake { 25% { transform: translateX(-6px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-3px); } }

.fact {
  margin-top: 18px; padding: 12px 14px; border-radius: 12px; font-size: 14px; line-height: 1.55;
  background: #fff8e6; border-left: 3px solid var(--gold); color: #5c4710;
  animation: fadeUp .35s ease both;
}

#btn-next { width: 100%; }

/* ---------- RESULT ---------- */
.result-card {
  position: relative; overflow: hidden; text-align: center;
  border-radius: 24px; padding: 32px 22px 26px;
  background:
    radial-gradient(500px 240px at 50% 0%, rgba(240,187,31,.22), transparent 70%),
    linear-gradient(180deg, #fffaf0, #ffffff);
  border: 1px solid rgba(240,187,31,.55);
  box-shadow: 0 18px 40px rgba(60,40,90,.10);
}
.badge { font-size: 56px; line-height: 1; margin-bottom: 8px; animation: pop .6s cubic-bezier(.3,1.6,.5,1) both .2s; }
@keyframes pop { from { transform: scale(0) rotate(-20deg); } to { transform: none; } }
.r-name { color: var(--muted); font-weight: 500; }
.r-title {
  font-family: "Cinzel", serif; font-weight: 800; font-size: clamp(24px, 5vw, 32px); margin: 4px 0 14px;
  background: linear-gradient(90deg, #a87300, #d98c00, #a87300);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

.ring-wrap { position: relative; width: 200px; height: 200px; margin: 0 auto 14px; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 14; }
.ring-bg { stroke: #efe9f5; }
.ring-fg { stroke: var(--gold); stroke-linecap: round; transition: stroke-dashoffset 1.6s cubic-bezier(.2,.8,.2,1); }
.ring-text { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-text strong { font-size: 54px; font-weight: 700; line-height: 1; }
.ring-text span { color: var(--muted); font-size: 14px; }
.ring-text em { font-style: normal; font-weight: 700; color: var(--gold-ink); margin-top: 4px; }

.r-message { color: var(--text); line-height: 1.6; max-width: 460px; margin: 0 auto 22px; }

.bars { display: grid; gap: 14px; text-align: left; max-width: 480px; margin: 0 auto; }
.bar-row .bar-head { display: flex; justify-content: space-between; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.bar-track { height: 12px; border-radius: 99px; background: #efe9f5; overflow: hidden; }
.bar-fill { height: 100%; width: 0; border-radius: 99px; transition: width 1.3s cubic-bezier(.2,.8,.2,1); }

.share { margin-top: 26px; text-align: center; }
.share h3 { font-size: 18px; margin-bottom: 14px; }
.share-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.share-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 12px 6px; border-radius: 14px; cursor: pointer;
  background: var(--card); border: 1px solid var(--line); color: var(--text);
  font: inherit; font-size: 12.5px; font-weight: 500; transition: transform .15s, border-color .2s;
}
.share-btn:hover { transform: translateY(-3px); }
.share-btn span {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  font-size: 18px; font-weight: 800; color: #fff;
}
.share-btn.wa span { background: #25d366; }
.share-btn.fb span { background: #1877f2; font-family: Arial, sans-serif; font-size: 22px; }
.share-btn.li span { background: #0a66c2; font-family: Arial, sans-serif; font-size: 16px; }
.share-btn.ig span { background: radial-gradient(circle at 30% 110%, #fdf497 0%, #fd5949 45%, #d6249f 60%, #285aeb 90%); }
.share-btn.x span  { background: #000; }
.share-btn.tg span { background: #229ed9; }
.share-btn.rd span { background: #ff4500; }
.share-btn.sc span { background: #fffc00; border: 1px solid #e6e000; }
.share-btn.em span { background: #7b61ff; }
.share-btn.sms span { background: #34c759; }
.share-btn.cp span { background: #6b6480; }
.share-btn.dl span { background: var(--gold); }

.native-share { margin-top: 12px; }

.result-actions { display: flex; gap: 12px; justify-content: center; margin-top: 26px; flex-wrap: wrap; }

.review { margin-top: 26px; display: grid; gap: 10px; }
.review-item { padding: 14px 16px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); font-size: 14px; line-height: 1.5; }
.review-item b { display: block; margin-bottom: 4px; font-size: 15px; }
.review-item .ok { color: var(--good); }
.review-item .no { color: var(--bad); }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 30px); opacity: 0;
  background: #1f1633; color: #fff; padding: 12px 20px; border-radius: 999px; font-weight: 600; font-size: 14px;
  box-shadow: 0 10px 30px rgba(31,22,51,.25); transition: .3s; z-index: 60; max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 520px) {
  .app { padding-top: 20px; }
  .share-grid { grid-template-columns: repeat(3, 1fr); }
  .card { padding: 22px 16px; }
  .option { font-size: 15px; }
}

/* ---------- HUB (index.html) ---------- */
.hub-screen { text-align: center; padding-top: 4vh; }
.hub-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-top: 10px; text-align: left; }
.hub-card {
  display: flex; flex-direction: column; gap: 6px; padding: 22px 20px; border-radius: var(--radius);
  background: linear-gradient(180deg, var(--card-2), var(--card)); border: 1px solid var(--line);
  color: var(--text); text-decoration: none; transition: transform .15s, border-color .2s, box-shadow .2s;
}
.hub-card:hover { transform: translateY(-4px); box-shadow: 0 16px 32px rgba(60,40,90,.12); }
.hub-card.hp:hover { border-color: var(--gold); }
.hub-card.fr:hover { border-color: var(--pink); }
.hub-card.ss:hover { border-color: var(--blue); }
.hub-card.ul:hover { border-color: var(--gold); }
.hub-icon { font-size: 34px; margin-bottom: 4px; }
.hub-card strong { font-size: 18px; }
.hub-card small { color: var(--muted); font-size: 13px; }

/* ---------- MORE QUIZZES (result screen) ---------- */
.more-quizzes { margin-top: 34px; text-align: center; }
.more-quizzes h3 { font-size: 18px; margin-bottom: 14px; }
.more-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.more-card {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px 8px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--line); color: var(--text); text-decoration: none;
  font-size: 13.5px; font-weight: 600; transition: transform .15s, border-color .2s;
}
.more-card:hover { transform: translateY(-3px); border-color: var(--gold); }
.more-card span { font-size: 26px; }

@media (max-width: 520px) {
  .hub-grid { grid-template-columns: 1fr; }
  .more-grid { grid-template-columns: 1fr; }
  .more-card { flex-direction: row; justify-content: center; }
  .more-card span { font-size: 20px; }
}

/* ---------- FOOTER ---------- */
.site-footer { max-width: 720px; margin: 0 auto; padding: 8px 16px 40px; text-align: center; color: var(--muted); font-size: 12.5px; }
.site-footer nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; margin-bottom: 12px; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--gold-ink); }
.site-footer .disclaimer { line-height: 1.6; opacity: .75; max-width: 560px; margin: 0 auto; }

/* ---------- COOKIE BANNER ---------- */
.cookie-banner {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 70; max-width: 560px; margin: 0 auto;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: space-between;
  padding: 14px 16px; border-radius: 16px; background: #fff; color: #1b1430; border: 1px solid var(--line);
  box-shadow: 0 16px 40px rgba(31,22,51,.18); font-size: 14px; animation: fadeUp .35s ease both;
}
.cookie-banner p { flex: 1 1 240px; line-height: 1.5; }
.cookie-banner a { color: #5b3fd1; }
.cookie-actions { display: flex; gap: 8px; }
.cookie-banner .btn { padding: 10px 18px; font-size: 14px; }
.cookie-banner .btn.ghost { color: #1b1430; border-color: #cfc8e6; }

/* ---------- DOC PAGES (about, privacy…) ---------- */
.doc { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 24px; line-height: 1.7; }
.doc .back { display: inline-block; color: var(--muted); text-decoration: none; font-size: 14px; margin-bottom: 14px; }
.doc .back:hover { color: var(--gold-ink); }
.doc-title { font-size: clamp(30px, 6vw, 42px); margin-bottom: 18px; }
.doc h2 { font-size: 18px; margin: 26px 0 8px; color: var(--gold-ink); }
.doc p, .doc ul { margin-bottom: 12px; color: #3b3450; }
.doc ul { padding-left: 22px; }
.doc a { color: var(--gold-ink); }
.doc code { background: var(--bg-2); padding: 1px 6px; border-radius: 6px; font-size: 13px; }
.doc .muted { color: var(--muted); font-size: 14px; }
.contact-box { font-size: 20px; font-weight: 600; padding: 18px; border-radius: 14px; background: var(--bg-2); text-align: center; }

/* ---------- AD SLOTS ---------- */
.ad-slot { margin: 26px auto 0; max-width: 480px; text-align: center; }
.ad-slot[hidden] { display: none; }
.ad-placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 250px; border: 2px dashed #d9d1e4; border-radius: 14px;
  background: repeating-linear-gradient(45deg, rgba(107,100,128,.04) 0 12px, transparent 12px 24px);
  color: var(--muted); font-size: 13px; letter-spacing: .08em; text-transform: uppercase;
}
.ad-placeholder small { font-size: 12px; opacity: .7; letter-spacing: 0; }
.ad-slot[data-ad="result"].ad-placeholder { min-height: 280px; }
.ad-slot[data-ad="home"] { max-width: 728px; margin-top: 30px; }
.ad-slot[data-ad="home"].ad-placeholder { min-height: 90px; }
#screen-start .ad-slot { margin-top: 34px; }

/* Sticky bottom banner: phones only */
.ad-sticky { display: none; }
@media (max-width: 767px) {
  .ad-sticky {
    display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: var(--bg); border-top: 1px solid var(--line); padding: 5px 0;
  }
  .ad-sticky .ad-slot { margin: 0 auto; max-width: 320px; }
  .ad-sticky .ad-placeholder { min-height: 50px; border-width: 1px; flex-direction: row; gap: 8px; }
  body:has(.ad-sticky) .site-footer { padding-bottom: 90px; }
  body:has(.ad-sticky) .toast { bottom: 80px; }
}

/* ---------- HUB v2: grouped, many quizzes ---------- */
.app-wide { max-width: 1000px; }
.hub-group { text-align: left; font-size: 20px; margin: 34px 0 12px; display: flex; align-items: center; gap: 10px; }
.hub-group::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.hub-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.hub-card { --accent: var(--gold); position: relative; overflow: hidden; }
.hub-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--accent); opacity: .8; }
.hub-card:hover { border-color: var(--accent); }
.all-quizzes { margin-top: 14px; }
@media (max-width: 520px) { .hub-grid { grid-template-columns: 1fr; } }

/* ---------- LIGHT THEME polish ---------- */
.hub-card, .more-card, .share-btn, .doc, .option { box-shadow: 0 2px 8px rgba(60,40,90,.05); }
.hub-card { background: #fff; }
.option:hover:not(:disabled) { border-color: var(--gold); background: #fffcf2; }
.review-item { background: #fff; }
.ad-sticky { box-shadow: 0 -4px 16px rgba(60,40,90,.08); }
.cookie-banner .btn.ghost { background: #fff; }

/* ---------- ADS v2: native, side rails, desktop sticky ---------- */
.ad-native { margin: 26px auto 0; max-width: 720px; }
.ad-native:empty { display: none; }
.ad-slot.ad-live { min-height: 0; }

.ad-rail { display: none; }
@media (min-width: 1200px) {
  .ad-rail { display: block; position: fixed; top: 90px; width: 160px; z-index: 30; }
  .ad-rail-left  { left: calc(50% - 360px - 190px); }
  .ad-rail-right { right: calc(50% - 360px - 190px); }
  .ad-rail .ad-slot { margin: 0; }
  .ad-rail .ad-placeholder { min-height: 600px; }
}
/* Home page is wider: rails only when there's room */
body:not([data-quiz]) .ad-rail { display: none; }
@media (min-width: 1400px) {
  body:not([data-quiz]) .ad-rail { display: block; }
  body:not([data-quiz]) .ad-rail-left  { left: calc(50% - 500px - 185px); }
  body:not([data-quiz]) .ad-rail-right { right: calc(50% - 500px - 185px); }
}

/* Sticky bottom banner on desktop too (728x90) */
@media (min-width: 768px) {
  .ad-sticky {
    display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: var(--bg); border-top: 1px solid var(--line); padding: 5px 0;
  }
  .ad-sticky .ad-slot { margin: 0 auto; max-width: 728px; }
  .ad-sticky .ad-placeholder { min-height: 90px; border-width: 1px; }
  body:has(.ad-sticky) .site-footer { padding-bottom: 130px; }
  body:has(.ad-sticky) .toast { bottom: 120px; }
}
