/* ─── OPENDISTRICTS V4 - v4.css ───────────────────────────────────────────────
   Design tokens + exact layout model from docs/V4-transition.md Sections 02-09
   Constraints: CSS transform + opacity only. No blur on map elements.
   No box-shadow on timeline cards. Never hard-code values outside this token set.
──────────────────────────────────────────────────────────────────────────────── */

/* ═══════════════════════════════════════════════════════════════════
   SECTION 03 - DESIGN TOKENS
═══════════════════════════════════════════════════════════════════ */
:root {
  /* Ink (text) */
  --ink: #0D1117;
  --ink-mid: #30363D;
  --ink-sub: #57606A;
  --ink-ghost: #8B949E;

  /* Structure */
  --rule: #D0D7DE;
  --rule-faint: #EAEEF2;
  --bg: #F6F8FA;
  --white: #FFFFFF;

  /* Semantic colour */
  --primary: #1F6FEB;
  --danger: #CF222E;
  --warn: #9A6700;
  --ok: #1A7F37;
  --purple: #6E40C9;
  --map-base: #DDE1E7;

  /* Typography */
  --font-display: 'Syne', sans-serif;
  --font-data: 'DM Mono', monospace;

  /* Incident type fills - shades only, no primary hues */
  --fill-health: rgba(185, 28, 48, 0.16);
  /* crimson-rose     */
  --fill-infrastructure: rgba(146, 92, 12, 0.14);
  /* amber-ochre      */
  --fill-mobility: rgba(55, 65, 160, 0.12);
  /* slate-indigo     */
  --fill-safety: rgba(20, 108, 100, 0.12);
  /* teal-cyan        */
  --fill-weather: rgba(96, 50, 168, 0.12);
  /* violet-mauve     */
  --fill-emergency: rgba(168, 22, 38, 0.20);
  /* deep-scarlet     */

  /* Incident type border colours */
  --border-health: rgba(185, 28, 48, 0.52);
  --border-infrastructure: rgba(146, 92, 12, 0.44);
  --border-mobility: rgba(55, 65, 160, 0.38);
  --border-safety: rgba(20, 108, 100, 0.36);
  --border-weather: rgba(96, 50, 168, 0.38);
  --border-emergency: rgba(168, 22, 38, 0.56);

  /* Incident type solid hues (for text/badges - muted shades) */
  --hue-health: #B91C30;
  /* crimson-rose     */
  --hue-infrastructure: #925C0C;
  /* amber-ochre      */
  --hue-mobility: #3741A0;
  /* slate-indigo     */
  --hue-safety: #146C64;
  /* teal-cyan        */
  --hue-weather: #603294;
  /* violet-mauve     */
  --hue-emergency: #A81626;
  /* deep-scarlet     */

  /* ── Structural dimension tokens - override in breakpoints to scale layout ── */
  --bar-h: 56px;       /* top bar height */
  --floor-h: 88px;     /* time axis height */
  --tl-w: clamp(260px, 22vw, 340px);   /* timeline panel width */
  --ai-w: clamp(320px, 27vw, 420px);   /* AI panel width */
  --tap-min: 50px;     /* minimum touch target size */
}

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

html,
body {
  width: 100%;
  height: 100vh;
  overflow: hidden;
  background: var(--map-base);
  font-family: var(--font-data);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: var(--font-data);
  cursor: pointer;
  background: none;
  border: none;
  outline: none;
}

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

/* ═══════════════════════════════════════════════════════════════════
   SECTION 02 - LAYOUT ARCHITECTURE
   (Exact CSS model. Do not deviate from these rules.)
═══════════════════════════════════════════════════════════════════ */

/* TOP BAR */
#topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: var(--bar-h);
  z-index: 50;
  background: rgba(13, 17, 23, 0.95);
  display: flex;
  align-items: center;
  padding: 0 18px;
  gap: 12px;
}

/* MAP CONTAINER - NEVER RESIZES */
#map {
  position: absolute;
  top: var(--bar-h);
  left: 0;
  right: 0;
  bottom: var(--floor-h);
  width: 100vw;
  z-index: 10;
  /* Trap Leaflet's internal z-indexes (400+) */
}

/* Leaflet tile desaturation */
#map .leaflet-tile-pane {
  filter: grayscale(100%) brightness(105%) contrast(88%);
}

/* LEFT TIMELINE - OVERLAY */
#timeline-panel {
  position: absolute;
  top: var(--bar-h);
  left: 0;
  bottom: var(--floor-h);
  width: var(--tl-w);
  z-index: 20;
  background: var(--white);
  border-right: 1.5px solid rgba(0, 0, 0, 0.1);
  transform: translateX(0);
  transition: transform 200ms ease-out;
  display: flex;
  flex-direction: column;
  overflow: visible;
  /* must stay visible so side-tab can protrude */
}

/* Clip overflow only on inner scroll/header, not panel itself */
#tl-header,
#tl-scroll {
  overflow: hidden;
}

#timeline-panel.hidden {
  transform: translateX(-100%);
}

/* ── Side toggle tab (shared) ────────────────────────────────── */
.panel-side-tab {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 74px;
  background: var(--white);
  border: 1.5px solid rgba(0, 0, 0, 0.12);
  border-radius: 0 6px 6px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 24px;
  color: var(--ink-ghost);
  transition: color 150ms, background 150ms, left 200ms ease-out, right 200ms ease-out;
  z-index: 50;
  padding: 0;
  box-shadow: 2px 0 6px rgba(0, 0, 0, 0.08);
  line-height: 1;
}

.panel-side-tab:hover {
  color: var(--ink);
  background: var(--bg-2);
}

/* Timeline tab logic */
#timeline-panel~#tl-tab {
  left: var(--tl-w);
  border-left: none;
}

#timeline-panel.hidden~#tl-tab {
  left: 0;
}

/* AI tab logic */
#ai-panel~#ai-tab {
  right: 0;
  border-right: none;
  border-radius: 6px 0 0 6px;
  box-shadow: -2px 0 6px rgba(0, 0, 0, 0.08);
}

#ai-panel.open~#ai-tab {
  right: var(--ai-w);
}

/* RIGHT AI PANEL - OVERLAY */
#ai-panel {
  position: absolute;
  top: var(--bar-h);
  right: 0;
  bottom: var(--floor-h);
  width: var(--ai-w);
  z-index: 30;
  background: var(--white);
  border-left: 2px solid var(--primary);
  transform: translateX(100%);
  transition: transform 200ms ease-out;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#ai-panel.open {
  transform: translateX(0);
}

/* TIME AXIS - ALWAYS VISIBLE */
#time-axis {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--floor-h);
  z-index: 25;
  background: rgba(13, 17, 23, 0.92);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: stretch;
}

/* HIERARCHY SELECTOR - FULL-SCREEN OVERLAY */
#hierarchy-selector {
  position: absolute;
  inset: 0;
  z-index: 100;
  background: rgba(13, 17, 23, 0.96);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 150ms;
}

#hierarchy-selector.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  display: flex !important;
  /* override global .hidden */
}

#hierarchy-selector.fading {
  opacity: 0;
  pointer-events: none;
}

/* ═══════════════════════════════════════════════════════════════════
   SECTION 04 - TOP BAR COMPONENTS
═══════════════════════════════════════════════════════════════════ */

#tb-logo {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 12px;
  color: #FFFFFF;
  flex-shrink: 0;
  letter-spacing: 0.2px;
  display: inline-flex;
  align-items: center;
  white-space: pre;
}

#tb-logo .tb-logo-char {
  display: inline-block;
  transform: translate3d(0, 0, 0);
}

#tb-logo.od-logo-fx .tb-logo-char {
  will-change: transform, opacity, filter;
  animation: od-logo-disintegrate-reform 1320ms cubic-bezier(0.2, 0.65, 0.2, 1) both;
  animation-delay: calc(var(--od-char-index, 0) * 24ms);
}

