*, *::before, *::after { box-sizing: border-box; }

/* ── 웰컴 오버레이 ── */
#welcome-overlay {
    position: fixed; inset: 0;
    background: linear-gradient(160deg, #1a252f 0%, #2c3e50 55%, #2d1b2e 100%);
    z-index: 10001;
    display: flex; align-items: center; justify-content: center;
    transition: opacity 0.6s ease;
}
#welcome-overlay.fade-out { opacity: 0; pointer-events: none; }
#welcome-overlay.hidden   { display: none; }

#welcome-content {
    text-align: center;
    padding: 40px 28px;
    max-width: 460px;
    width: 100%;
    animation: welcomeIn 0.8s ease;
}
@keyframes welcomeIn {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}

#welcome-logo {
    width: 76px; height: 76px;
    margin: 0 auto 28px;
    filter: drop-shadow(0 4px 16px rgba(233,30,140,0.5));
}
#welcome-logo img { width: 100%; height: 100%; }

#welcome-title {
    font-size: 2rem; font-weight: bold;
    color: white; line-height: 1.45;
    margin: 0 0 16px;
    text-shadow: 0 2px 12px rgba(0,0,0,0.4);
}

#welcome-sub {
    font-size: 1rem;
    color: rgba(255,255,255,0.72);
    line-height: 1.75;
    margin: 0 0 28px;
}

#welcome-tags {
    display: flex; gap: 10px;
    justify-content: center; flex-wrap: wrap;
    margin-bottom: 38px;
}
#welcome-tags span {
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.9);
    border: 1px solid rgba(255,255,255,0.22);
    border-radius: 20px;
    padding: 6px 18px;
    font-size: 0.88rem;
}

#welcome-btn {
    background: #e91e8c; color: white;
    border: none; border-radius: 30px;
    padding: 15px 44px;
    font-size: 1.05rem; font-weight: bold;
    cursor: pointer; font-family: inherit;
    box-shadow: 0 4px 22px rgba(233,30,140,0.45);
    transition: transform 0.15s, box-shadow 0.15s;
}
#welcome-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 30px rgba(233,30,140,0.65);
}

@media (max-width: 768px) {
    #welcome-title { font-size: 1.65rem; }
    #welcome-sub   { font-size: 0.93rem; }
    #welcome-btn   { padding: 14px 38px; font-size: 1rem; }
}

body, html {
    margin: 0; padding: 0; height: 100%;
    font-family: 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif;
    overflow: hidden;
}

.container { display: flex; height: 100vh; width: 100vw; position: relative; }

/* ── 지도 ── */
#map {
    width: 100%; height: 100%;
    background-color: #e5e3df;
    z-index: 1;
    touch-action: none;
}

/* ── 로딩 ── */
#loading-overlay {
    position: absolute; inset: 0;
    background: rgba(245,246,248,0.95);
    display: flex;
    align-items: center; justify-content: center;
    z-index: 9000;
}
#loading-overlay.hidden { display: none; }

#skeleton-wrap {
    display: flex; flex-direction: column; gap: 12px;
    width: min(360px, 88vw);
    max-height: 80vh; overflow: hidden;
}

.sk-card {
    background: white;
    border-radius: 14px;
    padding: 18px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.07);
}

@keyframes shimmer {
    0%   { background-position: -400px 0; }
    100% { background-position:  400px 0; }
}

.sk-line, .sk-img, .sk-badge {
    background: linear-gradient(90deg, #ececec 25%, #e0e0e0 50%, #ececec 75%);
    background-size: 400px 100%;
    animation: shimmer 1.4s ease infinite;
    border-radius: 6px;
    margin-bottom: 10px;
}
.sk-line         { height: 13px; width: 100%; }
.sk-title        { height: 20px; width: 55%; }
.sk-med          { width: 75%; }
.sk-short        { width: 40%; }
.sk-badge        { height: 20px; width: 60px; border-radius: 20px; }
.sk-img          { height: 110px; border-radius: 10px; }

/* ── 필터 ── */
#filter-wrapper {
    position: absolute; top: 20px; left: 60px;
    z-index: 1000;
}
#filter-btn {
    padding: 10px 18px;
    background: white; border: 1px solid #ccc;
    border-radius: 20px; font-size: 0.95rem;
    font-weight: bold; color: #2c3e50;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
#filter-btn:hover { background: #f1f1f1; }
#filter-menu {
    position: absolute; top: 45px; left: 0;
    background: white; border: 1px solid #ccc;
    border-radius: 12px; padding: 15px;
    display: flex; flex-direction: column; gap: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
    min-width: 160px;
}
#filter-menu.hidden { display: none; }
#filter-menu label {
    display: flex; align-items: center; gap: 8px;
    font-weight: bold; cursor: pointer; font-size: 0.95rem;
}
#filter-menu hr { border: none; border-top: 1px solid #eee; margin: 2px 0; }
#filter-menu select {
    width: 100%; padding: 6px 8px;
    border: 1px solid #ddd; border-radius: 8px;
    font-size: 0.9rem; cursor: pointer;
}

