/* ===== Theme ===== */
/* American Bankers Association brand palette */
:root {
  --aba-blue: #155897;
  --aba-blue-bright: #0060b9;
  --aba-navy: #0b3052;
  --aba-gold: #ecb84c;
}

:root {
  --bg: #121920;
  --chrome: #171f28;
  --chrome-border: #232d3a;
  --surface: #1c2530;
  --surface-hover: #222d3a;
  --text: #c8cfd8;
  --text-heading: #eef1f4;
  --text-muted: #a3aeb9;
  --text-dim: #8494a4;
  --accent: #c8cfd8;
  --number: #eef1f4;
  --scrollbar: rgba(255, 255, 255, 0.08);
  --focus-ring: rgba(116, 169, 216, 0.35);
  --float-shadow: 0 14px 34px rgba(8, 15, 23, 0.2);
  --panel-shadow: -18px 0 44px rgba(8, 15, 23, 0.22);
  --card-shadow: 0 10px 24px rgba(8, 15, 23, 0.12);
  --accent-fill: #16324e;
  --accent-border: #2f679c;
  --accent-text: #dcebf8;
  --viewport-height: 100vh;
  --header-height: 48px;
  --scenario-bar-top: 48px;
  --search-top: 96px;
  --map-top: 140px;
  --map-bottom: 40px;
  --legend-bottom: 50px;
  --back-button-top: 152px;
  --info-panel-bottom: 40px;
  --mobile-panel-max-height: 360px;
  --mobile-panel-peek-height: 88px;
  --safe-area-top: env(safe-area-inset-top, 0px);
  --safe-area-right: env(safe-area-inset-right, 0px);
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
  --safe-area-left: env(safe-area-inset-left, 0px);
}

[data-theme="light"] {
  --bg: #e8ecf0;
  --chrome: #ffffff;
  --chrome-border: #d5dbe2;
  --surface: #f3f5f7;
  --surface-hover: #ebeef1;
  --text: #3d4854;
  --text-heading: #1a2028;
  --text-muted: #475563;
  --text-dim: #647280;
  --accent: #3d4854;
  --number: #1a2028;
  --scrollbar: rgba(0, 0, 0, 0.1);
  --focus-ring: rgba(21, 88, 151, 0.22);
  --float-shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
  --panel-shadow: -18px 0 44px rgba(15, 23, 42, 0.12);
  --card-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  --accent-fill: #e6eef7;
  --accent-border: #9cbcdb;
  --accent-text: #113e6a;
}

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

body {
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  min-height: 100vh;
  height: var(--viewport-height);
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

a {
  touch-action: manipulation;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--focus-ring);
}

/* ===== Header ===== */
#header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
  padding: 0 20px;
  background: color-mix(in srgb, var(--chrome) 94%, transparent);
  border-bottom: 1px solid var(--chrome-border);
  backdrop-filter: blur(14px);
  box-shadow: 0 10px 24px rgba(8, 15, 23, 0.08);
}

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

#header-brand {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  border-radius: 4px;
}

.aba-logo {
  display: block;
  height: 26px;
  width: auto;
}

/* Swap logo art with the active theme (default chrome is dark) */
.aba-logo-light {
  display: none;
}

[data-theme="light"] .aba-logo-light {
  display: block;
}

[data-theme="light"] .aba-logo-dark {
  display: none;
}

.header-divider {
  width: 1px;
  height: 22px;
  background: var(--chrome-border);
  flex-shrink: 0;
}

.header-title-group {
  min-width: 0;
}

.header-left h1 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-heading);
  letter-spacing: -0.2px;
  white-space: nowrap;
}

.header-left .subtitle {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 400;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ===== Theme Toggle ===== */
#theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: transparent;
  border: 1px solid var(--chrome-border);
  border-radius: 4px;
  color: var(--text-dim);
  transition: all 0.15s;
}

#theme-toggle:hover {
  color: var(--text);
  border-color: var(--text-dim);
}

/* ===== Scenario Bar ===== */
#scenario-bar {
  position: fixed;
  top: var(--scenario-bar-top);
  left: 0;
  right: 0;
  z-index: 999;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 20px;
  background: color-mix(in srgb, var(--chrome) 94%, transparent);
  border-bottom: 1px solid var(--chrome-border);
  backdrop-filter: blur(14px);
  box-shadow: 0 12px 24px rgba(8, 15, 23, 0.08);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}

#scenario-bar::-webkit-scrollbar {
  display: none;
}

.control-section[hidden],
#data-notes-btn[hidden],
.scenario-meta-btn[hidden] {
  display: none !important;
}

