/* ============================================================
   Is My City Encrypted?
   Built by BinaryRogue.ai — Design System v7 (Purple)
   ============================================================ */

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

:root {
  --bg: #000000;
  --bg-card: #0a0a12;
  --bg-hover: #12121e;
  --border: rgba(139,92,246,0.12);
  --border-hover: rgba(139,92,246,0.28);
  --text: #d4d0e8;
  --text-bright: #F5F3FF;
  --text-muted: #8b85a6;
  --primary: #8B5CF6;
  --primary-soft: rgba(139,92,246,0.10);
  --primary-dim: #7C3AED;
  --secondary: #C4B5FD;
  --deep: #4C1D95;
  --accent: #3A86FF;
  --accent-soft: rgba(58,134,255,0.10);
  --enc-color: #8B5CF6;
  --enc-soft: rgba(139,92,246,0.12);
  --partial-color: #7C6FD0;
  --partial-soft: rgba(124,111,208,0.12);
  --clear-color: #c8c3d8;
  --clear-soft: rgba(200,195,216,0.08);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'SF Mono', 'Fira Code', 'JetBrains Mono', monospace;
  --header-h: 84px;
  --glow: 0 0 40px rgba(139,92,246,0.08);
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  padding-top: 32px;
}

a { color: var(--primary); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--secondary); }
.hidden { display: none !important; }
::selection { background: rgba(139,92,246,0.3); color: var(--text-bright); }

/* --- Skip link --- */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--primary);
  color: #fff;
  padding: 8px 16px;
  z-index: 1000;
  font-weight: 600;
  font-size: 0.85rem;
}
.skip-link:focus { top: 0; }

/* --- Topbar --- */
#topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 101;
  background: rgba(0,0,0,0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  text-align: center;
  padding: 8px 16px;
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}
#topbar a { color: var(--secondary); font-weight: 600; }
#topbar a:hover { color: var(--primary); }
#topbar .separator { margin: 0 8px; opacity: 0.3; }

/* --- Header --- */
#header {
  position: sticky;
  top: 32px;
  z-index: 100;
  background: rgba(0,0,0,0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
}

.header-inner {
  max-width: 880px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 20px;
  height: 52px;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-bright);
  flex-shrink: 0;
}

.header-title {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  color: var(--text-bright);
}

.header-search { flex: 1; }

/* --- Search --- */
.search-wrap { position: relative; display: flex; align-items: center; }

.search-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  pointer-events: none;
  z-index: 2;
}

.search-input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-bright);
  font-family: var(--font);
  font-size: 0.95rem;
  padding: 10px 16px 10px 44px;
  outline: none;
  transition: border-color 0.25s, box-shadow 0.25s;
}

.search-input::placeholder { color: var(--text-muted); }
.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(139,92,246,0.15), 0 0 20px rgba(139,92,246,0.08);
}

.search-kbd {
  position: absolute;
  right: 10px;
  background: rgba(139,92,246,0.08);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 0.7rem;
  padding: 2px 8px;
  pointer-events: none;
  z-index: 2;
}

/* Hero search */
.search-wrap--hero { max-width: 580px; margin: 0 auto; }

.search-wrap--hero .search-input {
  font-size: 1.08rem;
  padding: 16px 52px 16px 50px;
  border-radius: 14px;
  background: rgba(10,10,18,0.8);
  border: 1px solid rgba(139,92,246,0.2);
  box-shadow: var(--glow);
}

.search-wrap--hero .search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(139,92,246,0.18), 0 0 30px rgba(139,92,246,0.1);
}

/* Compact search */
.search-wrap--compact .search-input {
  padding: 7px 14px 7px 36px;
  font-size: 0.85rem;
  border-radius: 8px;
}
.search-wrap--compact .search-icon { left: 10px; width: 16px; height: 16px; }

/* --- Typeahead Dropdown --- */
.search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 14px 14px;
  max-height: 340px;
  overflow-y: auto;
  z-index: 200;
  display: none;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}
.search-dropdown.active { display: block; }