@keyframes od-logo-disintegrate-reform {
  0% {
    opacity: 1;
    filter: blur(0);
    transform: translate3d(0, 0, 0) scale(1) rotate(0deg);
  }
  36% {
    opacity: 0;
    filter: blur(2px);
    transform: translate3d(var(--od-x, 0px), var(--od-y, 0px), 0) scale(0.88) rotate(var(--od-r, 0deg));
  }
  62% {
    opacity: 0;
    filter: blur(1.6px);
    transform: translate3d(calc(var(--od-x, 0px) * -0.35), calc(var(--od-y, 0px) * -0.35), 0) scale(0.93) rotate(calc(var(--od-r, 0deg) * -0.28));
  }
  100% {
    opacity: 1;
    filter: blur(0);
    transform: translate3d(0, 0, 0) scale(1) rotate(0deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  #tb-logo.od-logo-fx .tb-logo-char {
    animation: none;
  }
}

.tb-sep {
  width: 1px;
  height: 16px;
  background: rgba(255, 255, 255, 0.12);
  flex-shrink: 0;
}

#tb-district-label {
  flex-shrink: 0;
}

.tb-district-meta {
  font-size: 9px;
  font-weight: 500;
  color: var(--ink-ghost);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  line-height: 1;
}

.tb-district-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  color: #FFFFFF;
  line-height: 1.2;
}

.tb-spacer {
  flex: 1;
}

/* Generic top bar button */
.tb-btn {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: rgba(255, 255, 255, 0.75);
  padding: 0 14px;
  min-height: var(--tap-min);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 2px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: border-color 150ms, color 150ms;
}

.tb-btn:hover {
  border-color: rgba(255, 255, 255, 0.44);
  color: #fff;
}

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

.tb-btn.primary:hover {
  background: #1a60d4;
  border-color: #1a60d4;
}

/* Language selector (Infinite Swipe Pill) */
#tb-lang {
  width: calc(var(--tap-min) + 2px);
  height: calc(var(--tap-min) + 2px);
  background-color: transparent;
  border-radius: 999px;
  position: relative;
  overflow: hidden;
  transition: width 0.4s cubic-bezier(0.25, 1, 0.5, 1), background-color 0.4s;
  cursor: pointer;
  touch-action: pan-y;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

#tb-lang:hover {
  border-color: rgba(255, 255, 255, 0.44);
}

#tb-lang.expanded {
  width: 320px;
  /* Expands to the left because of tb-spacer */
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.10), rgba(255, 255, 255, 0.06));
  /* Dark background when open */
  border-color: rgba(111, 168, 255, 0.35);
  box-shadow: 0 0 0 1px rgba(31, 111, 235, 0.25), 0 8px 22px rgba(6, 18, 38, 0.45);
}

#tb-lang::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(110deg,
      transparent 0%,
      rgba(255, 255, 255, 0.14) 40%,
      rgba(31, 111, 235, 0.22) 50%,
      rgba(255, 255, 255, 0.14) 60%,
      transparent 100%);
}

#tb-lang.expanded::before {
  opacity: 1;
  animation: lang-sheen 3.6s linear infinite;
}

.lang-track {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 0;
}

.lang-item {
  position: absolute;
  top: 0;
  left: calc(-1 * var(--tap-min) / 2);
  /* Half of its own width */
  width: var(--tap-min);
  height: var(--tap-min);
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--ink-ghost);
  font-size: 14px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  opacity: 0;
  /* Hidden by default when not expanded */
  transition: opacity 0.25s, font-size 0.25s, color 0.25s, filter 0.25s;
  will-change: transform;
  pointer-events: none;
  filter: blur(0.2px);
}

#tb-lang.expanded .lang-item {
  opacity: 0.5;
  filter: blur(0);
}

#tb-lang .lang-item.active {
  opacity: 1;
  color: #fff;
}

#tb-lang.expanded .lang-item.active {
  color: var(--primary);
  font-size: 16px;
  font-weight: 700;
  text-shadow: 0 0 12px rgba(31, 111, 235, 0.45);
  animation: lang-active-pulse 1.9s ease-in-out infinite;
}

.lang-focus-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid transparent;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s, border-color 0.3s;
}

#tb-lang.expanded .lang-focus-ring {
  border-color: var(--primary);
  opacity: 1;
  animation: lang-ring-pulse 2.6s ease-in-out infinite;
}

@keyframes lang-sheen {
  0% {
    transform: translateX(-85%);
  }

  55% {
    transform: translateX(95%);
  }

  100% {
    transform: translateX(95%);
  }
}

@keyframes lang-active-pulse {
  0%,
  100% {
    text-shadow: 0 0 10px rgba(31, 111, 235, 0.38);
    opacity: 1;
  }

  50% {
    text-shadow: 0 0 16px rgba(31, 111, 235, 0.62);
    opacity: 0.95;
  }
}

@keyframes lang-ring-pulse {
  0%,
  100% {
    opacity: 1;
    box-shadow: 0 0 0 0 rgba(31, 111, 235, 0.22);
  }

  50% {
    opacity: 0.92;
    box-shadow: 0 0 0 8px rgba(31, 111, 235, 0.0);
  }
}

/* Mode toggle */
#tb-mode {
  display: flex;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 2px;
  overflow: hidden;
}

.mode-pill {
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--ink-ghost);
  padding: 0 14px;
  min-height: var(--tap-min);
  border-radius: 0;
  transition: all 120ms;
}

.mode-pill.active {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.mode-pill:hover:not(.active) {
  color: rgba(255, 255, 255, 0.6);
}

/* Sync dot */
#sync-dot-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

#sync-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ok);
  animation: dot-pulse 2.5s ease-in-out infinite;
  /* 0.4 Hz - compliant */
}

#sync-dot.historical {
  background: var(--ink-ghost);
  animation: none;
}

#sync-label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--ok);
}

#sync-label.historical {
  color: var(--ink-ghost);
}

@keyframes dot-pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.3;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   SECTION 05 - LEFT TIMELINE PANEL
═══════════════════════════════════════════════════════════════════ */

/* Panel header - height matches topbar */
#tl-header {
  height: var(--bar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px 0 16px;
  border-bottom: 1px solid var(--rule);
  flex-shrink: 0;
}

.tl-header-meta {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--ink-ghost);
  line-height: 1;
}

.tl-header-district {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 21px;
  color: var(--ink);
  line-height: 1.2;
}

/* Collapse chevron button */
.tl-collapse-btn {
  width: 24px;
  height: var(--tap-min);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--ink-ghost);
  border: 1px solid var(--rule);
  border-radius: 2px;
  flex-shrink: 0;
  transition: color 150ms, border-color 150ms;
  line-height: 1;
}

.tl-collapse-btn:hover {
  color: var(--ink);
  border-color: var(--ink-mid);
}



/* Scroll area */
#tl-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0;
  scrollbar-width: thin;
  scrollbar-color: var(--rule) transparent;
}

/* ── SPINE ── */
.tl-spine {
  position: relative;
  padding: 0 10px 0 28px;
  /* left offset creates space for spine + node */
}

.tl-spine::before {
  /* THE SPINE LINE */
  content: "";
  position: absolute;
  left: 14px;
  top: 0;
  bottom: 0;
  width: 2px;
  /* MINIMUM 2px */
  background: var(--rule);
}

/* ── CARD ── */
.tl-card {
  position: relative;
  margin-bottom: 24px;
  cursor: pointer;
  transition: opacity 150ms;
}

/* NODE DOT - ON THE SPINE */
.tl-card::before {
  content: "";
  position: absolute;
  left: -20px;
  top: 18px;
  width: 13px;
  height: 13px;
  /* MINIMUM 10px */
  border-radius: 50%;
  background: var(--white);
  border: 2px solid var(--rule);
  z-index: 2;
}

.tl-card.cat-health::before {
  border-color: var(--hue-health);
}

.tl-card.cat-infrastructure::before {
  border-color: var(--hue-infrastructure);
}

.tl-card.cat-mobility::before {
  border-color: var(--hue-mobility);
}

.tl-card.cat-safety::before {
  border-color: var(--hue-safety);
}

.tl-card.cat-weather::before {
  border-color: var(--hue-weather);
}

.tl-card.cat-emergency::before {
  border-color: var(--hue-emergency);
}

/* STRING CONNECTOR between nodes */
.tl-card::after {
  content: "";
  position: absolute;
  left: -16px;
  top: 24px;
  bottom: -16px;
  width: 1.5px;
  background: var(--rule-faint);
  z-index: 1;
}

.tl-card:last-child::after {
  display: none;
}

/* CARD INNER - FLAT, NOT ELEVATED */
.tl-card-inner {
  position: relative;
  border: 1.5px solid var(--rule);
  border-radius: 2px;
  /* MAXIMUM 2px */
  background: var(--white);
  overflow: hidden;
  /* NO box-shadow. Cards are flat. */
}

