/* =====================================================
   새는 돈 찾기 - Global Styles
   모바일 퍼스트, 카드 UI, 토스 결제창과 잘 어울리는 톤
   ===================================================== */

:root {
  --color-primary: #3182F6;
  --color-primary-dark: #1B64DA;
  --color-primary-soft: #E8F2FE;
  --color-success: #00B956;
  --color-warning: #F59E0B;
  --color-danger: #EF4444;

  --color-bg: #F4F6F9;
  --color-surface: #FFFFFF;
  --color-surface-alt: #F9FAFB;

  --color-text: #191F28;
  --color-text-sub: #4E5968;
  --color-text-mute: #8B95A1;
  --color-border: #E5E8EB;

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius-xl: 24px;

  --shadow-card: 0 1px 2px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.04);
  --shadow-fab: 0 10px 24px rgba(49,130,246,0.28);

  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
    "Pretendard", "Noto Sans KR", "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

/* =====================================================
   App Shell - 모바일 가운데 정렬
   ===================================================== */
#app {
  min-height: 100vh;
  max-width: 480px;
  margin: 0 auto;
  background: var(--color-bg);
  position: relative;
  padding-top: var(--safe-top);
  padding-bottom: calc(96px + var(--safe-bottom));
}

@media (min-width: 481px) {
  #app {
    box-shadow: 0 0 40px rgba(0,0,0,0.06);
    min-height: 100vh;
    background: var(--color-bg);
  }
}

/* =====================================================
   Boot Splash
   ===================================================== */
.boot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 70vh;
  gap: 12px;
  color: var(--color-text-sub);
}
.boot__logo { font-size: 48px; }
.boot__title { font-weight: 800; font-size: 22px; color: var(--color-text); }
.boot__desc { font-size: 14px; color: var(--color-text-mute); }

/* =====================================================
   Common Layout
   ===================================================== */
.screen {
  padding: 24px 20px 40px;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--safe-top));
}

.section {
  padding: 0 20px;
}

.spacer-sm { height: 12px; }
.spacer-md { height: 20px; }
.spacer-lg { height: 32px; }

/* =====================================================
   Top Bar
   ===================================================== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--color-surface);
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--color-border);
}
.topbar__title {
  font-weight: 700;
  font-size: 16px;
  color: var(--color-text);
}
.topbar__back {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  font-size: 18px;
  color: var(--color-text);
}
.topbar__back:active { background: var(--color-surface-alt); }
.topbar__right { width: 36px; }

/* =====================================================
   Landing
   ===================================================== */
.hero {
  padding: 48px 24px 32px;
  background: linear-gradient(180deg, #EAF2FF 0%, #F4F6F9 100%);
  border-radius: 0 0 28px 28px;
}
.hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--color-surface);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-primary);
  box-shadow: var(--shadow-card);
  margin-bottom: 16px;
}
.hero__title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.3;
  color: var(--color-text);
  margin: 0 0 12px;
}
.hero__title em {
  font-style: normal;
  background: linear-gradient(120deg, var(--color-primary) 0%, #6FB1FF 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero__sub {
  font-size: 15px;
  color: var(--color-text-sub);
  line-height: 1.6;
  margin: 0;
}
.hero__illust {
  margin: 24px auto 8px;
  width: 100%;
  max-width: 280px;
  aspect-ratio: 16 / 10;
  background:
    radial-gradient(circle at 30% 40%, #FFFFFF 0%, transparent 60%),
    linear-gradient(135deg, #DCE9FF 0%, #B7D2FF 100%);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 72px;
  box-shadow: 0 8px 24px rgba(49,130,246,0.18);
}

.highlights {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 20px 20px 0;
}
.highlight {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 14px 10px;
  text-align: center;
  box-shadow: var(--shadow-card);
}
.highlight__icon { font-size: 22px; }
.highlight__label {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-sub);
  line-height: 1.3;
}

/* =====================================================
   Card
   ===================================================== */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
}
.card + .card { margin-top: 12px; }
.card__title {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--color-text);
}
.card__desc {
  font-size: 14px;
  color: var(--color-text-sub);
  margin: 0;
  line-height: 1.6;
}