.dropdown-item {
  padding: 10px 16px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.15s;
  border-bottom: 1px solid rgba(139,92,246,0.05);
}
.dropdown-item:last-child { border-bottom: none; }
.dropdown-item:hover, .dropdown-item.highlighted { background: var(--bg-hover); }

.dropdown-item-name {
  font-size: 0.88rem;
  color: var(--text-bright);
  font-weight: 500;
}
.dropdown-item-loc {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 1px;
}
.dropdown-item-status {
  display: flex;
  gap: 8px;
  font-size: 0.68rem;
  color: var(--text-muted);
  flex-shrink: 0;
}
.dropdown-item-status .dot { width: 5px; height: 5px; }

.dropdown-empty {
  padding: 16px;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* --- Loading Spinner --- */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* --- Skeleton loading --- */
@keyframes shimmer {
  0% { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-hover) 50%, var(--bg-card) 75%);
  background-size: 800px 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}
.skeleton-card {
  height: 90px;
  margin-bottom: 8px;
  border-radius: 10px;
}
.skeleton-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}
.skeleton-summary-card {
  height: 80px;
  border-radius: 10px;
}
.skeleton-header { height: 28px; width: 50%; margin-bottom: 8px; }
.skeleton-subheader { height: 16px; width: 35%; margin-bottom: 20px; }

/* --- Error State --- */
.error-state {
  text-align: center;
  padding: 40px 24px;
  color: var(--text-muted);
}
.error-state-icon {
  font-size: 2rem;
  margin-bottom: 12px;
  opacity: 0.5;
}
.error-state-msg {
  font-size: 0.9rem;
  margin-bottom: 16px;
}
.error-state .btn-back { margin: 0 auto; }

/* --- Search Hint --- */
.search-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 14px;
  letter-spacing: 0.01em;
}
.search-hint-sep { margin: 0 4px; opacity: 0.4; }

/* --- Hero --- */
#hero {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 64px 24px 48px;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}

/* Subtle radial glow behind hero */
#hero::before {
  content: '';
  position: absolute;
  top: -120px;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 600px;
  background: radial-gradient(ellipse, rgba(139,92,246,0.06) 0%, transparent 70%);
  pointer-events: none;
}

.hero-content {
  text-align: center;
  max-width: 660px;
  width: 100%;
  position: relative;
  z-index: 1;
}

.hero-title {
  font-size: clamp(2.2rem, 5.5vw, 3.2rem);
  font-weight: 800;
  color: var(--text-bright);
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
}

.text-gradient {
  background: linear-gradient(135deg, #F5F3FF 0%, #C4B5FD 35%, #8B5CF6 65%, #3A86FF 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradient-shift 8s ease-in-out infinite;
}
@keyframes gradient-shift {
  0%, 100% { background-position: 0% center; }
  50% { background-position: 100% center; }
}

.hero-subtitle {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 460px;
  margin: 0 auto 32px;
  line-height: 1.7;
  font-weight: 400;
}

/* --- Headline Stat Ring --- */
.hero-headline-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 32px;
}
.ring-gauge {
  position: relative;
  width: 180px;
  height: 180px;
}
.ring-svg {
  width: 100%;
  height: 100%;
}
.ring-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}
.ring-value {
  display: block;
  font-family: var(--mono);
  font-size: 2.6rem;
  font-weight: 800;
  color: var(--text-bright);
  letter-spacing: -0.03em;
  line-height: 1;
}
.ring-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 4px;
}
.headline-stat-text {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 8px;
}
.headline-stat-text strong { color: var(--primary); font-weight: 600; }
.headline-stat-hook {
  font-size: 0.8rem;
  color: var(--text-muted);
  opacity: 0.5;
  margin-top: 2px;
  font-style: italic;
}

/* --- Dashboard Stats Grid --- */
.hero-stats {
  margin-top: 40px;
}

.stats-coverage {
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.stats-coverage strong {
  color: var(--text-bright);
  font-weight: 700;
}

.stat-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  max-width: 500px;
  margin: 0 auto;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 14px 14px;
  text-align: center;
  transition: border-color 0.25s, box-shadow 0.25s;
}
.stat-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--glow);
}