.control-section {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.control-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--chrome-border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.control-group-view {
  background: color-mix(in srgb, var(--surface-hover) 80%, transparent);
}

.scenario-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  white-space: nowrap;
  margin-right: 0;
}

.scenario-context {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-right: 4px;
}

.scenario-context-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border: 1px solid var(--chrome-border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  color: var(--text-muted);
  font-size: 11px;
  white-space: nowrap;
}

.scenario-context-chip strong {
  color: var(--text-heading);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.45px;
  text-transform: uppercase;
}

.scenario-pill {
  padding: 4px 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.15s;
}

.scenario-pill:hover:not(:disabled) {
  color: var(--text);
  border-color: color-mix(in srgb, var(--text-dim) 60%, transparent);
  background: color-mix(in srgb, var(--surface-hover) 72%, transparent);
}

.scenario-pill:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.scenario-pill.active {
  background: var(--accent-fill);
  border-color: var(--accent-border);
  color: var(--accent-text);
}

.scenario-meta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-left: auto;
  padding: 3px 10px;
  border: 1px solid var(--chrome-border);
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.15s;
}

.scenario-meta-btn svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.scenario-meta-btn:hover:not(:disabled) {
  color: var(--text-heading);
  border-color: var(--text-dim);
  background: var(--surface-hover);
}

.scenario-meta-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

[data-theme="light"] .scenario-pill.active {
  background: var(--accent-fill);
  border-color: var(--accent-border);
  color: var(--accent-text);
}

[data-theme="light"] .party-text-R {
  color: #b91c1c;
}
[data-theme="light"] .party-text-D {
  color: #1d4ed8;
}
[data-theme="light"] .party-R {
  background: rgba(185, 28, 28, 0.08);
  color: #b91c1c;
}
[data-theme="light"] .party-D {
  background: rgba(29, 78, 216, 0.08);
  color: #1d4ed8;
}
[data-theme="light"] .party-I {
  background: rgba(126, 34, 206, 0.08);
  color: #7e22ce;
}

/* ===== Search ===== */
#search-container {
  position: fixed;
  top: var(--search-top);
  left: 16px;
  z-index: 1000;
  width: min(360px, calc(100vw - 32px));
}

#search-container::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 14px;
  z-index: 1;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  opacity: 0.58;
  pointer-events: none;
  background:
    center / 16px 16px no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23788496' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='m21 21-4.35-4.35m1.85-5.15a7 7 0 1 1-14 0 7 7 0 0 1 14 0Z'/%3E%3C/svg%3E");
}

#search-input {
  width: 100%;
  padding: 10px 14px 10px 40px;
  border: 1px solid var(--chrome-border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--chrome) 92%, transparent);
  color: var(--text);
  font-size: 13px;
  outline: none;
  box-shadow: var(--float-shadow);
  backdrop-filter: blur(12px);
  transition:
    border-color 0.15s,
    box-shadow 0.15s,
    background 0.15s;
}

#search-input::placeholder {
  color: var(--text-dim);
}
#search-input:focus {
  border-color: var(--text-muted);
  box-shadow:
    var(--float-shadow),
    0 0 0 4px var(--focus-ring);
}

#search-results {
  margin-top: 8px;
  background: color-mix(in srgb, var(--chrome) 95%, transparent);
  border: 1px solid var(--chrome-border);
  border-radius: 14px;
  overflow: hidden;
  max-height: 300px;
  overflow-y: auto;
  display: none;
  box-shadow: var(--float-shadow);
  backdrop-filter: blur(14px);
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.search-result-item {
  display: block;
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: transparent;
  text-align: left;
  border-bottom: 1px solid var(--chrome-border);
  transition: background 0.1s;
  color: var(--text);
}

.search-result-item:last-child {
  border-bottom: none;
}
.search-result-item:hover {
  background: var(--surface-hover);
}

.search-result-item .result-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-heading);
}

.search-result-item .result-subtitle {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 1px;
}

/* ===== Map ===== */
#map {
  position: fixed;
  top: var(--map-top);
  left: 0;
  right: 0;
  bottom: var(--map-bottom);
  z-index: 1;
  background: var(--bg);
}

.leaflet-container {
  background: var(--bg) !important;
}

#map-loading[hidden] {
  display: none;
}

#map-loading {
  position: fixed;
  top: var(--map-top);
  right: 0;
  bottom: var(--map-bottom);
  left: 0;
  z-index: 1050;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 16px;
  pointer-events: none;
}

.map-loading-card {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(100%, 360px);
  padding: 10px 14px;
  border: 1px solid var(--chrome-border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--chrome) 92%, transparent);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.18);
  backdrop-filter: blur(12px);
}

