/* 따뜻한 무채색 + 학교 파랑 하나, A 집중형. 색은 상태와 '지금'에만, 구분은 여백과 얇은 선, 그림자 없음.
   체계: 글자 4단계(--t1~t4), 간격 4단계(--s1~s4), 격자 하나(.wrap → 단계 목록 | 왼쪽 열 | 오른쪽 열). */
:root {
  --bg: #f7f6f3;
  --surface: #ffffff;
  --surface-2: #f1f0ec;
  --hover: #efeeea;
  --text: #333132; /* 학교 먹색 */
  --strong: #111111;
  --muted: #6b6a66;
  --line: #e6e4df;
  --line-strong: #d6d4ce;
  --field: #8e8c86;
  /* 학교 파랑 (국립경국대학교 UI 심벌의 진한 파랑): 지금 할 일, 주 버튼, 현재 위치 */
  --brand: #0066b3;
  --brand-hover: #00528f;
  --brand-soft: #e8f1f9;
  --sky: #00b6f1; /* 학교 하늘 파랑: 심벌, 상단 띠, 로고 옆 구분선에만(대비가 낮아 글자·상태에는 쓰지 않음) */
  --foot: #172033; /* 짙은 바닥 남색(학교 누리집 첫 화면의 남색 계열에서 고름) */
  --foot-text: #b8c2d1;
  --ok: #346538;
  --ok-soft: #edf3ec;
  --ex: #956400;
  --ex-soft: #fbf3db;
  --warn: #9f2f2d;
  --warn-soft: #fdebec;

  /* 글자 4단계: 제목 / 할 일 제목·이끄는 글 / 본문·버튼 / 소제목·도움말·꼬리표 */
  --t1: 2rem;
  --t2: 1.1875rem;
  --t3: 1.0625rem;
  --t4: 0.9375rem;
  /* 간격 4단계 */
  --s1: 8px;
  --s2: 16px;
  --s3: 24px;
  --s4: 40px;
  /* 격자 */
  --page-max: calc(var(--nav-w) + var(--col-gap) + var(--task-max) + var(--page-pad) * 2); /* 머리·본문·바닥이 같은 끝선 */
  --read-max: 860px;
  --action-w: 240px; /* 프롬프트 복사·AI 열기 열 */
  --task-max: calc(var(--read-max) + var(--s3) + var(--action-w)); /* 단계 화면 오른쪽 끝선 */
  --page-pad: 40px;
  --nav-w: 208px;
  --side-w: 320px;
  --col-gap: 40px;
  --topbar-h: 64px;

  --radius: 12px;
  --radius-sm: 6px;
  --font: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--topbar-h) + 72px); } /* 상단 + 붙는 할 일 탭 */
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--t3);
  line-height: 1.65;
  word-break: keep-all;
  overflow-wrap: break-word;
  caret-color: var(--strong);
  -webkit-font-smoothing: antialiased;
}
body.menu-open { overflow: hidden; }
::selection { background: var(--brand-soft); color: var(--strong); }
a { color: var(--strong); text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
[tabindex="-1"]:focus { outline: none; }
h1, h2, h3 { margin: 0; color: var(--strong); text-wrap: balance; }
p { margin: 0; }
code { font-family: var(--mono); font-size: 0.875em; padding: 1px 4px; border-radius: 4px; background: var(--surface-2); }
:is(.hint, .guide, .prose table, .pitfalls, .prompt-text) code { font-size: 1em; }
code.ko { font-family: var(--font); font-size: 0.95em; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: var(--s2); top: -60px; z-index: 60;
  padding: var(--s1) var(--s2); border-radius: var(--radius-sm); background: var(--strong); color: #fff; font-weight: 600; text-decoration: none;
}
.skip:focus { top: var(--s1); }
.skip:hover, .skip:focus { color: #fff; }

/* 격자 하나: 머리·알림·본문·바닥 모두 같은 왼쪽 선과 오른쪽 선 */
/* 단계 목록을 접으면 전체 폭은 그대로 두고 본문 끝선을 목록이 줄어든 만큼 넓힌다 (가운데로 모이지 않게) */
@media (min-width: 901px) {
  body.nav-collapsed { --read-max: calc(860px + var(--nav-w) - 44px); --task-max: calc(var(--read-max) + var(--s3) + var(--action-w)); }
}
.wrap { width: 100%; max-width: var(--page-max); margin-inline: auto; padding-inline: var(--page-pad); }

/* 아이콘 */
.i {
  flex: none; width: 1.15em; height: 1.15em; vertical-align: -0.2em;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

/* 모양 1: 버튼 (네모, 모서리 6px) */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s1);
  min-height: 44px; padding: 0 var(--s2);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--strong);
  font: inherit; font-size: var(--t4); font-weight: 600; line-height: 1.3; text-decoration: none; cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, transform 0.15s var(--ease);
}
.btn:hover { background: var(--hover); }
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: transparent; color: var(--strong); }
.btn-sm { padding: 0 12px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1); }

