/* ═══════════════════════════════════════════════════════════
   فين واقفين؟ — fw-style.css
   Mobile-first, RTL, Moroccan-themed
═══════════════════════════════════════════════════════════ */

/* ─── VARIABLES ─── */
:root {
  --bg: #F8F6F2;
  --surface: #FFFFFF;
  --ink: #1A1A1A;
  --ink-soft: #4A4A4A;
  --ink-muted: #888888;
  --green: #1B5E20;
  --green-mid: #2E7D32;
  --green-light: #E8F5E9;
  --red: #B71C1C;
  --red-mid: #C62828;
  --red-light: #FFF0EE;
  --gold: #B8860B;
  --gold-light: #FFF8E7;
  --border: #E5E0D8;
  --border-light: #F0EDE8;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 4px 16px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.10);
  --radius: 14px;
  --radius-sm: 8px;
  --nav-h: 64px;
}

/* ─── ACCESSIBILITY ─── */
/* Skip-nav link — hidden until focused by keyboard */
.skip-nav {
  position: absolute;
  top: -100%;
  inset-inline-start: 1rem;
  z-index: 9999;
  padding: 0.5rem 1rem;
  background: var(--green);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  transition: top 0.2s;
}
.skip-nav:focus {
  top: 0.5rem;
}

/* Focus-visible outlines for keyboard navigation */
:focus-visible {
  outline: 2px solid var(--green-mid);
  outline-offset: 3px;
  border-radius: 4px;
}
/* Remove focus outline from mouse clicks */
:focus:not(:focus-visible) {
  outline: none;
}
/* Map region keyboard focus */
.hm-region:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 1px;
}

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

html {
  scroll-behavior: smooth;
  overflow-x: hidden; /* block horizontal scroll at root */
}

body {
  font-family: 'IBM Plex Sans Arabic', 'Plus Jakarta Sans', sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip; /* clip instead of hidden — iOS Safari fix: lets child overflow-x:auto scroll work */
  -webkit-tap-highlight-color: transparent; /* remove blue tap flash on iOS */
}

[id] {
  scroll-margin-top: calc(var(--nav-h) + env(safe-area-inset-top, 0px) + 20px);
}

/* ─── NAVIGATION ─── */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  /* Safe area: account for iPhone notch / Dynamic Island with viewport-fit=cover */
  height: calc(var(--nav-h) + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) 20px 0;
  display: flex;
  align-items: center;    /* centers within space below the safe-area padding */
  gap: 12px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  flex-shrink: 0;
}

.logo-icon {
  height: 44px;
  width: 44px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  display: block;
  box-sizing: border-box;
}

.logo-text {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
}

.logo-sub {
  font-size: 0.68rem;
  color: var(--ink-muted);
  font-weight: 400;
  direction: ltr;
  unicode-bidi: isolate;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-right: auto;
  list-style: none;
}

.nav-links a {
  display: block;
  padding: 6px 14px;
  border-radius: 100px;
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s;
  white-space: nowrap;
}

.nav-links a:hover {
  background: var(--bg);
  color: var(--ink);
}

.nav-links a.active {
  background: var(--green-light);
  color: var(--green);
  font-weight: 600;
}

.lang-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  border: 1.5px solid var(--border);
  border-radius: 100px;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-soft);
  transition: all 0.2s;
  flex-shrink: 0;
  -webkit-appearance: none; /* iOS Safari reset */
  touch-action: manipulation;
  min-height: 36px; /* comfortable tap area */
}

.lang-btn:hover {
  border-color: var(--green);
  color: var(--green);
}

.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  flex-shrink: 0;
  -webkit-appearance: none; /* iOS Safari reset */
  touch-action: manipulation;
  min-width: 44px;  /* iOS HIG tap target */
  min-height: 44px;
}

.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  margin: 5px 0;
  transition: all 0.3s;
}

.mobile-menu {
  display: none;
  position: fixed;
  top: calc(var(--nav-h) + env(safe-area-inset-top, 0px));
  left: 0;
  right: 0;
  background: white;
  border-bottom: 1px solid var(--border);
  z-index: 999;
  padding: 12px 16px 20px;
}

.mobile-menu.open {
  display: block;
}

.mobile-menu a {
  display: block;
  padding: 12px 16px;
  text-decoration: none;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.mobile-menu a:hover {
  background: var(--bg);
}

/* ─── LAYOUT ─── */
main {
  padding-top: calc(var(--nav-h) + env(safe-area-inset-top, 0px));
}

.section {
  padding: 72px 20px;
}

.section-alt {
  background: var(--surface);
}

.container {
  max-width: 1100px;
  margin: 0 auto;
}

/* ─── SECTION HEADERS ─── */
.sec-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px;
  border-radius: 100px;
  background: var(--green-light);
  color: var(--green-mid);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 16px;
}

.sec-title {
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 12px;
}

.sec-sub {
  font-size: 1rem;
  color: var(--ink-soft);
  max-width: 560px;
  line-height: 1.7;
}

/* ─── HERO ─── */
.hero {
  background: linear-gradient(145deg, #0B1F0D 0%, #1B3020 45%, #0F1E2A 100%);
  min-height: 100vh;    /* fallback for older iOS */
  min-height: 100svh;   /* svh = small viewport height, hides Safari chrome */
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
  padding: 80px 20px;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 80% 50%, rgba(27, 94, 32, 0.25) 0%, transparent 70%),
    radial-gradient(ellipse 40% 40% at 20% 70%, rgba(183, 28, 28, 0.15) 0%, transparent 60%);
}

.hero-grid {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 40px;
  align-items: center;
  position: relative;
  z-index: 1;
}

.hero-vis {
  justify-self: end;
  width: 100%;
  max-width: 380px;
}

.hero-flag {
  display: flex;
  gap: 6px;
  margin-bottom: 24px;
  align-items: center;
}

.hero-flag span {
  height: 5px;
  border-radius: 3px;
  display: block;
}

.hero-flag .f-red {
  width: 40px;
  background: #C1272D;
}

.hero-flag .f-green {
  width: 40px;
  background: #006233;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 100px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 20px;
  background: rgba(255, 255, 255, 0.07);
}

.hero h1 {
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  font-weight: 900;
  color: white;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}

.hero h1 em {
  font-style: normal;
  background: linear-gradient(135deg, #4CAF50, #81C784);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-tagline {
  font-size: 1.05rem;
  color: rgba(255, 255, 255, 0.65);
  margin-bottom: 8px;
  line-height: 1.7;
}

.hero-tagline-fr {
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.4);
  margin-bottom: 32px;
  font-style: italic;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.hero-stats {
  display: flex;
  gap: 24px;
  margin-top: 40px;
  flex-wrap: wrap;
}

.hero-stat .num {
  font-size: 1.8rem;
  font-weight: 900;
  color: white;
  line-height: 1;
}

.hero-stat .lbl {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 2px;
}

.hero-vis {
  position: relative;
}

.vis-card {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 24px;
  backdrop-filter: blur(10px);
}

.vis-card .vc-title {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

.vis-bar-label {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.82rem;
  font-weight: 600;
  width: 90px;
  flex-shrink: 0;
  text-align: right;
}

.vis-bar-track {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

.vis-bar-fill {
  height: 100%;
  border-radius: 4px;
}

.vis-bar-pct {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.75rem;
  width: 36px;
  flex-shrink: 0;
}

.vis-tag {
  margin-top: 16px;
  padding: 10px 14px;
  background: rgba(76, 175, 80, 0.15);
  border: 1px solid rgba(76, 175, 80, 0.25);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.8rem;
  line-height: 1.5;
}

/* ─── BUTTONS ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 26px;
  border-radius: 100px;
  text-decoration: none;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s;
  border: none;
  -webkit-appearance: none; /* remove iOS default button styling */
  touch-action: manipulation; /* faster tap response on iOS */
  user-select: none; /* prevent long-press text highlight on iOS */
}

.btn-primary {
  background: white;
  color: var(--green);
}

.btn-primary:hover {
  background: #E8F5E9;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(255, 255, 255, 0.2);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  color: white;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* ─── QUIZ ─── */
.quiz-wrapper {
  background: var(--surface);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  border: 1px solid var(--border);
}

.quiz-header {
  background: linear-gradient(135deg, var(--green) 0%, var(--green-mid) 100%);
  padding: 28px 32px;
  color: white;
}

.quiz-header h3 {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.quiz-header p {
  font-size: 0.88rem;
  opacity: 0.75;
}

.progress-container {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 32px;
  background: white;
  border-bottom: 1px solid var(--border-light);
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0 10px;
}

.progress-meta .p-label {
  font-size: 0.82rem;
  color: var(--ink-muted);
  font-weight: 500;
}

.progress-meta .p-count {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--green);
}

.progress-track {
  height: 5px;
  background: #F0EDE8;
  border-radius: 3px;
  margin-bottom: 14px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--green-mid));
  border-radius: 3px;
  transition: width 0.5s ease;
}

.quiz-body {
  padding: 32px;
}

/* Row holding the question number badge + topic pill */
.q-header-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.q-header-row .q-topic { margin-bottom: 0; }

/* Question number badge — big, impossible to miss */
.q-num-badge {
  display: inline-flex;
  align-items: baseline;
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--green);
  line-height: 1;
  font-feature-settings: "tnum";
  flex-shrink: 0;
}
.q-num-total {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink-muted);
  margin-right: 2px;
}

