:root {
  --bg: #f7f5f2;
  --card: #ffffff;
  --text: #1c1917;
  --muted: #6b645c;
  --border: #e7e2dc;
  --accent: #e63946;
  --accent-ink: #ffffff;
  --radius: 16px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141210;
    --card: #1f1c19;
    --text: #f3efea;
    --muted: #a8a097;
    --border: #34302b;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
.wrap { max-width: 680px; margin: 0 auto; padding: 0 16px; }

/* Header / footer */
.site-header { border-bottom: 1px solid var(--border); background: var(--card); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.logo { font-weight: 800; font-size: 1.35rem; text-decoration: none; letter-spacing: -0.02em; }
.logo span { color: var(--accent); }
.site-footer { margin-top: 48px; padding: 24px 0 40px; border-top: 1px solid var(--border); color: var(--muted); font-size: .85rem; }
.site-footer nav { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }

/* Cards */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; margin: 20px 0; }
h1 { font-size: clamp(1.45rem, 4.5vw, 2rem); line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 12px; }
h2 { font-size: 1.2rem; margin: 0 0 12px; }
.muted { color: var(--muted); }
.hero-emoji { font-size: 3.5rem; line-height: 1; margin-bottom: 12px; }

/* Home list */
.quiz-list { display: grid; gap: 14px; margin: 20px 0; }
.quiz-item { display: flex; gap: 14px; align-items: center; text-decoration: none; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; transition: transform .15s, box-shadow .15s; }
.quiz-item:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.08); }
.quiz-item .ico { font-size: 2.2rem; width: 56px; height: 56px; display: grid; place-items: center; border-radius: 14px; flex: none; }
.quiz-item strong { display: block; font-size: 1.02rem; line-height: 1.3; }

/* Form + buttons */
label { font-weight: 600; display: block; margin-bottom: 8px; }
input[type=text] { width: 100%; font: inherit; padding: 14px 16px; border-radius: 12px; border: 2px solid var(--border); background: var(--bg); color: var(--text); }
input[type=text]:focus { outline: none; border-color: var(--accent); }
.btn { display: inline-block; font: inherit; font-weight: 700; border: 0; border-radius: 12px; padding: 14px 22px; background: var(--accent); color: var(--accent-ink); cursor: pointer; text-decoration: none; text-align: center; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.block { width: 100%; margin-top: 14px; }
.btn.ghost { background: transparent; color: var(--text); border: 2px solid var(--border); }

/* Questions */
.q-num { font-size: .8rem; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .06em; }
.q-title { font-size: 1.15rem; font-weight: 700; margin: 6px 0 16px; }
.answers { display: grid; gap: 10px; }
.answer { font: inherit; text-align: left; padding: 14px 16px; border-radius: 12px; border: 2px solid var(--border); background: var(--bg); color: var(--text); cursor: pointer; transition: border-color .12s, background .12s; }
.answer:hover { border-color: var(--accent); }
.answer.selected { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--bg)); font-weight: 600; }
.progress { height: 8px; background: var(--border); border-radius: 99px; overflow: hidden; margin: 18px 0 0; }
.progress > div { height: 100%; width: 0; background: var(--accent); transition: width .3s; }

