/* ================================================================
   ElectIQ — Civic Intelligence Platform
   Design: Editorial dark, teal + amber, Fraunces + Sora
   ================================================================ */

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

html {
  scroll-behavior: smooth;
}

:root {
  /* Core palette */
  --bg:          #0b1120;
  --surface:     #111827;
  --surface-2:   #1a2437;
  --surface-3:   #243044;
  --border:      rgba(255,255,255,0.08);
  --border-hi:   rgba(255,255,255,0.15);

  /* Accent: teal */
  --teal:        #2dd4bf;
  --teal-dim:    #0d9488;
  --teal-glow:   rgba(45,212,191,0.15);
  --teal-pale:   rgba(45,212,191,0.08);

  /* Accent: amber */
  --amber:       #f59e0b;
  --amber-dim:   #d97706;
  --amber-pale:  rgba(245,158,11,0.12);

  /* Text */
  --text-1:      #e2e8f0;
  --text-2:      #94a3b8;
  --text-3:      #64748b;
  --text:        #e2e8f0;
  --muted:       #94a3b8;
  --text-secondary: #cbd5e1;

  /* Stage colors */
  --s1: #f87171;
  --s2: #fb923c;
  --s3: #fbbf24;
  --s4: #34d399;
  --s5: #60a5fa;
  --s6: #a78bfa;

  /* Shadows */
  --shadow-sm:   0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:   0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg:   0 12px 40px rgba(0,0,0,0.6);

  /* Radius */
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;

  /* Timing */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* Light theme */
[data-theme="light"] {
  /* Core palette */
  --bg:          #f8fafc;
  --surface:     #f1f5f9;
  --surface-2:   #e2e8f0;
  --surface-3:   #cbd5e1;
  --border:      rgba(0,0,0,0.08);
  --border-hi:   rgba(0,0,0,0.15);

  /* Text */
  --text-1:      #0f172a;
  --text-2:      #475569;
  --text-3:      #94a3b8;
}

[data-theme="light"] .topbar {
  background: rgba(248, 250, 252, 0.92);
  border-bottom-color: rgba(15, 23, 42, 0.08);
}

[data-theme="light"] .brand-name {
  color: var(--text-1);
}

[data-theme="light"] .tab-nav {
  background: #e2e8f0;
  border: 1px solid rgba(15, 23, 42, 0.08);
}

[data-theme="light"] .tab-btn {
  color: #334155;
}

[data-theme="light"] .tab-btn:hover {
  background: rgba(255, 255, 255, 0.75);
  color: #0f172a;
}

[data-theme="light"] .tab-btn.active {
  color: #ffffff;
  background: var(--teal);
}

[data-theme="light"] .theme-toggle,
[data-theme="light"] .nav-hamburger {
  color: var(--text-1);
}

[data-theme="light"] .badge-live {
  background: rgba(45, 212, 191, 0.08);
  border-color: rgba(45, 212, 191, 0.2);
  color: var(--teal-dim);
}

html, body {
  height: 100%;
  font-family: 'Inter', 'Noto Sans Devanagari', sans-serif;
  background: var(--bg);
  color: var(--text-1);
  font-size: clamp(0.95rem, 1.5vw, 1rem);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

body {
  animation: page-fade-in 0.45s var(--ease);
}

@keyframes page-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  top: -48px;
  left: 1rem;
  z-index: 1000;
  padding: 0.55rem 0.85rem;
  border-radius: 999px;
  background: var(--teal);
  color: var(--bg);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 600;
  transition: top 0.2s var(--ease);
}

.skip-link:focus {
  top: 1rem;
}

img, svg {
  max-width: 100%;
}

button,
a,
input,
textarea,
.tab-btn,
.send-btn,
.theme-toggle,
.nav-hamburger,
.refresh-btn,
.quiz-opt,
.cat-btn,
.starter-card,
.topic-item,
.ask-btn,
.follow-up-chip {
  touch-action: manipulation;
  min-height: 44px;
}

h1 { font-size: clamp(1.4rem, 3vw, 2rem); }
h2 { font-size: clamp(1.2rem, 2.4vw, 1.5rem); }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hi); }

/* ================================================================
   LAYOUT
   ================================================================ */

.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Topbar ── */
.topbar {
  height: 60px;
  background: rgba(11,17,32,0.9);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1.5rem;
  z-index: 200;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}

.site-logo {
  width: 30px;
  height: 30px;
  display: inline-block;
  object-fit: contain;
  border-radius: 6px;
  margin-left: 0;
  margin-right: 8px;
  vertical-align: middle;
}

/* ── Hamburger button ── */
.nav-hamburger {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-1);
  cursor: pointer;
  padding: 8px;
  flex-shrink: 0;
}

/* ── Theme toggle button ── */
.theme-toggle {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 8px;
  transition: transform 0.2s;
  flex-shrink: 0;
}

.theme-toggle:hover {
  transform: scale(1.1);
}

.brand-name {
  font-family: 'Fraunces', serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: -0.3px;
}

.brand-name em {
  font-style: italic;
  color: var(--teal);
}

