:root {
  --sand: #F2EDE4;
  --navy: #1B2A4A;
  --muted: #8A8070;
  --white: #FFFFFF;
  --black: #0A0A0A;
  --grey: #666666;
  --red: #C8102E;
  --red-dark: #A80D26;
  --border: #E5E5E5;
  --green: #2E7D46;
  --brown: #7A4E2D;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Archivo', system-ui, -apple-system, sans-serif;
  background: var(--sand);
  color: var(--black);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button { font-family: inherit; }

@keyframes politiq-rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

.screen { display: none; }
.screen.active { display: block; }

/* ===================== SPLASH ===================== */

#splash-screen.active { display: block; }

.splash-wrap {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: var(--white);
}

.splash-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.splash-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(66% 84% at 50% 45%, rgba(255,255,255,0.96) 0%, rgba(255,255,255,0.9) 28%, rgba(255,255,255,0.55) 54%, rgba(255,255,255,0.15) 80%, rgba(255,255,255,0) 96%);
}

.splash-content {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 28px 96px;
  pointer-events: none;
}

.splash-inner {
  width: 100%;
  max-width: 600px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  pointer-events: auto;
  animation: politiq-rise .7s cubic-bezier(.2,.7,.2,1) both;
}

.splash-logo {
  font-weight: 900;
  font-size: clamp(56px, 10vw, 116px);
  line-height: 0.86;
  letter-spacing: -0.045em;
}
.splash-logo .q-grey { color: #BBBBBB; }

.splash-subtitle {
  margin-top: 16px;
  font-weight: 600;
  font-size: 12.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--grey);
}

.splash-card {
  margin-top: 30px;
  width: 100%;
  max-width: 530px;
  border: 1px solid var(--border);
  background: var(--white);
  padding: 26px 28px;
  box-shadow: 0 10px 40px rgba(10,10,10,0.05);
}
.splash-card p {
  font-size: 16.5px;
  line-height: 1.6;
  color: var(--black);
}

.splash-pills {
  margin-top: 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  justify-content: center;
}
.pill {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 15px;
  font-size: 13px;
  font-weight: 500;
  color: var(--black);
  background: var(--white);
}

.cta-btn {
  margin-top: 30px;
  background: var(--red);
  color: var(--white);
  border: none;
  font-weight: 800;
  font-size: 17px;
  letter-spacing: 0.005em;
  padding: 17px 38px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform .13s ease, background .13s ease, box-shadow .13s ease;
  box-shadow: 0 12px 26px rgba(200,16,46,0.26);
}
.cta-btn:hover {
  background: var(--red-dark);
  transform: translateY(-2px);
  box-shadow: 0 16px 32px rgba(200,16,46,0.32);
}
.cta-btn:active { transform: translateY(0) scale(0.98); }

.splash-footer {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 2;
  padding: 18px 24px 20px;
  text-align: center;
  pointer-events: none;
}
.splash-footer p {
  max-width: 660px;
  margin: 0 auto;
  font-size: 11px;
  line-height: 1.55;
  color: rgba(0,0,0,0.65);
  font-weight: 500;
}

/* ===================== QUIZ ===================== */

#quiz-screen.active,
#results-screen.active {
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 36px 20px 60px;
}

.quiz-container, .results-wrap {
  width: 100%;
  max-width: 640px;
}

.quiz-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 26px;
}
.quiz-logo {
  font-weight: 900;
  font-size: 26px;
  letter-spacing: -0.03em;
}
.quiz-logo .q-grey { color: #BBBBBB; }
.quiz-subtitle {
  margin-top: 6px;
  font-weight: 600;
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--grey);
}

.quiz-progress {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 30px;
}
.progress-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: transparent;
  border: 1.5px solid var(--muted);
  opacity: 0.5;
  transition: background .2s ease, opacity .2s ease, transform .2s ease;
}
.progress-dot.done {
  background: var(--muted);
  opacity: 1;
}
.progress-dot.current {
  background: var(--navy);
  border-color: var(--navy);
  opacity: 1;
  transform: scale(1.3);
}

.quiz-card {
  background: var(--white);
  border: 1px solid var(--border);
  padding: 34px 30px;
  animation: politiq-rise .5s cubic-bezier(.2,.7,.2,1) both;
}

.quiz-category {
  display: inline-block;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--navy);
  margin-bottom: 18px;
}

.quiz-question {
  font-size: clamp(22px, 4vw, 30px);
  font-weight: 800;
  line-height: 1.28;
  letter-spacing: -0.015em;
}

.help-toggle {
  margin-top: 16px;
  background: none;
  border: none;
  padding: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.help-toggle:hover { color: var(--black); }
.help-text {
  margin-top: 12px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--grey);
  border-left: 2px solid var(--border);
  padding-left: 14px;
}
.help-text[hidden] { display: none; }