/* 모양 2: 상태 꼬리표 (알약). 색은 상태에만 */
.tag, mark.ref {
  display: inline-flex; align-items: center; gap: 4px; flex: none;
  padding: 2px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted);
  font-size: var(--t4); font-weight: 600; line-height: 1.45; letter-spacing: 0; white-space: nowrap;
}
.tag[data-state="own"], mark.ref.ok { background: var(--ok-soft); color: var(--ok); }
.tag[data-state="example"], .tag[data-state="mixed"], mark.ref.ex { background: var(--ex-soft); color: var(--ex); }
.tag[data-state="prompt"], mark.ref.warn { background: var(--warn-soft); color: var(--warn); }
.tag[data-state="next"] { background: var(--brand); color: #fff; }
.tag[data-state="empty"], mark.ref.empty { background: transparent; box-shadow: inset 0 0 0 1px var(--line-strong); }

/* 상단 */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
/* 학교 띠: 심벌의 두 파랑. 상단 높이 안에 겹쳐 그려 붙는 위치가 바뀌지 않는다 */
.topbar::before { content: ""; position: absolute; pointer-events: none; inset: 0 0 auto; height: 4px; background: var(--brand); border-left: 30vw solid var(--sky); }
.topbar-inner { display: flex; align-items: center; gap: var(--s2); height: var(--topbar-h); padding-top: 4px; } /* 띠 아래 보이는 높이의 가운데 */
.nw { white-space: nowrap; }
.brand { display: flex; align-items: center; gap: var(--s2); min-width: 0; margin-right: auto; color: var(--strong); text-decoration: none; }
.brand-logo { flex: none; display: block; width: auto; height: 30px; }
.brand-symbol { display: none; }
.brand-title {
  min-width: 0; padding-left: var(--s2); border-left: 2px solid var(--sky); /* 학교 하늘 파랑 장식(글자 아님) */
  font-size: var(--t3); font-weight: 700; line-height: 1.3; letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.top-actions { display: flex; gap: 4px; flex: none; margin-right: calc(-1 * var(--s1)); }
.top-actions .btn { border-color: transparent; background: transparent; padding: 0 var(--s1); color: var(--text); }
.top-actions .btn:hover { background: var(--hover); color: var(--strong); }
.top-actions .count {
  padding: 0 var(--s1); border-radius: 999px; background: var(--surface-2); color: var(--strong);
  font-variant-numeric: tabular-nums;
}
.menu-btn { display: none; }
.save-notice { border-bottom: 1px solid var(--line); background: var(--surface-2); color: var(--muted); font-size: var(--t4); }
.save-notice[hidden] { display: none; }
.save-notice-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 var(--s2); min-height: 44px; }
.save-notice .btn { margin-left: auto; margin-right: calc(-1 * var(--s2)); }
.save-notice.warn { background: var(--warn-soft); color: var(--warn); font-weight: 600; }

/* 본문 격자: 단계 목록 | 내용 */
.layout {
  display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr); column-gap: var(--col-gap);
  padding-top: var(--s4); padding-bottom: var(--s4);
  min-height: calc(100vh - var(--topbar-h)); /* 짧은 쪽에서도 남색 바닥이 화면 아래 끝에 닿게 */
}
.step-nav {
  position: sticky; top: calc(var(--topbar-h) + var(--s4)); align-self: start;
  display: flex; flex-direction: column; gap: 4px;
}
/* 글자 선은 열의 왼쪽 선에 맞추고, 마우스 올림 바탕만 밖으로 8px 나간다 */
.nav-item {
  display: flex; align-items: center; gap: 12px;
  min-height: 44px; margin-inline: calc(-1 * var(--s1)); padding: 4px var(--s1); border-radius: var(--radius-sm);
  color: var(--text); text-decoration: none; line-height: 1.35;
}
.nav-item:hover { background: var(--hover); }
.nav-item.active { background: var(--brand-soft); color: var(--strong); font-weight: 600; }
.nav-no {
  flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  color: var(--muted); font-size: var(--t4); font-weight: 600; font-variant-numeric: tabular-nums;
  box-shadow: inset 0 0 0 1px var(--line-strong);
}
.nav-no .i { width: 15px; height: 15px; }
.nav-item.started .nav-no { box-shadow: inset 0 0 0 1.5px var(--strong); color: var(--strong); }
.nav-item.done .nav-no { background: var(--ok); color: #fff; box-shadow: none; }
.nav-item.active .nav-no { background: var(--brand); color: #fff; box-shadow: none; outline: 2px solid var(--brand); outline-offset: 2px; } /* 지금 단계는 바깥 고리: 끝난 단계(초록 채움)와 색이 아니라 모양으로도 다르다 */
.nav-results { position: relative; margin-top: var(--s2); }
.nav-results::after {
  content: ''; position: absolute; left: var(--s1); right: var(--s1); top: calc(-1 * var(--s1) - 1px); height: 1px; background: var(--line);
}
.nav-results .nav-no { box-shadow: none; color: var(--strong); }
.nav-count { color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums; }
.nav-group { margin: var(--s2) 0 0; padding-bottom: 4px; color: var(--muted); font-size: var(--t4); font-weight: 600; }
.nav-list { display: flex; flex-direction: column; gap: 4px; }
.nav-toggle {
  display: grid; place-items: center; width: 44px; height: 44px; margin: calc(-1 * var(--s1)) 0 0 -9px;
  border: 0; border-radius: var(--radius-sm); background: none; color: var(--muted); cursor: pointer;
}
.nav-toggle:hover { background: var(--hover); color: var(--strong); }
@media (min-width: 901px) {
  .layout { transition: grid-template-columns 0.25s var(--ease); }
  .layout.nav-collapsed { grid-template-columns: 44px minmax(0, 1fr); }
  .nav-collapsed .nav-title, .nav-collapsed .nav-group {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
  }
  /* 번호 띠: 번호가 곧 단추. 지금 단계는 파랑 네모에 흰 번호 */
  .nav-collapsed .nav-toggle { margin-left: 0; }
  .nav-collapsed .nav-list { gap: 4px; margin-top: var(--s2); }
  .nav-collapsed .nav-item { gap: 0; width: 44px; margin-inline: 0; padding: 0; border-radius: 8px; }
  .nav-collapsed .nav-item.active { background: none; }
  .nav-collapsed .nav-no { width: 44px; height: 40px; border-radius: 8px; box-shadow: none; font-size: var(--t3); }
  .nav-collapsed .nav-item.started .nav-no { box-shadow: none; color: var(--strong); font-weight: 700; }
  .nav-collapsed .nav-item.active .nav-no { background: var(--brand); color: #fff; }
  .nav-collapsed .nav-results { margin-top: var(--s3); }
  .nav-collapsed .nav-results::after { left: 6px; right: 6px; }
}
.step-view { min-width: 0; }
.step-view:focus { outline: none; }

/* 내용 격자: 왼쪽 열(머리·할 일·왜) | 오른쪽 열(체크포인트·막히는 곳·이전/다음) */
.page {
  display: grid; grid-template-columns: minmax(0, 1fr) var(--side-w);
  column-gap: var(--col-gap); row-gap: var(--s4); align-items: start;
}
.page > :not(.side) { grid-column: 1; }
/* 단계 화면은 한 열: 머리 → 진행 표시 → 판 하나 → 막히는 곳·왜 */
.page.step { display: flex; flex-direction: column; align-items: stretch; gap: var(--s2); }
/* 끝선은 둘: 글(입력 칸 포함)은 --read-max, 버튼 열·탭·아래 줄은 --task-max */
.task-main :is(.slot, .part:not(.prompt-grid), .guide, .hint, .relay-map, .ai-choices) { max-width: var(--read-max); }
.task-main .prompt-grid .part-head, .prompt-main > * { max-width: none; }
.step .step-head > :not(h1, .crumb-row), .task-body :is(.hint, .guide, .prose), .step .more .prose, .step .pitfalls ul, .step .checks ul { max-width: var(--read-max); }
.step .pitfalls + .more { margin-top: calc(-1 * var(--s2) - 1px); } /* 선 하나를 같이 쓴다 (.page.step 간격 --s2) */
.step .flow + .pitfalls, .step .flow + .more { margin-top: var(--s2); }

.page > .side {
  grid-column: 2; grid-row: 2 / span 2;
  position: sticky; top: calc(var(--topbar-h) + var(--s4));
  max-height: calc(100vh - var(--topbar-h) - var(--s4) * 2); overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent;
  /* 넘침을 잘라도 포커스 윤곽선·마우스 올림 바탕이 보이게 8px 여유. 글자 선은 그대로 */
  margin: -4px calc(-1 * var(--s1)); padding: 4px var(--s1);
}
.side > * + * { margin-top: var(--s3); }

/* 단계 머리 */
.step-head > * + * { margin-top: var(--s1); }
.step-head > .goal { margin-top: var(--s1); }
.page h1 { font-size: var(--t1); font-weight: 700; line-height: 1.25; letter-spacing: -0.03em; }
.step-head > h1 { margin-top: 4px; }
.h1-id { color: var(--muted); font-size: 0.75em; font-weight: 600; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.crumb-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s1) var(--s3); }
.crumb-row .resume-row { min-height: 0; }
.crumb { display: flex; flex-wrap: wrap; align-items: center; gap: 4px var(--s1); color: var(--muted); font-size: var(--t3); font-weight: 600; }
.crumb-no { color: var(--brand); font-variant-numeric: tabular-nums; }
.goal { color: var(--text); font-size: var(--t2); line-height: 1.55; }
.step-head > .intro-fold { margin-top: 0; }
.intro-fold[open] > summary { margin-bottom: 4px; }
.intro-fold > * + * { margin-top: var(--s1); }
.intro-fold .intro { color: var(--text); }
.intro-goal { color: var(--strong); font-weight: 600; }
.resume-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1); color: var(--muted); font-size: var(--t4); }

