/* ==========================================================================
   Smile Lab — design system
   ========================================================================== */

:root {
  --bg: #fffaf0;
  --bg-2: #fff3d6;
  --surface: #ffffff;
  --surface-2: #fff7e6;
  --ink: #241b3a;
  --ink-soft: #4a4160;
  --muted: #7a7191;
  --line: #ece3ff;
  --line-2: #e6dcc9;
  --yellow: #ffc93c;
  --yellow-deep: #f0a91f;
  --pink: #ff6b9d;
  --teal: #17b3a3;
  --purple: #7c5cff;
  --coral: #ff7a59;
  --green: #2fae6b;
  --red: #e5484d;
  --shadow: 0 14px 40px rgba(60, 40, 110, 0.12);
  --shadow-sm: 0 4px 14px rgba(60, 40, 110, 0.09);
  --radius: 22px;
  --radius-sm: 14px;
  --maxw: 1120px;
  --font-display: "Fredoka", "Trebuchet MS", system-ui, sans-serif;
  --font-body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
}

[data-theme="dark"] {
  --bg: #120d24;
  --bg-2: #1a1233;
  --surface: #1e1738;
  --surface-2: #261d45;
  --ink: #f6f2ff;
  --ink-soft: #d6cdf0;
  --muted: #a99fc9;
  --line: #332a57;
  --line-2: #3a3059;
  --shadow: 0 16px 44px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(1100px 520px at 8% -8%, rgba(255, 201, 60, 0.28), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(124, 92, 255, 0.16), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg { max-width: 100%; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.12;
  margin: 0 0 0.5em;
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(2rem, 6vw, 3.4rem); }
h2 { font-size: clamp(1.5rem, 4.4vw, 2.3rem); }
h3 { font-size: clamp(1.1rem, 3vw, 1.4rem); }
p { margin: 0 0 1rem; }
a { color: var(--purple); }

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 18px;
}

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--ink); color: var(--bg);
  padding: 10px 16px; border-radius: 0 0 12px 0; z-index: 200;
}
.skip-link:focus { left: 0; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: blur(12px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--line);
}
[data-theme="dark"] .site-header { background: rgba(18, 13, 36, 0.82); }
.header-inner {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 18px; max-width: var(--maxw); margin: 0 auto;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-display); font-weight: 600; font-size: 1.2rem;
  color: var(--ink); text-decoration: none; white-space: nowrap;
}
.brand svg { width: 38px; height: 38px; border-radius: 12px; }
.nav {
  display: flex; gap: 4px; margin-left: auto; align-items: center;
}
.nav a {
  color: var(--ink-soft); text-decoration: none; font-weight: 700;
  font-size: 0.92rem; padding: 8px 11px; border-radius: 999px;
}
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--ink); color: var(--bg); }
.icon-btn {
  flex: none; width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); cursor: pointer; font-size: 1.1rem;
  display: grid; place-items: center;
}
.icon-btn:hover { background: var(--surface-2); }
.menu-toggle { display: none; }