/* ── Tab navigation ── */
.tab-nav {
  display: flex;
  gap: 2px;
  background: var(--surface-2);
  border-radius: 10px;
  padding: 3px;
}

.tab-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-family: 'Sora', sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 6px 16px;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.tab-btn:hover { color: var(--text-1); background: var(--surface-3); }

.tab-btn.active {
  background: var(--teal);
  color: var(--bg);
  font-weight: 600;
  box-shadow: 0 0 16px var(--teal-glow);
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.news-marquee {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0;
  align-items: stretch;
  background: linear-gradient(90deg, rgba(245,158,11,0.16), rgba(45,212,191,0.08));
  border-bottom: 1px solid var(--border);
  min-height: 46px;
}

.news-marquee-label {
  display: flex;
  align-items: center;
  padding: 0 1rem;
  background: rgba(11, 17, 32, 0.62);
  color: var(--text-secondary);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.85px;
  border-right: 1px solid rgba(255,255,255,0.08);
}

.news-marquee-track-wrap {
  overflow: hidden;
  position: relative;
}

.news-marquee-track {
  display: inline-flex;
  align-items: center;
  gap: 1.25rem;
  white-space: nowrap;
  min-width: max-content;
  padding: 0.8rem 0;
  will-change: transform;
}

.news-marquee-track:hover {
  animation-play-state: paused;
}

/* Apply animation only when JS enables the moving class */
.news-marquee-track.moving {
  animation: marquee-slide 60s linear infinite;
}

.news-marquee-track.moving:hover {
  animation-play-state: paused;
}

.news-marquee-item {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--text-1);
  text-decoration: none;
  font-size: 0.82rem;
  padding-right: 0.6rem;
}

.news-marquee-item:hover {
  color: var(--teal);
}

.news-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 10px var(--teal-glow);
  flex-shrink: 0;
}

.news-dot.positive {
  background: #34d399;
  box-shadow: 0 0 10px rgba(52, 211, 153, 0.25);
}

.news-dot.neutral {
  background: var(--amber);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.25);
}

.news-dot.negative {
  background: #fb7185;
  box-shadow: 0 0 10px rgba(251, 113, 133, 0.25);
}

@keyframes marquee-slide {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.badge-live {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--teal);
  background: var(--teal-pale);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid rgba(45,212,191,0.2);
}

.live-dot {
  width: 6px; height: 6px;
  background: var(--teal);
  border-radius: 50%;
  animation: live-pulse 1.8s ease infinite;
}

@keyframes live-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.7); }
}

/* ── Content area ── */
.content-area {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.tab-panel {
  position: absolute;
  inset: 0;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.tab-panel.active {
  display: flex;
  opacity: 1;
  animation: fadeIn 0.2s ease forwards;
}

/* ================================================================
   TAB 1: CHAT
   ================================================================ */

.chat-layout {
  display: flex;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* ── Topics sidebar ── */
.topics-sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-head {
  padding: 1.2rem 1rem 0.8rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-head h3 {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--muted);
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
}

.topic-group { margin-bottom: 1rem; }

.topic-group-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-3);
  padding: 0 6px;
  margin-bottom: 5px;
}

.topic-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--text-2);
  transition: all 0.15s;
  border: 1px solid transparent;
}

.topic-item:hover {
  background: var(--surface-2);
  color: var(--text-1);
  border-color: var(--border);
}

.topic-item .icon {
  font-size: 1rem;
  flex-shrink: 0;
  width: 22px;
  text-align: center;
}

/* ── Chat main ── */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Messages ── */
.messages-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.chat-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  color: var(--muted);
  gap: 0.75rem;
  padding: 2rem;
}

.chat-empty-state .empty-icon {
  font-size: 3rem;
}

.chat-empty-state h3 {
  color: var(--text);
  font-size: 1.2rem;
  margin: 0;
}

.chat-empty-state p {
  font-size: 0.9rem;
  max-width: 400px;
  margin: 0;
}

.empty-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 0.5rem;
}

