/* grAte. Grade colours follow the cards in restaurant windows (blue A, green B, orange C),
   adjusted and checked so they stay apart for colour-blind readers and against both
   backgrounds. Letters always go with the colour, so it never carries meaning alone. */

:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --surface-2: #f3f1ec;
  --ink: #1d1f23;
  --ink-2: #545a63;
  --muted: #7c828b;
  --line: #e6e2da;
  --grade-a: #2f6fde;
  --grade-b: #17935a;
  --grade-c: #d4500f;
  --grade-p: #8a8f98;
  --grade-n: #c3c7cd;
  --bad: #c92a2a;
  --bad-bg: #fdecec;
  --warn: #9a5b00;
  --warn-bg: #fdf3e2;
  --good: #17784a;
  --good-bg: #e6f4ec;
  --focus: #2f6fde;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.06), 0 4px 16px rgb(0 0 0 / 0.08);
  --radius: 12px;
  --panel: 400px;
  color-scheme: light;
}

/* Dark: when the device is dark (unless light was picked), or when dark was picked */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14161a;
    --surface: #1c1f24;
    --surface-2: #23272d;
    --ink: #eceef1;
    --ink-2: #b2b8c1;
    --muted: #868c95;
    --line: #2e3239;
    --grade-a: #5a8ff0;
    --grade-b: #2fae6e;
    --grade-c: #e86a2a;
    --grade-p: #868c95;
    --grade-n: #4d525a;
    --bad: #ff7b7b;
    --bad-bg: #3a1d1f;
    --warn: #f0b056;
    --warn-bg: #36291a;
    --good: #5dd396;
    --good-bg: #183026;
    --focus: #7aa7f5;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 6px 20px rgb(0 0 0 / 0.35);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #14161a;
  --surface: #1c1f24;
  --surface-2: #23272d;
  --ink: #eceef1;
  --ink-2: #b2b8c1;
  --muted: #868c95;
  --line: #2e3239;
  --grade-a: #5a8ff0;
  --grade-b: #2fae6e;
  --grade-c: #e86a2a;
  --grade-p: #868c95;
  --grade-n: #4d525a;
  --bad: #ff7b7b;
  --bad-bg: #3a1d1f;
  --warn: #f0b056;
  --warn-bg: #36291a;
  --good: #5dd396;
  --good-bg: #183026;
  --focus: #7aa7f5;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 6px 20px rgb(0 0 0 / 0.35);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--grade-a);
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Layout ---------- */

.g-app {
  display: grid;
  grid-template-columns: var(--panel) 1fr;
  height: 100dvh;
}

.g-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--surface);
  border-right: 1px solid var(--line);
  z-index: 2;
}

.g-map-wrap {
  position: relative;
  min-height: 0;
}

.g-map {
  position: absolute;
  inset: 0;
  background: var(--surface-2);
}

/* ---------- Header ---------- */

.g-head {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 2px 12px;
  padding: 18px 20px 10px;
}

.g-logo {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  font-family: Fraunces, Georgia, serif;
  font-weight: 800;
  font-size: 34px;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}

.g-logo-card {
  display: inline-grid;
  place-items: center;
  width: 0.98em;
  height: 1.06em;
  margin: 0 2px;
  border-radius: 7px;
  background: var(--grade-a);
  color: #fff;
  font-size: 0.86em;
  transform: rotate(-4deg) translateY(-1px);
  box-shadow: 0 2px 0 rgb(0 0 0 / 0.12);
}

.g-tagline {
  grid-column: 1 / -1;
  margin: 4px 0 0;
  color: var(--ink-2);
  font-size: 14px;
}

.g-head-actions {
  grid-row: 1;
  grid-column: 2;
  display: flex;
  gap: 6px;
}

.g-icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.g-icon-btn:hover {
  background: var(--surface-2);
}

/* When the data was last refreshed, under the tagline */
.g-status {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 4px;
  margin: 6px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

.g-status[hidden] {
  display: none;
}

.g-status .g-link {
  font-size: 12.5px;
}

.g-status-dot {
  width: 7px;
  height: 7px;
  margin-right: 3px;
  border-radius: 50%;
  background: var(--good);
}

/* ---------- Search ---------- */

.g-search {
  display: flex;
  gap: 8px;
  padding: 6px 20px 10px;
}

.g-search input {
  flex: 1;
  min-width: 0;
  height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 15px;
}

.g-search input:focus {
  background: var(--surface);
  border-color: var(--focus);
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent);
}