/* 글 묶음 */
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose p { margin: 0 0 var(--s2); }
.prose h3 { margin: var(--s3) 0 var(--s1); font-size: var(--t3); }
.prose ul, .prose ol { margin: 0 0 var(--s2); padding-left: var(--s3); }
.prose li + li { margin-top: 4px; }
.prose table { display: block; overflow-x: auto; width: 100%; margin: 0 0 var(--s2); border-collapse: collapse; font-size: var(--t4); }
.prose th, .prose td { padding: var(--s1); border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.prose th:first-child, .prose td:first-child { padding-left: 0; }
.prose th { color: var(--muted); font-weight: 600; }
.prose blockquote { margin: 0 0 var(--s2); padding: var(--s2); border-radius: 8px; background: var(--surface-2); }
.safety { margin: 0 0 var(--s2); padding: 12px var(--s2); border-radius: 8px; background: var(--surface-2); color: var(--text); font-size: var(--t4); }
.safety strong { color: var(--warn); }
.safety ul { display: flex; flex-wrap: wrap; gap: 0 var(--s3); margin: 4px 0 0; padding: 0; list-style: none; }
.safety li { position: relative; padding-left: var(--s2); }
.safety li + li { margin-top: 0; }
.safety li::before { content: ''; position: absolute; left: 2px; top: 0.72em; width: 5px; height: 5px; border-radius: 50%; background: var(--warn); }

/* 준비물: 글 링크 + 상태 꼬리표 */
.needs { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s2); font-size: var(--t4); }
.needs-label { color: var(--muted); font-weight: 600; }
.need { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--s1); min-height: 44px; font-weight: 600; text-decoration: none; }
.need:hover { text-decoration: underline; text-decoration-color: currentColor; }