.suggestion-chip {
  background: transparent;
  border: 1px solid var(--teal);
  color: var(--teal);
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.suggestion-chip:hover {
  background: var(--teal);
  color: #000;
}

/* Welcome card */
.welcome-hero {
  background: linear-gradient(135deg, var(--surface-2) 0%, var(--surface-3) 100%);
  border: 1px solid var(--border-hi);
  border-radius: var(--r-lg);
  padding: 2rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.welcome-hero::before {
  content: '';
  position: absolute;
  top: -60px; left: 50%;
  transform: translateX(-50%);
  width: 200px; height: 200px;
  background: radial-gradient(circle, var(--teal-glow) 0%, transparent 70%);
  pointer-events: none;
}

.welcome-emoji {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  display: block;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.welcome-hero h2 {
  font-family: 'Fraunces', serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 0.5rem;
}

.welcome-hero p {
  font-size: 0.85rem;
  color: var(--text-2);
  max-width: 500px;
  margin: 0 auto 1.2rem;
  line-height: 1.6;
}

.starter-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  max-width: 560px;
  margin: 0 auto;
}

.starter-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 14px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  font-size: 0.8rem;
  color: var(--text-2);
}

.starter-card:hover {
  border-color: var(--teal);
  color: var(--text-1);
  background: var(--teal-pale);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.starter-card strong {
  display: block;
  font-size: 0.78rem;
  color: var(--teal);
  font-weight: 600;
  margin-bottom: 3px;
}

/* Message bubbles */
.msg-row {
  display: flex;
  gap: 10px;
  animation: msg-in 0.3s var(--ease);
}

@keyframes msg-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.msg-row.user { flex-direction: row-reverse; }

.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.82rem;
  flex-shrink: 0;
  margin-top: 3px;
}

.avatar.ai {
  background: linear-gradient(135deg, var(--teal-dim), var(--teal));
  box-shadow: 0 0 14px var(--teal-glow);
}

.avatar.user-av {
  background: linear-gradient(135deg, var(--amber-dim), var(--amber));
}

.bubble {
  max-width: 72%;
  border-radius: var(--r-md);
  padding: 12px 16px;
  font-size: 0.85rem;
  line-height: 1.7;
}

.bubble.ai {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-top-left-radius: 4px;
  color: var(--text-1);
}

.bubble.user {
  background: var(--teal);
  color: var(--bg);
  border-top-right-radius: 4px;
  font-weight: 500;
}

/* Rich content in bubbles */
.bubble.ai strong { color: var(--teal); font-weight: 600; }
.bubble.ai em { color: var(--amber); font-style: normal; font-weight: 500; }
.bubble.ai ul, .bubble.ai ol { padding-left: 1.3rem; margin: 8px 0; }
.bubble.ai li { margin-bottom: 5px; }

.bubble.ai .callout {
  background: var(--teal-pale);
  border-left: 3px solid var(--teal);
  border-radius: 0 8px 8px 0;
  padding: 10px 14px;
  margin: 10px 0;
  font-size: 0.83rem;
  color: var(--text-1);
}

/* Message timestamps and footer */
.msg-time {
  display: block;
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 6px;
}

.msg-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  gap: 0.5rem;
  flex-wrap: wrap;
}

.copy-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 4px 8px;
  transition: all 0.2s;
  color: var(--text-3);
  border-radius: 4px;
}

.copy-btn:hover {
  background: var(--surface-3);
  color: var(--text-1);
}

.translate-btn {
  background: var(--surface-3);
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 0.78rem;
  padding: 4px 10px;
  transition: all 0.2s var(--ease);
  color: var(--text-2);
  border-radius: 999px;
}

.translate-btn:hover {
  border-color: var(--teal);
  color: var(--teal);
  background: var(--teal-pale);
}

.hindi-translation {
  margin-top: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: var(--r-md);
  background: rgba(45, 212, 191, 0.08);
  border: 1px solid rgba(45, 212, 191, 0.22);
  color: var(--text-1);
  font-size: 0.84rem;
  line-height: 1.6;
}

.translate-unavailable {
  color: var(--muted);
  font-size: 0.85rem;
  font-style: italic;
}

.answer-method {
  margin-bottom: 0.9rem;
  padding: 0.95rem 1rem;
  background: linear-gradient(135deg, rgba(245,158,11,0.08), rgba(45,212,191,0.08));
  border: 1px solid var(--border-hi);
  border-radius: var(--r-md);
}

.answer-method-title {
  font-size: 0.72rem;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 0.7rem;
}

.answer-method-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
}

.answer-method-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem;
  display: grid;
  gap: 0.25rem;
}

.answer-method-card strong {
  color: var(--teal);
  font-size: 0.9rem;
}

.answer-method-card span {
  color: var(--text-2);
  font-size: 0.76rem;
  line-height: 1.45;
}

.teaching-block {
  margin-bottom: 0.95rem;
  padding: 1rem;
  background: linear-gradient(180deg, rgba(17,24,39,0.98), rgba(26,36,55,0.98));
  border: 1px solid var(--border-hi);
  border-radius: var(--r-md);
}

.teaching-head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin-bottom: 0.55rem;
}

.teaching-head strong {
  color: var(--text-1);
  font-size: 0.94rem;
}

.teaching-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  background: var(--teal-pale);
  border: 1px solid rgba(45,212,191,0.25);
  color: var(--teal);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.teaching-summary {
  color: var(--text-2);
  font-size: 0.8rem;
  margin-bottom: 0.8rem;
}

.diagram-flow {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 0.6rem;
  margin-bottom: 0.8rem;
}

.diagram-step {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.8rem 0.7rem;
  min-height: 88px;
  display: grid;
  align-content: start;
  gap: 0.45rem;
}

.diagram-index {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--teal);
  color: var(--bg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
}

.diagram-label {
  color: var(--text-1);
  font-size: 0.79rem;
  line-height: 1.35;
  font-weight: 600;
}

