/* ═══════════════════════════════════════════
   아파트 시세표 | common.css  v3.0
═══════════════════════════════════════════ */

:root {
    --bg-color:      #f4f7f9;
    --bg-blur:       rgba(244, 247, 249, 0.88);
    --text-main:     #1a1f24;
    --text-muted:    #73808b;
    --card-bg:       #ffffff;
    --border-color:  #e2e8f0;
    --primary-color: #facc15;
    --primary-dark:  #eab308;
    --hover-bg:      #f8fafc;
    --price-color:   #ef4444;
    --badge-bg:      #f0f9ff;
    --badge-text:    #0369a1;
    --chip-active-bg:    #1a1f24;
    --chip-active-text:  #facc15;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-color:      #0f172a;
        --bg-blur:       rgba(15, 23, 42, 0.88);
        --text-main:     #f1f5f9;
        --text-muted:    #94a3b8;
        --card-bg:       #1e293b;
        --border-color:  #334155;
        --hover-bg:      #0f172a;
        --price-color:   #f87171;
        --badge-bg:      #0c2a3f;
        --badge-text:    #38bdf8;
        --chip-active-bg:    #facc15;
        --chip-active-text:  #0f172a;
    }
}

/* ── 기본 레이아웃 ── */
body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    margin: 0; padding: 0;
    -webkit-font-smoothing: antialiased;
}
.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px 40px;
}
.page-header, .list-header, #statusMessage { display: none !important; }


/* ── 스플래시 ── */
.splash-overlay {
    position: fixed; inset: 0;
    background-color: var(--bg-color);
    z-index: 9999;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 16px;
    transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
}
.splash-overlay.hide { opacity: 0; visibility: hidden; }

/* 스플래시 프로그레스 바 */
.splash-progress-bar {
    width: 200px; height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 4px;
}
.splash-progress-fill {
    height: 100%; width: 0%;
    background: var(--primary-dark);
    border-radius: 2px;
    transition: width 0.3s ease;
}
.splash-progress-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-top: 6px;
    min-height: 1em;
}
.splash-version {
    font-size: 0.7rem;
    color: var(--text-muted);
    opacity: 0.5;
    margin-top: 4px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.spinner {
    width: 44px; height: 44px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-dark);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}
.splash-text  { font-size: 1rem; font-weight: 700; color: var(--text-main); }
.splash-error {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    text-align: center; color: var(--text-main);
}
.splash-error p     { font-weight: 700; margin: 0; }
.splash-error small { color: var(--text-muted); }
@keyframes spin { to { transform: rotate(360deg); } }


/* ── 스티키 헤더 ── */
.sticky-header {
    position: sticky; top: 0; z-index: 100;
    background-color: var(--bg-blur);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    padding: 14px 0 10px;
    margin-bottom: 14px;
}

.app-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 14px;
}
.app-title {
    font-size: 1.35rem; font-weight: 800;
    margin: 0; color: var(--text-main); letter-spacing: -0.5px;
}

/* 버튼 그룹: 새로고침 + 공유 */
.header-actions {
    display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}

.refresh-btn {
    display: flex; align-items: center; gap: 6px;
    background: var(--card-bg); border: 1px solid var(--border-color);
    color: var(--text-muted); font-size: 0.85rem; font-weight: 700;
    padding: 8px 14px; border-radius: 20px; cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05); transition: 0.2s;
}
.refresh-btn:active { transform: scale(0.95); background: var(--border-color); }


/* ── 검색창 ── */
.search-box { position: relative; width: 100%; }
.search-icon {
    position: absolute; left: 18px; top: 50%;
    transform: translateY(-50%); width: 20px; height: 20px;
    color: var(--text-muted);
}
.search-box input {
    width: 100%; box-sizing: border-box;
    padding: 14px 16px 14px 50px;
    border: 1px solid var(--border-color); border-radius: 14px;
    background-color: var(--card-bg); color: var(--text-main);
    font-size: 1rem; font-weight: 500;
    outline: none; transition: 0.25s;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}
.search-box input:focus {
    border-color: var(--primary-dark);
    box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.2);
}


/* ── 지역 칩 필터 ── */
.region-filter {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 12px 0 4px;
    /* iOS safari gap + overflow fix */
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.region-filter::-webkit-scrollbar { display: none; }

.region-chip {
    flex-shrink: 0;
    padding: 6px 14px;
    border-radius: 20px;
    border: 1.5px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-muted);
    font-size: 0.82rem; font-weight: 700;
    cursor: pointer; transition: 0.18s;
    white-space: nowrap;
    font-family: inherit;
}
.region-chip:hover { border-color: var(--text-muted); color: var(--text-main); }
.region-chip.active {
    background: var(--chip-active-bg);
    border-color: var(--chip-active-bg);
    color: var(--chip-active-text);
}


/* ── 메타 행 (결과 수 + 정렬) ── */
.meta-row {
    display: flex; align-items: center;
    justify-content: space-between;
    padding: 15px 2px;
}

.result-count {
    font-size: 0.82rem; font-weight: 700;
    color: var(--text-muted);
}