.q-topic {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 14px;
  border-radius: 100px;
  background: var(--gold-light);
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 14px;
}

.q-text {
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.5;
  margin-bottom: 8px;
}

.q-text-fr {
  font-size: 0.88rem;
  color: var(--ink-muted);
  font-style: italic;
  margin-bottom: 24px;
  line-height: 1.5;
  direction: ltr;
  text-align: left;
  unicode-bidi: isolate;
}
/* French answer subtitle (inline small) — force LTR block */
.answer-text small.q-text-fr,
.answer-text .q-text-fr {
  display: block;
  direction: ltr;
  text-align: left;
  unicode-bidi: isolate;
}

.answers-grid {
  display: grid;
  gap: 10px;
}

.answer-btn {
  width: 100%;
  padding: 14px 18px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink);
  text-align: right;
  transition: all 0.2s;
  line-height: 1.5;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 44px; /* iOS HIG minimum tap target */
  -webkit-appearance: none;
  touch-action: manipulation;
  user-select: none; /* prevent long-press text selection on iOS */
}

.answer-btn:hover {
  border-color: var(--green);
  background: var(--green-light);
  color: var(--green);
}

.answer-btn.selected {
  border-color: var(--green);
  background: var(--green-light);
  color: var(--green);
  font-weight: 700;
}

.answer-letter {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--border-light);
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 800;
  transition: all 0.2s;
  margin-top: 1px;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.answer-btn:hover .answer-letter,
.answer-btn.selected .answer-letter {
  background: var(--green);
  color: white;
}

.answer-text {
  flex: 1;
  text-align: right;
}
body.lang-fr .answer-btn {
  direction: ltr;
  text-align: left;
}
body.lang-fr .answer-text {
  text-align: left;
}

.quiz-nav {
  display: flex;
  gap: 10px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
  flex-wrap: wrap;
}

.btn-next {
  padding: 12px 28px;
  background: var(--green);
  color: white;
  border: none;
  border-radius: 100px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 44px;
  -webkit-appearance: none;
  touch-action: manipulation;
}

.btn-next:hover {
  background: var(--green-mid);
  transform: translateY(-1px);
}

.btn-next:disabled {
  background: #C8C8C8;
  cursor: not-allowed;
  transform: none;
}

.btn-prev {
  padding: 12px 24px;
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: 100px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink-soft);
  transition: all 0.2s;
  min-height: 44px;
  -webkit-appearance: none;
  touch-action: manipulation;
}

.btn-prev:hover {
  border-color: var(--green);
  color: var(--green);
}

/* Quiz Results */
.quiz-results {
  display: none;
  padding: 32px;
}

.result-top-badge {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border: 1.5px solid;
  border-radius: 12px;
  margin-bottom: 24px;
}

.rtb-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.rtb-label {
  font-size: 0.82rem;
  color: var(--ink-soft);
  font-weight: 500;
  margin-bottom: 4px;
}

.rtb-name {
  font-size: 1.1rem;
  font-weight: 800;
}

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

.results-sub {
  font-size: 0.85rem;
  color: var(--ink-muted);
  margin-bottom: 24px;
}

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

.result-party-name {
  width: 58px;
  flex-shrink: 0;
  font-size: 0.82rem;
  font-weight: 700;
  text-align: right;
}

.result-bar-track {
  flex: 1;
  height: 10px;
  background: #F0EDE8;
  border-radius: 5px;
  overflow: hidden;
}

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

.result-pct {
  width: 42px;
  flex-shrink: 0;
  font-size: 0.85rem;
  font-weight: 800;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.disclaimer-box {
  margin-top: 24px;
  padding: 14px 18px;
  background: var(--gold-light);
  border: 1px solid #E6D19A;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--ink-soft);
  line-height: 1.65;
}

.results-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.btn-retake {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 24px;
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: 100px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink-soft);
  transition: all 0.2s;
  text-decoration: none;
  min-height: 44px;
  -webkit-appearance: none;
  touch-action: manipulation;
  user-select: none;
}

.btn-retake:hover {
  border-color: var(--green);
  color: var(--green);
}

/* ─── COMPARISON ─── */
.party-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 28px;
  justify-content: center;
}

.party-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border: 1.5px solid var(--border);
  border-radius: 100px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  background: white;
  color: var(--ink-soft);
  transition: all 0.2s;
  min-height: 44px; /* iOS HIG tap target */
  -webkit-appearance: none;
  touch-action: manipulation;
}

.party-chip:hover {
  border-color: var(--green);
  color: var(--green);
}

.party-chip.selected {
  color: white;
}

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

.chip-abbr {
  font-weight: 800;
}

.compare-hint {
  padding: 40px;
  text-align: center;
  color: var(--ink-muted);
  font-size: 0.9rem;
  background: white;
  border-radius: var(--radius);
  border: 1.5px dashed var(--border);
}

.compare-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 580px;
}

.compare-table th {
  padding: 14px 16px;
  background: var(--bg);
  font-size: 0.83rem;
  font-weight: 700;
  border-bottom: 2px solid var(--border);
  text-align: right;
  vertical-align: top;
}

.compare-table th.topic-col {
  min-width: 140px;
  background: var(--bg);
}

.compare-table th.party-col {
  min-width: 170px;
  text-align: center;
}

.th-abbr {
  font-size: 1rem;
  font-weight: 900;
  margin-bottom: 2px;
}

.th-name {
  font-size: 0.75rem;
  color: var(--ink-muted);
  font-weight: 500;
  margin-bottom: 6px;
}

.th-badge {
  margin-top: 4px;
}

.compare-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.84rem;
  line-height: 1.6;
  vertical-align: top;
}

.compare-table td.topic-cell {
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--ink-soft);
  background: var(--bg);
}

.compare-table td.content-cell {
  text-align: center;
  color: var(--ink-soft);
}

.compare-table td.year-cell {
  font-size: 1rem;
  font-weight: 800;
  color: var(--ink);
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.compare-table tr:last-child td {
  border-bottom: none;
}

.compare-table tbody tr:hover td {
  background: #FDFCFB;
}

.compare-table tbody tr:hover td.topic-cell {
  background: #F4F2EE;
}

.compare-note {
  margin-top: 12px;
  font-size: 0.78rem;
  color: var(--ink-muted);
}

.compare-scroll-hint {
  display: none; /* hidden on desktop */
  font-size: 0.75rem;
  color: var(--ink-muted);
  text-align: center;
  margin: -18px 0 14px;
  opacity: 0.7;
}

/* ─── ORIENTATION TAGS ─── */
.orient-tag,
.tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 100px;   /* pill shape — cleaner on mobile */
  font-size: 0.72rem;
  font-weight: 700;
}

.tag-center {
  background: #EDE7F6;
  color: #4A148C;
}

.tag-center-right {
  background: #E3F2FD;
  color: #0D47A1;
}

.tag-center-left {
  background: #FFF3E0;
  color: #E65100;
}

.tag-left {
  background: #FFEBEE;
  color: #B71C1C;
}

/* Role tags */
.role-tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 700;
}

.gov {
  background: #E8F5E9;
  color: #1B5E20;
}

.opp {
  background: #FFF3E0;
  color: #E65100;
}

.meta-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--border-light);
  color: var(--ink-soft);
}

.meta-tag.gov {
  background: #E8F5E9;
  color: #1B5E20;
}

.meta-tag.opp {
  background: #FFF3E0;
  color: #E65100;
}

/* ─── PARTY CARDS ─── */
.parties-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.party-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: all 0.25s;
  box-shadow: var(--shadow);
  border-top: 4px solid transparent;
  overflow: hidden;  /* ensures inner sections don't bleed outside radius */
}

.party-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.party-card-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.party-logo {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 0.9rem;
  color: white;
  flex-shrink: 0;
  font-family: 'Plus Jakarta Sans', sans-serif;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

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

.party-card-name {
  font-weight: 800;
  font-size: 0.95rem;
  line-height: 1.2;
  margin-bottom: 2px;
}

.party-card-abbr {
  font-size: 0.72rem;
  color: var(--ink-muted);
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  /* always French text — always LTR */
  direction: ltr;
  text-align: left;
  unicode-bidi: isolate;
}

.party-card-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.party-card-desc {
  font-size: 0.83rem;
  color: var(--ink-soft);
  line-height: 1.65;
}

/* ─── ABOUT ─── */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: center;
}

.about-text p {
  font-size: 0.95rem;
  color: var(--ink-soft);
  line-height: 1.8;
  margin-bottom: 16px;
}