/* =====================================================
   Buttons
   ===================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  height: 56px;
  border-radius: var(--radius-md);
  font-size: 17px;
  font-weight: 700;
  transition: transform 0.04s ease;
}
.btn:active { transform: scale(0.985); }

.btn--primary {
  background: var(--color-primary);
  color: #fff;
  box-shadow: 0 6px 16px rgba(49,130,246,0.24);
}
.btn--primary:disabled {
  background: var(--color-border);
  color: var(--color-text-mute);
  box-shadow: none;
}
.btn--secondary {
  background: var(--color-primary-soft);
  color: var(--color-primary);
}
.btn--ghost {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}
.btn--share {
  margin-top: 10px;
  /* v1 출시: 공유 기능은 코드 유지, UI만 숨김. v2에서 아래 한 줄만 제거하면 즉시 노출됨. */
  display: none !important;
}
.btn:disabled {
  opacity: 0.6;
  pointer-events: none;
}

.btn-row {
  display: flex;
  gap: 10px;
}
.btn-row .btn { flex: 1; }

/* CTA fixed bottom */
.cta-fixed {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  max-width: 480px;
  margin: 0 auto;
  padding: 12px 20px calc(12px + var(--safe-bottom));
  background: linear-gradient(180deg, rgba(244,246,249,0) 0%, var(--color-bg) 30%);
  z-index: 20;
}

/* =====================================================
   Survey
   ===================================================== */
.progress {
  height: 6px;
  background: var(--color-border);
  border-radius: 999px;
  overflow: hidden;
}
.progress__bar {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary) 0%, #6FB1FF 100%);
  border-radius: 999px;
  transition: width 0.3s ease;
}
.progress-meta {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--color-text-mute);
  font-weight: 600;
}

.question {
  margin-top: 24px;
}
.question__title {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.35;
  color: var(--color-text);
  letter-spacing: -0.01em;
  margin: 0 0 8px;
}
.question__sub {
  font-size: 14px;
  color: var(--color-text-mute);
  margin: 0 0 24px;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.option {
  width: 100%;
  text-align: left;
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 18px 18px;
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.12s ease;
}
.option:active {
  transform: scale(0.99);
  background: var(--color-surface-alt);
}
.option.is-selected {
  border-color: var(--color-primary);
  background: var(--color-primary-soft);
  color: var(--color-primary-dark);
}
.option__check {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: transparent;
  transition: all 0.12s ease;
}
.option.is-selected .option__check {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

/* =====================================================
   Result
   ===================================================== */
.result-hero {
  margin: 20px 20px 0;
  padding: 28px 24px;
  background: linear-gradient(135deg, #3182F6 0%, #1B64DA 100%);
  color: #fff;
  border-radius: var(--radius-xl);
  text-align: center;
  box-shadow: 0 12px 32px rgba(49,130,246,0.28);
}
.result-hero__label {
  font-size: 13px;
  font-weight: 600;
  opacity: 0.9;
}
.result-hero__amount {
  font-size: 40px;
  font-weight: 900;
  letter-spacing: -0.02em;
  margin: 8px 0 6px;
  line-height: 1.1;
}
.result-hero__amount small {
  font-size: 18px;
  font-weight: 700;
  margin-left: 2px;
  opacity: 0.9;
}
.result-hero__headline {
  font-size: 15px;
  font-weight: 600;
  opacity: 0.95;
  margin: 0;
}
.result-hero__note {
  margin-top: 10px;
  font-size: 11px;
  opacity: 0.75;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.grade-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: rgba(255,255,255,0.18);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 14px;
}

.section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text-sub);
  margin: 28px 20px 12px;
}

.top3-list {
  margin: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.top3-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-card);
}
.top3-item__rank {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  flex-shrink: 0;
}
.top3-item__main { flex: 1; min-width: 0; }
.top3-item__label {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text);
}
.top3-item__status {
  font-size: 13px;
  color: var(--color-text-mute);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.top3-item__amount {
  font-size: 15px;
  font-weight: 800;
  color: var(--color-primary);
  flex-shrink: 0;
}

.action-list, .benefit-list {
  margin: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.action-item, .benefit-item {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  box-shadow: var(--shadow-card);
  font-size: 14px;
  color: var(--color-text);
  line-height: 1.5;
}
.action-item__icon, .benefit-item__icon {
  flex-shrink: 0;
  width: 24px; height: 24px;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  margin-top: 1px;
}
.benefit-item__icon { background: #FFF4E0; color: #D97706; }

/* =====================================================
   Benefit Cards (팩트 기반 절감·지원 제도 카드)
   ===================================================== */
.benefit-cards {
  margin: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.benefit-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 18px 18px 16px;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--color-border);
}
.benefit-card__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.benefit-card__icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.benefit-card__title {
  font-size: 16px;
  font-weight: 800;
  color: var(--color-text);
  letter-spacing: -0.01em;
}
.benefit-card__desc {
  font-size: 14px;
  color: var(--color-text-sub);
  margin: 0 0 12px;
  line-height: 1.55;
}
.benefit-card__row {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px dashed var(--color-border);
}
.benefit-card__label {
  width: 72px;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-mute);
  letter-spacing: 0.02em;
  padding-top: 1px;
}
.benefit-card__value {
  flex: 1;
  font-size: 13.5px;
  color: var(--color-text);
  line-height: 1.55;
}
.benefit-card__source {
  display: inline-block;
  margin-top: 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--color-primary);
  text-decoration: none;
}
.benefit-card__source:active { opacity: 0.7; }