.stat-card-value {
  display: block;
  font-family: var(--mono);
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
}
.stat-card--enc .stat-card-value { color: var(--enc-color); }
.stat-card--partial .stat-card-value { color: var(--partial-color); }
.stat-card--clear .stat-card-value { color: var(--clear-color); }

.stat-card-label {
  display: block;
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 6px;
}

.stat-card-bar {
  height: 4px;
  border-radius: 2px;
  background: rgba(139,92,246,0.06);
  margin-top: 10px;
  overflow: hidden;
}
.stat-card-fill {
  height: 100%;
  border-radius: 2px;
  width: 0%;
  transition: width 1.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.stat-card-fill--enc { background: var(--enc-color); }
.stat-card-fill--partial { background: var(--partial-color); }
.stat-card-fill--clear { background: var(--clear-color); }

/* --- Heatmap --- */
#heatmap {
  padding: 0 24px 48px;
  background: var(--bg);
}
.heatmap-container {
  max-width: 800px;
  margin: 0 auto;
  position: relative;
}
.heatmap-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-bright);
  text-align: center;
  letter-spacing: -0.02em;
}
.heatmap-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  margin: 4px 0 16px;
}
.heatmap-map {
  width: 100%;
  max-width: 700px;
  margin: 0 auto;
}
.heatmap-map svg {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 4px 30px rgba(139,92,246,0.15));
}
.heatmap-map path {
  stroke: rgba(0,0,0,0.5);
  stroke-width: 0.6;
  cursor: pointer;
  transition: filter 0.2s, stroke 0.2s, stroke-width 0.2s;
}
.heatmap-map path:hover {
  stroke: rgba(255,255,255,0.8);
  stroke-width: 1.8;
  filter: brightness(1.3) drop-shadow(0 0 14px rgba(255,160,50,0.4));
}
.heatmap-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}
.heatmap-legend-label {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.heatmap-legend-pct {
  font-family: var(--mono);
  font-size: 0.6rem;
  color: rgba(196,181,253,0.3);
}
.heatmap-gradient {
  width: 240px;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(90deg,
    hsl(260,60%,5%) 0%,
    hsl(290,85%,25%) 20%,
    hsl(350,88%,45%) 40%,
    hsl(15,92%,52%) 55%,
    hsl(35,95%,58%) 70%,
    hsl(50,97%,65%) 85%,
    hsl(55,100%,82%) 100%);
  box-shadow: 0 0 16px rgba(139,92,246,0.15);
}
.heatmap-tooltip {
  position: absolute;
  background: rgba(10,10,18,0.95);
  border: 1px solid var(--border-hover);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.8rem;
  color: var(--text-bright);
  pointer-events: none;
  z-index: 50;
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 20px rgba(139,92,246,0.1);
}
.heatmap-tooltip .tt-name {
  font-weight: 600;
  margin-bottom: 2px;
}
.heatmap-tooltip .tt-pct {
  font-family: var(--mono);
  font-weight: 700;
}
.heatmap-tooltip .tt-detail {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.lb-row--hidden { display: none !important; }
.lb-toggle {
  display: block;
  margin: 16px auto 0;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.75rem;
  padding: 8px 20px;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.25s, color 0.25s, box-shadow 0.25s;
}
.lb-toggle:hover {
  border-color: var(--primary);
  color: var(--secondary);
  box-shadow: 0 0 12px rgba(139,92,246,0.1);
}

/* --- Leaderboard --- */
#leaderboard {
  padding: 0 24px 60px;
  background: var(--bg);
}

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

.leaderboard-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-bright);
  text-align: center;
  letter-spacing: -0.02em;
}

.leaderboard-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  margin: 4px 0 20px;
}

/* Header row */
.lb-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}
.lb-head .lb-name,
.lb-head .lb-pct,
.lb-head .lb-total {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.lb-bar-label {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 0.68rem;
  color: var(--text-muted);
  min-width: 60px;
}
.lb-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-left: 8px;
}
.lb-dot:first-child { margin-left: 0; }
.lb-dot--enc { background: hsl(35, 95%, 58%); }
.lb-dot--partial { background: hsl(320, 90%, 35%); }
.lb-dot--clear { background: rgba(200,195,216,0.4); }

