:root {
  --bg: #f2f2f2;
  --panel: #ffffff;
  --line: #d9d9de;
  --accent: #4a4ad0;
  --accent-soft: #ecebfc;
  --ink: #222222;
  --muted: #5f6368;
  --hot: #b45309;
  --warn-bg: #fff3d6;
  --warn-ink: #6a4a00;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: "Hiragino UD Sans StdN", "Hiragino Sans", "BIZ UDPGothic", "Noto Sans JP", "Yu Gothic", sans-serif;
  font-size: 15px;
  line-height: 1.55;
}
h1, p, ol { margin: 0; padding: 0; }
button { font: inherit; color: inherit; }

.bar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand strong { color: var(--accent); font-size: 15px; letter-spacing: .06em; }
.brand span { color: var(--muted); font-size: 12px; }
.clock { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.badge {
  margin-left: auto;
  padding: 3px 10px;
  border-radius: 3px;
  background: var(--warn-bg);
  color: var(--warn-ink);
  font-size: 12px;
  white-space: nowrap;
}

.stage { position: relative; flex: 1; min-height: 0; overflow: hidden; }
#map { position: absolute; inset: 0; }

.console {
  position: absolute;
  z-index: 2;
  left: 440px;
  bottom: 30px;
  max-width: calc(100% - 470px);
  transition: left .5s ease;
  padding: 6px 12px;
  border-left: 2px solid var(--accent);
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 2px 10px rgba(0,0,0,.14);
  border-radius: 0 8px 8px 0;
  font-size: 14px;
  letter-spacing: .04em;
}
.console:empty { display: none; }

.panel {
  position: absolute;
  z-index: 3;
  top: 16px;
  left: 16px;
  bottom: 16px;
  width: 400px;
  padding: 20px;
  overflow-y: auto;
  border-radius: 14px;
  box-shadow: 0 6px 24px rgba(0,0,0,.14);
  background: var(--panel);
  opacity: 0;
  transform: translateX(-16px);
  transition: opacity .5s ease, transform .5s ease;
}
.panel.is-on { opacity: 1; transform: none; }

.eyebrow { color: var(--accent); font-size: 12px; font-weight: 700; }
h1 { margin-top: 2px; font-size: 21px; line-height: 1.4; font-weight: 700; }

.controls { display: grid; gap: 6px; margin-top: 14px; }
.seg { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px; padding: 4px; border-radius: 10px; background: var(--bg); }
.seg--four { grid-template-columns: repeat(4, 1fr); }
.seg button {
  min-height: 38px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
}
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: #ffffff; box-shadow: 0 1px 3px rgba(0,0,0,.18); color: var(--accent); font-weight: 700; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.coverage { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.coverage b { color: var(--accent); font-size: 36px; line-height: 1; font-variant-numeric: tabular-nums; }
.coverage span { color: var(--muted); font-size: 13px; line-height: 1.45; }

.ranks { margin-top: 14px; list-style: none; }
.ranks li { opacity: 0; transform: translateY(6px); transition: opacity .35s ease, transform .35s ease; }
.ranks li.is-on { opacity: 1; transform: none; }
.rank {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  gap: 2px 10px;
  width: 100%;
  padding: 10px 8px;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  text-align: left;
}
.rank:hover { background: var(--bg); }
.rank[aria-current="true"] { background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); }
.rank__no { grid-row: span 2; color: var(--accent); font-size: 22px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.rank__name { font-weight: 700; }
.rank__count { font-variant-numeric: tabular-nums; }
.rank__why { color: var(--muted); font-size: 12.5px; }
.rank__trend { align-self: start; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rank__trend.is-up { color: var(--hot); font-weight: 700; }
.tag { margin-left: 6px; padding: 0 5px; border-radius: 4px; border: 1px solid var(--line); color: var(--muted); font-size: 11px; font-weight: 400; white-space: nowrap; }
.tag--out { border-color: var(--hot); color: var(--hot); }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 14px; }
.actions button {
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: 13px;
}
.actions button:hover { border-color: var(--accent); color: var(--accent); }

.pin {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1.5px solid var(--accent);
  border-radius: 50%;
  background: #ffffff;
  color: var(--accent);
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.pin.is-top { border-color: var(--hot); color: var(--hot); }
.pin.is-top::after {
  content: "";
  position: absolute;
  inset: -2px;
  border: 1.5px solid var(--hot);
  border-radius: 50%;
  animation: ping 1.8s ease-out infinite;
}
@keyframes ping { from { transform: scale(1); opacity: .9; } to { transform: scale(2.4); opacity: 0; } }

.maplibregl-ctrl-attrib { font-size: 10px; }

@media (max-width: 760px) {
  .bar { flex-wrap: wrap; gap: 4px 12px; padding: 8px 16px; }
  .clock { display: none; }
  #map { inset: 0 0 55% 0; }
  .console { left: 16px; bottom: calc(55% + 30px); max-width: calc(100% - 32px); font-size: 13px; }
  .panel { top: 45%; left: 0; right: 0; bottom: 0; width: auto; padding: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .panel, .ranks li { transition: none; }
  .pin.is-top::after { animation: none; }
}

.views { display: flex; gap: 2px; }
.views a { display: inline-flex; align-items: center; min-height: 34px; padding: 0 10px; border-radius: 6px; color: var(--muted); font-size: 13px; text-decoration: none; }
.views a:hover { color: var(--ink); }
.views a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.rank__source { grid-column: 2 / -1; color: var(--muted); font-size: 12px; }

.to-plan { grid-column: 1 / -1; display: grid; place-items: center; min-height: 42px; border-radius: 8px; background: var(--accent); color: #fff; font-weight: 700; text-decoration: none; }

.role { padding: 3px 10px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; white-space: nowrap; }
.to-home { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