.teaching-cues {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.teaching-cue {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 0.72rem;
}

/* Follow-up suggestions */
.follow-ups {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.follow-up-chip {
  background: var(--surface-3);
  border: 1px solid var(--border-hi);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 0.75rem;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.follow-up-chip:hover {
  border-color: var(--teal);
  color: var(--teal);
  background: var(--teal-pale);
}

/* Typing indicator */
.typing-row { display: flex; gap: 10px; }

.typing-bubble {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  border-top-left-radius: 4px;
  padding: 14px 18px;
  display: flex;
  gap: 5px;
  align-items: center;
}

.t-dot {
  width: 7px; height: 7px;
  background: var(--text-3);
  border-radius: 50%;
  animation: tdot 1.3s ease infinite;
}

.t-dot:nth-child(2) { animation-delay: 0.2s; }
.t-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes tdot {
  0%, 80%, 100% { transform: translateY(0); background: var(--text-3); }
  40% { transform: translateY(-7px); background: var(--teal); }
}

/* ── Input bar ── */
.input-bar {
  padding: 1rem 1.5rem;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.input-inner {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: var(--surface-2);
  border: 1.5px solid var(--border-hi);
  border-radius: var(--r-lg);
  padding: 10px 10px 10px 16px;
  transition: border-color 0.2s;
}

.input-inner:focus-within {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-pale);
}

#chatInput {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-family: 'Sora', sans-serif;
  font-size: 0.88rem;
  color: var(--text-1);
  resize: none;
  max-height: 140px;
  line-height: 1.5;
}

#chatInput::placeholder { color: #64748b; }

.send-btn {
  width: 38px; height: 38px;
  background: var(--teal);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--bg);
  font-size: 1.1rem;
  transition: all 0.2s var(--ease);
  flex-shrink: 0;
}

.send-btn:hover { background: #5eead4; transform: scale(1.06); box-shadow: 0 0 16px var(--teal-glow); }
.send-btn:disabled { background: var(--surface-3); color: var(--text-3); cursor: not-allowed; transform: none; box-shadow: none; animation: send-pulse 1.2s ease-in-out infinite; }

@keyframes send-pulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.12); }
}

.input-hint {
  font-size: 0.68rem;
  color: var(--muted);
  text-align: center;
  margin-top: 7px;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.3px;
}

/* ================================================================
   TAB 2: TIMELINE
   ================================================================ */

.timeline-layout {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.timeline-header {
  text-align: center;
  max-width: 600px;
  margin: 0 auto;
}

.timeline-header h2 {
  font-family: 'Fraunces', serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 0.5rem;
}

.timeline-header p {
  color: var(--text-2);
  font-size: 0.88rem;
  line-height: 1.6;
}

/* Timeline progress bar */
.tl-progress-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  max-width: 1040px;
  margin: 0 auto;
  width: 100%;
  position: relative;
}

.tl-seg {
  flex: 1;
  height: 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.25s var(--ease);
  opacity: 0.45;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.1);
}

.tl-seg:hover, .tl-seg.active {
  opacity: 1;
  transform: scaleY(1.25);
  box-shadow: 0 0 16px rgba(0,0,0,0.15);
}

[data-theme="light"] .tl-seg {
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08);
}

[data-theme="light"] .tl-seg:hover, 
[data-theme="light"] .tl-seg.active {
  box-shadow: 0 0 16px rgba(0,0,0,0.12);
}

/* Timeline stages grid */
.stages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.2rem;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}

.stage-card {
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 1.25rem 1.25rem 1.2rem;
  cursor: pointer;
  transition: all 0.25s var(--ease);
  position: relative;
  overflow: hidden;
}

.stage-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  border-radius: 24px 24px 0 0;
}

.stage-card:hover {
  border-color: var(--border-hi);
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.stage-card.expanded {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.stage-card-top {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: center;
  margin-bottom: 1rem;
}

.stage-path-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.32rem 0.65rem;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  color: var(--text-2);
}

.stage-flow-head {
  display: flex;
  gap: 0.95rem;
  align-items: flex-start;
}

.stage-emoji-ring {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stage-flow-copy {
  flex: 1;
}

.stage-emoji {
  font-size: 1.2rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-1);
}

.stage-time-badge {
  font-size: 0.7rem;
  font-family: 'JetBrains Mono', monospace;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 3px 9px;
  border-radius: 20px;
  color: var(--text-3);
}

.stage-title {
  font-family: 'Fraunces', serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 6px;
}

.stage-desc {
  font-size: 0.82rem;
  color: var(--text-2);
  line-height: 1.6;
  margin-bottom: 0;
}

.stage-flow-arrow {
  margin: 0.95rem 0 0.25rem;
  color: var(--text-3);
  font-size: 1rem;
  font-family: 'JetBrains Mono', monospace;
}

.stage-details {
  display: none;
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: 4px;
}

.stage-card.expanded .stage-details { display: block; }

.stage-details ul {
  list-style: none;
  padding: 0;
  margin: 8px 0;
}

.stage-details li {
  display: flex;
  gap: 8px;
  font-size: 0.81rem;
  color: var(--text-2);
  padding: 4px 0;
  line-height: 1.5;
}

.stage-details li::before {
  content: '→';
  color: var(--teal);
  font-weight: 600;
  flex-shrink: 0;
}

.ask-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  background: var(--teal-pale);
  border: 1px solid rgba(45,212,191,0.25);
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--teal);
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Sora', sans-serif;
}