/* LEFT SEVERITY BAND - 3px full height */
.tl-card-inner::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
}

.tl-card.cat-health .tl-card-inner::before {
  background: var(--hue-health);
}

.tl-card.cat-infrastructure .tl-card-inner::before {
  background: var(--hue-infrastructure);
}

.tl-card.cat-mobility .tl-card-inner::before {
  background: var(--hue-mobility);
}

.tl-card.cat-safety .tl-card-inner::before {
  background: var(--hue-safety);
}

.tl-card.cat-weather .tl-card-inner::before {
  background: var(--hue-weather);
}

.tl-card.cat-emergency .tl-card-inner::before {
  background: var(--hue-emergency);
}

/* FOCUS STATE */
.tl-card.focused .tl-card-inner {
  border-color: var(--ink);
  /* Still NO box-shadow. Border darkens. */
}

.tl-card.dimmed {
  opacity: 0.32;
  pointer-events: none;
}

/* CARD HEAD */
.tl-card-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 13px 10px 14px;
  /* left 12 to clear severity band */
}

/* SVG thumbnail */
.tl-thumb {
  width: 40px;
  height: 32px;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 1px;
}

.tl-thumb svg {
  width: 100%;
  height: 100%;
}

.tl-meta {
  flex: 1;
  min-width: 0;
}

.tl-loc-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.tl-time {
  font-size: 12px;
  font-weight: 400;
  text-transform: uppercase;
  color: var(--ink-ghost);
  letter-spacing: 0.4px;
  margin-top: 1px;
}

/* Event summary */
.tl-summary {
  font-size: 14px;
  font-weight: 300;
  color: var(--ink-sub);
  line-height: 1.55;
  padding: 0 12px 0 14px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tl-summary-wrap {
  padding-bottom: 12px;
}

.tl-view-more {
  display: none;
  font-size: 12px;
  font-weight: 500;
  color: var(--primary);
  padding: 6px 12px 0 14px;
  letter-spacing: 0.2px;
}

.tl-card.has-overflow:not(.focused) .tl-view-more {
  display: block;
}

.tl-card.focused .tl-summary {
  display: block;
  -webkit-line-clamp: unset;
  line-clamp: unset;
  overflow: visible;
}

/* Details section - hidden until focused */
.tl-details {
  display: none;
  background: var(--bg);
  border-top: 1px solid var(--rule-faint);
  padding: 10px 12px 10px 14px;
}

/* Time Machine States */
.tl-card.tl-hidden {
  display: none !important;
}

.tl-card.tl-historical-dim {
  opacity: 0.4;
  filter: grayscale(1);
  transition: opacity 150ms, filter 150ms;
}

.tl-card.tl-historical-dim:hover {
  opacity: 0.7;
  filter: grayscale(0.5);
}

.tl-card.tl-current {
  opacity: 1;
  filter: none;
  box-shadow: -2px 0 0 var(--primary);
  /* Highlight current ones slightly */
}

.tl-card.focused .tl-details {
  display: block;
}

.tl-detail-row {
  display: flex;
  gap: 8px;
  margin-bottom: 4px;
  align-items: baseline;
}

.tl-detail-label {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  color: var(--ink-ghost);
  letter-spacing: 0.8px;
  width: 52px;
  flex-shrink: 0;
}

.tl-detail-value {
  font-size: 11px;
  font-weight: 400;
  color: var(--ink-mid);
  flex: 1;
}

/* Source verification tag */
.tl-source-tag {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
  font-size: 10px;
  font-weight: 400;
  color: var(--ok);
}

/* ── Phase 2 additions ───────────────────────────────────────── */

/* Event title row - between card-head and summary */
.tl-title-row {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  color: var(--ink);
  padding: 0 13px 6px 14px;
  line-height: 1.3;
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: normal;
  overflow: visible;
}

/* Incident type pill badge in card head (top-right) */
.tl-type-pill {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 3px 7px;
  border-radius: 1px;
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 1px;
}

.cat-pill-health {
  background: rgba(185, 28, 48, 0.12);
  color: var(--hue-health);
}

.cat-pill-infrastructure {
  background: rgba(146, 92, 12, 0.12);
  color: var(--hue-infrastructure);
}

.cat-pill-mobility {
  background: rgba(55, 65, 160, 0.12);
  color: var(--hue-mobility);
}

.cat-pill-safety {
  background: rgba(20, 108, 100, 0.10);
  color: var(--hue-safety);
}

.cat-pill-weather {
  background: rgba(96, 50, 168, 0.12);
  color: var(--hue-weather);
}

.cat-pill-emergency {
  background: rgba(168, 22, 38, 0.14);
  color: var(--hue-emergency);
}

/* Empty timeline state */
.tl-empty-state {
  padding: 24px 12px;
  font-size: 12px;
  font-weight: 400;
  color: var(--ink-ghost);
  text-align: center;
  line-height: 1.6;
}

/* AI context badge (event-bound vs general indicator) */
.ai-context-badge {
  display: inline-block;
  font-size: 7px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 2px 6px;
  border-radius: 1px;
  margin-top: 4px;
}

.ai-context-badge.event {
  background: rgba(207, 34, 46, 0.12);
  color: var(--danger);
}

.ai-context-badge.general {
  background: rgba(31, 111, 235, 0.08);
  color: var(--primary);
}

.tl-source-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════════
   SECTION 06 - MAP ELEMENTS
═══════════════════════════════════════════════════════════════════ */

/* Custom zoom controls */
#map-zoom-controls {
  position: absolute;
  right: 24px;
  bottom: calc(var(--floor-h) + 14px);
  /* above time axis */
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 1000;
}

.zoom-btn {
  width: 78px;
  height: 78px;
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: 12px;
  font-size: 44px;
  font-weight: 300;
  color: var(--ink-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 120ms, color 120ms;
  line-height: 1;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.zoom-btn:hover {
  border-color: var(--ink-mid);
  color: var(--ink);
}

.zoom-btn:active {
  transform: scale(0.95);
}

/* Environmental overlays - Only when env-active class is present
   env-active requires: mode=live AND connectionStatus=live AND !isHistorical */
.env-rain,
.env-haze {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 600ms;
}

/* Advanced effects canvas (rendered by effects-controller) */
.advanced-effects-host {
  contain: layout paint;
  overflow: hidden;
}

.advanced-effects-canvas {
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0.92;
}

.advanced-effects-debug-badge {
  position: absolute;
  top: 54px;
  left: 14px;
  z-index: 710;
  padding: 6px 8px;
  border-radius: 6px;
  font-family: "DM Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.02em;
  color: rgba(220, 248, 236, 0.96);
  background: rgba(7, 24, 19, 0.78);
  border: 1px solid rgba(99, 214, 167, 0.34);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

#map.live-mode.fx-backend-pixi .od-event-marker-host {
  display: none !important;
}

.advanced-effects-tooltip {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 720;
  min-width: 180px;
  max-width: 280px;
  padding: 8px 10px;
  border-radius: 10px;
  pointer-events: none;
  font-family: "DM Mono", monospace;
  font-size: 11px;
  line-height: 1.35;
  color: rgba(232, 245, 235, 0.95);
  background: rgba(8, 22, 16, 0.88);
  border: 1px solid rgba(106, 224, 178, 0.38);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  transform: translate(-9999px, -9999px);
}

.advanced-effects-tooltip .fx-tip-title {
  font-weight: 600;
  color: rgba(233, 255, 244, 0.98);
}

.advanced-effects-tooltip .fx-tip-meta {
  margin-top: 2px;
  opacity: 0.85;
}

.advanced-effects-tooltip .fx-tip-summary {
  margin-top: 6px;
  opacity: 0.9;
}

.advanced-effects-tooltip .fx-tip-pin {
  margin-left: 6px;
  padding: 1px 5px;
  border-radius: 9px;
  font-size: 10px;
  color: rgba(214, 252, 227, 0.95);
  background: rgba(34, 141, 102, 0.45);
  border: 1px solid rgba(95, 220, 169, 0.4);
}

/* Soft fallback diffusion styling for non-PIXI paths */
.leaflet-interactive.od-soft-diffusion {
  filter: blur(8px);
}

.leaflet-interactive.od-soft-diffusion-edge {
  filter: blur(8px);
}

.env-scanner {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 600ms;
  z-index: 2;
  mix-blend-mode: screen;
}

#map.env-active .env-scanner {
  opacity: 1;
  background: conic-gradient(from 0deg at 50% 50%, transparent 0deg, transparent 270deg, rgba(31, 111, 235, 0.05) 350deg, rgba(31, 111, 235, 0.25) 360deg);
  animation: radar-sweep 8s linear infinite;
}

@keyframes radar-sweep {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

#map.env-active .env-rain {
  opacity: 1;
  background: repeating-linear-gradient(175deg,
      transparent 0px, transparent 6px,
      rgba(130, 170, 210, 0.28) 6px, rgba(130, 170, 210, 0.28) 7.5px);
  animation: rain-fall 0.8s linear infinite;
  /* 1.25 Hz - compliant */
  z-index: 4;
}

@keyframes rain-fall {
  0% {
    background-position: 0 0;
  }

  100% {
    background-position: 0 20px;
  }
}

#map.env-active .env-haze {
  opacity: 1;
  /* Simplified for performance */
  background: radial-gradient(ellipse 80% 60% at 50% 50%,
      rgba(190, 170, 110, 0.15) 0%, transparent 70%);
  animation: haze-shift 5s ease-in-out infinite alternate;
  /* 0.1 Hz - compliant */
  z-index: 3;
  will-change: opacity;
}

