/* 빈칸 지도 — 온스퀘어 디자인 시스템 토큰 기반 */
:root {
  --navy: #0d263c; --navy-2: #163049; --navy-3: #1e3a55; --navy-line: #2a4560;
  --white: #ffffff; --surface-100: #f7f8fa; --surface-200: #edeff2; --line: #dee2e7;
  --ink-muted: #6b7280; --ink-muted-dark: #a9b4c2;
  --orange-deep: #f34d25; --orange-bright: #ff7834;
  --lv1: #9aa8b8; --lv2: #3fa7a0; --lv3: #f2c14e; --lv4: #c2185b; --lv5: #7a0c24;
  --bg: var(--navy); --fg: var(--white); --muted: var(--ink-muted-dark); --rule: var(--navy-line);
  --card: var(--navy-2); --accent: var(--orange-bright);
  --font: "Pretendard Variable", Pretendard, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
}
body[data-view="brief"] {
  --bg: var(--white); --fg: var(--navy); --muted: var(--ink-muted); --rule: var(--line);
  --card: var(--surface-100); --accent: var(--orange-deep);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--fg); font-family: var(--font); font-size: 15px; line-height: 1.5;
  display: flex; flex-direction: column; overflow: hidden; }
body[data-view="brief"] { overflow: auto; border-top: 6px solid var(--navy); }
button, a.btn { font: inherit; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* 상단 */
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; padding: 14px 24px;
  border-bottom: 1px solid var(--rule); flex-shrink: 0; }