/* Rows */
.lb-list { display: flex; flex-direction: column; gap: 0; }

.lb-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  border-radius: 8px;
  transition: background 0.15s, box-shadow 0.15s;
  cursor: pointer;
}
.lb-row:hover {
  background: var(--bg-card);
  box-shadow: var(--glow);
}
.lb-row:nth-child(even) { background: rgba(139,92,246,0.02); }
.lb-row:nth-child(even):hover { background: var(--bg-card); }

.lb-abbrev {
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  width: 26px;
  text-align: center;
  flex-shrink: 0;
  letter-spacing: 0.04em;
}

.lb-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-bright);
  width: 130px;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lb-bar {
  flex: 1;
  display: flex;
  height: 10px;
  border-radius: 5px;
  overflow: hidden;
  background: rgba(139,92,246,0.05);
  min-width: 80px;
}

.lb-seg { height: 100%; transition: width 0.6s ease; }
.lb-seg--enc { background: var(--enc-color); }
.lb-seg--partial { background: var(--partial-color); }
.lb-seg--clear { background: var(--clear-color); opacity: 0.5; }

.lb-pct {
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 600;
  width: 56px;
  text-align: right;
  flex-shrink: 0;
}

.lb-total {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  width: 44px;
  text-align: right;
  flex-shrink: 0;
}

/* --- Results --- */
#results, #detail, #agencyDetail { flex: 1; padding: 28px 24px; }

.results-container, .detail-container { max-width: 760px; margin: 0 auto; }

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.btn-back {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.8rem;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: border-color 0.25s, box-shadow 0.25s;
}

.btn-back:hover {
  border-color: var(--primary);
  color: var(--text-bright);
  box-shadow: 0 0 12px rgba(139,92,246,0.08);
}

/* Share button */
.btn-share {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.8rem;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: border-color 0.25s, box-shadow 0.25s;
}
.btn-share:hover {
  border-color: var(--primary);
  color: var(--text-bright);
  box-shadow: 0 0 12px rgba(139,92,246,0.08);
}

/* Detail nav row */
.detail-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0;
}

/* --- Cards --- */
.results-list { display: flex; flex-direction: column; gap: 8px; }

.result-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid transparent;
  border-radius: 10px;
  padding: 16px 20px;
  cursor: pointer;
  transition: border-color 0.25s, box-shadow 0.25s;
}

.result-card:hover {
  border-color: var(--border-hover);
  border-left-color: var(--primary);
  box-shadow: var(--glow);
}

.result-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.result-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-bright);
}

.result-location {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* County-level data annotation on city cards */
.result-county-note {
  font-size: 0.68rem;
  color: var(--primary);
  margin-top: 2px;
  font-style: italic;
}

.result-type-badge {
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 6px;
  flex-shrink: 0;
}

.badge-city { background: var(--primary-soft); color: var(--primary); }
.badge-county { background: var(--partial-soft); color: var(--partial-color); }
.badge-state { background: rgba(245,243,255,0.05); color: var(--text-muted); }

/* Encryption bar */
.encryption-bar {
  display: flex;
  height: 3px;
  border-radius: 2px;
  overflow: hidden;
  background: rgba(139,92,246,0.05);
  margin-bottom: 8px;
}

.bar-encrypted { background: var(--enc-color); }
.bar-partial { background: var(--partial-color); }
.bar-clear { background: var(--clear-color); opacity: 0.5; }

.result-stats {
  display: flex;
  gap: 14px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.result-stats span { display: flex; align-items: center; gap: 4px; }
.dot { width: 5px; height: 5px; border-radius: 50%; display: inline-block; }
.dot-encrypted { background: var(--enc-color); }
.dot-partial { background: var(--partial-color); }
.dot-clear { background: var(--clear-color); }

/* --- Detail --- */
.detail-header { margin: 16px 0 20px; }

.detail-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-bright);
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.detail-header .detail-location {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* County fallback */
.county-fallback {
  margin-top: 8px;
  padding: 8px 12px;
  background: var(--partial-soft);
  border: 1px solid rgba(124,111,208,0.25);
  border-radius: 8px;
  font-size: 0.78rem;
  color: var(--partial-color);
  line-height: 1.4;
  display: flex;
  align-items: center;
  gap: 8px;
}
.county-fallback::before {
  content: '\26A0';
  font-size: 1rem;
  flex-shrink: 0;
}

.detail-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}

.summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 14px;
  text-align: center;
  transition: border-color 0.25s, box-shadow 0.25s;
}

