/* 삼복부동산 · 대전 아파트 실거래가 — mobile first */

:root {
  --navy: #1e3a8a;
  --navy-700: #1b3475;
  --navy-900: #112254;
  --gold: #facc15;
  --bg: #f8fafc;
  --card: #ffffff;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --trade: #b91c1c;
  --jeonse: #1d4ed8;
  --wolse: #0f766e;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 10px 28px -18px rgba(15, 23, 42, .35);
  --maxw: 760px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard",
    "Pretendard Variable", "Noto Sans KR", "Malgun Gothic", "맑은 고딕", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  word-break: keep-all;
  overflow-wrap: break-word;
}

p { margin: 0; }
a { color: inherit; }
button { font: inherit; color: inherit; }

.page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ---------- 헤더 ---------- */
.hero {
  background:
    radial-gradient(120% 90% at 88% -10%, rgba(250, 204, 21, .22), transparent 55%),
    linear-gradient(160deg, #23439b 0%, var(--navy) 45%, var(--navy-900) 100%);
  color: #fff;
  padding: calc(16px + env(safe-area-inset-top)) 16px 62px;
}

.hero-inner { max-width: var(--maxw); margin: 0 auto; }

.hero-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }

.brand-mark {
  width: 42px; height: 42px; border-radius: 11px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .22);
  flex: none;
}

.brand-text { min-width: 0; }

.brand-sub {
  font-size: 11.5px;
  letter-spacing: -.01em;
  color: rgba(255, 255, 255, .74);
  margin-bottom: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-text h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
  letter-spacing: -.03em;
  font-weight: 800;
}

.hero-actions { display: flex; gap: 6px; flex: none; padding-top: 2px; }

.btn-ghost {
  display: inline-flex; align-items: center; gap: 4px;
  height: 32px; padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, .3);
  border-radius: 9px;
  background: rgba(255, 255, 255, .1);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s ease;
}
.btn-ghost:hover { background: rgba(255, 255, 255, .18); }
.btn-ghost svg { width: 15px; height: 15px; }

.hero-caption {
  margin-top: 14px;
  font-size: 12.5px;
  color: rgba(255, 255, 255, .78);
  display: flex; align-items: center; gap: 6px;
}
.hero-caption::before {
  content: "";
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--gold);
}

