:root {
  --bg: #faf7f2;
  --panel: #ffffff;
  --text: #1f1b16;
  --muted: #7a7166;
  --line: #e7e0d5;
  --accent: #e4572e;
  --bar: #fbe3da;
  --aired: #2f6fbd;
  --aired-bar: #dbe8f7;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17140f;
    --panel: #211d17;
    --text: #f3ede3;
    --muted: #a39a8c;
    --line: #37312a;
    --accent: #ff7a50;
    --bar: #4a2a1f;
    --aired: #7fb2ee;
    --aired-bar: #1f3552;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
}
header { padding: 14px 20px; border-bottom: 1px solid var(--line); }
h1 { margin: 0; font-size: 20px; }
.tagline { margin: 4px 0 0; font-size: 13px; }
#meta { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
footer { margin-top: 24px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 11.5px; line-height: 1.6; color: var(--muted); }
footer p { margin: 0 0 6px; }
footer a { color: inherit; }
main { flex: 1; display: flex; min-height: 0; }
#map { flex: 1; min-height: 280px; }
#panel {
  width: 380px;
  padding: 16px 20px;
  overflow-y: auto;
  background: var(--panel);
  border-left: 1px solid var(--line);
}
.picker { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 13px; color: var(--muted); white-space: nowrap; }
select {
  flex: 1;
  padding: 8px;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}
h2 { margin: 18px 0 2px; font-size: 22px; }
.sub { margin: 0 0 14px; font-size: 13px; color: var(--muted); }
.empty { color: var(--muted); font-size: 14px; }
ol { list-style: none; margin: 0; padding: 0; }
li { margin-bottom: 4px; }
.row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  overflow: hidden;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.row:hover .name, .row[aria-expanded="true"] .name { text-decoration: underline; }
.row .bar { position: absolute; inset: 0 auto 0 0; background: var(--bar); z-index: 0; }
.row > :not(.bar) { position: relative; z-index: 1; }
.more { padding: 8px 4px 10px 12px; margin: 2px 0 8px 14px; border-left: 2px solid var(--line); }
.naver {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 6px;
  background: #03c75a;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}
.where { margin-left: 6px; font-size: 12px; font-weight: 400; color: var(--muted); }
.row.aired .bar { background: var(--aired-bar); }
.row.aired .rank { color: var(--aired); }
.badge {
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 10px;
  background: var(--aired);
  color: var(--panel);
  font-size: 11px;
  font-weight: 700;
  vertical-align: 1px;
  white-space: nowrap;
}
.legend { display: flex; align-items: center; gap: 6px; margin: 0 0 10px; font-size: 12px; color: var(--muted); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.dot.aired { background: var(--aired); margin-left: 8px; }
.hint { margin: 10px 0 6px; font-size: 12px; color: var(--muted); }
.comment { padding: 8px 0; border-top: 1px solid var(--line); font-size: 13.5px; line-height: 1.5; }
.comment .text { margin: 0 0 4px; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment .foot { display: flex; gap: 12px; font-size: 12px; color: var(--muted); }
.comment .foot a { color: var(--accent); text-decoration: none; }
.rank { width: 22px; font-weight: 700; color: var(--accent); text-align: right; font-variant-numeric: tabular-nums; }
.name { flex: 1; font-weight: 600; overflow-wrap: anywhere; }
.count { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.videos { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13px; }
.videos p { margin: 0 0 6px; color: var(--muted); }
.videos a { display: block; margin-bottom: 4px; color: var(--accent); text-decoration: none; }
.videos a:hover { text-decoration: underline; }
.region-marker {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 12px;
  border: 2px solid #fff;
  white-space: nowrap;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .35);
  transform: translate(-50%, -50%);
  width: auto !important;
  height: auto !important;
}
.region-marker.active { background: #1f1b16; }
@media (max-width: 760px) {
  main { flex-direction: column; }
  #map { flex: none; height: 42vh; }
  #panel { width: auto; flex: 1; border-left: 0; border-top: 1px solid var(--line); }
}
