/* 스텝 — 디자인 시스템. 학습 작업대: 크림 종이 + 세이지 그린 + 단계 계단 구조 */
:root {
  --bg: #f7f5f0;
  --paper: #ffffff;
  --paper-2: #fbfaf6;
  --line: #e3ded2;
  --line-2: #cfc8b8;
  --ink: #23241f;
  --ink-dim: #6d6d63;
  --sage: #4f7a5c;        /* 포인트: 완료·진행 */
  --sage-soft: #e6efe7;
  --amber: #c9873a;       /* 남은 단계·강조 */
  --amber-soft: #f8eedf;
  --known: #9aa0a6;       /* 이미 아는 것 */
  --radius: 10px;
  --tab-h: 58px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", "Malgun Gothic", sans-serif;
  max-width: 620px; margin: 0 auto; min-height: 100vh; line-height: 1.55;
  padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom));
}
a { color: inherit; text-decoration: none; }
button { font: inherit; border: 0; cursor: pointer; background: none; color: inherit; }
input, textarea, select {
  font: inherit; color: var(--ink); background: var(--paper); border: 1px solid var(--line-2);
  border-radius: 7px; padding: 11px 13px; width: 100%;
}
textarea { resize: vertical; min-height: 110px; line-height: 1.6; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--sage); border-color: transparent; }
.num { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

/* 헤더 */
.top { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px;
       position: sticky; top: 0; z-index: 30; background: linear-gradient(var(--bg) 84%, transparent); }
.logo { font-size: 20px; font-weight: 900; letter-spacing: -0.6px; }
.logo em { font-style: normal; color: var(--sage); }
.top-actions { display: flex; gap: 8px; align-items: center; }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 7px;
            background: var(--paper); border: 1px solid var(--line); }
.icon-btn svg { width: 18px; height: 18px; stroke: var(--ink-dim); fill: none; stroke-width: 1.8; }
.quota-pill { display: inline-flex; align-items: center; gap: 5px; background: var(--paper);
              border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px;
              font-size: 12.5px; font-weight: 800; }

/* 탭바 */
.tabbar { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 620px;
          height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
          background: rgba(255,255,255,0.97); border-top: 1px solid var(--line-2); display: flex; z-index: 40; }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
       font-size: 10.5px; color: var(--ink-dim); font-weight: 700; }
