:root {
  --bg: #0c0f1a;
  --bg-alt: #0f1324;
  --card: #13192c;
  --panel: #0b1d2d;
  --text: #e8edf7;
  --muted: #b9c4d4;
  --accent: #1ee5c6;
  --accent-2: #ff8a4f;
  --stroke: rgba(255, 255, 255, 0.08);
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: radial-gradient(120% 120% at 10% 10%, rgba(30, 229, 198, 0.08), transparent 40%), radial-gradient(120% 120% at 90% 20%, rgba(255, 138, 79, 0.08), transparent 35%), var(--bg);
  color: var(--text);
  font-family: 'Space Grotesk', 'Noto Sans JP', system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
}

.muted {
  color: var(--muted);
}

img {
  max-width: 100%;
  display: block;
}

.site-header {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 28px;
  background: rgba(12, 15, 26, 0.8);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--stroke);
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #05060c;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.brand-text .eyebrow {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.4px;
  color: var(--muted);
}

.brand-text .title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.top-nav {
  display: flex;
  gap: 16px;
  align-items: center;
}

.top-nav a {
  color: var(--text);
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  transition: border-color 0.2s, background 0.2s;
}

.top-nav a:hover {
  border-color: var(--stroke);
  background: rgba(255, 255, 255, 0.04);
}

.top-nav .cta {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #05060c;
  font-weight: 700;
  border: none;
}

.hero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
  padding: 64px 28px 48px;
  align-items: center;
}

.hero-copy h1 {
  margin: 8px 0 12px;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.3;
}

.lede {
  color: var(--muted);
  max-width: 720px;
}

.eyebrow {
  letter-spacing: 0.24em;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--accent);
  margin: 0;
}

.actions {
  display: flex;
  gap: 12px;
  margin: 20px 0 8px;
  flex-wrap: wrap;
}

.primary,
.ghost {
  padding: 12px 18px;
  border-radius: 12px;
  border: 1px solid var(--accent);
  background: linear-gradient(135deg, var(--accent), #20b5c1);
  color: #041a17;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.primary:hover,
.ghost:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--stroke);
}

.usecases {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.usecases.hidden {
  display: none;
}

.pill {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 13px;
}

.hero-card {
  background: var(--card);
  border-radius: 20px;
  padding: 20px;
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
}

.hero-card ul {
  padding-left: 18px;
  color: var(--muted);
}

.hero-card .title {
  margin: 6px 0 0;
  font-weight: 700;
}

.quick-list {
  list-style: none;
  padding: 0;
  margin: 14px 0 0;
  display: grid;
  gap: 6px;
}

.quick-list li {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 14px;
}

.card-body .primary.block {
  display: block;
  text-align: center;
  margin-top: 12px;
}

.section {
  padding: 40px 28px;
}

.section.alt {
  background: var(--bg-alt);
  border-top: 1px solid var(--stroke);
  border-bottom: 1px solid var(--stroke);
}

.section-header h2 {
  margin: 6px 0;
  font-size: 26px;
}

.section-copy {
  color: var(--muted);
  margin-top: 4px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.info-card {
  background: var(--card);
  padding: 18px;
  border-radius: 16px;
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dataset-pick {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}

.dataset-pick input {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}

.subtle-note {
  color: var(--muted);
  font-size: 12px;
  margin-top: 6px;
}

.info-card .badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(30, 229, 198, 0.12);
  color: var(--accent);
  padding: 6px 10px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.05em;
}

.info-card h3 {
  margin: 6px 0;
}

.info-card .muted {
  color: var(--muted);
  margin: 0 0 4px;
}

.info-card ul {
  padding-left: 18px;
  color: var(--muted);
  flex: 1;
}

.card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.feature {
  background: var(--card);
  border: 1px solid var(--stroke);
  padding: 16px;
  border-radius: 14px;
}

.feature p {
  color: var(--muted);
}

.site-footer {
  padding: 24px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--stroke);
  background: rgba(12, 15, 26, 0.9);
}

.site-footer p {
  margin: 0;
  color: var(--muted);
}

/* Map page */
.map-layout {
  position: relative;
  min-height: 100vh;
  background: var(--bg);
}

.layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  min-height: 100vh;
  background: var(--bg);
}

.map-shell {
  position: relative;
  min-height: 100vh;
}