.summary-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--glow);
}

.summary-card-value {
  font-family: var(--mono);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}

.summary-card-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 8px;
}

/* --- Agency cards --- */
.detail-agencies { display: flex; flex-direction: column; gap: 8px; }

.agency-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid transparent;
  border-radius: 10px;
  padding: 16px 20px;
  cursor: pointer;
  transition: border-color 0.25s, box-shadow 0.25s;
}

.agency-card:hover {
  border-color: var(--border-hover);
  border-left-color: var(--primary);
  box-shadow: var(--glow);
}

/* Spotlight callout */
.spotlight {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin-bottom: 10px;
  background: var(--enc-soft);
  border: 1px solid rgba(139,92,246,0.2);
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--enc-color);
}
.spotlight svg { flex-shrink: 0; stroke: var(--enc-color); }
.agency-card--spotlight { border-left-color: var(--enc-color); }
.detail-header .spotlight {
  margin-bottom: 16px;
  font-size: 13px;
  padding: 10px 14px;
}

.agency-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  position: relative;
}

.agency-name {
  font-weight: 600;
  color: var(--text-bright);
  font-size: 0.95rem;
}

.agency-type {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: capitalize;
  letter-spacing: 0.02em;
}

/* Status badges */
.status-badge {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
}

.status-encrypted { background: var(--enc-soft); color: var(--enc-color); }
.status-partial { background: var(--partial-soft); color: var(--partial-color); }
.status-clear { background: var(--clear-soft); color: var(--clear-color); }
.status-unknown { background: rgba(245,243,255,0.04); color: var(--text-muted); }

.agency-meta {
  display: flex;
  gap: 16px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.agency-meta code {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text);
  background: rgba(139,92,246,0.06);
  padding: 1px 6px;
  border-radius: 4px;
}

/* --- Channels table --- */
.agency-channels { margin-top: 16px; overflow-x: auto; -webkit-overflow-scrolling: touch; }

.channels-table {
  width: 100%;
  border-collapse: collapse;
}

.channels-table th {
  text-align: left;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.channels-table td {
  padding: 10px 12px;
  font-size: 0.82rem;
  border-bottom: 1px solid rgba(139,92,246,0.04);
  color: var(--text);
}

.channels-table tr:hover td { background: rgba(139,92,246,0.03); }

.channels-table .freq {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--accent);
}

.channels-table .mode {
  font-family: var(--mono);
  font-size: 0.72rem;
}

.channel-encrypted { color: var(--enc-color); }
.channel-clear { color: var(--accent); }

.row-encrypted { background: var(--enc-soft); }
.row-clear { }

.ch-name { color: var(--text-bright); }
.ch-tag {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-family: var(--mono);
  margin-top: 2px;
}

.ch-status {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
}
.ch-status--enc {
  color: var(--enc-color);
  background: var(--enc-soft);
  border: 1px solid rgba(139,92,246,0.25);
}
.ch-status--clear {
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(58,134,255,0.2);
}

/* --- Agency chevron --- */
.agency-chevron {
  color: var(--text-muted);
  opacity: 0.4;
  transition: opacity 0.2s, transform 0.2s;
  flex-shrink: 0;
  margin-left: 8px;
}
.agency-card:hover .agency-chevron { opacity: 1; transform: translateX(2px); }

/* --- Search clear button --- */
.search-clear {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  font-size: 1rem;
  line-height: 1;
  z-index: 2;
  display: none;
  transition: color 0.15s;
}
.search-clear:hover { color: var(--text-bright); }
.search-clear.visible { display: flex; }
.search-wrap--hero .search-clear { right: 48px; }

