* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  background: #0d1117;
  color: #c9d1d9;
  line-height: 1.6;
}

.topbar {
  padding: 24px 16px 16px;
  text-align: center;
  background: linear-gradient(135deg, #161b22 0%, #0d1117 100%);
  border-bottom: 1px solid #30363d;
}

.topbar h1 { margin: 0; font-size: 1.5rem; font-weight: 600; }
.topbar .sub { margin: 4px 0 0; font-size: 0.85rem; color: #8b949e; }

main { max-width: 920px; margin: 0 auto; padding: 16px; }

.scatter-section, .region-section, .table-section, .about {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}

.axis-pickers {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.axis-pickers label { font-size: 0.85rem; color: #8b949e; }

.axis-pickers select {
  background: #0d1117;
  border: 1px solid #30363d;
  color: #c9d1d9;
  border-radius: 6px;
  padding: 5px 10px;
  font-family: inherit;
  font-size: 0.9rem;
  margin-left: 4px;
}

.corr {
  margin-left: auto;
  font-size: 0.9rem;
  font-family: ui-monospace, monospace;
}

.corr .r-value { font-size: 1.2rem; font-weight: 700; color: #ffd33d; }
.corr .r-label { color: #8b949e; }

#plot { width: 100%; height: auto; display: block; }

#plot .axis { stroke: #30363d; stroke-width: 1.5; }
#plot .grid { stroke: #1c2331; stroke-width: 1; }
#plot .axis-title { fill: #c9d1d9; font-size: 13px; }
#plot .tick-label { fill: #6e7681; font-size: 10px; font-family: ui-monospace, monospace; }

#plot .dot {
  cursor: pointer;
  transition: opacity 0.1s;
}
#plot .dot:hover { opacity: 1; stroke: #fff; stroke-width: 1.5; }
#plot .dot-label { fill: #c9d1d9; font-size: 10px; pointer-events: none; }
#plot .trend { stroke: #ffd33d; stroke-width: 1.5; stroke-dasharray: 5 4; opacity: 0.6; }

/* region color coding */
.region-アジア { fill: #58a6ff; }
.region-ヨーロッパ { fill: #7cffa1; }
.region-北米 { fill: #ff7b72; }
.region-南米 { fill: #ffa657; }
.region-アフリカ { fill: #d2a8ff; }
.region-中東 { fill: #ffd33d; }
.region-オセアニア { fill: #79c0ff; }

table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
thead th {
  text-align: left;
  padding: 6px 8px;
  color: #8b949e;
  border-bottom: 1px solid #30363d;
  white-space: nowrap;
}
thead th.sortable { cursor: pointer; user-select: none; }
thead th.sortable:hover { color: #c9d1d9; }
thead th .arrow { color: #ffd33d; }
tbody td { padding: 5px 8px; border-bottom: 1px solid #1c2331; }
tbody tr:hover td { background: #1c2331; }
.num { font-family: ui-monospace, monospace; text-align: right; }

.region-section h2, .table-section h2, .about h2 { margin-top: 0; font-size: 1.05rem; }
.region-table { max-width: 560px; }

.dim { color: #8b949e; font-size: 0.8rem; font-weight: normal; }
.about p { font-size: 0.9rem; }
.about a { color: #58a6ff; }

footer {
  border-top: 1px solid #30363d;
  padding: 16px;
  text-align: center;
  font-size: 0.85rem;
  color: #8b949e;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 920px;
  margin: 24px auto 0;
}

footer a { color: #58a6ff; }