.about-quote {
  padding: 18px 22px;
  border-right: 4px solid var(--green);
  background: var(--green-light);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 24px 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--green);
  line-height: 1.6;
}

.about-stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.about-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow);
}

.asn {
  font-size: 1.9rem;
  font-weight: 900;
  color: var(--green);
  line-height: 1;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.asl {
  font-size: 0.75rem;
  color: var(--ink-muted);
  margin-top: 4px;
}

.about-note {
  margin-top: 16px;
  padding: 18px;
  background: var(--green-light);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(27, 94, 32, 0.2);
  font-size: 0.85rem;
  color: var(--green);
  font-weight: 600;
  line-height: 1.7;
}

/* ─── IMPACT ─── */
.impact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 40px;
}

.impact-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform 0.2s;
}

.impact-card:hover {
  transform: translateY(-2px);
}

.impact-icon {
  font-size: 2rem;
  margin-bottom: 12px;
  display: block;
}

.impact-num {
  font-size: 2.4rem;
  font-weight: 900;
  color: var(--green);
  line-height: 1;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.impact-label {
  font-size: 0.82rem;
  color: var(--ink-muted);
  margin-top: 6px;
}

.share-section {
  background: linear-gradient(135deg, var(--green) 0%, #1B3020 100%);
  border-radius: var(--radius);
  padding: 36px;
  text-align: center;
  color: white;
}

.share-section h3 {
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.share-section p {
  opacity: 0.7;
  font-size: 0.9rem;
  margin-bottom: 24px;
}

.share-btns {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 100px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
  min-height: 44px; /* iOS HIG tap target */
  -webkit-appearance: none;
  touch-action: manipulation;
}

.share-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

.share-btn.wa {
  background: rgba(37, 211, 102, 0.25);
  border-color: rgba(37, 211, 102, 0.4);
}

.share-btn.ig-story-btn {
  background: linear-gradient(135deg, rgba(131,58,180,0.35) 0%, rgba(193,53,132,0.35) 50%, rgba(253,162,29,0.35) 100%);
  border-color: rgba(193,53,132,0.5);
  gap: 8px;
}
.share-btn.ig-story-btn:hover {
  background: linear-gradient(135deg, rgba(131,58,180,0.55) 0%, rgba(193,53,132,0.55) 50%, rgba(253,162,29,0.55) 100%);
  border-color: rgba(253,162,29,0.6);
  transform: translateY(-1px);
}

/* ─── INSTAGRAM FALLBACK SHEET ─── */
/* ── Instagram Story Modal ── */
#igStoryModal {
  position: fixed;
  inset: 0;
  z-index: 9100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.igs-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(3px);
}
.igs-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  background: #fff;
  border-radius: 24px 24px 0 0;
  padding: 28px 24px 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: igs-slide-up 0.28s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes igs-slide-up {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.igs-close {
  position: absolute;
  top: 14px; right: 18px;
  background: #f0f0f0;
  border: none;
  border-radius: 50%;
  width: 30px; height: 30px;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: #555;
}
.igs-header {
  display: flex;
  align-items: center;
  gap: 10px;
}
.igs-logo { font-size: 1.6rem; }
.igs-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--ink);
  margin: 0;
}
.igs-copied-note {
  background: #e8f5e9;
  color: #1b5e20;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
}
.igs-urlbox {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f7f7f7;
  border-radius: 12px;
  padding: 10px 12px;
  border: 1px solid #e0e0e0;
}
.igs-url {
  flex: 1;
  font-size: 0.8rem;
  color: #444;
  font-family: monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  direction: ltr;
}
.igs-copybtn {
  flex-shrink: 0;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}
.igs-copybtn.copied { background: #0d8a4e; }
.igs-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.igs-step {
  background: #fafafa;
  border: 1px solid #eee;
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.4;
}
.igs-open-btn {
  display: block;
  text-align: center;
  background: linear-gradient(135deg, #833ab4, #fd1d1d, #fcb045);
  color: #fff;
  border-radius: 14px;
  padding: 14px;
  font-size: 0.95rem;
  font-weight: 800;
  text-decoration: none;
  margin-top: 4px;
  letter-spacing: 0.01em;
}

#igFallbackSheet {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.ig-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
}

.ig-sheet-panel {
  position: relative;
  z-index: 1;
  background: #fff;
  border-radius: 24px 24px 0 0;
  /* safe-area-inset-bottom prevents content hiding behind iPhone home bar */
  padding: 28px 24px calc(40px + env(safe-area-inset-bottom, 0px));
  width: 100%;
  max-width: 540px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  animation: slideUp 0.3s ease;
  text-align: center;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.ig-sheet-close {
  position: absolute;
  top: 14px;
  left: 16px;
  background: #f0f0f0;
  border: none;
  border-radius: 50%;
  width: 44px;  /* iOS HIG minimum */
  height: 44px;
  cursor: pointer;
  font-size: 0.85rem;
  color: #555;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-appearance: none;
  touch-action: manipulation;
}

.ig-sheet-icon { font-size: 2rem; }

.ig-sheet-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #1a1a1a;
  margin: 0;
}

/* Step-by-step instructions block */
.ig-sheet-steps {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: #f7f7f9;
  border-radius: 16px;
  padding: 14px 16px;
  text-align: start;
}

.ig-sheet-step {
  font-size: 0.83rem;
  color: #555;
  margin: 0;
  line-height: 1.5;
}

/* URL row: displays the link + copy button side by side */
.ig-sheet-linkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1.5px solid #e0e6f0;
  border-radius: 100px;
  padding: 6px 6px 6px 14px;
  margin: 4px 0;
}

.ig-sheet-url {
  flex: 1;
  font-size: 0.78rem;
  font-family: "Courier New", monospace;
  color: #196F3D;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

.ig-sheet-copy {
  flex-shrink: 0;
  background: #196F3D;
  color: #fff;
  border: none;
  border-radius: 100px;
  padding: 7px 14px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  min-height: 34px;
  -webkit-appearance: none;
  touch-action: manipulation;
  transition: background 0.2s, transform 0.15s;
}
.ig-sheet-copy:active { transform: scale(0.95); }
.ig-sheet-copy.copied { background: #0d8a4e; }

/* Desktop-only note shown when Stories need the mobile app */
.ig-sheet-pc-note {
  font-size: 0.78rem;
  color: #888;
  margin: 0;
  background: #f5f5f5;
  border-radius: 8px;
  padding: 8px 12px;
  width: 100%;
  text-align: center;
}

/* ── Link sticker tip toast (shown after sharing to Instagram) ── */
.ig-link-tip {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  background: #1a1a1a;
  color: #fff;
  border-radius: 16px;
  padding: 14px 16px 14px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 340px;
  width: calc(100% - 32px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
  animation: slideUp 0.3s ease;
  transition: opacity 0.4s ease;
}
.ig-link-tip-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}
.ig-link-tip-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ig-link-tip-text strong {
  font-size: 0.88rem;
  color: #fff;
}
.ig-link-tip-text span {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.65);
  line-height: 1.4;
}
.ig-link-tip-close {
  background: rgba(255,255,255,0.12);
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  color: rgba(255,255,255,0.7);
  font-size: 0.75rem;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-appearance: none;
  touch-action: manipulation;
}

/* Download image — secondary, subtle */
.ig-sheet-dl {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  max-width: 320px;
  padding: 11px 24px;
  border-radius: 100px;
  font-weight: 600;
  font-size: 0.82rem;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
  background: transparent;
  border: 1.5px solid #e0e0e0;
  color: #666;
}
.ig-sheet-dl:hover { border-color: #aaa; color: #333; }

/* ─── FOOTER ─── */
footer {
  background: #111A12;
  color: rgba(255, 255, 255, 0.6);
  /* safe-area-inset-bottom = iPhone home indicator space */
  padding: 48px 20px calc(32px + env(safe-area-inset-bottom, 0px));
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 40px;
}

.footer-brand .fb-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.fb-logo-icon {
  height: 48px;
  width: 48px;
  border-radius: 10px;
  object-fit: cover;
  display: block;
  flex-shrink: 0;
  background: #fff;
  padding: 2px;
  box-sizing: border-box;
}

.fb-title {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.95rem;
  font-weight: 700;
}

.fb-sub {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.4);
}

.footer-brand p {
  font-size: 0.82rem;
  line-height: 1.7;
}

.footer-col h4 {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 14px;
}

.footer-col a {
  display: block;
  color: rgba(255, 255, 255, 0.5);
  text-decoration: none;
  font-size: 0.82rem;
  margin-bottom: 8px;
  transition: color 0.15s;
}

.footer-col a:hover {
  color: rgba(255, 255, 255, 0.85);
}

.footer-disclaimers {
  padding-top: 28px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.disclaimer {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.78rem;
  line-height: 1.6;
}

.disclaimer::before {
  content: '◆';
  color: #C8A951;
  flex-shrink: 0;
  font-size: 0.6rem;
  margin-top: 4px;
}

.footer-bottom {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.3);
}

/* ─── ANIMATIONS ─── */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  opacity: 0;
  animation: fadeUp 0.6s ease forwards;
}

.fade-in-2 {
  animation-delay: 0.15s;
}

.fade-in-3 {
  animation-delay: 0.3s;
}

/* ─── RESPONSIVE ─── */

/* ── Tablet (≤ 900px) ── */
@media (max-width: 900px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 28px;
  }

  .about-grid {
    grid-template-columns: 1fr;
    gap: 36px;
  }

  .parties-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }
}

