:root {
  --bg: #f7f5f0;
  --surface: #ffffff;
  --surface-2: #f0ede5;
  --line: #e2ddd1;
  --ink: #1b2130;
  --ink-2: #3f4759;
  --muted: #6b7283;
  --brand: #24438a;
  --brand-ink: #1a3370;
  --brand-soft: #e7ecf8;
  --accent: #f2a93b;
  --accent-soft: #fdf1dc;
  --ok: #1f7a4a;
  --ok-soft: #e3f3e9;
  --warn: #b4441f;
  --warn-soft: #fbe9e2;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(20, 30, 50, .04), 0 8px 24px rgba(20, 30, 50, .06);
  --font: "Pretendard Variable", Pretendard, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
}

/* 글자 크기: 보통 18px / 크게 20px / 아주 크게 23px — 나머지는 모두 rem 기준 */
html { font-size: 112.5%; scroll-behavior: smooth; }
html[data-size="l"] { font-size: 125%; }
html[data-size="xl"] { font-size: 143.75%; }

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: 1rem; line-height: 1.7;
  word-break: keep-all; overflow-wrap: anywhere; -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
img, video, iframe { max-width: 100%; display: block; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 8px; }
h1, h2, h3 { line-height: 1.35; margin: 0; }
p { margin: 0; }

.wrap { width: min(1040px, 100% - 32px); margin-inline: auto; }
.muted { color: var(--muted); }
.skip { position: absolute; left: -9999px; top: 8px; background: var(--brand); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 50; }
.skip:focus { left: 16px; }

/* ---------- 상단 ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(247, 245, 240, .94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar-in { display: flex; align-items: center; gap: 16px; min-height: 4rem; padding: 6px 0; }
.brand { display: flex; align-items: center; gap: 10px; flex: none; }
.brand-mark { display: grid; place-items: center; width: 2.3rem; height: 2.3rem; border-radius: 12px; background: var(--brand); color: #fff; font-weight: 800; font-size: .95rem; position: relative; }
.brand-mark::after { content: ""; position: absolute; right: -3px; top: -3px; width: .6rem; height: .6rem; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg); }
.brand-name { font-weight: 800; font-size: 1.15rem; white-space: nowrap; }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a { padding: .4rem .9rem; border-radius: 999px; font-weight: 700; color: var(--ink-2); white-space: nowrap; }
.nav a:hover { background: var(--surface-2); }
.nav a.on { background: var(--brand); color: #fff; }
.sizer { display: flex; align-items: center; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px; flex: none; }
.sizer-label { font-size: .75rem; color: var(--muted); padding: 0 6px 0 8px; }
.sizer button { border: 0; background: none; border-radius: 999px; width: 2rem; height: 2rem; font-weight: 800; line-height: 1; padding: 0; }
.sizer button[data-size="m"] { font-size: .8rem; }
.sizer button[data-size="l"] { font-size: 1rem; }
.sizer button[data-size="xl"] { font-size: 1.2rem; }
.sizer button.on { background: var(--brand); color: #fff; }

main { padding: 2rem 0 4rem; outline: none; }

/* ---------- 버튼 ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; border: 0; border-radius: 14px; padding: .8rem 1.3rem; min-height: 3rem; font-weight: 800; background: var(--brand); color: #fff; transition: transform .15s, box-shadow .15s, background .15s; }
.btn:hover { background: var(--brand-ink); box-shadow: 0 6px 16px rgba(36, 67, 138, .25); }
.btn.ghost { background: var(--surface); color: var(--ink); border: 1.5px solid var(--line); }
.btn.ghost:hover { background: var(--surface-2); box-shadow: none; }
.btn.ok { background: var(--ok); }
.btn.big { font-size: 1.1rem; padding: 1rem 1.6rem; }
.btn.small { min-height: 2.4rem; padding: .4rem .9rem; font-size: .9rem; border-radius: 10px; }

/* ---------- 첫 화면 ---------- */
.hero { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1.5rem; align-items: stretch; }
.hero-main { background: var(--brand); color: #fff; border-radius: 24px; padding: 2.2rem; position: relative; overflow: hidden; }
.hero-main::after { content: ""; position: absolute; right: -60px; bottom: -60px; width: 220px; height: 220px; border-radius: 50%; background: rgba(242, 169, 59, .18); }
.eyebrow { font-size: .8rem; font-weight: 800; letter-spacing: .08em; color: var(--accent); }
.hero h1 { font-size: 2.1rem; margin: .6rem 0 1rem; letter-spacing: -.02em; }
.hero-lead { color: rgba(255, 255, 255, .88); font-size: 1.05rem; max-width: 30em; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 1.6rem; position: relative; z-index: 1; }
.hero-cta .btn { background: #fff; color: var(--brand); }
.hero-cta .btn:hover { background: var(--accent-soft); }
.hero-cta .btn.ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .5); }
.hero-cta .btn.ghost:hover { background: rgba(255, 255, 255, .1); }
.hero-side { background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: 1.6rem; display: flex; flex-direction: column; gap: 1rem; box-shadow: var(--shadow); }
.hero-side h2 { font-size: 1.05rem; }
.facts { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.facts li { display: flex; gap: .7rem; align-items: baseline; }
.facts b { flex: none; width: 5.2rem; color: var(--muted); font-weight: 700; font-size: .9rem; }
.progress { height: .7rem; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--ok); border-radius: 999px; }
.progress-label { display: flex; justify-content: space-between; font-size: .9rem; color: var(--ink-2); margin-bottom: .35rem; }

