:root {
  --bg-outer: #e2e8f0;
  --bg-app: #f1f5f9;
  --bg-card: #ffffff;
  --bg-dark: #0f172a;
  --bg-dark-card: #1e293b;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --accent-red: #ef4444;
  --accent-red-dark: #dc2626;
  --accent-red-bg: #fef2f2;
  --accent-amber: #d97706;
  --accent-amber-bg: #fffbeb;
  --accent-blue: #3b82f6;
  --shadow-card: 0 4px 14px rgba(15, 23, 42, 0.04);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-outer);
  color: var(--text-primary);
  display: flex;
  justify-content: center;
  letter-spacing: -0.02em;
}

.app-container {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  background-color: var(--bg-app);
  position: relative;
  padding-bottom: 92px;
  box-shadow: 0 0 30px rgba(15, 23, 42, 0.08);
}

/* 1. 상단 고정 헤더 */
.header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #ffffff;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 19px;
  font-weight: 800;
  color: var(--text-primary);
  cursor: pointer;
}

.radar-ping {
  width: 10px;
  height: 10px;
  background-color: var(--accent-red);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

.region-select {
  padding: 7px 12px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  font-size: 13px;
  font-weight: 700;
  background: #f8fafc;
  color: var(--text-primary);
  cursor: pointer;
  outline: none;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 13px;
  font-size: 14px;
  opacity: 0.6;
}

.search-box input {
  width: 100%;
  padding: 11px 14px 11px 36px;
  border-radius: 12px;
  border: 1.5px solid transparent;
  background: #f1f5f9;
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
}

.search-box input:focus {
  border-color: var(--text-primary);
  background: #ffffff;
}

/* 2. 다크 레이더 히어로 섹션 */
.radar-hero {
  background: linear-gradient(145deg, #0f172a 0%, #1e293b 100%);
  color: #ffffff;
  padding: 20px 18px 22px;
  border-radius: 0 0 24px 24px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.16);
}

.radar-hero-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.radar-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  letter-spacing: 0.02em;
}