.answer-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}
.answer-btn {
  flex: 1 1 30%;
  min-width: 100px;
  background: var(--white);
  border: 1.5px solid var(--black);
  color: var(--black);
  font-weight: 700;
  font-size: 15px;
  padding: 15px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .12s ease, color .12s ease, transform .1s ease;
}
.answer-btn:hover { background: var(--black); color: var(--white); }
.answer-btn:active { transform: scale(0.97); }

.spectrum {
  margin-top: 34px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}
.axis-block { text-align: center; }
.axis-bar {
  position: relative;
  height: 8px;
  border-radius: 999px;
  margin: 0 2px;
}
.ideo-gradient { background: linear-gradient(to right, var(--red), var(--white) 50%, var(--navy)); }
.gestion-gradient { background: linear-gradient(to right, var(--green), var(--white) 50%, var(--brown)); }

.axis-marker {
  position: absolute;
  top: 50%;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--black);
  border: 3px solid var(--white);
  box-shadow: 0 1px 5px rgba(0,0,0,0.35);
  transform: translate(-50%, -50%);
  transition: left .5s cubic-bezier(.2,.7,.2,1);
  left: 50%;
}

.axis-label {
  margin-top: 12px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--black);
}

/* ===================== RESULTS ===================== */

.result-card {
  background: var(--navy);
  color: var(--white);
  padding: 40px 32px;
  animation: politiq-rise .5s cubic-bezier(.2,.7,.2,1) both;
}

.result-eyebrow {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.6);
}

.result-name {
  margin-top: 10px;
  font-size: clamp(28px, 5vw, 40px);
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.05;
}

.result-party {
  margin-top: 6px;
  font-size: 15px;
  font-weight: 500;
  color: rgba(255,255,255,0.75);
}

.result-pct {
  margin-top: 18px;
  display: inline-block;
  font-size: 15px;
  font-weight: 800;
  background: rgba(255,255,255,0.12);
  padding: 8px 16px;
  border-radius: 999px;
}

.result-chips {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 600;
}

.result-profile {
  margin-top: 22px;
  font-size: 16px;
  line-height: 1.6;
  font-style: italic;
  color: rgba(255,255,255,0.92);
  border-left: 2px solid rgba(255,255,255,0.35);
  padding-left: 14px;
}

.result-desc {
  margin-top: 18px;
  font-size: 14.5px;
  line-height: 1.6;
  color: rgba(255,255,255,0.8);
}

.result-actions {
  margin-top: 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.action-btn {
  flex: 1 1 28%;
  min-width: 110px;
  text-align: center;
  background: var(--white);
  color: var(--navy);
  border: none;
  font-weight: 700;
  font-size: 13.5px;
  padding: 13px 10px;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  transition: transform .1s ease, background .12s ease;
}
.action-btn:hover { background: var(--sand); }
.action-btn:active { transform: scale(0.97); }

.ranking-title {
  margin-top: 44px;
  margin-bottom: 16px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
}

.ranking-list { display: flex; flex-direction: column; gap: 10px; }

.ranking-row {
  display: grid;
  grid-template-columns: 26px 1fr 90px 40px;
  align-items: center;
  gap: 12px;
  background: var(--white);
  border: 1px solid var(--border);
  padding: 12px 16px;
}
.ranking-row.is-top { border-color: var(--navy); }

.ranking-rank { font-size: 13px; font-weight: 800; color: var(--muted); }
.ranking-info { min-width: 0; }
.ranking-name {
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ranking-party {
  font-size: 11.5px;
  color: var(--grey);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ranking-bar-track {
  height: 6px;
  background: var(--sand);
  border-radius: 999px;
  overflow: hidden;
}
.ranking-bar-fill {
  height: 100%;
  background: var(--navy);
  border-radius: 999px;
}
.ranking-pct { font-size: 13px; font-weight: 800; text-align: right; }

.replay-btn {
  display: block;
  margin: 40px auto 0;
  background: var(--red);
  color: var(--white);
  border: none;
  font-weight: 800;
  font-size: 15px;
  padding: 15px 34px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .12s ease, transform .1s ease;
}
.replay-btn:hover { background: var(--red-dark); }
.replay-btn:active { transform: scale(0.97); }

/* ===================== RESPONSIVE ===================== */

@media (max-width: 480px) {
  .quiz-card { padding: 26px 20px; }
  .answer-btn { flex: 1 1 100%; }
  .action-btn { flex: 1 1 100%; }
  .result-card { padding: 30px 22px; }
  .ranking-row { grid-template-columns: 20px 1fr 60px 36px; gap: 8px; padding: 10px 12px; }
}
