/* =============================================================
   Urdu Sentiment & Emotion Engine — Phase 7 Design System
   Midnight Obsidian · Glassmorphism · Dark mode only
   ============================================================= */

:root {
  /* Surfaces */
  --bg: #0B0F19;
  --bg-deep: #05070E;
  --bg-lift: #111726;

  /* Glass */
  --glass-bg: rgba(255, 255, 255, 0.045);
  --glass-bg-strong: rgba(255, 255, 255, 0.07);
  --glass-stroke: rgba(255, 255, 255, 0.09);
  --glass-stroke-hi: rgba(255, 255, 255, 0.16);
  --glass-blur: 18px;

  /* Text */
  --text: #E8EDF7;
  --text-soft: #B4BECD;
  --text-muted: #7C8798;

  /* Accents */
  --accent: #6366F1;
  --accent-2: #22D3EE;
  --accent-glow: rgba(99, 102, 241, 0.45);

  /* Sentiment */
  --positive: #10B981;
  --neutral: #9CA3AF;
  --negative: #EF4444;

  /* Emotion */
  --joy: #F59E0B;
  --anger: #DC2626;
  --fear: #8B5CF6;
  --sadness: #3B82F6;

  /* Geometry */
  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-pill: 999px;

  /* Shadows */
  --shadow-card: 0 18px 50px rgba(0, 0, 0, 0.55);
  --shadow-soft: 0 8px 24px rgba(0, 0, 0, 0.35);

  /* Motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur: 0.35s;

  --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-urdu: "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", serif;
}

/* ---------- Reset ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background:
    radial-gradient(1100px 700px at 15% -10%, rgba(99, 102, 241, 0.16), transparent 60%),
    radial-gradient(900px 620px at 88% 8%, rgba(34, 211, 238, 0.12), transparent 62%),
    var(--bg);
  background-attachment: fixed;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.02em; line-height: 1.25; }
p { margin: 0; }
code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.88em;
  color: var(--accent-2);
}
button, textarea, select { font: inherit; color: inherit; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -60px; left: 16px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: var(--r-sm);
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  transition: top 0.2s var(--ease);
}
.skip-link:focus { top: 16px; }

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

/* =============================================================
   BACKGROUND STACK
   Painting order, back to front:
     -3  #bg-canvas       WebGL particle wave + drifting embers
     -2  .ambient-glows   slow CSS blob orbs
     -1  .bg-vignette     edge falloff that seats the whole stack
      0  .mouse-spotlight cursor halo (read by the cards' backdrop-filter)
      1  .shell           application content
   ============================================================= */

#bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -3;
  display: block;
  opacity: 0;
  transition: opacity 1.4s ease;
}
#bg-canvas.is-ready { opacity: 1; }

/* ---------- Ambient glow orbs ---------- */
.ambient-glows {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  overflow: hidden;
  /* Isolate the orbs' compositing from the rest of the page. */
  contain: strict;
}

.glow-orb {
  position: absolute;
  display: block;
  /* Organic blob outline — this is what makes the rotation readable,
     a perfect circle would look static no matter how fast it spun. */
  border-radius: 42% 58% 63% 37% / 41% 44% 56% 59%;
  filter: blur(80px);
  will-change: transform;
  transform-origin: 50% 50%;
}