@keyframes haze-shift {
  0% {
    opacity: 0.6;
  }

  100% {
    opacity: 1;
  }
}

/* ── Incident-type kinetic animations (NO BREATHING) ──────────────────────────── */

/* Kinetic flow for boundaries */
@keyframes kinetic-flow {
  0% {
    stroke-dashoffset: 48;
  }

  100% {
    stroke-dashoffset: 0;
  }
}

/* Digital blip for markers */
@keyframes digital-blip {
  0% {
    transform: scale(0.6);
    stroke-opacity: 1;
    fill-opacity: 0.8;
  }

  30% {
    transform: scale(1.6);
    stroke-opacity: 0;
    fill-opacity: 0;
  }

  100% {
    transform: scale(0.6);
    stroke-opacity: 0;
    fill-opacity: 0;
  }
}

/* Base states */
.leaflet-interactive.cat-health-path,
.leaflet-interactive.cat-emergency-path,
.leaflet-interactive.cat-infrastructure-path,
.leaflet-interactive.cat-mobility-path {
  animation-play-state: paused;
}

/* Soft edge glow for area overlays */
#map .leaflet-interactive.polygon-path.cat-health-path {
  filter: drop-shadow(0 0 8px rgba(185, 28, 48, 0.25));
}

#map .leaflet-interactive.polygon-path.cat-emergency-path {
  filter: drop-shadow(0 0 8px rgba(168, 22, 38, 0.25));
}

#map .leaflet-interactive.polygon-path.cat-infrastructure-path {
  filter: drop-shadow(0 0 8px rgba(146, 92, 12, 0.25));
}

#map .leaflet-interactive.polygon-path.cat-mobility-path {
  filter: drop-shadow(0 0 8px rgba(55, 65, 160, 0.25));
}

#map .leaflet-interactive.polygon-path.cat-safety-path {
  filter: drop-shadow(0 0 8px rgba(20, 108, 100, 0.25));
}

#map .leaflet-interactive.polygon-path.cat-weather-path {
  filter: drop-shadow(0 0 8px rgba(96, 50, 148, 0.25));
}

/* If it is a polygon (we add polygon-path class in JS) */
#map.live-mode .leaflet-interactive.polygon-path.cat-health-path,
#map.live-mode .leaflet-interactive.polygon-path.cat-emergency-path {
  stroke-dasharray: 8 16;
  animation: kinetic-flow 0.8s linear infinite;
  animation-play-state: running;
}

#map.live-mode .leaflet-interactive.polygon-path.cat-infrastructure-path,
#map.live-mode .leaflet-interactive.polygon-path.cat-mobility-path {
  stroke-dasharray: 4 20;
  animation: kinetic-flow 1.2s linear infinite;
  animation-play-state: running;
}

/* If it is a marker (we add marker-path class in JS) */
#map.live-mode .leaflet-interactive.marker-path.cat-health-path,
#map.live-mode .leaflet-interactive.marker-path.cat-emergency-path {
  animation: digital-blip 1s cubic-bezier(0.1, 0.9, 0.2, 1) infinite;
  animation-play-state: running;
}

#map.live-mode .leaflet-interactive.marker-path.cat-infrastructure-path,
#map.live-mode .leaflet-interactive.marker-path.cat-mobility-path,
#map.live-mode .leaflet-interactive.marker-path.cat-safety-path,
#map.live-mode .leaflet-interactive.marker-path.cat-weather-path {
  animation: digital-blip 2s cubic-bezier(0.1, 0.9, 0.2, 1) infinite;
  animation-play-state: running;
}

/* Marker component (used by geo-service buildMarkerIconHtml) */
.od-marker {
  position: relative;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  transform: translateZ(0);
}

.od-marker-shell {
  position: relative;
  z-index: 3;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 30% 24%,
      rgba(255, 255, 255, 0.28) 0%,
      rgba(var(--od-r), var(--od-g), var(--od-b), 0.18) 48%,
      rgba(var(--od-r), var(--od-g), var(--od-b), 0.08) 100%);
  border: 1.4px solid rgba(var(--od-r), var(--od-g), var(--od-b), 0.62);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.28),
    0 0 0 1px rgba(255, 255, 255, 0.05) inset;
}

.od-marker-glow {
  position: absolute;
  inset: 5px;
  z-index: 1;
  border-radius: 50%;
  background: radial-gradient(circle,
      rgba(var(--od-r), var(--od-g), var(--od-b), 0.36) 0%,
      rgba(var(--od-r), var(--od-g), var(--od-b), 0) 70%);
  opacity: 0.55;
}

.od-marker-ring {
  position: absolute;
  inset: 4px;
  z-index: 2;
  border-radius: 50%;
  border: 1.3px solid rgba(var(--od-r), var(--od-g), var(--od-b), 0.56);
  opacity: 0;
}

.od-marker.is-dimmed {
  opacity: 0.36;
  filter: saturate(0.5);
}

.od-marker.is-dimmed .od-marker-glow,
.od-marker.is-dimmed .od-marker-ring {
  display: none;
}

@keyframes od-marker-wave {
  0% {
    transform: scale(0.86);
    opacity: 0;
  }

  16% {
    opacity: 0.72;
  }

  100% {
    transform: scale(1.8);
    opacity: 0;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   SECTION 09 - RIGHT AI PANEL
═══════════════════════════════════════════════════════════════════ */

/* Collapse sliver */
#ai-sliver {
  position: absolute;
  left: -24px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 48px;
  background: var(--white);
  border: 1px solid var(--rule);
  border-right: none;
  border-radius: 4px 0 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--ink-ghost);
  cursor: pointer;
  transition: color 120ms;
  z-index: 1;
}

#ai-sliver:hover {
  color: var(--ink);
}

/* Panel header */
#ai-header {
  height: var(--bar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  border-bottom: 1px solid var(--rule);
  flex-shrink: 0;
}

#ai-header-left {
  display: flex;
  align-items: center;
  gap: 7px;
}

#ai-active-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--primary);
  animation: dot-pulse 2.0s ease-in-out infinite;
  /* 0.5 Hz - compliant */
}

#ai-header-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  color: var(--ink);
}

.ai-close-btn {
  width: 40px;
  height: 40px;
  border: 1px solid var(--rule);
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--ink-ghost);
  transition: color 120ms, border-color 120ms;
}

.ai-close-btn:hover {
  color: var(--ink);
  border-color: var(--ink-mid);
}

/* Context bar */
#ai-context-bar {
  padding: 10px 14px;
  border-bottom: 1px solid var(--rule-faint);
  flex-shrink: 0;
}

#ai-context-bar.general {
  background: var(--bg);
}

#ai-context-bar.event-bound {
  background: rgba(207, 34, 46, 0.06);
  border: 1px solid rgba(207, 34, 46, 0.22);
}

#ai-context-text {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--ink-ghost);
}

#ai-context-bar.event-bound #ai-context-text {
  color: var(--danger);
}

/* Intent section */
#ai-intent-section {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  scrollbar-width: thin;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ai-section-label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--ink-ghost);
  margin-bottom: 4px;
}

