/* ============================================================
   급상승 여행지 지수 — iOS / Apple 스타일
   iOS 시스템 컬러·타이포그래피, Settings/Weather 앱 스타일의
   그룹 리스트(hairline 구분선), 세그먼트 컨트롤, Large Title.
   ============================================================ */

:root {
    /* iOS 시스템 컬러 (라이트 모드) */
    --bg: #f2f2f7;
    /* systemGroupedBackground */
    --card: #ffffff;
    /* secondarySystemGroupedBackground */
    --text: #000000;
    /* label */
    --text-secondary: #8e8e93;
    /* systemGray */
    --separator: rgba(60, 60, 67, 0.29);
    --blue: #007aff;
    /* systemBlue */
    --orange: #ff9500;
    /* systemOrange - 급상승 강조 */
    --red: #ff3b30;
    /* systemRed */
    --green: #34c759;
    /* systemGreen */
    --fill-secondary: #e5e5ea;
    /* systemGray6 계열, 세그먼트 배경 */
    --radius-lg: 14px;
    --radius-md: 10px;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Apple SD Gothic Neo",
        "Helvetica Neue", "Pretendard", sans-serif;
    font-size: 17px;
    line-height: 1.4;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    /* 아이폰 노치/다이나믹 아일랜드, 하단 홈 인디케이터 안전영역 */
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    padding-bottom: env(safe-area-inset-bottom);
}

/* ---------- Large Title 헤더 ---------- */
.hero {
    padding: max(20px, env(safe-area-inset-top)) 20px 8px;
    background: var(--bg);
}

.hero.small {
    padding: max(16px, env(safe-area-inset-top)) 20px 8px;
}

.hero-date {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 590;
    letter-spacing: -0.01em;
    margin: 0 0 2px;
}

.hero h1 {
    margin: 0;
    font-size: 34px;
    font-weight: 750;
    letter-spacing: 0.01em;
    line-height: 1.15;
}

.back {
    color: var(--blue);
    text-decoration: none;
    font-size: 17px;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-bottom: 4px;
    font-weight: 400;
}

.category {
    color: var(--text-secondary);
    font-size: 15px;
    margin-top: 2px;
    font-weight: 590;
}

main {
    max-width: 600px;
    margin: 0 auto;
    padding: 8px 16px 40px;
}

/* ---------- 세그먼트 컨트롤 (iOS UISegmentedControl) ---------- */
.tabs {
    display: flex;
    gap: 2px;
    background: var(--fill-secondary);
    border-radius: 9px;
    padding: 2px;
    margin: 8px 0 20px;
}

.tab {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text);
    padding: 10px 12px;
    min-height: 36px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 590;
    cursor: pointer;
    transition: background 0.2s ease, box-shadow 0.2s ease;
    font-family: inherit;
}

.tab.active {
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 0 0 0.5px rgba(0, 0, 0, 0.04);
}

/* ---------- 그룹 리스트 (iOS Settings 스타일) ---------- */
.ranking,
.place-list {
    background: var(--card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.card,
.place-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--text);
    border-bottom: 0.5px solid var(--separator);
    min-height: 44px;
    /* iOS 최소 터치 영역 */
}

.card:last-child,
.place-item:last-child {
    border-bottom: none;
}

.card:active {
    background: rgba(0, 0, 0, 0.04);
}

.rank {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--fill-secondary);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card:nth-child(1) .rank {
    background: var(--orange);
    color: #fff;
}

.card:nth-child(2) .rank {
    background: #c0c0c8;
    color: #fff;
}

.card:nth-child(3) .rank {
    background: #cd9a5b;
    color: #fff;
}

.name {
    font-weight: 590;
    font-size: 16px;
    flex: 1;
    min-width: 0;
}

.name .badge {
    font-size: 10px;
    background: var(--blue);
    color: #fff;
    padding: 2px 6px;
    border-radius: 5px;
    margin-left: 6px;
    font-weight: 700;
    vertical-align: middle;
}

.card .category {
    grid-column: unset;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 1px;
    font-weight: 400;
    display: block;
}