#map-loading[data-variant="compact"] .map-loading-card {
  width: auto;
  max-width: min(100%, 260px);
  padding: 8px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--chrome) 86%, transparent);
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.14);
}

#map-hint {
  position: fixed;
  top: calc(var(--map-top) + 16px);
  left: 50%;
  z-index: 1040;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: min(560px, calc(100vw - 32px));
  padding: 10px 14px;
  border: 1px solid color-mix(in srgb, var(--accent-border) 74%, var(--chrome-border));
  border-radius: 999px;
  background: color-mix(in srgb, var(--chrome) 92%, transparent);
  box-shadow: var(--float-shadow);
  backdrop-filter: blur(14px);
  color: var(--text-heading);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  transform: translateX(-50%);
  opacity: 1;
  pointer-events: none;
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
}

#map-hint.hidden {
  display: none;
}

#map-hint svg {
  flex-shrink: 0;
  opacity: 0.72;
}

#map-hint.map-hint-hiding {
  opacity: 0;
  transform: translateX(-50%) translateY(-6px);
}

#map-loading[data-variant="compact"] .map-loading-label {
  display: none;
}

.map-loading-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--chrome-border);
  border-top-color: var(--text-muted);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

.map-loading-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.map-loading-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.95px;
  text-transform: uppercase;
  color: var(--text-dim);
}

#map-loading-message {
  font-size: 12px;
  line-height: 1.35;
  color: var(--text-heading);
}

#map-loading[data-variant="compact"] #map-loading-message {
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
}

.leaflet-top.leaflet-left {
  top: 12px;
}

.leaflet-control-zoom {
  border: none !important;
  margin: 12px !important;
}

.leaflet-control-zoom a {
  background: var(--chrome) !important;
  color: var(--text-muted) !important;
  border: 1px solid var(--chrome-border) !important;
  width: 28px !important;
  height: 28px !important;
  line-height: 28px !important;
  font-size: 14px !important;
  border-radius: 3px !important;
}

.leaflet-control-zoom a:hover {
  color: var(--text-heading) !important;
  background: var(--surface-hover) !important;
}

.leaflet-interactive:focus {
  outline: none;
}

/* ===== Info Panel ===== */
#info-panel {
  position: fixed;
  top: var(--map-top);
  right: 0;
  bottom: var(--info-panel-bottom);
  z-index: 1000;
  width: clamp(336px, 28vw, 392px);
  overflow-y: auto;
  background: color-mix(in srgb, var(--chrome) 96%, transparent);
  border-left: 1px solid var(--chrome-border);
  padding: 22px 22px 24px;
  box-shadow: var(--panel-shadow);
  backdrop-filter: blur(14px);
  transition:
    transform 0.2s ease,
    opacity 0.2s ease;
}

#info-panel.hidden {
  transform: translateX(100%);
  opacity: 0;
  pointer-events: none;
}

#data-notes-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1400;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: calc(var(--map-top) - 20px) 20px calc(var(--map-bottom) + 32px);
  background: rgba(6, 10, 14, 0.58);
  backdrop-filter: blur(4px);
}

#data-notes-backdrop.hidden {
  display: none;
}

#data-notes-panel {
  position: relative;
  width: min(720px, 100%);
  max-height: 100%;
  overflow-y: auto;
  background: var(--chrome);
  border: 1px solid var(--chrome-border);
  border-radius: 10px;
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.35);
  padding: 24px 24px 20px;
}

#close-data-notes {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-dim);
  font-size: 20px;
  line-height: 1;
}

#close-data-notes:hover {
  color: var(--text-heading);
  background: var(--surface-hover);
}

.notes-header {
  padding-right: 28px;
  margin-bottom: 18px;
}

.notes-kicker {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.1px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.notes-header h2 {
  font-size: 24px;
  line-height: 1.15;
  letter-spacing: -0.4px;
  color: var(--text-heading);
}

.notes-intro {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-muted);
}

.notes-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0 20px;
}

.notes-meta-card {
  padding: 12px 14px;
  border: 1px solid var(--chrome-border);
  border-radius: 8px;
  background: var(--surface);
}

.notes-meta-card .label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.notes-meta-card .value {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-heading);
}

.notes-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  margin: 20px 0 10px;
}

.notes-grid {
  display: grid;
  gap: 12px;
}

.notes-card {
  padding: 14px 15px;
  border: 1px solid var(--chrome-border);
  border-radius: 8px;
  background: var(--surface);
}

.notes-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}

.notes-card-header h3 {
  font-size: 15px;
  color: var(--text-heading);
}

.notes-card-header .notes-chip {
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(95, 151, 205, 0.16);
  color: #a7c8e8;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  white-space: nowrap;
}