.sort-select {
    appearance: none; -webkit-appearance: none;
    background: var(--card-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2373808b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") no-repeat right 10px center;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    padding: 6px 28px 6px 12px;
    font-size: 0.82rem; font-weight: 700;
    color: var(--text-muted);
    cursor: pointer; outline: none; transition: 0.2s;
    font-family: inherit;
}
.sort-select:focus { border-color: var(--primary-dark); }


/* ── 기준일 라벨 ── */
.date-action-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 4px;
    min-height: 26px;
}
.base-date-label {
    font-size: 0.78rem; color: var(--text-muted);
    font-weight: 600;
}


/* ── 카드 (아코디언) ── */
.list-wrapper { display: flex; flex-direction: column; gap: 12px; }

.group-item {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px; overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
    transition: box-shadow 0.25s, border-color 0.25s;
}
.group-item.active {
    border-color: var(--text-muted);
    box-shadow: 0 6px 18px rgba(0,0,0,0.07);
}

/* ── 카드 헤더: 별표(좌, 형제) + 아코디언(우, 형제) ──
   fav-star-btn 과 accordion-btn 은 완전히 분리된 형제 요소.
   star 클릭 이벤트가 accordion으로 절대 전파되지 않음. */
.group-item-header {
    display: flex;
    align-items: stretch;
}

/* 별표 버튼: 좌측 고정 컬럼 */
.group-item-header > .fav-star-btn {
    width: 44px;
    flex-shrink: 0;
    border-right: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border-top: none;
    border-bottom: none;
    border-left: none;
    padding: 0;
    font-size: 1.1rem;
    cursor: pointer;
    opacity: 0.3;
    transition: opacity 0.18s, background 0.15s;
    font-family: inherit;
}
.group-item-header > .fav-star-btn:hover { opacity: 0.7; background: var(--hover-bg); }
.group-item-header > .fav-star-btn.active { opacity: 1; }

/* 아코디언: 나머지 공간 모두 차지 */
.group-item-header > .accordion-btn {
    flex: 1;
    min-width: 0;
}

.accordion-btn {
    padding: 18px 20px;
    display: flex; justify-content: space-between; align-items: center;
    cursor: pointer; user-select: none;
    transition: background 0.15s;
    background: var(--card-bg);
    gap: 12px;
}
.accordion-btn:hover { background: var(--hover-bg); }

.group-title-wrap { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.group-apt {
    font-size: 1.2rem; font-weight: 800;
    color: var(--text-main); letter-spacing: -0.4px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.group-region { font-size: 0.88rem; color: var(--text-muted); font-weight: 500; }

.accordion-right {
    display: flex; align-items: center;
    gap: 6px; flex-shrink: 0; margin-left: 10px;
    flex-wrap: nowrap; /* 한 줄 유지 */
}

/* 일반가 범위 배지 */
.price-range-badge {
    font-size: 0.78rem; font-weight: 700;
    color: var(--price-color);
    background: rgba(239,68,68,0.08);
    padding: 4px 8px; border-radius: 8px;
    white-space: nowrap;
}

/* 면적 수 배지 */
.row-count-badge {
    font-size: 0.75rem; font-weight: 700;
    color: var(--badge-text);
    background: var(--badge-bg);
    padding: 4px 8px; border-radius: 8px;
    white-space: nowrap;
}

.chevron {
    width: 22px; height: 22px;
    stroke: var(--text-muted);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), stroke 0.2s;
    flex-shrink: 0;
}
.group-item.active .chevron {
    transform: rotate(180deg);
    stroke: var(--text-main);
}


/* ── 아코디언 내부 ── */
.accordion-content {
    display: none;
    border-top: 1px solid var(--border-color);
    background: var(--card-bg);
}
.group-item.active .accordion-content {
    display: block;
    animation: slideDown 0.28s ease-out forwards;
}
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.content-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 20px;
    background-color: var(--hover-bg);
    border-bottom: 1px solid var(--border-color);
}
.header-area, .header-unit {
    font-size: 0.78rem; color: var(--text-muted); font-weight: 600;
}

.inner-row {
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}
.inner-row:last-child { border-bottom: none; }
.inner-row:hover { background: var(--hover-bg); }

/* PC: 면적(좌) + 가격3컬럼(우) 한 줄 */
.inner-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px 14px;
    gap: 12px;
}

.loan-info-row {
	padding:0 20px 10px;
}
.inner-area {
    display: flex; align-items: center;
    gap: 6px; flex-wrap: wrap;
    min-width: 150px;
    flex-shrink: 0;
}
.area-val {
    font-size: 1.05rem; font-weight: 700; color: var(--text-main);
}
.area-val.exclusive {
    font-size: 0.9rem; font-weight: 500; color: var(--text-muted);
}
.area-divider { color: #cbd5e1; font-weight: 300; }

/* 면적 타입 suffix 배지 (테라스, 펜트 등) */
.area-suffix {
    font-size: 0.7rem; font-weight: 700;
    color: #7c3aed;
    background: rgba(124,58,237,0.08);
    padding: 2px 7px; border-radius: 6px;
    white-space: nowrap;
}

/* 가격 3컬럼 */
.inner-prices {
    display: flex;
    gap: 0;
    flex-shrink: 0;
}
.price-box {
    display: flex; flex-direction: column;
    align-items: center;
    min-width: 90px;
    text-align: center;
    padding: 0 8px;
}
.price-box + .price-box {
    border-left: 1px solid var(--border-color);
}
.price-label {
    font-size: 0.72rem; color: var(--text-muted);
    margin-bottom: 6px; font-weight: 600;
    letter-spacing: 0.2px;
    white-space: nowrap;
}
.price-val {
    font-size: 1.1rem; font-weight: 700; color: var(--text-main);
    letter-spacing: -0.5px;
}
.price-box.mid .price-val {
    color: var(--price-color) !important;
    font-weight: 800 !important;
}


/* ── 빈 상태 ── */
.empty-state {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 70px 20px; gap: 8px;
    color: var(--text-muted); text-align: center;
}
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: 4px; }
.empty-state p   { font-size: 1rem; font-weight: 600; margin: 0; }
.empty-state small { font-size: 0.85rem; }