.ai-intents {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ai-intents.hidden {
  display: none;
}

/* Intent card */
.intent-card {
  width: 100%;
  text-align: left;
  padding: 14px;
  min-height: var(--tap-min);
  border: 1.5px solid var(--rule);
  border-radius: 2px;
  background: var(--white);
  transition: border-color 120ms;
}

.intent-card:hover {
  border-color: var(--primary);
}

.intent-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  color: var(--ink);
  line-height: 1.3;
}

.intent-sub {
  font-size: 14px;
  font-weight: 300;
  color: var(--ink-ghost);
  margin-top: 2px;
  line-height: 1.4;
}

/* Result area */
#ai-result {
  border-top: 1px solid var(--rule-faint);
  padding: 12px 14px;
  flex-shrink: 0;
}

#ai-result.hidden {
  display: none;
}

#ai-result-source {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 6px;
}

.result-verified-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  flex-shrink: 0;
}

#ai-result-source-text {
  font-size: 11px;
  font-weight: 500;
  color: var(--ok);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

#ai-result-body {
  font-size: 15px;
  font-weight: 400;
  color: var(--ink-mid);
  line-height: 1.7;
}

/* ═══════════════════════════════════════════════════════════════════
   SECTION 07 - TIME AXIS
═══════════════════════════════════════════════════════════════════ */

/* Left controls zone: 100px */
#ta-controls {
  width: 196px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  /* Reduced gap slightly to fit 3 buttons nicely */
  padding: 0 10px;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.ta-ctrl-btn {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.55);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 4px;
  transition: color 120ms, border-color 120ms;
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--tap-min);
  min-width: var(--tap-min);
}

.ta-ctrl-btn:hover {
  color: rgba(255, 255, 255, 0.9);
  border-color: rgba(255, 255, 255, 0.35);
}

.ta-ctrl-btn.playing {
  color: #fff;
  border-color: var(--primary);
}

.ta-ctrl-btn svg {
  width: 15px;
  height: 15px;
}

/* Main timeline area: fills remaining width */
#ta-main {
  flex: 1;
  position: relative;
  /* overflow: hidden; Removed to allow labels to breathe */
  display: flex;
  flex-direction: column;
  padding: 4px 14px 10px;
  box-sizing: border-box;
}

/* Ruler layer: 32px */
#ta-ruler {
  height: 44px;
  position: relative;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  /* overflow: hidden; Removed to allow labels to breathe */
}

/* Density ribbon: 32px */
#ta-ribbon {
  height: 50px;
  position: relative;
  display: flex;
}

/* Segments are injected as <div class="ribbon-seg"> by JS */
.ribbon-seg {
  height: 100%;
  flex-shrink: 0;
  transition: background-color 300ms;
}

/* Playhead */
#ta-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  pointer-events: none;
  z-index: 10;
}

#ta-playhead-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 2px;
  background: #FFFFFF;
}

#ta-playhead-handle {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 38px;
  background: #FFFFFF;
  border-radius: 6px;
  cursor: grab;
  pointer-events: auto;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  transition: transform 100ms, box-shadow 180ms;
}

#ta-playhead-handle:hover {
  transform: translateX(-50%) scale(1.1);
}

#ta-playhead-handle:active {
  cursor: grabbing;
  transform: translateX(-50%) scale(0.95);
}

#ta-playhead-handle.idle-pulse {
  animation: ta-handle-idle-pulse 1.1s ease-out 1;
}

@keyframes ta-handle-idle-pulse {
  0% {
    transform: translateX(-50%) scale(1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  }

  35% {
    transform: translateX(-50%) scale(1.08);
    box-shadow: 0 0 0 10px rgba(255, 255, 255, 0.18), 0 3px 10px rgba(0, 0, 0, 0.45);
  }

  100% {
    transform: translateX(-50%) scale(1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  }
}

/* Post-playhead overlay (historical mode) */
#ta-ribbon::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 0;
  /* set by JS */
  background: rgba(0, 0, 0, 0.45);
  pointer-events: none;
  transition: width 150ms;
}

/* Tick marks in ruler */
.ta-tick-major {
  position: absolute;
  bottom: 0;
  width: 1px;
  height: 20px;
  background: rgba(255, 255, 255, 0.25);
}

.ta-tick-minor {
  position: absolute;
  bottom: 0;
  width: 1px;
  height: 8px;
  background: rgba(255, 255, 255, 0.10);
}

.ta-tick-label {
  position: absolute;
  bottom: 3px;
  /* Lifted slightly to fit 2 lines if needed */
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  pointer-events: none;
}

.ta-date {
  font-size: 11px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.7);
  white-space: nowrap;
  letter-spacing: 0.3px;
}

.ta-time {
  font-size: 10px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.4);
  white-space: nowrap;
}



/* ═══════════════════════════════════════════════════════════════════
   SECTION 10 - HIERARCHY SELECTOR
═══════════════════════════════════════════════════════════════════ */

/* Hide side tabs when hierarchy selector is open */
#hierarchy-selector:not(.hidden)~.panel-side-tab {
  display: none !important;
}

#hierarchy-selector {
  background: #0b0f18;
  z-index: 500;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
}

#hierarchy-selector.hidden {
  display: none !important;
}

#hs-inner {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  display: flex;
  flex-direction: column;
  overflow: visible;
  padding: 0;
}

/* Tier 1 header */
#hs-header {
  position: absolute;
  top: 20px;
  left: 20px;
  right: 20px;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0;
  pointer-events: none;
}

#hs-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 24px;
  color: #FFFFFF;
  letter-spacing: 0.3px;
  pointer-events: auto;
}

.hs-close-btn {
  width: var(--tap-min);
  height: var(--tap-min);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: rgba(255, 255, 255, 0.6);
  transition: color 120ms;
  pointer-events: auto;
  background: rgba(10, 14, 23, 0.75);
}

.hs-close-btn:hover {
  color: #fff;
}

/* Search input */
#hs-search-wrap {
  margin-bottom: 16px;
}

#hs-search {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 2px;
  min-height: var(--tap-min);
  padding: 12px 14px;
  font-family: var(--font-data);
  font-size: 16px;
  color: #FFFFFF;
  outline: none;
}

#hs-search::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

#hs-search:focus {
  border-color: var(--primary);
}

/* Tier 1 Body: split map and search/stats */
#hs-tier1-body {
  display: block;
  height: 100vh;
}

/* Left: Map Container */
#hs-india-map {
  position: relative;
  width: 100%;
  height: 100%;
  background: #0b0f18;
  border: none;
  border-radius: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

#hs-india-svg {
  width: 100%;
  height: 100%;
}

/* Right: Panel (Search + Stats) */
#hs-right-panel {
  position: absolute;
  top: 84px;
  right: 20px;
  width: clamp(320px, 28vw, 460px);
  max-height: calc(100% - 104px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: rgba(10, 14, 23, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 4px;
  overflow: auto;
  z-index: 3;
  transition: transform 160ms ease, opacity 160ms ease;
}

#hs-right-panel.collapsed {
  transform: translateX(calc(100% + 14px));
  opacity: 0;
  pointer-events: none;
}

#hs-popup-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

#hs-popup-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}

.hs-popup-close-btn {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 2px;
  color: rgba(255, 255, 255, 0.65);
}

.hs-popup-open-btn {
  position: absolute;
  top: 86px;
  right: 20px;
  padding: 0 14px;
  min-height: var(--tap-min);
  font-family: var(--font-data);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(10, 14, 23, 0.84);
  border-radius: 2px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease;
  z-index: 4;
}

#hs-right-panel.collapsed ~ #hs-panel-open {
  opacity: 1;
  pointer-events: auto;
}

/* State Paths (Optimized for performance) */
.india-state-path {
  fill: rgba(255, 255, 255, 0.06);
  stroke: rgba(255, 255, 255, 0.2);
  stroke-width: 1;
  cursor: pointer;
  vector-effect: non-scaling-stroke;
  /* Intentionally no transition or filter to guarantee instantaneous 60fps hover on massive SVGs */
}

.india-state-path:not(.unsupported):hover,
.india-state-path.hovered {
  fill: rgba(31, 111, 235, 0.25);
  stroke: #1F6FEB;
  stroke-width: 1.5;
}