.map-full {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.float-panel {
  position: fixed;
  z-index: 5;
  background: rgba(10, 14, 26, 0.9);
  border: 1px solid var(--stroke);
  border-radius: 16px;
  padding: 12px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.float-panel.filters {
  top: 12px;
  left: 12px;
  width: min(420px, 92vw);
  max-height: calc(100vh - 24px);
  overflow-y: auto;
}

.float-panel.list-panel {
  bottom: 12px;
  left: 12px;
  width: min(420px, 92vw);
  max-height: 38vh;
  overflow-y: auto;
}

.float-panel.info {
  top: 12px;
  right: 12px;
  width: min(520px, 94vw);
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

@media (max-width: 820px) {
  body {
    overflow-x: hidden;
  }
  .map-shell {
    padding: 8px;
    min-height: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .map-full {
    position: relative;
    inset: auto;
    width: 100%;
    height: 55vh;
  }
  .float-panel {
    position: static;
    width: 100%;
    max-height: none;
    margin: 6px 0;
  }
  .float-panel.filters,
  .float-panel.list-panel,
  .float-panel.info {
    width: 100%;
    max-height: none;
  }
  .results-list {
    max-height: 220px;
  }
}
@media (max-width: 768px) {
  .map-shell {
    padding: 8px;
    min-height: auto;
  }
  .map-full {
    position: relative;
    inset: auto;
    height: 60vh;
  }
  .float-panel {
    position: static;
    width: 100%;
    max-height: none;
    margin: 8px 0;
  }
  .float-panel.filters,
  .float-panel.list-panel,
  .float-panel.info {
    width: 100%;
    max-height: none;
  }
}

.sidebar {
  background: rgba(10, 14, 26, 0.95);
  border-right: 1px solid var(--stroke);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.content {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.content-grid-2 {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 12px;
  align-items: start;
}

.content-grid-2 .col {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chart-card {
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.chart-wrapper {
  height: 280px;
}

.chart-meta {
  color: var(--muted);
  font-size: 12px;
  margin-top: 6px;
  line-height: 1.5;
}

.flex-1 {
  flex: 1;
}

.map-panel {
  position: absolute;
  top: 14px;
  left: 14px;
  width: min(420px, 94vw);
  max-height: calc(100vh - 28px);
  overflow: hidden;
  background: rgba(10, 14, 26, 0.92);
  backdrop-filter: blur(10px);
  border: 1px solid var(--stroke);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  border-radius: 16px;
  box-shadow: var(--shadow);
  z-index: 15;
}

.panel-scroll {
  overflow-y: auto;
  padding-right: 6px;
  max-height: calc(100vh - 160px);
}

.map-panel .section-title {
  margin: 0;
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.map-panel .sub {
  color: var(--muted);
  margin: 0;
}

.dataset-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.dataset-tab {
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.1s;
}

.dataset-tab.active {
  border-color: var(--accent);
  background: rgba(30, 229, 198, 0.12);
  transform: translateY(-1px);
}

.dataset-tab .label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dataset-tab .title {
  font-weight: 700;
  font-size: 14px;
}

.dataset-tab .subtitle {
  color: var(--muted);
  font-size: 12px;
}

.panel-card {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 14px;
  padding: 12px;
  box-shadow: var(--shadow);
}

.panel-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.panel-card + .panel-card {
  margin-top: 10px;
}

#trend-card {
  position: relative;
  z-index: 1;
  min-height: 240px;
  height: auto;
  max-height: none;
  overflow: visible;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
}

#trend-chart {
  display: block;
  width: 100%;
  height: 260px;
  max-height: 260px;
  flex: 1;
}

#detail-card {
  position: relative;
  z-index: 0;
  margin-top: 10px;
  clear: both;
}

.endpoint-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
}

.endpoint-chip {
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.1s;
}

.endpoint-chip:hover {
  border-color: var(--accent);
  background: rgba(30, 229, 198, 0.08);
}

.endpoint-chip.disabled {
  opacity: 0.35;
  cursor: not-allowed;
  border-style: dashed;
}

.endpoint-chip.active {
  border-color: var(--accent);
  background: rgba(30, 229, 198, 0.12);
  transform: translateY(-1px);
}

.endpoint-chip .title {
  font-weight: 700;
  font-size: 13px;
}

.endpoint-chip .subtitle {
  color: var(--muted);
  font-size: 12px;
}

.endpoint-chip .pill {
  margin: 0;
}

.results-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
}

.result-item {
  border: 1px solid var(--stroke);
  border-radius: 10px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.result-item:hover {
  border-color: var(--accent);
  background: rgba(30, 229, 198, 0.08);
}

.result-item.selected {
  border-color: var(--accent);
  background: rgba(30, 229, 198, 0.12);
}

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

.metric-card {
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
}

.metric-label {
  color: var(--muted);
  font-size: 12px;
  margin: 0 0 4px;
}

.metric-value {
  font-size: 20px;
  font-weight: 800;
  margin: 0;
}

.detail-card {
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.02);
  margin-top: 10px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 8px;
}

.detail-grid.single-col {
  grid-template-columns: 1fr;
}

.detail-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--stroke);
  border-radius: 10px;
  padding: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.detail-label {
  color: var(--muted);
  font-size: 12px;
  margin: 0 0 4px;
}

.detail-value {
  margin: 0;
  font-weight: 700;
}

.mini-map {
  width: 100%;
  height: 220px;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  overflow: hidden;
}

.result-json {
  background: var(--bg-alt);
  color: var(--text);
  border: 1px solid var(--stroke);
  border-radius: 10px;
  padding: 12px;
  max-height: 420px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.hidden {
  display: none;
}

.freq-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.freq-card {
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.03);
}

.freq-card h4 {
  margin: 0 0 6px;
  font-size: 14px;
}

.freq-item {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}

.result-title {
  font-weight: 700;
  font-size: 14px;
  margin: 0 0 4px;
}

.result-meta {
  color: var(--muted);
  font-size: 12px;
  margin: 0;
}

.endpoint-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
}

.endpoint-chip {
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.1s;
}

.endpoint-chip:hover {
  border-color: var(--accent);
  background: rgba(30, 229, 198, 0.08);
}

.endpoint-chip.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.endpoint-chip .title {
  font-weight: 700;
  font-size: 13px;
}

.endpoint-chip .subtitle {
  color: var(--muted);
  font-size: 12px;
}

.endpoint-chip .pill {
  margin: 0;
}

.toggle-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toggle-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.toggle-item label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  cursor: pointer;
}

.badge-small {
  display: inline-flex;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
}

.search-box {
  display: flex;
  gap: 8px;
  align-items: center;
}

.search-box input,
.panel-card input,
.panel-card select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.selected-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}
.selected-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #dce4ee;
}
.selected-item input {
  width: 14px;
  height: 14px;
}