/* ── ㎡ / 평 단위 토글 ── */

/* 기본: ㎡ 표시 */
.u-pyeong { display: none !important; }
.u-sqm    { display: inline !important; }

/* 평형 모드: body.pyeong-mode 클래스로 전환 */
body.pyeong-mode .u-pyeong { display: inline !important; }
body.pyeong-mode .u-sqm    { display: none !important; }

/* 단위 토글 버튼 */
.unit-toggle-btn {
    display: flex; align-items: center;
    gap: 0;
    background: var(--card-bg);
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    font-family: inherit;
    padding: 0;
    transition: border-color 0.2s;
}
.unit-toggle-btn:focus { outline: none; border-color: var(--primary-dark); }

.u-label-sqm,
.u-label-pyeong {
    padding: 6px 11px;
    font-size: 0.82rem; font-weight: 700;
    color: var(--text-muted);
    transition: background 0.18s, color 0.18s;
    user-select: none;
    line-height: 1;
}
.u-label-sqm.active,
.u-label-pyeong.active {
    background: var(--chip-active-bg);
    color: var(--chip-active-text);
}
/* 구분선 */
.unit-toggle-btn .u-sep {
    width: 1px; height: 18px;
    background: var(--border-color);
    flex-shrink: 0;
}

/* 아코디언 헤더 단위 배지 */
.header-unit-badge {
    display: inline-block;
    font-size: 0.72rem; font-weight: 700;
    background: var(--primary-color);
    color: #1a1f24;
    padding: 1px 6px; border-radius: 5px;
    margin-left: 4px;
    vertical-align: middle;
}
#scrollSentinel { height: 40px; width: 100%; margin-top: 16px; }


/* ══════════════════════════════════════
   가격 변동 뱃지 (지난주 대비)
══════════════════════════════════════ */