.radar-dot {
  width: 7px;
  height: 7px;
  background: #22c55e;
  border-radius: 50%;
  animation: blink 1.6s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.count-pill {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.hero-headline {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.3;
  margin-bottom: 6px;
  font-variant-numeric: tabular-nums;
}

.highlight-red {
  color: #f87171;
}

.hero-sub {
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.45;
  margin-bottom: 16px;
}

.hero-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  background: rgba(255, 255, 255, 0.06);
  padding: 12px 8px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.hero-kpi-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.kpi-label {
  font-size: 11px;
  color: #94a3b8;
}

.kpi-val {
  font-size: 16px;
  font-weight: 800;
}

.text-red { color: #f87171; }
.text-white { color: #ffffff; }
.text-blue { color: #60a5fa; }

/* 3. 메인 피드 & 툴바 */
.main-content {
  padding: 16px 18px;
}

.toolbar-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.filter-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.filter-chips::-webkit-scrollbar {
  display: none;
}

.chip {
  padding: 7px 13px;
  border-radius: 20px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
}

.chip.active {
  background: var(--bg-dark);
  color: #ffffff;
  border-color: var(--bg-dark);
}

.sort-select {
  padding: 7px 9px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  outline: none;
}

/* 급매 카드 및 3단계 등급 강조 */
.deal-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.deal-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--bg-card);
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(15, 23, 42, 0.06);
  cursor: pointer;
}

.deal-card.tier-super {
  border: 1.5px solid rgba(239, 68, 68, 0.45);
  background: linear-gradient(to bottom, #fffafa 0%, #ffffff 35%);
}

.deal-card:active {
  transform: scale(0.99);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.rank-location {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.rank-badge {
  background: #f1f5f9;
  color: var(--text-primary);
  font-weight: 800;
  padding: 3px 7px;
  border-radius: 6px;
}

.deal-card:first-child .rank-badge {
  background: var(--bg-dark);
  color: #ffffff;
}

/* 3단계 하락 등급 뱃지 */
.drop-badge {
  font-size: 12px;
  font-weight: 800;
  padding: 4px 9px;
  border-radius: 8px;
  font-variant-numeric: tabular-nums;
}

.badge-super {
  background: var(--accent-red);
  color: #ffffff;
}

.badge-high {
  background: var(--accent-red-bg);
  color: var(--accent-red-dark);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.badge-mid {
  background: var(--accent-amber-bg);
  color: var(--accent-amber);
  border: 1px solid rgba(217, 119, 6, 0.25);
}

.apt-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.apt-spec {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

/* 가격 비교 박스 + 시각적 게이지 바 */
.price-box {
  background: #f8fafc;
  padding: 14px 16px;
  border-radius: 14px;
  margin-bottom: 12px;
  font-variant-numeric: tabular-nums;
  border: 1px solid #f1f5f9;
}

.price-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 10px;
}

.prev-price {
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: line-through;
  margin-bottom: 2px;
}

.deal-price {
  font-size: 22px;
  font-weight: 800;
  color: var(--accent-red-dark);
  line-height: 1.2;
}

.diff-amount {
  font-size: 13px;
  font-weight: 800;
  color: var(--accent-red-dark);
  background: #ffffff;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.gauge-track {
  width: 100%;
  height: 6px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.gauge-fill {
  height: 100%;
  background: linear-gradient(90deg, #f87171 0%, #dc2626 100%);
  border-radius: 999px;
}

.gauge-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
}

.tag-broker {
  color: var(--accent-blue);
  font-weight: 700;
}

/* 중간 수익화 네이티브 배너 */
.ad-banner {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  color: #ffffff;
  border-radius: 18px;
  padding: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}

.ad-banner span {
  font-size: 11px;
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
}

.ad-banner p {
  font-size: 14px;
  font-weight: 700;
  margin-top: 8px;
  line-height: 1.4;
}

/* 지역 허브 및 푸터 */
.region-hub-box {
  margin-top: 22px;
  background: #ffffff;
  padding: 16px;
  border-radius: 16px;
  box-shadow: var(--shadow-card);
}

.hub-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.hub-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.site-footer {
  margin-top: 20px;
  padding: 16px 14px;
  background: #e2e8f0;
  border-radius: 14px;
  font-size: 11px;
  color: #64748b;
  line-height: 1.6;
}

.footer-head {
  font-weight: 700;
  color: #475569;
  margin-bottom: 4px;
}

/* 4. 하단 고정 CTA */
.sticky-cta-wrap {
  position: fixed;
  bottom: 0;
  width: 100%;
  max-width: 480px;
  padding: 12px 18px 18px;
  background: #f1f5f9;
  border-top: 1px solid rgba(15, 23, 42, 0.06);
  z-index: 30;
}

.btn-sticky-cta {
  width: 100%;
  padding: 16px;
  border-radius: 14px;
  border: none;
  background: var(--accent-red-dark);
  color: #ffffff;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
}

.btn-sticky-cta:active {
  transform: scale(0.99);
}

/* 모달 */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 18px;
  z-index: 50;
}

.modal-card {
  background: #ffffff;
  width: 100%;
  max-width: 400px;
  border-radius: 22px;
  padding: 24px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 800;
}

.modal-close {
background: #f1f5f9;
border: none;
width: 30px;
height: 30px;
border-radius: 50%;
font-size: 14px;
color: var(--text-secondary);
cursor: pointer;
}
.modal-desc {
font-size: 14px;
color: var(--text-secondary);
line-height: 1.55;
margin-bottom: 18px;
}
#alertForm {
display: flex;
flex-direction: column;
gap: 10px;
}
#alertForm input {
padding: 13px 14px;
border-radius: 12px;
border: 1.5px solid #cbd5e1;
font-size: 14px;
outline: none;
}
#alertForm input:focus {
border-color: var(--bg-dark);
}
.btn-submit {
margin-top: 4px;
padding: 15px;
border-radius: 12px;
border: none;
background: var(--bg-dark);
color: #ffffff;
font-size: 15px;
font-weight: 700;
cursor: pointer;
}
.hidden {
display: none !important;
}