:root {
  --bg: #0f1419;
  --panel: #1a2230;
  --panel-2: #232d3f;
  --border: #2d3a4f;
  --text: #e8eef5;
  --muted: #8a9bb0;
  --accent: #6aa9ff;
  --correct: #3ecf8e;
  --wrong: #ff5d6c;
  --dem: #3b82f6;
  --rep: #ef4444;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5; min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 760px; margin: 0 auto; padding: 32px 20px 64px; }
.wrap.wide { max-width: 1100px; }
header h1 { margin: 0 0 4px; font-size: 28px; letter-spacing: -0.01em; }
header .sub { color: var(--muted); font-size: 14px; margin-bottom: 24px; }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.flash.notice { background: rgba(62, 207, 142, 0.12); border: 1px solid var(--correct); color: var(--correct); }
.flash.alert { background: rgba(255, 93, 108, 0.12); border: 1px solid var(--wrong); color: var(--wrong); }
.progress { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px;
  margin-bottom: 12px; text-transform: uppercase; letter-spacing: 0.05em; }
.progress-bar { height: 4px; background: var(--panel); border-radius: 2px; overflow: hidden; margin-bottom: 24px; }
.progress-bar > div { height: 100%; background: var(--accent); transition: width 0.3s ease; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 24px; margin-bottom: 20px; }
.question-card { animation: question-in 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.options { animation: options-in 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both; animation-delay: 0.1s; }
.summary { font-size: 18px; line-height: 1.6; }
@keyframes question-in {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes options-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: no-preference) {
  ::view-transition-old(root) {
    animation: 0.22s cubic-bezier(0.4, 0, 1, 1) both vt-fade-out;
  }
  ::view-transition-new(root) {
    animation: 0.32s cubic-bezier(0.2, 0.8, 0.2, 1) 0.05s both vt-slide-in;
  }
}
@keyframes vt-fade-out {
  to { opacity: 0; transform: translateY(-8px); }
}
@keyframes vt-slide-in {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
.options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.options.parties { gap: 14px; }
@media (max-width: 480px) { .options { grid-template-columns: 1fr; } }
.opt {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  padding: 12px 16px; border-radius: 12px; font-size: 16px; cursor: pointer;
  text-align: left; font-family: inherit; width: 100%;
  display: flex; align-items: center; gap: 12px;
  transition: transform 0.08s ease, border-color 0.15s ease, background 0.15s ease;
}
.opt:active { transform: scale(0.98); }
.opt-avatar {
  flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%;
  overflow: hidden; background: var(--panel); border: 2px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center;
}
.opt-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.opt-label { flex: 1; font-weight: 500; }
.options.parties .opt { padding: 18px; font-size: 18px; font-weight: 700; border-width: 2px; justify-content: center; }
.options.parties .opt-avatar { width: 56px; height: 56px; background: #fff; }
.options.parties .opt-avatar img { object-fit: contain; padding: 6px; }
.opt:hover { background: #2c3950; border-color: var(--accent); }
.opt[data-party="Democrats"]:hover { background: rgba(59,130,246,0.18); border-color: var(--dem); }
.opt[data-party="Republicans"]:hover { background: rgba(239,68,68,0.18); border-color: var(--rep); }
.btn { background: var(--accent); color: #08111c; border: none; padding: 10px 20px; border-radius: 8px;
  font-size: 15px; font-weight: 600; cursor: pointer; font-family: inherit; display: inline-block; text-decoration: none; }
.btn:hover { filter: brightness(1.1); text-decoration: none; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn.big { padding: 14px 24px; font-size: 16px; }
.score { font-size: 56px; font-weight: 700; color: var(--accent); margin: 8px 0 4px; }
.score-sub { color: var(--muted); margin-bottom: 24px; }
.review-row { padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.review-row:last-child { border-bottom: none; }
.review-row .who { font-size: 12px; color: var(--muted); margin-top: 4px; }
.review-row .you { color: var(--wrong); }
.review-row .you.right { color: var(--correct); }
.pchip { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 11px;
  font-weight: 700; text-transform: uppercase; margin-left: 4px; letter-spacing: 0.04em; }
.pchip.dem { background: rgba(59,130,246,0.2); color: var(--dem); }
.pchip.rep { background: rgba(239,68,68,0.2); color: var(--rep); }
.feedback {
  text-align: center; padding: 32px 24px;
  border-radius: 16px; border: 1px solid var(--border);
  background: var(--panel); margin-bottom: 24px;
  animation: feedback-in 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.feedback-right { border-color: var(--correct); box-shadow: 0 0 0 1px var(--correct), 0 16px 48px rgba(62,207,142,0.18); }
.feedback-wrong { border-color: var(--wrong); box-shadow: 0 0 0 1px var(--wrong), 0 16px 48px rgba(255,93,108,0.15); }
.feedback-banner {
  font-size: clamp(28px, 5vw, 40px); font-weight: 800; letter-spacing: -0.02em;
  margin-bottom: 24px; animation: banner-pop 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.feedback-right .feedback-banner { color: var(--correct); }
.feedback-wrong .feedback-banner { color: var(--wrong); }

.feedback-portrait { display: flex; align-items: center; justify-content: center; gap: 24px; margin-bottom: 24px; }
.portrait-col { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.portrait-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); font-weight: 600; }
.portrait-name { font-size: 16px; font-weight: 700; }
.portrait-arrow { font-size: 28px; color: var(--muted); padding-top: 18px; }

.portrait-frame {
  width: 160px; height: 160px; border-radius: 50%;
  overflow: hidden; border: 4px solid var(--border);
  background: var(--panel-2);
  animation: portrait-in 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.portrait-solo .portrait-frame { width: 200px; height: 200px; }
.portrait-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.portrait-frame.correct { border-color: var(--correct); box-shadow: 0 0 0 6px rgba(62,207,142,0.18); animation-name: portrait-correct; }
.portrait-frame.wrong { border-color: var(--wrong); box-shadow: 0 0 0 6px rgba(255,93,108,0.15); }
.portrait-pair .portrait-col:last-child .portrait-frame { animation-delay: 0.1s; }

.portrait-frame.is-party { background: #fff; }
.portrait-frame.is-party img { object-fit: contain; padding: 18px; }

.signed-by {
  display: inline-flex; align-items: center; gap: 8px;
  margin: 8px auto 20px; padding: 8px 16px;
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 999px; font-size: 14px; color: var(--muted);
}
.signed-by strong { color: var(--text); }
.signed-avatar {
  width: 32px; height: 32px; border-radius: 50%; overflow: hidden;
  border: 2px solid var(--border); flex: 0 0 auto;
}
.signed-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

.feedback-detail { max-width: 540px; margin: 0 auto 24px; text-align: left; }
.feedback-title { font-size: 18px; font-weight: 700; text-align: center; margin-bottom: 12px; }
.feedback-summary { font-size: 15px; line-height: 1.65; padding: 16px 18px;
  background: var(--panel-2); border-radius: 10px; border: 1px solid var(--border); }
.feedback-source { text-align: center; margin-top: 14px; font-size: 14px; }
.feedback-source a { font-weight: 600; }
.feedback-source a::after { content: " ↗"; color: var(--muted); font-weight: 400; }
.feedback-next { min-width: 200px; }

@media (max-width: 520px) {
  .portrait-frame { width: 110px; height: 110px; border-width: 3px; }
  .portrait-solo .portrait-frame { width: 150px; height: 150px; }
  .feedback-portrait { gap: 12px; }
  .portrait-arrow { font-size: 22px; padding-top: 14px; }
}

@keyframes feedback-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes banner-pop {
  0% { opacity: 0; transform: scale(0.8); }
  60% { transform: scale(1.06); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes portrait-in {
  from { opacity: 0; transform: scale(0.7); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes portrait-correct {
  0% { opacity: 0; transform: scale(0.7) rotate(-6deg); }
  60% { transform: scale(1.08) rotate(2deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}
.choices { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; align-items: stretch; }
.choices > form { display: flex; }
.choices > form > .choice { height: 100%; display: flex; flex-direction: column; }
.choices > form > .choice p { margin-top: auto; }
@media (max-width: 600px) { .choices { grid-template-columns: 1fr; } }
.choice {
  display: block; padding: 24px; background: var(--panel); border: 1px solid var(--border);
  border-radius: 16px; color: var(--text); cursor: pointer; text-align: left;
  width: 100%; font-family: inherit;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  position: relative; overflow: hidden;
}
.choice:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.35); }
.choice h3 { margin: 14px 0 6px; font-size: 20px; }
.choice p { color: var(--muted); margin: 0; font-size: 14px; }
.choice-faces { display: flex; }
.choice-faces img {
  width: 48px; height: 48px; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--panel); margin-left: -10px; background: var(--panel-2);
}
.choice-faces img:first-child { margin-left: 0; }
.choice-parties .choice-faces img { background: #fff; object-fit: contain; padding: 6px; }

.hero {
  position: relative; padding: 72px 20px 64px; margin-bottom: 32px;
  text-align: center; overflow: hidden;
  border-bottom: 1px solid var(--border);
  background: #0b1220;
}
.hero-flag {
  position: absolute; inset: 0; z-index: 0;
  background-size: cover; background-position: center;
  filter: saturate(1.25) contrast(1.05);
}
.hero-overlay {
  position: absolute; inset: 0; z-index: 1;
  background:
    radial-gradient(ellipse at center, rgba(15,20,25,0) 0%, rgba(15,20,25,0.25) 70%, rgba(15,20,25,0.65) 100%);
}

.hero-presidents {
  display: flex; justify-content: center; gap: 6px;
  margin: 18px 0 22px; flex-wrap: nowrap;
}
.hero-presidents img {
  width: 64px; height: 64px; border-radius: 50%; object-fit: cover;
  border: 2px solid rgba(255,255,255,0.85);
  box-shadow: 0 6px 18px rgba(0,0,0,0.55);
  flex: 0 0 auto;
  transition: transform 0.2s ease;
}
.hero-presidents img:hover { transform: translateY(-3px) scale(1.05); }
@media (max-width: 600px) {
  .hero-presidents { gap: 4px; }
  .hero-presidents img { width: 44px; height: 44px; border-width: 2px; }
}
.hero-inner { position: relative; z-index: 3; max-width: 760px; margin: 0 auto; }
.hero .kicker {
  display: inline-block; font-size: 12px; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--accent); font-weight: 700;
  padding: 4px 12px; border: 1px solid var(--accent); border-radius: 999px;
  margin-bottom: 16px; background: rgba(106,169,255,0.08);
}
.hero h1 {
  font-size: clamp(40px, 7vw, 64px); margin: 0 0 14px;
  letter-spacing: -0.02em; line-height: 1.05;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0,0,0,0.6), 0 0 32px rgba(0,0,0,0.4);
}
.hero .lede {
  color: #e8eef5; font-size: 18px; max-width: 580px; margin: 0 auto 24px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.7);
}
.hero-flags { display: inline-flex; align-items: center; gap: 14px; }
.hero-flags img { width: 52px; height: 52px; object-fit: contain;
  background: #fff; border-radius: 50%; padding: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.hero-flags .vs { font-size: 14px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.1em; }
@media (max-width: 600px) {
  .hero-bg { gap: 6px; }
  .hero-bg img { width: 70px; height: 70px; }
  .hero { padding: 40px 16px 36px; }
}
table.attempts { width: 100%; border-collapse: collapse; font-size: 14px; }
table.attempts th, table.attempts td { padding: 10px 8px; text-align: left; border-bottom: 1px solid var(--border); }
table.attempts th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; }
table.attempts tr:hover td { background: var(--panel-2); }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.topbar .links a { margin-right: 14px; font-size: 14px; }
form.inline { display: inline; }
input[type="email"], input[type="password"] {
  width: 100%; padding: 12px 14px; background: var(--panel-2); border: 1px solid var(--border);
  color: var(--text); border-radius: 8px; font-size: 15px; font-family: inherit; margin-bottom: 12px;
}
label { display: block; margin-bottom: 4px; font-size: 13px; color: var(--muted); }
.info-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
  margin-top: 40px;
}
@media (max-width: 700px) { .info-grid { grid-template-columns: 1fr; } }
.info-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; padding: 20px;
}
.info-icon { font-size: 28px; margin-bottom: 10px; line-height: 1; }
.info-card h4 { margin: 0 0 8px; font-size: 16px; }
.info-card p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }

footer { margin-top: 40px; color: var(--muted); font-size: 12px; text-align: center; }
.muted { color: var(--muted); }
.right { text-align: right; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px;
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.badge.right { background: var(--correct); color: #082d1d; }
.badge.wrong { background: var(--wrong); color: #2d0810; }