/* 가격 변동 (price-box 내부) */
.price-diff {
    display: block;
    font-size: 0.72rem;
    font-weight: 800;
    margin-top: 4px;
    margin-bottom: 10px;
    letter-spacing: -0.2px;
    line-height: 1;
    white-space: nowrap;
    min-height: 1em; /* 항상 같은 높이 확보 → 컬럼 정렬 */
}
.price-diff.up   { color: #ef4444; }
.price-diff.down { color: #3b82f6; }
.price-diff.none {
    color: var(--border-color);
    font-weight: 400;
    font-size: 0.65rem;
}

/* 카드 헤더 변동 요약 뱃지 */
.group-diff-badge {
    font-size: 0.75rem;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 8px;
    white-space: nowrap;
    letter-spacing: -0.2px;
    flex-shrink: 0;
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.group-diff-badge.up    { color: #ef4444; background: rgba(239,68,68,0.09); }
.group-diff-badge.down  { color: #3b82f6; background: rgba(59,130,246,0.09); }
.group-diff-badge.mixed { color: #7c3aed; background: rgba(124,58,237,0.09); }

@media (prefers-color-scheme: dark) {
    .price-diff.up   { color: #fca5a5; }
    .price-diff.down { color: #93c5fd; }
    .group-diff-badge.up    { color: #fca5a5; background: rgba(239,68,68,0.15); }
    .group-diff-badge.down  { color: #93c5fd; background: rgba(59,130,246,0.15); }
    .group-diff-badge.mixed { color: #c4b5fd; background: rgba(124,58,237,0.15); }
}

/* 480px 이하에서 카드 헤더 요약 뱃지 숨김 */
@media screen and (max-width: 480px) {
    .group-diff-badge { display: none; }
}


/* ── LTV 칩 (카드 헤더 규제 배지 옆) ── */
.ltv-chip {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 5px;
    white-space: nowrap;
    letter-spacing: -0.1px;
}
/* LTV 40% — 규제지역 (주황 계열) */
.ltv-chip.ltv-40 {
    background: rgba(234, 88, 12, 0.10);
    color: #c2410c;
    border: 1px solid rgba(234, 88, 12, 0.25);
}
/* LTV 70% — 일반지역 (파랑 계열) */
.ltv-chip.ltv-70 {
    background: rgba(37, 99, 235, 0.08);
    color: #1d4ed8;
    border: 1px solid rgba(37, 99, 235, 0.20);
}
@media (prefers-color-scheme: dark) {
    .ltv-chip.ltv-40 { background: rgba(234,88,12,0.18); color: #fdba74; border-color: rgba(234,88,12,0.32); }
    .ltv-chip.ltv-70 { background: rgba(37,99,235,0.15); color: #93c5fd; border-color: rgba(37,99,235,0.28); }
}


   대출 정보 행 (가격 3컬럼 아래 풀폭)
══════════════════════════════════════ */
.loan-info-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px 14px;
    flex-wrap: wrap;
    border-top: 1px dashed var(--border-color);
}
.loan-info-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}
.loan-tags {
    display:inline-block;
}
.loan-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 7px;
    white-space: nowrap;
    letter-spacing: -0.2px;
}
.loan-tag-label {
    font-size: 0.65rem;
    font-weight: 800;
    font-style: normal;
    padding: 1px 6px;
    border-radius: 3px;
    background: rgba(0,0,0,0.10);
    color: inherit;
    opacity: 0.85;
}
/* 색상 클래스 (loan-tag / loan-badge 공통) */
.loan-ltv-reg, .loan-tag.loan-ltv-reg {
    background: rgba(234, 88, 12, 0.10); color: #c2410c;
    border: 1px solid rgba(234, 88, 12, 0.25);
}
.loan-ltv-gen, .loan-tag.loan-ltv-gen {
    background: rgba(37, 99, 235, 0.08); color: #1d4ed8;
    border: 1px solid rgba(37, 99, 235, 0.20);
}
.loan-pol-a, .loan-tag.loan-pol-a {
    background: rgba(22, 163, 74, 0.09); color: #15803d;
    border: 1px solid rgba(22, 163, 74, 0.22);
}
.loan-pol-b, .loan-tag.loan-pol-b {
    background: rgba(202, 138, 4, 0.09); color: #a16207;
    border: 1px solid rgba(202, 138, 4, 0.22);
}
.loan-pol-c, .loan-tag.loan-pol-c {
    background: rgba(100, 116, 139, 0.09); color: #475569;
    border: 1px solid rgba(100, 116, 139, 0.22);
}
@media (prefers-color-scheme: dark) {
    .loan-ltv-reg, .loan-tag.loan-ltv-reg { background: rgba(234,88,12,0.18); color: #fdba74; border-color: rgba(234,88,12,0.32); }
    .loan-ltv-gen, .loan-tag.loan-ltv-gen { background: rgba(37,99,235,0.15); color: #93c5fd; border-color: rgba(37,99,235,0.28); }
    .loan-pol-a,   .loan-tag.loan-pol-a   { background: rgba(22,163,74,0.16); color: #86efac; border-color: rgba(22,163,74,0.28); }
    .loan-pol-b,   .loan-tag.loan-pol-b   { background: rgba(202,138,4,0.16); color: #fde68a; border-color: rgba(202,138,4,0.28); }
    .loan-pol-c,   .loan-tag.loan-pol-c   { background: rgba(100,116,139,0.18); color: #94a3b8; border-color: rgba(100,116,139,0.28); }
}


/* ══════════════════════════════════════
   규제지역 배지 (2025.10.16 기준)
   A = 투기지역+투기과열+조정 (서울 강남3구+용산)
   B = 투기과열+조정 (서울 나머지+경기 12곳)
══════════════════════════════════════ */

.reg-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 5px;
}

.reg-badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 5px;
    letter-spacing: -0.2px;
    white-space: nowrap;
}

/* 투기지역 — 빨간 (가장 강한 규제) */
.reg-badge.reg-A {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.28);
}

/* 투기과열지구 — 주황 */
.reg-badge.reg-B {
    background: rgba(234, 88, 12, 0.09);
    color: #c2410c;
    border: 1px solid rgba(234, 88, 12, 0.22);
}

/* 조정대상지역 — 파랑 */
.reg-badge.reg-C {
    background: rgba(37, 99, 235, 0.07);
    color: #1d4ed8;
    border: 1px solid rgba(37, 99, 235, 0.18);
}

/* 다크모드 */
@media (prefers-color-scheme: dark) {
    .reg-badge.reg-A { background: rgba(239,68,68,0.18); color: #fca5a5; border-color: rgba(239,68,68,0.35); }
    .reg-badge.reg-B { background: rgba(234,88,12,0.18); color: #fdba74; border-color: rgba(234,88,12,0.32); }
    .reg-badge.reg-C { background: rgba(37,99,235,0.15); color: #93c5fd; border-color: rgba(37,99,235,0.28); }
}

/* 카드 좌측 컬러 테두리 — 규제 강도 시각화 */
.group-item.has-reg.zone-A { border-left: 3px solid rgba(239, 68, 68, 0.55); }
.group-item.has-reg.zone-B { border-left: 3px solid rgba(234, 88, 12, 0.45); }


/* ══════════════════════════════════════
   맨위로 버튼
   ─────────────────────────────────────
   - 우하단 고정 (fixed)
   - 기본 숨김 → .visible 클래스로 표시
   - opacity + translateY 트랜지션으로 자연스럽게 등장/소멸
══════════════════════════════════════ */
.scroll-top-btn {
    position: fixed;
    bottom: 28px;
    right: 20px;
    z-index: 200;

    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;

    background: var(--chip-active-bg);
    color: var(--chip-active-text);
    border: none;
    border-radius: 50%;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
    cursor: pointer;

    /* 기본 숨김 상태 */
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none; /* 숨겨진 동안 클릭 막기 */
    transition: opacity 0.28s ease, transform 0.28s ease;
}

/* app.js 에서 .visible 추가 시 등장 */
.scroll-top-btn.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.scroll-top-btn:active {
    transform: scale(0.92);
}

/* ── 무한스크롤 센티넬 ── */
@media screen and (max-width: 768px) {
    .accordion-btn { padding: 18px 16px; }

    /* 가격 범위 배지: 모바일에서 숨김 (헤더가 좁음) */
    .price-range-badge { display: none; }

    .accordion-right { gap: 4px; }

    /* 모바일: 공유 버튼 텍스트 숨김 → 아이콘만 표시 */
    .share-btn-text { display: none; }
    .share-btn {
        padding: 8px 10px;   /* 정사각형에 가깝게 */
        border-radius: 50%;
        min-width: 38px; min-height: 38px;
        justify-content: center;
    }

    .inner-main {
        flex-direction: column;
        align-items: stretch;
        padding: 14px 16px 10px;
        gap: 12px;
    }
    .inner-area {
        justify-content: center;
        padding-bottom: 10px;
        border-bottom: 1px dashed var(--border-color);
        min-width: unset;
    }
    .inner-prices {
        width: 100%;
        background: var(--hover-bg);
        border-radius: 12px;
        overflow: hidden;
    }
    .price-box {
        flex: 1;
        min-width: 0;
        padding: 12px 4px;
    }
    .price-box + .price-box {
        border-left: 1px solid var(--border-color);
    }
    .loan-info-row {
        flex-direction: column;
        align-items: flex-start;
        padding: 8px 16px 14px;
        gap: 6px;
    }

    .meta-row { padding-top: 4px; }
}

@media screen and (max-width: 400px) {
    .group-apt { font-size: 1.05rem; }
    .row-count-badge { display: none; }
    .loan-tags {display:flex; gap: 6px; }
}


/* ══════════════════════════════════════════════
   공유 버튼
══════════════════════════════════════════════ */
.share-btn {
    display: flex; align-items: center; gap: 6px;
    background: var(--card-bg);
    border: 1px solid var(--primary-dark);
    color: var(--primary-dark);
    font-size: 0.85rem; font-weight: 700;
    padding: 8px 14px; border-radius: 20px;
    cursor: pointer; transition: 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    font-family: inherit;
}
.share-btn:hover { background: var(--primary-color); color: #1a1f24; }
.share-btn:active { transform: scale(0.95); }

/* ══════════════════════════════════════════════
   공유 모달 오버레이
══════════════════════════════════════════════ */
.share-modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
    z-index: 9000;
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
    opacity: 0; visibility: hidden;
    transition: opacity 0.22s, visibility 0.22s;
}
.share-modal-overlay.open { opacity: 1; visibility: visible; }

.share-modal-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 24px 22px 22px;
    width: 100%; max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    transform: translateY(10px);
    transition: transform 0.22s;
}
.share-modal-overlay.open .share-modal-card { transform: translateY(0); }

.share-modal-header {
    display: flex; align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.share-modal-title {
    display: flex; align-items: center; gap: 8px;
    font-size: 1rem; font-weight: 800;
    color: var(--text-main); margin: 0;
}
.share-close-btn {
    background: none; border: none;
    font-size: 1rem; color: var(--text-muted);
    cursor: pointer; padding: 4px 8px;
    border-radius: 8px; transition: 0.15s;
    font-family: inherit; line-height: 1;
}
.share-close-btn:hover { background: var(--hover-bg); color: var(--text-main); }

.share-modal-desc {
    font-size: 0.82rem; color: var(--text-muted);
    line-height: 1.55; margin: 0 0 18px;
}

/* 기간 설정 */
.share-duration-wrap { margin-bottom: 16px; }
.share-duration-label {
    display: block;
    font-size: 0.78rem; font-weight: 700;
    color: var(--text-muted); margin-bottom: 8px;
}
.share-duration-row {
    display: flex; gap: 8px; align-items: center;
}
.share-duration-input {
    width: 64px; padding: 10px 8px;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-color); color: var(--text-main);
    font-size: 1rem; font-weight: 700;
    text-align: center; outline: none;
    font-family: inherit; transition: 0.2s; flex-shrink: 0;
}
.share-duration-input:focus { border-color: var(--primary-dark); }
.share-unit-select {
    flex: 1; padding: 10px 10px;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-color); color: var(--text-main);
    font-size: 0.85rem; font-weight: 600;
    outline: none; cursor: pointer;
    font-family: inherit; transition: 0.2s;
    appearance: none; -webkit-appearance: none;
    min-width: 0;
}
.share-unit-select:focus { border-color: var(--primary-dark); }
.share-gen-btn {
    padding: 10px 16px;
    background: var(--primary-dark); color: #1a1f24;
    border: none; border-radius: 10px;
    font-size: 0.88rem; font-weight: 800;
    cursor: pointer; transition: 0.2s;
    white-space: nowrap; font-family: inherit; flex-shrink: 0;
}
.share-gen-btn:hover { background: var(--primary-color); }
.share-gen-btn:active { transform: scale(0.96); }

.share-hint {
    font-size: 0.72rem; color: var(--text-muted);
    margin: 6px 0 0; opacity: 0.65;
}

/* 생성된 링크 결과 */
.share-result-box {
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
    display: flex; flex-direction: column; gap: 10px;
}
.share-exp-label {
    font-size: 0.75rem; font-weight: 700;
    color: var(--text-muted);
    padding: 6px 12px;
    background: var(--hover-bg);
    border-radius: 8px;
    white-space: nowrap;
    align-self: flex-start;
}
.share-msg-label {
    font-size: 0.78rem; font-weight: 700;
    color: var(--text-muted);
    margin: 0 0 8px;
}
.share-msg-preview-wrap {
    border: 1.5px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    background: var(--hover-bg);
    margin-bottom: 10px;
}
.share-msg-textarea {
    width: 100%; box-sizing: border-box;
    padding: 12px 14px;
    background: transparent;
    color: var(--text-main);
    font-size: 0.82rem;
    font-weight: 500;
    line-height: 1.65;
    border: none; outline: none; resize: none;
    font-family: inherit;
    cursor: text;
}
/* 전체 복사 버튼 */
.share-copy-btn-full {
    width: 100%;
    padding: 13px 16px;
    background: var(--primary-dark); color: #1a1f24;
    border: none; border-radius: 12px;
    font-size: 0.92rem; font-weight: 800;
    cursor: pointer; transition: 0.2s;
    font-family: inherit; letter-spacing: -0.2px;
}
.share-copy-btn-full:hover  { background: var(--primary-color); }
.share-copy-btn-full:active { transform: scale(0.98); }

.share-copy-msg {
    font-size: 0.78rem; font-weight: 700;
    color: #16a34a; text-align: center;
    margin-top: 8px; line-height: 1.5;
}

/* ══════════════════════════════════════════════
   링크 만료 페이지
══════════════════════════════════════════════ */
.share-expired-page {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    text-align: center;
    padding: 40px 30px;
    max-width: 340px;
    gap: 10px;
}
.sep-icon  { font-size: 3rem; line-height: 1; margin-bottom: 4px; }
.sep-title {
    font-size: 1.3rem; font-weight: 800;
    color: var(--text-main); margin: 0;
    letter-spacing: -0.5px;
}
.sep-desc  {
    font-size: 0.95rem; color: var(--text-muted);
    margin: 4px 0 0; line-height: 1.6;
}
.sep-sub   {
    font-size: 0.85rem; color: var(--text-muted);
    opacity: 0.75; margin: 0;
}


/* ══════════════════════════════════════════════
   공유 링크 프리뷰 페이지
══════════════════════════════════════════════ */
.share-preview-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 40px 32px;
    max-width: 380px;
    width: 100%;
    gap: 0;
}

/* 임시 링크 배지 */
.spp-badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--primary-dark);
    background: rgba(234, 179, 8, 0.12);
    border: 1px solid rgba(234, 179, 8, 0.3);
    padding: 4px 12px;
    border-radius: 20px;
    letter-spacing: 0.3px;
    margin-bottom: 24px;
}

/* 아이콘 */
.spp-icon {
    font-size: 3.5rem;
    line-height: 1;
    margin-bottom: 16px;
    filter: drop-shadow(0 4px 12px rgba(250,204,21,0.3));
}

/* 제목 */
.spp-title {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--text-main);
    margin: 0 0 14px;
    letter-spacing: -0.5px;
}

/* 설명 — 카운트다운 포함 */
.spp-desc {
    font-size: 1rem;
    color: var(--text-muted);
    line-height: 1.9;
    margin: 0 0 28px;
}
/* 카운트다운 숫자 강조 */
.spp-desc #shareCountdown {
    display: inline-block;
    font-weight: 900;
    font-size: 1.15rem;
    color: var(--primary-dark);
    min-width: 20px;
    transition: color 0.3s;
}

/* CTA 버튼 */
.spp-btn {
    width: 100%;
    max-width: 240px;
    padding: 15px 24px;
    background: var(--primary-dark);
    color: #1a1f24;
    border: none;
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.18s, background 0.18s;
    font-family: inherit;
    letter-spacing: 0.2px;
    box-shadow: 0 8px 24px rgba(234,179,8,0.3);
    margin-bottom: 20px;
}
.spp-btn:hover  { background: var(--primary-color); transform: translateY(-2px); }
.spp-btn:active { transform: scale(0.97); }

/* 하단 안내 */
.spp-notice {
    font-size: 0.73rem;
    color: var(--text-muted);
    margin: 0;
    opacity: 0.5;
}


/* ══════════════════════════════════════════════
   즐겨찾기 별표 버튼
══════════════════════════════════════════════ */


/* 즐겨찾기 지역 칩 */
.region-chip.fav-chip {
    background: rgba(250,204,21,0.1);
    border-color: rgba(234,179,8,0.3);
    color: var(--primary-dark);
}
.region-chip.fav-chip.active {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    color: #1a1f24;
}

/* 모바일에서 주요 지역 외 칩 숨김 */
@media screen and (max-width: 768px) {
    .region-chip.mobile-hidden { display: none; }
}


/* ══════════════════════════════════════════════
   최근 검색어
══════════════════════════════════════════════ */
.recent-search-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 2px 2px;
    flex-wrap: wrap;
}
.recent-label {
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--text-muted);
    white-space: nowrap;
    opacity: 0.7;
    flex-shrink: 0;
}
.recent-chips {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.recent-chip {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    overflow: hidden;
    transition: border-color 0.15s;
}
.recent-chip:hover { border-color: var(--text-muted); }
.recent-chip-text {
    background: none;
    border: none;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-main);
    padding: 5px 4px 5px 10px;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
}
.recent-chip-text:hover { color: var(--primary-dark); }
.recent-chip-del {
    background: none;
    border: none;
    font-size: 0.68rem;
    color: var(--text-muted);
    padding: 5px 8px 5px 2px;
    cursor: pointer;
    font-family: inherit;
    opacity: 0.6;
    line-height: 1;
    transition: opacity 0.15s;
}
.recent-chip-del:hover { opacity: 1; color: #ef4444; }


/* ══════════════════════════════════════════════
   공유 모달 — 즐겨찾기 포함 토글
══════════════════════════════════════════════ */
.share-fav-toggle-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: var(--hover-bg);
    border-radius: 12px;
    margin-bottom: 16px;
    gap: 12px;
	display:none;
}
.share-fav-toggle-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.share-fav-toggle-label {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-main);
}
.share-fav-toggle-desc {
    font-size: 0.74rem;
    color: var(--text-muted);
}
/* iOS-style 슬라이더 스위치 */
.sft-switch {
    position: relative;
    display: inline-block;
    width: 46px; height: 26px;
    flex-shrink: 0;
}
.sft-switch input { opacity: 0; width: 0; height: 0; }
.sft-slider {
    position: absolute; inset: 0;
    background: var(--border-color);
    border-radius: 26px;
    cursor: pointer;
    transition: background 0.22s;
}
.sft-slider::before {
    content: '';
    position: absolute;
    width: 20px; height: 20px;
    left: 3px; top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.22s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.sft-switch input:checked + .sft-slider { background: var(--primary-dark); }
.sft-switch input:checked + .sft-slider::before { transform: translateX(20px); }

/* ── 모바일 즐겨찾기 칩: 텍스트 숨김 ── */
@media screen and (max-width: 768px) {
    .fav-chip-text { display: none; }
    .region-chip.fav-chip { padding: 8px 12px; }
}


/* ══════════════════════════════════════════════
   카카오톡 공유 버튼 (오너 모달)
══════════════════════════════════════════════ */
.share-action-btns {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.share-kakao-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 16px;
    background: #FEE500;
    color: #191919;
    border: none;
    border-radius: 12px;
    font-size: 0.92rem;
    font-weight: 800;
    cursor: pointer;
    transition: 0.18s;
    font-family: inherit;
    letter-spacing: -0.2px;
}
.share-kakao-btn:hover  { background: #F5DC00; transform: translateY(-1px); }
.share-kakao-btn:active { transform: scale(0.98); }

/* ══════════════════════════════════════════════
   수신자 공유 패널 (헤더 공유 버튼 클릭 시)
══════════════════════════════════════════════ */
.recv-share-panel {
    position: fixed;
    top: 64px;
    right: 16px;
    z-index: 8000;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 16px;
    width: min(320px, calc(100vw - 32px));
    box-shadow: 0 12px 40px rgba(0,0,0,0.22);
    animation: panelIn 0.18s ease-out;
}
@keyframes panelIn {
    from { opacity: 0; transform: translateY(-8px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.rsp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.rsp-title {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--text-main);
}
.rsp-close {
    background: none;
    border: none;
    font-size: 1rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 6px;
    font-family: inherit;
    transition: 0.15s;
}
.rsp-close:hover { background: var(--hover-bg); }
.rsp-url {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-family: monospace;
    background: var(--hover-bg);
    padding: 8px 10px;
    border-radius: 8px;
    margin-bottom: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.rsp-actions {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-bottom: 10px;
}
.rsp-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 11px 14px;
    border: none;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: 0.15s;
}
.rsp-copy {
    background: var(--hover-bg);
    color: var(--text-main);
    border: 1.5px solid var(--border-color);
}
.rsp-copy:hover { border-color: var(--text-muted); }
.rsp-kakao {
    background: #FEE500;
    color: #191919;
}
.rsp-kakao:hover  { background: #F5DC00; }
.rsp-kakao:active { transform: scale(0.97); }
.rsp-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin: 0;
    opacity: 0.6;
    text-align: center;
}


/* ══════════════════════════════════════════════
   투데이 방문자 팝업 (직접/공유 분리 표시)
══════════════════════════════════════════════ */
.today-popup {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9500;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 0;
    width: min(300px, calc(100vw - 40px));
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: todayPopIn 0.22s cubic-bezier(0.34,1.56,0.64,1);
    overflow: hidden;
}
@keyframes todayPopIn {
    from { opacity: 0; transform: translate(-50%,-50%) scale(0.85); }
    to   { opacity: 1; transform: translate(-50%,-50%) scale(1); }
}
.tp-header {
    display: flex; align-items: center;
    justify-content: space-between;
    padding: 15px 18px 12px;
    border-bottom: 1px solid var(--border-color);
}
.tp-title { font-size: 0.95rem; font-weight: 800; color: var(--text-main); }
.tp-close {
    background: none; border: none; font-size: 1rem;
    color: var(--text-muted); cursor: pointer;
    padding: 2px 6px; border-radius: 6px;
    font-family: inherit; transition: 0.15s;
}
.tp-close:hover { background: var(--hover-bg); }
.tp-body { padding: 16px 18px 18px; }
.tp-rows { margin-bottom: 14px; }
.tp-row {
    display: flex; align-items: center;
    justify-content: space-between;
    padding: 11px 0;
}
.tp-row-total { padding-top: 13px; }
.tp-divider {
    height: 1px;
    background: var(--border-color);
    opacity: 0.6;
}
.tp-label {
    font-size: 0.88rem; font-weight: 600;
    color: var(--text-muted);
}
.tp-row-total .tp-label {
    font-size: 0.9rem; font-weight: 800;
    color: var(--text-main);
}
.tp-val {
    display: flex; align-items: baseline; gap: 2px;
    min-width: 60px; justify-content: flex-end;
}
.tp-num-sm {
    font-size: 1.5rem; font-weight: 900;
    color: var(--primary-dark); letter-spacing: -1px; line-height: 1;
}
.tp-total-num { font-size: 1.7rem; color: var(--text-main); }
.tp-unit-sm {
    font-size: 0.8rem; font-weight: 700;
    color: var(--text-muted); padding-bottom: 2px;
}
.tp-spinner-sm {
    display: inline-block;
    width: 18px; height: 18px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary-dark);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.tp-err { font-size: 0.85rem; color: var(--text-muted); opacity: 0.5; }
.tp-date {
    font-size: 0.78rem; color: var(--text-muted);
    font-weight: 600; margin: 0 0 4px; text-align: center;
}
.tp-hint {
    font-size: 0.7rem; color: var(--text-muted);
    opacity: 0.5; margin: 0; text-align: center;
}


/* ══════════════════════════════════════════════
   생애최초 LTV 토글 버튼
══════════════════════════════════════════════ */
.first-home-btn {
    display: flex; align-items: center; gap: 5px;
    background: var(--card-bg);
    border: 1.5px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.8rem; font-weight: 700;
    padding: 6px 12px; border-radius: 20px;
    cursor: pointer; transition: 0.2s;
    font-family: inherit; white-space: nowrap;
}
.first-home-btn:hover {
    border-color: #16a34a;
    color: #16a34a;
    background: rgba(22,163,74,0.06);
}
.first-home-btn.active {
    background: rgba(22,163,74,0.12);
    border-color: #16a34a;
    color: #15803d;
    font-weight: 800;
}
.first-home-btn.active::after {
    content: ' ON';
    font-size: 0.72rem;
    font-weight: 900;
    opacity: 0.8;
}
@media (prefers-color-scheme: dark) {
    .first-home-btn.active {
        background: rgba(22,163,74,0.18);
        color: #86efac;
        border-color: rgba(22,163,74,0.5);
    }
}

/* 생애최초 대출 배지 — 녹색 계열 */
.loan-badge.loan-first-home,
.loan-tag.loan-first-home {
    background: rgba(22,163,74,0.12);
    color: #15803d;
    border: 1px solid rgba(22,163,74,0.3);
}
@media (prefers-color-scheme: dark) {
    .loan-badge.loan-first-home,
    .loan-tag.loan-first-home {
        background: rgba(22,163,74,0.2);
        color: #86efac;
        border-color: rgba(22,163,74,0.35);
    }
}

/* 생애최초 LTV 칩 */
.ltv-chip.ltv-first {
    border-color: rgba(22,163,74,0.4) !important;
    background: rgba(22,163,74,0.1) !important;
    color: #15803d !important;
}
.ltv-fh-mark {
    font-style: normal;
    font-size: 0.6rem;
    font-weight: 900;
    background: rgba(22,163,74,0.2);
    padding: 1px 4px;
    border-radius: 3px;
    margin-left: 3px;
    vertical-align: middle;
}
@media (prefers-color-scheme: dark) {
    .ltv-chip.ltv-first { color: #86efac !important; }
}

/* 모바일: 생애최초 버튼 텍스트 축약 */
@media screen and (max-width: 480px) {
    .first-home-btn { font-size: 0.75rem; padding: 5px 9px; }
}


/* ── 링크만 복사 버튼 ── */
.share-url-only-btn {
    width: 100%;
    padding: 12px 16px;
    background: var(--hover-bg);
    color: var(--text-main);
    border: 1.5px solid var(--border-color);
    border-radius: 12px;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    transition: 0.18s;
    font-family: inherit;
    letter-spacing: -0.2px;
}
.share-url-only-btn:hover {
    border-color: var(--text-muted);
    background: var(--card-bg);
}