/* ── Mobile landscape / large phones (≤ 768px) ── */
@media (max-width: 768px) {
  :root {
    --nav-h: 58px;
  }

  /* Nav */
  .nav-links { display: none; }
  .hamburger { display: block; }
  .nav { padding: env(safe-area-inset-top, 0px) 16px 0; gap: 8px; }
  .logo-text { font-size: 0.92rem; }
  .logo-sub  { font-size: 0.62rem; }
  .lang-btn  { padding: 6px 12px; font-size: 0.76rem; }

  /* Layout */
  .section { padding: 52px 16px; }
  .sec-title { font-size: clamp(1.4rem, 5vw, 2rem); }
  .sec-sub { font-size: 0.92rem; }

  /* Hero */
  .hero {
    padding: 72px 18px 52px;
    min-height: auto;
    padding-top: calc(var(--nav-h) + 36px);
  }
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 0;
    text-align: center;
  }
  .hero-vis { display: none; }
  .hero-flag { justify-content: center; }
  .hero-actions {
    justify-content: center;
    flex-direction: column;
    align-items: center;
    gap: 10px;
  }
  .hero-actions .btn { width: 100%; max-width: 320px; justify-content: center; }
  .hero h1 { font-size: clamp(2rem, 8vw, 3rem); }
  .hero-tagline { font-size: 0.96rem; }
  .hero-stats {
    justify-content: center;
    gap: 18px;
    margin-top: 28px;
  }
  .hero-stat .num { font-size: 1.5rem; }
  .hero-badge {
    margin-bottom: 14px;
    flex-wrap: wrap;            /* prevent badge from overflowing on narrow screens */
    justify-content: center;
  }

  /* Quiz */
  .quiz-header  { padding: 18px 16px; }
  .quiz-header h3 { font-size: 1.05rem; }
  .progress-container { padding: 10px 16px; }
  .quiz-body    { padding: 18px 16px; }
  .quiz-results { padding: 18px 16px; }
  .quiz-nav { flex-direction: column-reverse; }
  .btn-next, .btn-prev { width: 100%; justify-content: center; }
  .q-text { font-size: 1rem; }
  .answer-btn { padding: 12px 14px; font-size: 0.86rem; }
  .results-actions { flex-direction: column; }
  .btn-retake { justify-content: center; }

  /* About */
  .about-grid { grid-template-columns: 1fr; gap: 32px; }
  .about-stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .about-stat { padding: 16px 12px; }
  .asn { font-size: 1.6rem; }

  /* Impact */
  .impact-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .impact-card { padding: 20px 14px; }
  .impact-num  { font-size: 2rem; }

  /* Share section */
  .share-section { padding: 24px 16px; }
  .share-section h3 { font-size: 1.1rem; }
  .share-btns { flex-direction: column; align-items: center; }
  .share-btn  { width: 100%; max-width: 280px; justify-content: center; }

  /* Footer */
  .footer-grid { grid-template-columns: 1fr; gap: 28px; }
  .footer-bottom { flex-direction: column; text-align: center; gap: 6px; }
  footer { padding: 40px 16px calc(28px + env(safe-area-inset-bottom, 0px)); }

  /* ── Party cards — 2-column compact grid on mobile ── */
  .parties-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .party-card {
    padding: 0;
    border-top: 4px solid transparent;
    display: flex;
    flex-direction: column;
  }
  /* Compact header: logo centered + name below */
  .party-card-head {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 16px 12px 10px;
    margin-bottom: 0;
    gap: 8px;
    background: rgba(0,0,0,0.025);
    border-bottom: 1px solid var(--border-light);
  }
  .party-logo {
    width: 52px;
    height: 52px;
    font-size: 0.9rem;
    border-radius: 14px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
  }
  .party-card-info { min-width: 0; width: 100%; }
  /* Collapsed: only show Arabic name, no French subtitle */
  .party-card-name { font-size: 0.8rem; line-height: 1.3; text-align: center; }
  .party-card-abbr { display: none; } /* hide French subtitle — too long for 2-col */
  /* Only show orientation tag */
  .party-card-meta {
    padding: 6px 8px 0;
    margin-bottom: 0;
    gap: 4px;
    justify-content: center;
  }
  .party-card-meta .meta-tag:not(.orient-tag) { display: none; }
  /* Hide description — shown when expanded */
  .party-card-desc { display: none; }
  .party-card.expanded .party-card-desc {
    display: block;
    padding: 8px 12px 10px;
    font-size: 0.8rem;
    line-height: 1.6;
    border-bottom: 1px solid var(--border-light);
  }
  /* Show French subtitle when expanded */
  .party-card.expanded .party-card-abbr {
    display: block;
    font-size: 0.65rem;
    margin-top: 2px;
    text-align: center;
    opacity: 0.7;
  }
  .party-card-source { display: none; }
  .party-card.expanded .party-card-source {
    display: block;
    padding: 4px 12px 0;
  }
  .party-card-toggle {
    padding: 9px 10px;
    margin-top: auto;
    border-top: 1px solid var(--border-light);
    background: rgba(0,0,0,0.012);
    font-size: 0.7rem;
    border-radius: 0 0 var(--radius) var(--radius);
  }
  .party-card.expanded .party-card-toggle { border-radius: 0; }
  .party-card-policy { background: var(--bg); border-top: none; }
  .pcp-inner {
    padding: 10px 12px 12px;
    gap: 0;
  }
  .pcb-item {
    font-size: 0.8rem;
    gap: 10px;
    padding: 9px 0;
    border-bottom: 1px solid var(--border-light);
    line-height: 1.55;
    align-items: flex-start;
  }
  .pcb-item:last-of-type { border-bottom: none; }
  .pcb-ico { width: 20px; font-size: 1rem; margin-top: 1px; }

  /* Party chips */
  .party-chip { padding: 7px 13px; font-size: 0.8rem; }

  /* Show scroll hint on mobile */
  .compare-scroll-hint { display: block; }

  /* Comparison table — mobile-friendly */
  .compare-table-wrap {
    -webkit-overflow-scrolling: touch;
    position: relative;
  }
  .compare-table-wrap::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 32px;
    height: 100%;
    background: linear-gradient(to left, rgba(255,255,255,0.85), transparent);
    pointer-events: none;
    border-radius: 0 var(--radius) var(--radius) 0;
  }
  .compare-table th.topic-col,
  .compare-table td.topic-cell {
    position: sticky;
    left: 0;
    z-index: 2;
    box-shadow: 2px 0 6px rgba(0,0,0,0.06);
  }
  .compare-table th { padding: 10px 12px; font-size: 0.78rem; }
  .compare-table td { padding: 10px 12px; font-size: 0.8rem; }
  .compare-table th.party-col { min-width: 140px; }
  .compare-table th.topic-col { min-width: 110px; }

  /* Result bars */
  .result-party-name { width: 46px; font-size: 0.76rem; }
}