[data-theme="light"] .notes-card-header .notes-chip {
  background: rgba(21, 88, 151, 0.1);
  color: var(--aba-blue);
}

.notes-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-muted);
}

.notes-row .term {
  color: var(--text-dim);
  font-weight: 600;
}

.notes-row .value {
  color: var(--text);
}

.notes-assumption {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--chrome-border);
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
}

#close-panel {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--surface);
  border: 1px solid var(--chrome-border);
  color: var(--text-dim);
  font-size: 18px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  transition:
    color 0.1s,
    border-color 0.1s,
    background 0.1s;
}

#close-panel:hover {
  color: var(--text-heading);
  border-color: var(--text-muted);
  background: var(--surface-hover);
}

#panel-peek-toggle {
  position: absolute;
  top: 8px;
  left: 50%;
  z-index: 2;
  display: none;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: transparent;
  transform: translateX(-50%);
  touch-action: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#panel-peek-toggle::before {
  content: "";
  width: 42px;
  height: 4px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text-dim) 30%, transparent);
  transition: background 0.15s ease;
}

#panel-peek-toggle:hover::before {
  background: color-mix(in srgb, var(--text-dim) 48%, transparent);
}

.panel-header {
  margin-bottom: 18px;
  padding-right: 42px;
}

.panel-header .panel-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.panel-header h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1.2;
  letter-spacing: -0.3px;
}

.panel-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin: 0 0 16px;
  padding: 18px 16px;
  border: 1px solid var(--chrome-border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  box-shadow: var(--card-shadow);
}

.panel-stat .big-number {
  display: block;
  font-size: 36px;
  font-weight: 700;
  color: var(--number);
  letter-spacing: -1px;
  line-height: 1;
}

.panel-stat .stat-desc {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.45;
}

.panel-members {
  margin-top: 16px;
}

.panel-members h3 {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.member-card {
  padding: 12px 14px;
  margin-bottom: 8px;
  border: 1px solid var(--chrome-border);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border-radius: 12px;
  box-shadow: var(--card-shadow);
}

.member-card:last-child {
  margin-bottom: 0;
}

.member-card .member-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-heading);
}

.member-card .member-detail {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
  line-height: 1.45;
}

.party-badge {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 2px;
  font-size: 10px;
  font-weight: 700;
  margin-left: 4px;
  letter-spacing: 0.3px;
}

.party-R {
  background: rgba(220, 50, 50, 0.15);
  color: #ef5555;
}
.party-D {
  background: rgba(60, 130, 240, 0.15);
  color: #5b9cf5;
}
.party-I {
  background: rgba(160, 80, 240, 0.15);
  color: #b480f0;
}

.party-text-R {
  color: #ef5555;
}
.party-text-D {
  color: #5b9cf5;
}

.panel-margin {
  font-size: 13px;
  font-weight: 700;
  margin-left: 4px;
}

.panel-election {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 0 16px;
  padding: 10px 12px;
  border: 1px solid var(--chrome-border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  line-height: 1.45;
}

.panel-compare-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin: 0 0 16px;
}

.panel-compare-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 12px 11px;
  border: 1px solid var(--chrome-border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  box-shadow: var(--card-shadow);
}

.panel-compare-card .compare-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-dim);
}

.panel-compare-card .compare-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-heading);
  font-variant-numeric: tabular-nums;
}

.tooltip-margin {
  font-size: 11px;
  font-weight: 700;
  margin-left: 4px;
}

.tooltip-compare {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.tooltip-delta {
  font-size: 11px;
  font-weight: 600;
  color: #c6a8ff;
  margin-top: 1px;
}

.tone-positive {
  color: #c6a8ff;
}

.tone-negative {
  color: #f4b27a;
}

.tone-neutral {
  color: var(--text-muted);
}

[data-theme="light"] .tooltip-delta {
  color: #6d28d9;
}

[data-theme="light"] .tone-positive {
  color: #6d28d9;
}

[data-theme="light"] .tone-negative {
  color: #c2410c;
}

.panel-delta {
  font-size: 12px;
  font-weight: 600;
  color: #c6a8ff;
  margin: -8px 0 12px;
  padding: 6px 10px;
  background: rgba(109, 40, 217, 0.14);
  border-radius: 3px;
  border-left: 3px solid #8b5cf6;
}

[data-theme="light"] .panel-delta {
  color: #6d28d9;
  background: #f3e8ff;
  border-left-color: #a78bfa;
}

/* ===== District Print Controls ===== */
.panel-print-card {
  margin: -2px 0 16px;
  padding: 12px;
  border: 1px solid var(--chrome-border);
  border-radius: 8px;
  background: var(--surface);
}

.panel-print-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.panel-print-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-dim);
}

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