/* ── 정보 패널 (데스크탑) ── */
#info-panel {
    position: absolute; top: 0; right: 0;
    width: 400px; height: 100%;
    background: white;
    box-shadow: -5px 0 20px rgba(0,0,0,0.1);
    z-index: 9999;
    transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    display: flex; flex-direction: column;
    transform: translateX(100%);
}
#info-panel.visible { transform: translateX(0); }
#info-panel.hidden { transform: translateX(100%); }

#drag-handle-visual {
    width: 45px; height: 6px;
    background: #ddd; border-radius: 3px;
    margin: 15px auto 5px;
    flex-shrink: 0; display: none;
}

#panel-content {
    flex: 1; overflow-y: auto;
    padding: 30px 25px; touch-action: pan-y;
}

h2 { margin-top: 0; color: #2c3e50; font-size: 1.6rem; margin-bottom: 10px; }

/* 카테고리 배지 */
.badge {
    display: inline-block;
    padding: 3px 10px; border-radius: 20px;
    font-size: 0.78rem; font-weight: bold;
    margin-bottom: 14px;
}
.badge.city   { background: #e8f5e9; color: #2e7d32; }
.badge.onsen  { background: #fff3e0; color: #e65100; }
.badge.sakura { background: #fce4ec; color: #880e4f; }

p { line-height: 1.6; color: #34495e; font-size: 0.95rem; margin-bottom: 14px; }
p strong {
    color: #16a085; display: block;
    margin-bottom: 4px; font-weight: bold;
}

/* 이미지 */
#town-image-wrap { margin-bottom: 18px; }
#town-image {
    width: 100%; height: 220px;
    object-fit: cover; border-radius: 12px;
    display: none; background: #f0f0f0;
}
.photo-credit {
    font-size: 0.72rem; color: #aaa;
    margin: 4px 0 0; text-align: right;
}
.photo-credit a { color: #aaa; }

/* 주변 명소 */
.nearby-title {
    margin-top: 30px;
    border-top: 1px solid #eee; padding-top: 20px;
    font-size: 1.1rem; color: #2c3e50;
}
#nearby-list { display: flex; flex-direction: column; gap: 10px; }
.nearby-card {
    background: #f8f9fa; border: 1px solid #eee;
    padding: 12px; border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}
.nearby-card:hover { background: #eef2f5; transform: scale(1.02); }

/* ── 마커 ── */
.leaflet-div-icon { background: transparent; border: none; }
.pin-visual-wrapper { width: 44px; height: 44px; transform-origin: bottom center; }
.pin-visual-wrapper.bouncing { animation: bounceMarker 0.5s infinite alternate ease-in-out; }
@keyframes bounceMarker { 0% { transform: translateY(0); } 100% { transform: translateY(-15px); } }

.custom-pin {
    width: 100%; height: 100%;
    border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
    border: 2px solid white;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    display: flex; align-items: center; justify-content: center;
}
.custom-pin.city   { background: #6ecc39; }
.custom-pin.onsen  { background: #ff7043; }
.custom-pin.sakura { background: #e91e8c; }

.pin-svg {
    transform: rotate(45deg);
    display: flex; align-items: center; justify-content: center;
    width: 24px; height: 24px; color: white;
}

/* ── 모바일 ── */
@media (max-width: 768px) {
    #info-panel {
        top: auto; bottom: 0; left: 0;
        width: 100%; height: 90vh;
        border-radius: 24px 24px 0 0;
        transform: translateY(100%);
    }
    #info-panel.visible { transform: translateY(40vh); }
    #info-panel.hidden  { transform: translateY(100%); }
    #info-panel.mini    { transform: translateY(calc(90vh - 130px)) !important; }
    #drag-handle-visual { display: block; }
    #panel-content { padding: 10px 20px 40px; }
    #filter-wrapper { top: 15px; right: 15px; left: auto; }
    #filter-menu { left: auto; right: 0; }
    #action-buttons { gap: 6px; }
    .action-btn { padding: 9px 14px; font-size: 0.88rem; }
    h2 { font-size: 1.4rem; }
    p { font-size: 1rem; }
}

/* ── 클러스터 버블 ── */
.cluster-bubble {
    background: #2c3e50;
    color: white;
    border-radius: 50%;
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    font-weight: bold; font-size: 0.85rem;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* ── 액션 버튼 ── */
#action-buttons {
    display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap;
}
.action-btn {
    padding: 7px 13px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: bold;
    cursor: pointer;
    text-decoration: none;
    border: none;
    font-family: inherit;
    transition: opacity 0.15s;
}
.action-btn:hover { opacity: 0.8; }
.map-btn     { background: #4285f4; color: white; }
.share-btn   { background: #f1f3f4; color: #333; }
.twitter-btn { background: #000; color: white; }
.kakao-btn      { background: #FEE500; color: #3A1D1D; }
.webshare-btn   { background: #16a085; color: white; }


/* ── Footer ─────────────────────────────── */
#site-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    padding: 6px 0;
    background: rgba(26, 37, 47, 0.85);
    backdrop-filter: blur(4px);
    z-index: 500;
    font-size: 12px;
}
#site-footer a {
    color: #adb5bd;
    text-decoration: none;
}
#site-footer a:hover { color: #fff; }
#site-footer span { color: #495057; margin: 0 6px; }