.benefit-note {
  margin: 14px 20px 0;
  padding: 12px 14px;
  background: var(--color-surface-alt);
  border-radius: 12px;
  font-size: 12px;
  color: var(--color-text-mute);
  line-height: 1.55;
}

.footnote {
  margin: 20px 20px 0;
  font-size: 11px;
  color: var(--color-text-mute);
  line-height: 1.6;
  text-align: center;
}

.result-actions {
  margin: 24px 20px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* =====================================================
   Detail
   ===================================================== */
.detail-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
  margin: 0 20px 12px;
}
.detail-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.detail-card__title {
  font-size: 17px;
  font-weight: 800;
  color: var(--color-text);
}
.detail-card__amount {
  font-size: 15px;
  font-weight: 800;
  color: var(--color-primary);
  padding: 4px 10px;
  background: var(--color-primary-soft);
  border-radius: 999px;
}
.detail-card__amount.is-zero {
  color: var(--color-text-mute);
  background: var(--color-surface-alt);
}
.detail-card__row {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--color-border);
}
.detail-card__label {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-mute);
  letter-spacing: 0.02em;
  margin-bottom: 4px;
}
.detail-card__value {
  font-size: 14px;
  color: var(--color-text);
  line-height: 1.55;
}

/* =====================================================
   Saved list
   ===================================================== */
.saved-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--color-text-mute);
}
.saved-empty__icon { font-size: 48px; margin-bottom: 12px; }

.saved-item {
  margin: 0 20px 10px;
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-card);
}
.saved-item__main { flex: 1; min-width: 0; }
.saved-item__date {
  font-size: 12px;
  color: var(--color-text-mute);
  margin-bottom: 2px;
}
.saved-item__amount {
  font-size: 18px;
  font-weight: 800;
  color: var(--color-text);
}
.saved-item__grade {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-primary);
  padding: 4px 10px;
  background: var(--color-primary-soft);
  border-radius: 999px;
}

/* =====================================================
   Ad / Affiliate Slot (광고/제휴 슬롯)
   현재는 더미. 추후 실 광고/제휴 컴포넌트 교체.
   ===================================================== */
.adslot {
  margin: 24px 20px 0;
  padding: 16px;
  background: var(--color-surface);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--color-text-sub);
}
.adslot__icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.adslot__title {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text);
}
.adslot__desc {
  font-size: 12px;
  color: var(--color-text-mute);
  margin-top: 2px;
}
.adslot__cta {
  margin-left: auto;
  font-size: 12px;
  font-weight: 700;
  color: var(--color-primary);
  flex-shrink: 0;
}

/* =====================================================
   Toast
   ===================================================== */
.toast {
  position: fixed;
  bottom: calc(100px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: rgba(25, 31, 40, 0.92);
  color: #fff;
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  z-index: 100;
  animation: toast-in 0.2s ease;
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* =====================================================
   Utility
   ===================================================== */
.text-center { text-align: center; }
.text-mute { color: var(--color-text-mute); }
.fw-bold { font-weight: 700; }
.fw-extra { font-weight: 800; }
.fade-in { animation: fadeIn 0.25s ease; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
