/* ===================== RESET & BASE ===================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #22263a;
  --border: #2e3352;
  --text: #e8eaf0;
  --text-muted: #8b90a8;
  --accent: #4f6ef7;
  --accent-hover: #6882ff;
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #f87171;
  --radius: 12px;
  --radius-lg: 20px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --transition: 0.2s ease;
}

body {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
}

/* ===================== LAYOUT ===================== */
.app-container {
  width: 100%;
  max-width: 680px;
  padding: 20px 16px 60px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.screen { width: 100%; flex: 1; }
.hidden { display: none !important; }

/* ===================== HEADER ===================== */
.app-header {
  text-align: center;
  padding: 32px 0 8px;
  margin-bottom: 8px;
}

.app-logo {
  font-size: 2.8rem;
  font-weight: 800;
  letter-spacing: -2px;
  background: linear-gradient(135deg, #4f6ef7 0%, #a78bfa 50%, #34d399 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 6px;
}

.app-tagline {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ===================== START SCREEN ===================== */
.hero-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  text-align: center;
  box-shadow: var(--shadow);
  margin-top: 12px;
}

.hero-icon { font-size: 4rem; margin-bottom: 20px; }

.hero-title {
  font-size: 1.7rem;
  font-weight: 700;
  margin-bottom: 12px;
  line-height: 1.3;
}

.hero-desc {
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.7;
  margin-bottom: 32px;
}

.stats-row {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 36px;
  flex-wrap: wrap;
}

.stat-item {
  text-align: center;
  background: var(--surface2);
  border-radius: var(--radius);
  padding: 14px 24px;
  border: 1px solid var(--border);
}

.stat-number {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--accent);
  display: block;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 16px 40px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
  width: 100%;
  max-width: 320px;
}

.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.disclaimer {
  margin-top: 20px;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ===================== QUIZ SCREEN ===================== */
.quiz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.question-counter {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

.progress-wrap {
  background: var(--surface2);
  border-radius: 99px;
  height: 6px;
  width: 100%;
  margin-bottom: 24px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #a78bfa);
  border-radius: 99px;
  transition: width 0.4s ease;
  width: 0%;
}

.category-badge {
  display: inline-block;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 99px;
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.question-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.question-text {
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.6;
  color: var(--text);
}

/* ===================== ANSWER BUTTONS ===================== */
.answers-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}

.answer-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text);
  text-align: left;
  font-size: 0.97rem;
  font-family: inherit;
}

.answer-btn:hover {
  border-color: var(--accent);
  background: rgba(79, 110, 247, 0.08);
}

.answer-btn.selected {
  border-color: var(--accent);
  background: rgba(79, 110, 247, 0.15);
}

.answer-icon {
  font-size: 1rem;
  font-weight: 800;
  min-width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: var(--surface2);
  color: var(--text-muted);
  font-family: monospace;
}

.answer-btn[data-value="1"] .answer-icon { color: #f87171; }
.answer-btn[data-value="2"] .answer-icon { color: #fb923c; }
.answer-btn[data-value="3"] .answer-icon { color: var(--text-muted); }
.answer-btn[data-value="4"] .answer-icon { color: #86efac; }
.answer-btn[data-value="5"] .answer-icon { color: var(--success); }

.answer-btn.selected[data-value="1"] { border-color: #f87171; background: rgba(248,113,113,0.1); }
.answer-btn.selected[data-value="2"] { border-color: #fb923c; background: rgba(251,146,60,0.1); }
.answer-btn.selected[data-value="3"] { border-color: #94a3b8; background: rgba(148,163,184,0.1); }
.answer-btn.selected[data-value="4"] { border-color: #86efac; background: rgba(134,239,172,0.1); }
.answer-btn.selected[data-value="5"] { border-color: var(--success); background: rgba(52,211,153,0.1); }

.answer-label { flex: 1; }

/* ===================== NAVIGATION ===================== */
.quiz-nav {
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.btn-nav {
  flex: 1;
  padding: 14px 20px;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.97rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-nav:disabled { opacity: 0.3; cursor: not-allowed; }
.btn-nav:not(:disabled):hover { border-color: var(--accent); background: rgba(79,110,247,0.08); }

.btn-nav.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-nav.primary:not(:disabled):hover { background: var(--accent-hover); border-color: var(--accent-hover); }

/* ===================== RESULTS SCREEN ===================== */
.results-header {
  text-align: center;
  padding: 24px 0 20px;
}

.results-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.results-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin: 28px 0 14px;
  font-size: 0.8rem;
}

/* ===================== POLITICIAN CARDS ===================== */
.politician-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  overflow: hidden;
  transition: border-color var(--transition);
}

.politician-card.best-match {
  border-color: var(--accent);
  background: rgba(79,110,247,0.06);
}

.best-badge {
  position: absolute;
  top: 0;
  right: 0;
  background: var(--accent);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 0 var(--radius) 0 var(--radius);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.politician-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.politician-info { flex: 1; min-width: 0; }

.politician-name {
  font-weight: 700;
  font-size: 0.97rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.politician-role {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 1px 0;
}

.politician-party {
  font-size: 0.8rem;
  font-weight: 700;
  margin-top: 2px;
}

.similarity-container { text-align: right; flex-shrink: 0; }

.similarity-percent {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  margin-bottom: 6px;
}

.similarity-bar-bg {
  width: 80px;
  height: 6px;
  background: var(--surface2);
  border-radius: 99px;
  overflow: hidden;
}

.similarity-bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 1s ease;
}

/* ===================== PARTY SCORES ===================== */
.party-breakdown {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  margin-bottom: 12px;
}

.party-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.party-row:last-child { margin-bottom: 0; }

.party-name {
  width: 120px;
  font-size: 0.85rem;
  font-weight: 600;
  flex-shrink: 0;
  color: var(--text-muted);
}

.party-bar-wrap {
  flex: 1;
  background: var(--surface2);
  border-radius: 99px;
  height: 8px;
  overflow: hidden;
}

.party-bar {
  height: 100%;
  border-radius: 99px;
  transition: width 1s ease;
}

.party-pct {
  width: 40px;
  text-align: right;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
}

/* ===================== ACTIONS ===================== */
.results-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 28px;
}

.btn-share {
  background: var(--success);
  color: #064e3b;
  border: none;
  border-radius: var(--radius);
  padding: 14px 24px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}

.btn-share:hover { filter: brightness(1.1); }

.btn-restart {
  background: transparent;
  color: var(--text-muted);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 24px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}

.btn-restart:hover { border-color: var(--accent); color: var(--text); }

/* ===================== PARTY FILTER ===================== */
.party-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  border-radius: 99px;
  padding: 6px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}

.filter-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

.filter-btn.active {
  color: #fff;
}

.filter-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 480px) {
  .app-container { padding: 16px 12px 48px; }
  .hero-card { padding: 28px 18px; }
  .question-card { padding: 22px 18px; }
  .question-text { font-size: 1.05rem; }
  .stats-row { gap: 12px; }
  .app-logo { font-size: 2.2rem; }
  .similarity-bar-bg { width: 60px; }
  .party-name { width: 90px; font-size: 0.78rem; }
}