.india-state-path.selected {
  fill: rgba(31, 111, 235, 0.4);
  stroke: #1F6FEB;
  stroke-width: 2;
}

/* Search filtering states */
.india-state-path.search-dim {
  fill: rgba(255, 255, 255, 0.02);
  stroke: rgba(255, 255, 255, 0.05);
  pointer-events: none;
}

/* Search filtering districts (Tier 2) */
.hdist-poly.search-dim {
  fill: rgba(255, 255, 255, 0.01);
  stroke: rgba(255, 255, 255, 0.05);
  pointer-events: none;
}

.hdist-poly.search-match {
  fill: rgba(31, 111, 235, 0.22);
  stroke: #1F6FEB;
  stroke-width: 1.5;
}

.india-state-path.unsupported {
  fill: rgba(255, 255, 255, 0.02);
  stroke: rgba(255, 255, 255, 0.05);
  cursor: pointer;
}

.india-state-path.unsupported:hover {
  fill: rgba(255, 255, 255, 0.05);
  stroke: rgba(255, 255, 255, 0.1);
}

.india-state-path.search-match {
  fill: rgba(31, 111, 235, 0.3);
  stroke: #1F6FEB;
  stroke-width: 2;
  filter: drop-shadow(0 0 6px rgba(31, 111, 235, 0.5));
}

.state-label {
  fill: rgba(255, 255, 255, 0.5);
  font-family: var(--font-data);
  font-size: 18px;
  text-anchor: middle;
  pointer-events: none;
  transition: fill 150ms;
}

.state-label.active {
  fill: #fff;
  font-weight: bold;
}

/* State Stats Bar (appears below search) */
#hs-state-stats-bar {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 2px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transform: translateY(0);
  opacity: 1;
  transition: transform 250ms ease-out, opacity 250ms ease-out;
}

#hs-state-stats-bar.slide-out {
  transform: translateY(-10px);
  opacity: 0;
}

#hs-state-stats-bar.hidden {
  display: none;
}

#hs-state-stats-name {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 8px;
}

#hs-state-stats-action {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
}

.hs-enter-btn {
  background: var(--primary);
  color: #fff;
  border: none;
  min-height: var(--tap-min);
  padding: 0 18px;
  border-radius: 4px;
  font-family: var(--font-data);
  font-weight: 600;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  transition: background 150ms, transform 150ms;
}

.hs-enter-btn:hover {
  background: #2f81f7;
  transform: translateY(-1px);
}

.hs-enter-btn:active {
  background: #0969da;
  transform: translateY(0);
}

/* Tier 2 */
#hs-tier2,
#hs-tier1 {
  width: 100%;
  height: 100%;
}

#hs-tier2.hidden {
  display: none;
}

#hs-t2-header {
  position: absolute;
  top: 20px;
  left: 20px;
  right: 20px;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 0;
}

/* Tier 2 district search bar */
#hs-t2-search-wrap {
  position: absolute;
  top: 72px;
  left: 20px;
  width: min(620px, calc(100vw - 64px));
  right: auto;
  z-index: 4;
}

#hs-t2-search {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 2px;
  min-height: var(--tap-min);
  padding: 12px 14px;
  font-family: var(--font-data);
  font-size: 16px;
  color: #FFFFFF;
  outline: none;
  box-sizing: border-box;
}

#hs-t2-search::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

#hs-t2-search:focus {
  border-color: var(--primary);
}

.hs-back-btn {
  width: var(--tap-min);
  height: var(--tap-min);
  font-size: 22px;
  color: rgba(255, 255, 255, 0.6);
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 2px;
  transition: color 120ms;
}

.hs-back-btn:hover {
  color: #fff;
}

#hs-t2-state-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 24px;
  color: #fff;
  flex: 1;
}

#hs-t2-body {
  display: flex;
  gap: 16px;
  position: absolute;
  top: 136px;
  left: 20px;
  right: 20px;
  bottom: 20px;
  height: auto;
}

#hs-district-map-wrap {
  flex: 1;
  min-width: 0;
  /* Take up remaining or full space */
  background: #0b0f18;
  border: none;
  border-radius: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

#hs-district-svg {
  width: 100%;
  height: 100%;
}

/* District polygon base styles (JS overrides on hover/active) */
.dist-poly {
  fill: rgba(255, 255, 255, 0.06);
  stroke: rgba(255, 255, 255, 0.18);
  stroke-width: 1;
  cursor: pointer;
  transition: fill 120ms, stroke 120ms;
}

.dist-poly:hover {
  fill: rgba(31, 111, 235, 0.20);
  stroke: #1F6FEB;
}

.dist-poly.active {
  fill: rgba(31, 111, 235, 0.15);
  stroke: #1F6FEB;
  stroke-width: 1.5;
}

.dist-alert-dot {
  fill: var(--danger);
  pointer-events: none;
}

/* Authentic GeoJSON map styling */
.hdist-poly {
  fill: rgba(255, 255, 255, 0.04);
  stroke: rgba(255, 255, 255, 0.18);
  stroke-width: 0.5;
  cursor: pointer;
  transition: fill 120ms, stroke 120ms, stroke-width 120ms;
}

.hdist-poly.active,
.hdist-poly:not(.unsupported):hover {
  fill: rgba(31, 111, 235, 0.20);
  stroke: #1F6FEB;
  stroke-width: 1.5;
}

.hdist-lbl {
  font-family: var(--font-data);
  font-size: 16px;
  font-weight: 500;
  fill: rgba(255, 255, 255, 0.5);
  transition: fill 120ms, font-weight 120ms;
  text-shadow: 0px 2px 4px rgba(0, 0, 0, 0.8);
}

.hdist-lbl.active {
  fill: #fff;
  font-weight: 700;
}

.hdist-alert-dot {
  fill: var(--danger);
  stroke: #0a0e17;
  stroke-width: 1.5px;
}

/* District Stats Sidebar (slides in from right, content-sized) */
#hs-district-stats {
  width: 0;
  padding: 0;
  opacity: 0;
  overflow: hidden;
  flex-shrink: 0;
  align-self: flex-start;
  /* size to content, not to parent height */
  display: flex;
  flex-direction: column;
  background: rgba(10, 14, 23, 0.85);
  border: 1px solid transparent;
  border-radius: 6px;
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1),
    padding 0.4s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1),
    border-color 0.4s;
}

#hs-district-stats.open {
  width: clamp(280px, 32vw, 360px);
  padding: 24px 20px;
  opacity: 1;
  border-color: rgba(255, 255, 255, 0.1);
}

@media (max-width: 980px) {
  #hs-t2-search-wrap {
    left: 20px;
    right: 20px;
    width: auto;
  }

  #hs-t2-body {
    top: 136px;
    left: 12px;
    right: 12px;
    bottom: 12px;
  }
}

#hs-stats-content {
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  /* height NOT set - wraps content */
}

#hs-stats-name {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  margin: 0 0 12px 0;
  text-align: center;
}

#hs-stats-data {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
}

.hs-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.04);
  padding: 10px;
  border-radius: 2px;
}

.hs-stat-row strong {
  font-family: var(--font-data);
  font-weight: 500;
  color: #fff;
}

.hs-stat-row strong.danger-text {
  color: var(--danger);
  font-weight: 700;
}

#hs-stats-action {
  margin-top: 16px;
}

.hs-district-action-btn {
  width: 100%;
  min-height: var(--tap-min);
  padding: 0 12px;
  background: rgba(31, 111, 235, 0.1);
  border: 1px solid rgba(31, 111, 235, 0.4);
  border-radius: 4px;
  color: #58a6ff;
  font-family: var(--font-data);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 150ms, color 150ms, border-color 150ms, transform 100ms;
}

.hs-district-action-btn:hover {
  background: rgba(31, 111, 235, 0.25);
  border-color: #58a6ff;
  color: #fff;
  transform: translateY(-1px);
}

.hs-district-action-btn:active {
  transform: translateY(0);
  background: rgba(31, 111, 235, 0.35);
}

#hs-stats-action:hover {
  background: rgba(34, 197, 94, 0.15);
  color: #fff;
}

.dist-list-row {
  padding: 8px 10px;
  border-radius: 2px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 120ms;
}

.dist-list-row:hover {
  background: rgba(255, 255, 255, 0.06);
}

.dist-list-row.active {
  background: rgba(31, 111, 235, 0.12);
}

.dist-list-name {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
}