/* 할 일: 위쪽 가로 탭 + 판 하나. 탭은 상단 바로 아래에 붙는다 */
.stepper-wrap { position: sticky; top: var(--topbar-h); z-index: 5; border-bottom: 1px solid var(--line-strong); background: var(--bg); }
.stepper {
  display: flex; margin: 0;
  overflow-x: auto; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent;
}
.stepper.more-right { -webkit-mask-image: linear-gradient(to left, transparent, #000 48px); mask-image: linear-gradient(to left, transparent, #000 48px); }
.stepper.more-left { -webkit-mask-image: linear-gradient(to right, transparent, #000 48px); mask-image: linear-gradient(to right, transparent, #000 48px); }
.stepper.more-left.more-right {
  -webkit-mask-image: linear-gradient(to right, transparent, #000 48px, #000 calc(100% - 48px), transparent);
  mask-image: linear-gradient(to right, transparent, #000 48px, #000 calc(100% - 48px), transparent);
}
.step-tab {
  position: relative; flex: 1 0 auto; display: flex; align-items: center; justify-content: center; gap: var(--s1); white-space: nowrap;
  padding: 12px 12px 10px;
  border: 0; border-bottom: 3px solid transparent; background: none; color: var(--muted);
  font: inherit; font-size: var(--t4); font-weight: 500; line-height: 1.4; text-align: center; cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.step-tab { scroll-margin-inline: 48px; }
.step-tab:hover { color: var(--strong); border-bottom-color: var(--line-strong); }
.step-tab:focus-visible { outline-offset: -2px; }
.step-tab[aria-selected="true"] { border-bottom-color: var(--brand); color: var(--brand); font-weight: 700; }
.task-no {
  flex: none; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%;
  color: var(--muted); font-variant-numeric: tabular-nums;
}
.task-no .i { width: 13px; height: 13px; stroke-width: 3; }
.task-title { min-width: 0; }
.step-tab[data-state="next"]:not([aria-selected="true"]) .task-title::after {
  content: ''; display: inline-block; width: 6px; height: 6px; margin-left: 6px; vertical-align: 0.2em; border-radius: 50%; background: var(--brand);
}
.step-tab[data-state="own"] .task-no { background: var(--ok); color: #fff; }
.step-tab[data-state="own"]:not([aria-selected="true"]) { color: var(--text); }
.step-tab .tag { padding: 0 8px; }
.task-body { padding: var(--s3) 0 0; }
.task-main > :first-child { margin-top: 0; }
.task-foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2);
  margin-top: var(--s3); padding-top: var(--s3); border-top: 1px solid var(--line-strong);
}
.task-foot .btn-primary { min-height: 48px; padding: 0 var(--s3); font-size: var(--t3); }
.done-check {
  display: flex; align-items: center; gap: 12px; min-height: 56px; margin-top: var(--s2);
  font-size: var(--t3); font-weight: 600; cursor: pointer;
}
.done-check input, .checks input { flex: none; width: 22px; height: 22px; margin: 0; accent-color: var(--ok); }
.done-check + .task-foot { margin-top: var(--s2); }
.done-check:has(input:disabled) { cursor: default; }
.done-why { color: var(--muted); font-size: var(--t4); font-weight: 500; }
button.chip-link { padding: 0; border: 0; background: none; color: var(--brand); font: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
button.chip-link mark.ref { cursor: pointer; }
.finish .finish-status { margin: 0; }
.finish .pager .btn { flex: 0 1 auto; }
@keyframes task-in { from { opacity: 0; transform: translateY(-4px); } }
.task:not([hidden]) .task-body { animation: task-in 0.25s var(--ease); }

/* 할 일 안의 부분: 작은 소제목 + 내용, 모두 판 안쪽 한 선에서 시작 */
.part + .part, .lead-hint + .part, .relay-map + .part, .guide + .part { margin-top: var(--s4); }
.prompt-grid + .part, .part + .guide, .before + * { margin-top: var(--s3); }
.agent-dest { display: flex; gap: var(--s1); }
.agent-dest .i { margin-top: 0.25em; color: var(--brand); }
.part-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s1); min-height: 28px; }
.part-label { color: var(--strong); font-size: var(--t3); font-weight: 700; line-height: 1.5; }
.part-note { margin-left: 4px; color: var(--muted); font-weight: 500; }
.part-note::before { content: '· '; }
.slot.bare > .part-head { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.part > * + *, .slot > * + * { margin-top: var(--s1); }
.part > .fold, .slot > .fold, .slot.bare > .part-head + * { margin-top: 0; }
.hint { color: var(--muted); font-size: var(--t4); }
.task-main .guide { font-size: var(--t3); }
.slot > .hint:first-of-type, .part > .hint, .task-main > .hint { color: var(--text); font-size: var(--t3); }
:is(.practice > .guide, .task-main .guide.prose) > ol { margin: 0 0 var(--s3); padding: 0; list-style: none; counter-reset: howto; border-top: 1px solid var(--line); }
:is(.practice > .guide, .task-main .guide.prose) > ol > li {
  position: relative; counter-increment: howto; min-height: 64px; margin: 0; padding: var(--s2) 0 var(--s2) 52px;
  border-bottom: 1px solid var(--line); line-height: 1.65;
}
:is(.practice > .guide, .task-main .guide.prose) > ol > li::before {
  content: counter(howto); position: absolute; left: 0; top: 14px;
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: var(--surface-2); color: var(--strong); font-size: var(--t3); font-weight: 700; font-variant-numeric: tabular-nums;
}
.guide pre {
  margin: var(--s1) 0 0; padding: var(--s2); max-width: var(--read-max); overflow-x: auto;
  border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface);
  font-family: var(--font); font-size: var(--t3); line-height: 1.7; white-space: pre-wrap;
}
.copy-pre { margin: var(--s1) 0 var(--s2); }
.practice a { color: var(--brand); font-weight: 600; text-decoration-color: rgba(0, 102, 179, 0.35); }
.lead-hint { margin-bottom: 0; }
.guide { font-size: var(--t4); }
.inserts { display: flex; flex-wrap: wrap; align-items: center; gap: 4px var(--s1); font-size: var(--t4); }
.inserts > span:first-child { color: var(--muted); font-weight: 600; }
.inserts [data-inserts] { display: contents; }

.prompt-text, .example pre {
  margin: var(--s1) 0 0; padding: var(--s2); max-height: 320px; overflow: auto;
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  font-family: var(--font); font-size: var(--t4); line-height: 1.65; color: var(--text);
  white-space: pre-wrap; word-break: break-word; scrollbar-color: var(--line-strong) transparent;
}
.prompt-text.short { max-height: none; margin-top: 0; padding: 12px var(--s2); }
.prompt-grid { display: grid; grid-template-columns: minmax(0, 1fr) var(--action-w); gap: var(--s1) var(--s3); align-items: start; }
.prompt-main { min-width: 0; }
.prompt-main > * + * { margin-top: var(--s1); }
.prompt-actions { display: flex; flex-direction: column; gap: var(--s1); padding-top: 36px; }
.prompt-actions .btn { width: 100%; }
.prompt-actions .btn-primary { min-height: 52px; font-size: var(--t3); }
.ai-links { display: flex; flex-direction: column; gap: var(--s1); }
/* 미리 보기: 다섯 줄까지만. 줄이 잘려 보이지 않게 상자(여백)와 글(줄 수 제한)을 나눈다 */
.prompt-peek { padding: var(--s2); border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); }
.prompt-peek pre {
  display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; max-height: calc(1.7em * 5);
  margin: 0; font-family: var(--font); font-size: var(--t3); line-height: 1.7; color: var(--text); white-space: pre-wrap; word-break: break-word;
}
.prompt-main:has(.prompt-full[open]) .prompt-peek { display: none; }
.prompt-full .prompt-text { background: var(--surface); border-color: var(--line-strong); }
.howto { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s1) var(--s3); margin: 4px 0 0; padding: 0; list-style: none; counter-reset: howto; }
.howto li { display: flex; align-items: center; gap: var(--s1); min-height: 36px; counter-increment: howto; font-size: var(--t3); line-height: 1.45; }
.howto li::before {
  content: counter(howto); flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--surface-2); color: var(--strong); font-size: var(--t4); font-weight: 700; font-variant-numeric: tabular-nums;
}
@media (max-width: 1100px) {
  .prompt-grid { grid-template-columns: minmax(0, 1fr); }
  .prompt-actions { flex-direction: row; flex-wrap: wrap; padding-top: 0; }
  .prompt-actions .btn, .ai-links .btn { width: auto; }
  .ai-links { flex-direction: row; flex-wrap: wrap; }
}
mark.ref { white-space: normal; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.prompt-text mark.ref { display: inline; padding: 1px 8px; }
mark.val { padding: 0 2px; border-radius: 3px; background: var(--ok-soft); color: inherit; }
mark.val.ex { background: var(--ex-soft); }
mark.val.warn { background: var(--warn-soft); }

.chip-link { text-decoration: none; }
.chip-link mark.ref { text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.chip-link:hover mark.ref { color: var(--strong); }

/* 칸 */
.slot textarea {
  display: block; width: 100%; min-height: 160px; padding: 12px var(--s2);
  border: 1px solid var(--field); border-radius: 8px;
  background: var(--surface); color: var(--text);
  font: var(--t3)/1.65 var(--font); resize: vertical; scrollbar-color: var(--line-strong) transparent;
  transition: border-color 0.15s;
}

.slot textarea.code { font: var(--t4)/1.6 var(--mono); }
.slot textarea:focus { border-color: var(--brand); outline: 2px solid var(--brand); outline-offset: 0; }
.slot textarea::placeholder { color: var(--muted); }
.slot[data-state="example"] textarea, .slot[data-state="mixed"] textarea { border-color: var(--ex); }
.slot[data-state="prompt"] textarea { border-color: var(--warn); }
.slot-alert {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s2); padding: 12px var(--s2);
  border-radius: 8px; background: var(--ex-soft); color: var(--ex); font-size: var(--t4); font-weight: 500;
}
.slot-alert[hidden] { display: none; }
.slot-alert p { flex: 1 1 16em; }
.slot-alert[data-kind="warn"] { background: var(--warn-soft); color: var(--warn); }
.route { display: flex; align-items: center; gap: var(--s1); color: var(--muted); font-size: var(--t4); }
.file-actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--s1); }
.file-actions[hidden] { display: none; }
.photo-pick { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1); }
.photo-pick img { width: 48px; height: 64px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line-strong); }
.photo-pick label:focus-within { outline: 2px solid var(--brand); outline-offset: 2px; }
.photo-pick .hint { flex: 1 1 100%; margin: 0; }
.file-preview { flex: 1 1 100%; }
.file-preview iframe { display: block; width: 100%; height: min(78vh, 720px); margin-top: var(--s1); border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; }