.glow-orb--indigo {
  top: -8vh;
  left: -6vw;
  width: 46vw;
  height: 46vw;
  min-width: 380px;
  min-height: 380px;
  opacity: 0.30;
  background: radial-gradient(circle at 35% 35%, #6366F1 0%, rgba(99, 102, 241, 0.45) 45%, transparent 72%);
  animation: floatGlow 26s var(--ease-glow, ease-in-out) infinite;
}

.glow-orb--cyan {
  top: 34vh;
  right: -12vw;
  width: 40vw;
  height: 40vw;
  min-width: 340px;
  min-height: 340px;
  opacity: 0.22;
  background: radial-gradient(circle at 60% 40%, #22D3EE 0%, rgba(34, 211, 238, 0.40) 48%, transparent 74%);
  animation: floatGlowAlt 29s var(--ease-glow, ease-in-out) infinite;
  animation-delay: -8s;
}

.glow-orb--violet {
  bottom: -14vh;
  left: 26vw;
  width: 44vw;
  height: 44vw;
  min-width: 360px;
  min-height: 360px;
  opacity: 0.18;
  background: radial-gradient(circle at 45% 55%, #8B5CF6 0%, rgba(139, 92, 246, 0.42) 46%, transparent 73%);
  animation: floatGlow 22s var(--ease-glow, ease-in-out) infinite reverse;
  animation-delay: -14s;
}

@keyframes floatGlow {
  0%   { transform: translate3d(0, 0, 0) scale(1) rotate(0deg); }
  25%  { transform: translate3d(5vw, -6vh, 0) scale(1.16) rotate(90deg); }
  50%  { transform: translate3d(8vw, 4vh, 0) scale(0.94) rotate(180deg); }
  75%  { transform: translate3d(-3vw, 7vh, 0) scale(1.10) rotate(270deg); }
  100% { transform: translate3d(0, 0, 0) scale(1) rotate(360deg); }
}

@keyframes floatGlowAlt {
  0%   { transform: translate3d(0, 0, 0) scale(1.04) rotate(0deg); }
  33%  { transform: translate3d(-7vw, 8vh, 0) scale(0.90) rotate(-120deg); }
  66%  { transform: translate3d(-2vw, -7vh, 0) scale(1.20) rotate(-240deg); }
  100% { transform: translate3d(0, 0, 0) scale(1.04) rotate(-360deg); }
}

.bg-vignette {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 0%, transparent 40%, rgba(5, 7, 14, 0.72) 100%),
    linear-gradient(180deg, transparent 55%, rgba(5, 7, 14, 0.85) 100%);
}

/* ---------- Mouse spotlight halo ----------
   A fixed-size element parked at the origin and moved with translate3d, so
   tracking the cursor stays on the compositor instead of repainting a
   viewport-sized gradient every frame. It sits *below* .shell on purpose:
   the cards' backdrop-filter samples it, so the halo blooms through the
   glass rather than washing over it. */
.mouse-spotlight {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 0;
  width: 780px;
  height: 780px;
  margin: -390px 0 0 -390px;
  pointer-events: none;
  opacity: 0;
  will-change: transform, opacity;
  transition: opacity 0.6s ease;
  background: radial-gradient(
    circle closest-side,
    rgba(129, 140, 248, 0.16) 0%,
    rgba(34, 211, 238, 0.09) 38%,
    rgba(139, 92, 246, 0.05) 62%,
    transparent 100%
  );
}
.has-pointer .mouse-spotlight { opacity: 1; }

/* ---------- Cursor-lit glass borders ----------
   `background-attachment: fixed` resolves the gradient against the viewport,
   so one pair of root-level coordinates lights every card's rim without
   per-card bookkeeping. The two-layer mask keeps only the 1px ring. */
@media (hover: hover) and (pointer: fine) {
  .glass::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    border-radius: inherit;
    padding: 1px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s var(--ease);
    background:
      radial-gradient(
        420px circle at var(--spot-x, 50vw) var(--spot-y, 50vh),
        rgba(186, 200, 255, 0.75) 0%,
        rgba(34, 211, 238, 0.30) 38%,
        transparent 70%
      );
    background-attachment: fixed;
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
            mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
  }
  .has-pointer .glass::after { opacity: 1; }
}

/* ---------- Layout shell ---------- */
.shell {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 22px 0 64px;
}

/* ---------- Glass primitive ---------- */
.glass {
  /* Anchors the cursor-lit ::after ring. Elements that need another
     position value (sticky header, relative tab bar) set it themselves
     further down the cascade. */
  position: relative;
  background: var(--glass-bg);
  border: 1px solid var(--glass-stroke);
  border-radius: var(--r-lg);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(150%);
  backdrop-filter: blur(var(--glass-blur)) saturate(150%);
  box-shadow: var(--shadow-card), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* Top highlight sweep shared by cards */
.card {
  position: relative;
  overflow: hidden;
}
.card::before {
  content: "";
  position: absolute;
  inset-inline: 0;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.28), transparent);
  opacity: 0.75;
  pointer-events: none;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 14px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 18px;
  border-radius: var(--r-md);
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  flex: none;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 22px var(--accent-glow);
}