.ask-btn:hover {
  background: var(--teal);
  color: var(--bg);
  border-color: var(--teal);
}

/* Stage-specific colors */
.s1 { --sc: var(--s1); }
.s2 { --sc: var(--s2); }
.s3 { --sc: var(--s3); }
.s4 { --sc: var(--s4); }
.s5 { --sc: var(--s5); }
.s6 { --sc: var(--s6); }

.stage-card::before { background: var(--sc); }
.stage-num { color: var(--sc); }
.stage-card.expanded { border-color: var(--sc) !important; box-shadow: 0 0 0 1px var(--sc), var(--shadow-lg); }

/* ================================================================
   TAB 3: QUIZ
   ================================================================ */

.quiz-layout {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.quiz-header {
  text-align: center;
  max-width: 580px;
}

.quiz-header h2 {
  font-family: 'Fraunces', serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 0.5rem;
}

.quiz-header p {
  color: var(--text-2);
  font-size: 0.88rem;
}

/* Category selector */
.category-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.cat-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 7px 16px;
  font-family: 'Sora', sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.2s;
}

.cat-btn:hover { border-color: var(--teal); color: var(--teal); }
.cat-btn.selected { background: var(--teal); border-color: var(--teal); color: var(--bg); font-weight: 600; }

/* Quiz card */
.quiz-card {
  width: 100%;
  max-width: 640px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 2rem;
  animation: msg-in 0.35s var(--ease);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), border-color 0.25s var(--ease);
}

.quiz-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-hi);
}

.quiz-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.2rem;
}

.quiz-score-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--amber);
  background: var(--amber-pale);
  padding: 4px 12px;
  border-radius: 20px;
  font-family: 'JetBrains Mono', monospace;
}

.quiz-q-count {
  font-size: 0.75rem;
  color: var(--text-3);
  font-family: 'JetBrains Mono', monospace;
}

.quiz-question {
  font-family: 'Fraunces', serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-1);
  line-height: 1.5;
  margin-bottom: 1.3rem;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quiz-opt {
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 16px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-2);
  transition: all 0.2s var(--ease);
  text-align: left;
  font-family: 'Sora', sans-serif;
  display: flex;
  align-items: center;
  gap: 10px;
}

.opt-letter {
  width: 26px; height: 26px;
  border-radius: 6px;
  background: var(--surface-3);
  border: 1px solid var(--border-hi);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  flex-shrink: 0;
  color: var(--text-3);
  transition: all 0.2s;
}

.quiz-opt:hover {
  border-color: var(--teal);
  color: var(--text-1);
  background: var(--teal-pale);
}

.quiz-opt:hover .opt-letter {
  background: var(--teal);
  color: var(--bg);
  border-color: var(--teal);
}

.quiz-opt.correct {
  border-color: #34d399;
  background: rgba(52,211,153,0.1);
  color: var(--text-1);
}

.quiz-opt.correct .opt-letter { background: #34d399; color: var(--bg); border-color: #34d399; }

.quiz-opt.wrong {
  border-color: var(--s1);
  background: rgba(248,113,113,0.1);
  color: var(--text-2);
}

.quiz-opt.wrong .opt-letter { background: var(--s1); color: white; border-color: var(--s1); }

.quiz-opt.disabled { pointer-events: none; }

.quiz-explanation {
  margin-top: 1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--teal);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  padding: 12px 16px;
  font-size: 0.82rem;
  color: var(--text-2);
  line-height: 1.6;
  animation: msg-in 0.3s var(--ease);
}

.quiz-explanation strong { color: var(--teal); }

.quiz-next-btn {
  margin-top: 1.2rem;
  width: 100%;
  background: var(--teal);
  border: none;
  border-radius: var(--r-md);
  padding: 12px;
  font-family: 'Sora', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--bg);
  cursor: pointer;
  transition: all 0.2s var(--ease);
  display: none;
}

.quiz-next-btn:hover { background: #5eead4; box-shadow: 0 0 20px var(--teal-glow); }
.quiz-next-btn.visible { display: block; }

/* Loading state */
.quiz-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 2rem;
  color: var(--text-2);
  font-size: 0.85rem;
}

.spin {
  width: 36px; height: 36px;
  border: 3px solid var(--surface-3);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Start quiz CTA */
.quiz-start {
  width: 100%;
  max-width: 640px;
  background: linear-gradient(135deg, var(--surface-2), var(--surface-3));
  border: 1px solid var(--border-hi);
  border-radius: var(--r-xl);
  padding: 2.5rem;
  text-align: center;
}

.quiz-start h3 {
  font-family: 'Fraunces', serif;
  font-size: 1.4rem;
  margin-bottom: 0.5rem;
  color: var(--text-1);
}

.quiz-start p {
  color: var(--text-2);
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}

.start-quiz-btn {
  background: var(--amber);
  border: none;
  border-radius: var(--r-md);
  padding: 12px 32px;
  font-family: 'Sora', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--bg);
  cursor: pointer;
  transition: all 0.2s var(--ease);
  box-shadow: 0 0 24px rgba(245,158,11,0.25);
}