.search-box button {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: rgba(30, 229, 198, 0.15);
  color: var(--text);
  cursor: pointer;
}

.legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 6px;
}

.date-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
  margin: 10px 0;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
}

.chart-card canvas {
  width: 100%;
  height: 200px;
}

.map-card {
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.02);
}

.mapbox-container {
  width: 100%;
  height: 320px;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  overflow: hidden;
}

.mapboxgl-canvas {
  outline: none;
}

.mapboxgl-popup {
  max-width: 280px;
}

.mapboxgl-popup-content {
  background: #11182b;
  color: var(--text);
  border: 1px solid var(--stroke);
  border-radius: 10px;
}

.mapboxgl-popup-tip {
  border-top-color: #11182b !important;
  border-bottom-color: #11182b !important;
}

#map {
  width: 100%;
  height: 100vh;
}

.map-header {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(12, 15, 26, 0.75);
  backdrop-filter: blur(12px);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 12;
}

.map-header .pill {
  margin: 0;
}

.info-panel {
  background: rgba(12, 15, 26, 0.9);
  border: 1px solid var(--stroke);
  border-radius: 14px;
  padding: 12px;
  color: var(--muted);
}

.info-panel h4 {
  margin: 0 0 6px;
  color: var(--text);
}

.map-area {
  position: relative;
}

.center-target {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 18px;
  height: 18px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(30, 229, 198, 0.08);
  pointer-events: none;
  z-index: 8;
}

.center-target::before,
.center-target::after {
  content: '';
  position: absolute;
  background: var(--accent);
}

.center-target::before {
  width: 2px;
  height: 26px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.center-target::after {
  width: 26px;
  height: 2px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

@media (max-width: 960px) {
  .map-panel {
    width: calc(100vw - 20px);
    top: auto;
    bottom: 10px;
    left: 10px;
    right: 10px;
    max-height: 60vh;
  }
  .panel-scroll {
    max-height: 50vh;
  }
}

@media (max-width: 640px) {
  .top-nav {
    display: none;
  }
  .hero {
    padding-top: 32px;
  }
  .map-header {
    position: absolute;
    bottom: 10px;
    top: auto;
  }
  .map-panel {
    padding: 12px;
    max-height: 70vh;
  }
  .panel-scroll {
    max-height: 54vh;
  }
}