.print-mode-group {
  display: flex;
  gap: 6px;
}

.print-mode-pill {
  flex: 1 1 0;
  min-height: 34px;
  padding: 8px 10px;
  border: 1px solid var(--chrome-border);
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  transition: all 0.15s;
}

.print-mode-pill:hover {
  border-color: var(--text-dim);
  background: var(--surface-hover);
  color: var(--text-heading);
}

.print-mode-pill.active {
  background: var(--chrome);
  border-color: var(--aba-blue-bright);
  color: var(--text-heading);
}

/* ===== Download PDF ===== */
.download-pdf-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 8px 14px;
  margin-top: 16px;
  background: transparent;
  border: 1px solid var(--chrome-border);
  border-radius: 3px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  transition: all 0.15s;
}

.panel-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 42px;
  padding: 8px 14px;
  margin-top: 14px;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  border: 1px solid var(--chrome-border);
  border-radius: 10px;
  color: var(--text-heading);
  font-size: 12px;
  font-weight: 600;
  transition: all 0.15s;
}

.download-pdf-btn:hover {
  background: var(--surface-hover);
  color: var(--text-heading);
  border-color: var(--text-dim);
}

.panel-action-btn:hover {
  background: var(--surface-hover);
  border-color: var(--text-dim);
}

.download-pdf-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.download-pdf-btn svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}
.download-pdf-btn svg.spin {
  animation: spin 0.8s linear infinite;
}

.panel-print-card .download-pdf-btn {
  margin-top: 10px;
}

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

/* ===== ZIP Loading Spinner ===== */
.zip-loading {
  display: flex;
  align-items: center;
  gap: 8px;
}

.zip-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid var(--chrome-border);
  border-top-color: var(--text-muted);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

/* ===== District List ===== */
.district-list {
  margin-top: 20px;
}

.district-list h3 {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.district-zip-list {
  margin-top: 18px;
}

.zip-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 1px solid var(--chrome-border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  font-size: 11px;
  color: var(--text-dim);
}

.zip-list {
  display: flex;
  flex-direction: column;
}

.zip-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
  border: 1px solid var(--chrome-border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  box-shadow: var(--card-shadow);
}

.zip-row:last-child {
  margin-bottom: 0;
}

.zip-row-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-heading);
  font-variant-numeric: tabular-nums;
}

.zip-row-value {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-heading);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.zip-row-meta {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-dim);
  line-height: 1.35;
}

.district-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 8px;
  border: 1px solid var(--chrome-border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  text-align: left;
  transition:
    background 0.12s,
    border-color 0.12s,
    transform 0.12s,
    box-shadow 0.12s;
  box-shadow: var(--card-shadow);
}

.district-row:hover {
  background: var(--surface-hover);
  border-color: color-mix(in srgb, var(--text-dim) 56%, var(--chrome-border));
  transform: translateY(-1px);
}

.district-row .dist-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-heading);
  font-variant-numeric: tabular-nums;
}

.district-row .dist-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-heading);
  font-variant-numeric: tabular-nums;
}

.district-row .dist-rep {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
  line-height: 1.4;
}

/* ===== Legend ===== */
#legend {
  position: fixed;
  bottom: var(--legend-bottom);
  left: 16px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  background: color-mix(in srgb, var(--chrome) 95%, transparent);
  border: 1px solid var(--chrome-border);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: var(--float-shadow);
  backdrop-filter: blur(14px);
}

#legend-body {
  display: block;
}

#legend-toggle {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 32px;
  width: 100%;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-heading);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-align: left;
}

#legend-toggle svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--text-dim);
  transition: transform 0.15s ease;
}

#legend.legend-collapsible #legend-toggle:not([hidden]) {
  display: inline-flex;
}

#legend.legend-collapsible:not(.legend-collapsed) #legend-toggle svg {
  transform: rotate(180deg);
}

#legend.legend-collapsible.legend-collapsed {
  padding: 8px 10px;
}

#legend.legend-collapsible.legend-collapsed #legend-body {
  display: none;
}

#legend h4 {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

#legend-context:empty {
  display: none;
}

#legend-context {
  font-size: 11px;
  line-height: 1.45;
  color: var(--text-muted);
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--chrome-border);
  max-width: 220px;
}

