:root {
  --ink: #0f172a;
  --muted: #5b6474;
  --bg: #ffffff;
  --panel: #f3f5f9;
  --line: #e4e7ee;
  --red: #cd2e3a;
  --blue: #0047a0;
  --navy: #0b1730;
  --sky: #eef4ff;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(15, 23, 42, .16);
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  overflow: hidden;
}
button { font: inherit; cursor: pointer; color: inherit; }
a { color: var(--blue); }

/* ---------- header ---------- */
.top { height: 56px; display: flex; align-items: center; justify-content: space-between; padding: 0 14px; background: var(--navy); color: #fff; position: relative; z-index: 20; }
.brand { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font-size: 18px; letter-spacing: -.01em; }
.brand b { color: #ffd2d6; }
.brand-pin { width: 24px; height: 24px; }
.top-right { display: flex; align-items: center; gap: 8px; }
.chip-btn { background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.25); border-radius: 999px; padding: 6px 12px; font-size: 14px; white-space: nowrap; }
.chip-btn.on { background: #fff; color: var(--navy); }
.round-btn { width: 34px; height: 34px; border-radius: 50%; border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.12); color: #fff; font-weight: 700; }

/* ---------- layout ---------- */
.layout { height: calc(100vh - 56px); height: calc(100dvh - 56px); }
.feed-col { height: 100%; overflow-y: auto; background: var(--bg); }
.detail { position: relative; }
.map-box { position: absolute; inset: 0; background: #e8eef5; }
#map { position: absolute; inset: 0; }

/* ---------- feed header ---------- */
.feed-head { position: sticky; top: 0; z-index: 5; background: rgba(255,255,255,.94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); padding: 10px 14px 10px; }
.today-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.today-line { margin: 0; font-size: 13px; color: var(--muted); }
.today-line b { color: var(--ink); font-variant-numeric: tabular-nums; }
.today-line .new { color: var(--red); }
.seg { display: inline-flex; background: var(--panel); border-radius: 999px; padding: 3px; flex: none; }
.seg button { border: 0; background: none; border-radius: 999px; padding: 4px 10px; font-size: 13px; color: var(--muted); }
.seg button.on { background: #fff; color: var(--ink); font-weight: 650; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 5px 12px; font-size: 14px; }
.chip.on { background: var(--navy); border-color: var(--navy); color: #fff; }

/* ---------- feed posts ---------- */
.feed { max-width: 540px; margin: 0 auto; padding: 0 0 48px; }
.day-head { margin: 18px 14px 8px; font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.post { border-bottom: 1px solid var(--line); padding-bottom: 14px; margin-bottom: 6px; transition: background .2s; }
.post.active { background: #fff6f7; }
.post-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; }
.ava { width: 34px; height: 34px; border-radius: 50%; background: var(--navy); display: grid; place-items: center; flex: none; }
.ava svg { width: 20px; height: 20px; }
.post-head b { display: block; font-size: 14px; line-height: 1.2; }
.post-head small { color: var(--muted); font-size: 12px; }
.new-badge { margin-left: auto; background: var(--red); color: #fff; font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 999px; letter-spacing: .04em; }
.post-photo { display: block; position: relative; width: 100%; aspect-ratio: 4 / 3; padding: 0; border: 0; background: #d9dee7; overflow: hidden; }
.post-photo img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s ease; }
.post-photo:hover img { transform: scale(1.02); }
.reveal-tag { position: absolute; left: 12px; bottom: 12px; display: inline-flex; align-items: center; gap: 6px; background: rgba(11,23,48,.82); color: #fff; font-size: 13px; font-weight: 600; padding: 7px 12px; border-radius: 999px; }
.post-actions { display: flex; align-items: center; gap: 2px; padding: 6px 8px 0; }
.icon-btn { width: 42px; height: 42px; border: 0; background: none; border-radius: 50%; font-size: 24px; line-height: 1; display: grid; place-items: center; }
.icon-btn:hover { background: var(--panel); }
.icon-btn.on { color: var(--red); }
.dist { margin-left: auto; padding-right: 6px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.dist b { color: var(--blue); }
.post-body { padding: 2px 14px 0; }
.hook { margin: 0; font-size: 15px; }
.hook b { margin-right: 4px; }
.where { margin: 4px 0 0; color: var(--blue); font-size: 14px; font-weight: 650; }
.see-btn { border: 0; background: none; color: var(--red); font-weight: 700; padding: 6px 0 0; font-size: 14px; }
.empty { color: var(--muted); padding: 30px 16px; text-align: center; }

/* ---------- info card ---------- */
.info { background: #fff; padding: 18px; }
.area-chip { display: inline-block; background: var(--panel); border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.info h2 { font-size: 22px; line-height: 1.25; margin: 8px 0 0; letter-spacing: -.01em; }
.info .ko { color: var(--muted); font-size: 14px; margin: 2px 0 0; }
.distance-box { display: flex; align-items: center; gap: 10px; background: var(--sky); border-radius: 12px; padding: 10px 12px; margin: 12px 0 14px; font-size: 14px; }
.distance-box b { font-size: 20px; color: var(--blue); white-space: nowrap; }
.distance-box .link { margin-left: auto; border: 0; background: none; color: var(--blue); font-weight: 650; font-size: 13px; padding: 0; text-decoration: underline; }
.why { margin: 0 0 14px; }
.kv { background: var(--panel); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; font-size: 15px; }
.kv b { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 2px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 10px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 12px; padding: 10px 14px; font-weight: 650; font-size: 15px; text-decoration: none; border: 1px solid transparent; }
.btn.primary { background: var(--red); color: #fff; }
.btn.naver { background: #03c75a; color: #fff; }
.btn.ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn.ghost.on { color: var(--red); border-color: #f2b8bd; background: #fff5f6; }
.btn.block { width: 100%; }
.credit { color: var(--muted); font-size: 12px; margin: 6px 0 14px; }
.intro h2 { margin-top: 0; }
.intro p { color: var(--muted); }
.close-x { display: none; }

/* ---------- map markers ---------- */
.pin { width: 28px; height: 34px; }
.pin i { position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--red); border: 3px solid #fff; box-shadow: 0 3px 8px rgba(0,0,0,.35); }
.base-mark { display: flex; flex-direction: column; align-items: center; pointer-events: none; }
.base-mark .dot { width: 18px; height: 18px; border-radius: 50%; background: var(--blue); border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(0,71,160,.18), 0 2px 6px rgba(0,0,0,.3); }
.base-mark.city .dot { background: var(--navy); box-shadow: 0 2px 6px rgba(0,0,0,.3); }
.base-mark span { margin-top: 4px; background: #fff; border-radius: 999px; padding: 1px 8px; font-size: 12px; font-weight: 700; box-shadow: 0 1px 4px rgba(0,0,0,.2); }
.maplibregl-popup-content { border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.map-error { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; color: var(--muted); }

/* ---------- dialog & toast ---------- */
dialog { border: 0; border-radius: 20px; padding: 22px; max-width: 440px; width: calc(100% - 32px); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(11,23,48,.55); }
dialog h2 { margin: 0 0 8px; }
dialog ol { padding-left: 20px; margin: 0 0 10px; }
dialog li { margin-bottom: 4px; }
dialog .note { background: #effaf3; border-radius: 10px; padding: 8px 10px; font-size: 14px; }
dialog .fine { color: var(--muted); font-size: 12px; }
dialog .btn { width: 100%; margin-top: 6px; padding: 12px; }
.toast { position: fixed; z-index: 3000; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 14px; box-shadow: var(--shadow); max-width: calc(100% - 32px); text-align: center; }

/* ---------- wide screens: feed left, map + card right ---------- */
@media (min-width: 900px) {
  .layout { display: grid; grid-template-columns: minmax(400px, 44%) 1fr; }
  .feed-col { border-right: 1px solid var(--line); }
  .info { position: absolute; z-index: 3; top: 16px; right: 16px; width: 400px; max-height: calc(100% - 32px); overflow-y: auto; border-radius: 18px; box-shadow: var(--shadow); }
}

/* ---------- phones: feed full screen, details slide up ---------- */
@media (max-width: 899px) {
  .detail { position: fixed; z-index: 1000; left: 0; right: 0; bottom: 0; top: 7vh; display: flex; flex-direction: column; background: #fff; border-radius: 20px 20px 0 0; box-shadow: 0 -10px 40px rgba(15,23,42,.25); overflow: hidden; transform: translateY(105%); transition: transform .3s ease; }
  .detail.open { transform: none; }
  .map-box { position: relative; inset: auto; flex: none; height: 36vh; }
  .info { flex: 1; overflow-y: auto; padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
  .close-x { display: grid; place-items: center; position: absolute; z-index: 5; top: 10px; right: 10px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(11,23,48,.8); color: #fff; font-size: 18px; }
}
