/* Base reset shared by every page */
:root{padding-top:env(safe-area-inset-top,0px);padding-bottom:env(safe-area-inset-bottom,0px)}
body{margin:0}
img{max-width:100%}
[hidden]{display:none!important}

/* Layout: una papeleta centrada, una afirmación por pantalla; resultados en lista ordenada con barras neutras (sin colores de partido) */
:root{
  --bg:#f3f4f6; --paper:#ffffff; --ink:#1c2230; --muted:#5d6577; --line:#d9dce3;
  --accent:#a8670f; --accent-soft:#f6ead8; --sel:#1c2230; --sel-fg:#ffffff; color-scheme:light;
  --chip:#edf0f5; --chip-line:#c2c8d4; --star-bg:#f2b83d; --star-fg:#1c2230;
  --display:"Newsreader", Georgia, serif;
  --body:"Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono:"IBM Plex Mono", ui-monospace, Menlo, monospace;
}
@media (prefers-color-scheme: dark){:root:not([data-theme="light"]){
  --bg:#13161d; --paper:#1c2029; --ink:#e8eaf0; --muted:#9aa1b2; --line:#2f3542;
  --accent:#e0a14a; --accent-soft:#3a2c17; --sel:#e8eaf0; --sel-fg:#13161d; color-scheme:dark;
  --chip:#272d3a; --chip-line:#434b5c; --star-bg:#e8b04e; --star-fg:#13161d}}
:root[data-theme="dark"]{
  --bg:#13161d; --paper:#1c2029; --ink:#e8eaf0; --muted:#9aa1b2; --line:#2f3542;
  --accent:#e0a14a; --accent-soft:#3a2c17; --sel:#e8eaf0; --sel-fg:#13161d; color-scheme:dark;
  --chip:#272d3a; --chip-line:#434b5c; --star-bg:#e8b04e; --star-fg:#13161d}
*{box-sizing:border-box}
body{background:var(--bg);color:var(--ink);font:15px/1.55 var(--body);padding:12px 16px 32px}
@media (min-width:640px){body{padding-block:28px 48px}}
a{color:var(--accent)}
.wrap{max-width:640px;margin:0 auto;display:flex;flex-direction:column;gap:14px}
@media (min-width:640px){.wrap{gap:20px}}
header{display:flex;justify-content:space-between;align-items:center;gap:10px;min-height:36px}
.brand{font:700 1.42rem/1 var(--display);letter-spacing:-.01em;white-space:nowrap;color:inherit;text-decoration:none;position:relative;top:.13em}
.brand span{color:var(--accent)}
.meta{font:500 .75rem var(--mono);color:var(--muted);text-transform:uppercase;letter-spacing:.08em}
.hdr-right{display:flex;align-items:center;gap:10px}
.upd{white-space:nowrap}
.hdr-meta{display:none}
/* Desktop only: the two-line date block shown when the site launched replaces the compact "Act. 9 oct". */
@media (min-width:1024px){.hdr-meta{display:flex;flex-direction:column;gap:2px;text-align:right}.upd{display:none}}
.theme{width:36px;height:36px;display:inline-flex;align-items:center;justify-content:center;background:transparent;color:var(--ink);border:1px solid var(--line);border-radius:4px;cursor:pointer;padding:0}
.theme:hover{border-color:var(--ink)}
.theme svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.theme .sun{display:none}
:root[data-theme="dark"] .theme .sun{display:block}
:root[data-theme="dark"] .theme .moon{display:none}
.paper{background:var(--paper);border:1px solid var(--line);border-radius:6px;padding:20px 16px;display:flex;flex-direction:column;gap:16px}
@media (min-width:640px){.paper{padding:28px 24px;gap:18px}}
h1,h2,h3{font-family:var(--display);font-weight:700;text-wrap:balance;margin:0;line-height:1.15}
h1{font-size:clamp(1.6rem,7.4vw,1.9rem)} h2{font-size:1.45rem}
h3{font-size:1.15rem}
#mtitle,#ftitle,#ptitle{font-size:1.45rem}
p{margin:0;max-width:62ch}
.muted{color:var(--muted)}
.note{font-size:.85rem;color:var(--muted);border-left:3px solid var(--accent);padding-left:12px}
.btn{font:600 .95rem var(--body);border:1px solid var(--ink);background:var(--ink);color:var(--paper);padding:11px 18px;border-radius:4px;cursor:pointer;text-decoration:none;display:inline-flex;align-items:center;gap:8px}
.btn.ghost{background:var(--chip);color:var(--ink);border-color:var(--chip-line)}
.btn:focus-visible,.theme:focus-visible,.opt:focus-visible,.star:focus-visible,.wstar:focus-visible,.navbtn:focus-visible,summary:focus-visible,a:focus-visible{outline:3px solid var(--accent);outline-offset:2px}
.row{display:flex;gap:10px;flex-wrap:wrap;align-items:center}
.progress{height:4px;flex:none;background:var(--line);border-radius:2px;overflow:hidden}
.progress i{display:block;height:100%;background:var(--accent);transition:width .25s}
.topic{font:500 .75rem var(--mono);text-transform:uppercase;letter-spacing:.1em;color:var(--accent)}
/* Quiz: one slide per screen. Must fit an iPhone SE (375x667, ~553px usable in Safari) without scrolling. */
body.quiz{height:calc(100dvh - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px));overflow:hidden;padding-bottom:10px}
body.quiz .wrap{height:100%;gap:10px}
body.quiz .legend{display:none}
body.quiz #app{flex:1;min-height:0;padding:12px 14px;gap:0;overflow:hidden}
.slide{display:flex;flex-direction:column;gap:10px;height:100%;min-height:0}
.qhead{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:36px}
.qmeta{display:flex;flex-direction:column;gap:2px;min-width:0}
.qcount{font:500 .72rem var(--mono);color:var(--muted)}
.star{display:inline-flex;align-items:center;gap:6px;min-height:36px;padding:0 12px 0 10px;border:1px solid var(--star-bg);border-radius:999px;background:var(--star-bg);color:var(--star-fg);font:700 .82rem var(--body);cursor:pointer;white-space:nowrap}
.star svg,.wstar svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:2;stroke-linejoin:round;flex:none}
.star[aria-pressed="true"]{box-shadow:inset 0 0 0 2px var(--star-fg)}
.star[aria-pressed="true"] svg{fill:var(--star-fg);stroke:var(--star-fg)}
.wstar[aria-pressed="true"] svg{fill:var(--accent);stroke:var(--accent)}
.more{align-self:flex-start;flex:none;display:inline-flex;align-items:center;gap:6px;min-height:32px;padding:0;background:none;border:none;color:var(--accent);font:600 .85rem var(--body);cursor:pointer}
.more{margin:-6px 0 6px}
@media (min-width:560px){.more{margin:-8px 0 8px}}
.more:hover span{text-decoration:underline;text-underline-offset:3px}
.more:focus-visible{outline:3px solid var(--accent);outline-offset:2px}
.more i{font:600 1rem var(--mono);font-style:normal;width:1ch;text-align:center}
.infodlg{width:min(520px,calc(100vw - 32px));min-height:min(65dvh,500px);max-height:min(90dvh,800px);padding:0;overflow:auto;background:var(--paper);color:var(--ink);border:1px solid var(--line);border-radius:6px;box-shadow:0 12px 40px rgba(0,0,0,.3);font-size:.92rem}
.infodlg[open]{display:flex;flex-direction:column}
.infodlg::backdrop{background:rgba(10,12,18,.6)}
.dlg-body{flex:1;display:flex;flex-direction:column;gap:14px;padding:20px 20px 24px}
.dlg-head{display:flex;align-items:center;justify-content:space-between;gap:10px}
.dlg-x{flex:none;width:36px;height:36px;display:inline-flex;align-items:center;justify-content:center;padding:0;background:transparent;color:var(--ink);border:1px solid var(--line);border-radius:4px;cursor:pointer}
.dlg-x:hover{border-color:var(--ink)}
.dlg-x:focus-visible{outline:3px solid var(--accent);outline-offset:2px}
.dlg-x svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round}
.dlg-q{font:500 1.05rem/1.3 var(--display)}
.dlg-sides{display:flex;flex-direction:column;gap:8px}
.dlg-side{background:var(--chip);border:1px solid var(--chip-line);border-radius:8px;padding:10px 12px;display:flex;flex-direction:column;gap:4px}
.dlg-side h3{display:flex;align-items:center;gap:8px;font:500 .72rem var(--mono);text-transform:uppercase;letter-spacing:.08em;color:var(--muted)}
.dlg-side h3 svg{width:18px;height:18px;flex:none;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;color:var(--ink)}
.dlg-side p{font-size:.9rem}
.dlg-links{list-style:none;margin:auto 0 0;padding:0;display:flex;flex-direction:column;gap:6px;font-size:.85rem}
.dlg-links li{position:relative;padding-left:1.3em}
.dlg-links li::before{content:"–";position:absolute;left:.15em;color:var(--muted)}
body:has(.infodlg[open]){overflow:hidden}
.statement:focus{outline:none}
.statement{flex:0 1 auto;min-height:0;margin:0;padding-top:10px;font:500 var(--fs)/1.25 var(--display);text-wrap:balance}
.len-s{--fs:clamp(1.3rem,6.8vw,1.8rem)}
.len-m{--fs:clamp(1.2rem,6vw,1.6rem)}
.len-l{--fs:clamp(1.08rem,5.2vw,1.4rem)}
.opts{display:flex;flex-direction:column;gap:6px;flex:1 1 auto;min-height:0}
.opt{font:500 .95rem/1.2 var(--body);background:var(--chip);color:var(--ink);border:1px solid var(--chip-line);box-shadow:0 1px 0 var(--chip-line);border-radius:8px;padding:0 14px;cursor:pointer;flex:1 1 0;min-height:44px;max-height:60px;display:flex;align-items:center;gap:12px;text-align:left}
.opt b{font:600 1rem var(--mono);width:2.2ch;text-align:center}
.opt:active{transform:translateY(1px);box-shadow:none}
.opt:hover{border-color:var(--ink)}
.opt[aria-pressed="true"]{background:var(--sel);color:var(--sel-fg);border-color:var(--sel);box-shadow:none}
.qnav{display:flex;justify-content:space-between;align-items:center;min-height:40px}
.navbtn{background:none;border:none;color:var(--muted);font:600 .9rem var(--body);min-height:40px;padding:0 4px;cursor:pointer;display:inline-flex;align-items:center;gap:4px}
.navbtn.skip{text-decoration:underline;text-underline-offset:3px}
.navbtn svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
@media (max-height:620px){.opt{min-height:40px;font-size:.9rem}.opts{gap:5px}.slide{gap:8px}.progress{height:3px}}
@media (max-height:520px){.opt{min-height:36px}.statement{font-size:1rem}body.quiz #app{padding:10px 12px}.qhead,.navbtn,.qnav{min-height:32px}.star{min-height:32px}.slide{gap:6px}}
@media (max-height:480px){.statement{font-size:.95rem;line-height:1.22}body.quiz .wrap{gap:6px}body.quiz{padding-top:8px}.opts{gap:4px}}
@media (min-width:560px){body.quiz{height:auto;overflow:visible}body.quiz .wrap{height:auto}body.quiz #app{flex:none;padding:28px 24px;gap:16px}.slide{height:auto;gap:16px}.opts{flex:none;display:grid;grid-template-columns:repeat(5,1fr)}.opt{max-height:none;flex-direction:column;justify-content:center;min-height:64px;padding:12px 4px;text-align:center;gap:6px;font-size:.8rem}}
@keyframes inNext{from{transform:translateX(32px);opacity:0}to{transform:none;opacity:1}}
@keyframes inPrev{from{transform:translateX(-32px);opacity:0}to{transform:none;opacity:1}}
@keyframes outNext{to{transform:translateX(-32px);opacity:0}}
@keyframes outPrev{to{transform:translateX(32px);opacity:0}}
.slide.in-next{animation:inNext .22s ease-out}
.slide.in-prev{animation:inPrev .22s ease-out}
.slide.out-next{animation:outNext .15s ease-in forwards}
.slide.out-prev{animation:outPrev .15s ease-in forwards}
.cta{display:flex;justify-content:flex-end;align-items:center;gap:10px}
.cta #reset{margin-right:auto}
.btn svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.wstar{display:inline-flex;vertical-align:middle;margin-right:6px;padding:4px;min-width:28px;min-height:28px;align-items:center;justify-content:center;background:none;border:none;color:var(--muted);cursor:pointer}
.results{display:flex;flex-direction:column;gap:14px}
.res{display:grid;grid-template-columns:7.5rem 1fr 3.5rem;gap:12px;align-items:center}
.res .name{font-weight:600}
.res .pct{font:500 .95rem var(--mono);text-align:right;font-variant-numeric:tabular-nums}
.bar{height:12px;background:var(--line);border-radius:2px;overflow:hidden}
.bar i{display:block;height:100%;background:var(--ink)}
.res.top .bar i{background:var(--accent)}
.res.top .name::after{content:" · más afín";font-weight:500;font-size:.8rem;color:var(--accent)}
@media (max-width:480px){.res{grid-template-columns:1fr 3.5rem}.res .bar{grid-column:1/-1;grid-row:2}}
details{border-top:1px solid var(--line);padding-top:14px}
summary{cursor:pointer;font-weight:600}
details > div, details > ol, details > section{margin-top:12px}
.est{font-style:italic;color:var(--muted)}
.cards{list-style:none;margin:12px 0 0;padding:0;display:flex;flex-direction:column;gap:10px}
.qcard{border:1px solid var(--line);border-radius:8px;padding:12px;display:flex;flex-direction:column;gap:10px}
.qc-head{display:flex;align-items:flex-start;gap:8px}
.qc-head .wstar{margin:-4px 0 0 -6px}
.qc-q{flex:1;font:500 .98rem/1.3 var(--display);margin:0}
.qc-you{flex:none;font:500 .75rem var(--mono);color:var(--muted);background:var(--accent-soft);border-radius:6px;padding:4px 8px;white-space:nowrap}
.qc-you b{color:var(--ink);font-size:.95rem}
.qc-parties{list-style:none;margin:0;padding:0;display:grid;grid-template-columns:repeat(3,1fr);gap:6px}
@media (min-width:480px){.qc-parties{grid-template-columns:repeat(6,1fr)}}
.chip{display:flex;flex-direction:column;align-items:center;gap:2px;background:var(--chip);border:1px solid var(--chip-line);border-radius:6px;padding:6px 4px;font:600 1rem var(--mono)}
.chip .pn{font:500 .66rem var(--mono);text-transform:uppercase;letter-spacing:.06em;color:var(--muted)}
.chip a{color:inherit;text-decoration:underline dotted;text-underline-offset:3px;padding:2px 6px}
.chip.match{background:var(--accent-soft);border-color:var(--accent)}
.chip.match,.chip.match a{color:var(--accent);font-weight:700}
.legend{font-size:.8rem;color:var(--muted)}
/* Footer: centred. When a page is shorter than the window (phones taller than an iPhone SE, desktop) it hugs the bottom
   and the home card sits in the middle of the free space. On an iPhone SE the content is taller, so nothing changes. */
.wrap{min-height:calc(100dvh - 44px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px))}
@media (min-width:640px){.wrap{min-height:calc(100dvh - 76px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px))}}
.wrap > .legend{margin-top:auto;max-width:none;text-align:center}
body.intro #app{flex:1 0 auto}      /* phones/tablets: the home card takes all the free height */
body.intro .wrap > .legend{margin-top:0}
.faq{margin-top:16px;gap:8px;font-size:.9rem}
.faq h2{margin-bottom:4px}
.faq h3{font-size:1rem;margin-top:10px}
.faq p{margin:0}
body:not(.intro) .faq{display:none}   /* only the home start screen shows it (crawlers and no-JS visitors still get it) */
.srclist{display:flex;flex-direction:column;gap:16px;padding-left:1.4em;margin:12px 0 0}
.srclist li{font-size:.85rem}
.srclist li > p{font-weight:600;margin-bottom:4px}
.srclist ul{list-style:none;padding:0;margin:0;display:flex;flex-direction:column;gap:3px}
.srclist .pty{font:500 .72rem var(--mono);display:inline-block;width:5.2em;color:var(--muted)}
.method{display:flex;flex-direction:column;gap:10px;font-size:.9rem}
.formula{margin:4px 0;padding:16px;background:var(--chip);border:1px solid var(--chip-line);border-left:4px solid var(--accent);border-radius:8px;display:flex;flex-direction:column;gap:12px}
.formula figcaption{font:500 .72rem var(--mono);text-transform:uppercase;letter-spacing:.08em;color:var(--muted)}
.f-step{display:flex;flex-direction:column;gap:6px}
.f-name{font:500 .72rem var(--mono);color:var(--accent)}
.f-eq{display:flex;align-items:center;justify-content:center;gap:10px;font:italic 500 clamp(.92rem,4.7vw,1.15rem)/1.2 var(--display);padding:8px 8px;flex-wrap:wrap;row-gap:4px;background:var(--paper);border:1px solid var(--chip-line);border-radius:6px}
.f-lhs{font-weight:700;font-size:1.5rem}
.frac{display:inline-flex;flex-direction:column;align-items:center;text-align:center}
.frac .num{padding:0 6px 6px;border-bottom:2px solid var(--ink);white-space:nowrap}
.frac .den{padding-top:6px}
.f-legend{display:flex;flex-direction:column;gap:4px;margin:0;font-size:.85rem}
.f-legend div{display:flex;gap:8px;align-items:baseline}
.f-legend dt{flex:none;min-width:5.5rem;font:600 .78rem var(--mono);color:var(--accent)}
.f-legend dd{margin:0}
.f-example{font-size:.85rem;color:var(--muted);border-top:1px solid var(--chip-line);padding-top:10px}
.f-example b{color:var(--ink)}
.method ul{margin:0;padding-left:1.2em;display:flex;flex-direction:column;gap:6px}
.share{display:flex;gap:6px;flex-wrap:wrap}
.share .btn{padding:9px 14px;font-size:.88rem}
.inc{display:flex;align-items:center;gap:8px;min-height:40px;font-size:.9rem;cursor:pointer}
.inc input{width:18px;height:18px;accent-color:var(--accent)}
.sharenote{font-size:.8rem;color:var(--muted);margin-top:4px}
.privacy h3{margin-top:6px}
.privacy code{font:500 .8rem var(--mono);background:var(--chip);border:1px solid var(--chip-line);border-radius:4px;padding:1px 5px}
.btn.icon{width:42px;height:42px;padding:0;justify-content:center}
.btn.icon svg{width:20px;height:20px}
.btn.icon svg.logo{fill:currentColor;stroke:none}
@media (prefers-reduced-motion:reduce){.progress i{transition:none}.slide{animation:none!important}}