.legend-item {
  display: flex;
  align-items: center;
  margin-bottom: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

.legend-item:last-child {
  margin-bottom: 0;
}

.legend-header {
  display: flex;
  gap: 0;
  margin-bottom: 4px;
  font-size: 9px;
  font-weight: 700;
}

.legend-header .legend-r {
  width: 14px;
  text-align: center;
  color: #ef5555;
}

.legend-header .legend-d {
  width: 14px;
  text-align: center;
  color: #5b9cf5;
  margin-right: 6px;
}

.legend-header-single {
  margin-bottom: 6px;
}

.legend-header-single .legend-r,
.legend-header-single .legend-d {
  width: auto;
  margin-right: 0;
}

.legend-color {
  width: 16px;
  height: 10px;
  border-radius: 999px;
  flex-shrink: 0;
}

.legend-color + .legend-color {
  margin-right: 6px;
}

.legend-item-single .legend-color-single {
  margin-right: 8px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  margin-right: 10px;
  flex-shrink: 0;
}

/* ===== Back Button ===== */
#back-btn {
  position: fixed;
  top: var(--back-button-top);
  left: 50%;
  transform: translateX(-50%);
  z-index: 1100;
  min-height: 36px;
  padding: 7px 16px;
  background: color-mix(in srgb, var(--chrome) 94%, transparent);
  border: 1px solid var(--chrome-border);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition:
    color 0.15s,
    border-color 0.15s,
    background 0.15s,
    box-shadow 0.15s;
  box-shadow: var(--float-shadow);
  backdrop-filter: blur(14px);
}

#back-btn:hover {
  color: var(--text-heading);
  border-color: var(--text-dim);
  background: color-mix(in srgb, var(--surface-hover) 88%, transparent);
}
#back-btn.hidden {
  display: none;
}

/* ===== Stats Bar ===== */
#stats-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  justify-content: flex-start;
  gap: 0;
  padding: 0 18px;
  height: 48px;
  align-items: center;
  background: color-mix(in srgb, var(--chrome) 94%, transparent);
  border-top: 1px solid var(--chrome-border);
  backdrop-filter: blur(14px);
}

.stat {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  padding-right: 18px;
  margin-right: 18px;
  border-right: 1px solid var(--chrome-border);
}

.stat:last-child {
  padding-right: 0;
  margin-right: 0;
  border-right: none;
}

.stat-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-heading);
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ===== Tooltips ===== */
.leaflet-tooltip {
  background: var(--chrome) !important;
  border: 1px solid var(--chrome-border) !important;
  border-radius: 3px !important;
  color: var(--text) !important;
  font-family: "Inter", sans-serif !important;
  font-size: 12px !important;
  padding: 8px 10px !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}

.leaflet-tooltip::before {
  border-top-color: var(--chrome) !important;
}

.tooltip-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-heading);
  margin-bottom: 2px;
}

.tooltip-count {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-heading);
}

.tooltip-member {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}

/* ===== Scrollbar ===== */
#info-panel::-webkit-scrollbar,
#data-notes-panel::-webkit-scrollbar,
#search-results::-webkit-scrollbar {
  width: 4px;
}

#info-panel::-webkit-scrollbar-track,
#data-notes-panel::-webkit-scrollbar-track,
#search-results::-webkit-scrollbar-track {
  background: transparent;
}

#info-panel::-webkit-scrollbar-thumb,
#data-notes-panel::-webkit-scrollbar-thumb,
#search-results::-webkit-scrollbar-thumb {
  background: var(--scrollbar);
  border-radius: 2px;
}

