/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', sans-serif;
  background: linear-gradient(135deg, #F0F4FF 0%, #E0E7FF 100%);
  color: #1E293B;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { text-decoration: none; color: inherit; }

/* ── Header ── */
.header {
  background: #2563EB;
  color: #fff;
  padding: 14px 20px;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 8px rgba(37,99,235,.3);
}
.header-inner { max-width: 480px; margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.logo { font-size: 1.2rem; font-weight: 700; }
.header-sub { font-size: .78rem; opacity: .8; }

/* ── Main ── */
.main { flex: 1; max-width: 480px; margin: 0 auto; width: 100%; padding: 20px 16px 40px; }

/* ── Footer ── */
.footer { text-align: center; padding: 20px; font-size: .75rem; color: #94A3B8; }

/* ── Hero ── */
.hero { text-align: center; padding: 28px 0 20px; }
.hero-title { font-size: 1.6rem; font-weight: 800; color: #1E40AF; margin-bottom: 8px; }
.hero-desc { color: #64748B; font-size: .92rem; line-height: 1.6; }

/* ── Alert ── */
.alert { border-radius: 10px; padding: 12px 16px; margin-bottom: 16px; font-size: .88rem; }
.alert-error { background: #FEF2F2; color: #DC2626; border: 1px solid #FECACA; }

/* ── Card ── */
.card { 
  background: rgba(255, 255, 255, 0.7); 
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 20px; 
  padding: 24px; 
  box-shadow: 0 8px 32px rgba(37, 99, 235, 0.08); 
  margin-bottom: 20px; 
}
.search-card { }

/* ── Location ── */
.location-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.location-status { display: flex; align-items: center; gap: 8px; font-size: .88rem; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot-gray   { background: #CBD5E1; }
.dot-green  { background: #22C55E; animation: pulse 1.5s infinite; }
.dot-yellow { background: #F59E0B; animation: pulse 1.5s infinite; }
.dot-red    { background: #EF4444; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.5} }

/* ── Form ── */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-weight: 600; font-size: .88rem; color: #475569; margin-bottom: 10px; }

.service-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.service-chip { height: 100%; display: block; }
.service-chip input { display: none; }
.service-chip span {
  display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center;
  height: 100%;
  padding: 10px 4px; border-radius: 10px;
  border: 2px solid #E2E8F0; font-size: .82rem; cursor: pointer;
  background: #F8FAFC; transition: all .15s;
}
.service-chip input:checked + span {
  border-color: #2563EB; background: #EFF6FF; color: #2563EB; font-weight: 700;
}

.mode-row { display: flex; flex-direction: column; gap: 8px; }
.mode-chip input { display: none; }
.mode-chip span {
  display: block; padding: 12px 16px; border-radius: 10px;
  border: 2px solid #E2E8F0; font-size: .88rem; cursor: pointer;
  background: #F8FAFC; transition: all .15s;
}
.mode-chip input:checked + span {
  border-color: #2563EB; background: #EFF6FF; color: #2563EB; font-weight: 700;
}

/* ── Buttons ── */
.btn-primary {
  display: block; width: 100%;
  background: #2563EB; color: #fff;
  border: none; border-radius: 14px;
  padding: 16px; font-size: 1.05rem; font-weight: 700;
  cursor: pointer; transition: all .2s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-primary:disabled { background: #94A3B8; cursor: not-allowed; }
.btn-primary:not(:disabled):hover { 
  background: #1D4ED8; 
  transform: translateY(-2px); 
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.3);
}
.btn-primary:not(:disabled):active { transform: scale(0.98); }

.btn-outline {
  background: #fff; border: 1.5px solid #CBD5E1;
  border-radius: 8px; padding: 8px 14px;
  font-size: .82rem; cursor: pointer; color: #475569;
}
.btn-outline:hover { border-color: #2563EB; color: #2563EB; }

.btn-back {
  display: inline-block; color: #2563EB;
  font-size: .88rem; margin-bottom: 12px; font-weight: 600;
}

/* ── Info Cards ── */
.info-cards { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.info-card {
  display: flex; align-items: flex-start; gap: 14px;
  background: rgba(255, 255, 255, 0.85); 
  backdrop-filter: blur(8px);
  border-radius: 16px; padding: 18px;
  box-shadow: 0 4px 16px rgba(0,0,0,.04);
  border: 1px solid rgba(255, 255, 255, 0.6);
  transition: transform 0.2s;
}
.info-card:hover { transform: translateY(-2px); }
.info-icon { font-size: 1.5rem; }
.info-text { display: flex; flex-direction: column; }
.info-text strong { font-size: .9rem; color: #1E293B; }
.info-text span { font-size: .8rem; color: #64748B; margin-top: 2px; }

/* ── Result ── */
.result-header { margin-bottom: 20px; }
.result-meta { display: flex; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.tag {
  background: #EFF6FF; color: #2563EB;
  border-radius: 20px; padding: 4px 12px; font-size: .8rem; font-weight: 600;
}
.tag-mode { background: #F0FDF4; color: #16A34A; }
.result-title { font-size: 1.4rem; font-weight: 800; }
.result-sub { font-size: .8rem; color: #94A3B8; margin-top: 4px; }

/* ── Result Card ── */
.result-card {
  background: rgba(255, 255, 255, 0.95); 
  border-radius: 20px; padding: 24px;
  box-shadow: 0 6px 24px rgba(37, 99, 235, 0.08);
  margin-bottom: 16px; border: 2px solid transparent;
  transition: transform 0.2s, box-shadow 0.2s;
}
.result-card:hover { transform: translateY(-3px); box-shadow: 0 12px 32px rgba(37, 99, 235, 0.12); }
.result-card--top { border-color: #2563EB; background: rgba(255, 255, 255, 1); }

.result-rank { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.rank-badge { font-size: .85rem; font-weight: 700; color: #2563EB; }
.rank-score { font-size: 1.1rem; font-weight: 800; color: #1E40AF; }

.result-name { font-size: 1.1rem; font-weight: 700; margin-bottom: 4px; }
.result-address { font-size: .82rem; color: #64748B; margin-bottom: 2px; }
.result-phone { font-size: .82rem; color: #64748B; margin-bottom: 14px; }

/* ── Metrics ── */
.metrics { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin-bottom: 12px; }
.metric { text-align: center; background: #F8FAFC; border-radius: 10px; padding: 10px 4px; }
.metric-value { font-size: 1.15rem; font-weight: 800; }
.metric-value.green  { color: #16A34A; }
.metric-value.yellow { color: #D97706; }
.metric-value.red    { color: #DC2626; }
.metric-label { font-size: .72rem; color: #94A3B8; margin-top: 2px; }

.waiting-label { font-size: .88rem; font-weight: 600; margin-bottom: 14px; color: #475569; }

/* ── Score Bars ── */
.score-bars { margin-bottom: 16px; display: flex; flex-direction: column; gap: 8px; }
.score-row { display: flex; align-items: center; gap: 8px; }
.score-label { font-size: .75rem; color: #64748B; width: 90px; flex-shrink: 0; white-space: nowrap; }
.score-bar-wrap { flex: 1; background: #F1F5F9; border-radius: 4px; height: 8px; overflow: hidden; }
.score-bar        { height: 100%; background: #22C55E; border-radius: 4px; transition: width .4s; }
.score-bar--blue  { background: #2563EB; }
.score-bar--purple{ background: #7C3AED; }
.score-num { font-size: .75rem; color: #94A3B8; width: 32px; text-align: right; flex-shrink: 0; }

/* ── Map Button ── */
.btn-map {
  display: block; text-align: center;
  background: #FEF9C3; color: #92400E;
  border-radius: 10px; padding: 12px;
  font-size: .88rem; font-weight: 600;
  transition: background .15s;
}
.btn-map:hover { background: #FDE68A; }

/* ── Refresh ── */
.refresh-row { display: flex; align-items: center; gap: 12px; padding: 16px 0; }
.refresh-hint { font-size: .78rem; color: #94A3B8; }

/* ── Empty ── */
.empty-state { text-align: center; padding: 40px 20px; }
.empty-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state p { color: #64748B; margin-bottom: 8px; font-size: .9rem; }
.empty-state .btn-primary { margin-top: 20px; max-width: 200px; display: inline-block; }

.alert-tomorrow {
  background: #FFFBEB;
  color: #92400E;
  border: 1px solid #FDE68A;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: .88rem;
}

/* ── 저시력자 큰 글씨 모드 (더욱 확대) ── */
body.large-font {
  font-size: 20px;
}
body.large-font .hero-title         { font-size: 2.4rem; }
body.large-font .hero-desc          { font-size: 1.250rem; line-height: 1.8; }
body.large-font .form-label         { font-size: 1.2rem; }
body.large-font .service-chip span    { font-size: 1.15rem; padding: 16px 8px; }
body.large-font .mode-chip span     { font-size: 1.2rem; padding: 16px 20px; }
body.large-font .btn-primary        { font-size: 1.4rem; padding: 22px; border-radius: 18px; }
body.large-font .result-name        { font-size: 1.5rem; }
body.large-font .result-address,
body.large-font .result-phone       { font-size: 1.1rem; }
body.large-font .metric-value       { font-size: 1.7rem; }
body.large-font .metric-label       { font-size: 1.0rem; }
body.large-font .score-label        { font-size: 1.1rem; width: 130px; }
body.large-font .score-num          { font-size: 1.1rem; width: 48px; }
body.large-font .rank-badge         { font-size: 1.2rem; }
body.large-font .tag                { font-size: 1.1rem; padding: 6px 16px; }
body.large-font .waiting-label      { font-size: 1.2rem; }
body.large-font .btn-map            { font-size: 1.2rem; padding: 16px; }
body.large-font .score-bar-wrap     { height: 16px; }
body.large-font label[for="debugModeToggle"],
body.large-font .header-sub         { font-size: 1.1rem; }
body.large-font .logo               { font-size: 1.6rem; }

/* ── 부드러운 전환 효과 ── */
body { transition: background-color 0.3s ease, color 0.3s ease; }
.card, .btn-primary, .service-chip span, .mode-chip span, .tag, .result-card {
  transition: all 0.2s ease;
}

/* ── AI 채팅창 큰 글씨 대응 ── */
body.large-font #aiChatBox      { font-size: 1.1rem; max-height: 400px; }
body.large-font #aiInput        { font-size: 1.1rem; padding: 14px; }
body.large-font #aiBtn          { font-size: 1.1rem; }

/* ── 헤더 버튼 호버 강화 ── */
#largeFontBtn:hover {
  background: rgba(255,255,255,0.25) !important;
  transform: translateY(-1px);
}
#largeFontBtn:active {
  transform: translateY(1px);
}