.start-quiz-btn:hover {
  background: #fbbf24;
  transform: scale(1.04);
  box-shadow: 0 0 32px rgba(245,158,11,0.4);
}

/* Score board */
.scoreboard {
  width: 100%;
  max-width: 640px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 2rem;
  text-align: center;
  animation: msg-in 0.4s var(--ease);
}

.score-display {
  font-family: 'Fraunces', serif;
  font-size: 4rem;
  font-weight: 900;
  color: var(--teal);
  line-height: 1;
  margin-bottom: 0.5rem;
  text-shadow: 0 0 30px var(--teal-glow);
}

.score-label {
  font-size: 0.85rem;
  color: var(--text-2);
  margin-bottom: 1.2rem;
}

.replay-btn {
  background: var(--surface-2);
  border: 1px solid var(--border-hi);
  border-radius: var(--r-md);
  padding: 10px 28px;
  font-family: 'Sora', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-1);
  cursor: pointer;
  transition: all 0.2s;
}

.replay-btn:hover { border-color: var(--teal); color: var(--teal); }

/* Quiz history */
.quiz-history-section {
  width: 100%;
  max-width: 640px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin-top: 1.5rem;
  overflow: hidden;
}

.quiz-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--surface-3);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
}

.quiz-history-header strong {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-1);
}

.history-toggle-btn {
  background: none;
  border: none;
  font-size: 0.8rem;
  color: var(--text-3);
  cursor: pointer;
  padding: 4px 8px;
  transition: transform 0.2s;
}

.history-toggle-btn:hover {
  color: var(--teal);
}

.quiz-history-list {
  max-height: 400px;
  overflow-y: auto;
  transition: max-height 0.3s var(--ease);
}

.quiz-history-list.hidden {
  max-height: 0;
  overflow: hidden;
}

.history-empty {
  padding: 16px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-3);
}

.history-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
}

.history-item:last-child {
  border-bottom: none;
}

.history-date {
  color: var(--text-3);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
}

.history-category {
  color: var(--text-2);
}

.history-score {
  color: var(--amber);
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
}

/* ================================================================
   UTILITY & RESPONSIVE
   ================================================================ */

.hidden { display: none !important; }

@media (max-width: 900px) {
  .topics-sidebar { display: none; }
  .stages-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .topbar { padding: 0 1rem; gap: 0.5rem; }
  .brand-name { font-size: 1.1rem; }
  .nav-hamburger { display: block; }
  .tab-nav {
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--surface-2);
    border-radius: 0;
    padding: 8px;
    gap: 4px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s var(--ease);
    z-index: 100;
  }
  .topbar.nav-open .tab-nav {
    max-height: 300px;
  }
  .tab-btn {
    width: 100%;
    justify-content: flex-start;
    padding: 10px 16px;
  }
  .tab-btn span { display: inline; }
  .topbar-right { gap: 8px; }
  .messages-wrap, .timeline-layout, .quiz-layout { padding: 1rem; }
  .starter-grid { grid-template-columns: 1fr; }
  .bubble { max-width: 88%; }
  .answer-method-grid { grid-template-columns: 1fr; }
  .diagram-flow { grid-template-columns: 1fr 1fr; }
  .stage-card-top, .stage-flow-head { flex-direction: column; }
  .tl-progress-bar { gap: 6px; }
  .news-marquee {
    grid-template-columns: 1fr;
  }

  .news-marquee-label {
    justify-content: center;
    border-right: none;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    min-height: 36px;
  }
}

/* ================================================================
   INDIA INFO TABS
   ================================================================ */

.info-layout {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  padding: 2rem;
}

.info-hero {
  max-width: 760px;
  margin: 0 auto 1.5rem;
  text-align: center;
}

.info-hero h2 {
  font-family: 'Fraunces', serif;
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.info-hero p {
  color: var(--text-2);
  font-size: 0.9rem;
}

.tracker-grid,
.laws-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  max-width: 1100px;
  margin: 0 auto 1.5rem;
}