.brand { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.brand .name { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.brand .tag { font-size: 12px; color: var(--muted); }
.brand .asof { font-size: 13px; color: var(--muted); margin-left: 8px; white-space: nowrap; }
.chips { display: flex; gap: 6px; flex: 1 1 auto; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { height: 36px; padding: 0 13px; border-radius: 6px; border: 1px solid var(--rule); background: transparent;
  color: var(--fg); font-size: 14px; font-weight: 500; white-space: nowrap; cursor: pointer; flex-shrink: 0; }
.chip[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); font-weight: 700; }
.tools { display: flex; gap: 8px; align-items: center; }
.seg { display: flex; border: 1px solid var(--rule); border-radius: 6px; overflow: hidden; }
.seg button { height: 36px; padding: 0 12px; border: 0; background: transparent; color: var(--fg); font-size: 14px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--fg); color: var(--bg); font-weight: 700; }
.btn { display: inline-flex; align-items: center; justify-content: center; height: 40px; padding: 0 14px; border-radius: 6px;
  border: 1px solid var(--fg); background: transparent; color: var(--fg); font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn.solid { background: var(--fg); color: var(--bg); }
.btn.wide { width: 100%; height: 48px; font-size: 15px; font-weight: 700; }
.btn.link { border: 0; height: 36px; color: var(--muted); }
body.locked #prefsBtn { display: none; }
body:not(.locked) #signupBtn { display: none; }
.stale { background: var(--lv3); color: var(--navy); padding: 8px 24px; font-size: 14px; font-weight: 600; }

/* 무대 */
.stage { position: relative; flex: 1 1 auto; display: grid; grid-template-columns: minmax(0, 1fr) 460px; min-height: 0; }
.mapwrap { position: relative; min-height: 0; }
#map { position: absolute; inset: 0; }
.panel { border-left: 1px solid var(--rule); display: flex; flex-direction: column; min-height: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; padding: 16px 20px 10px; font-size: 17px; font-weight: 700; }
.panel-head .muted { font-size: 13px; font-weight: 400; }
.list { list-style: none; margin: 0; padding: 0 20px 12px; overflow-y: auto; flex: 1 1 auto; display: flex; flex-direction: column; gap: 10px; }
.panel-foot { padding: 14px 20px 18px; border-top: 1px solid var(--rule); display: flex; flex-direction: column; gap: 10px; }
.notice { margin: 0; font-size: 11px; line-height: 1.5; color: var(--muted); }

/* 항목 */
.item { background: var(--card); border: 1px solid var(--rule); padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; cursor: pointer; }
.item.sel { background: var(--white); color: var(--navy); border-color: var(--white); }
body[data-view="brief"] .item.sel { border: 2px solid var(--orange-deep); }
.item .row1 { display: flex; align-items: center; gap: 10px; }
.item .title { font-size: 15px; font-weight: 700; flex: 1 1 auto; }
.item .meta { font-size: 13px; color: var(--muted); }
.item.sel .meta { color: var(--ink-muted); }
.item .impact, .item .action { font-size: 14px; }
.item .action { font-weight: 600; }
.item .foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding-top: 6px; border-top: 1px solid var(--line); }
.item .src { font-size: 12px; color: var(--ink-muted); }
.item:not(.sel) .impact, .item:not(.sel) .foot { display: none; }
.item .lockline { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.item.sel .lockline { color: var(--ink-muted); }
.item.locked-row { cursor: pointer; opacity: 0.85; }
.copy { height: 36px; padding: 0 12px; border-radius: 6px; border: 1px solid var(--navy); background: var(--white); color: var(--navy); font-size: 13px; font-weight: 600; cursor: pointer; }
.copy[disabled] { opacity: 0.5; cursor: default; }
.demo { white-space: nowrap; flex-shrink: 0; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 2px; background: var(--surface-200); color: var(--navy); }

/* 단계 배지 */
.lv { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px; flex-shrink: 0; color: var(--navy); }
.lv1 { background: var(--lv1); } .lv2 { background: var(--lv2); } .lv3 { background: var(--lv3); }
.lv4 { background: var(--lv4); color: var(--white); } .lv5 { background: var(--lv5); color: var(--white); box-shadow: 0 0 0 1px var(--white); }

/* 지도 표식 */
.mk { border-radius: 50%; display: flex; align-items: center; justify-content: center; font: 800 12px var(--font);
  border: 2px solid var(--navy); cursor: pointer; color: var(--navy); }
.mk.lv4, .mk.lv5 { border-color: var(--white); color: var(--white); }
.mk.sel { outline: 3px solid var(--white); outline-offset: 3px; }
.mk.dim { opacity: 0.25; }

.legend { position: absolute; left: 20px; bottom: 18px; display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 13px;
  background: color-mix(in srgb, var(--bg) 85%, transparent); padding: 8px 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .lv { width: 20px; height: 20px; font-size: 11px; }

/* 상세 카드(지도 보기) */
.detail { display: none; }

/* 브리핑 보기 */
.brief-top { display: none; }
body[data-view="brief"] .brief-top { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; padding: 20px 24px 0; }
body[data-view="brief"] .brief-top .item { background: var(--surface-100); border: 1px solid var(--line); color: var(--navy); padding: 18px; }
body[data-view="brief"] .brief-top .item:first-child { background: var(--white); border: 2px solid var(--orange-deep); }
body[data-view="brief"] .brief-top .item .impact, body[data-view="brief"] .brief-top .item .foot { display: flex; }
body[data-view="brief"] .brief-top .item .title { font-size: 19px; }
body[data-view="brief"] .stage { grid-template-columns: 420px minmax(0, 1fr); padding: 20px 24px; gap: 20px; min-height: 520px; }
body[data-view="brief"] .mapwrap { order: 0; border: 1px solid var(--line); min-height: 420px; }
body[data-view="brief"] .panel { border-left: 0; }
body[data-view="brief"] .item { background: transparent; border: 0; border-bottom: 1px solid var(--line); }
body[data-view="brief"] .item.sel { background: var(--surface-100); }
body[data-view="brief"] .legend { background: var(--white); }

/* 지도 보기 */
body[data-view="map"] .stage { grid-template-columns: minmax(0, 1fr); }
body[data-view="map"] .panel { position: absolute; right: 20px; top: 20px; width: 300px; max-height: calc(100% - 200px);
  background: var(--white); color: var(--navy); border: 0; z-index: 2; --muted: var(--ink-muted); --rule: var(--line); --card: var(--white); }
body[data-view="map"] .panel .item { border: 0; border-bottom: 1px solid var(--line); padding: 10px 4px; }
body[data-view="map"] .panel .item .impact, body[data-view="map"] .panel .item .action, body[data-view="map"] .panel .item .foot,
body[data-view="map"] .panel .item .meta, body[data-view="map"] .panel .item .lockline { display: none; }
body[data-view="map"] .panel .item.sel { background: #fcf2e6; }
body[data-view="map"] .panel-foot { display: none; }
body[data-view="map"] .detail { display: flex; flex-direction: column; gap: 8px; position: absolute; left: 20px; top: 20px; width: 380px;
  background: var(--white); color: var(--navy); padding: 18px; z-index: 2; }
.detail .title { font-size: 19px; font-weight: 700; }
.detail .meta { font-size: 13px; color: var(--ink-muted); }
.detail .note { background: var(--surface-100); border: 1px solid var(--line); padding: 10px 12px; font-size: 13px; }
.detail .nav { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--ink-muted); }
.detail .nav button { height: 36px; min-width: 44px; border: 1px solid var(--line); background: var(--white); color: var(--navy); border-radius: 6px; cursor: pointer; }

/* 대화상자 */
dialog { border: 0; padding: 0; max-width: 440px; width: calc(100% - 32px); color: var(--navy); background: var(--white); }
dialog::backdrop { background: rgba(13, 38, 60, 0.6); }
.dlg { padding: 24px; display: flex; flex-direction: column; gap: 12px; --fg: var(--navy); --bg: var(--white); --muted: var(--ink-muted); }
.dlg h2 { margin: 0; font-size: 20px; }
.dlg p { margin: 0; font-size: 14px; }
.dlg fieldset { border: 1px solid var(--line); padding: 10px 12px; margin: 0; }
.dlg legend { font-size: 13px; font-weight: 700; padding: 0 4px; }
.opts { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: 14px; }
.opts label { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; }
.row { display: flex; gap: 8px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--white); color: var(--navy);
  padding: 12px 18px; font-size: 14px; font-weight: 600; box-shadow: 0 0 0 1px var(--line); opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 10; }
.toast.on { opacity: 1; }

/* 휴대폰 */
@media (max-width: 820px) {
  .top { padding: 12px 16px; gap: 10px; }
  .brand .asof { margin-left: auto; }
  .brand { width: 100%; }
  .chips { order: 3; width: 100%; flex-basis: 100%; }
  .tools { width: 100%; }
  .seg { flex: 1 1 auto; } .seg button { flex: 1 1 0; }
  body { overflow: auto; }
  .stage { display: flex; flex-direction: column; }
  .mapwrap { height: 42vh; min-height: 260px; flex-shrink: 0; }
  .panel { border-left: 0; }
  .list { padding: 0 16px 12px; overflow: visible; }
  .legend { left: 10px; bottom: 10px; font-size: 12px; gap: 4px 8px; }
  .legend .txt { display: none; }
  body[data-view="brief"] .brief-top { grid-template-columns: minmax(0, 1fr); padding: 16px 16px 0; gap: 10px; }
  body[data-view="brief"] .stage { padding: 16px; }
  body[data-view="brief"] .mapwrap { display: none; }
  body[data-view="map"] { overflow: hidden; }
  body[data-view="map"] .stage { flex: 1 1 auto; position: relative; }
  body[data-view="map"] .mapwrap { position: absolute; inset: 0; height: auto; }
  body[data-view="map"] .panel { display: none; }
  body[data-view="map"] .detail { left: 0; right: 0; top: auto; bottom: 0; width: auto; padding: 14px 16px 18px; }
  body[data-view="map"] .legend { bottom: auto; top: 10px; }
  body[data-view="map"] .detail .note { display: none; }
  body[data-view="map"] .maplibregl-ctrl-bottom-right { display: none; }
}

/* 목록 머리: 정렬·종류·나라 */
.panel-head { flex-direction: column; align-items: stretch; gap: 10px; }
.ctrl-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; flex-wrap: wrap; }
.count { font-size: 17px; font-weight: 700; }
.sort select { height: 32px; border-radius: 6px; border: 1px solid var(--rule); background: transparent; color: var(--fg); font: 500 13px var(--font); padding: 0 8px; }
.sort select option { color: #0d263c; }
.seg.kind button { height: 32px; padding: 0 12px; font-size: 13px; }
.country-input { flex: 1 1 140px; min-width: 0; height: 32px; border-radius: 6px; border: 1px solid var(--rule); background: transparent; color: var(--fg); font: 400 13px var(--font); padding: 0 10px; }
.country-input::placeholder { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.country-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; padding: 10px 12px; border: 1px solid var(--fg); font-size: 15px; }
.country-head .btn.link { height: 28px; padding: 0 6px; color: var(--fg); }
.divider { font-size: 12px; color: var(--muted); padding: 6px 2px 0; letter-spacing: 0.04em; }
.kind-ico { flex-shrink: 0; opacity: 0.75; }
.storm-line { font-size: 13px; color: var(--muted); }
.item.sel .storm-line { color: #4b5563; }
.mk.storm { padding: 3px; color: var(--navy); }
.mk.storm.lv4, .mk.storm.lv5 { color: var(--white); }
body[data-view="map"] .panel .panel-head .ctrl-row:last-child { display: none; }
body[data-view="map"] .country-head, body[data-view="map"] .divider { display: none; }

/* 지도 표식: 모양 = 종류, 색 = 단계 */
.mk.wx { border-radius: 6px; }
.mk .n { position: absolute; right: -7px; top: -7px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--white); color: var(--navy);
  font: 800 10px var(--font); display: flex; align-items: center; justify-content: center; padding: 0 3px; box-shadow: 0 0 0 1px var(--navy); }
.mk.storm { background: var(--navy); color: var(--white); border: 3px solid var(--lv3); border-radius: 50%; padding: 0; }
.mk.storm.ring1 { border-color: var(--lv1); } .mk.storm.ring2 { border-color: var(--lv2); } .mk.storm.ring3 { border-color: var(--lv3); }
.mk.storm.ring4 { border-color: var(--lv4); } .mk.storm.ring5 { border-color: var(--lv5); }
.legend { flex-direction: column; align-items: flex-start; }
.lg-row { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.sh { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; margin-right: 6px; vertical-align: middle; }
.sh-news { border-radius: 50%; background: var(--lv1); }
.sh-wx { border-radius: 4px; background: var(--lv1); color: var(--navy); }
.sh-ok::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #cfe3d4; opacity: .8; }
.hub-pop .maplibregl-popup-content { background: #0d263c; color: #e3ebf2; padding: 6px 10px; border-radius: 8px; font-size: 12px; }
.hub-pop .maplibregl-popup-tip { display: none; }
.sh-storm { border-radius: 50%; background: var(--navy); color: var(--white); box-shadow: 0 0 0 2px var(--lv1); }
@media (max-width: 820px) { .lg-shape .txt { display: none; } }

.data-switch { display: flex; align-items: center; gap: 4px; font-size: 12px; }
.data-switch .btn.link { height: 28px; padding: 0 6px; font-size: 12px; }
.data-switch .btn.link[aria-pressed="true"] { color: var(--fg); font-weight: 700; text-decoration: underline; }

/* v0.5 — CI·메일 받기 */
.ci-link { display: inline-flex; align-items: center; align-self: center; }
.ci { height: 22px; width: auto; display: block; }
.ci-n { display: none; }
body[data-view="brief"] .ci-w { display: none; }
body[data-view="brief"] .ci-n { display: block; }
.brand { align-items: center; }
.brand .name { font-size: 17px; font-weight: 700; white-space: nowrap; }
body.locked .item .foot { display: flex; }
.copy.mail { margin-left: auto; }
.item .foot .copy + .copy { margin-left: 6px; }
.slogan { margin: 4px 0 0; font-size: 13px; font-weight: 600; text-align: center; }
.fld { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; }
.fld input { height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-weight: 400; font-size: 15px; color: var(--navy); background: var(--white); }
.fld em { font-style: normal; font-weight: 400; }
.chk { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; line-height: 1.45; color: var(--ink-muted); }
.chk input { margin-top: 2px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.err { color: #c2185b; font-size: 13px; min-height: 1em; }
@media (max-width: 820px) { .ci { height: 18px; } .brand .name { font-size: 14px; } }
@media (max-width: 480px) { .brand .asof { display: none; } }