/* --- Scrollbar --- */
html { scrollbar-color: rgba(139,92,246,0.12) transparent; scrollbar-width: thin; }
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(139,92,246,0.12); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(139,92,246,0.25); }

/* --- Footer --- */
#footer {
  border-top: 1px solid var(--border);
  padding: 20px 24px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.footer-links {
  margin-bottom: 8px;
}
.footer-links a { color: var(--text-muted); }
.footer-links a:hover { color: var(--primary); }
.footer-links .separator { margin: 0 8px; opacity: 0.3; }

.footer-clock {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.3px;
}

/* --- Focus visible --- */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.result-card:focus-visible,
.agency-card:focus-visible,
.lb-row:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
  border-color: var(--primary);
}
.btn-back:focus-visible { outline-offset: 2px; }
.search-input:focus-visible { outline: none; }
.search-clear:focus-visible { outline-offset: 0; }

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-hover);
  border-radius: 14px;
  padding: 28px 32px 24px;
  max-width: 520px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 40px rgba(139,92,246,0.08);
  max-height: 80vh;
  overflow-y: auto;
}
.modal-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-bright);
  margin-bottom: 16px;
}
.modal-body {
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--text);
  margin-bottom: 20px;
}
.modal-body h4 {
  color: var(--text-bright);
  font-size: 0.85rem;
  font-weight: 600;
  margin: 16px 0 6px;
}
.modal-body h4:first-child { margin-top: 0; }
.modal-body p { margin-bottom: 8px; color: var(--text-muted); }
.modal-body ul { margin: 4px 0 12px 18px; color: var(--text-muted); }
.modal-body li { margin-bottom: 4px; }
.modal-close {
  display: block;
  margin-left: auto;
  padding: 8px 24px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, box-shadow 0.2s;
}
.modal-close:hover {
  opacity: 0.9;
  box-shadow: 0 0 16px rgba(139,92,246,0.3);
}

/* --- Toast notification --- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border-hover);
  color: var(--text-bright);
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 0.82rem;
  z-index: 400;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 16px rgba(139,92,246,0.1);
  animation: toastIn 0.3s ease, toastOut 0.3s ease 1.7s forwards;
}
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(10px); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(-50%) translateY(10px); } }

/* --- Trust Bar --- */
.trust-bar {
  margin-top: 10px;
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}
.trust-bar a { color: var(--secondary); font-weight: 500; }
.trust-bar a:hover { color: var(--primary); }
.trust-sep { margin: 0 6px; opacity: 0.3; }

/* --- Breadcrumbs --- */
.breadcrumb {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); }
.bc-sep { margin: 0 6px; opacity: 0.4; }

/* --- Status Explainer --- */
.status-explainer {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 0.82rem;
  line-height: 1.5;
  margin-bottom: 16px;
  border: 1px solid;
}
.status-explainer strong { font-weight: 600; }
.status-explainer--bad {
  background: var(--enc-soft);
  border-color: rgba(139,92,246,0.2);
  color: var(--enc-color);
}
.status-explainer--good {
  background: var(--accent-soft);
  border-color: rgba(58,134,255,0.2);
  color: var(--accent);
}
.status-explainer--mixed {
  background: var(--partial-soft);
  border-color: rgba(124,111,208,0.2);
  color: var(--partial-color);
}

/* --- Detail Actions --- */
.detail-actions {
  margin-top: 20px;
  padding: 16px 0;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.action-report a, .action-alert a {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.action-report a:hover, .action-alert a:hover { color: var(--primary); }
.action-report a::before { content: '\26A0'; font-size: 0.9rem; }
.action-alert a::before { content: '\1F514'; font-size: 0.9rem; }

/* --- Scanner Recommendation --- */
.scanner-rec {
  margin-top: 24px;
  padding: 20px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
}
.scanner-rec h4 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-bright);
  margin-bottom: 8px;
}
.scanner-rec p {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 12px;
}
.rec-link {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--primary);
  padding: 8px 16px;
  border: 1px solid var(--primary);
  border-radius: 8px;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