.dist-list-alert {
  font-size: 11px;
  color: var(--danger);
}

/* ═══════════════════════════════════════════════════════════════════
   GLOBAL UTILITIES
═══════════════════════════════════════════════════════════════════ */

.hidden {
  display: none !important;
}

/* ═══════════════════════════════════════════════════════════════════
   LIVE MODE ACTIVE STATES
   Applied when #map has class live-mode (via JS setMode)
═══════════════════════════════════════════════════════════════════ */

/* LIVE pill highlight in top bar */
#mode-live.active {
  background: rgba(26, 127, 55, 0.18);
  color: #3fb950;
}

/* Top bar subtle green border when live mode active */
body.live-active #topbar {
  border-bottom: 1px solid rgba(26, 127, 55, 0.30);
}

/* Density ribbon shimmer in Live Mode (spec §4) */
body.live-active #ta-ribbon {
  animation: ribbon-shimmer 3s ease-in-out infinite alternate;
}

@keyframes ribbon-shimmer {
  0% {
    filter: brightness(1.0);
  }

  100% {
    filter: brightness(1.06);
  }
}

/* Playhead stronger glow in Live Mode (spec §4) */
body.live-active #ta-playhead-line {
  box-shadow: 0 0 4px rgba(255, 255, 255, 0.5);
}

/* Strong mode separation: live/advanced gets a tactical scan look */
#map.live-mode .leaflet-tile-pane {
  filter: grayscale(30%) contrast(1.08) brightness(0.92);
}

#map.live-mode .leaflet-overlay-pane {
  filter: saturate(1.12);
}

#map.live-mode::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 430;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(30, 166, 132, 0.09), rgba(11, 44, 39, 0.18)),
    repeating-linear-gradient(0deg, rgba(117, 214, 181, 0.08) 0 1px, transparent 1px 8px);
  mix-blend-mode: screen;
}

#map.live-mode::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 431;
  pointer-events: none;
  background: radial-gradient(circle at 50% 50%, rgba(115, 255, 194, 0.06) 0%, transparent 64%);
  animation: od-live-scan 8s linear infinite;
}

#map.live-mode .od-marker .od-marker-glow {
  opacity: 0.78;
}

#map.live-mode .od-marker .od-marker-ring-a {
  animation: od-marker-wave 1.8s ease-out infinite;
}

#map.live-mode .od-marker .od-marker-ring-b {
  animation: od-marker-wave 1.8s ease-out infinite 0.9s;
}

@keyframes od-live-scan {
  0% {
    transform: translateY(-10px);
    opacity: 0.35;
  }

  50% {
    transform: translateY(10px);
    opacity: 0.55;
  }

  100% {
    transform: translateY(-10px);
    opacity: 0.35;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   PERFORMANCE OPTIMIZATIONS (Issue 4)
   Reduce layout reflow, enable GPU compositing hints
═══════════════════════════════════════════════════════════════════ */

/* Prevent timeline scroll from affecting map layout */
#tl-scroll {
  contain: layout style;
  overflow-anchor: none;
  --tl-scroll-fade: 44px;
  -webkit-mask-image: linear-gradient(to bottom,
      transparent 0,
      #000 var(--tl-scroll-fade),
      #000 calc(100% - var(--tl-scroll-fade)),
      transparent 100%);
  mask-image: linear-gradient(to bottom,
      transparent 0,
      #000 var(--tl-scroll-fade),
      #000 calc(100% - var(--tl-scroll-fade)),
      transparent 100%);
}

/* GPU-hint for animated Leaflet SVG paths.
   Applied by JS via _applyCatClass. Reduces main-thread paint cost. */
.leaflet-interactive.cat-health-path,
.leaflet-interactive.cat-emergency-path,
.leaflet-interactive.cat-infrastructure-path,
.leaflet-interactive.cat-mobility-path {
  will-change: stroke-opacity;
}

/* Timeline cards: contain painting to their box */
.tl-card-inner {
  contain: layout style paint;
}

/* Env overlays: already use opacity, add compositing hint */
.env-rain,
.env-haze {
  will-change: opacity;
}

/* ═══════════════════════════════════════════════════════════════════
   SETTINGS SIDEBAR PANEL - Bottom Left
═══════════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════════
   SETTINGS TRAY PANEL (Bottom Center Pull-up)
═══════════════════════════════════════════════════════════════════ */

#settings-tray-container {
  position: absolute;
  bottom: 0;
  /* Attach directly to the bottom of the map (above the 60px time axis via structural flow) */
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
  /* Let clicks pass through container */
}

/* The small pull tab sitting on top */
.tray-pull-tab {
  pointer-events: auto;
  background: rgba(13, 17, 23, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  min-height: 38px;
  padding: 6px 24px;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, background 0.2s;
}

.tray-pull-tab:hover {
  color: #fff;
  background: rgba(48, 54, 61, 0.95);
}

.tray-pull-tab[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.tray-pull-tab svg {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* The actual expanding panel */
#settings-panel {
  pointer-events: auto;
  background: rgba(13, 17, 23, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  overflow-y: auto;
  overflow-x: hidden;
  width: 90vw;
  max-width: 600px;
  /* Allows 2-3 columns easily */
  max-height: 45vh;
  /* Prevents escaping the top of the viewport */
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.5);
}

/* Custom dark scrollbars for the settings panel */
#settings-panel::-webkit-scrollbar {
  width: 6px;
}

#settings-panel::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 0 8px 0 0;
}

#settings-panel::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

#settings-panel::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.4);
}

#settings-panel.hidden {
  max-height: 0;
  opacity: 0;
  border-width: 0;
  overflow: hidden;
  /* Hide scrollbars physically when animating away */
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  padding: 16px 24px;
}

/* Settings Toggle Switch (Reused from previous) */
.setting-toggle-label {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
  font-family: var(--font-data);
  color: #fff;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.05);
  /* Button-like appearance */
  padding: 10px 16px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: background 0.2s;
}

.setting-toggle-label:hover {
  background: rgba(255, 255, 255, 0.1);
}

.setting-toggle-label input[type="checkbox"] {
  display: none;
}

.setting-toggle-switch {
  position: relative;
  width: 36px;
  height: 20px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  transition: background 0.3s;
  flex-shrink: 0;
}

.setting-toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.setting-toggle-label input[type="checkbox"]:checked+.setting-toggle-switch {
  background: #1F6FEB;
}

.setting-toggle-label input[type="checkbox"]:checked+.setting-toggle-switch::after {
  transform: translateX(16px);
}

/* ═══════════════════════════════════════════════════════════════════
   WIDE-SCREEN RESPONSIVE SCALING
   Strategy: override structural tokens + key font sizes at breakpoints.
   Layout model is untouched - only the token values and font sizes grow.
   ─── Breakpoints ───────────────────────────────────────────────────
     1280px  laptop/large tablet
     1600px  HD desktop / 1080p
     1920px  full HD / large desktop
═══════════════════════════════════════════════════════════════════ */

/* ── 1280px - laptop / large tablet ─────────────────────────── */
@media (min-width: 1280px) {
  :root {
    --bar-h: 60px;
    --floor-h: 94px;
    --tl-w: clamp(280px, 21vw, 360px);
    --ai-w: clamp(340px, 24vw, 430px);
    --tap-min: 50px;
  }

  /* Topbar */
  .tb-district-meta         { font-size: 10px; }
  .tb-district-name         { font-size: 21px; }
  .tb-btn, .mode-pill       { font-size: 12px; padding: 0 16px; min-height: var(--tap-min); }
  #sync-label               { font-size: 12px; }
  #tb-logo                  { font-size: 18px; }

  /* Timeline panel */
  .tl-header-meta           { font-size: 11px; }
  .tl-header-district       { font-size: 20px; }
  .tl-card-meta             { font-size: 11px; }
  .tl-card-title            { font-size: 14px; }
  .tl-card-desc             { font-size: 12px; }
  .tl-card-badge            { font-size: 10px; }
  .tl-day-label             { font-size: 11px; }

  /* AI panel */
  .ai-header-label          { font-size: 11px; }
  .ai-header-title          { font-size: 18px; }
  .ai-chip                  { font-size: 11px; }
  .ai-response-text         { font-size: 13px; line-height: 1.65; }
  .ai-source-label          { font-size: 10px; }

  /* Time axis internals */
  #ta-ruler                 { height: 44px; }
  #ta-ribbon                { height: 50px; }
  #ta-controls              { width: 200px; }
  .ta-ctrl-btn              { min-width: var(--tap-min); height: var(--tap-min); font-size: 13px; }
  .ta-date                  { font-size: 11px; }
  .ta-time                  { font-size: 10px; }

  /* Zoom controls */
  .zoom-btn                 { width: 82px; height: 82px; font-size: 46px; }

  /* Hierarchy selector */
  #hs-title                 { font-size: 26px; }
  #hs-state-stats-name      { font-size: 24px; }
}

