/* ============================================================
   첫발 — 공통 디자인 토큰 (Gowun Batang 제목 + IBM Plex Sans KR 본문)
   라이트/다크 3상태: 시스템 따름(기본) / html[data-theme=light|dark] 강제
   모바일 우선 (375px 기준)
   ============================================================ */
:root {
  --bg: #faf7f2;
  --card: #ffffff;
  --ink: #2b2620;
  --sub: #6b6257;
  --line: #e7e0d6;
  --accent: #1a7a5e;
  --accent-soft: #e3f2ec;
  --warn: #b4442c;
  --warn-soft: #fbeae4;
  --gold: #a8771c;
  --gold-soft: #f8efdc;
  --shadow: 0 2px 10px rgba(60, 50, 30, 0.07);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17150f;
    --card: #211e17;
    --ink: #ece5d8;
    --sub: #a89e8e;
    --line: #373226;
    --accent: #4cc39a;
    --accent-soft: #1d3229;
    --warn: #e2846b;
    --warn-soft: #392019;
    --gold: #d9ab55;
    --gold-soft: #33290f;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  }
}
:root[data-theme="dark"] {
  --bg: #17150f;
  --card: #211e17;
  --ink: #ece5d8;
  --sub: #a89e8e;
  --line: #373226;
  --accent: #4cc39a;
  --accent-soft: #1d3229;
  --warn: #e2846b;
  --warn-soft: #392019;
  --gold: #d9ab55;
  --gold-soft: #33290f;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "IBM Plex Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 17px;
  line-height: 1.7;
}
h1, h2, h3, .serif {
  font-family: "Gowun Batang", "IBM Plex Sans KR", serif;
  line-height: 1.4;
}
a { color: var(--accent); }
button { font-family: inherit; cursor: pointer; }

.wrap { max-width: 640px; margin: 0 auto; padding: 0 16px 80px; }

/* 상단 바 */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0 10px;
}
.topbar .brand { font-size: 20px; font-weight: 700; text-decoration: none; color: var(--ink); }
.topbar .brand b { color: var(--accent); }
.topbar .nav { display: flex; gap: 8px; align-items: center; }
.topbar .nav a {
  text-decoration: none; font-size: 14px; color: var(--sub);
  padding: 8px 10px; border-radius: 10px; min-height: 40px;
  display: inline-flex; align-items: center;
}
.topbar .nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.theme-btn {
  border: 1px solid var(--line); background: var(--card); border-radius: 10px;
  width: 40px; height: 40px; font-size: 16px; color: var(--ink);
}

/* 카드·칩·버튼 */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; padding: 18px 16px; box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1.5px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 999px; padding: 10px 14px; font-size: 15px; min-height: 44px;
}
.chip.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 12px 18px; border-radius: 12px;
  border: none; font-size: 16px; font-weight: 700; text-decoration: none;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-ghost { background: var(--card); color: var(--accent); border: 1.5px solid var(--accent); }
.btn-warn { background: var(--warn); color: #fff; }

/* 배지 */
.badge {
  display: inline-block; font-size: 12.5px; font-weight: 700;
  border-radius: 8px; padding: 3px 8px; vertical-align: middle;
}
.badge-limited { background: var(--warn-soft); color: var(--warn); }
.badge-always { background: var(--accent-soft); color: var(--accent); }
.badge-mine { background: var(--gold-soft); color: var(--gold); }
.badge-demo { background: var(--gold-soft); color: var(--gold); }

/* 정책 카드 */
.policy .amount { font-size: 19px; font-weight: 800; color: var(--accent); margin: 6px 0 2px; }
.policy .title { font-size: 17px; font-weight: 700; }
.policy .meta { font-size: 13.5px; color: var(--sub); }
.policy details summary {
  cursor: pointer; color: var(--accent); font-size: 15px; margin-top: 8px;
  min-height: 44px; display: flex; align-items: center;
}
.policy .cond { font-size: 15.5px; color: var(--ink); background: var(--bg); border-radius: 10px; padding: 12px; margin: 8px 0; }

/* 입력 */
input[type="text"], input[type="tel"], select {
  width: 100%; min-height: 48px; font-size: 17px; font-family: inherit;
  border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 14px;
  background: var(--card); color: var(--ink);
}
input[type="range"] { width: 100%; accent-color: var(--accent); height: 40px; }
label.check { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; color: var(--sub); }
label.check input { width: 22px; height: 22px; margin-top: 3px; accent-color: var(--accent); }

/* 섹션 제목 */
.sec-title { font-size: 20px; margin: 26px 0 12px; }
.sec-sub { font-size: 14.5px; color: var(--sub); margin: -8px 0 12px; }

/* 문제 레이더 */
.problem .sev { letter-spacing: 2px; font-size: 13px; }
.problem .golden {
  background: var(--gold-soft); color: var(--gold); border-radius: 10px;
  padding: 12px; font-size: 15px; font-weight: 700; margin: 10px 0;
}
.problem ol { padding-left: 22px; }
.problem ol li { margin-bottom: 10px; font-size: 15.5px; }
.problem .step-meta { font-size: 13px; color: var(--sub); }
.problem ul { padding-left: 20px; font-size: 15px; }
.problem ul li { margin-bottom: 6px; }

/* 탭 */
.tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.tabs button {
  flex: 1; min-height: 44px; border-radius: 10px; border: 1.5px solid var(--line);
  background: var(--card); color: var(--sub); font-size: 15px;
}
.tabs button.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 700; }

/* 알림 박스 */
.notify-box { border: 2px solid var(--accent); }
.msg-ok { color: var(--accent); font-size: 15px; font-weight: 700; }
.msg-err { color: var(--warn); font-size: 15px; font-weight: 700; }

/* 면책 */
.disclaimer {
  font-size: 13.5px; color: var(--sub); background: var(--card);
  border: 1px dashed var(--line); border-radius: 12px; padding: 12px 14px;
  margin-top: 24px;
}

/* 상황 체크인 (할 일 지도) */
.jphase { border-left: 3px solid var(--line); margin: 14px 0 0 6px; padding: 0 0 4px 14px; }
.jwhen {
  font-family: "Gowun Batang", serif; font-weight: 700; font-size: 15.5px;
  color: var(--accent); margin-bottom: 6px; position: relative;
}
.jwhen::before {
  content: ""; position: absolute; left: -21px; top: 7px;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--card);
}
.jitem {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 8px 0; font-size: 15px; cursor: pointer;
}
.jitem input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--accent); flex-shrink: 0; }
.jitem .jdetail { display: block; font-size: 13.5px; color: var(--sub); font-weight: 400; }
.jitem a { font-size: 13.5px; font-weight: 700; white-space: nowrap; }
.jitem.done b { text-decoration: line-through; color: var(--sub); }

.fade-up { animation: fadeUp 0.4s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

@media (min-width: 640px) {
  body { font-size: 17.5px; }
  .wrap { padding-bottom: 100px; }
}
