:root {
  --bg: #fff8f2;
  --card: #ffffff;
  --ink: #1d1b2e;
  --muted: #6b6880;
  --track: #ece7f3;
  --accent: #d6336c;
  --blue: #2f80ed;
  --red: #eb2f4b;
  --radius: 18px;
  --shadow: 0 6px 24px rgba(40, 20, 80, .08);
}

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

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  transition: background-color .6s;
}
body.is-danger { background: #ffe9ee; }

.topbar {
  padding: 10px 16px;
  border-bottom: 4px solid transparent;
  border-image: linear-gradient(90deg, #e40303, #ff8c00, #ffed00, #008026, #004dff, #750787) 1;
}
.topbar-inner { max-width: 960px; margin: 0 auto; display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; }
.logo { font-weight: 800; font-size: 1.15rem; color: var(--ink); text-decoration: none; margin-right: auto; }
.topnav { display: flex; gap: 14px; font-size: .95rem; }
.topnav a { color: var(--muted); text-decoration: none; font-weight: 600; }
.topnav a:hover { color: var(--accent); }
@media (max-width: 520px) { .topnav { order: 3; width: 100%; justify-content: space-between; } }

.lang-switch { position: relative; }
.lang-switch summary { list-style: none; cursor: pointer; font-weight: 700; padding: 6px 10px; border: 2px solid var(--track); border-radius: 99px; }
.lang-switch summary::-webkit-details-marker { display: none; }
.lang-switch ul {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 10; min-width: 200px; margin: 0; padding: 6px;
  list-style: none; background: var(--card); border-radius: 12px; box-shadow: var(--shadow);
}
.lang-switch a { display: block; padding: 6px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; }
.lang-switch a:hover, .lang-switch a[aria-current] { background: var(--track); }

.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 16px; top: 8px; z-index: 20; background: var(--card); padding: 8px 12px; border-radius: 8px; }

.wrap { max-width: 640px; margin: 0 auto; padding: 24px 16px 40px; }

.screen { display: none; }
.screen.is-active { display: block; animation: fade-in .35s ease; }

@keyframes fade-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Home ---------- */
.hero-title { font-size: clamp(2rem, 7vw, 3rem); line-height: 1.1; margin: 8px 0 12px; }
.rainbow-text {
  background: linear-gradient(90deg, #e40303, #ff8c00, #e6c200, #008026, #004dff, #750787);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub { font-size: 1.1rem; color: var(--muted); margin: 0 0 20px; }
.explain { background: var(--card); border-radius: var(--radius); padding: 16px 20px; box-shadow: var(--shadow); }
.explain p { margin: 8px 0; }
.t-blue { color: var(--blue); }
.t-red { color: var(--red); }

.pick-title { margin: 32px 0 4px; }
.pick-sub { margin: 0 0 16px; color: var(--muted); }
.btn-start { display: inline-block; margin: 0 0 20px; padding: 14px 28px; font-size: 1.1rem; text-decoration: none; box-shadow: var(--shadow); }
.btn-start:hover { background: var(--accent); border-color: var(--accent); }
.pick { scroll-margin-top: 12px; }
.regions { display: grid; gap: 12px; }
.regions.is-highlight .region-btn { animation: nudge .6s ease both; }
.regions.is-highlight .region-btn:nth-child(2) { animation-delay: .1s; }
.regions.is-highlight .region-btn:nth-child(3) { animation-delay: .2s; }
@keyframes nudge {
  40% { transform: translateY(-4px) scale(1.02); border-color: var(--accent); box-shadow: 0 0 0 4px rgba(214, 51, 108, .2); }
}
@media (prefers-reduced-motion: reduce) { .regions.is-highlight .region-btn { animation: none; border-color: var(--accent); } }
.home-error { margin: 0 0 16px; padding: 12px 16px; border-radius: 12px; background: #fde6ef; color: var(--red); font-weight: 600; }
.region-btn {
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 14px;
  align-items: center; text-align: left;
  padding: 14px 18px; border: 2px solid transparent; border-radius: var(--radius);
  background: var(--card); box-shadow: var(--shadow); cursor: pointer; font: inherit; color: inherit;
  transition: transform .15s, border-color .15s;
}
.region-btn:hover { transform: translateY(-2px) rotate(-.5deg); border-color: var(--accent); }
.region-btn .flag { grid-row: span 2; font-size: 2.2rem; }
.region-btn b { font-size: 1.1rem; }
.region-btn small { color: var(--muted); }

/* ---------- Meter ---------- */
.meter-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 16px 12px; margin-bottom: 20px; }
.meter { position: relative; max-width: 320px; margin: 0 auto; text-align: center; }
.meter svg { width: 100%; display: block; overflow: visible; }
.meter-end { font-size: 12px; }
.needle, .needle-wobble { transform-box: view-box; transform-origin: 100px 100px; }
.needle { transform: rotate(-90deg); transition: transform .9s cubic-bezier(.34, 1.56, .64, 1); }
.meter-readout { font-size: 2rem; font-weight: 800; margin-top: -6px; transition: color .4s; }
.meter-label { font-weight: 600; color: var(--muted); min-height: 1.5em; }

.meter.is-danger { animation: shake .45s infinite; }
.meter.is-danger .needle-wobble { animation: wobble .18s infinite alternate; }
.meter.is-danger .meter-readout { color: var(--red); animation: pulse .6s infinite alternate; }
.meter.is-danger .meter-label { color: var(--red); }
.meter.is-max { animation-duration: .25s; }

@keyframes shake {
  0%, 100% { transform: translate(0, 0) rotate(0); }
  20% { transform: translate(-3px, 1px) rotate(-1.5deg); }
  40% { transform: translate(3px, -1px) rotate(1.5deg); }
  60% { transform: translate(-2px, 2px) rotate(-1deg); }
  80% { transform: translate(2px, -2px) rotate(1deg); }
}
@keyframes wobble { from { transform: rotate(-5deg); } to { transform: rotate(5deg); } }
@keyframes pulse { from { transform: scale(1); } to { transform: scale(1.15); } }

.burst { position: absolute; left: 50%; top: 45%; pointer-events: none; }
.burst span {
  position: absolute; font-size: 1.5rem;
  animation: fly 1.2s ease-out forwards;
}
@keyframes fly {
  from { transform: translate(0, 0) scale(.4); opacity: 1; }
  to { transform: translate(var(--dx), var(--dy)) scale(1.2) rotate(var(--rot)); opacity: 0; }
}

/* ---------- Quiz ---------- */
.progress { height: 8px; background: var(--track); border-radius: 99px; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, #e40303, #ff8c00, #e6c200, #008026, #004dff, #750787); transition: width .4s; }
.progress-text { font-size: .9rem; color: var(--muted); margin-top: 6px; }
.question { font-size: 1.5rem; margin: 12px 0 16px; }
.answers { display: grid; gap: 10px; }
.answer {
  text-align: left; padding: 14px 16px; border-radius: 14px; border: 2px solid var(--track);
  background: var(--card); font: inherit; color: inherit; cursor: pointer;
  transition: border-color .15s, transform .15s, background-color .15s;
}
.answer:hover:not(:disabled) { border-color: var(--accent); transform: translateX(4px); }
.answer:disabled { cursor: default; opacity: .55; }
.answer.is-picked { opacity: 1; border-color: var(--accent); background: #fde6ef; transform: scale(1.02); }

/* ---------- Result ---------- */
.result-kicker { text-transform: uppercase; letter-spacing: .1em; font-size: .8rem; color: var(--muted); margin: 0; }
.result-title { font-size: 2rem; margin: 4px 0 8px; }
.result-text { font-size: 1.1rem; margin: 0 0 20px; }
.stats { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 18px; margin: 0 0 20px; }
.stats p { margin: 4px 0; }
.stats .big { font-size: 1.15rem; }
.stats small { color: var(--muted); }
.result-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
  padding: 12px 18px; border-radius: 99px; border: 2px solid var(--ink); background: transparent;
  font: inherit; font-weight: 600; color: var(--ink); cursor: pointer;
}
.btn-primary { background: var(--ink); color: #fff; }

/* ---------- Content sections (SEO) ---------- */
.app { scroll-margin-top: 16px; }
.info { margin-top: 56px; scroll-margin-top: 16px; }
.info h2 { font-size: 1.6rem; line-height: 1.2; margin: 0 0 8px; }
.info > p { color: var(--muted); margin: 0 0 16px; }
.cards { display: grid; gap: 12px; padding: 0; margin: 0; list-style: none; }
@media (min-width: 560px) { .cards { grid-template-columns: 1fr 1fr; } }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
.card h3 { margin: 0 0 4px; font-size: 1.05rem; }
.card p { margin: 0; color: var(--muted); }
.steps { counter-reset: step; }
.steps .card h3::before { counter-increment: step; content: counter(step) ". "; color: var(--accent); }
.levels { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.level { display: grid; grid-template-columns: 84px 1fr; gap: 0 12px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 16px; }
.level-range { grid-row: span 2; align-self: center; font-weight: 800; color: var(--accent); }
.level h3 { margin: 0; font-size: 1.05rem; }
.level p { margin: 0; color: var(--muted); }
.faq-item { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 18px; margin-bottom: 10px; }
.faq-item summary { cursor: pointer; }
.faq-item summary h3 { display: inline; font-size: 1.02rem; margin: 0; }
.faq-item p { margin: 8px 0 2px; color: var(--muted); }
.cta { text-align: center; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px 20px; }
.cta .btn { display: inline-block; text-decoration: none; }

.footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 32px 16px; }
.footer-title { font-size: .9rem; margin: 16px 0 8px; }
.footer-langs { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; }
.footer-langs a { color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  .meter.is-danger, .meter.is-danger .needle-wobble, .meter.is-danger .meter-readout { animation: none; }
}

.btn:disabled { opacity: .5; cursor: default; }
.evidence { margin-top: 20px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 18px; }
.evidence summary { cursor: pointer; font-weight: 600; }
.evidence ol { padding-left: 20px; margin: 10px 0 0; }
.evidence li { margin: 6px 0; }
.evidence li span { color: var(--muted); }

/* ---------- Sharing ---------- */
.home-share { margin-top: 8px; }
.share-block { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; margin: 0 0 16px; }
.btn-copy { width: 100%; }
.share-url { width: 100%; margin-top: 10px; padding: 10px 12px; border: 2px solid var(--track); border-radius: 10px; font: inherit; font-size: .9rem; color: var(--ink); background: var(--bg); }
.share-label { margin: 14px 0 8px; color: var(--muted); font-size: .9rem; text-align: center; }
.share-bar { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.share-btn {
  width: 46px; height: 46px; border-radius: 50%; border: 0; padding: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.4rem; font-weight: 700; text-decoration: none;
  transition: transform .15s, box-shadow .15s;
}
.share-btn:hover, .share-btn:focus-visible { transform: translateY(-3px) scale(1.06); box-shadow: 0 6px 14px rgba(0, 0, 0, .18); }
.share-icon { width: 22px; height: 22px; background: currentColor; -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat; }
.share-facebook { background: #0866ff; --icon: url(../img/icons/facebook.svg); }
.share-x        { background: #000;    --icon: url(../img/icons/x.svg); }
.share-whatsapp { background: #25d366; --icon: url(../img/icons/whatsapp.svg); }
.share-viber    { background: #7360f2; --icon: url(../img/icons/viber.svg); }
.share-telegram { background: #26a5e4; --icon: url(../img/icons/telegram.svg); }
.share-reddit   { background: #ff4500; --icon: url(../img/icons/reddit.svg); }
.share-more     { background: var(--ink); line-height: 1; }