.rec-link:hover {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 0 16px rgba(139,92,246,0.25);
}

/* --- Submit Form --- */
.submit-form { display: flex; flex-direction: column; gap: 12px; }
.form-row { display: flex; flex-direction: column; gap: 4px; }
.form-row label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-bright);
}
.form-optional { font-weight: 400; color: var(--text-muted); }
.form-row input, .form-row select, .form-row textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-bright);
  font-family: var(--font);
  font-size: 0.85rem;
  padding: 8px 12px;
  outline: none;
  transition: border-color 0.25s, box-shadow 0.25s;
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(139,92,246,0.1);
}
.form-row select { cursor: pointer; }
.form-row textarea { resize: vertical; min-height: 48px; }
.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 10px 20px;
  cursor: pointer;
  transition: opacity 0.2s, box-shadow 0.2s;
  font-family: var(--font);
}
.btn-primary:hover {
  opacity: 0.9;
  box-shadow: 0 0 16px rgba(139,92,246,0.3);
}
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.form-msg { font-size: 0.8rem; margin-top: 4px; }
.form-msg--success { color: #22c55e; }
.form-msg--error { color: #ef4444; }

/* --- Empty State --- */
.empty-guidance {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 8px 0 16px;
  line-height: 1.5;
}
.empty-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: center;
}
.btn-submit-cta {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 16px;
  cursor: pointer;
  font-family: var(--font);
  transition: opacity 0.2s, box-shadow 0.2s;
}
.btn-submit-cta:hover {
  opacity: 0.9;
  box-shadow: 0 0 12px rgba(139,92,246,0.2);
}
.dropdown-submit-link {
  color: var(--primary);
  font-weight: 500;
  font-size: 0.78rem;
  display: inline-block;
  margin-top: 4px;
}

/* --- Footer Disclaimer --- */
.footer-disclaimer {
  font-size: 0.68rem;
  color: rgba(139,133,166,0.6);
  margin-top: 8px;
  line-height: 1.5;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}
.footer-disclaimer a { color: rgba(139,133,166,0.8); }
.footer-disclaimer a:hover { color: var(--primary); }

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* --- Responsive --- */
@media (max-width: 768px) {
  :root { --header-h: 82px; }
  #topbar { font-size: 0.62rem; padding: 6px 12px; }
  body { padding-top: 28px; }
  #header { top: 28px; }
  #hero { padding: 36px 20px 28px; }
  .hero-title { font-size: clamp(1.6rem, 5vw, 2.2rem); }
  .hero-subtitle { font-size: 0.95rem; margin-bottom: 20px; }
  .hero-headline-stat { margin-bottom: 20px; }
  .ring-gauge { width: 150px; height: 150px; }
  .ring-value { font-size: 2.1rem; }
  .headline-stat-text { font-size: 0.78rem; }
  .stat-cards { max-width: 100%; }
  .stat-card-value { font-size: 1.3rem; }
  .stat-card { padding: 12px 10px 10px; }
  .header-title { display: none; }
  .detail-summary { gap: 6px; }
  .summary-card { padding: 14px 8px; }
  .summary-card-value { font-size: 1.5rem; }
  .agency-meta { flex-wrap: wrap; gap: 8px; }
  .lb-name { width: 80px; font-size: 0.68rem; }
  .detail-nav { gap: 8px; }
  .heatmap-tooltip { display: none; }
  .heatmap-gradient { width: 140px; }
}

@media (max-width: 480px) {
  .hero-title { font-size: clamp(1.4rem, 7vw, 1.8rem); }
  .stat-card-value { font-size: 1.1rem; }
  .stat-cards { gap: 8px; }
  .detail-summary { grid-template-columns: 1fr; }
  .search-kbd { display: none; }
  .search-wrap--hero .search-input { font-size: 0.95rem; padding: 12px 16px 12px 42px; }
  .lb-name { width: 60px; font-size: 0.65rem; }
  .lb-total { display: none; }
  .lb-row { gap: 6px; padding: 2px 6px; }
  .skeleton-summary { grid-template-columns: 1fr; }
}