/** 거래 종류 탭 (스티키) */
.sticky-tabs {
  position: sticky;
  top: 0;
  z-index: 30;
  margin-top: 14px;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(150%) blur(12px);
  -webkit-backdrop-filter: saturate(150%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.tabs {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 8px 16px;
  display: flex;
  gap: 6px;
}

.tab {
  flex: 1;
  height: 38px;
  border: 0;
  border-radius: 10px;
  background: #eef2f8;
  color: var(--muted);
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -.02em;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.tab:active { transform: scale(.99); }
.tab.is-active {
  background: var(--navy);
  color: #fff;
  box-shadow: 0 4px 12px -6px rgba(30, 58, 138, .8);
}

/* ---------- 본문 ---------- */
.main { flex: 1; }

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 16px;
}

/* ---------- 요약 ---------- */
.dashboard { margin-top: -46px; position: relative; z-index: 5; }
.stat-main {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px 18px 15px;
  box-shadow: var(--shadow);
}

.stat-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -.01em;
}

.stat-big {
  display: flex;
  align-items: baseline;
  gap: 3px;
  margin-top: 2px;
}
.stat-big strong {
  font-size: 38px;
  line-height: 1.1;
  letter-spacing: -.045em;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.stat-big span { font-size: 15px; font-weight: 700; color: var(--ink-2); }

.stat-note {
  margin-top: 5px;
  font-size: 12.5px;
  color: var(--muted);
  min-height: 18px;
}

.stat-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  min-width: 0;
}
.stat-k { font-size: 11.5px; font-weight: 600; color: var(--muted); }
.stat-v {
  margin-top: 2px;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}
.stat-s {
  margin-top: 1px;
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 16px;
}

/* 자치구 칩 */
.chips {
  display: flex;
  gap: 7px;
  margin-top: 14px;
  overflow-x: auto;
  padding-bottom: 3px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.chips::-webkit-scrollbar { display: none; }

.chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s ease;
}
.chip .n {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.chip.is-active {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}
.chip.is-active .n { color: rgba(255, 255, 255, .8); }

/* ---------- 필터 ---------- */
.filters {
  margin-top: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow);
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 10px;
  color: var(--muted);
}
.search svg { width: 18px; height: 18px; flex: none; }
.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 11px 0;
  font-size: 15px;
  color: var(--ink);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.search input::-webkit-search-cancel-button { display: none; }
.search input::placeholder { color: #94a3b8; }
.search:focus-within { border-color: #93a7e0; background: #fff; }

.clear-btn {
  border: 0;
  background: #e2e8f0;
  color: var(--ink-2);
  width: 20px; height: 20px;
  border-radius: 50%;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  flex: none;
  padding: 0;
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.months {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  flex: 1;
  padding-bottom: 2px;
}
.months::-webkit-scrollbar { display: none; }

.month-btn {
  flex: none;
  height: 32px;
  padding: 0 10px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  white-space: nowrap;
}
.month-btn.is-active { background: #e8edfb; border-color: #b9c8f0; color: var(--navy); }

.month-pick { flex: none; display: flex; align-items: center; gap: 5px; }
.month-pick-label { display: none; }

input[type="month"] {
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  background: #fff;
  font-family: inherit;
}

.sort { display: flex; align-items: center; gap: 7px; margin-left: auto; }
.sort-label { font-size: 12.5px; font-weight: 600; color: var(--muted); }
select#sort {
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0 26px 0 9px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-2);
  background: #fff url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6' fill='none' stroke='%2364748b' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 8px center;
  -webkit-appearance: none;
  appearance: none;
  font-family: inherit;
}

.btn-refresh {
  flex: none;
  width: 34px; height: 32px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--ink-2);
  cursor: pointer;
}
.btn-refresh svg { width: 16px; height: 16px; }
.btn-refresh.is-spinning svg { animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 목록 ---------- */
.list-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 16px 2px 8px;
  flex-wrap: wrap;
}
.list-head p { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.list-tip {
  font-size: 11.5px !important;
  font-weight: 500 !important;
  color: var(--muted) !important;
  width: 100%;
}

.list { display: flex; flex-direction: column; gap: 9px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px 13px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.card:hover { border-color: #cdd8ea; box-shadow: 0 6px 18px -14px rgba(15, 23, 42, .5); }

.card-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--muted);
  min-height: 17px;
}
.loc { font-weight: 800; color: var(--navy); letter-spacing: -.01em; }
.card-head .date { margin-left: auto; font-variant-numeric: tabular-nums; }

.badge {
  display: inline-flex;
  align-items: center;
  height: 17px;
  padding: 0 5px;
  border-radius: 5px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: -.01em;
}
.badge-cancel { background: #fee2e2; color: #b91c1c; }
.badge-direct { background: #eef2ff; color: #4338ca; }
.badge-renew { background: #ecfdf5; color: #047857; }

.card-body {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-top: 3px;
}

.apt {
  margin: 0;
  min-width: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.35;
  color: var(--ink);
}

.price {
  flex: none;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -.035em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.price.trade { color: var(--trade); }
.price.jeonse { color: var(--jeonse); }
.price.wolse { color: var(--wolse); }
.price .sub { font-size: 12.5px; font-weight: 700; opacity: .7; margin-right: 2px; }
.price .vs { color: #cbd5e1; font-weight: 600; font-size: 13px; }

.meta {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0 6px;
  font-variant-numeric: tabular-nums;
}
.meta span { white-space: nowrap; }
.meta .dot { color: #cbd5e1; }

.card.is-cancel { background: #fffafa; border-color: #f3dede; }
.card.is-cancel .apt { color: var(--muted); }
.card.is-cancel .price { color: #a16161; text-decoration: line-through; text-decoration-thickness: 1px; }

/* 스켈레톤 */
.skeleton-card {
  height: 92px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: linear-gradient(100deg, #f1f5f9 20%, #f8fafc 40%, #f1f5f9 60%);
  background-size: 220% 100%;
  animation: shimmer 1.25s ease-in-out infinite;
}
@keyframes shimmer { from { background-position: 120% 0; } to { background-position: -40% 0; } }

/* 상태 카드 */
.state {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 26px 18px;
  text-align: center;
}
.state-icon { font-size: 26px; line-height: 1; }
.state-title { margin-top: 8px; font-size: 15px; font-weight: 800; letter-spacing: -.02em; }
.state-text { margin-top: 6px; font-size: 13px; color: var(--muted); line-height: 1.6; }
.state-actions { margin-top: 14px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.state-btn {
  height: 38px;
  padding: 0 16px;
  border-radius: 10px;
  border: 0;
  background: var(--navy);
  color: #fff;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.state-btn.ghost { background: #eef2f8; color: var(--ink-2); }
.state code {
  font-size: 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 5px;
}

.more {
  width: 100%;
  height: 44px;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

/* 상담 */
.ask {
  margin: 22px 0 8px;
  background: linear-gradient(150deg, #eef3ff, #f8fbff);
  border: 1px solid #dbe5f8;
  border-radius: 16px;
  padding: 16px 16px 15px;
}
.ask-title { font-size: 14px; font-weight: 800; color: var(--navy-700); letter-spacing: -.02em; }
.ask-text { margin-top: 4px; font-size: 12.5px; color: #4a5b78; line-height: 1.55; }
.ask-actions { display: flex; gap: 8px; margin-top: 12px; }
.ask-btn {
  flex: 1;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--navy);
  color: #fff;
  font-size: 13.5px;
  font-weight: 700;
  text-decoration: none;
}
.ask-btn.ghost { background: #fff; color: var(--navy); border: 1px solid #c9d6f0; }

/* 푸터 */
.footer {
  margin-top: 20px;
  padding: 22px 16px calc(26px + env(safe-area-inset-bottom));
  background: #0f1a33;
  color: rgba(255, 255, 255, .66);
  font-size: 11.5px;
  line-height: 1.75;
  text-align: center;
}
.footer-brand { color: #fff; font-size: 13px; font-weight: 800; letter-spacing: -.01em; }
.footer a { color: rgba(255, 255, 255, .9); text-decoration: none; }
.footer-src { margin-top: 8px; font-size: 10.5px; color: rgba(255, 255, 255, .42); line-height: 1.6; }

/* 맨 위로 */
.to-top { position: fixed; right: 14px; bottom: 18px; z-index: 40; }
.to-top button {
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .95);
  color: var(--navy);
  font-size: 17px;
  font-weight: 800;
  box-shadow: 0 8px 22px -10px rgba(15, 23, 42, .5);
  cursor: pointer;
}

/* 설치 안내 시트 */
.sheet { position: fixed; inset: 0; z-index: 100; }
.sheet[hidden] { display: none; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .45); }
.sheet-panel {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  max-width: 520px;
  margin: 0 auto;
  background: #fff;
  border-radius: 20px 20px 0 0;
  padding: 10px 20px calc(18px + env(safe-area-inset-bottom));
  max-height: 82vh;
  overflow-y: auto;
  animation: sheetUp .22s ease-out;
}
@keyframes sheetUp { from { transform: translateY(14px); opacity: .7; } to { transform: none; opacity: 1; } }

.sheet-grip {
  width: 38px; height: 4px;
  border-radius: 999px;
  background: #e2e8f0;
  margin: 0 auto 14px;
}
.sheet-panel h2 { margin: 0 0 10px; font-size: 16.5px; font-weight: 800; letter-spacing: -.03em; }
.sheet-body { font-size: 13.5px; color: var(--ink-2); line-height: 1.65; }
.sheet-body ol { margin: 6px 0 0; padding-left: 20px; }
.sheet-body li { margin: 5px 0; }
.sheet-body .note {
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 12.5px;
  color: var(--muted);
}
.sheet-body .os-title {
  margin-top: 14px;
  font-size: 12px;
  font-weight: 800;
  color: var(--navy);
}
.sheet-close {
  width: 100%;
  height: 46px;
  margin-top: 16px;
  border: 0;
  border-radius: 12px;
  background: var(--navy);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.noscript {
  margin: 20px;
  padding: 16px;
  border-radius: 12px;
  background: #fef2f2;
  color: #991b1b;
  font-size: 14px;
}

/* 탭/칩 클릭 시 포커스 링은 키보드에만 */
.tab:focus-visible,
.chip:focus-visible,
.month-btn:focus-visible,
.btn-ghost:focus-visible,
.btn-refresh:focus-visible {
  outline: 2px solid var(--navy);
  outline-offset: 2px;
}

/* ---------- 데스크톱 ---------- */
@media (min-width: 640px) {
  body { font-size: 16.5px; }
  .hero { padding: 22px 24px 70px; }
  .brand-text h1 { font-size: 23px; }
  .brand-mark { width: 46px; height: 46px; }
  .wrap { padding: 0 24px; }
  .tabs { padding: 9px 24px; }
  .tab { height: 42px; font-size: 15px; }
  .stat-big strong { font-size: 44px; }
  .stat-row { gap: 12px; }
  .stat-v { font-size: 19px; }
  .months { flex-wrap: wrap; overflow: visible; }
  .card { padding: 14px 18px 15px; }
  .apt { font-size: 16px; }
  .price { font-size: 19px; }
  .sheet-panel { border-radius: 20px; bottom: 24px; }
  .to-top { right: max(14px, calc(50vw - 400px)); }
}

@media (max-width: 359px) {
  .brand-text h1 { font-size: 18px; }
  .btn-ghost { padding: 0 8px; font-size: 12px; }
  .stat-big strong { font-size: 33px; }
  .card-body { flex-direction: column; gap: 2px; }
  .price { font-size: 16.5px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