.score {
    font-variant-numeric: tabular-nums;
    font-size: 16px;
    font-weight: 590;
    color: var(--text);
    text-align: right;
}

.change {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: right;
    min-width: 44px;
}

.change.up {
    color: var(--orange);
    font-weight: 700;
}

.chevron {
    width: 8px;
    height: 8px;
    border-top: 2px solid #c7c7cc;
    border-right: 2px solid #c7c7cc;
    transform: rotate(45deg);
    flex-shrink: 0;
    margin-left: 2px;
}

.loading,
.empty {
    color: var(--text-secondary);
    text-align: center;
    padding: 48px 20px;
    font-size: 15px;
}

.note {
    text-align: center;
    color: var(--text-secondary);
    font-size: 12px;
    margin-top: 16px;
    padding: 0 20px;
}

/* ---------- 통계 위젯 (Weather 앱 스타일 카드) ---------- */
.stat-row {
    display: flex;
    gap: 10px;
    margin: 16px 0;
}

.stat {
    flex: 1;
    background: var(--card);
    border-radius: var(--radius-lg);
    padding: 14px 12px;
    text-align: center;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.stat .label {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    font-weight: 590;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.stat .value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.rank-row {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.rank-pill {
    background: var(--card);
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 13px;
    color: var(--text-secondary);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.rank-pill b {
    color: var(--blue);
    font-size: 15px;
    font-weight: 700;
}

/* ---------- 정보 카드 ---------- */
.info-card {
    display: flex;
    gap: 14px;
    background: var(--card);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.info-thumb {
    width: 88px;
    height: 88px;
    object-fit: cover;
    border-radius: var(--radius-md);
    flex-shrink: 0;
    background: var(--fill-secondary);
}

.info-body {
    flex: 1;
    min-width: 0;
}

.info-address {
    font-size: 13px;
    color: var(--blue);
    margin: 0 0 6px;
    font-weight: 590;
}

.info-overview {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0 0 8px;
}

.info-link {
    font-size: 14px;
    color: var(--blue);
    text-decoration: none;
    font-weight: 590;
}

/* ---------- 날씨 카드 ---------- */
.weather-body {
    display: flex;
    align-items: baseline;
    gap: 16px;
    flex-wrap: wrap;
}

.weather-temp {
    font-size: 40px;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.weather-meta {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 13px;
    color: var(--text-secondary);
}

/* ---------- 차트 섹션 ---------- */
.chart-section {
    background: var(--card);
    border-radius: var(--radius-lg);
    padding: 18px 16px;
    margin-bottom: 16px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.chart-section h2 {
    font-size: 13px;
    margin: 0 0 14px;
    color: var(--text-secondary);
    font-weight: 590;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.hint {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 10px 0 0;
    text-align: center;
}

/* ---------- 리스트 섹션 (근처/축제) ---------- */
.list-section {
    margin-bottom: 16px;
}

.list-section h2 {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 590;
    margin: 0 0 8px 4px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.place-name {
    font-weight: 590;
    font-size: 15px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.place-meta {
    color: var(--text-secondary);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

/* ---------- 지도 ---------- */
#map {
    height: 240px;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.map-wrap {
    position: relative;
}

.map-region-label {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.92);
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: 999px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
    pointer-events: none;
    max-width: calc(100% - 20px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.distance-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    font-size: 14px;
    color: var(--text-secondary);
}

.distance-row b {
    color: var(--blue);
    font-weight: 700;
}

.distance-icon {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--blue);
    flex-shrink: 0;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
}



@media (max-width: 480px) {
    .hero h1 {
        font-size: 28px;
    }

    .change {
        display: none;
    }
}

@media (max-width: 360px) {
    body {
        font-size: 16px;
    }

    .hero h1 {
        font-size: 25px;
    }

    .info-thumb {
        width: 64px;
        height: 64px;
    }

    .stat-row {
        gap: 6px;
    }

    .stat {
        padding: 12px 8px;
    }

    .stat .value {
        font-size: 20px;
    }

    main {
        padding-left: 12px;
        padding-right: 12px;
    }

    .hero,
    .hero.small {
        padding-left: 16px;
        padding-right: 16px;
    }
}