/* 접기 */
.fold > summary, .guide-more > summary {
  display: flex; align-items: center; gap: var(--s1); min-height: 44px; color: var(--muted); font-size: var(--t4); font-weight: 600;
  cursor: pointer; list-style: none;
}
.fold > summary::-webkit-details-marker, .guide-more > summary::-webkit-details-marker { display: none; }
.fold > summary::before, .guide-more > summary::before {
  content: ''; flex: none; width: 12px; height: 12px; background: currentColor;
  -webkit-mask: var(--chevron) center / contain no-repeat; mask: var(--chevron) center / contain no-repeat;
  transition: transform 0.2s var(--ease);
}
.fold[open] > summary::before, .guide-more[open] > summary::before { transform: rotate(90deg); }
.fold > summary:hover, .guide-more > summary:hover { color: var(--strong); }
.fold.before > summary { color: var(--text); font-size: var(--t3); }
.example pre { margin: 0 0 var(--s1); background: var(--surface); }

.prompt-full .prompt-text { margin-top: 0; }

/* 0단계: 릴레이 그림 */
.relay-map { margin: 0; padding: var(--s2); border-radius: 8px; background: var(--bg); }
.relay-map figcaption { margin-bottom: var(--s2); color: var(--muted); font-size: var(--t4); font-weight: 600; }
.relay-map ol { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s2) var(--s4); margin: 0; padding: 0; list-style: none; counter-reset: relay; }
.relay-map li { position: relative; display: flex; flex-direction: column; gap: 4px; counter-increment: relay; font-size: var(--t4); line-height: 1.5; }
.relay-map li > .i { width: 22px; height: 22px; margin-bottom: 4px; color: var(--brand); }
.relay-map strong { color: var(--strong); }
.relay-map strong::before { content: counter(relay) '. '; color: var(--muted); }
.relay-map li span { color: var(--muted); }
.relay-map li:not(:last-child)::after {
  content: ''; position: absolute; top: 8px; right: -24px; width: 7px; height: 7px;
  border-top: 1.5px solid var(--muted); border-right: 1.5px solid var(--muted); transform: rotate(45deg);
}

