* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif; color: #222; }
/* 네이버 지도가 컨테이너에 position:relative 를 넣으므로 크기를 명시 */
#map { position: fixed !important; top: 0; left: 0; width: 100vw; height: 100vh; height: 100dvh; background: #e9ecef; }

.panel {
  position: fixed; z-index: 10; background: rgba(255,255,255,.96);
  border-radius: 12px; box-shadow: 0 2px 12px rgba(0,0,0,.15);
}
.top { top: max(12px, env(safe-area-inset-top)); left: 12px; right: 12px; max-width: 420px; padding: 10px 12px; }
.row { display: flex; align-items: center; gap: 8px; }
.small { font-size: 12px; color: #666; margin-top: 4px; }
#nameInput { flex: 1; min-width: 0; font-size: 16px; border: 1px solid #ddd; border-radius: 8px; padding: 6px 10px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #adb5bd; flex: none; }
.dot.on { background: #03c75a; }
.dot.off { background: #fa5252; }

.list { top: calc(max(12px, env(safe-area-inset-top)) + 84px); right: 12px; width: 220px; max-height: 50vh; overflow: hidden; display: flex; flex-direction: column; }
.list-toggle { border: 0; background: none; padding: 10px 12px; text-align: left; font-size: 14px; cursor: pointer; }
.list ul { list-style: none; margin: 0; padding: 0 6px 6px; overflow-y: auto; }
.list.collapsed ul { display: none; }
.list li { display: flex; align-items: center; gap: 8px; padding: 8px 6px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.list li:hover { background: #f1f3f5; }
.list li .sw { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.list li .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list li .meta { font-size: 11px; color: #888; white-space: nowrap; }

.actions { bottom: max(16px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 24px); display: flex; padding: 6px; gap: 4px; }
.actions button { border: 0; background: none; padding: 8px 12px; border-radius: 8px; font-size: 18px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.actions button span { font-size: 11px; color: #444; white-space: nowrap; }
.actions button:hover { background: #f1f3f5; }

#toast { position: fixed; z-index: 20; left: 50%; bottom: 100px; transform: translateX(-50%); background: rgba(0,0,0,.8); color: #fff; padding: 8px 14px; border-radius: 20px; font-size: 13px; opacity: 0; transition: opacity .25s; pointer-events: none; }
#toast.show { opacity: 1; }

/* 지도 마커 */
.pin { position: relative; transform: translate(-50%, -100%); display: flex; flex-direction: column; align-items: center; }
.pin .label { background: var(--c); color: #fff; font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 12px; white-space: nowrap; box-shadow: 0 1px 4px rgba(0,0,0,.3); }
.pin .label.stale { opacity: .55; }
.pin .stem { width: 2px; height: 8px; background: var(--c); }
.pin .ball { width: 14px; height: 14px; border-radius: 50%; background: var(--c); border: 3px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.2); }
.pin.me .ball { width: 18px; height: 18px; animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(3,199,90,.6); } 70% { box-shadow: 0 0 0 12px rgba(3,199,90,0); } 100% { box-shadow: 0 0 0 0 rgba(3,199,90,0); } }

.error-box { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; text-align: center; color: #555; line-height: 1.6; }

@media (max-width: 600px) {
  .list { width: auto; left: 12px; max-height: 35vh; }
  .list.collapsed { width: auto; left: auto; }
}
