:root {
  --bg: #0b1020;
  --panel: rgba(15, 23, 42, 0.92);
  --panel-2: rgba(30, 41, 59, 0.86);
  --text: #e5e7eb;
  --muted: #94a3b8;
  --line: rgba(148, 163, 184, 0.22);
  --accent: #93c5fd;
  --danger: #fb7185;
  --shadow: 0 20px 70px rgba(0,0,0,.35);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", sans-serif; }
button, input, select { font: inherit; }
#app { display: none; grid-template-columns: 1fr 360px; height: 100vh; }
html.appReady #app { display: grid; }
#stageWrap { position: relative; overflow: hidden; background:
  radial-gradient(circle at 25% 20%, rgba(59,130,246,.14), transparent 26%),
  radial-gradient(circle at 75% 80%, rgba(236,72,153,.13), transparent 28%),
  linear-gradient(135deg, #0b1020 0%, #111827 52%, #0f172a 100%); }
#toolbar { position: absolute; top: 16px; left: 16px; z-index: 20; display: flex; align-items: center; gap: 8px; padding: 10px; border: 1px solid var(--line); background: rgba(15,23,42,.72); border-radius: 16px; backdrop-filter: blur(10px); box-shadow: var(--shadow); }
.toolBtn { border: 1px solid rgba(148,163,184,.25); background: rgba(30,41,59,.72); color: var(--text); border-radius: 12px; padding: 8px 10px; cursor: pointer; }
.toolBtn:hover { background: rgba(51,65,85,.82); }
#legend { position: absolute; left: 16px; bottom: 16px; z-index: 20; max-width: 620px; border: 1px solid var(--line); background: rgba(15,23,42,.72); border-radius: 16px; backdrop-filter: blur(10px); box-shadow: var(--shadow); color: var(--muted); font-size: 13px; line-height: 1.55; overflow: hidden; }
.legendHeader { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-bottom: 1px solid rgba(148,163,184,.16); color: #e5e7eb; }
.legendTitle { font-size: 13px; font-weight: 800; letter-spacing: .01em; }
#legendToggleBtn { border: 1px solid rgba(148,163,184,.28); background: rgba(30,41,59,.72); color: #cbd5e1; border-radius: 999px; padding: 4px 9px; cursor: pointer; font-size: 12px; line-height: 1.2; }
#legendToggleBtn:hover { background: rgba(51,65,85,.82); color: #f8fafc; }
.legendMobileToggleBtn { display: none; border: 1px solid rgba(148,163,184,.28); background: rgba(30,41,59,.78); color: #cbd5e1; border-radius: 999px; padding: 7px 12px; cursor: pointer; font-size: 12px; line-height: 1.2; }
.legendMobileToggleBtn:hover { background: rgba(51,65,85,.86); color: #f8fafc; }
#legend .legendBody { padding: 0 14px 12px; }
#legend.isCollapsed { max-width: 150px; }
#legend.isCollapsed .legendHeader { border-bottom: 0; }
#legend.isCollapsed .legendBody { display: none; }
#legend .legendList { margin: 0; padding-left: 18px; }
#legend .legendList ul { margin: 4px 0 0; padding-left: 18px; }
#legend .legendList li { margin: 2px 0; }
.entryNotice { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(2,6,23,.68); backdrop-filter: blur(8px); }
.entryNotice.isHidden { display: none; }
html.entryNoticeSuppressed .entryNotice { display: none; }
.entryNoticePanel { width: min(560px, 100%); max-height: min(680px, calc(100dvh - 32px)); overflow: auto; border: 1px solid rgba(148,163,184,.30); background: rgba(15,23,42,.96); color: #e5e7eb; border-radius: 16px; box-shadow: 0 28px 90px rgba(0,0,0,.42); padding: 24px; }
.entryNoticeEyebrow { margin: 0 0 8px; color: #93c5fd; font-size: 12px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.entryNoticePanel h2 { margin: 0; color: #f8fafc; font-size: 22px; line-height: 1.3; letter-spacing: 0; }
.entryNoticePanel p { margin: 12px 0 0; color: #cbd5e1; font-size: 14px; line-height: 1.65; }
.entryNoticePanel ul { margin: 14px 0 0; padding-left: 20px; color: #cbd5e1; font-size: 13px; line-height: 1.6; }
.entryNoticePanel li { margin: 5px 0; }
.entryNoticeActions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; flex-wrap: wrap; }
.entryNoticeSecondaryBtn { border: 1px solid rgba(148,163,184,.34); background: rgba(30,41,59,.72); color: #cbd5e1; border-radius: 12px; padding: 10px 14px; cursor: pointer; font-size: 13px; font-weight: 800; }
.entryNoticeSecondaryBtn:hover { background: rgba(51,65,85,.86); color: #f8fafc; }
.entryNoticeCloseBtn { border: 1px solid rgba(147,197,253,.58); background: rgba(37,99,235,.82); color: #f8fafc; border-radius: 12px; padding: 10px 14px; cursor: pointer; font-size: 13px; font-weight: 800; }
.entryNoticeCloseBtn:hover { background: rgba(59,130,246,.92); }
#mapCanvas { width: 100%; height: 100%; display: block; cursor: grab; user-select: none; touch-action: none; }
#mapCanvas.dragging { cursor: grabbing; }
#sidePanel { border-left: 1px solid var(--line); background: var(--panel); backdrop-filter: blur(14px); overflow: auto; box-shadow: -20px 0 60px rgba(0,0,0,.18); }
.panelInner { padding: 20px; }
.titleBlock h1 { margin: 0 0 6px 0; font-size: 20px; line-height: 1.25; }
.titleBlock p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.periodPanel { margin-top: 14px; padding: 12px; border: 1px solid rgba(148,163,184,.24); border-radius: 14px; background: rgba(15,23,42,.46); }
.periodLabel { display: block; margin-bottom: 6px; color: #cbd5e1; font-size: 12px; font-weight: 800; }
.section { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.section h2 { margin: 0 0 10px; font-size: 14px; color: #cbd5e1; letter-spacing: -.01em; }
.statGrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat { border: 1px solid var(--line); background: rgba(15,23,42,.55); border-radius: 14px; padding: 10px; }
.stat b { display: block; font-size: 15px; color: #fff; }
.stat span { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }
.tooltip { position: fixed; z-index: 50; display: none; max-width: 360px; padding: 10px 12px; border: 1px solid rgba(148,163,184,.25); background: rgba(2,6,23,.92); color: #f8fafc; border-radius: 14px; box-shadow: var(--shadow); pointer-events: none; font-size: 12px; line-height: 1.45; }
.tooltip b { display: block; font-size: 13px; margin-bottom: 4px; }
.badge { display:inline-flex; align-items:center; gap:4px; padding:2px 7px; border:1px solid rgba(148,163,184,.28); border-radius:999px; color:#cbd5e1; background:rgba(30,41,59,.48); font-size:11px; margin:2px 4px 2px 0; }
a { color: #93c5fd; text-decoration: none; }
a:hover { text-decoration: underline; }
.smallNote { color: var(--muted); font-size: 12px; line-height: 1.55; }
.toggleRow { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0; color: #cbd5e1; font-size: 13px; }
.toggleText { display:flex; flex-direction:column; gap:2px; min-width:0; }
.toggleHint { color: var(--muted); font-size: 11px; line-height: 1.25; }
.switch { position: relative; display: inline-flex; align-items: center; width: 42px; height: 24px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.switchSlider { position: absolute; cursor: pointer; inset: 0; background: rgba(71,85,105,.92); border: 1px solid rgba(148,163,184,.35); border-radius: 999px; transition: .16s ease; }
.switchSlider:before { content: ""; position: absolute; width: 18px; height: 18px; left: 2px; top: 2px; background: rgba(248,250,252,.92); border-radius: 50%; box-shadow: 0 2px 8px rgba(0,0,0,.28); transition: .16s ease; }
.switch input:checked + .switchSlider { background: rgba(59,130,246,.78); border-color: rgba(147,197,253,.72); }
.switch input:checked + .switchSlider:before { transform: translateX(18px); }
input[type="range"] { width: 140px; }
.edgePercentSelect, .periodSelect { min-width: 92px; padding: 6px 10px; border: 1px solid rgba(148,163,184,.35); border-radius: 10px; background: rgba(15,23,42,.75); color: #e5e7eb; outline: none; }
.periodSelect { width: 100%; }
.edgePercentSelect:focus, .periodSelect:focus { border-color: rgba(147,197,253,.75); box-shadow: 0 0 0 3px rgba(59,130,246,.18); }
.searchPanel { margin-top: 14px; position: relative; }
.searchInputWrap { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid rgba(148,163,184,.30); border-radius: 14px; background: rgba(15,23,42,.62); }
.searchIcon { color: var(--muted); font-size: 14px; flex: 0 0 auto; }
#mapSearchInput { width: 100%; min-width: 0; border: 0; outline: none; background: transparent; color: #f8fafc; font-size: 13px; }
#mapSearchInput::placeholder { color: rgba(148,163,184,.82); }
#clearSearchBtn { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 2px 4px; border-radius: 8px; font-size: 14px; line-height: 1; }
#clearSearchBtn:hover { color: #f8fafc; background: rgba(148,163,184,.14); }
.searchResults { margin-top: 8px; display: grid; gap: 6px; max-height: 260px; overflow: auto; padding-right: 2px; }
.searchResults:empty { display: none; }
.searchResultItem { border: 1px solid rgba(148,163,184,.22); background: rgba(15,23,42,.58); border-radius: 13px; padding: 9px 10px; cursor: pointer; }
.searchResultItem:hover, .searchResultItem.active { border-color: rgba(147,197,253,.62); background: rgba(30,41,59,.80); }
.searchResultTitle { color: #f8fafc; font-size: 13px; font-weight: 800; line-height: 1.32; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.searchResultMeta { margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.searchResultBadge { display: inline-flex; align-items: center; padding: 1px 6px; margin-right: 5px; border-radius: 999px; border: 1px solid rgba(148,163,184,.24); background: rgba(30,41,59,.58); color: #cbd5e1; font-size: 10px; }
@media (max-width: 980px) {
  #app { grid-template-columns: 1fr; grid-template-rows: 1fr 42vh; }
  #sidePanel { border-left: 0; border-top: 1px solid var(--line); }
  #toolbar { top: 10px; left: 10px; }
  #legend { left: 10px; right: 10px; bottom: 10px; max-width: none; max-height: min(58vh, calc(100dvh - 20px)); display: flex; flex-direction: column; }
  #legendToggleBtn { display: none; }
  #legend .legendBody { overflow: auto; padding-bottom: 10px; }
  #legend.isCollapsed { max-width: none; max-height: none; }
  .legendMobileToggleBtn { display: inline-flex; align-self: flex-end; margin: 0 12px 12px; flex: 0 0 auto; }
  .entryNotice { padding: 16px; }
  .entryNoticePanel { padding: 20px; max-height: calc(100dvh - 32px); }
  .entryNoticePanel h2 { font-size: 19px; }
  .entryNoticeActions { flex-direction: column; justify-content: stretch; }
  .entryNoticeCloseBtn, .entryNoticeSecondaryBtn { width: 100%; }
}