.g-near {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 42px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: var(--ink);
  color: var(--surface);
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.g-near:hover {
  opacity: 0.9;
}

.g-near.busy svg {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Filters ---------- */

.g-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 0 20px 12px;
  border-bottom: 1px solid var(--line);
}

.g-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
}

.g-chip,
.g-more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.g-chip[aria-pressed="false"] {
  color: var(--muted);
  background: transparent;
  border-style: dashed;
}

.g-chip[aria-pressed="false"] .dot {
  opacity: 0.35;
}

.g-more[aria-expanded="true"] {
  background: var(--surface-2);
}

.g-count {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--ink);
  color: var(--surface);
  font-size: 11px;
  font-weight: 700;
}

.g-more-panel {
  flex-basis: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
  padding: 10px 0 2px;
}

.g-more-panel[hidden] {
  display: none;
}

.g-field {
  display: grid;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
}

.g-field select {
  height: 36px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  font-size: 14px;
  font-weight: 400;
  color: var(--ink);
}

.g-check {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 14px;
}

.g-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--ink);
}

.g-link {
  justify-self: start;
  border: 0;
  background: none;
  padding: 0;
  color: var(--grade-a);
  text-decoration: underline;
  cursor: pointer;
  font-size: 14px;
}

/* ---------- Dots and badges ---------- */

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: none;
}

.dot.a { background: var(--grade-a); }
.dot.b { background: var(--grade-b); }
.dot.c { background: var(--grade-c); }
.dot.p { background: var(--grade-p); }
.dot.n { background: var(--grade-n); }
.dot.closed {
  background: transparent;
  box-shadow: inset 0 0 0 2px var(--bad);
}

.g-badge {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 34px;
  border-radius: 6px;
  color: #fff;
  font-family: Fraunces, Georgia, serif;
  font-weight: 800;
  font-size: 19px;
  line-height: 1;
}

.g-badge.big {
  width: 64px;
  height: 72px;
  border-radius: 10px;
  font-size: 44px;
  box-shadow: 0 2px 0 rgb(0 0 0 / 0.12);
}

.g-A { background: var(--grade-a); }
.g-B { background: var(--grade-b); }
.g-C { background: var(--grade-c); }
.g-P { background: var(--grade-p); }
.g-N {
  background: transparent;
  color: var(--muted);
  box-shadow: inset 0 0 0 2px var(--grade-n);
}

/* ---------- Restaurants / Recent updates ---------- */

.g-tabs {
  display: flex;
  gap: 18px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
}

.g-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: -1px;
  padding: 10px 0 9px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}

.g-tabs button[aria-selected="true"] {
  border-bottom-color: var(--ink);
  color: var(--ink);
}

.g-tabs .g-count[hidden] {
  display: none;
}

.g-updates-intro {
  padding: 12px 20px 4px;
  font-size: 13px;
  color: var(--ink-2);
}

.g-updates-intro p {
  margin: 0 0 8px;
}

.g-update-day h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.g-update-day h3 span {
  font-weight: 400;
  color: var(--muted);
}

.g-item:disabled {
  cursor: default;
  opacity: 0.75;
}

.g-item:disabled:hover {
  background: none;
}

.g-updates-more {
  padding: 12px 20px 20px;
}

/* ---------- List ---------- */

.g-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.g-list-head {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 10px 20px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-2);
}

.g-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.g-item {
  display: flex;
  gap: 12px;
  width: 100%;
  padding: 12px 20px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  text-align: left;
  cursor: pointer;
}

.g-item:hover {
  background: var(--surface-2);
}

.g-item-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.g-item-name {
  font-weight: 600;
  font-size: 15px;
}

.g-sub {
  color: var(--ink-2);
  font-size: 13px;
  margin: 0;
}

.g-meta {
  color: var(--muted);
  font-size: 12.5px;
}