/* ── 1600px - HD desktop / 1080p ─────────────────────────────── */
@media (min-width: 1600px) {
  :root {
    --bar-h: 66px;
    --floor-h: 102px;
    --tl-w: clamp(300px, 19vw, 390px);
    --ai-w: clamp(360px, 22vw, 470px);
    --tap-min: 54px;
  }

  /* Topbar */
  .tb-district-meta         { font-size: 11px; letter-spacing: 1.4px; }
  .tb-district-name         { font-size: 23px; }
  .tb-btn, .mode-pill       { font-size: 13px; padding: 0 18px; min-height: var(--tap-min); }
  #sync-label               { font-size: 13px; }
  #tb-logo                  { font-size: 19px; letter-spacing: 0.3px; }
  #sync-dot                 { width: 11px; height: 11px; }

  /* Timeline panel */
  .tl-header-meta           { font-size: 12px; }
  .tl-header-district       { font-size: 22px; }
  .tl-card-meta             { font-size: 12px; }
  .tl-card-title            { font-size: 15px; }
  .tl-card-desc             { font-size: 13px; line-height: 1.55; }
  .tl-card-badge            { font-size: 11px; padding: 3px 7px; }
  .tl-day-label             { font-size: 12px; }
  #tl-scroll                { padding: 18px 0; }
  .tl-card                  { margin-bottom: 22px; }

  /* AI panel */
  .ai-header-label          { font-size: 12px; }
  .ai-header-title          { font-size: 19px; }
  .ai-chip                  { font-size: 12px; padding: 6px 12px; }
  .ai-response-text         { font-size: 14px; line-height: 1.7; }
  .ai-source-label          { font-size: 11px; }

  /* Time axis internals */
  #ta-ruler                 { height: 48px; }
  #ta-ribbon                { height: 54px; }
  #ta-controls              { width: 214px; }
  .ta-ctrl-btn              { min-width: var(--tap-min); height: var(--tap-min); font-size: 14px; }
  .ta-date                  { font-size: 12px; }
  .ta-time                  { font-size: 11px; }

  /* Zoom controls */
  .zoom-btn                 { width: 90px; height: 90px; font-size: 50px; border-radius: 14px; }

  /* Hierarchy selector */
  #hs-title                 { font-size: 28px; }
  #hs-state-stats-name      { font-size: 26px; }
}

/* ── 1920px - 1080p large desktop ────────────────────────────── */
@media (min-width: 1920px) {
  :root {
    --bar-h: 74px;
    --floor-h: 114px;
    --tl-w: clamp(320px, 18vw, 430px);
    --ai-w: clamp(390px, 21vw, 520px);
    --tap-min: 58px;
  }

  /* Topbar */
  .tb-district-meta         { font-size: 12px; letter-spacing: 1.6px; }
  .tb-district-name         { font-size: 26px; }
  .tb-btn, .mode-pill       { font-size: 14px; min-height: var(--tap-min); padding: 0 20px; }
  #sync-label               { font-size: 14px; }
  #tb-logo                  { font-size: 22px; }
  #sync-dot                 { width: 12px; height: 12px; }
  #topbar                   { padding: 0 22px; gap: 16px; }

  /* Timeline panel */
  .tl-header-meta           { font-size: 13px; letter-spacing: 1.4px; }
  .tl-header-district       { font-size: 25px; }
  .tl-card-meta             { font-size: 13px; }
  .tl-card-title            { font-size: 16px; }
  .tl-card-desc             { font-size: 14px; line-height: 1.6; }
  .tl-card-badge            { font-size: 12px; padding: 4px 8px; }
  .tl-day-label             { font-size: 13px; }
  #tl-scroll                { padding: 20px 0; }
  .tl-card                  { margin-bottom: 26px; }
  .tl-spine                 { padding-left: 36px; }

  /* AI panel */
  .ai-header-label          { font-size: 13px; }
  .ai-header-title          { font-size: 21px; }
  .ai-chip                  { font-size: 13px; padding: 7px 14px; }
  .ai-response-text         { font-size: 15px; line-height: 1.75; }
  .ai-source-label          { font-size: 12px; }

  /* Time axis internals */
  #ta-ruler                 { height: 52px; }
  #ta-ribbon                { height: 60px; }
  #ta-controls              { width: 230px; }
  .ta-ctrl-btn              { min-width: var(--tap-min); height: var(--tap-min); font-size: 15px; }
  .ta-date                  { font-size: 13px; }
  .ta-time                  { font-size: 12px; }
  .ta-tick-major            { height: 24px; }

  /* Zoom controls */
  .zoom-btn                 { width: 100px; height: 100px; font-size: 56px; border-radius: 16px; }

  /* Hierarchy selector */
  #hs-title                 { font-size: 30px; }
  #hs-state-stats-name      { font-size: 28px; }
}

/* ── 2560px - 1440p native (= what 150% zoom gave you) ───────── */
@media (min-width: 2560px) {
  :root {
    --bar-h: 86px;
    --floor-h: 130px;
    --tl-w: clamp(360px, 17vw, 500px);
    --ai-w: clamp(450px, 21vw, 620px);
    --tap-min: 64px;
  }

  /* Topbar */
  .tb-district-meta         { font-size: 14px; letter-spacing: 1.8px; }
  .tb-district-name         { font-size: 30px; }
  .tb-btn, .mode-pill       { font-size: 16px; min-height: var(--tap-min); padding: 0 22px; letter-spacing: 0.9px; }
  #sync-label               { font-size: 15px; }
  #tb-logo                  { font-size: 24px; letter-spacing: 0.4px; }
  #sync-dot                 { width: 13px; height: 13px; }
  #topbar                   { padding: 0 28px; gap: 18px; }
  .tb-sep                   { height: 22px; }

  /* Timeline panel */
  .tl-header-meta           { font-size: 14px; letter-spacing: 1.6px; }
  .tl-header-district       { font-size: 30px; }
  #tl-header                { padding: 0 14px 0 20px; }
  .tl-card-meta             { font-size: 14px; }
  .tl-card-title            { font-size: 19px; }
  .tl-card-desc             { font-size: 16px; line-height: 1.6; }
  .tl-card-badge            { font-size: 13px; padding: 5px 10px; }
  .tl-day-label             { font-size: 14px; }
  #tl-scroll                { padding: 24px 0; }
  .tl-card                  { margin-bottom: 28px; }
  .tl-spine                 { padding: 0 14px 0 42px; }
  .tl-card::before          { width: 14px; height: 14px; left: -24px; top: 18px; }

  /* AI panel */
  .ai-header-label          { font-size: 14px; }
  .ai-header-title          { font-size: 24px; }
  .ai-chip                  { font-size: 14px; min-height: var(--tap-min); padding: 0 18px; }
  .ai-response-text         { font-size: 17px; line-height: 1.75; }
  .ai-source-label          { font-size: 13px; }
  #ai-header                { padding: 0 18px; }

  /* Time axis internals - ruler + ribbon fill floor height */
  #ta-ruler                 { height: 60px; }
  #ta-ribbon                { height: 68px; }
  #ta-controls              { width: 246px; }
  .ta-ctrl-btn              { min-width: var(--tap-min); height: var(--tap-min); font-size: 16px; }
  .ta-date                  { font-size: 12px; }
  .ta-time                  { font-size: 11px; }
  .ta-tick-major            { height: 28px; }
  .ta-tick-minor            { height: 10px; }
  #ta-playhead-handle       { width: 44px; height: 46px; border-radius: 7px; bottom: 10px; }

  /* Zoom controls */
  .zoom-btn                 { width: 112px; height: 112px; font-size: 62px; border-radius: 18px; }

  /* Hierarchy selector */
  #hs-title                 { font-size: 34px; }
  #hs-state-stats-name      { font-size: 30px; }
}



