/* ═══════════════════════════════════════════
   1억 플래너 — Dark Mode Design System
═══════════════════════════════════════════ */

:root {
  --bg0:   #09090f;
  --bg1:   #0f0f1a;
  --bg2:   #151524;
  --bg3:   #1c1c30;
  --bg4:   #22223a;
  --border:       #2c2c4a;
  --border-light: #38385c;

  --text1: #eeeef8;
  --text2: #9898c0;
  --text3: #5a5a88;

  --purple:  #7c6ff7;
  --purple2: #9d94f8;
  --blue:    #4f96ff;
  --green:   #3ecf82;
  --orange:  #ff8c42;
  --red:     #ff4d6d;
  --gold:    #ffc94d;

  --grad-purple: linear-gradient(135deg, #7c6ff7 0%, #4f96ff 100%);
  --grad-green:  linear-gradient(135deg, #3ecf82 0%, #1ca86a 100%);
  --grad-orange: linear-gradient(135deg, #ff8c42 0%, #f43f5e 100%);

  --shadow-md: 0 4px 20px rgba(0,0,0,.45);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;

  --transition: all .2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  /* iOS에서 키보드 등장 시 레이아웃이 밀리는 현상 방지 */
  height: -webkit-fill-available;
}

body {
  font-family: 'Noto Sans KR', -apple-system, sans-serif;
  background: var(--bg0);
  color: var(--text1);
  line-height: 1.6;
  min-height: 100vh;
  min-height: -webkit-fill-available; /* iOS Safari 키보드 레이아웃 보정 */
  -webkit-font-smoothing: antialiased;
  /* 한국어는 단어 단위로, 영문은 필요시 줄바꿈 */
  word-break: break-word;
  overflow-wrap: break-word;
  /* 두 번 탭 확대 방지 (pinch-to-zoom은 허용) */
  touch-action: manipulation;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg1); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 99px; }

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ══════════════════════════════
   Header — 강화된 디자인
══════════════════════════════ */
.header {
  background: linear-gradient(160deg, #0b0b1c 0%, #10102a 60%, #0d0d20 100%);
  border-bottom: none;
  /* 상단 노치/상태바 safe area 반영 */
  padding: max(14px, env(safe-area-inset-top)) 0 14px;
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 4px 32px rgba(0,0,0,.55);
}
/* 보라→파랑 그라디언트 언더라인 */
.header::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(124,111,247,.8) 30%,
    rgba(79,150,255,.8) 70%,
    transparent 100%);
}
.header-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.logo { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }

/* ── 국가 선택 버튼 ── */
.country-selector {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 4px 6px;
  flex-shrink: 0;
}
.country-btn {
  font-size: 1.35rem;
  line-height: 1;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 99px;
  transition: var(--transition);
  opacity: .45;
  filter: grayscale(60%);
  position: relative;
}
.country-btn:hover {
  opacity: .85;
  filter: grayscale(0%);
  background: rgba(255,255,255,.07);
}
.country-btn.active {
  opacity: 1;
  filter: grayscale(0%);
  background: rgba(124,111,247,.2);
  box-shadow: 0 0 0 1px rgba(124,111,247,.45);
}
/* 나라 전환 시 미세한 dot */
.country-btn.active::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  background: var(--purple2);
  border-radius: 50%;
}

/* 모바일: 2줄 헤더
   1줄 — 로고(코인 + 앱이름)
   2줄 — 목표금액 배지 + 국기 버튼 */
