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

:root { color-scheme: light dark; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding: 1rem;
  max-width: 1200px;
  margin: 0 auto;
  background: light-dark(#fff, #1a1a1a);
  color: light-dark(#000, #e0e0e0);
}

h1 { margin-bottom: 0.5rem; }

nav { margin-bottom: 1rem; }
nav a { color: light-dark(#06c, #6cb4ff); text-decoration: none; }
nav a:hover { text-decoration: underline; }

#search {
  padding: 0.4rem 0.6rem;
  border: 1px solid light-dark(#ccc, #444);
  border-radius: 4px;
  width: 260px;
  font-size: 0.9rem;
  background: light-dark(#fff, #2a2a2a);
  color: light-dark(#000, #e0e0e0);
}

.filters {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-bottom: 0.8rem;
}
.region-filter {
  font-size: 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.region-filter .count {
  opacity: 0.45;
  font-size: 0.8rem;
}

.table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }

th {
  background: light-dark(#f0f0f0, #2a2a2a);
  cursor: pointer;
  padding: 0.5rem 0.6rem;
  text-align: right;
  white-space: nowrap;
  user-select: none;
  border-bottom: 2px solid light-dark(#ccc, #555);
}
th:first-child { text-align: left; }

td { padding: 0.4rem 0.6rem; text-align: right; border-bottom: 1px solid light-dark(#eee, #333); }
td:first-child { text-align: left; }

tr:hover { background: light-dark(#f7f7f7, #333); cursor: pointer; }

th .arrow { font-size: 0.7rem; margin-left: 2px; opacity: 0.3; }
th .arrow.active { opacity: 1; }
th:hover { background: light-dark(#e4e4e4, #3a3a3a); }

#stage-ctrl {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-left: 1rem;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  color: light-dark(#555, #aaa);
}
#stage-ctrl input[type="range"] { max-width: 150px; }
#stage-n-val { font-weight: 600; min-width: 3.5em; }