/* ── Small phones (≤ 480px) ── */
@media (max-width: 480px) {
  .section { padding: 40px 14px; }

  .hero { padding: 60px 14px 44px; padding-top: calc(var(--nav-h) + 28px); }
  .hero h1 { font-size: clamp(1.75rem, 9vw, 2.6rem); letter-spacing: -0.01em; }
  .hero-tagline { font-size: 0.9rem; }
  .hero-stats { gap: 14px; }
  .hero-stat .num { font-size: 1.35rem; }
  .hero-stat .lbl { font-size: 0.68rem; }
  .hero-actions .btn { max-width: 100%; font-size: 0.85rem; padding: 12px 20px; }

  .sec-title { font-size: clamp(1.25rem, 6vw, 1.75rem); }

  .impact-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .impact-card { padding: 16px 10px; }
  .impact-num  { font-size: 1.7rem; }
  .impact-icon { font-size: 1.6rem; margin-bottom: 8px; }

  .about-stat-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .asn { font-size: 1.45rem; }

  /* Party cards — keep 2-column compact design from 768px */
  .parties-grid { gap: 8px; }
  .party-logo   { width: 48px; height: 48px; font-size: 0.84rem; }
  .party-card-head { padding: 14px 10px 8px; gap: 6px; }
  .party-card-meta { padding: 6px 8px 0; }
  .party-card-name { font-size: 0.78rem; }
  .party-card-abbr { font-size: 0.62rem; }
  .party-card-toggle { padding: 9px 10px; font-size: 0.7rem; }
  .pcp-inner { padding: 8px 10px 10px; }
  .party-card.expanded .party-card-desc { padding: 6px 10px 8px; font-size: 0.8rem; }

  .quiz-wrapper { border-radius: 14px; }
  .quiz-header  { padding: 14px 14px; }
  .quiz-body    { padding: 14px 14px; }
  .quiz-results { padding: 14px 14px; }
  .answer-btn   { padding: 11px 12px; gap: 10px; }
  .answer-letter { width: 24px; height: 24px; font-size: 0.72rem; }

  .party-selector { gap: 8px; }
  .party-chip { padding: 6px 10px; font-size: 0.76rem; gap: 5px; }
  .chip-dot   { width: 8px; height: 8px; }

  /* Comparison table — tighter on small phones */
  .compare-table { min-width: 420px; }
  .compare-table th { padding: 8px 10px; font-size: 0.74rem; }
  .compare-table td { padding: 9px 10px; font-size: 0.77rem; }
  .compare-table th.party-col { min-width: 120px; }
  .compare-table th.topic-col { min-width: 100px; }
  .th-name { font-size: 0.68rem; }

  .compare-hint { padding: 28px 16px; }

  footer { padding: 32px 14px calc(24px + env(safe-area-inset-bottom, 0px)); }
  .footer-col h4 { font-size: 0.82rem; }
  .footer-col a  { font-size: 0.78rem; }
  .footer-brand p { font-size: 0.78rem; }

  .share-section { border-radius: var(--radius-sm); }
  .share-btn { padding: 10px 16px; font-size: 0.82rem; }

  .result-top-badge { padding: 12px 14px; gap: 10px; }
  .rtb-name { font-size: 0.95rem; }
}

/* ── Very small phones (≤ 375px) ── */
@media (max-width: 375px) {
  .hero h1 { font-size: 1.65rem; }
  .hero-stats { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 12px 20px; }
  .logo-text { font-size: 0.85rem; }
  .logo-icon { height: 36px; width: 36px; }
  .impact-grid { grid-template-columns: 1fr 1fr; }
  /* Keep 2-column party grid on 375px too — just slightly tighter */
  .parties-grid { grid-template-columns: 1fr 1fr; gap: 7px; }
  .party-logo { width: 44px; height: 44px; font-size: 0.8rem; }
  .party-card-head { padding: 12px 9px 7px; gap: 5px; }
  .party-card-name { font-size: 0.74rem; }
  .party-card-abbr { font-size: 0.6rem; }
  .party-card-toggle { padding: 8px 9px; font-size: 0.68rem; }
  .pcp-inner { padding: 7px 9px 9px; }
  .about-stat-grid { grid-template-columns: 1fr 1fr; }
  .party-chip { padding: 5px 9px; font-size: 0.72rem; }
  .section { padding: 36px 12px; }
  .quiz-body, .quiz-header, .quiz-results, .progress-container { padding-inline: 12px; }
  /* Comparison table: narrower on 375px */
  .compare-table { min-width: 380px; }
  .compare-table th { padding: 7px 8px; font-size: 0.71rem; }
  .compare-table td { padding: 8px 8px; font-size: 0.73rem; }
  .compare-table th.party-col { min-width: 110px; }
  .compare-table th.topic-col { min-width: 90px; }
  .th-name { display: none; }  /* Hide long party name in header to save space */
}

/* ── 320px phones ── */
@media (max-width: 320px) {
  .hero h1 { font-size: 1.45rem; }
  .btn { padding: 10px 16px; font-size: 0.8rem; }
  .lang-btn { padding: 5px 9px; font-size: 0.72rem; }
  .logo-text { display: none; }
  .impact-grid { grid-template-columns: 1fr; }
}

@media print {
  .nav, .hamburger, .hero, .mobile-menu { display: none !important; }
  main { padding-top: 0; }
}

/* ─── LANGUAGE TOGGLE ─────────────────────────────────────────────
   Page layout stays RTL (Arabic-first). Only the French *text*
   direction is corrected so sentences start/end on the correct side.
──────────────────────────────────────────────────────────────────── */
.fr-only {
  display: none;
}

.ar-only {
  display: inline;
}

p.ar-only,
div.ar-only,
li.ar-only {
  display: block;
}

body.lang-fr .fr-only {
  display: inline;
}

body.lang-fr p.fr-only,
body.lang-fr div.fr-only,
body.lang-fr li.fr-only {
  display: block;
}

body.lang-fr .ar-only {
  display: none !important;
}

/* French text flows left-to-right inside the RTL page layout.
   unicode-bidi:isolate keeps each element's text independent.
   text-align:left ensures block elements start from the left edge. */
body.lang-fr .fr-only {
  direction: ltr;
  unicode-bidi: isolate;
}
body.lang-fr p.fr-only,
body.lang-fr div.fr-only,
body.lang-fr h1.fr-only,
body.lang-fr h2.fr-only,
body.lang-fr h3.fr-only,
body.lang-fr li.fr-only,
body.lang-fr span.fr-only {
  text-align: left;
}

/* Stat cards: switch whole card to LTR in French so num/tag/desc all align left */
body.lang-fr .yimp-card {
  direction: ltr;
  text-align: left;
}
body.lang-fr .yimp-num,
body.lang-fr .yimp-tag,
body.lang-fr .yimp-desc {
  text-align: left;
}

/* About-note: keep bullet left-aligned in French */
body.lang-fr .about-note {
  direction: ltr;
  text-align: left;
}

/* ── French-mode: quiz, compare, results, party cards ───────────────
   JS-rendered elements that hold French text but have no fr-only class */
body.lang-fr .q-explain-text,
body.lang-fr .multi-notice,
body.lang-fr .quiz-header h3,
body.lang-fr .quiz-header p,
body.lang-fr .party-card-desc,
body.lang-fr .party-card-meta,
body.lang-fr .compare-note,
body.lang-fr .result-party-name,
body.lang-fr .btn-next,
body.lang-fr .btn-prev {
  direction: ltr;
  text-align: left;
}

/* ── French-mode: quiz explain accordion ─────────────────────────────
   The <details> and <summary> are flex containers — must be LTR
   so "💡 Pourquoi cette question ?" aligns left, not right */
body.lang-fr .q-explain {
  direction: ltr;
}
body.lang-fr .q-explain summary {
  direction: ltr;
}

/* ── French-mode: quiz progress bar & header ─────────────────────────
   progress-container is a flex row — must be LTR so ring is on left,
   "Progression" label is on right; quiz-header is also a flex row */
body.lang-fr .progress-container {
  direction: ltr;
}
body.lang-fr .progress-meta,
body.lang-fr .progress-meta .p-label {
  direction: ltr;
  text-align: left;
}
body.lang-fr .quiz-header {
  direction: ltr;
  text-align: left;
}

/* ── French-mode: quiz topic chip and result row flex ordering ───────
   q-topic now renders French label; result-row flex must be LTR
   so name→bar→percentage reads left-to-right */
body.lang-fr .q-topic {
  direction: ltr;
}
body.lang-fr .result-row {
  direction: ltr;
}
body.lang-fr .result-party-name {
  text-align: left;
}

/* ── French-mode: hero map section overlay ──────────────────────────
   Renders French region names, "sièges", "habitants" etc. */
body.lang-fr .hero-region-detail {
  direction: ltr;
  text-align: left;
}

/* ── French-mode: sidebar map panel (national overview + region detail)
   Both `buildNationalOverview()` and `showRegionDetail()` inject
   French text into #mapPanel — target the container */
body.lang-fr #mapPanel {
  direction: ltr;
  text-align: left;
}
/* Seat/bar rows inside map panel are flex — must be LTR too */
body.lang-fr .mrd-seat-row,
body.lang-fr .mno-party-row {
  direction: ltr;
}

/* ── French-mode: map legend ─────────────────────────────────────────
   Party names and "Vainqueurs" label rendered by renderMapLegend() */
body.lang-fr #mapLegend {
  direction: ltr;
}
body.lang-fr .legend-item {
  direction: ltr;
}

/* ── French-mode: hero map bottom legend row ─────────────────────────
   Party abbreviation + French full name items */
body.lang-fr .hero-map-legend {
  direction: ltr;
}
body.lang-fr .hml-item {
  direction: ltr;
}

/* ── French-mode: timeline cards ─────────────────────────────────────
   tl-text inside tl-card holds French event text */
body.lang-fr .tl-card {
  direction: ltr;
}

/* ── French-mode: previous result banner ────────────────────────────
   Renders "Résultat précédent (…): RNI — 72%" in French */
body.lang-fr .rb-inner {
  direction: ltr;
}
body.lang-fr .rb-text {
  text-align: left;
}

/* ── French-mode: sec-sub block positioning fix ──────────────────────
   .sec-sub has max-width:560px; in RTL the block starts from the right
   edge of the container. margin-right:auto pushes it back to the left. */
body.lang-fr .sec-sub {
  margin-left: 0 !important;
  margin-right: auto !important;
}