/* ===== Responsive ===== */
@media (max-width: 768px), (hover: none) and (pointer: coarse) and (max-height: 500px) {
  #header {
    flex-wrap: wrap;
    gap: 8px;
    height: auto;
    padding:
      calc(10px + var(--safe-area-top))
      calc(16px + var(--safe-area-right))
      10px
      calc(16px + var(--safe-area-left));
  }
  .header-left .subtitle {
    display: block;
    margin-left: 0;
    margin-top: 1px;
  }

  #scenario-bar {
    padding:
      8px
      calc(12px + var(--safe-area-right))
      8px
      calc(12px + var(--safe-area-left));
    gap: 8px;
  }

  .control-section {
    gap: 6px;
  }

  .control-group {
    gap: 4px;
    padding: 3px;
  }

  #search-container {
    left: calc(12px + var(--safe-area-left));
    right: calc(12px + var(--safe-area-right));
    width: auto;
  }

  #search-input {
    min-height: 44px;
    padding-top: 12px;
    padding-bottom: 12px;
    font-size: 16px;
    border-radius: 14px;
  }

  #search-results {
    margin-top: 10px;
    max-height: min(320px, calc(var(--viewport-height) - var(--search-top) - 28px));
  }

  .search-result-item {
    min-height: 52px;
    padding: 12px 14px;
  }

  .search-result-item .result-title {
    font-size: 14px;
  }

  .search-result-item .result-subtitle {
    font-size: 12px;
    margin-top: 2px;
  }

  .scenario-pill,
  .scenario-meta-btn {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0 12px;
  }

  .leaflet-top.leaflet-left {
    left: auto;
    right: 0;
  }

  .leaflet-control-zoom a {
    width: 32px !important;
    height: 32px !important;
    line-height: 32px !important;
    font-size: 16px !important;
  }

  #data-notes-backdrop {
    padding:
      calc(var(--map-top) - 16px)
      calc(12px + var(--safe-area-right))
      calc(var(--map-bottom) + 12px)
      calc(12px + var(--safe-area-left));
  }

  #data-notes-panel {
    padding: 20px 16px 16px;
  }

  .notes-meta {
    grid-template-columns: 1fr;
  }

  .panel-compare-grid {
    grid-template-columns: 1fr;
  }

  .scenario-context {
    display: none;
  }

  #legend {
    left: calc(12px + var(--safe-area-left));
    max-width: min(
      220px,
      calc(100vw - var(--safe-area-left) - var(--safe-area-right) - 24px)
    );
    padding: 10px 12px;
  }

  #legend.legend-collapsible.legend-collapsed {
    max-width: min(
      116px,
      calc(100vw - var(--safe-area-left) - var(--safe-area-right) - 24px)
    );
    padding: 7px 10px;
  }

  #map-hint {
    top: calc(var(--map-top) + 12px);
    max-width: calc(100vw - 20px);
    padding: 9px 12px;
    font-size: 11px;
  }

  body.panel-open:not(.panel-peek) .leaflet-top.leaflet-left {
    opacity: 0;
    pointer-events: none;
  }

  #info-panel {
    top: auto;
    bottom: var(--info-panel-bottom);
    right: 0;
    left: 0;
    width: 100%;
    max-height: var(--mobile-panel-max-height);
    border-left: none;
    border-top: 1px solid var(--chrome-border);
    border-top-left-radius: 14px;
    border-top-right-radius: 14px;
    box-shadow: 0 -16px 36px rgba(0, 0, 0, 0.3);
    padding:
      34px
      calc(16px + var(--safe-area-right))
      calc(20px + var(--safe-area-bottom))
      calc(16px + var(--safe-area-left));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    scroll-padding-top: 56px;
  }

  #panel-peek-toggle:not([hidden]) {
    display: inline-flex;
  }

  #info-panel.peek {
    transform: translateY(calc(100% - var(--mobile-panel-peek-height)));
    overflow: hidden;
    overscroll-behavior: none;
  }

  #info-panel.dragging {
    transition: none;
  }

  #info-panel.hidden {
    transform: translateY(calc(100% + 24px));
  }

  #info-panel.peek #panel-content {
    pointer-events: none;
  }

  body.panel-open:not(.panel-peek) #legend {
    opacity: 0;
    pointer-events: none;
  }

  #close-panel {
    top: 14px;
    right: calc(12px + var(--safe-area-right));
    width: 36px;
    height: 36px;
    font-size: 22px;
    background: var(--surface);
    border: 1px solid var(--chrome-border);
    border-radius: 999px;
    color: var(--text-muted);
  }

  .panel-header {
    padding-right: 44px;
  }

  #back-btn {
    top: calc(var(--map-top) + 12px);
    bottom: auto;
    left: calc(12px + var(--safe-area-left));
    transform: none;
    min-height: 40px;
    padding: 0 14px;
  }

  #stats-bar {
    gap: 8px;
    height: auto;
    min-height: 64px;
    padding:
      8px
      calc(10px + var(--safe-area-right))
      calc(10px + var(--safe-area-bottom))
      calc(10px + var(--safe-area-left));
    align-items: stretch;
  }

  .stat {
    flex: 1 1 0;
    min-width: 0;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    padding-right: 0;
    margin-right: 0;
    border-right: none;
  }

  .stat-value {
    font-size: 15px;
    line-height: 1;
  }

  .stat-label {
    font-size: 9px;
    line-height: 1.15;
    letter-spacing: 0.35px;
    white-space: normal;
  }

  .district-row {
    min-height: 52px;
    padding: 11px 12px;
    align-items: flex-start;
  }

  .download-pdf-btn {
    min-height: 44px;
  }

  .panel-print-header,
  .print-mode-group {
    flex-direction: column;
  }

  .print-mode-pill {
    width: 100%;
  }
}