/* 0단계: 내 AI 고르기 */
.ai-choices { display: flex; flex-wrap: wrap; gap: var(--s1); margin: var(--s2) 0 0; padding: 0; border: 0; }
.ai-choice {
  display: inline-flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 var(--s2);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); font-weight: 600; cursor: pointer;
}
.ai-choice input { width: 18px; height: 18px; margin: 0; accent-color: var(--brand); }
.ai-choice:has(input:checked) { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }

/* 체크포인트: 체크 하나가 흰 줄 하나 */
.checks-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.checks ul { display: flex; flex-direction: column; gap: var(--s1); margin: 0; padding: 0; list-style: none; }
.checks label {
  display: flex; align-items: center; gap: var(--s2); min-height: 56px; padding: 12px var(--s2);
  border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); font-size: var(--t3); cursor: pointer;
  transition: border-color 0.15s;
}
.checks label:hover { border-color: var(--field); }

/* 막히는 곳·왜 이렇게 */
.pitfalls { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.pitfalls > summary { min-height: 52px; color: var(--strong); font-size: var(--t3); }
.pitfalls > summary .i, .more > summary .i { color: var(--muted); }
.pitfalls ul { margin: 0 0 var(--s2); padding: 0; list-style: none; }
.pitfalls li { position: relative; padding: 4px 0 4px var(--s2); font-size: var(--t4); }
.pitfalls li::before { content: ''; position: absolute; left: 2px; top: 1em; width: 5px; height: 5px; border-radius: 50%; background: var(--ex); }
.more { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.more > summary { min-height: 56px; color: var(--strong); font-size: var(--t3); }
.more .sub { border-top: 1px solid var(--line); }
.more .sub > summary { min-height: 48px; padding-left: var(--s3); color: var(--text); font-size: var(--t3); font-weight: 500; }
.more .sub > .prose { padding: 0 0 var(--s3) var(--s3); }

.finish-status { display: flex; align-items: center; gap: 12px; margin-bottom: var(--s2); color: var(--muted); font-size: var(--t3); font-weight: 600; }
.finish-status.done { color: var(--ok); font-size: var(--t2); font-weight: 700; }
.done-mark { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--ok); color: #fff; }
.done-mark .i { width: 18px; height: 18px; stroke-width: 3; }
.pager { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s1); }
.pager .btn { flex: 1 1 auto; }
.pager .btn:only-child { flex: 0 1 auto; margin-left: auto; }


/* 내 결과 */
.complete { padding: var(--s2); border-radius: 8px; background: var(--ok-soft); color: var(--ok); font-weight: 600; }
.deliverables { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.deliv { padding: var(--s3) 0; border-bottom: 1px solid var(--line); }
.results .side { padding-left: var(--s3); border-left: 1px solid var(--line-strong); }
.results .block { padding: 0; border: 0; border-radius: 0; background: none; }
.results .side > .block + .block { margin-top: var(--s3); padding-top: var(--s3); border-top: 1px solid var(--line-strong); }
.results .block .hint { font-size: var(--t3); color: var(--text); }
.deliv-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) 12px; }
.deliv-head h2 { font-size: var(--t2); letter-spacing: -0.01em; }