/* ── French-mode: switch all section text blocks to LTR/left-align ──
   Covers every parent container that holds fr-only children.
   This ensures symbols (✦ 🗳️ ⬆ ↗), headings, subtitles, labels,
   footer text, and hero content all start from the left in French mode.  */
body.lang-fr .sec-label,
body.lang-fr .sec-title,
body.lang-fr .sec-sub,
body.lang-fr .hero-tagline,
body.lang-fr .hero-badge,
body.lang-fr .hero-stat .lbl,
body.lang-fr .compare-hint,
body.lang-fr .about-quote,
body.lang-fr .about-stat .asl,
body.lang-fr .about-text > p,
body.lang-fr .impact-label,
body.lang-fr .yimp-title,
body.lang-fr .yimp-subtitle,
body.lang-fr .yimp-manifesto-body,
body.lang-fr .share-section h3,
body.lang-fr .share-section p,
body.lang-fr .footer-disclaimers .disclaimer,
body.lang-fr .footer-col h4,
body.lang-fr .footer-col a,
body.lang-fr .fb-sub,
body.lang-fr .fb-title {
  direction: ltr;
  text-align: left;
}

/* ─── CURSOR GLOW ─── */
.cursor-glow {
  position: fixed;
  pointer-events: none;
  z-index: 0;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(27, 94, 32, 0.06) 0%, transparent 65%);
  transform: translate(-50%, -50%);
  transition: left 0.08s linear, top 0.08s linear;
  will-change: left, top;
}

/* ─── HERO CANVAS ─── */
.hero-canvas-wrap {
  position: relative;
  width: 100%;
  height: 380px;
  border-radius: 16px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.09);
}

.hero-canvas-wrap canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: none;
}

.hero-canvas-text {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
}

.hct-eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.35);
  text-transform: uppercase;
  margin-bottom: 12px;
}

.hct-main {
  font-size: 1.7rem;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.88);
  line-height: 1.2;
  margin-bottom: 6px;
}

.hct-sub {
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.4);
  font-style: italic;
  margin-bottom: 28px;
}

.hct-num {
  font-size: 3.8rem;
  font-weight: 900;
  line-height: 1;
  color: rgba(255, 255, 255, 0.08);
  letter-spacing: -0.03em;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.hct-num-label {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.3);
  letter-spacing: 0.08em;
  margin-top: 4px;
}
/* ─── HERO CURSOR GLOW ─── */
.hero-cursor-glow {
  position: absolute;
  pointer-events: none;
  z-index: 0;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(27, 94, 32, 0.22) 0%, transparent 65%);
  transform: translate(-50%, -50%);
  transition: left 0.1s linear, top 0.1s linear, opacity 0.4s ease;
  opacity: 0;
  will-change: left, top;
  mix-blend-mode: screen;
}

/* ─── TOUCH DEVICE: hide cursor-tracking glow effects (no mouse = no glow needed) ─── */
@media (hover: none) and (pointer: coarse) {
  .hero-cursor-glow,
  .map-cursor-glow {
    display: none !important;
  }

  /* Active press feedback on touch devices (replaces hover lift) */
  .party-card:active {
    transform: scale(0.985);
    box-shadow: var(--shadow);
    transition: transform 0.1s ease, box-shadow 0.1s ease;
  }
  .party-card-toggle:active {
    background: rgba(0,0,0,0.05);
  }
  .answer-btn:active {
    border-color: var(--green);
    background: var(--green-light);
  }
  .party-chip:active {
    opacity: 0.7;
  }
}

/* ─── HERO MAP — floating, no box ─── */
.hero-map-wrap {
  position: relative;
  padding: 4px 0 0;
}

.hero-map-title {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.42);
  text-align: center;
  margin-bottom: 4px;
  text-transform: uppercase;
}

#heroMap {
  display: block;
  width: 100%;
  height: auto;
  max-height: 320px;
  object-fit: contain;
  filter: drop-shadow(0 14px 40px rgba(0, 0, 0, 0.50));
  transition: filter 0.3s ease;
}

.hm-region {
  cursor: pointer;
  transition: opacity 0.15s ease, filter 0.15s ease;
}
.hm-region:not(.hm-active):hover {
  opacity: 0.78;
  filter: brightness(1.18);
}
.hm-region.hm-active {
  filter: drop-shadow(0 8px 22px rgba(0, 0, 0, 0.6)) brightness(1.12);
}

.hero-map-legend {
  display: flex;
  gap: 14px;
  justify-content: center;
  margin-top: 8px;
  flex-wrap: wrap;
}

.hml-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.48);
  font-weight: 500;
}

.map-click-hint {
  text-align: center;
  margin-top: 7px;
  font-size: 0.76rem;
  color: rgba(255,255,255,0.38);
  letter-spacing: 0.02em;
  pointer-events: none;
  animation: hint-pulse 2.8s ease-in-out infinite;
}
body.lang-fr .map-click-hint {
  direction: ltr;
}
@keyframes hint-pulse {
  0%, 100% { opacity: 0.38; }
  50%       { opacity: 0.72; }
}

.hml-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.hero-map-tip {
  position: absolute;
  background: rgba(8, 14, 24, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 7px;
  padding: 5px 10px;
  font-size: 0.72rem;
  color: #fff;
  pointer-events: none;
  z-index: 25;
  max-width: 190px;
  line-height: 1.5;
  backdrop-filter: blur(10px);
  white-space: nowrap;
}

/* ─── HERO INFO CARD (slides up on region click) ─── */
.hero-info-card {
  position: absolute;
  bottom: 26px;
  left: 4px;
  right: 4px;
  background: rgba(6, 12, 22, 0.92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 14px;
  padding: 13px 15px 11px;
  transform: translateY(10px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.22s ease;
  z-index: 15;
}
.hero-info-card.visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.hic-close {
  position: absolute;
  top: 2px;
  left: 2px;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.32);
  font-size: 0.75rem;
  padding: 0;
  border-radius: 50%;
  transition: color 0.15s, background 0.15s;
  line-height: 1;
  background: none;
  border: none;
  width: 36px;   /* comfortable tap size within tight card */
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-appearance: none;
  touch-action: manipulation;
}
.hic-close:hover { color: #fff; background: rgba(255, 255, 255, 0.10); }

.hic-name {
  font-size: 0.80rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 2px;
  padding-right: 18px;
  line-height: 1.3;
}

.hic-winner {
  font-size: 0.92rem;
  font-weight: 800;
  margin-bottom: 1px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  display: flex;
  align-items: center;
  gap: 5px;
}

.hic-pop {
  font-size: 0.67rem;
  color: rgba(255, 255, 255, 0.38);
  margin-bottom: 9px;
}

.hic-bars { display: flex; flex-direction: column; gap: 5px; }

.hic-bar-row {
  display: flex;
  align-items: center;
  gap: 7px;
}

.hic-party {
  font-size: 0.63rem;
  font-weight: 700;
  min-width: 28px;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.hic-track {
  flex: 1;
  height: 5px;
  background: rgba(255, 255, 255, 0.09);
  border-radius: 3px;
  overflow: hidden;
}

.hic-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  width: 0%;
}

.hic-seats {
  font-size: 0.63rem;
  color: rgba(255, 255, 255, 0.45);
  min-width: 16px;
  text-align: end;
}

/* ─── MAP CURSOR GLOW ─── */
.map-cursor-glow {
  position: absolute;
  pointer-events: none;
  z-index: 3;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: left 0.06s linear, top 0.06s linear, opacity 0.3s ease;
  opacity: 0;
  mix-blend-mode: screen;
  will-change: left, top, opacity;
}

/* ─── BODY MAP SECTION ─── */
.map-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 24px;
  align-items: start;
  max-width: 780px;
  margin: 0 auto;
}

.map-container {
  background: linear-gradient(160deg, #dbeaf5 0%, #c8d9ea 25%, #e8dfc8 60%, #ddd0b0 100%);
  border-radius: 20px;
  padding: 14px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.12), inset 0 1px 0 rgba(255,255,255,0.6);
  border: 1px solid rgba(200, 190, 170, 0.4);
  aspect-ratio: 500 / 540;
  position: relative;
  overflow: hidden;
}

#moroccoMap {
  width: 100%;
  height: 100%;
  display: block;
}

.map-region {
  transition: opacity 0.2s, filter 0.2s;
}

/* ─── MAP PANEL ─── */
.map-panel {
  background: var(--surface);
  border-radius: 16px;
  padding: 18px 16px;
  border: 1px solid var(--border);
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  min-height: 240px;
  margin-bottom: 12px;
}

.mno-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
  margin-bottom: 16px;
}

.mno-split-bar {
  display: flex;
  height: 10px;
  border-radius: 5px;
  overflow: hidden;
  background: var(--border);
  margin-bottom: 18px;
}

.mno-split-rni,
.mno-split-pam {
  height: 100%;
  transition: width 0.8s ease;
}

