:root {
  --ink: #1a1a1a;
  --muted: #6b6b6b;
  --surface: #ffffff;
  --line: #e2e2e2;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  color: var(--ink);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  margin: 0;
  background: #f2f2f2;
}

.toolbar {
  position: relative;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem; /* 8px 16px */
  padding: 0.5rem 1rem; /* 8px 16px */
  padding-top: calc(0.5rem + env(safe-area-inset-top, 0px));
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  font-size: 0.8125rem; /* 13px */
}

.toolbar label {
  display: flex;
  align-items: center;
  gap: 0.375rem; /* 6px */
}

.toolbar select {
  font: inherit;
  padding: 0.25rem 0.375rem; /* 4px 6px */
}

.diagnostics {
  margin-left: auto;
}

.diagnostics summary {
  cursor: pointer;
}

.diagnostics[open] #diagnostics {
  position: absolute;
  right: 1rem; /* 16px */
  left: 1rem; /* 16px */
  max-width: 32rem; /* 512px */
  margin-left: auto;
  max-height: 60vh;
  overflow: auto;
  padding: 0.75rem; /* 12px */
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.5rem; /* 8px */
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.12);
  font-family: ui-monospace, Menlo, monospace;
  font-size: 0.75rem; /* 12px */
  white-space: pre-wrap;
}

.stage {
  position: relative;
  flex: 1;
}

.map {
  position: absolute;
  inset: 0;
}

.chip {
  position: absolute;
  top: 1rem; /* 16px */
  left: 1rem; /* 16px */
  z-index: 5;
  padding: 0.5rem 0.875rem; /* 8px 14px */
  background: var(--surface);
  border-radius: 999px;
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.15);
  font-size: 0.875rem; /* 14px */
}

.close {
  position: absolute;
  top: 1rem; /* 16px */
  right: 1rem; /* 16px */
  z-index: 5;
  width: 2.5rem; /* 40px */
  height: 2.5rem; /* 40px */
  border: 0;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.15);
  font-size: 1rem; /* 16px */
  cursor: pointer;
}

.map .mapboxgl-ctrl-top-left,
.map .maplibregl-ctrl-top-left {
  top: 3.5rem; /* 56px, below the city chip */
}

.pin {
  position: relative;
  padding: 0.375rem 0.625rem; /* 6px 10px */
  border: 0;
  border-radius: 0.5rem; /* 8px */
  background: var(--surface);
  box-shadow: 0 2px 6px rgb(0 0 0 / 0.2);
  font-family: inherit;
  font-size: 0.8125rem; /* 13px */
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink);
  white-space: nowrap;
  cursor: pointer;
}

.pin::after {
  content: '';
  position: absolute;
  bottom: -0.3125rem; /* -5px */
  left: 50%;
  width: 0.625rem; /* 10px */
  height: 0.625rem; /* 10px */
  background: inherit;
  transform: translateX(-50%) rotate(45deg);
}

.pin[data-active='true'] {
  background: var(--ink);
  color: var(--surface);
}

.card {
  position: absolute;
  right: 1rem; /* 16px */
  bottom: 2.5rem; /* 40px, clears the map attribution */
  left: 1rem; /* 16px */
  z-index: 5;
  display: grid;
  gap: 0.25rem; /* 4px */
  max-width: 24rem; /* 384px */
  padding: 1rem; /* 16px */
  background: var(--surface);
  border-radius: 1rem; /* 16px */
  box-shadow: 0 6px 20px rgb(0 0 0 / 0.18);
  color: var(--ink);
  text-decoration: none;
}

.card-name {
  font-size: 1.125rem; /* 18px */
  font-weight: 600;
}

.card-address {
  color: var(--muted);
  font-size: 0.875rem; /* 14px */
}

.card-link {
  margin-top: 0.25rem; /* 4px */
  font-size: 0.875rem; /* 14px */
  font-weight: 600;
}

.token-state,
.list {
  position: absolute;
  inset: 0;
  z-index: 10;
  overflow: auto;
  padding: 2rem 1rem; /* 32px 16px */
  background: #f7f7f5;
}

.token-state h1,
.list h1 {
  margin: 0 0 1rem;
  font-size: 1.5rem; /* 24px */
}

.token-state p {
  max-width: 36rem; /* 576px */
  line-height: 1.5;
}

.token-state button,
.list button {
  margin-top: 1rem; /* 16px */
  padding: 0.75rem 1.25rem; /* 12px 20px */
  border: 0;
  border-radius: 0.5rem; /* 8px */
  background: var(--ink);
  color: var(--surface);
  font: inherit;
  cursor: pointer;
}

.list ul {
  display: grid;
  gap: 0.75rem; /* 12px */
  max-width: 36rem; /* 576px */
  margin: 0;
  padding: 0;
  list-style: none;
}

.list li a {
  display: grid;
  gap: 0.25rem; /* 4px */
  padding: 1rem; /* 16px */
  background: var(--surface);
  border-radius: 0.75rem; /* 12px */
  color: var(--ink);
  text-decoration: none;
}

.banner {
  position: absolute;
  top: 4rem; /* 64px */
  left: 50%;
  z-index: 15;
  margin: 0;
  max-width: calc(100% - 2rem);
  padding: 0.625rem 1rem; /* 10px 16px */
  background: #8a1c1c;
  border-radius: 0.5rem; /* 8px */
  color: #fff;
  font-size: 0.875rem; /* 14px */
  transform: translateX(-50%);
}