/* ===== Desktop layout =====
   Everything visual lives inside the (min-width:1024px) query: phones and tablets keep the layouts above.
   The few base rules just below only keep new wrapper elements transparent (or hidden) on small screens. */
.intro-main,.intro-side,.res-side,.res-main,.page,.page-main{display:contents}
.how,.toc,.kbd-hint{display:none}
.res-side .row{order:1}
.share-wrap{order:1;margin-top:auto}   /* below the call to action, pushed to the bottom of the card; desktop resets the order below */
kbd{font:600 .78em var(--mono);background:var(--chip);border:1px solid var(--chip-line);border-bottom-width:2px;border-radius:4px;padding:1px 5px}
h3[id]{scroll-margin-top:20px}

@media (min-width:1024px){
  html{font-size:112.5%}               /* +12.5% everywhere: every size below is in rem */
  body{font-size:.9375rem}
  .wrap{max-width:1120px}

  /* Home: copy on the left, how it works + sharing on a tinted panel on the right */
  #app[data-view="intro"]{display:grid;grid-template-columns:minmax(0,1.2fr) minmax(0,.8fr);gap:0;padding:0;overflow:hidden}
  #app[data-view="intro"] .intro-main,#app[data-view="intro"] .intro-side{display:flex;flex-direction:column;gap:22px;padding:48px 52px}
  #app[data-view="intro"] .intro-side{background:var(--chip);border-left:1px solid var(--chip-line)}
  #app[data-view="intro"] h1{font-size:2.5rem}
  #app[data-view="intro"] .cta{justify-content:flex-end;flex-wrap:nowrap;margin-top:auto;padding-top:8px}
  #app[data-view="intro"] .cta .btn{white-space:nowrap;padding-inline:12px}
  #app[data-view="intro"] .cta #reset{margin-right:0}
  .how{display:block}
  .how h2{font-size:1.3rem;margin-bottom:14px}
  .how ol{list-style:none;counter-reset:step;margin:0;padding:0;display:flex;flex-direction:column;gap:14px}
  .how li{counter-increment:step;display:grid;grid-template-columns:1.6rem 1fr;gap:8px}
  .how li::before{content:counter(step);font:600 1.05rem/1.4 var(--mono);color:var(--accent)}
  .intro-main .share-wrap{order:0;margin-top:auto}

  body.intro #app{flex:none;margin-block:auto}   /* desktop: two-panel card, centred instead of stretched */

  /* Test: one big centred card, vertically centred in the window */
  body.quiz .wrap{min-height:calc(100dvh - 76px)}
  body.quiz #app{width:100%;max-width:820px;margin:auto;padding:40px 48px;gap:0}
  .slide{gap:22px}
  .len-s{--fs:2.2rem}.len-m{--fs:2rem}.len-l{--fs:1.8rem}
  .opt{min-height:92px;font-size:.88rem}
  .opt b{font-size:1.25rem}
  .kbd-hint{display:block;max-width:none;text-align:center;font-size:.8rem;color:var(--muted);margin:0}

  /* Results: sticky summary on the left, per-question cards in two columns on the right */
  #app[data-view="results"]{display:grid;grid-template-columns:clamp(340px,32vw,400px) minmax(0,1fr);gap:48px;align-items:start;padding:40px}
  .res-side{display:flex;flex-direction:column;gap:18px;position:sticky;top:20px}
  .res-side .row{order:0}
  .res-main{display:flex;flex-direction:column;gap:18px;min-width:0}
  .res-main details:first-child{border-top:0;padding-top:0}
  .cards{grid-template-columns:repeat(auto-fill,minmax(270px,1fr));display:grid;gap:12px}
  .qc-head{flex-wrap:wrap;row-gap:6px}
  .qc-head .wstar{order:1;margin:-4px 0 0 -6px}
  .qc-head .qc-you{order:2;margin-left:auto}
  .qc-head .qc-q{order:3;flex:1 1 100%;font-size:1.02rem}
  .qc-parties{grid-template-columns:repeat(3,1fr)}

  /* Text pages: reading column plus a sticky index on the left */
  .page{display:grid;grid-template-columns:220px minmax(0,760px);gap:48px;justify-content:center;align-items:start}
  .page-main{display:flex;flex-direction:column;gap:20px;min-width:0}
  .toc{display:block;position:sticky;top:24px;font-size:.88rem}
  .toc-title{font:500 .72rem var(--mono);text-transform:uppercase;letter-spacing:.08em;color:var(--muted);margin:0 0 10px}
  .toc ul{list-style:none;margin:0;padding:0;border-left:1px solid var(--line)}
  .toc a{display:block;padding:6px 0 6px 14px;margin-left:-1px;color:var(--muted);text-decoration:none;border-left:2px solid transparent}
  .toc a:hover,.toc a:focus-visible{color:var(--ink);border-left-color:var(--accent)}
  .paper.method{padding:40px 48px;line-height:1.65}
  .paper.method.privacy{max-width:800px;width:100%;margin-inline:auto}
  .legend{max-width:62ch}

  /* Footer: same width as the header and stuck to the bottom of the window when the page is short */
  .wrap > .legend{border-top:1px solid var(--line);padding-top:16px}
}