.mno-party-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0 10px 12px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 4px;
}
.mno-party-row:last-of-type {
  border-bottom: none;
}

.mno-party-abbr {
  font-size: 1.1rem;
  font-weight: 900;
  font-family: 'Plus Jakarta Sans', sans-serif;
  min-width: 40px;
}

.mno-party-stats {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.mno-stat {
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.mno-num {
  font-weight: 700;
  color: var(--ink);
}

.mno-pct {
  font-size: 1rem;
  font-weight: 900;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.mno-hint {
  margin-top: 14px;
  font-size: 0.72rem;
  color: var(--ink-muted);
  text-align: center;
  font-style: italic;
}

/* ─── REGION DETAIL PANEL ─── */
.mrd-back {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 14px;   /* enlarged for tap target */
  font-size: 0.78rem;
  cursor: pointer;
  color: var(--ink-soft);
  margin-bottom: 14px;
  font-family: inherit;
  transition: background 0.15s;
  min-height: 44px;
  -webkit-appearance: none;
  touch-action: manipulation;
  user-select: none;
  display: inline-flex;
  align-items: center;
}
.mrd-back:hover { background: var(--border-light); }

.mrd-region-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
}

.mrd-winner {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.mrd-total,
.mrd-pop {
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin-bottom: 2px;
}

.mrd-bar-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  margin: 14px 0 8px;
}

.mrd-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.mrd-bar-label {
  font-size: 0.72rem;
  font-weight: 700;
  min-width: 32px;
  color: var(--ink);
}

.mrd-bar-track {
  flex: 1;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.mrd-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease;
}

.mrd-bar-pct {
  font-size: 0.72rem;
  font-weight: 700;
  min-width: 24px;
  text-align: end;
}

/* ─── MAP LEGEND ─── */
.map-legend {
  background: var(--surface);
  border-radius: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.mleg-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--ink-soft);
  padding: 4px 0;
}

.mleg-dot {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* ─── FLOATING MAP TOOLTIP ─── */
.maptip {
  position: fixed;
  background: rgba(15, 20, 30, 0.92);
  color: #fff;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.78rem;
  pointer-events: none;
  z-index: 9999;
  max-width: 220px;
  line-height: 1.5;
  border: 1px solid rgba(255,255,255,0.12);
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.maptip-name {
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 4px;
}

.maptip-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

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

.maptip-pop {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.55);
  margin-top: 3px;
}

/* ─── LANG BTN ─── */
.lang-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.2);
  color: var(--ink);
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  margin-inline-start: auto;
  transition: background 0.15s;
}
.lang-btn:hover { background: var(--border); }

/* ─── RESPONSIVE MAP ─── */
@media (max-width: 820px) {
  .map-layout {
    grid-template-columns: 1fr;
    max-width: 440px;
  }
  .map-side {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
  }
}

@media (max-width: 640px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .hero-vis {
    max-width: 100%;
    justify-self: center;
  }
  .map-layout {
    max-width: 100%;
  }
  .map-side {
    grid-template-columns: 1fr;
  }
}

/* ─── HERO REGION DETAIL — tablet / narrow layout ─── */
@media (max-width: 1024px) and (min-width: 769px) {
  .hero-grid {
    grid-template-columns: 1fr 1fr;
  }
  .hero-region-detail {
    max-width: 100%;
    overflow: hidden;
  }
  .hrd-name {
    font-size: 0.95rem;
    white-space: normal;
    word-break: break-word;
  }
  .hrd-bar-row { gap: 6px; }
}

/* ─── SCROLL PROGRESS BAR ─── */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--green-mid), #22C55E);
  z-index: 2000;
  transition: width 0.1s linear;
  border-radius: 0 2px 2px 0;
}

/* ─── HERO STATS HIDDEN STATE ─── */
.hero-stats {
  transition: opacity 0.2s ease;
}
.hero-stats.hidden {
  display: none;
}

/* ─── HERO REGION DETAIL (left panel) ─── */
.hero-region-detail {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.28s cubic-bezier(0.34, 1.56, 0.64, 1),
              transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
  min-height: 0;
  margin-top: 36px;
  position: relative;
}
.hero-region-detail.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.hrd-close {
  position: absolute;
  top: -4px;
  inset-inline-end: -4px;
  background: rgba(255, 255, 255, 0.09);
  border: none;
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.50);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.15s, background 0.15s;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-appearance: none;
  touch-action: manipulation;
}
.hrd-close:hover { color: #fff; background: rgba(255, 255, 255, 0.16); }

.hrd-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.92);
  margin-bottom: 3px;
  padding-right: 32px;
  line-height: 1.3;
}

.hrd-winner {
  font-size: 0.95rem;
  font-weight: 800;
  margin-bottom: 2px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.hrd-pop {
  font-size: 0.70rem;
  color: rgba(255, 255, 255, 0.40);
  margin-bottom: 10px;
}

.hrd-bars { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }

.hrd-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hrd-party {
  font-size: 0.65rem;
  font-weight: 700;
  min-width: 30px;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.hrd-track {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
}

.hrd-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.hrd-seats {
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.40);
  min-width: 18px;
  text-align: end;
}

/* ─── JS-REVEAL ENTRANCE ANIMATIONS ─── */
.js-reveal {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 0.65s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.65s cubic-bezier(0.16, 1, 0.3, 1);
}
.js-reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* ─── QUIZ RESULTS: WhatsApp share button ─── */
.btn-wa-share {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  background: #25D366;
  color: #fff;
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  transition: background 0.15s, transform 0.15s;
}
.btn-wa-share:hover { background: #1ebe5a; transform: translateY(-1px); }

/* ─── PARTY CARD: source citation ─── */
.party-card-source {
  padding: 6px 0 10px;
}
.party-card-source a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  color: var(--ink-muted);
  text-decoration: none;
  border-bottom: 1px dotted var(--border);
  transition: color 0.15s;
  min-height: 36px;         /* comfortable tap target */
  touch-action: manipulation;
}
.party-card-source a:hover { color: var(--green-mid); }

/* ─── RESULTS ACTIONS: layout ─── */
.results-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 20px;
}
.btn-retake, .btn-next {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 9px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.15s;
}
.btn-retake:hover, .btn-next:hover { opacity: 0.8; transform: translateY(-1px); }

/* ─── PRINT STYLES ─── */
@media print {
  .scroll-progress,
  .nav,
  .hamburger,
  .mobile-menu,
  .hero,
  .share-section,
  .footer { display: none !important; }

  body { background: #fff; color: #000; }
  main { padding-top: 0; }
  .section, .section-alt { break-inside: avoid; }
  .party-card { break-inside: avoid; box-shadow: none; border: 1px solid #ddd; }
  a { color: #000; text-decoration: underline; }
  .compare-table { font-size: 0.75rem; }
}

/* ══════════════════════════════════════════════════════════════
   ─── RETURN VISITOR BANNER ───────────────────────────────────
══════════════════════════════════════════════════════════════ */
.return-banner {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px)); /* clear iPhone home bar */
  inset-inline-end: 20px;
  z-index: 1500;
  max-width: 360px;
  animation: slideUpIn 0.4s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes slideUpIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.rb-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  box-shadow: var(--shadow-lg);
  font-size: 0.80rem;
  line-height: 1.4;
}
.rb-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.rb-text { flex: 1; color: var(--ink-soft); }
.rb-link {
  color: var(--green-mid);
  text-decoration: none;
  font-weight: 700;
  white-space: nowrap;
  font-size: 0.78rem;
}
.rb-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink-muted);
  font-size: 1.2rem;
  padding: 4px 8px;     /* larger tap area */
  line-height: 1;
  flex-shrink: 0;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-appearance: none;
  touch-action: manipulation;
}
.rb-close:hover { color: var(--ink); }