.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: 15px; font-weight: 650; letter-spacing: -0.01em; }
.brand-text small {
  font-size: 11.5px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-actions { display: flex; align-items: center; gap: 8px; flex: none; }

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--glass-stroke);
  background: rgba(255, 255, 255, 0.05);
  font-size: 12.5px;
  font-weight: 550;
  white-space: nowrap;
}
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  box-shadow: 0 0 0 0 currentColor;
}
.status-badge[data-state="healthy"] { color: var(--positive); border-color: rgba(16, 185, 129, 0.35); background: rgba(16, 185, 129, 0.10); }
.status-badge[data-state="healthy"] .status-dot { background: var(--positive); animation: pulse-dot 2.4s ease-out infinite; }
.status-badge[data-state="degraded"] { color: var(--joy); border-color: rgba(245, 158, 11, 0.35); background: rgba(245, 158, 11, 0.10); }
.status-badge[data-state="degraded"] .status-dot { background: var(--joy); }
.status-badge[data-state="offline"] { color: var(--negative); border-color: rgba(239, 68, 68, 0.35); background: rgba(239, 68, 68, 0.10); }
.status-badge[data-state="offline"] .status-dot { background: var(--negative); }
.status-badge[data-state="checking"] .status-dot { animation: pulse-dot 1.2s ease-out infinite; }

@keyframes pulse-dot {
  0%   { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.35); }
  70%  { box-shadow: 0 0 0 7px rgba(255, 255, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 10px;
  border: 1px solid var(--glass-stroke);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-soft);
  cursor: pointer;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease), transform 0.2s var(--ease);
}
.icon-btn:hover { color: var(--text); border-color: var(--glass-stroke-hi); transform: rotate(-40deg); }