.tab svg { width: 21px; height: 21px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.tab.active { color: var(--sage); }

/* 섹션 · 카드 */
.section-title { font-size: 15px; font-weight: 800; padding: 16px 16px 10px;
                 display: flex; justify-content: space-between; align-items: baseline; }
.section-title small { font-weight: 600; color: var(--ink-dim); font-size: 12px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
        margin: 0 16px 10px; padding: 15px; display: block; }
.card h3 { font-size: 15.5px; font-weight: 800; }
.card p { font-size: 13.5px; color: var(--ink-dim); margin-top: 5px; line-height: 1.6; }
.seg { display: flex; gap: 7px; padding: 4px 16px 12px; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg .s { flex-shrink: 0; padding: 7px 13px; border-radius: 999px; font-size: 13px; font-weight: 700;
          background: var(--paper); color: var(--ink-dim); border: 1px solid var(--line-2); }
.seg .s.on { background: var(--sage); color: #fff; border-color: var(--sage); }

/* 목표 카드 */
.goal-card { position: relative; }
.goal-card .meta { display: flex; gap: 10px; margin-top: 10px; font-size: 12.5px;
                   color: var(--ink-dim); font-weight: 700; }
.goal-card .go { margin-top: 12px; display: inline-block; background: var(--sage); color: #fff;
                 font-weight: 800; font-size: 13.5px; padding: 9px 16px; border-radius: 7px; }

/* ===== 학습 순서 세로 단계표 (핵심 UI) ===== */
.plan-head { margin: 0 16px 12px; padding: 16px; background: var(--paper); border: 1px solid var(--line);
             border-radius: var(--radius); }
.plan-head h2 { font-size: 19px; font-weight: 900; }
.plan-head .sum { font-size: 13.5px; color: var(--ink-dim); margin-top: 6px; }
.plan-progress { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.plan-progress .bar { flex: 1; height: 8px; background: #eae6dc; border-radius: 4px; overflow: hidden; }
.plan-progress .bar span { display: block; height: 100%; background: var(--sage); transition: width 0.4s; }
.plan-progress .pct { font-size: 13px; font-weight: 900; }

.steps { padding: 0 16px 8px; position: relative; }
.step { position: relative; padding: 0 0 12px 40px; }
/* 단계 연결선 */
.step::before { content: ""; position: absolute; left: 15px; top: 26px; bottom: -2px; width: 2px;
                background: var(--line-2); }
.step:last-child::before { display: none; }
.step .dot { position: absolute; left: 4px; top: 8px; width: 24px; height: 24px; border-radius: 50%;
             background: var(--paper); border: 2px solid var(--line-2); display: grid; place-items: center;
             font-size: 11px; font-weight: 900; color: var(--ink-dim); z-index: 2; }
.step.done .dot { background: var(--sage); border-color: var(--sage); color: #fff; }
.step.done::before { background: var(--sage); }
.step.next .dot { border-color: var(--amber); color: var(--amber); box-shadow: 0 0 0 4px var(--amber-soft); }
.step .box { background: var(--paper); border: 1px solid var(--line); border-radius: 9px; padding: 13px 15px; }
.step.next .box { border-color: var(--amber); }
.step .name { font-size: 15px; font-weight: 800; }
.step .one { font-size: 13px; color: var(--ink-dim); margin-top: 4px; line-height: 1.55; }
.step .row { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.step.done .name { color: var(--ink-dim); }

/* 태그 */
.tag { font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 5px;
       background: var(--paper-2); color: var(--ink-dim); border: 1px solid var(--line); }
.tag.lv { background: transparent; }
.tag.done { background: var(--sage-soft); color: var(--sage); border-color: transparent; }
.tag.next { background: var(--amber-soft); color: var(--amber); border-color: transparent; }
.tag.known { background: #eceef0; color: var(--known); border-color: transparent; }
.tag.dep { background: var(--paper-2); }

/* 아는 개념 체크 리스트 */
.know-item { display: flex; align-items: flex-start; gap: 11px; padding: 12px 16px;
             border-bottom: 1px solid var(--line); }
.know-item .cb { width: 22px; height: 22px; flex-shrink: 0; border-radius: 6px; border: 2px solid var(--line-2);
                 background: var(--paper); display: grid; place-items: center; margin-top: 1px; }
.know-item .cb svg { width: 14px; height: 14px; stroke: #fff; stroke-width: 3; fill: none; opacity: 0; }
.know-item.on .cb { background: var(--sage); border-color: var(--sage); }
.know-item.on .cb svg { opacity: 1; }
.know-item .t { flex: 1; min-width: 0; }
.know-item .t .n { font-size: 14.5px; font-weight: 800; }
.know-item .t .o { font-size: 12.5px; color: var(--ink-dim); margin-top: 3px; line-height: 1.5; }
.know-item.on .t .n { color: var(--known); }

/* 수업 (3파트) */
.lesson { margin: 0 16px 12px; }
.lesson-part { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
               padding: 16px; margin-bottom: 10px; }
.lesson-part .h { display: flex; align-items: center; gap: 7px; font-size: 11.5px; font-weight: 900;
                  letter-spacing: 1.5px; color: var(--sage); margin-bottom: 9px; }
.lesson-part .h .n { width: 20px; height: 20px; border-radius: 50%; background: var(--sage-soft);
                     display: grid; place-items: center; font-size: 11px; letter-spacing: 0; }
.lesson-part .c { font-size: 14.5px; line-height: 1.75; white-space: pre-wrap; word-break: break-word; }
.lesson-part.practice { border-left: 3px solid var(--amber); }
.level-pick { display: flex; gap: 8px; padding: 4px 16px 12px; }
.level-pick button { flex: 1; padding: 12px 8px; border-radius: 8px; font-weight: 800; font-size: 13.5px;
                     background: var(--paper); border: 2px solid var(--line-2); color: var(--ink-dim); }
.level-pick button.on { border-color: var(--sage); color: var(--sage); background: var(--sage-soft); }
.gen-note { font-size: 11.5px; color: var(--ink-dim); padding: 0 16px 10px; line-height: 1.5; }
.gen-note b { color: var(--amber); }

/* 선수 관계 */
.dep-item { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.dep-item .n { font-size: 14px; font-weight: 800; }
.dep-item .why { font-size: 12.5px; color: var(--ink-dim); margin-top: 5px; line-height: 1.55; }
.dep-item .why::before { content: "왜 "; font-weight: 800; color: var(--sage); }

/* 검수 배지 */
.review-note { margin: 10px 16px; padding: 11px 14px; border-radius: 8px; background: var(--sage-soft);
               font-size: 12.5px; color: #35543e; line-height: 1.55; }
.review-note b { font-weight: 900; }

/* 공유 카드 */
.share-stage { padding: 22px 16px; }
.share-card { background: var(--paper); border: 2px solid var(--ink); border-radius: 14px; padding: 26px 22px; }
.share-card .sc-label { font-size: 11px; font-weight: 900; letter-spacing: 3px; color: var(--ink-dim); }
.share-card .sc-goal { font-size: 22px; font-weight: 900; margin: 8px 0 4px; line-height: 1.35; }
.share-card .sc-count { font-size: 40px; font-weight: 900; color: var(--sage); line-height: 1.1; }
.share-card .sc-count small { font-size: 16px; color: var(--ink-dim); }
.share-card .sc-list { margin-top: 14px; font-size: 13px; line-height: 1.9; color: var(--ink-dim); }
.share-card .sc-list b { color: var(--ink); font-weight: 800; }
.share-card .sc-foot { font-size: 11px; color: var(--ink-dim); letter-spacing: 1.5px; margin-top: 16px; text-align: center; }

/* 버튼 · 폼 · 상태 */
.btn { display: block; width: calc(100% - 32px); margin: 0 16px 10px; padding: 14px; border-radius: 8px;
       text-align: center; font-weight: 900; font-size: 15px; background: var(--sage); color: #fff; }
.btn.ghost { background: var(--paper); color: var(--ink); border: 1px solid var(--line-2); }
.btn.amber { background: var(--amber); color: #fff; }
.btn:disabled { opacity: 0.45; }
.form-block { padding: 6px 16px; display: flex; flex-direction: column; gap: 12px; }
.field label { display: block; font-size: 12.5px; font-weight: 700; color: var(--ink-dim); margin-bottom: 6px; }
.field .hint { font-size: 11.5px; color: var(--ink-dim); margin-top: 5px; line-height: 1.5; }
.empty { text-align: center; color: var(--ink-dim); padding: 44px 20px; font-size: 14px; line-height: 1.6; }
.empty .big { font-size: 28px; font-weight: 900; margin-bottom: 8px; color: var(--ink); }
.skeleton { background: linear-gradient(90deg, #efece4 25%, #f6f4ee 50%, #efece4 75%);
            background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; height: 14px; margin: 8px 0; }
@keyframes sk { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
#toast { position: fixed; bottom: calc(var(--tab-h) + 16px); left: 50%; transform: translateX(-50%);
         background: var(--ink); color: #fff; font-size: 13.5px; font-weight: 800; padding: 11px 18px;
         border-radius: 999px; z-index: 60; opacity: 0; transition: opacity 0.25s; pointer-events: none;
         max-width: 88%; text-align: center; }
#toast.show { opacity: 1; }

/* 히어로 */
.hero { margin: 0 16px 14px; border-radius: var(--radius); overflow: hidden; background-color: #e8e3d7;
        background-image: url("../assets/hero.jpg"); background-size: cover; background-position: center;
        padding: 34px 20px 22px; min-height: 152px; display: flex; flex-direction: column;
        justify-content: flex-end; border: 1px solid var(--line); }
.hero h1 { font-size: 28px; font-weight: 900; letter-spacing: -1px; color: #23241f; }
.hero h1 em { font-style: normal; color: var(--sage); }
.hero p { font-size: 13px; margin-top: 5px; color: #45463d; font-weight: 600; }

@media (min-width: 621px) { body { border-left: 1px solid var(--line); border-right: 1px solid var(--line); } }