@media (max-width: 480px) {
  .header-inner {
    flex-wrap: wrap;
    gap: 6px 8px;
  }

  /* 1줄: 로고가 전체 너비를 차지해 혼자 한 줄에 배치 */
  .logo {
    flex: 1 0 100%;
  }

  /* logo-text 유지 (기존에 숨겼던 거 복원) */
  .logo-text { display: flex; }

  /* 2줄: 목표금액 배지가 남은 공간을 채우고 국기 버튼과 나란히 */
  .logo-badge {
    flex: 1 1 auto;
    font-size: .65rem;
    padding: 4px 10px;
    justify-content: flex-start;
  }

  .country-selector { flex-shrink: 0; }
  .country-btn { font-size: 1.15rem; padding: 3px 5px; }
}
/* 매우 좁은 화면: 배지 숨김 */
@media (max-width: 320px) {
  .logo-badge { display: none; }
}
.logo-coin {
  font-size: 2.2rem;
  animation: coinSpin 5s ease-in-out infinite;
  display: inline-block;
  flex-shrink: 0;
  filter: drop-shadow(0 0 12px rgba(255,201,77,.5));
}
@keyframes coinSpin {
  0%,100%  { transform: rotateY(0deg)   scale(1); }
  45%,55%  { transform: rotateY(180deg) scale(1.08); }
}
.logo-text { display: flex; flex-direction: column; gap: 2px; }
.logo h1 {
  font-size: 1.45rem;
  font-weight: 900;
  background: linear-gradient(120deg, #c4b5fd 0%, #818cf8 45%, #60a5fa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -.025em;
  line-height: 1.1;
  white-space: nowrap;
}
.logo p {
  font-size: .72rem;
  color: rgba(157,148,248,.55);
  letter-spacing: .03em;
}
/* 목표 금액 뱃지 */
.logo-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3px 10px;
  background: rgba(124,111,247,.15);
  border: 1px solid rgba(124,111,247,.35);
  border-radius: 99px;
  font-size: .68rem;
  font-weight: 700;
  color: var(--purple2);
  white-space: nowrap;
  /* flex: 1로 로고와 국기 버튼 사이 공간을 채움 → 겹침 방지 */
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  letter-spacing: .02em;
}

/* ══════════════════════════════
   Input Section
══════════════════════════════ */
.input-section { padding: 32px 0 56px; }

.section-heading { text-align: center; margin-bottom: 28px; }
.section-heading h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 6px; }
.section-heading p  { color: var(--text2); font-size: .88rem; }

/* ── 그리드: 기본 1열, 768px 이상 3열 ── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-bottom: 14px;
}
@media (min-width: 768px) {
  .form-grid { grid-template-columns: repeat(3, 1fr); }
}

.form-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 18px;
  transition: var(--transition);
}
.form-card:hover { border-color: var(--border-light); }
.form-card-full  { grid-column: 1 / -1; }

.form-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  row-gap: 6px;
}
.fc-icon { font-size: 1.2rem; flex-shrink: 0; }
.form-card-header h3 { font-size: .95rem; font-weight: 600; flex: 1; min-width: 0; }

.form-group label {
  display: block;
  font-size: .78rem;
  color: var(--text2);
  margin-bottom: 8px;
}

/* 숫자 입력 */
.input-wrapper { position: relative; display: flex; align-items: center; }
.input-wrapper input {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  /* 오른쪽에 X버튼(22px) + 간격(8px) + 원(16px) + 여백(10px) = 56px */
  padding: 12px 56px 12px 14px;
  font-size: 1rem;
  color: var(--text1);
  font-family: inherit;
  transition: var(--transition);
  outline: none;
}
.input-wrapper input:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(124,111,247,.15);
}
.input-wrapper input::placeholder { color: var(--text3); }

/* X(지우기) 버튼 — JS로 동적 생성됨 */
.input-clear-btn {
  position: absolute;
  right: 30px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg4);
  border: none;
  color: var(--text3);
  cursor: pointer;
  font-size: .65rem;
  width: 18px;
  height: 18px;
  display: none;          /* 기본 숨김 */
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: var(--transition);
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
}
.input-clear-btn:hover { background: rgba(255,77,109,.2); color: var(--red); }

.input-suffix {
  position: absolute;
  right: 12px;
  font-size: .78rem;
  color: var(--text3);
  pointer-events: none;
}
.input-preview {
  display: block;
  margin-top: 5px;
  font-size: .8rem;
  color: var(--purple2);
  min-height: 16px;
}

/* ── 단위 선택 버튼 ── */
.unit-btns {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.unit-btns-label {
  font-size: .72rem;
  color: var(--text3);
  margin-right: 2px;
  white-space: nowrap;
}
.unit-btn {
  padding: 4px 10px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 99px;
  color: var(--text3);
  font-size: .75rem;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
}
.unit-btn:hover {
  background: rgba(124,111,247,.15);
  border-color: var(--purple);
  color: var(--purple2);
}
/* 단위 선택 중(빈칸 상태에서 누른 경우) */
.unit-btn.active {
  background: rgba(124,111,247,.22);
  border-color: var(--purple);
  color: var(--purple2);
  font-weight: 600;
}
/* 즉시 적용 시 잠깐 flash */
.unit-btn.flash {
  background: var(--purple);
  border-color: var(--purple);
  color: #fff;
}

/* 범위 슬라이더 */
.range-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.range-row input[type="range"] {
  flex: 1;
  min-width: 0;
  -webkit-appearance: none;
  height: 5px;
  background: var(--bg4);
  border-radius: 99px;
  outline: none;
  cursor: pointer;
}
.range-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: var(--grad-purple);
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(124,111,247,.5);
  cursor: pointer;
  transition: transform .15s;
}
.range-row input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.2); }

