* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent; /* 터치 시 하이라이트 제거 */
}

body, html {
    width: 100%;
    height: 100%;
    font-family: 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
    color: #333;
    overflow: hidden;
    position: fixed; /* 바운스 스크롤 방지 */
}

/* 1. 시작 화면 (App Landing Page 느낌) */
#start-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #fff;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

#start-screen.hidden {
    transform: translateY(-100%);
}

.start-content {
    width: 100%;
    padding: 40px 30px;
    text-align: center;
}

.logo {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 30px;
    color: #ff8c00;
}

.start-content h1 {
    font-size: 1.6rem;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.start-content p {
    color: #888;
    margin-bottom: 40px;
}

#start-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#start-location {
    padding: 18px;
    font-size: 1.1rem;
    border: 1px solid #eee;
    background: #f8f9fa;
    border-radius: 16px;
    outline: none;
    text-align: center;
}

#start-form button {
    padding: 18px;
    background: #ff8c00;
    color: white;
    border: none;
    border-radius: 16px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(255, 140, 0, 0.3);
}

/* 2. 지도 영역 */
#map {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

/* 3. 상단 카테고리 메뉴 (플로팅 바 느낌) */
#category-menu {
    position: absolute;
    top: env(safe-area-inset-top, 20px);
    left: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 12px;
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    z-index: 100;
    transition: all 0.3s;
}

#category-menu.hidden {
    opacity: 0;
    transform: translateY(-20px);
    pointer-events: none;
}

.category-title {
    font-size: 0.8rem;
    font-weight: bold;
    color: #999;
    margin-bottom: 8px;
    text-align: center;
}

.category-buttons {
    display: flex;
    gap: 8px;
    overflow-x: auto; /* 모바일에서 가로 스크롤 가능하게 */
    padding-bottom: 5px;
    scrollbar-width: none; /* 파이어폭스 스크롤바 숨김 */
}

.category-buttons::-webkit-scrollbar { display: none; }

.category-btn {
    flex: 0 0 auto;
    padding: 10px 16px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.category-btn:active {
    background: #f7e600;
    transform: scale(0.95);
}

.menu-footer {
    display: flex;
    justify-content: space-between;
    padding: 8px 5px 0;
    border-top: 1px solid #f5f5f5;
    margin-top: 8px;
}

#re-search-btn, #open-inquiry-btn {
    font-size: 11px;
    color: #999;
    background: none;
    border: none;
    text-decoration: none;
}

#open-inquiry-btn { color: #ff8c00; font-weight: bold; }

/* 4. 하단 바텀 시트 (검색 결과) - 모바일 최적화의 핵심 */
#sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60%; /* 모바일에서 높이 */
    background: #fff;
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -5px 25px rgba(0, 0, 0, 0.1);
    z-index: 500;
    display: flex;
    flex-direction: column;
    transform: translateY(100%); /* 초기에는 숨김 */
    transition: transform 0.4s cubic-bezier(0.33, 1, 0.68, 1);
}

#sidebar.active {
    transform: translateY(0);
}

/* 드래그 바 (App 느낌) */
.sheet-handle {
    width: 40px;
    height: 5px;
    background: #ddd;
    border-radius: 3px;
    margin: 12px auto;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 0 20px 15px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.1rem;
}

#close-sidebar {
    width: 30px;
    height: 30px;
    background: #f0f0f0;
    border: none;
    border-radius: 50%;
    font-size: 18px;
}

#places-list {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.place-item {
    padding: 18px 20px;
    border-bottom: 1px solid #f5f5f5;
}

.place-name { font-size: 16px; font-weight: bold; color: #1a1a1a; margin-bottom: 4px; }
.place-address { font-size: 13px; color: #777; line-height: 1.4; }

#pagination {
    padding: 15px;
    background: #fff;
    border-top: 1px solid #eee;
    padding-bottom: calc(15px + env(safe-area-inset-bottom)); /* 아이폰 하단 바 대응 */
}

/* 5. 모달 (Pop-up) 최적화 */
.modal-content {
    width: 90% !important;
    border-radius: 24px !important;
    padding: 25px !important;
}

.form-group input, .form-group textarea {
    background: #f8f9fa;
    border: none !important;
    padding: 15px !important;
    font-size: 16px !important; /* 모바일에서 포커스 시 줌 방지 */
}

/* 데스크탑 버전 (화면이 넓을 때의 보정) */
@media (min-width: 768px) {
    #sidebar {
        width: 360px;
        height: auto;
        top: 160px;
        left: 20px;
        bottom: 20px;
        border-radius: 20px;
        transform: translateX(-120%);
    }
    #sidebar.active {
        transform: translateX(0);
    }
    .sheet-handle { display: none; }
    #category-menu {
        left: 20px;
        right: auto;
        width: 360px;
    }
    .category-buttons { flex-wrap: wrap; }
}