/* ---------- Hero ---------- */
.hero { padding: 56px 4px 40px; max-width: 720px; }
.hero-title {
  font-size: clamp(30px, 5vw, 46px);
  font-weight: 750;
  letter-spacing: -0.035em;
  background: linear-gradient(120deg, #FFFFFF 20%, #A9B6FF 55%, #6EE7F9 95%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-title em {
  font-style: normal;
  background: linear-gradient(120deg, var(--accent-2), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-sub {
  margin-top: 16px;
  font-size: 16px;
  color: var(--text-soft);
  max-width: 62ch;
}

/* ---------- Tabs ---------- */
.tabs {
  position: relative;
  display: flex;
  gap: 4px;
  padding: 6px;
  border-radius: var(--r-pill);
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 550;
  white-space: nowrap;
  cursor: pointer;
  transition: color var(--dur) var(--ease);
}
.tab:hover { color: var(--text-soft); }
.tab.is-active { color: #fff; }
.tab-ico { font-size: 10px; opacity: 0.75; }

.tab-indicator {
  position: absolute;
  top: 6px;
  left: 6px;
  height: calc(100% - 12px);
  width: 0;
  border-radius: var(--r-pill);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.9), rgba(34, 211, 238, 0.75));
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
  transition: transform 0.45s var(--ease), width 0.45s var(--ease);
  pointer-events: none;
}

/* ---------- Panels ---------- */
.panel { padding-top: 28px; }
.panel[hidden] { display: none; }

.results-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-top: 20px;
}
.span-2 { grid-column: 1 / -1; }

/* ---------- Cards ---------- */
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 18px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.card-title { font-size: 15px; font-weight: 600; letter-spacing: 0.01em; }
.card-hint { font-size: 12px; color: var(--text-muted); }
.card-head-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-body { padding: 22px; }

/* ---------- Chips ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  border-radius: var(--r-pill);
  border: 1px solid var(--glass-stroke);
  background: rgba(255, 255, 255, 0.05);
  font-size: 12.5px;
  font-weight: 550;
  color: var(--text-soft);
  white-space: nowrap;
}
button.chip { cursor: pointer; transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease), background var(--dur) var(--ease); }
button.chip:hover { color: var(--text); border-color: var(--glass-stroke-hi); background: rgba(255, 255, 255, 0.09); }

.chip-lang[data-lang="urdu-script"] { color: var(--accent-2); border-color: rgba(34, 211, 238, 0.35); background: rgba(34, 211, 238, 0.10); }
.chip-lang[data-lang="roman-urdu"]  { color: #A5B4FC; border-color: rgba(129, 140, 248, 0.35); background: rgba(129, 140, 248, 0.10); }
.chip-lang[data-lang="mixed"]       { color: var(--joy); border-color: rgba(245, 158, 11, 0.35); background: rgba(245, 158, 11, 0.10); }
.chip-lang[data-lang="english"]     { color: var(--positive); border-color: rgba(16, 185, 129, 0.32); background: rgba(16, 185, 129, 0.10); }

.chip-toggle[aria-pressed="true"] {
  color: #fff;
  border-color: rgba(99, 102, 241, 0.5);
  background: rgba(99, 102, 241, 0.22);
}

.chip-verdict {
  font-size: 13px;
  font-weight: 650;
  padding: 7px 16px;
  color: var(--tone, var(--text-soft));
  border-color: color-mix(in srgb, var(--tone, #fff) 38%, transparent);
  background: color-mix(in srgb, var(--tone, #fff) 12%, transparent);
}

/* ---------- Buttons ---------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 12px 26px;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s var(--ease), box-shadow var(--dur) var(--ease), background var(--dur) var(--ease), opacity var(--dur) var(--ease);
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn-sm { padding: 9px 18px; font-size: 13px; }

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #4F46E5 55%, var(--accent-2));
  box-shadow: 0 10px 30px rgba(79, 70, 229, 0.35);
}
.btn-primary:hover { box-shadow: 0 14px 38px rgba(79, 70, 229, 0.5); }

.btn-ghost {
  color: var(--text-soft);
  border-color: var(--glass-stroke);
  background: rgba(255, 255, 255, 0.04);
}
.btn-ghost:hover { color: var(--text); border-color: var(--glass-stroke-hi); background: rgba(255, 255, 255, 0.08); }

.btn[disabled] { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-spinner {
  display: none;
  width: 15px; height: 15px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}
.btn.is-loading .btn-spinner { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Composer ---------- */
.text-input {
  width: 100%;
  min-height: 140px;
  padding: 18px 20px;
  border-radius: var(--r-md);
  border: 1px solid var(--glass-stroke);
  background: rgba(6, 9, 17, 0.55);
  color: var(--text);
  font-size: 15.5px;
  line-height: 1.75;
  resize: vertical;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.text-input::placeholder { color: #566073; }
.text-input:focus {
  outline: none;
  border-color: rgba(99, 102, 241, 0.55);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.14);
}

/* Urdu / RTL rendering */
.text-input[dir="rtl"],
.urdu-script {
  font-family: var(--font-urdu);
  font-size: 19px;
  line-height: 2.35;
}
[dir="rtl"] { text-align: right; }

.composer-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.samples { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.samples-label { font-size: 12px; color: var(--text-muted); }
.chip-sample { font-weight: 500; }

.char-count { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.char-count.is-warn { color: var(--joy); }
.char-count.is-over { color: var(--negative); font-weight: 600; }

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

/* ---------- Empty state ---------- */
.empty-state {
  margin-top: 20px;
  padding: 46px 24px;
  border-radius: var(--r-lg);
  text-align: center;
  color: var(--text-muted);
}
.empty-ico { font-size: 26px; color: var(--accent); opacity: 0.7; margin-bottom: 10px; }

/* ---------- Verdict + bars ---------- */
.verdict-block { display: flex; align-items: baseline; gap: 10px; margin-bottom: 22px; }
.verdict-value {
  font-size: 38px;
  font-weight: 750;
  letter-spacing: -0.03em;
  color: var(--tone, var(--text));
  font-variant-numeric: tabular-nums;
}
.verdict-caption { font-size: 12.5px; color: var(--text-muted); }

.bars { display: flex; flex-direction: column; gap: 15px; }
.bar-row { display: flex; flex-direction: column; gap: 7px; }
.bar-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
}
.bar-name { color: var(--text-soft); font-weight: 500; }
.bar-value { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.bar-track {
  height: 8px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  width: 0;
  border-radius: var(--r-pill);
  background: var(--tone, var(--accent));
  box-shadow: 0 0 14px color-mix(in srgb, var(--tone, var(--accent)) 55%, transparent);
}
.bar-row.is-top .bar-name { color: var(--text); font-weight: 650; }

/* ---------- Attention highlighter ---------- */
.attention-tokens {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 5px;
  min-height: 52px;
  line-height: 2.1;
}
.attention-tokens[dir="rtl"] { flex-direction: row-reverse; }

.token {
  padding: 4px 9px;
  border-radius: 8px;
  font-size: 14.5px;
  border: 1px solid transparent;
  transition: transform 0.2s var(--ease), border-color 0.2s var(--ease);
  cursor: default;
}
.token:hover { transform: translateY(-2px); border-color: var(--glass-stroke-hi); }
.token.urdu-script { font-size: 18px; }

.attention-legend {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.legend-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; }
.legend-ramp {
  flex: 1;
  height: 7px;
  border-radius: var(--r-pill);
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.08), var(--ramp-color, var(--accent)));
}

/* ---------- Analytics ---------- */
.stat-row {
  display: flex;
  align-items: stretch;
  gap: 16px;
  flex-wrap: wrap;
}
.stat-card {
  flex: 1 1 190px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px 22px;
}
.stat-label {
  font-size: 11.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.09em;
}
.stat-value {
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--tone, var(--text));
  font-variant-numeric: tabular-nums;
}
.stat-refresh { flex: none; align-self: center; }

.chart-wrap { position: relative; height: 290px; }

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  min-height: 60px;
}
.tag {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  padding: 7px 15px;
  border-radius: var(--r-pill);
  border: 1px solid var(--glass-stroke);
  background: rgba(99, 102, 241, 0.10);
  color: var(--text);
  font-weight: 550;
  transition: transform 0.22s var(--ease), border-color 0.22s var(--ease), background 0.22s var(--ease);
}
.tag:hover { transform: translateY(-3px); border-color: rgba(99, 102, 241, 0.55); background: rgba(99, 102, 241, 0.2); }
.tag-count { font-size: 11.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.tag.urdu-script { font-family: var(--font-urdu); }

.muted-note { color: var(--text-muted); font-size: 13.5px; }

/* ---------- Live feed ---------- */
.live-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 18px;
}
.live-pulse {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--text-muted);
  flex: none;
}
.live-pulse[data-on="true"] { background: var(--positive); animation: pulse-dot 1.6s ease-out infinite; }