.section { margin-top: 3rem; }
.section-head { margin-bottom: 1.2rem; }
.section-head h2 { font-size: 1.5rem; }
.section-head p { color: var(--ink-2); margin-top: .3rem; }

.flow { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem; list-style: none; padding: 0; margin: 0; counter-reset: flow; }
.flow li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; counter-increment: flow; }
.flow li::before { content: counter(flow); display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-weight: 800; margin-bottom: .5rem; }
.flow b { display: block; font-size: 1.05rem; }
.flow span { color: var(--ink-2); font-size: .92rem; }

/* 마당 + 강의 목록 */
.yard { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 1.4rem 1.4rem .6rem; box-shadow: var(--shadow); }
.yard + .yard { margin-top: 1rem; }
.yard-head { display: flex; gap: 1rem; align-items: flex-start; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.yard-num { flex: none; display: grid; place-items: center; width: 3rem; height: 3rem; border-radius: 14px; background: var(--brand-soft); color: var(--brand); font-weight: 800; font-size: 1.3rem; }
.yard-title { flex: 1; min-width: 0; }
.yard-title h3 { font-size: 1.25rem; }
.yard-title p { color: var(--ink-2); font-size: .95rem; }
.yard-count { flex: none; font-size: .85rem; font-weight: 700; color: var(--muted); background: var(--surface-2); border-radius: 999px; padding: .2rem .7rem; white-space: nowrap; }
.yard-count.all { background: var(--ok-soft); color: var(--ok); }
.lessons { list-style: none; margin: 0; padding: 0; }
.lessons li + li { border-top: 1px dashed var(--line); }
.lesson-row { display: flex; align-items: center; gap: 1rem; padding: 1rem .4rem; border-radius: 12px; }
.lesson-row:hover { background: var(--bg); }
.lesson-no { flex: none; width: 2.6rem; font-weight: 800; color: var(--brand); }
.lesson-txt { flex: 1; min-width: 0; }
.lesson-txt b { display: block; font-size: 1.08rem; }
.lesson-txt span { display: block; color: var(--muted); font-size: .88rem; }
.lesson-state { flex: none; display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 50%; border: 2px solid var(--line); color: var(--muted); font-weight: 800; }
.lesson-state.done { background: var(--ok); border-color: var(--ok); color: #fff; }

.safety { margin-top: 2rem; display: flex; gap: 1rem; align-items: center; background: var(--warn-soft); border: 1px solid #f1c9b9; color: #6e2a12; border-radius: var(--radius); padding: 1.1rem 1.3rem; }
.safety-icon { flex: none; display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: 50%; background: var(--warn); color: #fff; font-weight: 800; font-size: 1.2rem; }

/* ---------- 강의 화면 ---------- */
.crumb { font-size: .92rem; color: var(--muted); margin-bottom: .8rem; }
.crumb a { color: var(--brand); font-weight: 700; }
.crumb a:hover { text-decoration: underline; }
.lesson-head h1 { font-size: 1.85rem; letter-spacing: -.02em; }
.lesson-meta { display: flex; flex-wrap: wrap; gap: .5rem; margin: .7rem 0 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; font-weight: 700; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: .15rem .75rem; color: var(--ink-2); }
.chip.ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.goal { margin-top: 1.2rem; background: var(--accent-soft); border-radius: var(--radius); padding: 1.1rem 1.3rem; font-size: 1.08rem; }
.goal b { color: #8a5a0e; margin-right: .4rem; }

.video { margin-top: 1.5rem; background: #111827; border-radius: 20px; overflow: hidden; aspect-ratio: 16 / 9; position: relative; }
.video video, .video iframe { width: 100%; height: 100%; border: 0; }
.video.empty { overflow: visible; display: grid; } /* 글자를 키워도 안내 문구가 잘리지 않게 */
.video-empty { display: grid; place-items: center; text-align: center; color: #e5e7eb; padding: 1.5rem; }
.video-empty .play { width: 4.2rem; height: 4.2rem; border-radius: 50%; background: rgba(255, 255, 255, .12); display: grid; place-items: center; margin: 0 auto 1rem; font-size: 1.6rem; }
.video-empty p { color: #aeb4c2; font-size: .95rem; margin-top: .3rem; }
.chapters { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .8rem; }
.chapters button { border: 1.5px solid var(--line); background: var(--surface); border-radius: 999px; padding: .35rem .9rem; font-weight: 700; font-size: .9rem; }
.chapters button:hover { border-color: var(--brand); color: var(--brand); }
.chapters time { color: var(--muted); font-weight: 600; margin-right: .35rem; }

.block { margin-top: 2rem; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 1.5rem; box-shadow: var(--shadow); }
.block-head { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem .8rem; margin-bottom: 1rem; }
.block-head h2 { white-space: nowrap; }
.btn.small { white-space: nowrap; }
.block-head .n { flex: none; display: grid; place-items: center; width: 2.2rem; height: 2.2rem; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 800; }
.block-head h2 { font-size: 1.3rem; }
.block-head .aside { margin-left: auto; }

.steps { list-style: none; margin: 0; padding: 0; counter-reset: st; display: grid; gap: .7rem; }
.steps li { counter-increment: st; display: flex; gap: .9rem; align-items: flex-start; font-size: 1.05rem; }
.steps li::before { content: counter(st); flex: none; display: grid; place-items: center; width: 1.9rem; height: 1.9rem; border-radius: 10px; background: var(--brand-soft); color: var(--brand); font-weight: 800; font-size: .95rem; margin-top: .1rem; }

.examples { display: grid; gap: .8rem; margin-top: 1.3rem; }
.example { background: var(--bg); border: 1px solid var(--line); border-left: 5px solid var(--brand); border-radius: 14px; padding: 1rem 1.1rem; }
.example-label { display: flex; justify-content: space-between; align-items: center; gap: .6rem; font-size: .85rem; font-weight: 800; color: var(--brand); margin-bottom: .4rem; }
.example p { white-space: pre-line; font-size: 1.02rem; }

.apply { background: var(--brand-soft); border-color: transparent; box-shadow: none; }
.apply p { font-size: 1.08rem; }

.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.checks label { display: flex; gap: .8rem; align-items: center; background: var(--bg); border: 1.5px solid var(--line); border-radius: 14px; padding: .8rem 1rem; cursor: pointer; font-size: 1.05rem; }
.checks input { width: 1.5rem; height: 1.5rem; accent-color: var(--ok); flex: none; margin: 0; }
.checks label:has(input:checked) { border-color: var(--ok); background: var(--ok-soft); }
.done-row { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin-top: 1.2rem; }
.done-msg { color: var(--ok); font-weight: 800; }

.tip { display: flex; gap: .8rem; margin-top: 1.5rem; padding: 1rem 1.2rem; border-radius: var(--radius); background: var(--surface-2); color: var(--ink-2); }
.tip b { flex: none; color: var(--ink); }

.pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 2.2rem; }
.pager a { flex: 1; max-width: 48%; background: var(--surface); border: 1.5px solid var(--line); border-radius: 16px; padding: 1rem 1.2rem; }
.pager a:hover { border-color: var(--brand); }
.pager small { display: block; color: var(--muted); font-weight: 700; font-size: .85rem; }
.pager b { display: block; }
.pager .next { text-align: right; margin-left: auto; }
.tools { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; justify-content: center; }

/* ---------- 내 진도 / 도움말 ---------- */
.page-head h1 { font-size: 1.85rem; }
.page-head p { color: var(--ink-2); margin-top: .3rem; }
.record-total { margin-top: 1.5rem; }
.record-grid { display: grid; gap: .8rem; margin-top: 1.5rem; }
.record-yard { display: flex; align-items: center; gap: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 1rem 1.2rem; }
.record-yard .progress { flex: 1; }
.record-yard b { flex: none; width: 11rem; }
.record-yard span { flex: none; width: 3.4rem; text-align: right; font-weight: 800; color: var(--ink-2); }
.cert { margin-top: 1.5rem; text-align: center; background: var(--surface); border: 3px double var(--accent); border-radius: 22px; padding: 2rem 1.5rem; }
.cert h2 { font-size: 1.6rem; color: var(--brand); margin: .4rem 0; }

.faq { display: grid; gap: .7rem; margin-top: 1.5rem; }
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 0 1.2rem; }
.faq summary { cursor: pointer; font-weight: 800; padding: 1rem 0; font-size: 1.05rem; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--brand); font-size: 1.3rem; line-height: 1; }
.faq details[open] summary::after { content: "−"; }
.faq .ans { padding: 0 0 1.1rem; color: var(--ink-2); }
.faq .ans p + p { margin-top: .5rem; }

/* ---------- 바닥 ---------- */
.footer { border-top: 1px solid var(--line); padding: 1.5rem 0 2rem; font-size: .88rem; }
.footer-in { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1.5rem; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: .7rem 1.3rem; border-radius: 999px; font-weight: 700; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 40; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 방문자 카운터 (좌하단 고정, IT 배움터와 같은 모양) ---------- */
.visits { position: fixed; left: 16px; bottom: 16px; z-index: 18; pointer-events: none; display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px; background: rgba(255, 255, 255, .92); backdrop-filter: blur(6px); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: .82rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.visits[hidden] { display: none; }
.visits b { color: var(--brand); font-weight: 800; }
.visits i { font-style: normal; color: var(--muted); }
.visits .v-dot { width: 7px; height: 7px; border-radius: 50%; background: #2fa66b; box-shadow: 0 0 0 3px rgba(47, 166, 107, .18); }
@media (max-width: 860px) {
  .visits { position: static; margin: 0 16px 16px; box-shadow: none; }
}

/* ---------- 좁은 화면 ---------- */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .flow { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .topbar-in { flex-wrap: wrap; gap: 6px 10px; }
  .sizer { margin-left: auto; }
  .nav { order: 3; width: 100%; margin: 0; }
  .nav a { flex: 1; text-align: center; padding: .4rem .3rem; }
  .sizer-label { display: none; }
  main { padding-top: 1.4rem; }
  .hero-main { padding: 1.6rem; }
  .hero h1 { font-size: 1.65rem; }
  .flow { grid-template-columns: 1fr; }
  .yard { padding: 1.1rem 1rem .4rem; }
  .yard-head { flex-wrap: wrap; }
  .yard-count { order: -1; margin-left: auto; }
  .yard-title { flex-basis: calc(100% - 4rem); }
  .lesson-row { gap: .7rem; padding: .9rem .1rem; }
  .lesson-no { width: 2.2rem; }
  .lesson-head h1, .page-head h1 { font-size: 1.5rem; }
  .block { padding: 1.2rem 1rem; }
  .pager { flex-direction: column; }
  .pager a { max-width: none; }
  .record-yard { flex-wrap: wrap; }
  .record-yard b { width: 100%; }
}

/* ---------- 인쇄 (한 장 요약) ---------- */
@media print {
  html { font-size: 11pt; }
  body { background: #fff; }
  .topbar, .footer, .video, .chapters, .pager, .tools, .copy, .done-row, .skip, .toast, .visits { display: none !important; }
  main { padding: 0; }
  .block, .goal, .tip, .example { box-shadow: none; break-inside: avoid; }
  .block { margin-top: 1rem; padding: 1rem; }
  .checks label { padding: .3rem .6rem; }
}