@media (max-width: 560px), (hover: none) and (pointer: coarse) and (max-height: 430px) {
  #header {
    padding:
      calc(8px + var(--safe-area-top))
      calc(12px + var(--safe-area-right))
      8px
      calc(12px + var(--safe-area-left));
  }

  .header-left {
    gap: 8px;
  }

  /* Compact brand: crop the lockup to the "aba" ribbon mark on phones */
  .aba-logo {
    width: 55px;
    height: 24px;
    object-fit: cover;
    object-position: left center;
  }

  .header-left h1 {
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .header-left .subtitle {
    display: none;
  }

  .scenario-label {
    display: inline-flex;
  }

  .scenario-meta-btn {
    margin-left: auto;
  }

  #scenario-bar {
    flex-wrap: wrap;
    overflow-x: visible;
    padding:
      6px
      calc(10px + var(--safe-area-right))
      8px
      calc(10px + var(--safe-area-left));
    row-gap: 6px;
  }

  .scenario-pill,
  .scenario-meta-btn {
    min-height: 36px;
    padding: 0 10px;
    font-size: 11px;
  }

  .control-section {
    gap: 5px;
  }

  .control-group {
    flex-wrap: wrap;
  }

  .map-loading-card {
    width: min(100%, 320px);
    padding: 9px 12px;
  }

  #map-loading[data-variant="compact"] .map-loading-card {
    max-width: min(100%, 220px);
    padding: 8px 10px;
  }

  #legend {
    max-width: min(
      168px,
      calc(100vw - var(--safe-area-left) - var(--safe-area-right) - 20px)
    );
  }

  #legend.legend-collapsible.legend-collapsed {
    max-width: min(
      108px,
      calc(100vw - var(--safe-area-left) - var(--safe-area-right) - 20px)
    );
  }

  .notes-card-header {
    flex-direction: column;
  }

  #back-btn {
    font-size: 11px;
    top: calc(var(--map-top) + 10px);
  }

  #info-panel {
    padding:
      32px
      calc(14px + var(--safe-area-right))
      calc(18px + var(--safe-area-bottom))
      calc(14px + var(--safe-area-left));
  }

  #close-panel {
    top: 12px;
    right: calc(10px + var(--safe-area-right));
  }

  #stats-bar {
    min-height: 66px;
    padding:
      7px
      calc(8px + var(--safe-area-right))
      calc(12px + var(--safe-area-bottom))
      calc(8px + var(--safe-area-left));
  }

  .stat-value {
    font-size: 13px;
  }

  .stat-label {
    font-size: 8px;
  }

  .panel-header h2 {
    font-size: 20px;
  }

  .panel-stat .big-number {
    font-size: 30px;
  }

  .zip-summary {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .district-row .dist-count {
    font-size: 12px;
  }

  .zip-row {
    flex-direction: column;
  }

  .zip-row-value {
    align-items: flex-start;
    text-align: left;
  }
}

@media (hover: none) and (pointer: coarse) and (orientation: landscape) and (max-height: 500px) {
  :root {
    --landscape-touch-panel-width: min(320px, 40vw);
    --landscape-touch-search-width: max(
      152px,
      min(
        260px,
        28vw,
        calc(
          100vw - var(--safe-area-left) - var(--safe-area-right) -
            var(--landscape-touch-panel-width) - 180px - 24px
        )
      )
    );
  }

  #header {
    flex-wrap: nowrap;
    align-items: center;
    gap: 10px;
  }

  .header-left {
    min-width: 0;
  }

  .header-left .subtitle {
    display: none;
  }

  .header-right {
    flex-shrink: 0;
  }

  #scenario-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    row-gap: 0;
    padding:
      6px
      calc(12px + var(--safe-area-right))
      6px
      calc(12px + var(--safe-area-left));
  }

  .control-group {
    flex-wrap: nowrap;
  }

  #search-container {
    right: auto;
    width: var(--landscape-touch-search-width);
  }

  #legend {
    max-width: 200px;
  }

  #legend.legend-collapsible.legend-collapsed {
    max-width: 112px;
  }

  #info-panel {
    top: calc(var(--map-top) + 8px);
    right: calc(12px + var(--safe-area-right));
    bottom: calc(var(--info-panel-bottom) + 8px);
    left: auto;
    width: var(--landscape-touch-panel-width);
    max-height: none;
    border: 1px solid var(--chrome-border);
    border-radius: 16px;
    box-shadow: var(--float-shadow);
    padding:
      18px
      calc(16px + var(--safe-area-right))
      18px
      16px;
  }

  #panel-peek-toggle {
    display: none !important;
  }

  #info-panel.hidden {
    transform: translateX(calc(100% + 20px));
  }

  #back-btn {
    top: calc(var(--map-top) + 8px);
  }

  #stats-bar {
    min-height: 52px;
    padding:
      4px
      calc(12px + var(--safe-area-right))
      calc(6px + var(--safe-area-bottom))
      calc(12px + var(--safe-area-left));
  }

  .stat {
    align-items: center;
  }
}