.g-tag {
  display: inline-block;
  align-self: flex-start;
  margin: 4px 6px 0 0;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.g-tag.bad {
  background: var(--bad-bg);
  color: var(--bad);
}

.g-tag.warn {
  background: var(--warn-bg);
  color: var(--warn);
}

.g-tag.good {
  background: var(--good-bg);
  color: var(--good);
}

.g-show-more {
  display: block;
  margin: 14px auto 20px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 14px;
  cursor: pointer;
}

.g-empty {
  padding: 24px 20px;
  color: var(--ink-2);
  margin: 0;
}

.g-intro {
  padding: 22px 20px;
}

.g-intro p {
  color: var(--ink-2);
}

.g-big-number {
  margin: 0 0 14px;
  font-family: Fraunces, Georgia, serif;
  font-size: 40px;
  font-weight: 800;
  line-height: 1;
  color: var(--ink) !important;
}

.g-big-number span {
  font-family: Inter, system-ui, sans-serif;
  font-size: 16px;
  font-weight: 500;
  color: var(--ink-2);
}

.g-tally {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  display: grid;
  gap: 8px;
}

.g-tally li {
  display: grid;
  grid-template-columns: 30px 70px 1fr;
  align-items: center;
  gap: 10px;
}

.g-tally li span:not(.g-badge) {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.g-tally small {
  color: var(--muted);
  font-size: 13px;
}

/* ---------- One restaurant ---------- */

.g-place {
  padding: 12px 20px 28px;
}

.g-back {
  border: 0;
  background: none;
  padding: 6px 0;
  color: var(--ink-2);
  font-weight: 500;
  cursor: pointer;
}

.g-back:hover {
  color: var(--ink);
}

.g-place-head {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin: 8px 0 10px;
}

.g-place-head h1 {
  margin: 2px 0 4px;
  font-family: Fraunces, Georgia, serif;
  font-size: 26px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.g-place-head h1:focus {
  outline: none;
}

.g-grade-line {
  margin: 0 0 6px;
  font-weight: 500;
}

.g-tags {
  margin-bottom: 4px;
}

.g-facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 14px 0;
}

.g-facts div {
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: 10px;
}

.g-facts dt {
  font-size: 12px;
  color: var(--ink-2);
}

.g-facts dd {
  margin: 2px 0 0;
  font-size: 15px;
}

.g-facts strong {
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}

.g-note {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-left: 3px solid var(--warn);
  background: var(--warn-bg);
  border-radius: 0 8px 8px 0;
  font-size: 14px;
}

.g-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 0 0 18px;
  font-size: 14px;
}

.g-place h2 {
  margin: 22px 0 8px;
  font-size: 16px;
}

.g-muted {
  color: var(--muted);
}

.small {
  font-size: 12.5px;
}

/* What inspectors found */

.g-story {
  margin: 4px 0 20px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.g-place .g-story h2 {
  margin: 0 0 2px;
  font-size: 15px;
}

.g-story-head {
  margin: 0 0 10px;
  color: var(--ink-2);
  font-size: 13.5px;
}

.g-story ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 7px;
}

.g-story li {
  position: relative;
  padding-left: 18px;
  font-size: 14px;
}

/* A shape as well as a colour, so the tone never rests on colour alone */
.g-story li::before {
  position: absolute;
  left: 0;
  top: 0;
  font-weight: 700;
  color: var(--muted);
  content: "•";
}

.g-story li.bad::before { content: "!"; color: var(--bad); }
.g-story li.warn::before { content: "!"; color: var(--warn); }
.g-story li.good::before { content: "✓"; color: var(--good); }

/* Inspections heading with the ELI5 switch */

.g-insp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 22px 0 8px;
}

.g-place .g-insp-head h2 {
  margin: 0;
}

.g-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 4px 4px 0;
  border: 0;
  background: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.g-switch-track {
  position: relative;
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: var(--grade-n);
  transition: background-color 0.2s;
}

.g-switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.25);
  transition: transform 0.2s;
}

.g-switch[aria-checked="true"] .g-switch-track {
  background: var(--grade-a);
}

.g-switch[aria-checked="true"] .g-switch-track::after {
  transform: translateX(14px);
}

.g-topic {
  display: block;
  margin-bottom: 2px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
}

/* Score chart */

.g-chart {
  position: relative;
  margin: 8px 0 0;
}

.g-chart figcaption {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
}

.g-chart figcaption small {
  font-weight: 400;
  color: var(--muted);
}

.g-chart svg {
  display: block;
  max-width: 100%;
  height: auto;
  touch-action: pan-y;
  overflow: visible;
}

.g-chart .band-A { fill: color-mix(in srgb, var(--grade-a) 9%, transparent); }
.g-chart .band-B { fill: color-mix(in srgb, var(--grade-b) 9%, transparent); }
.g-chart .band-C { fill: color-mix(in srgb, var(--grade-c) 9%, transparent); }

.g-chart .band-label {
  font: 700 11px Inter, system-ui, sans-serif;
  fill: var(--muted);
}

.g-chart .tick {
  font: 11px Inter, system-ui, sans-serif;
  fill: var(--muted);
  font-variant-numeric: tabular-nums;
}

.g-chart .year-line {
  stroke: var(--line);
  stroke-width: 1;
}

.g-chart .line {
  fill: none;
  stroke: var(--ink-2);
  stroke-width: 2;
  stroke-linejoin: round;
}

.g-chart .pt {
  stroke: var(--surface);
  stroke-width: 2;
}