/* Result */
.result { text-align: center; color: #fff; border: 0; }
.result .side { display: inline-block; font-weight: 800; letter-spacing: .12em; font-size: .85rem; padding: 6px 14px; border-radius: 99px; background: rgba(255,255,255,.2); }
.result .r-emoji { font-size: 4.5rem; margin: 14px 0 6px; }
.result h1 { color: #fff; }
.result .series { font-size: 1.05rem; opacity: .95; margin-bottom: 14px; }
.result p { text-align: left; font-size: 1.02rem; background: rgba(0,0,0,.18); padding: 16px; border-radius: 12px; margin: 0; }
.share { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 14px; }
.share a, .share button { font: inherit; font-weight: 700; font-size: .95rem; padding: 12px; border-radius: 12px; border: 0; cursor: pointer; text-decoration: none; color: #fff; text-align: center; }
.s-wa { background: #25d366; } .s-fb { background: #1877f2; } .s-x { background: #111; box-shadow: inset 0 0 0 2px #3a3a3a; } .s-copy { background: #6b645c; }

/* Ad slots: keep space around ads (AdSense policy: no ads pegados a botones) */
.ad-slot { margin: 28px 0; min-height: 100px; text-align: center; }
.ad-label { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; display: block; margin-bottom: 4px; }
.ad-placeholder { border: 2px dashed var(--border); border-radius: 12px; padding: 30px 10px; color: var(--muted); font-size: .85rem; }

.hidden { display: none !important; }
.prose h2 { margin-top: 24px; }
.prose p, .prose li { color: var(--text); }

/* ===== Layout con espacios laterales para anuncios (pantallas grandes) ===== */
.layout { display: grid; grid-template-columns: minmax(0, 1fr); justify-content: center; gap: 24px; padding-inline: 0; }
.ad-side { display: none; }
@media (min-width: 1100px) {
  .layout { grid-template-columns: 160px minmax(0, 680px) 160px; }
  .layout > main.wrap { padding: 0; width: 100%; }
  .ad-side { display: block; position: sticky; top: 20px; align-self: start; margin-top: 20px; }
  .ad-side .ad-placeholder { min-height: 600px; display: grid; place-items: center; padding: 10px; }
}
@media (min-width: 1360px) { .layout { grid-template-columns: 300px minmax(0, 680px) 300px; } }

/* ===== Interactividad ===== */
@keyframes slideIn { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
@keyframes slideBack { from { opacity: 0; transform: translateX(-28px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(1); } 45% { transform: scale(1.04); } 100% { transform: scale(1); } }
@keyframes reveal { 0% { opacity: 0; transform: scale(.85) rotate(-2deg); } 70% { transform: scale(1.03) rotate(.5deg); } 100% { opacity: 1; transform: none; } }
@keyframes bounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes spin { to { transform: rotate(360deg); } }
.anim-in { animation: slideIn .35s ease both; }
.anim-back { animation: slideBack .35s ease both; }
.answer { display: flex; align-items: center; gap: 12px; }
.answer .letter { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .85rem; background: var(--border); color: var(--text); transition: background .15s, color .15s; }
.answer:hover .letter, .answer.selected .letter { background: var(--accent); color: var(--accent-ink); }
.answer.selected { animation: pop .3s ease; }
.answer:active { transform: scale(.98); }
.q-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.back-btn { font: inherit; font-size: .85rem; font-weight: 600; background: none; border: 0; color: var(--muted); cursor: pointer; padding: 4px 0; }
.back-btn:hover { color: var(--text); }
.back-btn[disabled] { visibility: hidden; }
.dots { display: flex; gap: 6px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.dots span { width: 10px; height: 10px; border-radius: 50%; background: var(--border); transition: background .2s, transform .2s; }
.dots span.done { background: var(--accent); }
.dots span.now { background: var(--accent); transform: scale(1.35); }

/* Pantalla de "analizando" */
.loading { text-align: center; padding: 40px 24px; }
.loading .spinner { width: 64px; height: 64px; margin: 0 auto 18px; border-radius: 50%; border: 6px solid var(--border); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.loading .msg { font-weight: 700; font-size: 1.1rem; min-height: 1.6em; }

/* Resultado animado */
.result.show { animation: reveal .6s cubic-bezier(.2,.9,.3,1.2) both; }
.result .r-emoji { display: block; width: fit-content; margin-inline: auto; animation: bounce 1.6s ease-in-out infinite; }

/* Medidor héroe / villano y desglose */
.meter-card h2 { font-size: 1.05rem; }
.meter { display: flex; height: 34px; border-radius: 99px; overflow: hidden; font-weight: 800; font-size: .85rem; color: #fff; }
.meter > div { display: flex; align-items: center; padding-inline: 12px; white-space: nowrap; transition: width 1s ease; width: 0; }
.meter .m-hero { background: #1d4ed8; }
.meter .m-vill { background: #b91c1c; justify-content: flex-end; }
.bars { display: grid; gap: 10px; margin-top: 18px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 1fr) 46px; gap: 4px 10px; align-items: center; font-size: .9rem; }
.bar-row .lbl { min-width: 0; }
.bar-row .pct { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.bar-row .track { grid-column: 1 / -1; height: 10px; background: var(--border); border-radius: 99px; overflow: hidden; }
.bar-row .fill { height: 100%; width: 0; border-radius: 99px; transition: width 1s ease; }

#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 50; width: 100%; height: 100%; }

@media (prefers-reduced-motion: reduce) {
  .anim-in, .anim-back, .answer.selected, .result.show, .result .r-emoji, .loading .spinner { animation: none !important; }
  .meter > div, .bar-row .fill, .progress > div { transition: none !important; }
}

/* ---- Navegación superior ---- */
.top-nav { display: flex; gap: 16px; font-size: .92rem; font-weight: 600; }
.top-nav a { text-decoration: none; color: var(--muted); }
.top-nav a:hover { color: var(--text); }

/* ---- Sección "Sobre este quiz" ---- */
.about-quiz h2 { margin-top: 0; }
.about-quiz h3 { margin: 22px 0 10px; font-size: 1.05rem; }
.about-quiz p { line-height: 1.65; }
.res-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.res-list li { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--border); border-radius: 14px; }
.res-list .r-ico { font-size: 1.6rem; line-height: 1; }
.res-list p { margin: 4px 0 0; font-size: .93rem; color: var(--muted); }
.small { font-size: .82rem; }
.quiz-list h2 { margin: 8px 0 4px; }

/* ---- Trivia ---- */
.answer.correct { border-color: #16a34a !important; background: #16a34a26 !important; }
.answer.wrong { border-color: #dc2626 !important; background: #dc262626 !important; }
.feedback { margin-top: 12px; padding: 12px 14px; border-radius: 12px; font-size: .95rem; line-height: 1.5; animation: pop .3s ease; }
.feedback.ok { background: #16a34a1f; border: 1px solid #16a34a55; }
.feedback.bad { background: #dc26261f; border: 1px solid #dc262655; }
.q-title { font-size: clamp(1.15rem, 4.5vw, 1.5rem); }
.rev-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--border); }
.rev-row:last-child { border-bottom: 0; }
.rev-row strong { display: block; font-size: .92rem; }
.rev-row .muted { font-size: .85rem; }
.back-btn[hidden] { display: none; }

/* Bandera como imagen */
img.flag { width: 1.6em; height: auto; border-radius: 3px; vertical-align: middle; box-shadow: 0 0 0 1px rgba(0,0,0,.15); }
.hero-emoji img.flag { width: 64px; }