/* ── Reset & base ────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #f7f7f5;
  --surface:   #ffffff;
  --border:    #e0e0d8;
  --text:      #1a1a1a;
  --muted:     #666;
  --accent:    #1d4ed8;
  --accent-hl: #1e40af;
  --ja:        #16a34a;
  --nej:       #dc2626;
  --avstar:    #9ca3af;
  --radius:    8px;
  --shadow:    0 1px 3px rgba(0,0,0,.08);
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
}

a { color: var(--accent); }
a:hover { color: var(--accent-hl); }
/* ── Dev banner ──────────────────────────────────────────────────────── */
.dev-banner {
  background: #fef9c3;
  border-bottom: 1px solid #fde047;
  color: #713f12;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.55rem 1rem;
}
/* ── Layout ──────────────────────────────────────────────────────────────── */
.container {
  max-width: 780px;
  margin: 0 auto;
  padding: 2rem 1rem 4rem;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
.site-header {
  background: var(--accent);
  color: #fff;
  padding: 1.2rem 1.5rem;
}
.site-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  letter-spacing: -0.3px;
}
.site-tagline {
  font-size: 0.85rem;
  opacity: 0.85;
  margin-top: 0.15rem;
}

/* ── Footer ──────────────────────────────────────────────────────────────── */
.site-footer {
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  padding: 2rem 1rem;
  border-top: 1px solid var(--border);
}
.site-footer a { color: var(--muted); }
.footer-links { margin-top: 0.5rem; }
.footer-links a { text-decoration: none; }
.footer-links a:hover { text-decoration: underline; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn-primary, .btn-secondary {
  display: inline-block;
  padding: 0.55rem 1.3rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background 0.15s;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hl); color: #fff; }
.btn-primary:disabled { background: #a0aec0; cursor: not-allowed; }

.btn-secondary {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--accent);
}
.btn-secondary:hover { background: #eff6ff; }

/* ── Quiz intro ──────────────────────────────────────────────────────────── */
.quiz-intro { margin-bottom: 1.5rem; }
.quiz-intro h1 { font-size: 1.7rem; font-weight: 800; margin-bottom: 0.5rem; }
.quiz-intro p { color: var(--muted); max-width: 620px; }

/* ── Tag filter ──────────────────────────────────────────────────────────── */
.controls { margin: 1.2rem 0 1.5rem; }
.filter-label { font-size: 0.85rem; color: var(--muted); margin-right: 0.5rem; }
.tag-filter { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.tag-btn {
  font-size: 0.8rem;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: all 0.12s;
}
.tag-btn:hover { border-color: var(--accent); color: var(--accent); }
.tag-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Question card ───────────────────────────────────────────────────────── */
.question-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}
.question-text {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.question-link { color: var(--text); text-decoration: none; }
.question-link:hover { text-decoration: underline; color: var(--accent); }

.card-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.8rem; }
.tag {
  font-size: 0.72rem;
  padding: 0.15rem 0.55rem;
  background: #eff6ff;
  color: var(--accent);
  border-radius: 999px;
  border: 1px solid #bfdbfe;
}

/* Badge */
.badge          { font-size: 0.7rem; font-weight: 700; padding: 0.15rem 0.5rem; border-radius: 999px; }
.badge-hot      { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }

/* ── Stance buttons ──────────────────────────────────────────────────────── */
.answer-row { margin-top: 0.75rem; }
.stance-buttons { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.stance-btn {
  padding: 0.4rem 1rem;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s;
}
.stance-btn:hover { border-color: var(--accent); }
.stance-btn[data-stance="ja"].active    { background: var(--ja);  color: #fff; border-color: var(--ja); }
.stance-btn[data-stance="nej"].active   { background: var(--nej); color: #fff; border-color: var(--nej); }
.stance-btn.dismiss { font-size: 0.8rem; color: var(--muted); }
.stance-btn.dismiss.active { background: #f1f5f9; color: var(--muted); border-color: var(--muted); }

.question-card.skipped { opacity: 0.55; transition: opacity 0.2s; }
.question-card.skipped:hover { opacity: 0.85; }

/* ── Weight row ──────────────────────────────────────────────────────────── */
.weight-row { margin-top: 0.75rem; display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.weight-row.hidden { display: none; }
.weight-label { font-size: 0.82rem; color: var(--muted); }
.weight-buttons { display: flex; gap: 0.35rem; }
.weight-btn {
  font-size: 0.8rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  background: var(--surface);
  cursor: pointer;
}
.weight-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Submit bar ──────────────────────────────────────────────────────────── */
.submit-bar {
  position: sticky;
  bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 0.9rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 -2px 8px rgba(0,0,0,.06);
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}
#answer-count { font-size: 0.9rem; color: var(--muted); }

/* ── Detail page ─────────────────────────────────────────────────────────── */
.back-link { display: inline-block; margin-bottom: 1.25rem; font-size: 0.9rem; }
.detail-page h1 { font-size: 1.5rem; font-weight: 800; margin-bottom: 0.75rem; }
.detail-page h2 { font-size: 1rem; font-weight: 700; margin-bottom: 0.5rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }

/* ── About page ──────────────────────────────────────────────────────────── */
.about-section {
  margin-bottom: 2rem;
}
.about-section p {
  margin-bottom: 0.75rem;
  max-width: 60ch;
}
.about-list {
  margin: 0.5rem 0 0.75rem 1.25rem;
  max-width: 60ch;
}
.about-list li {
  margin-bottom: 0.5rem;
}

.context-box, .source-box, .links-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}
.context-box p { color: var(--text); }

/* Stances table */
.stances-table {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  overflow-x: auto;
}
.stances-table table { width: 100%; border-collapse: collapse; }
.stances-table th {
  padding: 0.4rem 0.6rem;
  font-size: 0.85rem;
  text-align: center;
  background: #f8f8f6;
  border-bottom: 1px solid var(--border);
}
.stance {
  text-align: center;
  padding: 0.6rem 0.4rem;
  font-size: 0.9rem;
  font-weight: 600;
}
.stance-ja    { color: var(--ja); }
.stance-nej   { color: var(--nej); }
.stance-avstar { color: var(--avstar); }
.stance-note  { font-size: 0.75rem; color: var(--muted); margin-top: 0.5rem; }

.source-box a, .links-box a { word-break: break-all; }
.links-box ul { padding-left: 1.2rem; }
.links-box li { margin-bottom: 0.4rem; font-size: 0.9rem; }
.link-source { font-size: 0.75rem; color: var(--muted); }

/* ── Results page ────────────────────────────────────────────────────────── */
.results-page h1 { font-size: 1.7rem; font-weight: 800; margin-bottom: 0.3rem; }
.results-intro { color: var(--muted); margin-bottom: 1.5rem; }

.score-list { margin-bottom: 2rem; }
.score-row {
  display: grid;
  grid-template-columns: 2.5rem 1fr 200px 3.5rem;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}
.score-party { font-weight: 700; font-size: 0.95rem; }
.score-name  { font-size: 0.9rem; color: var(--muted); }
.score-bar-wrap { background: #e5e7eb; border-radius: 999px; height: 10px; overflow: hidden; }
.score-bar  { height: 100%; width: var(--pct); background: var(--accent); border-radius: 999px; }
.score-pct  { font-size: 0.9rem; font-weight: 700; text-align: right; }

.share-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 2rem;
}
.share-box h2 { font-size: 1rem; font-weight: 700; margin-bottom: 0.4rem; }
.share-url-row { display: flex; gap: 0.5rem; margin: 0.6rem 0; flex-wrap: wrap; }
.share-url-row input {
  flex: 1;
  min-width: 200px;
  padding: 0.4rem 0.7rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
  background: #f8f8f6;
}
.share-note { font-size: 0.78rem; color: var(--muted); }

.answer-breakdown h2 { font-size: 1.05rem; font-weight: 700; margin-bottom: 1rem; }
.breakdown-row {
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--border);
}
.breakdown-q { margin-bottom: 0.4rem; display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap; }
.breakdown-q a { font-size: 0.9rem; font-weight: 600; color: var(--text); text-decoration: none; }
.breakdown-q a:hover { text-decoration: underline; }
.weight-chip { font-size: 0.71rem; padding: 0.1rem 0.45rem; border-radius: 999px; }
.weight-chip.weight-1 { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.weight-chip.weight-2 { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.weight-chip.weight-3 { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.breakdown-stances { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.your-stance { font-size: 0.82rem; font-weight: 700; margin-right: 0.25rem; }
.your-stance-ja  { color: var(--ja); }
.your-stance-nej { color: var(--nej); }
.party-chip {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  opacity: 0.45;
}
.party-chip-ja    { background: #dcfce7; color: #15803d; }
.party-chip-nej   { background: #fee2e2; color: #b91c1c; }
.party-chip-avstar { background: #f1f5f9; color: #64748b; }
.party-chip.match { opacity: 1; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 540px) {
  .score-row { grid-template-columns: 2rem 1fr 3rem; }
  .score-name { display: none; }
  .score-bar-wrap { display: none; }
}