.deliv-preview {
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  margin: var(--s1) 0 var(--s2); color: var(--muted); font-size: var(--t4); white-space: pre-wrap;
}
@media (min-width: 1200px) {
  /* 넓으면 결과물 하나가 한 줄: 이름 | 상태 | 미리 보기 | 단추 */
  .deliv { display: grid; grid-template-columns: 13em auto minmax(0, 1fr) auto; align-items: center; gap: var(--s1) var(--s3); }
  .deliv-head { display: contents; }
  .deliv-preview { display: block; margin: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; line-height: 1.4; }
  .deliv .row { justify-content: flex-end; }
}
.block { padding: var(--s3); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.side > .block + .block { margin-top: var(--s2); }
.block-title { display: flex; align-items: center; gap: var(--s1); margin-bottom: var(--s1); font-size: var(--t2); letter-spacing: -0.01em; }
.block .row { margin-top: var(--s2); }
.others { margin-top: var(--s2); }
.others ul { margin: 0; padding: 0; list-style: none; }
.others li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s1); min-height: 48px; padding: 4px 0; border-bottom: 1px solid var(--line); }

/* 바닥 */
.site-foot { background: var(--foot); color: var(--foot-text); font-size: var(--t4); print-color-adjust: exact; -webkit-print-color-adjust: exact; }
.site-foot-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2) var(--s3); padding-top: var(--s4); padding-bottom: var(--s4); }
.site-foot img { display: block; height: 32px; width: auto; forced-color-adjust: none; background: var(--foot); } /* 고대비 모드에서도 흰 로고가 남색 위에 */

/* 토스트 */
.toast {
  position: fixed; left: var(--s2); right: var(--s2); bottom: var(--s3); z-index: 50;
  width: fit-content; max-width: 560px; margin: 0 auto; padding: 12px var(--s2); border-radius: 8px;
  background: var(--strong); color: #fff; font-size: var(--t4); border: 1px solid rgba(255, 255, 255, 0.35); /* 남색 바닥 위에서도 경계가 보이게 */
  opacity: 0; pointer-events: none; transform: translateY(12px);
  transition: opacity 0.2s, transform 0.3s var(--ease);
}
.toast.show { opacity: 1; transform: translateY(0); }