/* ══════════════════════════════════════════════════════════════
   ─── SVG PROGRESS RING ───────────────────────────────────────
══════════════════════════════════════════════════════════════ */
.progress-ring-wrap {
  position: relative;
  width: 60px;
  height: 60px;
  flex-shrink: 0;
}
.ring-track  { stroke: #e8f0e9; stroke-width: 5; }
.ring-fill   {
  stroke: var(--green-mid);
  stroke-width: 5;
  transform-origin: 50% 50%;
  transform: rotate(-90deg);
  transition: stroke-dashoffset 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.ring-count {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 900;
  color: var(--green);
  letter-spacing: -0.02em;
  font-feature-settings: "tnum";
  pointer-events: none;
}
.progress-meta .p-label {
  font-size: 0.80rem;
  color: var(--ink-muted);
  display: block;
}

/* ══════════════════════════════════════════════════════════════
   ─── QUESTION EXPLANATION ACCORDION ─────────────────────────
══════════════════════════════════════════════════════════════ */
.q-explain {
  margin-top: 14px;
  background: rgba(34,197,94,0.05);
  border: 1px solid rgba(34,197,94,0.22);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: background 0.2s;
}
.q-explain summary {
  cursor: pointer;
  padding: 12px 14px;    /* taller for iOS tap comfort */
  font-size: 0.80rem;
  font-weight: 600;
  color: var(--green-mid);
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  touch-action: manipulation;
}
.q-explain summary::-webkit-details-marker { display: none; }
.q-explain[open] {
  background: rgba(34,197,94,0.07);
}
.q-explain[open] summary {
  border-bottom: 1px solid rgba(34,197,94,0.18);
}
.q-explain-text {
  padding: 10px 14px;
  font-size: 0.79rem;
  color: var(--ink-soft);
  margin: 0;
  line-height: 1.65;
}

/* ══════════════════════════════════════════════════════════════
   ─── CONFETTI ────────────────────────────────────────────────
══════════════════════════════════════════════════════════════ */
@keyframes confetti-fall {
  0%   { transform: translateY(-20px) rotate(0deg) scaleX(1); opacity: 1; }
  50%  { transform: translateY(50vh) rotate(400deg) scaleX(-1); opacity: 0.9; }
  100% { transform: translateY(110vh) rotate(720deg) scaleX(1); opacity: 0; }
}
.confetti-piece {
  position: fixed;
  top: 0;
  border-radius: 2px;
  animation: confetti-fall linear forwards;
  pointer-events: none;
  z-index: 9999;
}

/* ══════════════════════════════════════════════════════════════
   ─── PARTY CARD POLICY ACCORDION ─────────────────────────────
══════════════════════════════════════════════════════════════ */
.party-card-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  background: none;
  border: none;
  border-top: 1px solid var(--border-light);
  padding: 12px 0 6px;   /* increased for 44px tap target */
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--ink-muted);
  cursor: pointer;
  text-align: right;
  transition: color 0.15s;
  margin-top: 10px;
  font-family: inherit;
  min-height: 44px;
  -webkit-appearance: none;
  touch-action: manipulation;
  user-select: none;
}
.party-card-toggle:hover { color: var(--green-mid); }
.pct-arrow {
  margin-inline-start: auto;
  display: inline-block;
  transition: transform 0.28s;
  font-style: normal;
  font-size: 0.7rem;
}
.party-card.expanded .pct-arrow { transform: rotate(180deg); }

.party-card-policy {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.38s cubic-bezier(0.4,0,0.2,1), opacity 0.25s;
  opacity: 0;
}
.party-card.expanded .party-card-policy {
  max-height: 260px;
  opacity: 1;
}
.pcp-inner {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 10px 0 4px;
}
.pcb-item {
  display: flex;
  gap: 7px;
  font-size: 0.71rem;
  line-height: 1.55;
  color: var(--ink-soft);
}
.pcb-ico { flex-shrink: 0; width: 18px; }
.pcb-link {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.72rem;
  color: var(--green-mid);
  text-decoration: none;
  font-weight: 600;
  border-bottom: 1px dotted var(--green-mid);
}

/* ══════════════════════════════════════════════════════════════
   ─── ELECTION TIMELINE ───────────────────────────────────────
══════════════════════════════════════════════════════════════ */
.timeline-scroll {
  display: flex;
  gap: 0;
  overflow-x: auto;
  padding-bottom: 16px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  position: relative;
}
.timeline-scroll::before {
  content: '';
  position: absolute;
  top: 34px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--green-mid), var(--green-light));
  z-index: 0;
}
.tl-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  min-width: 160px;
  max-width: 180px;
  flex-shrink: 0;
  scroll-snap-align: start;
  position: relative;
  z-index: 1;
}
.tl-year {
  font-size: 0.80rem;
  font-weight: 800;
  color: var(--green-mid);
  background: var(--bg);
  padding: 3px 8px;
  border-radius: 20px;
  border: 2px solid var(--green-mid);
  white-space: nowrap;
  position: relative;
  z-index: 2;
}
.tl-line-dot {
  width: 2px;
  height: 24px;
  background: var(--green-mid);
  display: flex;
  justify-content: center;
  align-items: flex-end;
}
.tl-dot-inner {
  width: 10px;
  height: 10px;
  background: var(--green-mid);
  border-radius: 50%;
  border: 2px solid var(--bg);
  flex-shrink: 0;
}
.tl-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin: 0 8px;
  font-size: 0.72rem;
  line-height: 1.5;
  color: var(--ink-soft);
  display: flex;
  flex-direction: column;
  gap: 5px;
  box-shadow: var(--shadow);
  text-align: center;
  transition: transform 0.2s, box-shadow 0.2s;
}
.tl-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}
.tl-icon {
  font-size: 1.2rem;
  display: block;
}
.tl-milestone .tl-year { color: var(--red-mid); border-color: var(--red-mid); }
.tl-milestone .tl-line-dot,
.tl-milestone .tl-dot-inner { background: var(--red-mid); }
.tl-reform .tl-year { color: var(--gold); border-color: var(--gold); }
.tl-reform .tl-line-dot,
.tl-reform .tl-dot-inner { background: var(--gold); }

/* ══════════════════════════════════════════════════════════════
   ─── INSTAGRAM SHARE BUTTON ──────────────────────────────────
══════════════════════════════════════════════════════════════ */
.btn-ig-share {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  max-width: 320px;
  padding: 14px 24px;
  background: linear-gradient(135deg, #833ab4 0%, #fd1d1d 50%, #fcb045 100%);
  color: #fff;
  font-size: 0.92rem;
  font-weight: 700;
  border-radius: 100px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.18s, transform 0.15s;
  min-height: 44px;
  -webkit-appearance: none;
  touch-action: manipulation;
  user-select: none;
  box-shadow: 0 4px 18px rgba(193,53,132,0.35);
}
.btn-ig-share:hover { opacity: 0.88; transform: translateY(-1px); }

/* Instagram Story button inside share-section (impact panel) */
.share-btn.ig-story-share {
  background: linear-gradient(135deg, #833ab4, #fd1d1d, #fcb045);
  color: #fff;
  border: none;
}
.share-btn.ig-story-share:hover { opacity: 0.88; transform: translateY(-2px); }

/* ═══════════════════════════════════════════════════════════
   YOUTH IMPACT SECTION (#youth-impact)
═══════════════════════════════════════════════════════════ */
.yimp-section {
  background: linear-gradient(160deg, #f0faf1 0%, #e8f5e9 50%, #f8f6f2 100%);
}

.yimp-box {
  background: var(--surface);
  border: 1px solid rgba(46, 125, 50, 0.15);
  border-radius: 20px;
  padding: 40px 36px;
  box-shadow: 0 8px 48px rgba(27, 94, 32, 0.08), 0 2px 8px rgba(0,0,0,0.04);
}

/* Header */
.yimp-header {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 32px;
}
.yimp-icon {
  font-size: 2rem;
  background: linear-gradient(135deg, rgba(27,94,32,0.1), rgba(76,175,80,0.15));
  width: 58px; height: 58px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid rgba(46,125,50,0.15);
}
.yimp-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 5px;
  line-height: 1.4;
}
.yimp-subtitle {
  font-size: 0.88rem;
  color: var(--ink-muted);
}

/* Grid of stat cards — 3 equal columns */
.yimp-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.yimp-card {
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 28px 22px;
  transition: transform 0.22s, box-shadow 0.22s, border-color 0.22s;
}
.yimp-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 32px rgba(27,94,32,0.10);
  border-color: rgba(46,125,50,0.35);
}

.yimp-num {
  font-size: 2.8rem;
  font-weight: 900;
  color: var(--green-mid);
  font-family: 'Plus Jakarta Sans', sans-serif;
  line-height: 1;
  margin-bottom: 8px;
}
.yimp-tag {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 10px;
  opacity: 0.85;
}
.yimp-desc {
  font-size: 0.85rem;
  color: var(--ink-muted);
  line-height: 1.6;
}

/* Manifesto footer */
.yimp-manifesto {
  padding-top: 24px;
  border-top: 1px dashed rgba(46,125,50,0.25);
}
.yimp-manifesto-inner {
  background: linear-gradient(135deg, rgba(27,94,32,0.04), rgba(76,175,80,0.06));
  border: 1px solid rgba(46,125,50,0.15);
  border-radius: var(--radius);
  padding: 22px 24px;
}
.yimp-manifesto-body {
  font-size: 0.95rem;
  color: var(--ink-soft);
  line-height: 1.75;
  margin: 0;
}
.yimp-footnote {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid rgba(46,125,50,0.18);
  font-size: 0.75rem;
  color: var(--ink-muted);
  line-height: 1.6;
}
.yimp-footnote a {
  color: var(--green);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.yimp-footnote a:hover {
  color: var(--green-dark);
}

/* Responsive — 3 cards: stay in a row on tablet, stack on mobile */
@media (max-width: 680px) {
  .yimp-grid { grid-template-columns: 1fr; gap: 12px; }
  .yimp-box  { padding: 24px 18px; }
  .yimp-header { flex-direction: column; align-items: center; text-align: center; }
  .yimp-num  { font-size: 2.4rem; }
}