.tracker-card,
.law-card,
.info-card-block,
.law-callout {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.tracker-banner {
  max-width: 1100px;
  margin: 0 auto 1rem;
}

.tracker-banner-card,
.tracker-detail-card {
  background: linear-gradient(135deg, var(--surface-2), var(--surface-3));
  border: 1px solid var(--border-hi);
  border-radius: var(--r-lg);
  padding: 1rem 1.25rem;
}

.tracker-kicker {
  color: var(--amber);
  font-size: 0.74rem;
  font-family: 'JetBrains Mono', monospace;
  margin-bottom: 0.6rem;
}

.tracker-card h3,
.law-card h3,
.info-card-block h3,
.law-callout h3 {
  font-family: 'Fraunces', serif;
  font-size: 1.05rem;
  margin-bottom: 0.55rem;
}

.tracker-card p,
.law-card p,
.law-callout p {
  color: var(--text-2);
  font-size: 0.84rem;
}

.tracker-card {
  cursor: pointer;
  transition: transform 0.2s var(--ease), border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.tracker-card:hover {
  transform: translateY(-2px);
  border-color: var(--teal);
}

.tracker-card.selected {
  border-color: var(--teal);
  box-shadow: 0 0 0 1px var(--teal), var(--shadow-md);
  background: linear-gradient(135deg, rgba(45, 212, 191, 0.08), var(--surface));
}

.tracker-meta,
.tracker-status {
  margin-top: 0.75rem;
  font-size: 0.79rem;
}

.tracker-meta {
  color: var(--text-2);
}

.tracker-status {
  color: var(--teal);
  font-weight: 600;
}

.tracker-detail {
  max-width: 1100px;
  margin: 0 auto 1.5rem;
}

.tracker-detail-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 0.8rem;
}

.tracker-detail-head h3 {
  font-family: 'Fraunces', serif;
  font-size: 1.2rem;
}

.tracker-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.8rem;
  background: var(--teal-pale);
  border: 1px solid rgba(45,212,191,0.25);
  border-radius: 999px;
  padding: 0.5rem 0.9rem;
  color: var(--teal);
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(45,212,191,0.04);
  transition: all 0.2s var(--ease);
}

.tracker-back-btn:hover {
  background: var(--teal);
  border-color: var(--teal);
  color: var(--bg);
  box-shadow: 0 0 16px var(--teal-glow);
}

.tracker-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.tracker-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 14px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border-hi);
  color: var(--text-1);
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 600;
}

.tracker-link-btn:hover {
  border-color: var(--teal);
  color: var(--teal);
}

.tracker-refresh-btn {
  margin-top: 0;
}

.tracker-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

.tracker-facts div {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 0.85rem;
}

.tracker-facts span {
  display: block;
  color: var(--text-3);
  font-size: 0.72rem;
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.tracker-facts strong {
  color: var(--text-1);
  font-size: 0.86rem;
}

.tracker-live-note {
  background: rgba(45, 212, 191, 0.08);
  border-left: 3px solid var(--teal);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  padding: 0.85rem 1rem;
  color: var(--text-1);
  font-size: 0.82rem;
  margin-bottom: 1rem;
}

.tracker-subsection {
  margin-top: 1rem;
}

.tracker-subsection h4 {
  font-size: 0.82rem;
  color: var(--amber);
  margin-bottom: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.tracker-points {
  padding-left: 1.2rem;
  color: var(--text-2);
  font-size: 0.82rem;
}

.tracker-points li {
  margin-bottom: 0.45rem;
}

.mini-table {
  display: grid;
  gap: 0.4rem;
}

.mini-head,
.mini-row {
  display: grid;
  grid-template-columns: minmax(0, 3fr) repeat(3, minmax(52px, 1fr));
  gap: 0.5rem;
  align-items: center;
}

.mini-head {
  color: var(--text-3);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.mini-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 0.8rem;
  color: var(--text-2);
  font-size: 0.8rem;
}

.mini-row-two,
.mini-head-two {
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 2fr);
}

.constituency-list {
  display: grid;
  gap: 0.7rem;
}

.constituency-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 0.9rem 1rem;
  display: grid;
  gap: 0.2rem;
}

.constituency-card strong {
  color: var(--text-1);
  font-size: 0.85rem;
}

.constituency-card span {
  color: var(--text-2);
  font-size: 0.79rem;
}

.info-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  max-width: 1100px;
  margin: 0 auto;
}

.date-list,
.source-list {
  display: grid;
  gap: 0.75rem;
}

.date-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  font-size: 0.82rem;
}

.date-row strong {
  color: var(--text-1);
}

.source-item {
  display: grid;
  gap: 0.25rem;
  text-decoration: none;
  color: inherit;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.source-item strong {
  color: var(--teal);
  font-size: 0.82rem;
}

.source-item span {
  color: var(--text-2);
  font-size: 0.78rem;
}

.law-callout {
  max-width: 1100px;
  margin: 0 auto 1rem;
  background: linear-gradient(135deg, var(--surface-2), var(--surface-3));
}

.law-callout ul {
  padding-left: 1.2rem;
  margin-top: 0.75rem;
}

.law-callout li {
  color: var(--text-2);
  margin-bottom: 0.45rem;
  font-size: 0.82rem;
}

/* ── Live Results Panel ── */
.live-results-panel {
  max-width: 1100px;
  margin: 0 auto 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--teal);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: 0 0 20px var(--teal-glow);
}

.live-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: linear-gradient(135deg, rgba(45, 212, 191, 0.08), rgba(45, 212, 191, 0.04));
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.live-results-header h3 {
  font-family: 'Fraunces', serif;
  font-size: 1rem;
  margin: 0;
  color: var(--text-1);
}

.last-updated {
  color: var(--amber);
  font-size: 0.75rem;
  font-weight: 600;
}

.refresh-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.5rem 0.9rem;
  background: transparent;
  border: 1px solid var(--teal);
  border-radius: 6px;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s var(--ease);
}

.refresh-btn:hover {
  background: var(--teal-pale);
  box-shadow: 0 0 12px var(--teal-glow);
}

