@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@500;600;700;800&family=Noto+Sans+KR:wght@400;500;600;700&display=swap');

:root {
  --bg: #0b0d0a;
  --panel: #141712;
  --panel-2: #1a1e17;
  --line: rgba(255,255,255,.09);
  --text: #f1f4eb;
  --muted: #92998b;
  --accent: #d7f23b;
  --accent-dim: rgba(215,242,59,.13);
  --header-h: 72px;
  --sidebar-w: 332px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--text); }
body { font-family: "Noto Sans KR", system-ui, sans-serif; overflow: hidden; }
button, input { font: inherit; }
button { color: inherit; }

.app-shell { height: 100%; display: grid; grid-template-rows: var(--header-h) 1fr; }
.topbar {
  position: relative; z-index: 1000; display: grid; grid-template-columns: var(--sidebar-w) 1fr auto;
  align-items: center; height: var(--header-h); border-bottom: 1px solid var(--line);
  background: rgba(12,14,11,.97); box-shadow: 0 8px 30px rgba(0,0,0,.28);
}
.brand { height: 100%; display: flex; align-items: center; gap: 13px; padding: 0 22px; color: inherit; text-decoration: none; border-right: 1px solid var(--line); }
.brand-mark { display: grid; place-items: center; width: 35px; height: 35px; color: #10130b; background: var(--accent); font: 800 16px/1 "Barlow Condensed"; transform: skew(-7deg); }
.brand strong, .brand small { display: block; font-family: "Barlow Condensed", sans-serif; letter-spacing: .08em; }
.brand strong { font-size: 21px; line-height: 1; }
.brand small { margin-top: 4px; color: var(--muted); font-size: 9px; letter-spacing: .18em; }
.map-tabs { height: 100%; display: flex; align-items: stretch; justify-content: center; gap: 7px; }
.map-tab { position: relative; min-width: 104px; border: 0; background: transparent; color: #81877b; cursor: pointer; font: 700 16px "Barlow Condensed", "Noto Sans KR"; letter-spacing: .06em; transition: .2s; }
.map-tab::after { content: ""; position: absolute; left: 16px; right: 16px; bottom: 0; height: 3px; background: var(--accent); transform: scaleX(0); transition: .2s; }
.map-tab:hover { color: #daddd4; background: rgba(255,255,255,.025); }
.map-tab.active { color: var(--text); }
.map-tab.active::after { transform: scaleX(1); }
.top-actions { display: flex; align-items: center; gap: 12px; padding: 0 22px; }
.icon-button { border: 1px solid var(--line); border-radius: 5px; padding: 9px 12px; background: #181b16; font-size: 12px; cursor: pointer; }
.icon-button:hover { border-color: rgba(215,242,59,.45); }
.beta-badge { padding: 5px 8px; border-radius: 3px; color: #10130b; background: var(--accent); font: 800 10px "Barlow Condensed"; letter-spacing: .12em; }

.workspace { min-height: 0; display: grid; grid-template-columns: var(--sidebar-w) 1fr; }
.sidebar { z-index: 900; min-height: 0; display: flex; flex-direction: column; background: var(--panel); border-right: 1px solid var(--line); box-shadow: 15px 0 35px rgba(0,0,0,.18); }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 22px 20px 14px; }
.eyebrow { color: var(--accent); font: 700 9px "Barlow Condensed"; letter-spacing: .2em; }
.sidebar h1 { margin: 3px 0 0; font: 800 30px "Barlow Condensed", "Noto Sans KR"; letter-spacing: -.02em; }
.mobile-close { display: none; border: 0; background: transparent; font-size: 30px; }
.search-box { margin: 0 16px 15px; height: 42px; display: flex; align-items: center; gap: 8px; padding: 0 12px; background: #0f110e; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); }
.search-box:focus-within { border-color: rgba(215,242,59,.45); }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 13px; }
.search-box input::placeholder { color: #666d61; }
.panel-section { border-top: 1px solid var(--line); padding: 15px 16px; }
.section-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; color: #aeb4a8; font-size: 11px; font-weight: 700; letter-spacing: .04em; }
.section-title button { border: 0; background: transparent; color: var(--accent); padding: 0; font-size: 10px; cursor: pointer; }
.section-title b { min-width: 22px; text-align: center; padding: 2px 7px; color: var(--accent); background: var(--accent-dim); border-radius: 10px; font: 700 11px "Barlow Condensed"; }
.layer-list { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.layer-toggle { display: flex; align-items: center; gap: 9px; padding: 9px; border: 1px solid var(--line); border-radius: 5px; background: #181b16; color: #aab0a4; cursor: pointer; font-size: 11px; text-align: left; transition: .15s; }
.layer-toggle:hover { border-color: rgba(255,255,255,.18); }
.layer-toggle.active { color: var(--text); border-color: color-mix(in srgb, var(--category) 50%, transparent); background: color-mix(in srgb, var(--category) 10%, #181b16); }
.layer-symbol { display: grid; place-items: center; flex: 0 0 23px; height: 23px; border-radius: 50%; color: #111; background: var(--category); font: 800 11px "Barlow Condensed"; }
.feature-section { min-height: 0; flex: 1; display: flex; flex-direction: column; }
.feature-list { min-height: 0; overflow-y: auto; scrollbar-color: #343a30 transparent; scrollbar-width: thin; }
.feature-card { width: 100%; display: grid; grid-template-columns: 31px 1fr; gap: 10px; padding: 11px 7px; border: 0; border-bottom: 1px solid rgba(255,255,255,.055); background: transparent; text-align: left; cursor: pointer; }
.feature-card:hover { background: rgba(255,255,255,.035); }
.feature-card .layer-symbol { margin-top: 2px; width: 25px; height: 25px; }
.feature-card strong { display: block; margin-bottom: 4px; font-size: 12px; }
.feature-card small { display: -webkit-box; overflow: hidden; color: #777e72; font-size: 10px; line-height: 1.5; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.empty-state { padding: 28px 10px; color: var(--muted); text-align: center; font-size: 11px; }
.sample-notice { margin: 0 16px 16px; padding: 12px; border-left: 2px solid #d4a72c; background: rgba(212,167,44,.08); }
.sample-notice strong { color: #e6c86b; font-size: 10px; }
.sample-notice p { margin: 4px 0 0; color: #858b80; font-size: 9px; line-height: 1.5; }

.map-stage { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: #0b0d0a; }
#map { position: absolute; inset: 0; background: #0b0d0a; }
.map-shade { pointer-events: none; position: absolute; inset: 0; z-index: 400; box-shadow: inset 0 0 80px rgba(0,0,0,.45); }
.leaflet-container { font-family: "Noto Sans KR", sans-serif; }
.leaflet-zoom-anim .leaflet-zoom-animated { transition-duration: .16s; transition-timing-function: cubic-bezier(.2,.72,.2,1); }
.leaflet-tile-pane { filter: saturate(.88) contrast(1.04) brightness(.88); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { color: var(--text); background: #171a15; }
.leaflet-tooltip.terrain-title-label { padding: 5px 9px; border: 1px solid rgba(192,132,252,.78); border-radius: 4px; background: rgba(10,8,15,.86); box-shadow: 0 3px 12px rgba(0,0,0,.68); color: #f5eaff; font: 800 11px/1.2 "Noto Sans KR", Arial, sans-serif; letter-spacing: -.01em; text-shadow: 0 1px 2px #000; white-space: nowrap; pointer-events: none; }
.leaflet-tooltip.terrain-title-label::before { display: none; }
.leaflet-popup-content-wrapper { border: 1px solid rgba(255,255,255,.12); border-radius: 5px; box-shadow: 0 14px 35px rgba(0,0,0,.4); }
.leaflet-popup-content { width: auto !important; max-height: 78vh; margin: 15px; overflow-x: hidden; overflow-y: auto; scrollbar-color: #454c3d #11140f; scrollbar-width: thin; }
.popup-layout { width: 230px; }
.popup-layout.has-media { width: min(700px, calc(100vw - 90px)); }
.popup-info { min-width: 0; }
.popup-category { color: var(--popup-color); font: 700 10px "Barlow Condensed"; letter-spacing: .1em; }
.popup-title { margin: 4px 0 6px; font-size: 14px; }
.popup-copy { margin: 0; color: #949b8e; font-size: 11px; line-height: 1.6; }
.popup-coord { display: block; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); color: #697063; font: 500 9px monospace; }
.popup-quick-media { display: grid; min-width: 0; gap: 16px; }
.popup-media-item { min-width: 0; }
.popup-media-label { display: flex; align-items: center; gap: 9px; margin: 0 0 7px; }
.popup-media-label span { flex: 0 0 auto; color: var(--popup-color); font: 700 9px "Barlow Condensed"; letter-spacing: .1em; }
.popup-media-label strong { overflow: hidden; color: #d9ddd5; font-size: 11px; white-space: nowrap; text-overflow: ellipsis; }
.popup-media-stage { display: grid; place-items: center; width: 100%; overflow: hidden; border: 1px solid rgba(255,255,255,.13); border-radius: 5px; aspect-ratio: 16/9; background: #070907; }
.popup-media-stage iframe { display: block; width: 100%; height: 100%; border: 0; }
.popup-image-preview { position: relative; width: 100%; height: 100%; padding: 0; overflow: hidden; border: 0; background: #070907; cursor: zoom-in; }
.popup-image-preview img { display: block; width: 100%; height: 100%; object-fit: cover; }
.popup-image-preview span { position: absolute; right: 7px; bottom: 7px; padding: 5px 7px; border-radius: 3px; background: rgba(8,10,8,.85); color: #fff; font-size: 9px; }
.popup-media-empty { padding: 20px; color: var(--muted); font-size: 10px; }
.popup-media-tabs { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.popup-media-tab, .popup-expand-media { min-height: 27px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 3px; background: #1a1e17; color: #a8afa2; cursor: pointer; font-size: 9px; font-weight: 700; }
.popup-media-tab.active { border-color: var(--popup-color); color: #fff; background: color-mix(in srgb, var(--popup-color) 12%, #171a15); }
.popup-expand-media { margin-left: auto; color: var(--accent); }
.popup-media-tab:hover, .popup-expand-media:hover { filter: brightness(1.18); }
.leaflet-popup-close-button { color: #93998e !important; }
.guide-marker { background: transparent; border: 0; }
.guide-marker-inner { position: relative; display: grid; place-items: center; width: 30px; height: 30px; color: #111; background: var(--marker); border: 2px solid rgba(255,255,255,.85); border-radius: 50% 50% 50% 12%; box-shadow: 0 4px 12px rgba(0,0,0,.55); transform: rotate(-45deg); font: 800 12px "Barlow Condensed"; }
.guide-marker-inner span { transform: rotate(45deg); }
.floating-tools { position: absolute; top: 18px; right: 18px; z-index: 500; display: grid; overflow: hidden; border: 1px solid var(--line); border-radius: 5px; box-shadow: 0 7px 24px rgba(0,0,0,.35); }
.floating-tools button { width: 38px; height: 38px; border: 0; border-bottom: 1px solid var(--line); background: rgba(20,23,18,.94); cursor: pointer; font-size: 18px; }
.floating-tools button:last-child { border-bottom: 0; font-size: 15px; }
.floating-tools button:hover { color: var(--accent); background: #20251c; }
.distance-guide { position: absolute; z-index: 500; top: 154px; right: 18px; display: grid; grid-template-columns: 28px auto auto; align-items: center; gap: 8px; min-height: 46px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 5px; background: rgba(20,23,18,.94); box-shadow: 0 7px 24px rgba(0,0,0,.35); color: #aab0a4; }
.distance-guide-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: rgba(215,242,59,.11); color: var(--accent); font: 800 17px "Barlow Condensed"; }
.distance-guide strong, .distance-guide small { display: block; white-space: nowrap; }
.distance-guide strong { color: #e9ece4; font-size: 10px; }
.distance-guide small { margin-top: 2px; color: #8e9588; font-size: 9px; }
.distance-guide kbd { padding: 1px 4px; border: 1px solid rgba(255,255,255,.2); border-bottom-width: 2px; border-radius: 3px; background: #0d0f0c; color: #dce0d7; font: 700 8px monospace; }
.distance-guide button { margin-left: 2px; padding: 5px 7px; border: 1px solid rgba(215,242,59,.35); border-radius: 3px; background: rgba(215,242,59,.08); color: var(--accent); cursor: pointer; font-size: 9px; }
.distance-guide.active { border-color: rgba(215,242,59,.38); }
.distance-guide.complete { background: rgba(25,31,18,.97); }
.leaflet-tooltip.distance-measure-label { display: flex; align-items: baseline; gap: 6px; padding: 6px 9px; border: 1px solid rgba(215,242,59,.8); border-radius: 4px; background: rgba(11,14,9,.94); box-shadow: 0 4px 16px rgba(0,0,0,.5); color: #fff; white-space: nowrap; pointer-events: none; }
.leaflet-tooltip.distance-measure-label::before { border-top-color: rgba(215,242,59,.8); }
.distance-measure-label span { color: #a9b09f; font: 700 8px "Noto Sans KR"; }
.distance-measure-label strong { color: var(--accent); font: 800 13px "Barlow Condensed", monospace; letter-spacing: .03em; }
.map-status, .coordinate-readout { position: absolute; z-index: 500; bottom: 15px; display: flex; align-items: center; gap: 9px; height: 29px; padding: 0 11px; border: 1px solid var(--line); border-radius: 4px; background: rgba(15,17,14,.9); backdrop-filter: blur(8px); color: #949a8e; font: 700 9px "Barlow Condensed"; letter-spacing: .08em; }
.map-status { left: 15px; }
.coordinate-readout { right: 15px; font-family: monospace; }
.map-status i { width: 1px; height: 10px; background: var(--line); }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px rgba(215,242,59,.65); }
.mobile-panel-button { display: none; }
.toast { position: absolute; z-index: 1200; left: 50%; bottom: 58px; padding: 10px 14px; border: 1px solid rgba(215,242,59,.35); border-radius: 4px; background: rgba(15,17,14,.96); color: var(--accent); font-size: 11px; opacity: 0; transform: translate(-50%, 10px); pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.popup-media-button { width: 100%; margin-top: 11px; padding: 9px 10px; border: 1px solid color-mix(in srgb, var(--popup-color) 55%, transparent); border-radius: 4px; background: color-mix(in srgb, var(--popup-color) 10%, #151914); color: #f5f7f1; cursor: pointer; font-size: 11px; font-weight: 700; }
.popup-media-button:hover { filter: brightness(1.16); }
.media-modal[hidden] { display: none; }
.media-modal { position: fixed; inset: 0; z-index: 5000; display: grid; place-items: center; padding: 22px; }
.media-modal-backdrop { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: rgba(3,5,3,.96); cursor: default; }
.media-open .app-shell { visibility: hidden; }
.media-dialog { position: relative; z-index: 1; contain: layout paint; width: min(980px, 94vw); max-height: 92vh; overflow: auto; padding: 24px; border: 1px solid rgba(255,255,255,.14); border-radius: 8px; background: #121510; box-shadow: 0 20px 55px rgba(0,0,0,.55); }
.media-close { position: absolute; z-index: 2; right: 14px; top: 12px; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 50%; background: #1c2119; color: #fff; cursor: pointer; font-size: 23px; }
.media-dialog-head { padding-right: 50px; }
.media-dialog-head>span { color: var(--accent); font: 700 10px "Barlow Condensed"; letter-spacing: .13em; }
.media-dialog-head h2 { margin: 5px 0 7px; font-size: 24px; }
.media-dialog-head p { margin: 0 0 17px; color: #969d91; font-size: 12px; line-height: 1.7; white-space: pre-wrap; }
.media-stage { position: relative; display: grid; place-items: center; width: 100%; min-height: 360px; overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: #070907; }
.media-stage>img { display: block; max-width: 100%; max-height: 62vh; object-fit: contain; }
.media-stage iframe { display: block; width: 100%; aspect-ratio: 16/9; border: 0; }
.youtube-play-preview { position: relative; width: 100%; min-height: 360px; border: 0; background: #080a08; cursor: pointer; overflow: hidden; }
.youtube-play-preview img { width: 100%; height: 100%; min-height: 360px; object-fit: cover; opacity: .68; }
.youtube-play-preview span { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); display: grid; place-items: center; width: 74px; height: 52px; border-radius: 13px; background: #f00; color: #fff; font-size: 25px; box-shadow: 0 8px 30px #000; }
.media-thumbnails { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 9px; margin-top: 12px; }
.media-thumb-button { min-width: 0; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 5px; background: #191d16; text-align: left; cursor: pointer; }
.media-thumb-button.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.media-thumb-button img { display: block; width: 100%; height: 92px; object-fit: cover; background: #080a08; }
.media-thumb-button span { display: block; overflow: hidden; padding: 8px; color: #b6bcb1; font-size: 10px; white-space: nowrap; text-overflow: ellipsis; }

@media (max-width: 900px) {
  :root { --header-h: 61px; }
  .topbar { grid-template-columns: auto 1fr; }
  .brand { padding: 0 14px; border-right: 0; }
  .brand small, .top-actions { display: none; }
  .map-tabs { justify-content: flex-end; overflow-x: auto; padding-right: 8px; }
  .map-tab { min-width: 72px; font-size: 13px; }
  .workspace { grid-template-columns: 1fr; }
  .sidebar { position: absolute; inset: var(--header-h) auto 0 0; width: min(88vw, 340px); transform: translateX(-105%); transition: transform .25s ease; }
  .sidebar.open { transform: translateX(0); }
  .mobile-close { display: block; }
  .mobile-panel-button { position: absolute; z-index: 500; display: block; left: 12px; top: 12px; border: 1px solid var(--line); border-radius: 5px; padding: 10px 12px; background: rgba(20,23,18,.94); font-size: 11px; }
  .floating-tools { top: 12px; right: 12px; }
  .distance-guide { top: 148px; right: 12px; }
  .coordinate-readout { display: none; }
  .map-status { left: 10px; bottom: 10px; }
}

@media (max-width: 700px) {
  .popup-layout.has-media { width: min(440px, calc(100vw - 70px)); }
  .popup-quick-media { gap: 13px; }
}

@media (max-width: 520px) {
  .brand-mark { width: 30px; height: 30px; }
  .brand strong { font-size: 17px; }
  .map-tab { min-width: 62px; font-size: 12px; }
  .map-status span:nth-of-type(3), .map-status i:nth-of-type(2) { display: none; }
  .distance-guide { grid-template-columns: 26px auto; }
  .distance-guide button { grid-column: 1 / -1; margin: 0; }
  .media-modal { padding: 0; }
  .media-dialog { width: 100%; max-height: 100vh; min-height: 100vh; padding: 18px; border: 0; border-radius: 0; }
  .media-dialog-head h2 { font-size: 20px; }
  .media-stage, .youtube-play-preview, .youtube-play-preview img { min-height: 230px; }
  .media-thumbnails { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