.g-chart .pt-A { fill: var(--grade-a); }
.g-chart .pt-B { fill: var(--grade-b); }
.g-chart .pt-C { fill: var(--grade-c); }

.g-chart .focus {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2;
  pointer-events: none;
}

.g-chart-tip {
  margin-top: 6px;
  font-size: 13px;
  color: var(--ink-2);
}

.g-chart-tip strong {
  color: var(--ink);
}

/* Inspection history */

.g-inspections {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.g-inspections > li {
  border-bottom: 1px solid var(--line);
}

.g-inspections summary {
  display: grid;
  grid-template-columns: 96px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  cursor: pointer;
  list-style: none;
}

.g-inspections summary::-webkit-details-marker {
  display: none;
}

.g-insp-date {
  font-weight: 600;
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}

.g-insp-kind {
  font-size: 13.5px;
  color: var(--ink-2);
}

.g-insp-result {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  font-size: 13px;
  white-space: nowrap;
}

.g-insp-result .g-badge {
  width: 22px;
  height: 25px;
  font-size: 14px;
  border-radius: 5px;
}

.g-inspections details > p,
.g-violations {
  margin: 0 0 10px;
}

.g-violations {
  padding-left: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.g-violations li {
  font-size: 13.5px;
  padding-left: 12px;
  border-left: 2px solid var(--line);
}

.g-violations li.critical {
  border-left-color: var(--bad);
}

.g-violations .g-tag {
  margin: 0 6px 0 0;
  font-size: 11px;
  padding: 1px 6px;
}

/* ---------- Footer, legend, hover tip, toasts ---------- */

.g-foot {
  padding: 10px 20px 14px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}

.g-foot a {
  color: inherit;
}

.g-legend {
  position: absolute;
  left: 12px;
  bottom: 26px;
  z-index: 900;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  max-width: calc(100% - 24px);
  padding: 7px 12px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: var(--shadow);
  font-size: 12px;
  color: var(--ink-2);
  pointer-events: none;
}

.g-legend[hidden] {
  display: none;
}

.g-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.g-tip {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 950;
  display: grid;
  max-width: 260px;
  padding: 7px 10px;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 13px;
  pointer-events: none;
}

.g-tip[hidden] {
  display: none;
}

.g-tip span {
  color: var(--ink-2);
  font-size: 12px;
}

.g-toasts {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 2000;
  display: grid;
  gap: 8px;
  width: min(420px, calc(100% - 32px));
}

.g-toast {
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--surface);
  font-size: 14px;
  box-shadow: var(--shadow);
}

/* ---------- About ---------- */

.g-dialog {
  width: min(560px, calc(100% - 32px));
  max-height: calc(100dvh - 48px);
  padding: 24px 26px;
  border: 0;
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.g-dialog::backdrop {
  background: rgb(0 0 0 / 0.45);
}

.g-dialog h2 {
  margin: 0 0 10px;
  font-family: Fraunces, Georgia, serif;
  font-size: 26px;
}

.g-dialog h3 {
  margin: 20px 0 6px;
  font-size: 15px;
}

.g-dialog p {
  margin: 0 0 10px;
  color: var(--ink-2);
}

.g-dialog-close {
  position: absolute;
  right: 12px;
  top: 10px;
}

.g-dialog-close button {
  border: 0;
  background: none;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  color: var(--ink-2);
}

.g-bands {
  list-style: none;
  padding: 0;
  margin: 8px 0 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
}

.g-bands li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.g-tech {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 6px;
  padding: 0;
}

.g-tech li {
  padding: 2px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  color: var(--ink-2);
}

.g-credits {
  font-size: 12px;
}

/* ---------- Dots or heatmap ---------- */

.g-mode {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 900;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.g-mode button {
  height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
}

.g-mode button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--surface);
}

.g-mode-letters {
  display: flex;
  gap: 2px;
  margin-left: 4px;
  padding-left: 6px;
  border-left: 1px solid var(--line);
}

.g-mode-letters[hidden] {
  display: none;
}

.g-mode-letters button {
  width: 30px;
  padding: 0;
  font-family: Fraunces, Georgia, serif;
  font-size: 15px;
}

.g-mode-letters button[data-letter="A"][aria-pressed="true"] { background: var(--grade-a); color: #fff; }
.g-mode-letters button[data-letter="B"][aria-pressed="true"] { background: var(--grade-b); color: #fff; }
.g-mode-letters button[data-letter="C"][aria-pressed="true"] { background: var(--grade-c); color: #fff; }

.g-heat-legend {
  position: absolute;
  left: 12px;
  bottom: 26px;
  z-index: 900;
  display: grid;
  gap: 5px;
  width: min(300px, calc(100% - 24px));
  padding: 10px 12px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: var(--shadow);
  font-size: 12px;
  color: var(--ink-2);
}

.g-heat-legend[hidden] {
  display: none;
}

.g-heat-legend strong {
  color: var(--ink);
  font-size: 12.5px;
}

.g-heat-legend small {
  font-size: 11.5px;
  color: var(--muted);
}

/* The same pale-to-strong steps the hexagons use */
.g-ramp {
  height: 10px;
  border-radius: 3px;
}

.g-ramp-A { background: linear-gradient(90deg, color-mix(in srgb, var(--grade-a) 12%, transparent), color-mix(in srgb, var(--grade-a) 90%, transparent)); }
.g-ramp-B { background: linear-gradient(90deg, color-mix(in srgb, var(--grade-b) 12%, transparent), color-mix(in srgb, var(--grade-b) 90%, transparent)); }
.g-ramp-C { background: linear-gradient(90deg, color-mix(in srgb, var(--grade-c) 12%, transparent), color-mix(in srgb, var(--grade-c) 90%, transparent)); }

.g-ramp-ends {
  display: flex;
  justify-content: space-between;
  font-variant-numeric: tabular-nums;
}

.g-tip span + span {
  margin-top: 2px;
}

/* ---------- Map bits ---------- */

.grate-dots {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 450;
  pointer-events: none;
}

.grate-dots.zooming {
  visibility: hidden;
}

.leaflet-container.over-dot,
.leaflet-container.over-dot * {
  cursor: pointer !important;
}

.leaflet-container {
  font: 12px/1.4 Inter, system-ui, sans-serif;
  background: var(--surface-2);
}

.g-you {
  fill: var(--grade-a);
  fill-opacity: 1;
  stroke: #fff;
  stroke-width: 3;
}

.g-accuracy {
  fill: var(--grade-a);
  fill-opacity: 0.1;
  stroke: var(--grade-a);
  stroke-opacity: 0.4;
  stroke-width: 1;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .leaflet-bar a,
  :root:not([data-theme="light"]) .leaflet-control-attribution {
    background: var(--surface) !important;
    color: var(--ink-2) !important;
    border-color: var(--line) !important;
  }

  :root:not([data-theme="light"]) .leaflet-control-attribution a {
    color: var(--ink) !important;
  }
}

:root[data-theme="dark"] .leaflet-bar a,
:root[data-theme="dark"] .leaflet-control-attribution {
  background: var(--surface) !important;
  color: var(--ink-2) !important;
  border-color: var(--line) !important;
}

:root[data-theme="dark"] .leaflet-control-attribution a {
  color: var(--ink) !important;
}

/* ---------- Phones: search on top, then the map, then the list ---------- */

@media (max-width: 760px) {
  .g-app {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 100dvh;
  }

  .g-panel {
    display: contents;
  }

  .g-head { order: 1; padding: 14px 16px 6px; }
  .g-search { order: 2; padding: 4px 16px 10px; }
  .g-map-wrap { order: 3; height: 46dvh; min-height: 280px; }
  .g-filters { order: 4; padding: 12px 16px; border-top: 1px solid var(--line); }
  .g-tabs { order: 4; padding: 0 16px; background: var(--surface); }
  .g-updates-intro { padding: 12px 16px 4px; }
  .g-body { order: 5; overflow: visible; background: var(--surface); }
  .g-foot { order: 6; background: var(--surface); }

  .g-logo { font-size: 28px; }
  .g-tagline { font-size: 13px; }
  .g-item { padding: 12px 16px; }
  .g-list-head { padding: 10px 16px; }
  .g-place { padding: 10px 16px 24px; }
  .g-near span { display: none; }
  .g-legend { top: 8px; right: 8px; bottom: auto; left: auto; max-width: 150px; font-size: 11px; gap: 2px 8px; padding: 5px 8px; }
  .g-mode { top: 8px; right: auto; left: 52px; }
  .g-mode button { height: 28px; padding: 0 10px; font-size: 12px; }
  .g-mode-letters button { width: 28px; }
  .g-legend { top: 46px; }
  .g-heat-legend { bottom: 22px; left: 8px; padding: 8px 10px; }
  .leaflet-control-attribution { font-size: 9px; max-width: 70vw; }
  .g-facts { grid-template-columns: 1fr 1fr 1fr; }
  .g-facts strong { font-size: 19px; }
  .g-inspections summary { grid-template-columns: 1fr auto; }
  .g-insp-kind { grid-column: 1 / -1; grid-row: 2; margin-top: -6px; }
}