.feed { display: flex; flex-direction: column; gap: 14px; }

.feed-card {
  padding: 16px 18px;
  border-radius: var(--r-md);
  border: 1px solid var(--glass-stroke);
  background: rgba(255, 255, 255, 0.035);
  border-left: 3px solid var(--tone, var(--accent));
}
[dir="rtl"] .feed-card { border-left: 1px solid var(--glass-stroke); border-right: 3px solid var(--tone, var(--accent)); }

.feed-text { font-size: 15px; color: var(--text); margin-bottom: 12px; }
.feed-text.urdu-script { font-size: 18px; line-height: 2.2; }
.feed-tags { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.feed-time { margin-inline-start: auto; font-size: 11.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.select {
  padding: 8px 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--glass-stroke);
  background: rgba(11, 15, 25, 0.9);
  color: var(--text-soft);
  font-size: 12.5px;
  cursor: pointer;
}
.select:hover { border-color: var(--glass-stroke-hi); }

/* ---------- Toasts ---------- */
.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(380px, calc(100vw - 40px));
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 14px 18px;
  border-radius: var(--r-md);
  border: 1px solid var(--glass-stroke);
  background: rgba(17, 23, 38, 0.92);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-card);
  font-size: 13.5px;
  color: var(--text-soft);
  border-left: 3px solid var(--tone, var(--accent));
}
.toast[data-type="error"] { --tone: var(--negative); }
.toast[data-type="success"] { --tone: var(--positive); }
.toast[data-type="warn"] { --tone: var(--joy); }
.toast[data-type="info"] { --tone: var(--accent-2); }
.toast-ico { color: var(--tone, var(--accent)); font-weight: 700; line-height: 1.4; }

/* ---------- Footer ---------- */
.site-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 54px;
  padding-top: 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 12.5px;
  color: var(--text-muted);
}

.noscript-banner {
  position: fixed;
  inset-inline: 0;
  top: 0;
  z-index: 200;
  padding: 14px;
  text-align: center;
  background: var(--negative);
  color: #fff;
  font-weight: 600;
}

/* ---------- Reveal (fallback when GSAP is unavailable) ---------- */
.reveal { opacity: 1; }
.no-gsap .reveal { animation: fade-up 0.6s var(--ease) both; }
@keyframes fade-up {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .results-grid { grid-template-columns: minmax(0, 1fr); }
  .hero { padding: 40px 2px 30px; }
}

@media (max-width: 620px) {
  .shell { width: calc(100% - 24px); }
  .site-header { flex-wrap: wrap; }
  .brand-text small { display: none; }
  .card-body { padding: 18px; }
  .card-head { padding: 16px 18px; }
  .verdict-value { font-size: 32px; }
  .tabs { width: 100%; }
  .tab { padding: 10px 16px; }
  .toast-stack { right: 12px; left: 12px; bottom: 12px; max-width: none; }
}

/* ---------- Accessibility: reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  #bg-canvas { opacity: 0.35; }

  /* Hold the orbs on their first frame and drop the cursor effects entirely —
     a drifting blur and a tracking halo are exactly the kind of continuous
     motion this preference is asking us to stop. */
  .glow-orb { animation: none !important; }
  .mouse-spotlight { display: none; }
  .glass::after { display: none; }
}