.refresh-btn.spinning {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.results-table-wrap {
  padding: 1rem 1.25rem;
  max-height: 400px;
  overflow-y: auto;
}

.results-placeholder {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-3);
  font-size: 0.85rem;
}

.no-results-card {
  text-align: center;
  padding: 2.5rem 2rem;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  margin: 1rem 0;
}

.no-results-card h3 {
  margin: 0.5rem 0 1rem 0;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-1);
}

.no-results-card p {
  margin: 0.5rem 0;
  color: var(--text-3);
  font-size: 0.95rem;
}

.no-results-emoji {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.news-marquee-item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.75rem;
}

.news-dot {
  width: 0.6rem;
  height: 0.6rem;
  display: inline-block;
  border-radius: 50%;
  background: var(--border);
  flex: 0 0 auto;
}

.news-dot.source-newsdata { background: #2dd4bf; } /* teal */
.news-dot.source-eci { background: #f59e0b; } /* amber */
.news-dot.source-newsapi { background: #60a5fa; } /* blue */
.news-dot.source-rss { background: var(--border); }

.results-table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.results-table-wrap th {
  background: var(--surface-2);
  color: var(--text-1);
  padding: 0.7rem;
  text-align: left;
  font-weight: 600;
  border-bottom: 1px solid var(--border-hi);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-size: 0.72rem;
}

.results-table-wrap td {
  padding: 0.7rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
}

.results-table-wrap tr:nth-child(even) {
  background: rgba(45, 212, 191, 0.04);
}

.results-table-wrap tr:hover {
  background: rgba(45, 212, 191, 0.08);
}

.results-table-wrap td strong {
  color: var(--text-1);
}

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

@media (min-width: 769px) {
  .tab-nav {
    display: flex;
    flex-wrap: nowrap;
  }

  .tracker-grid,
  .laws-grid,
  .stages-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .bubble {
    max-width: 70%;
  }
}

@media (min-width: 1200px) {
  .app-shell {
    max-width: 1600px;
    margin: 0 auto;
  }

  .info-layout,
  .timeline-layout,
  .quiz-layout {
    padding-left: 2.5rem;
    padding-right: 2.5rem;
  }
}

@media (max-width: 768px) {
  .topbar {
    height: auto;
    min-height: 60px;
    flex-wrap: wrap;
    align-items: center;
    padding: 0.75rem 1rem;
    gap: 0.75rem;
  }

  .nav-hamburger {
    display: block;
  }

  .topbar-right {
    margin-left: auto;
  }

  .tab-nav {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 0;
    background: transparent;
    border-radius: 0;
  }

  .tab-btn {
    width: 100%;
    justify-content: center;
    min-height: 44px;
    padding: 0.9rem 0.75rem;
  }

  .chat-layout {
    flex-direction: column;
  }

  .topics-sidebar {
    display: none;
  }

  .messages-wrap {
    padding: 1rem;
  }

  .bubble {
    max-width: 90%;
  }

  .input-bar {
    position: sticky;
    bottom: 0;
    z-index: 40;
    padding: 0.75rem;
  }

  .input-inner {
    min-height: 52px;
  }

  #chatInput {
    font-size: 16px;
  }

  .news-marquee {
    grid-template-columns: 1fr;
  }

  .news-marquee-label {
    justify-content: center;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .news-marquee-item {
    font-size: 0.9rem;
  }

  .news-marquee-track.moving {
    animation-duration: 90s;
  }

  .timeline-layout,
  .quiz-layout,
  .info-layout {
    padding: 1rem;
  }

  .stages-grid,
  .tracker-grid,
  .laws-grid,
  .info-split {
    grid-template-columns: 1fr;
  }

  .results-table-wrap {
    overflow-x: auto;
    max-height: 320px;
  }

  .results-table-wrap table {
    min-width: 500px;
  }

  .live-results-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .refresh-btn {
    align-self: flex-end;
  }

  .quiz-card {
    padding: 1.25rem;
  }
}

@media (max-width: 480px) {
  .brand-name {
    font-size: 1rem;
  }

  .tab-nav {
    grid-template-columns: 1fr;
    position: relative;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s var(--ease);
  }

  .topbar.nav-open .tab-nav {
    max-height: 72vh;
    overflow: visible;
    padding-top: 0.25rem;
  }

  .tab-btn {
    justify-content: flex-start;
  }

  .chat-layout {
    gap: 0;
  }

  .messages-wrap {
    padding: 0.75rem;
  }

  .bubble {
    max-width: 92%;
  }

  .bubble.ai,
  .bubble.user {
    font-size: 0.95rem;
  }

  .input-bar {
    padding: 0.65rem;
  }

  .input-hint {
    font-size: 0.65rem;
  }

  .news-marquee-item {
    font-size: 0.95rem;
  }

  .timeline-header h2,
  .quiz-header h2,
  .info-hero h2 {
    font-size: 1.2rem;
  }

  .welcome-hero h2 {
    font-size: 1.2rem;
  }

  .tracker-banner,
  .quiz-card,
  .scoreboard,
  .live-results-panel,
  .law-callout {
    border-radius: var(--r-lg);
  }
}