@media (max-width: 820px) {
  .nav {
    position: fixed; inset: 62px 0 auto 0;
    flex-direction: column; align-items: stretch;
    background: var(--surface); border-bottom: 1px solid var(--line);
    padding: 10px 18px 18px; gap: 4px; margin: 0;
    transform: translateY(-140%); transition: transform .28s ease;
    box-shadow: var(--shadow);
  }
  .nav.open { transform: translateY(0); }
  .menu-toggle { display: grid; margin-left: auto; }
  .nav + .icon-btn { margin-left: 0; }
  .header-inner { flex-wrap: nowrap; }
  .nav a { padding: 12px 14px; }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-display); font-weight: 600; font-size: 1rem;
  padding: 12px 22px; border-radius: 999px; border: 2px solid transparent;
  background: var(--ink); color: var(--bg); cursor: pointer;
  text-decoration: none; transition: transform .12s ease, box-shadow .2s ease, background .2s ease;
  box-shadow: var(--shadow-sm);
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: 3px solid var(--purple); outline-offset: 2px; }
.btn--yellow { background: var(--yellow); color: #3a2500; }
.btn--pink { background: var(--pink); color: #3d0018; }
.btn--teal { background: var(--teal); color: #00201d; }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line-2); box-shadow: none; }
.btn--ghost:hover { background: var(--surface-2); }
.btn--block { width: 100%; }
.btn--lg { font-size: 1.15rem; padding: 15px 28px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ---------- layout helpers ---------- */
.section { padding: 54px 0; }
.section--tight { padding: 34px 0; }
.section-head { max-width: 680px; margin: 0 auto 28px; text-align: center; }
.eyebrow {
  display: inline-block; font-family: var(--font-display); font-weight: 600;
  font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--purple); background: color-mix(in srgb, var(--purple) 12%, transparent);
  padding: 5px 13px; border-radius: 999px; margin-bottom: 12px;
}
.lead { font-size: 1.12rem; color: var(--ink-soft); }
.grid { display: grid; gap: 20px; }
@media (min-width: 720px) {
  .grid--2 { grid-template-columns: 1fr 1fr; }
  .grid--3 { grid-template-columns: repeat(3, 1fr); }
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 980px) { .grid--4 { grid-template-columns: repeat(4, 1fr); } }
.center { text-align: center; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-sm);
}
.card--pop { border: 2px solid var(--ink); box-shadow: 8px 8px 0 var(--ink); }
[data-theme="dark"] .card--pop { box-shadow: 8px 8px 0 rgba(255, 201, 60, 0.5); }

.pill {
  display: inline-block; font-size: 0.78rem; font-weight: 800;
  padding: 3px 11px; border-radius: 999px; background: var(--surface-2);
  color: var(--ink-soft); border: 1px solid var(--line);
}
.pill--reward { background: color-mix(in srgb, var(--yellow) 30%, transparent); color: #6b4a00; }
.pill--affiliation { background: color-mix(in srgb, var(--teal) 22%, transparent); color: #075049; }
.pill--dominance { background: color-mix(in srgb, var(--pink) 24%, transparent); color: #6d0033; }
.pill--other { background: color-mix(in srgb, var(--purple) 20%, transparent); color: #3b2a8a; }
[data-theme="dark"] .pill--reward { color: #ffd97a; }
[data-theme="dark"] .pill--affiliation { color: #7ff0e4; }
[data-theme="dark"] .pill--dominance { color: #ffb3ce; }
[data-theme="dark"] .pill--other { color: #cbbcff; }

/* ---------- hero ---------- */
.hero { padding: 44px 0 20px; }
.hero-grid { display: grid; gap: 34px; align-items: center; }
@media (min-width: 900px) { .hero-grid { grid-template-columns: 1.05fr 0.95fr; } }
.hero h1 .hl { color: var(--pink); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }
.hero-facts { display: flex; flex-wrap: wrap; gap: 10px 22px; margin-top: 22px; padding: 0; list-style: none; }
.hero-facts li { font-weight: 700; color: var(--ink-soft); font-size: 0.95rem; }
.hero-facts b { color: var(--ink); }

.hero-art { position: relative; display: grid; place-items: center; }
.hero-art .big-face { width: min(340px, 78vw); filter: drop-shadow(0 18px 30px rgba(60,40,110,.25)); }
.hero-art .float {
  position: absolute; font-size: 2rem; animation: bob 5s ease-in-out infinite;
}
.hero-art .f1 { top: 4%; left: 2%; }
.hero-art .f2 { bottom: 6%; right: 0; animation-delay: 1.2s; }
.hero-art .f3 { top: 40%; right: -2%; animation-delay: 2.4s; }
@keyframes bob { 0%,100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-12px) rotate(6deg); } }

/* ---------- banner ---------- */
.banner {
  background: var(--ink); color: var(--bg);
  border-radius: var(--radius); padding: 14px 20px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px;
  font-weight: 700; box-shadow: var(--shadow);
}
[data-theme="dark"] .banner { background: linear-gradient(100deg, #3a2d6b, #7c5cff); }
.banner .tag { background: var(--yellow); color: #3a2500; padding: 4px 12px; border-radius: 999px; font-family: var(--font-display); }
.banner a { color: var(--yellow); }

/* ---------- game ---------- */
.game-shell { max-width: 760px; margin: 0 auto; }
.game-card {
  background: var(--surface); border: 2px solid var(--ink);
  border-radius: 28px; padding: 20px; box-shadow: 10px 10px 0 var(--yellow);
}
[data-theme="dark"] .game-card { box-shadow: 10px 10px 0 rgba(255,201,60,.35); }
.modes { display: grid; gap: 12px; }
@media (min-width: 640px) { .modes { grid-template-columns: repeat(3, 1fr); } }
.mode {
  text-align: left; background: var(--surface-2); border: 2px solid var(--line);
  border-radius: 18px; padding: 16px; cursor: pointer; color: var(--ink);
  font-family: var(--font-body); transition: transform .12s ease, border-color .2s ease;
}
.mode:hover { transform: translateY(-3px); border-color: var(--ink); }
.mode.active { border-color: var(--pink); background: color-mix(in srgb, var(--pink) 12%, var(--surface)); }
.mode h3 { margin: 0 0 2px; }
.mode p { margin: 0; font-size: 0.88rem; color: var(--muted); font-weight: 600; }
.mode .badge { font-size: 0.72rem; font-weight: 800; color: var(--purple); text-transform: uppercase; letter-spacing: .06em; }

.game-top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.progress { flex: 1; height: 12px; background: var(--surface-2); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); min-width: 120px; }
.progress > span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--yellow), var(--pink)); transition: width .3s ease; }
.score-chip { font-family: var(--font-display); font-weight: 600; font-size: 1rem; background: var(--surface-2); border: 1px solid var(--line); padding: 4px 12px; border-radius: 999px; }
.timer-ring { font-family: var(--font-display); font-weight: 600; color: var(--red); min-width: 42px; text-align: center; }

.face-stage {
  position: relative; display: grid; place-items: center; padding: 8px 0 4px;
}
.face-stage svg { width: min(320px, 68vw); height: auto; }
.face-stage .scan {
  position: absolute; left: 8%; right: 8%; top: 0; height: 3px;
  background: linear-gradient(90deg, transparent, var(--teal), transparent);
  animation: scan 2.6s ease-in-out infinite; opacity: .8;
}
@keyframes scan { 0%,100% { top: 8%; } 50% { top: 90%; } }
.prompt { text-align: center; font-family: var(--font-display); font-weight: 600; font-size: 1.2rem; margin: 6px 0 14px; }
.answers { display: grid; gap: 12px; }
@media (min-width: 520px) { .answers { grid-template-columns: 1fr 1fr; } }
.answer {
  font-family: var(--font-display); font-weight: 600; font-size: 1.1rem;
  padding: 18px; border-radius: 18px; border: 2px solid var(--ink);
  cursor: pointer; transition: transform .1s ease, background .2s ease;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.answer--real { background: var(--yellow); color: #3a2500; }
.answer--fake { background: var(--surface); color: var(--ink); }
.answer:hover { transform: translateY(-3px); }
.answer kbd { font-family: var(--font-body); font-size: .72rem; background: rgba(0,0,0,.14); border-radius: 6px; padding: 2px 6px; }
.feedback { margin-top: 14px; border-radius: 16px; padding: 14px 16px; font-weight: 700; display: none; }
.feedback.show { display: block; animation: pop .22s ease; }
.feedback.good { background: color-mix(in srgb, var(--green) 16%, var(--surface)); border: 1px solid var(--green); }
.feedback.bad { background: color-mix(in srgb, var(--red) 14%, var(--surface)); border: 1px solid var(--red); }
.feedback .tell { display: block; font-weight: 600; color: var(--ink-soft); margin-top: 3px; }
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* result */
.result { text-align: center; display: none; }
.result.show { display: block; animation: pop .3s ease; }
.result .iq {
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(3rem, 14vw, 5.4rem); line-height: 1;
  background: linear-gradient(120deg, var(--pink), var(--purple), var(--teal));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.result .rank { font-family: var(--font-display); font-size: 1.5rem; margin: 4px 0 2px; }
.result .sub { color: var(--muted); font-weight: 700; }
.result-stats { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin: 18px 0; }
.stat { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 8px 16px; min-width: 92px; }
.stat b { display: block; font-family: var(--font-display); font-size: 1.3rem; }
.stat span { font-size: .78rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.review { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 6px 0 18px; }
.review .mini { width: 46px; height: 46px; border-radius: 12px; overflow: hidden; position: relative; border: 2px solid var(--line); }
.review .mini svg { width: 100%; height: 100%; display: block; }
.review .mini.ok { border-color: var(--green); }
.review .mini.no { border-color: var(--red); }
.result-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

.how { counter-reset: step; }
.how li { list-style: none; position: relative; padding-left: 54px; margin-bottom: 16px; }
.how li::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 0; top: -2px; width: 38px; height: 38px;
  display: grid; place-items: center; border-radius: 50%;
  background: var(--yellow); color: #3a2500; font-family: var(--font-display); font-weight: 600;
}
.how li b { display: block; }

/* ---------- muscle lab ---------- */
.lab { display: grid; gap: 24px; align-items: start; }
@media (min-width: 860px) { .lab { grid-template-columns: 1fr 1fr; } }
.lab-face { display: grid; place-items: center; }
.lab-face svg { width: min(320px, 74vw); }
.muscle-list { display: grid; gap: 10px; }
.muscle {
  display: flex; gap: 12px; align-items: flex-start; text-align: left;
  background: var(--surface); border: 2px solid var(--line); border-radius: 16px;
  padding: 12px 14px; cursor: pointer; color: var(--ink); font-family: var(--font-body);
}
.muscle.on { border-color: var(--pink); background: color-mix(in srgb, var(--pink) 10%, var(--surface)); }
.muscle .dot { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--ink); margin-top: 2px; display: grid; place-items: center; font-size: .7rem; color: #fff; }
.muscle.on .dot { background: var(--pink); }
.muscle b { display: block; font-family: var(--font-display); }
.muscle small { color: var(--muted); font-weight: 600; }
.lab-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }

/* ---------- encyclopedia ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 20px; }
.search {
  flex: 1 1 220px; min-width: 180px; padding: 11px 16px; border-radius: 999px;
  border: 2px solid var(--line-2); background: var(--surface); color: var(--ink);
  font-family: var(--font-body); font-size: 1rem;
}
.search:focus { outline: none; border-color: var(--purple); }
.chip {
  border: 2px solid var(--line-2); background: var(--surface); color: var(--ink-soft);
  border-radius: 999px; padding: 8px 14px; font-weight: 800; font-size: .86rem; cursor: pointer;
  font-family: var(--font-body);
}
.chip.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.smile-grid { display: grid; gap: 18px; }
@media (min-width: 640px) { .smile-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 980px) { .smile-grid { grid-template-columns: repeat(3, 1fr); } }
.smile-card { display: flex; flex-direction: column; }
.smile-card .art { display: grid; place-items: center; margin-bottom: 12px; }
.smile-card .art svg { width: 132px; height: 132px; }
.smile-card h3 { margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.smile-card .signals { color: var(--ink-soft); font-size: .95rem; }
.smile-card dl { margin: 12px 0 0; font-size: .84rem; }
.smile-card dt { font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-size: .72rem; margin-top: 8px; }
.smile-card dd { margin: 0; color: var(--ink-soft); }
.empty { text-align: center; color: var(--muted); padding: 40px 0; font-weight: 700; }

/* ---------- timeline ---------- */
.timeline { position: relative; max-width: 780px; margin: 0 auto; padding-left: 34px; }
.timeline::before { content: ""; position: absolute; left: 12px; top: 6px; bottom: 6px; width: 4px; border-radius: 4px; background: linear-gradient(var(--yellow), var(--pink), var(--purple)); }
.tl-item { position: relative; margin-bottom: 22px; }
.tl-item::before {
  content: attr(data-emoji); position: absolute; left: -34px; top: 8px;
  width: 30px; height: 30px; border-radius: 50%; background: var(--surface);
  border: 2px solid var(--ink); display: grid; place-items: center; font-size: .95rem;
}
.tl-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 16px 18px; box-shadow: var(--shadow-sm); }
.tl-card .yr { font-family: var(--font-display); font-weight: 600; color: var(--purple); }
.tl-card h3 { margin: 2px 0 6px; }
.tl-card p { margin: 0; color: var(--ink-soft); }

/* ---------- trivia ---------- */
.trivia { max-width: 720px; margin: 0 auto; }
.q-meta { display: flex; justify-content: space-between; font-weight: 800; color: var(--muted); margin-bottom: 10px; }
.q-text { font-family: var(--font-display); font-size: 1.25rem; margin-bottom: 16px; }
.q-options { display: grid; gap: 10px; }
.q-opt {
  text-align: left; padding: 14px 16px; border-radius: 14px; border: 2px solid var(--line-2);
  background: var(--surface); color: var(--ink); cursor: pointer; font-family: var(--font-body);
  font-weight: 700; font-size: 1rem;
}
.q-opt:hover { border-color: var(--ink); }
.q-opt.correct { border-color: var(--green); background: color-mix(in srgb, var(--green) 15%, var(--surface)); }
.q-opt.wrong { border-color: var(--red); background: color-mix(in srgb, var(--red) 13%, var(--surface)); }
.q-opt[disabled] { cursor: default; }
.q-why { margin-top: 14px; padding: 13px 16px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); font-weight: 600; display: none; }
.q-why.show { display: block; }

/* ---------- myth cards ---------- */
.flip { perspective: 1000px; cursor: pointer; background: none; border: none; padding: 0; font-family: var(--font-body); text-align: left; display: block; }
.flip-inner { display: grid; transition: transform .55s; transform-style: preserve-3d; }
.flip.flipped .flip-inner { transform: rotateY(180deg); }
.flip-face {
  grid-area: 1 / 1; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border-radius: 18px; padding: 18px; border: 2px solid var(--ink); display: flex; flex-direction: column; justify-content: center; gap: 8px;
}
.flip-front { background: var(--surface); }
.flip-back { background: var(--yellow); color: #3a2500; transform: rotateY(180deg); }
.flip-back p { font-size: 0.94rem; }
.flip-back .src { font-size: .74rem; font-weight: 800; opacity: .8; }
.flip .lab { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; opacity: .7; }

/* ---------- kindness ---------- */
.kind-wrap { max-width: 640px; margin: 0 auto; text-align: center; }
.kind-box { font-family: var(--font-display); font-size: clamp(1.15rem, 3.6vw, 1.6rem); min-height: 4.2em; display: grid; place-items: center; padding: 18px; border-radius: 18px; background: var(--surface-2); border: 2px dashed var(--line-2); }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); margin-top: 40px; padding: 32px 0; color: var(--muted); }
.footer-grid { display: flex; flex-wrap: wrap; gap: 18px; justify-content: space-between; align-items: flex-start; }
.site-footer a { color: var(--ink-soft); }
.site-footer .muted-note { max-width: 520px; font-size: .88rem; }
.to-top { position: fixed; right: 16px; bottom: 16px; z-index: 90; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 140%);
  background: var(--ink); color: var(--bg); padding: 12px 20px; border-radius: 999px;
  font-weight: 800; z-index: 300; transition: transform .3s ease; box-shadow: var(--shadow); max-width: 90vw;
}
.toast.show { transform: translate(-50%, 0); }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