/* 내 결과: 오른쪽 열이 들어갈 폭이 안 되면 아래로 */
@media (max-width: 1199px) {
  .page { display: flex; flex-direction: column; align-items: stretch; gap: var(--s4); max-width: 720px; }
  .page > .side { display: contents; }
  .side > * + * { margin-top: 0; }
  .results .block { padding-top: var(--s3); border-top: 1px solid var(--line-strong); }
}
@media (max-width: 900px) {
  :root { --page-pad: 24px; }
  .brand-title { white-space: normal; } /* ☰ 버튼이 생겨 좁아지면 교육명을 자르지 않고 두 줄로 */
  .menu-btn {
    display: inline-flex; align-items: center; justify-content: center; flex: none;
    width: 44px; height: 44px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--strong); cursor: pointer;
  }
  .layout { grid-template-columns: minmax(0, 1fr); padding-top: var(--s3); }
  .step-nav {
    display: none; position: fixed; inset: var(--topbar-h) 0 0 0; z-index: 15; align-self: stretch;
    padding: var(--s2) var(--page-pad); background: var(--bg); overflow-y: auto; overscroll-behavior: contain;
  }
  .step-nav.open { display: flex; }
  .nav-toggle { display: none; }
}
@media (max-width: 720px) {
  /* 상단이 좁으면 버튼은 아이콘만(이름은 화면 낭독용), 학교 표기 아래 교육명 */
  .btn-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .top-actions .btn { min-width: 44px; padding: 0 10px; }
  .topbar-inner { gap: 12px; }
  .brand { flex-direction: column; align-items: flex-start; gap: 2px; }
  .brand-logo { height: 18px; }
  .brand-title { padding-left: 0; border-left: 0; font-size: var(--t4); }
  .relay-map ol { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .relay-map li:nth-child(2)::after { display: none; }
}
@media (max-width: 560px) {
  :root { --page-pad: 16px; --t1: 1.625rem; }
  /* 판 안의 표(에이전트 도구 준비)는 행마다 세로로 쌓는다 */
  .before table, .before tbody, .before tr, .before td { display: block; }
  .before tr:first-child { display: none; }
  .before tr { padding: var(--s1) 0; border-bottom: 1px solid var(--line); }
  .before td { padding: 0; border: 0; }
  .before td:first-child { color: var(--muted); font-weight: 600; }
  /* 휴대폰: 심벌 + 교육명 두 줄. 결과 개수는 단계 목록 메뉴에 있다 */
  .brand { flex-direction: row; align-items: center; gap: var(--s1); }
  .brand-logo, .top-actions .count { display: none; }
  .brand-symbol { display: block; flex: none; width: 36px; height: 36px; }
  .brand-title { white-space: normal; line-height: 1.3; }
  .step-tab { padding-inline: 14px; }
  .prompt-actions { flex-direction: column; }
  .prompt-actions .btn, .task-foot .btn-primary { width: 100%; }
  .ai-links { flex-direction: row; }
  .ai-links .btn { flex: 1 1 0; min-width: 0; padding: 0 var(--s1); }
  /* 좁으면 '열기'는 화면 낭독용으로만 (바깥 링크 아이콘이 같은 뜻) */
  .ai-links .open-word { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .task-foot:not(.finish) { flex-direction: column-reverse; align-items: stretch; }
  .finish { flex-direction: column; align-items: stretch; }
  .howto { grid-template-columns: minmax(0, 1fr); }
  :is(.practice > .guide, .task-main .guide.prose) > ol > li { padding-left: 46px; }
  :is(.practice > .guide, .task-main .guide.prose) > ol > li::before { width: 30px; height: 30px; }
  .checks label { padding: 12px var(--s2); }
  .relay-map ol { grid-template-columns: minmax(0, 1fr); gap: var(--s1); }
  .relay-map li { display: grid; grid-template-columns: 22px 1fr; column-gap: 12px; align-items: center; }
  .relay-map li > .i { grid-row: span 2; margin: 0; }
  .relay-map li::after { display: none; }
  .more .sub > summary { padding-left: 0; }
  .more .sub > .prose { padding-left: 0; }
  .file-preview iframe { height: 60vh; }
  .toast { top: calc(var(--topbar-h) + var(--s1)); bottom: auto; transform: translateY(-12px); }
}
@media (max-width: 400px) {
  .brand-title { font-size: 0.875rem; line-height: 1.2; } /* 360px 휴대폰에서도 두 줄 */
}
@media (max-width: 340px) {
  .nw { white-space: normal; } /* 아주 좁으면 묶음을 풀어 잘리지 않게 */
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* 이북 링크: 새 탭으로 booklink(지금은 웹 이북)를 연다 */
.step-book { margin: var(--s1) 0 0; }
.ebook-link { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 4px var(--s2); border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--text); font-size: var(--t4); font-weight: 600; text-decoration: none; }
.ebook-link:hover { border-color: var(--brand); color: var(--brand); }
.ebook-link .i { width: 16px; height: 16px; color: var(--brand); }
