:root {
  --primary: #4c1bb8;
  --primary-dark: #33088a;
  --coral: #e9545e;
  --ink: #1d1340;
  --muted: #6b6485;
  --bg: #fcfbfa;
  --card: #ffffff;
  --line: #e9e4f5;
  --c1: #4c1bb8;
  --c2: #8a4dff;
  --radius: 22px;
  --shadow: 0 10px 30px rgba(76, 27, 184, 0.14);
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg);
  line-height: 1.5; min-height: 100vh; display: flex; flex-direction: column;
}
img { max-width: 100%; height: auto; }
a { color: var(--primary); }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .5em; }
h1 { font-size: clamp(2rem, 6vw, 3.2rem); font-weight: 900; letter-spacing: -.02em; }
h2 { font-size: clamp(1.4rem, 4vw, 1.9rem); font-weight: 800; }
p { margin: 0 0 1em; }
[hidden] { display: none !important; }

/* header */
.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px max(16px, env(safe-area-inset-left)); background: #fff; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.brand img { display: block; height: 54px; width: auto; mix-blend-mode: multiply; }
.site-nav { display: flex; gap: 6px; }
.site-nav a { text-decoration: none; font-weight: 700; color: var(--ink); padding: 8px 14px; border-radius: 999px; }
.site-nav a:hover { background: #f1ecff; }

.page { width: 100%; max-width: 1040px; margin: 0 auto; padding: 24px 16px 56px; flex: 1; }
.app { max-width: 520px; margin: 0 auto; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer;
  font: inherit; font-weight: 800; font-size: 1.05rem; padding: 14px 28px; border-radius: 999px;
  text-decoration: none; transition: transform .12s, box-shadow .12s, background .12s;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 8px 20px rgba(76, 27, 184, .3); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-coral { background: var(--coral); color: #fff; box-shadow: 0 8px 20px rgba(233, 84, 94, .3); }
.btn-ghost { background: #f1ecff; color: var(--primary); }
.btn-xl { font-size: 1.3rem; padding: 18px 44px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* hero */
.hero { text-align: center; padding: 28px 0 20px; }
.lead { font-size: 1.15rem; color: var(--muted); }
.hero-home { padding-top: 12px; }
.quiz-hero {
  background: linear-gradient(145deg, var(--c1), var(--c2)); color: #fff; border-radius: 32px; padding: 40px 20px 44px;
  box-shadow: var(--shadow);
}
.quiz-hero .lead { color: rgba(255, 255, 255, .9); }
.quiz-hero .btn-primary { background: #fff; color: var(--c1); box-shadow: 0 8px 24px rgba(0, 0, 0, .2); }
.quiz-hero .headline { font-size: 1.3rem; font-weight: 800; margin-bottom: .3em; }
.hero-art {
  font-size: 5.5rem; line-height: 1; margin-bottom: 12px; animation: float 3s ease-in-out infinite;
  filter: drop-shadow(0 10px 14px rgba(0, 0, 0, .25));
}
@keyframes float { 50% { transform: translateY(-10px) rotate(-4deg); } }

/* quiz cards */
.quiz-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); margin: 12px 0 32px; }
.quiz-card {
  display: flex; flex-direction: column; text-decoration: none; color: var(--ink); background: var(--card);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: transform .15s;
}
.quiz-card:hover { transform: translateY(-4px); }
.quiz-card-art {
  display: flex; align-items: center; justify-content: center; font-size: 4rem; height: 130px;
  background: linear-gradient(145deg, var(--c1), var(--c2));
}
.quiz-card-body { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px 18px; }
.quiz-card-body strong { font-size: 1.25rem; }
.quiz-card-body span { color: var(--muted); }
.quiz-card-body em { font-style: normal; font-weight: 800; color: var(--c1); margin-top: 6px; }

/* steps */
.steps { margin: 32px 0; text-align: center; }
.steps ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.steps li { background: var(--card); border-radius: var(--radius); padding: 22px 18px; box-shadow: var(--shadow); }
.steps li span { font-size: 2.4rem; display: block; }
.steps li p { color: var(--muted); margin: 4px 0 0; }

.faq { margin: 32px 0; }
.faq details { background: var(--card); border-radius: 16px; padding: 14px 18px; margin-bottom: 10px; box-shadow: 0 4px 14px rgba(76, 27, 184, .08); }
.faq summary { font-weight: 800; cursor: pointer; }
.faq p { margin: 10px 0 0; color: var(--muted); }

.about-quiz { background: var(--card); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); margin-bottom: 32px; }
.prose { max-width: 720px; margin: 0 auto; }
.prose .meta { color: var(--muted); font-size: .9rem; }
.about-quiz h3 { margin: 1.2em 0 .4em; }
.about-quiz ul { padding-left: 1.2em; }
.crumbs { font-size: .9rem; color: var(--muted); margin: 4px 0 12px; }
.crumbs a { color: var(--muted); }
.center { text-align: center; }
.prose h2 { margin-top: 1.4em; }
.prose ul { padding-left: 1.2em; }
.prose li { margin-bottom: .4em; }
.cta-box { background: linear-gradient(145deg, var(--c1), var(--c2)); color: #fff; border-radius: var(--radius); padding: 22px; margin: 28px 0; text-align: center; }
.cta-box p { margin: 6px 0 14px; }
.cta-box .btn-primary { background: #fff; color: var(--c1); }
.article-list { display: grid; gap: 14px; max-width: 720px; margin: 0 auto; }
.article-card { display: flex; flex-direction: column; gap: 4px; background: var(--card); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); text-decoration: none; color: var(--ink); }
.article-card strong { font-size: 1.2rem; }
.article-card span { color: var(--muted); }
.article-card em { font-style: normal; font-weight: 800; color: var(--primary); margin-top: 4px; }

.ad-slot:empty { display: none; }
.ad-slot { margin: 20px auto; text-align: center; }

/* footer */
.site-footer { background: #fff; border-top: 1px solid var(--line); padding: 28px 16px calc(28px + env(safe-area-inset-bottom)); text-align: center; }
.footer-brand img { height: 70px; width: auto; mix-blend-mode: multiply; }
.footer-tag { color: var(--muted); margin: 4px 0 12px; }
.footer-links { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 20px; margin-bottom: 12px; }
.footer-links a { color: var(--ink); font-weight: 700; text-decoration: none; }
.footer-copy { color: var(--muted); font-size: .85rem; margin: 0; }

/* app screens */
.screen { animation: pop .3s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(12px); } }
.screen h1 { font-size: clamp(1.8rem, 7vw, 2.4rem); text-align: center; }
.screen .sub { text-align: center; color: var(--muted); }
.accent { background: linear-gradient(transparent 60%, rgba(255, 194, 51, .6) 60%); padding: 0 4px; }

.field {
  width: 100%; font: inherit; font-size: 1.3rem; font-weight: 700; text-align: center; padding: 16px;
  border: 3px solid var(--line); border-radius: 18px; background: #fff; color: var(--ink); outline: none;
}
.field:focus { border-color: var(--primary); }
.counter { text-align: right; color: var(--muted); font-size: .85rem; margin: 4px 6px 16px; }
.avatar-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin: 8px 0 24px; }
.avatar-btn { font-size: 1.8rem; background: #fff; border: 3px solid var(--line); border-radius: 16px; padding: 6px 0; cursor: pointer; }
.avatar-btn[aria-pressed="true"] { border-color: var(--primary); background: #f1ecff; transform: scale(1.08); }
.label { font-weight: 800; margin: 10px 0 4px; text-align: center; }
.big-avatar { font-size: 4.5rem; text-align: center; line-height: 1; margin-bottom: 8px; }

.progress { height: 12px; background: #ece7fa; border-radius: 99px; overflow: hidden; margin-bottom: 22px; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--c1), var(--c2)); border-radius: 99px; transition: width .35s; }
.qcard {
  position: relative; background: linear-gradient(160deg, var(--c1), var(--c2)); color: #fff; border-radius: 28px;
  padding: 36px 18px 22px; box-shadow: var(--shadow);
}
.qbadge {
  position: absolute; top: -16px; left: 50%; transform: translateX(-50%); background: var(--coral); color: #fff;
  font-weight: 900; padding: 6px 22px; border-radius: 12px; white-space: nowrap; box-shadow: 0 6px 14px rgba(0, 0, 0, .2);
}
.qtext { font-size: 1.4rem; font-weight: 800; text-align: center; margin: 0 0 18px; }
.options { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.options.three .opt:last-child:nth-child(odd) { grid-column: 1 / -1; }
.opt {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; background: #fff; color: var(--ink);
  border: 0; border-radius: 18px; padding: 16px 8px; font: inherit; font-weight: 800; cursor: pointer;
  box-shadow: 0 6px 14px rgba(0, 0, 0, .18); transition: transform .12s;
}
.opt:hover { transform: translateY(-3px) rotate(-1deg); }
.opt:active { transform: scale(.96); }
.opt.picked { outline: 4px solid #ffc233; }
.opt .e { font-size: 2.6rem; line-height: 1.1; }
.skip { display: block; margin: 18px auto 0; background: rgba(255, 255, 255, .22); color: #fff; border: 0; border-radius: 999px; padding: 10px 24px; font: inherit; font-weight: 800; cursor: pointer; }

.ready-card { background: #fff; border: 3px solid var(--primary); border-radius: 28px; padding: 28px 18px; text-align: center; box-shadow: var(--shadow); position: relative; margin-top: 20px; }
.ready-card .ribbon { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); background: var(--primary); color: #fff; padding: 6px 22px; border-radius: 12px; font-weight: 900; white-space: nowrap; }
.linkbox { display: flex; gap: 8px; background: #fff; border: 3px solid var(--line); border-radius: 16px; padding: 6px; margin: 16px 0; }
.linkbox input { flex: 1; min-width: 0; border: 0; font: inherit; padding: 8px 10px; outline: none; color: var(--ink); background: transparent; }
.linkbox button { border: 0; background: var(--primary); color: #fff; font: inherit; font-weight: 800; border-radius: 12px; padding: 8px 16px; cursor: pointer; }
.share-grid { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; margin: 12px 0 20px; }
.share-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 14px; padding: 13px 8px;
  color: #fff; font: inherit; font-weight: 800; cursor: pointer; text-decoration: none; transition: transform .12s;
}
.share-btn:active { transform: scale(.96); }
.share-btn svg { width: 20px; height: 20px; fill: currentColor; flex: none; }
.share-btn.wide { grid-column: 1 / -1; font-size: 1.15rem; padding: 16px; }
.s-whatsapp { background: #25d366; }
.s-instagram { background: linear-gradient(45deg, #f9a03f, #e1306c 55%, #833ab4); }
.s-snapchat { background: #fffc00; color: #1d1340; }
.s-facebook { background: #1877f2; }
.s-messenger { background: linear-gradient(135deg, #00b2ff, #a033ff 60%, #ff5280); }
.s-telegram { background: #229ed9; }
.s-x { background: #111; }
.s-other { background: var(--primary); }
.stack { display: grid; gap: 12px; }

/* result */
.ring { position: relative; width: 190px; height: 190px; margin: 8px auto 12px; }
.ring svg { transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 14; stroke-linecap: round; }
.ring .bg { stroke: #ece7fa; }
.ring .fg { stroke: var(--c1); stroke-dasharray: 502; stroke-dashoffset: 502; transition: stroke-dashoffset 1.2s cubic-bezier(.2, .8, .2, 1); }
.ring .num { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 3rem; font-weight: 900; line-height: 1; }
.ring .num small { font-size: 1rem; color: var(--muted); font-weight: 700; }
.verdict { text-align: center; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 18px; margin-bottom: 18px; }
.verdict .emoji { font-size: 3.5rem; line-height: 1; }
.verdict h2 { margin: 6px 0; color: var(--c1); }
.verdict p { margin: 0; color: var(--muted); }

/* scoreboard */
.summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 16px 0; }
.summary div { background: #fff; border-radius: 16px; padding: 12px 6px; text-align: center; box-shadow: 0 4px 14px rgba(76, 27, 184, .1); }
.summary strong { display: block; font-size: 1.6rem; }
.summary span { color: var(--muted); font-size: .85rem; font-weight: 700; }
.board { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 10px; }
.board li { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; background: #fff; border-radius: 16px; padding: 12px 14px; box-shadow: 0 4px 14px rgba(76, 27, 184, .1); }
.board .rank { font-weight: 900; color: var(--muted); text-align: center; }
.board .pname { font-weight: 800; overflow-wrap: anywhere; }
.board .bar { height: 8px; border-radius: 9px; background: #ece7fa; margin-top: 6px; overflow: hidden; }
.board .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--c1), var(--c2)); }
.board .pscore { text-align: right; font-weight: 900; }
.board .ptier { display: block; font-size: .8rem; color: var(--muted); font-weight: 700; }
.empty { text-align: center; padding: 28px 12px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px; }
.empty .emoji { font-size: 3.5rem; }

.loader { width: 44px; height: 44px; margin: 80px auto; border: 5px solid #ece7fa; border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.notice, .error-msg { text-align: center; color: var(--coral); font-weight: 800; }
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 30px); background: var(--ink); color: #fff;
  padding: 12px 22px; border-radius: 999px; font-weight: 800; opacity: 0; pointer-events: none; transition: all .25s; z-index: 50; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 480px) {
  .brand img { height: 46px; }
  .avatar-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
