:root {
  --bg: #0e1420;
  --panel: #161e2e;
  --line: #2a3550;
  --text: #e6ebf5;
  --muted: #8d99b3;
  --accent: #f2c14e;
  --vis: #3ecf8e;
  --edge: #f2994a;
  --hid: #e5484d;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  font-size: 16px; display: flex; flex-direction: column; min-height: 100vh;
}
button, input, select { font: inherit; color: inherit; }
button {
  background: #22304a; border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 14px; cursor: pointer;
}
button:hover { background: #2b3d5e; }
input, select {
  background: #0b111b; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
}

.top {
  display: flex; gap: 16px; align-items: center; padding: 10px 16px;
  background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 19px; }
.brand img { width: 28px; height: 28px; }
.search { display: flex; gap: 6px; flex: 1; min-width: 260px; max-width: 560px; }
.search input { flex: 1; min-width: 0; }

.controls {
  display: flex; gap: 14px; align-items: center; padding: 10px 16px; flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
}
.controls label { display: flex; gap: 8px; align-items: center; color: var(--muted); }
.controls label.grow { flex: 1; min-width: 240px; }
.controls label.grow input { flex: 1; accent-color: var(--accent); }
.opts { display: contents; }
#optBtn { display: none; }
.nt .msum { display: none; }
.controls b { color: var(--text); min-width: 112px; font-variant-numeric: tabular-nums; }

.chips { display: flex; gap: 6px; padding: 8px 16px; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: thin; }
.chip {
  display: flex; align-items: center; gap: 6px; white-space: nowrap; padding: 6px 12px;
  border-radius: 999px; background: #1a2336; border: 1px solid var(--line); font-weight: 700;
}
.chip i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.chip small { font-weight: 400; color: var(--muted); font-size: 12px; }
.chip.vis small { color: var(--vis); }
.chip.edge small { color: var(--edge); }
.chip.hid, .chip.bright, .chip.down { opacity: .45; }
.chip.sel { opacity: 1; border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.objinfo {
  padding: 10px 16px; font-size: 17px; border-bottom: 1px solid var(--line); min-height: 44px;
}
.objinfo .tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-weight: 700; margin-right: 8px; }
.tag.vis { background: rgba(62,207,142,.18); color: var(--vis); }
.tag.edge { background: rgba(242,153,74,.18); color: var(--edge); }
.tag.hid { background: rgba(229,72,77,.18); color: var(--hid); }
.tag.down { background: #232b3b; color: var(--muted); }
.objinfo .sub { color: var(--muted); }

.tabs { display: flex; gap: 4px; padding: 8px 16px 0; border-bottom: 1px solid var(--line); }
.tab { border-radius: 8px 8px 0 0; border-bottom: none; background: transparent; color: var(--muted); }
.tab.active { background: var(--panel); color: var(--text); font-weight: 700; }

main { flex: 1; display: flex; min-height: 0; }
.pane { display: none; flex: 1; flex-direction: column; min-height: 0; }
.pane.active { display: flex; }
#map { flex: 1; min-height: 420px; background: #0b111b; }
.legend {
  display: flex; gap: 16px; flex-wrap: wrap; padding: 8px 16px; font-size: 14px; color: var(--muted);
  align-items: center;
}
.sw { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: -2px; margin-right: 5px; }
.sw.vis { background: rgba(62,207,142,.45); }
.sw.hid { background: rgba(10,14,24,.75); border: 1px solid #555; }
.sw.bd { background: transparent; border: 2px solid #d9e2f2; }
.sw.bd.est { border: 2px dashed #f2c14e; }
.sw.bd.br { border: 2px dashed #6fb3ff; }
.legend .tip { color: #6b7894; }
.status { margin-left: auto; }

.hint { color: var(--muted); margin: 10px 16px; font-size: 14px; }
.panowrap { flex: 1; padding: 0 16px 16px; min-height: 320px; }
#pano { width: 100%; height: 100%; display: block; border-radius: 10px; }

#nightTable { padding: 0 16px 16px; overflow-x: auto; }
.nt { width: 100%; border-collapse: collapse; }
.nt td { padding: 4px 6px; }
.nt tr { cursor: pointer; }
.nt tr:hover td { background: #1b2538; }
.nt tr.sel td { background: #22304a; }
.nt .name { width: 150px; font-weight: 700; font-size: 14px; line-height: 1.2; }
.nt .sum { white-space: nowrap; color: var(--muted); font-size: 14px; width: 260px; }
.bar { position: relative; height: 22px; background: #0b111b; border-radius: 4px; overflow: hidden; display: flex; }
.bar i { display: block; height: 100%; }
.bar .now { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--accent); }
.axis { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }

.foot { padding: 6px 16px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }

.leaflet-container { font: inherit; }
.basemap { filter: brightness(.55) saturate(.4) contrast(1.1); }
.bpop label { display: block; margin-top: 6px; }
.bpop input { width: 70px; color: #111; background: #fff; }
.bpop button { color: #111; background: #eee; margin-top: 6px; padding: 4px 10px; }

.foot a { color: inherit; }

/* 휴대폰: 지도 영역을 우선 확보, 페이지 전체 스크롤 없이 */
@media (max-width: 700px) {
  body { font-size: 15px; height: 100dvh; min-height: 0; overflow: hidden; }
  .top { padding: 6px 10px; gap: 6px; flex-wrap: nowrap; }
  .brand span { display: none; }
  .search { min-width: 0; }
  .search button { padding: 8px 10px; }
  .controls { gap: 6px 8px; padding: 6px 10px; flex-wrap: wrap; }
  .controls label.grow { flex: 1 1 0; min-width: 0; }
  .controls label.grow .lbl { display: none; }
  .controls b { min-width: 0; font-size: 14px; }
  #nowBtn, #optBtn { padding: 6px 10px; }
  #optBtn { display: inline-block; }
  .opts { display: none; }
  .controls.open .opts { display: flex; flex-wrap: wrap; gap: 6px 10px; flex-basis: 100%; }
  .chips { padding: 6px 10px; }
  .chip { padding: 5px 10px; }
  .objinfo { padding: 6px 10px; font-size: 13px; min-height: 0; }
  .objinfo .tag { font-size: 14px; }
  .objinfo .sub { display: block; margin-top: 4px; }
  .tabs { padding: 4px 10px 0; }
  .tab { padding: 6px 10px; flex: 1; }
  main { min-height: 0; overflow: hidden; }
  .pane.active { overflow-y: auto; }
  #map { min-height: 0; }
  .legend { gap: 4px 8px; padding: 4px 10px; font-size: 11px; }
  .legend .tip, .legend .status { display: none; }
  .hint { margin: 6px 10px; font-size: 12px; }
  .panowrap { padding: 0 10px 10px; overflow-x: auto; min-height: 280px; }
  #nightTable { padding: 0 10px 10px; }
  .nt .sum { display: none; }
  .nt .name { width: 42%; font-size: 13px; }
  .nt .msum { display: block; font-weight: 400; color: var(--muted); font-size: 11px; margin-top: 2px; }
  .foot { font-size: 9px; padding: 2px 10px; line-height: 1.3; }
}