.range-value-box {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  flex-shrink: 0;
}
.range-value-box input[type="number"] {
  width: 40px;
  background: transparent;
  border: none;
  color: var(--text1);
  font-size: .95rem;
  font-family: inherit;
  font-weight: 600;
  outline: none;
  text-align: right;
  -moz-appearance: textfield;
}
.range-value-box input[type="number"]::-webkit-inner-spin-button,
.range-value-box input[type="number"]::-webkit-outer-spin-button { display: none; }
.range-value-box span { font-size: .78rem; color: var(--text2); }

.period-presets { display: flex; gap: 6px; flex-wrap: wrap; }
.pp-btn {
  padding: 5px 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 99px;
  color: var(--text2);
  font-size: .78rem;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.pp-btn:hover, .pp-btn.active {
  background: var(--purple);
  border-color: var(--purple);
  color: #fff;
}

/* 고정지출 프리셋 */
.expense-presets { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 14px; }
.ep-btn {
  padding: 6px 13px;
  background: var(--bg3);
  border: 1px dashed var(--border-light);
  border-radius: 99px;
  color: var(--text2);
  font-size: .8rem;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.ep-btn:hover { background: rgba(124,111,247,.12); border-color: var(--purple); color: var(--purple2); }
.ep-btn.used { opacity: .4; pointer-events: none; }

.btn-add-expense {
  margin-left: auto;
  padding: 5px 12px;
  background: rgba(124,111,247,.12);
  border: 1px solid var(--purple);
  border-radius: 99px;
  color: var(--purple2);
  font-size: .78rem;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-add-expense:hover { background: rgba(124,111,247,.25); }

/* 지출 항목 목록 */
.expenses-list { display: flex; flex-direction: column; gap: 8px; }
.expenses-empty {
  padding: 18px;
  text-align: center;
  color: var(--text3);
  font-size: .83rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
}

/* ── 지출 항목 행 ── */
.expense-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  animation: fadeInUp .2s ease;
  flex-wrap: wrap;     /* 좁은 화면에서 자연스럽게 줄바꿈 */
  row-gap: 6px;
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ei-name {
  flex: 1;
  min-width: 80px;
  background: transparent;
  border: none;
  color: var(--text1);
  font-family: inherit;
  font-size: .88rem;
  outline: none;
}
.item-sep {
  width: 1px;
  height: 18px;
  background: var(--border);
  flex-shrink: 0;
}

/* 금액 + 단위버튼 묶음 */
.ei-amount-group {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}
.ei-amount {
  width: 88px;
  background: transparent;
  border: none;
  color: var(--text1);
  font-family: inherit;
  font-size: .88rem;
  outline: none;
  text-align: right;
  /* number input 스피너 제거 */
  -moz-appearance: textfield;
}
.ei-amount::-webkit-inner-spin-button,
.ei-amount::-webkit-outer-spin-button { display: none; }

.ei-units { display: flex; gap: 3px; flex-shrink: 0; }
.eu-btn {
  padding: 3px 7px;
  background: var(--bg4);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text3);
  font-size: .7rem;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.eu-btn:hover {
  background: rgba(124,111,247,.15);
  border-color: var(--purple);
  color: var(--purple2);
}
.eu-btn.active {
  background: rgba(124,111,247,.22);
  border-color: var(--purple);
  color: var(--purple2);
  font-weight: 600;
}
.eu-btn.flash {
  background: var(--purple);
  border-color: var(--purple);
  color: #fff;
}

.btn-remove {
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  font-size: .9rem;
  padding: 3px 5px;
  border-radius: 4px;
  transition: var(--transition);
  line-height: 1;
  flex-shrink: 0;
  margin-left: auto;
}
.btn-remove:hover { color: var(--red); background: rgba(255,77,109,.1); }

.expenses-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: .88rem;
  color: var(--text2);
  gap: 12px;
}
.expenses-total-row strong { color: var(--orange); font-size: 1rem; }

/* 계산 버튼 */
.btn-calculate {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 24px;
  padding: 17px;
  background: var(--grad-purple);
  border: none;
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(124,111,247,.4);
  transition: var(--transition);
}
.btn-calculate:hover { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(124,111,247,.55); }
.btn-calculate:active { transform: translateY(0); }
.btn-icon { font-size: 1.2rem; }

/* ══════════════════════════════
   Results Section
══════════════════════════════ */
.results-section { padding: 32px 0 56px; }
.hidden { display: none !important; }

/* ── Progress Overview: 항상 가로 배치 ── */
.progress-overview {
  display: flex;
  align-items: center;
  gap: 18px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 18px;
  margin-bottom: 16px;
}

.ring-wrapper {
  position: relative;
  width: 88px;
  height: 88px;
  flex-shrink: 0;
}
.ring-svg {
  width: 88px;
  height: 88px;
  transform: rotate(-90deg);
}
.ring-bg   { fill: none; stroke: var(--bg4); stroke-width: 9; }
.ring-fill {
  fill: none;
  stroke: #ff4d6d;   /* 기본값: JS에서 동적으로 덮어씀 */
  stroke-width: 9;
  stroke-linecap: round;
  stroke-dasharray: 314.16;
  stroke-dashoffset: 314.16;
  transition: stroke-dashoffset 1.2s cubic-bezier(.4,0,.2,1),
              stroke .6s ease;
  filter: drop-shadow(0 0 4px currentColor);
}
.ring-label {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  text-align: center;
  white-space: nowrap;
}
.ring-pct {
  display: block;
  font-size: 1.05rem;
  font-weight: 900;
  /* 색상은 JS에서 동적으로 설정 */
  color: #ff4d6d;
  line-height: 1.1;
  transition: color .6s ease;
}
.ring-sub { font-size: .58rem; color: var(--text3); }

/* 통계 그리드: 2열 기본 */
.overview-stats {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
@media (min-width: 768px) {
  .ring-wrapper { width: 114px; height: 114px; }
  .ring-svg     { width: 114px; height: 114px; }
  .ring-pct     { font-size: 1.3rem; }
  .ring-sub     { font-size: .63rem; }
  .progress-overview { gap: 26px; padding: 24px 22px; }
  .overview-stats { grid-template-columns: repeat(3, 1fr); gap: 10px; }
}

.ov-stat {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  min-width: 0;
  overflow: hidden;
}
.ov-label {
  display: block;
  font-size: .67rem;
  color: var(--text3);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ov-value {
  display: block;
  font-size: clamp(.8rem, 2.8vw, .96rem);
  font-weight: 800;
  color: #e8e8f8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ov-value.gold    { color: #ffd166; text-shadow: 0 0 10px rgba(255,209,102,.3); }
.ov-value.warn    { color: #ffaa55; text-shadow: 0 0 10px rgba(255,140,66,.25); }
.ov-value.primary { color: #b8adff; text-shadow: 0 0 10px rgba(157,148,248,.3); }

/* ── Spending Card ── */
.spending-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 18px;
  margin-bottom: 16px;
}
.spending-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  font-size: 1.1rem;
}
.spending-card-header h3 { font-size: .95rem; font-weight: 600; }

.spend-limit-big {
  font-size: clamp(1.4rem, 6vw, 2rem);
  font-weight: 900;
  margin-bottom: 8px;
  line-height: 1.2;
}
.spend-limit-big.ok   { color: #3ecf82; text-shadow: 0 0 24px rgba(62,207,130,.35); }
.spend-limit-big.warn { color: #ffd166; text-shadow: 0 0 24px rgba(255,209,102,.3); }
.spend-limit-big.bad  { color: #ff4d6d; text-shadow: 0 0 24px rgba(255,77,109,.3); }

.spend-desc {
  font-size: .85rem;
  color: var(--text2);
  margin-bottom: 16px;
  line-height: 1.7;
}

/* 지출 비율 바 */
.spend-bars { display: flex; flex-direction: column; gap: 10px; }
.spend-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .82rem;
  color: var(--text2);
}
.spend-bar-label { width: 50px; flex-shrink: 0; font-size: .76rem; }
.bar-track {
  flex: 1;
  min-width: 0;
  height: 8px;
  background: var(--bg4);
  border-radius: 99px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: 99px;
  width: 0%;
  transition: width 1s cubic-bezier(.4,0,.2,1) .3s;
}
.bar-save  { background: var(--grad-purple); }
.bar-fixed { background: var(--grad-orange); }
.bar-free  { background: var(--grad-green); }
.spend-bar-amt {
  flex-shrink: 0;
  font-weight: 600;
  color: var(--text1);
  font-size: .78rem;
  width: 72px;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── 전략 카드: 기본 1열, 768px+ 3열 ── */
.strategies { margin-bottom: 28px; }
.strategies-heading { font-size: 1.2rem; font-weight: 700; margin-bottom: 14px; }

.strategy-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
@media (min-width: 768px) {
  .strategy-grid { grid-template-columns: repeat(3, 1fr); }
}

.strat-card {
  border-radius: var(--radius-lg);
  padding: 20px 18px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.strat-card:hover { transform: translateY(-3px); }

/* ── 확실한 방법: 최우선 — 초록 강조 ── */
.strat-certain {
  background: linear-gradient(160deg, rgba(62,207,130,.1) 0%, #151524 45%);
  border: 1px solid rgba(62,207,130,.3);
  border-top: 3px solid #3ecf82;
  box-shadow: 0 0 0 0 rgba(62,207,130,0);
}
.strat-certain:hover {
  border-color: rgba(62,207,130,.55);
  box-shadow: 0 6px 28px rgba(62,207,130,.12);
}
/* 우선순위 라벨 */
.strat-certain::before {
  content: 'BEST';
  position: absolute;
  top: 14px; right: 14px;
  font-size: .62rem;
  font-weight: 900;
  letter-spacing: .08em;
  color: #3ecf82;
  background: rgba(62,207,130,.12);
  border: 1px solid rgba(62,207,130,.3);
  padding: 2px 7px;
  border-radius: 99px;
}

/* ── 도전해볼 방법: 중간 — 파랑 ── */
.strat-challenge {
  background: linear-gradient(160deg, rgba(79,150,255,.07) 0%, #151524 45%);
  border: 1px solid rgba(79,150,255,.22);
  border-top: 3px solid #4f96ff;
}
.strat-challenge:hover {
  border-color: rgba(79,150,255,.45);
  box-shadow: 0 6px 28px rgba(79,150,255,.1);
}
.strat-challenge::before {
  content: 'TRY';
  position: absolute;
  top: 14px; right: 14px;
  font-size: .62rem;
  font-weight: 900;
  letter-spacing: .08em;
  color: #4f96ff;
  background: rgba(79,150,255,.1);
  border: 1px solid rgba(79,150,255,.28);
  padding: 2px 7px;
  border-radius: 99px;
}

/* ── 기대해봐야 할 방법: 낮음 — 보라/경고 ── */
.strat-hope {
  background: #151524;
  border: 1px solid rgba(168,85,247,.15);
  border-top: 2px dashed rgba(168,85,247,.4);
  opacity: .88;
}
.strat-hope:hover {
  opacity: 1;
  border-color: rgba(168,85,247,.3);
  box-shadow: 0 6px 28px rgba(168,85,247,.08);
}
.strat-hope::before {
  content: 'RISK';
  position: absolute;
  top: 14px; right: 14px;
  font-size: .62rem;
  font-weight: 900;
  letter-spacing: .08em;
  color: #c084fc;
  background: rgba(168,85,247,.1);
  border: 1px solid rgba(168,85,247,.25);
  padding: 2px 7px;
  border-radius: 99px;
}

.strat-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
}
.strat-badge {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  background: var(--bg3);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.strat-certain  .strat-badge { background: rgba(62,207,130,.12);  border: 1px solid rgba(62,207,130,.2); }
.strat-challenge .strat-badge { background: rgba(79,150,255,.1);  border: 1px solid rgba(79,150,255,.2); }
.strat-hope     .strat-badge { background: rgba(168,85,247,.08); border: 1px solid rgba(168,85,247,.18); }
.strat-head h3 { font-size: .92rem; font-weight: 700; margin-bottom: 2px; }
.strat-head p  { font-size: .72rem; color: var(--text3); }

/* ── 전략 리스트: flex로 세로글자 버그 수정 ── */
.strat-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.strat-list li {
  /* grid 대신 flex 사용:
     grid를 쓰면 li의 직접 자식(strong, text노드, span)들이
     각각 grid item이 되어 14px 열에 끼면서 세로로 배치됨 */
  display: flex;
  gap: 7px;
  align-items: flex-start;
  font-size: .85rem;
  color: var(--text2);
  line-height: 1.6;
}
.strat-list li::before {
  content: '→';
  color: var(--text3);
  font-size: .72rem;
  flex-shrink: 0;
  margin-top: 4px;
  width: 12px;
  text-align: center;
}
/* JS에서 li 내용을 이 span으로 래핑해 하나의 flex item으로 처리 */
.li-content {
  flex: 1;
  min-width: 0;
}
.li-content strong { color: #ffffff; font-weight: 700; }
.tag-accent {
  display: inline-block;
  font-size: .72rem;
  padding: 1px 6px;
  border-radius: 99px;
  font-weight: 600;
  white-space: nowrap;
}
.strat-certain   .tag-accent { background: rgba(62,207,130,.15);  color: var(--green); }
.strat-challenge .tag-accent { background: rgba(79,150,255,.15);  color: var(--blue);  }
.strat-hope      .tag-accent { background: rgba(168,85,247,.15);  color: #c084fc;      }

/* ── 월별 스케줄 ── */
.schedule-wrap { margin-bottom: 28px; }
.schedule-heading { font-size: 1.2rem; font-weight: 700; margin-bottom: 14px; }

.table-scroll {
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  overflow: hidden;
}
.sched-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .86rem;
  table-layout: fixed;
}
.sched-table col.c-month { width: 30%; }
.sched-table col.c-save  { width: 18%; }
.sched-table col.c-cum   { width: 22%; }
.sched-table col.c-pct   { width: 12%; }
.sched-table col.c-bar   { width: 18%; }

.sched-table thead th {
  background: var(--bg3);
  padding: 11px 10px;
  text-align: left;
  font-size: .72rem;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sched-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.sched-table tbody tr:last-child { border-bottom: none; }
.sched-table tbody tr:hover { background: var(--bg3); }
.sched-table td {
  padding: 10px 10px;
  color: var(--text2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sched-table td:first-child  { color: var(--text1); font-weight: 500; }
.sched-table td:nth-child(3) { color: var(--text1); }
.sched-table td:nth-child(4) { font-weight: 600; }

/* 모바일: 저축액(2열)·진도바(5열) 숨김 → 3열만 표시 */
@media (max-width: 767px) {
  .sched-table col.c-save,
  .sched-table col.c-bar  { display: none; }
  .sched-table th:nth-child(2),
  .sched-table td:nth-child(2),
  .sched-table th:nth-child(5),
  .sched-table td:nth-child(5) { display: none; }
  .sched-table col.c-month { width: 38%; }
  .sched-table col.c-cum   { width: 36%; }
  .sched-table col.c-pct   { width: 26%; }
}

/* 마일스톤 행 */
.sched-table tr.milestone-25  td { background: rgba(255,201,77,.04); }
.sched-table tr.milestone-50  td { background: rgba(79,150,255,.04); }
.sched-table tr.milestone-75  td { background: rgba(62,207,130,.04); }
.sched-table tr.milestone-100 td { background: rgba(124,111,247,.06); }

.milestone-badge {
  display: inline-block;
  font-size: .67rem;
  padding: 1px 5px;
  border-radius: 99px;
  font-weight: 700;
  margin-left: 4px;
  vertical-align: middle;
}
.milestone-25  .milestone-badge { background: rgba(255,201,77,.2);   color: var(--gold);    }
.milestone-50  .milestone-badge { background: rgba(79,150,255,.2);   color: var(--blue);    }
.milestone-75  .milestone-badge { background: rgba(62,207,130,.2);   color: var(--green);   }
.milestone-100 .milestone-badge { background: rgba(124,111,247,.25); color: var(--purple2); }

.prog-cell { display: flex; align-items: center; gap: 6px; }
.prog-mini {
  flex: 1;
  height: 5px;
  background: var(--bg4);
  border-radius: 99px;
  overflow: hidden;
  min-width: 20px;
}
.prog-mini-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--grad-purple);
}
.prog-mini-fill.full { background: var(--grad-green); }
.prog-pct { font-size: .75rem; color: var(--text2); white-space: nowrap; }

.btn-show-all {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text2);
  font-size: .85rem;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
}
.btn-show-all:hover { color: var(--purple2); border-color: var(--purple); }

/* 다시 계산 */
.btn-recalc {
  display: block;
  margin: 0 auto;
  padding: 13px 32px;
  background: transparent;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  color: var(--text2);
  font-size: .92rem;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
}
.btn-recalc:hover {
  border-color: var(--purple);
  color: var(--purple2);
  background: rgba(124,111,247,.08);
}

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  /* 하단 홈바(safe area) 영역 침범 방지 */
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  text-align: center;
  font-size: .75rem;
  color: var(--text3);
}
