:root {
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --accent: #0e7490;
  --warn: #b45309;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
  color: var(--ink);
}

#map {
  position: absolute;
  inset: 0;
  background: #dbeafe;
}

/* ---------- top bar ---------- */

.bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.brand {
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.brand .arrow { color: var(--accent); }

.brand .tag {
  margin-left: 8px;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  border-radius: 999px;
  vertical-align: middle;
}

#search {
  display: flex;
  gap: 6px;
  flex: 1 1 420px;
  min-width: 280px;
}

#search input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 9px 11px;
  font-size: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  outline: none;
}

#search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(14, 116, 144, 0.15);
}

#search input.chiban {
  flex: 0 0 150px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

#search button {
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

#search button:hover { background: #155e75; }

.status {
  flex: 1 1 100%;
  font-size: 12px;
  color: var(--muted);
  min-height: 15px;
}

.status.ok { color: #047857; }
.status.warn { color: var(--warn); font-weight: 600; }

/* ---------- panel ---------- */

.panel {
  position: fixed;
  top: 96px;
  right: 14px;
  z-index: 9;
  width: min(360px, calc(100vw - 28px));
  max-height: calc(100vh - 160px);
  overflow: auto;
  padding: 16px 18px 18px;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
}

.panel.hidden { display: none; }

.panel h2 {
  margin: 0 0 12px;
  font-size: 15px;
  line-height: 1.4;
  padding-right: 24px;
}

.close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  font-size: 18px;
  line-height: 1;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

.close:hover { background: #f1f5f9; }

.row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 13px;
}

.row:last-child { border-bottom: 0; }

.row .k { color: var(--muted); white-space: nowrap; }

.row .v {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  text-align: right;
  word-break: break-all;
}

/* ---------- misc ---------- */

.samples {
  position: fixed;
  left: 14px;
  top: 96px;
  z-index: 8;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  padding: 7px 12px;
  font-size: 12px;
  color: #0f172a;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.chip:hover { border-color: var(--accent); color: var(--accent); }

.credit {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  max-width: 640px;
  border-radius: 6px 6px 0 0;
  bottom: 0;
  z-index: 8;
  padding: 5px 12px;
  font-size: 10px;
  line-height: 1.4;
  color: #334155;
  text-align: center;
  background: rgba(255, 255, 255, 0.85);
  pointer-events: none;
}

@media (max-width: 640px) {
  .bar { gap: 8px; padding: 8px 10px; }
  .brand { font-size: 13px; }
  #search { flex-basis: 100%; }
  #search input.chiban { flex-basis: 110px; }
  .panel { top: auto; bottom: 52px; right: 8px; left: 8px; width: auto; max-height: 46vh; }
  .samples { display: none; }
}

.copy {
  width: 100%;
  margin-top: 12px;
  padding: 9px 12px;
  font-size: 12px;
  font-weight: 700;
  color: #0e7490;
  background: #ecfeff;
  border: 1px solid #a5f3fc;
  border-radius: 8px;
  cursor: pointer;
}

.copy:hover { background: #cffafe; }

.maplibregl-ctrl-top-left { margin-top: 58px; }

.basemap {
  margin-left: 4px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 700;
  color: #0e7490;
  background: #ecfeff;
  border: 1px solid #a5f3fc;
  border-radius: 8px;
  text-decoration: none;
  white-space: nowrap;
}

.basemap:hover { background: #cffafe; }

.maptype {
  margin: 10px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 700;
  color: #1f2937;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  cursor: pointer;
}
