/* 레이아웃: 왼쪽 과정 목차 + 본문 한 단. 명령은 어두운 터미널 패널, 상태는 Project 보드의 Status 색으로 표시한다. */
:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #eaeef4;
  --ink: #17202c;
  --muted: #566274;
  --line: #d6dce5;
  --accent: #1d55c9;
  --accent-ink: #ffffff;
  --accent-soft: #e4ecfb;
  --term-bg: #121822;
  --term-head: #1b2330;
  --term-fg: #dce3ee;
  --term-dim: #8593a8;
  --term-line: #2a3444;
  --st-todo: #5f6b7d;
  --st-progress: #a8650d;
  --st-review: #7246c0;
  --st-done: #1d7f47;
  --st-blocked: #c0362c;
  --st-todo-bg: #eceff3;
  --st-progress-bg: #fbf0dc;
  --st-review-bg: #f0e9fb;
  --st-done-bg: #e2f4e9;
  --st-blocked-bg: #fbe6e4;

  --font-body: "IBM Plex Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --step--1: 0.8125rem;
  --step-0: 1rem;
  --step-1: 1.125rem;
  --step-2: 1.375rem;
  --step-3: 1.875rem;
  --radius: 6px;
  --side-w: 17rem;
  --bar-h: 3rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f141b;
    --surface: #161c26;
    --surface-2: #1d2531;
    --ink: #e2e7ee;
    --muted: #9aa5b6;
    --line: #2a3341;
    --accent: #84a9ff;
    --accent-ink: #0f141b;
    --accent-soft: #1b2944;
    --term-bg: #0a0e14;
    --term-head: #121822;
    --term-fg: #dce3ee;
    --term-dim: #7f8da3;
    --term-line: #222b38;
    --st-todo: #a3adbd;
    --st-progress: #e3aa4f;
    --st-review: #b597f2;
    --st-done: #55c486;
    --st-blocked: #f2776c;
    --st-todo-bg: #232a35;
    --st-progress-bg: #33280f;
    --st-review-bg: #2a2140;
    --st-done-bg: #13301f;
    --st-blocked-bg: #3a1a18;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f141b;
  --surface: #161c26;
  --surface-2: #1d2531;
  --ink: #e2e7ee;
  --muted: #9aa5b6;
  --line: #2a3341;
  --accent: #84a9ff;
  --accent-ink: #0f141b;
  --accent-soft: #1b2944;
  --term-bg: #0a0e14;
  --term-head: #121822;
  --term-fg: #dce3ee;
  --term-dim: #7f8da3;
  --term-line: #222b38;
  --st-todo: #a3adbd;
  --st-progress: #e3aa4f;
  --st-review: #b597f2;
  --st-done: #55c486;
  --st-blocked: #f2776c;
  --st-todo-bg: #232a35;
  --st-progress-bg: #33280f;
  --st-review-bg: #2a2140;
  --st-done-bg: #13301f;
  --st-blocked-bg: #3a1a18;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.75;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
a { color: var(--accent); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
img { max-width: 100%; }

/* ---------- 골격 ---------- */
.shell {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  min-height: 100vh;
}
.side {
  position: sticky;
  top: calc(env(safe-area-inset-top, 0px) + var(--bar-h));
  align-self: start;
  height: calc(100vh - var(--bar-h));
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: var(--surface);
  padding-block: 1.25rem 2rem;
  padding-inline: 1rem;
  font-size: 0.9rem;
}
.main {
  min-width: 0;
  padding-block: 2.5rem 4rem;
  padding-inline: clamp(1rem, 4vw, 3.5rem);
}
.main > * { max-width: 46rem; }
.main > .wide { max-width: 64rem; }

/* ---------- 목차 ---------- */
.brand {
  display: block;
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
  font-size: 1.02rem;
  line-height: 1.35;
  margin-bottom: 0.25rem;
}
.brand-sub {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 1.25rem;
}
.nav-group { margin-bottom: 1.1rem; }
.nav-stage {
  margin: 1.4rem 0 0.6rem;
  padding: 0.35rem 0.5rem;
  border-top: 1px solid var(--line);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.4;
}
.nav-group h2 {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 0.35rem;
  padding-inline: 0.5rem;
  text-transform: uppercase;
}
.nav-group ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.nav-group a {
  display: grid;
  grid-template-columns: 3.3rem minmax(0, 1fr) auto;
  gap: 0.25rem;
  align-items: baseline;
  padding: 0.3rem 0.5rem;
  border-radius: var(--radius);
  color: var(--ink);
  text-decoration: none;
  line-height: 1.4;
}
.nav-group a:hover { background: var(--surface-2); }
.nav-group a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.nav-num { font-family: var(--font-mono); font-size: 0.72rem; color: var(--muted); }
.nav-group a[aria-current="page"] .nav-num { color: var(--accent); }
.nav-prog {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.nav-prog.done { color: var(--st-done); }
.side-toggle { display: none; }

/* ---------- 머리 ---------- */
.eyebrow {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.03em;
  color: var(--muted);
  margin: 0 0 0.75rem;
}
.eyebrow span + span::before { content: "/"; margin-right: 0.75rem; color: var(--line); }
h1 {
  font-size: var(--step-3);
  line-height: 1.3;
  margin: 0 0 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.lead {
  font-size: var(--step-1);
  line-height: 1.75;
  color: var(--ink);
  margin: 0 0 1.5rem;
}
.meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  margin: 0 0 2.5rem;
  font-size: 0.9rem;
}
.meta div { padding: 0.75rem 1rem; border-right: 1px solid var(--line); min-width: 0; }
.meta div:last-child { border-right: 0; }
.meta dt {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-transform: uppercase;
}
.meta dd { margin: 0.15rem 0 0; line-height: 1.5; }

/* ---------- 본문 ---------- */
.prose h2 {
  font-size: var(--step-2);
  line-height: 1.4;
  margin: 3rem 0 0.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  text-wrap: balance;
}
.prose h2 .step {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--accent);
  margin-right: 0.5rem;
  vertical-align: 0.15em;
}
.prose h3 { font-size: var(--step-1); line-height: 1.45; margin: 2rem 0 0.5rem; }
.prose p, .prose ul, .prose ol { margin: 0 0 1rem; }
.prose ul, .prose ol { padding-left: 1.4rem; }
.prose li { margin-bottom: 0.3rem; }
.prose li > ul, .prose li > ol { margin: 0.3rem 0 0; }
.prose strong { font-weight: 700; }
code, kbd, samp { font-family: var(--font-mono); font-size: 0.88em; }
:not(pre) > code {
  background: var(--surface-2);
  border-radius: 4px;
  padding: 0.08em 0.35em;
  overflow-wrap: anywhere;
}
kbd {
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0 0.35em;
  background: var(--surface);
}

/* ---------- 터미널 블록 ---------- */
/* 스크립트가 감싸기 전에도 읽을 수 있도록 원래 pre에 기본 모양을 준다. */
pre.sh, pre.out, pre.file {
  margin: 1rem 0 1.25rem;
  padding: 0.9rem 1rem;
  border-radius: var(--radius);
  overflow-x: auto;
  background: var(--term-bg);
  color: var(--term-fg);
  font-family: var(--font-mono);
  font-size: 0.84rem;
  line-height: 1.65;
  word-break: normal;
  overflow-wrap: normal;
}
pre.out { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.code {
  margin: 1rem 0 1.25rem;
  border-radius: var(--radius);
  background: var(--term-bg);
  border: 1px solid var(--term-line);
  overflow: hidden;
}
.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.35rem 0.5rem 0.35rem 0.85rem;
  background: var(--term-head);
  border-bottom: 1px solid var(--term-line);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--term-dim);
}
.code-head .file { color: var(--term-fg); }
.copy-btn {
  font: inherit;
  font-size: 0.72rem;
  color: var(--term-fg);
  background: transparent;
  border: 1px solid var(--term-line);
  border-radius: 4px;
  padding: 0.2rem 0.6rem;
  cursor: pointer;
  min-height: 1.9rem;
}
.copy-btn:hover { border-color: var(--term-dim); }
.copy-btn[data-state="done"] { color: var(--st-done); border-color: var(--st-done); }
.code pre {
  margin: 0;
  padding: 0.9rem 1rem 1rem;
  overflow-x: auto;
  color: var(--term-fg);
  font-family: var(--font-mono);
  font-size: 0.84rem;
  line-height: 1.65;
  tab-size: 4;
  word-break: normal;
  overflow-wrap: normal;
}
.code pre .cm { color: var(--term-dim); }
.code.output { background: var(--surface); border-color: var(--line); }
.code.output .code-head { background: var(--surface-2); border-color: var(--line); color: var(--muted); }
.code.output pre { color: var(--ink); }
.code.file .code-head .file::before { content: "파일 "; color: var(--term-dim); }

/* ---------- 표 ---------- */
.table-wrap { overflow-x: auto; margin: 1rem 0 1.5rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; line-height: 1.55; }
table.wide { min-width: 40rem; }
th, td { text-align: left; vertical-align: top; padding: 0.55rem 0.8rem; border-bottom: 1px solid var(--line); }
th { font-weight: 500; font-size: 0.8rem; color: var(--muted); background: var(--surface-2); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td code { overflow-wrap: anywhere; }
td.num, th.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
[data-filter] td:last-child, [data-filter] th:last-child { white-space: nowrap; }

/* ---------- 상태 칩 ---------- */
.st {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  line-height: 1.5;
  padding: 0.05rem 0.5rem;
  border-radius: 999px;
  border: 1px solid currentColor;
  white-space: nowrap;
}
.st-todo { color: var(--st-todo); background: var(--st-todo-bg); }
.st-progress { color: var(--st-progress); background: var(--st-progress-bg); }
.st-review { color: var(--st-review); background: var(--st-review-bg); }
.st-done { color: var(--st-done); background: var(--st-done-bg); }
.st-blocked { color: var(--st-blocked); background: var(--st-blocked-bg); }

/* ---------- 안내 상자 ---------- */
.box {
  margin: 1.25rem 0 1.5rem;
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: var(--radius);
  background: var(--surface);
}
.box > :last-child { margin-bottom: 0; }
.box-title {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
}
.box.why { border-left-color: var(--accent); }
.box.why .box-title { color: var(--accent); }
.box.warn { border-left-color: var(--st-progress); }
.box.warn .box-title { color: var(--st-progress); }
.box.stop { border-left-color: var(--st-blocked); }
.box.stop .box-title { color: var(--st-blocked); }
.box.team { border-left-color: var(--st-review); }
.box.team .box-title { color: var(--st-review); }

/* ---------- 접는 상자 ---------- */
details {
  margin: 1rem 0 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
details > summary {
  cursor: pointer;
  padding: 0.6rem 1rem;
  font-weight: 500;
  list-style-position: inside;
}
details[open] > summary { border-bottom: 1px solid var(--line); }
details > .details-body { padding: 0.75rem 1rem 0.25rem; }
details .code { margin-top: 0.25rem; }
details.trouble > summary::marker { color: var(--st-blocked); }

/* ---------- 완료 확인 ---------- */
.checklist {
  list-style: none;
  padding: 0.5rem 0 !important;
  margin: 1rem 0 1.5rem !important;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.checklist li { margin: 0; padding: 0.35rem 1rem; }
.checklist label { display: grid; grid-template-columns: 1.25rem minmax(0, 1fr); gap: 0.6rem; align-items: start; cursor: pointer; }
.checklist input { width: 1.05rem; height: 1.05rem; margin: 0.35rem 0 0; accent-color: var(--st-done); }
.checklist input:checked + span { color: var(--muted); }
.checklist-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.1rem 1rem 0.5rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.checklist-head .count { font-variant-numeric: tabular-nums; }
.checklist-head .count.done { color: var(--st-done); }

/* ---------- 흐름 그림 ---------- */
.flow {
  list-style: none;
  margin: 1.25rem 0 1.75rem !important;
  padding: 0 !important;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: 0.5rem;
  counter-reset: flow;
}
.flow li {
  position: relative;
  margin: 0;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 0.9rem;
  line-height: 1.5;
  counter-increment: flow;
}
.flow li::before {
  content: counter(flow, decimal-leading-zero);
  display: block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent);
  margin-bottom: 0.15rem;
}
.flow li b { display: block; font-weight: 700; }
.flow li small { display: block; color: var(--muted); font-size: 0.8rem; }

/* ---------- 카드 목록 (과정 지도) ---------- */
.sessions { display: grid; gap: 1rem; margin: 1rem 0 2rem; }
.stage-head { margin: 0.75rem 0 -0.25rem; padding-top: 0.75rem; border-top: 2px solid var(--line); font-weight: 700; font-size: var(--step-1); color: var(--ink); }
.session {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1rem 1.1rem;
}
.session h3 { margin: 0 0 0.25rem; font-size: var(--step-1); }
.session p { margin: 0 0 0.75rem; color: var(--muted); font-size: 0.92rem; }
.session ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.session li {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr) auto;
  gap: 0.75rem;
  padding: 0.45rem 0;
  border-top: 1px solid var(--line);
  font-size: 0.93rem;
  line-height: 1.5;
  margin: 0;
}
.session li .t { font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted); font-variant-numeric: tabular-nums; padding-top: 0.1rem; }
.session li .p { font-family: var(--font-mono); font-size: 0.72rem; color: var(--muted); }
.session li .p.done { color: var(--st-done); }

/* ---------- 입력 도구 ---------- */
.tool {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1rem 1.1rem;
  margin: 1rem 0 1.5rem;
}
.tool-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 0.75rem 1rem; }
.tool label { display: grid; gap: 0.2rem; font-size: 0.85rem; color: var(--muted); }
.tool input[type="text"], .tool input[type="search"] {
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.45rem 0.6rem;
  min-width: 0;
  width: 100%;
}
.tool input:focus { border-color: var(--accent); }
.tool .hint { font-size: 0.82rem; color: var(--muted); margin: 0.6rem 0 0; }

/* ---------- 파일 보기 ---------- */
.files { display: grid; grid-template-columns: 15rem minmax(0, 1fr); gap: 1rem; align-items: start; }
.file-list { list-style: none; margin: 0 !important; padding: 0 !important; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); max-height: 40rem; overflow-y: auto; }
.file-list li { margin: 0; border-bottom: 1px solid var(--line); }
.file-list li:last-child { border-bottom: 0; }
.file-list button {
  display: block;
  width: 100%;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--ink);
  background: transparent;
  border: 0;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  overflow-wrap: anywhere;
}
.file-list button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.file-view { min-width: 0; }
.file-view .code { margin-top: 0; }
.file-view pre { max-height: 36rem; }

/* ---------- 이전·다음 ---------- */
.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}
.pager a {
  display: block;
  padding: 0.75rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-decoration: none;
  color: var(--ink);
  line-height: 1.45;
  min-width: 0;
}
.pager a:hover { border-color: var(--accent); }
.pager small { display: block; font-family: var(--font-mono); font-size: 0.7rem; color: var(--muted); letter-spacing: 0.04em; }
.pager .next { text-align: right; grid-column: 2; }

.foot { margin-top: 2.5rem; font-size: 0.82rem; color: var(--muted); }

/* ---------- 좁은 화면 ---------- */
@media (max-width: 960px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding-block: 0.75rem;
  }
  .side-toggle {
    display: inline-block;
    font: inherit;
    font-size: 0.85rem;
    color: var(--ink);
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 0.35rem 0.75rem;
    cursor: pointer;
    margin-top: 0.5rem;
  }
  .side .nav-body { display: none; margin-top: 1rem; }
  .side.open .nav-body { display: block; }
  .brand-sub { margin-bottom: 0; }
  .main { padding-block: 1.75rem 3rem; }
  .files { grid-template-columns: minmax(0, 1fr); }
  .file-list { max-height: 18rem; }
}
@media (max-width: 560px) {
  .meta div { border-right: 0; border-bottom: 1px solid var(--line); }
  .meta div:last-child { border-bottom: 0; }
  .session li { grid-template-columns: minmax(0, 1fr) auto; }
  .session li .t { grid-column: 1 / -1; padding-top: 0; }
  .pager { grid-template-columns: minmax(0, 1fr); }
  .pager .next { grid-column: 1; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ===================== 3회차: 그래프와 재생 화면 ===================== */
:root {
  --s1: #2a78d6;   /* PV, 계획 */
  --s2: #eb6834;   /* EV, 획득 */
  --s3: #1baf7a;   /* AC, 실제 */
  --grid: #e3e7ed;
  --crit: #c2410c;
  --tile-bg: var(--surface);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --s1: #3987e5;
    --s2: #d95926;
    --s3: #199e70;
    --grid: #263040;
    --crit: #f08a4b;
  }
}
:root[data-theme="dark"] {
  --s1: #3987e5;
  --s2: #d95926;
  --s3: #199e70;
  --grid: #263040;
  --crit: #f08a4b;
}

.widget {
  margin: 1.25rem 0 1.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1rem;
}
.widget-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 0.75rem;
}
.widget-title { font-weight: 700; font-size: 0.95rem; }
.widget-note { font-size: 0.82rem; color: var(--muted); margin: 0.5rem 0 0; }
.ctrl {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  font-size: 0.85rem;
}
.ctrl label { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--muted); }
.ctrl input[type="range"] { width: min(18rem, 60vw); accent-color: var(--accent); }
.ctrl input[type="number"], .ctrl input[type="text"], .ctrl input[type="date"], .ctrl select {
  font: inherit;
  font-size: 0.85rem;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.3rem 0.45rem;
  min-width: 0;
}
.ctrl input[type="number"] { width: 4.2rem; }
.btn {
  font: inherit;
  font-size: 0.82rem;
  color: var(--accent-ink);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 0.3rem 0.8rem;
  cursor: pointer;
  min-height: 2rem;
}
.btn.ghost { color: var(--ink); background: transparent; border-color: var(--line); }
.btn:hover { filter: brightness(1.05); }
.day-label { font-family: var(--font-mono); font-size: 0.85rem; font-variant-numeric: tabular-nums; }

/* 지표 타일 */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr)); gap: 0.5rem; margin: 0.25rem 0 0.75rem; }
.tile { border: 1px solid var(--line); border-radius: var(--radius); padding: 0.5rem 0.7rem; background: var(--tile-bg); min-width: 0; }
.tile .t-label { display: block; font-size: 0.74rem; color: var(--muted); }
.tile .t-value { display: block; font-size: 1.3rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.3; }
.tile .t-sub { display: block; font-size: 0.74rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.tile.warn .t-value { color: var(--st-blocked); }

/* 그래프 */
.chart { position: relative; width: 100%; min-width: 0; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--muted); font-family: var(--font-body); font-size: 11px; }
.chart .t-ink { fill: var(--ink); }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .axis { stroke: var(--line); stroke-width: 1; }
.chart .ln { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .s1 { stroke: var(--s1); }
.chart .s2 { stroke: var(--s2); }
.chart .s3 { stroke: var(--s3); }
.chart .f1 { fill: var(--s1); }
.chart .f2 { fill: var(--s2); }
.chart .f3 { fill: var(--s3); }
.chart .dot { stroke: var(--surface); stroke-width: 2; }
.chart .ref { stroke: var(--muted); stroke-width: 1; }
.chart .mark { stroke: var(--ink); stroke-width: 1; }
.chart .bar { fill: var(--s1); }
.chart .bar.hit { fill: var(--s2); }
.chart .crit { stroke: var(--crit); }
.chart .crit-fill { fill: var(--crit); }
.chart .muted-fill { fill: var(--grid); }
.chart .hover-line { stroke: var(--muted); stroke-width: 1; }
.legend { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; font-size: 0.8rem; color: var(--muted); margin: 0 0 0.4rem; }
.legend .key { display: inline-flex; align-items: center; gap: 0.35rem; }
.legend .sw { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.legend .sw.s1 { background: var(--s1); }
.legend .sw.s2 { background: var(--s2); }
.legend .sw.s3 { background: var(--s3); }
.legend .sw.crit { background: var(--crit); }
.legend .sw.grey { background: var(--grid); height: 8px; }
.viz-tip {
  position: absolute;
  pointer-events: none;
  z-index: 5;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.35rem 0.55rem;
  font-size: 0.78rem;
  line-height: 1.45;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.viz-tip .k { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 0.3rem; }

/* 터미널 재생 */
.player {
  margin: 1.25rem 0 1.5rem;
  border-radius: var(--radius);
  background: var(--term-bg);
  border: 1px solid var(--term-line);
  overflow: hidden;
}
.player-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.35rem 0.5rem 0.35rem 0.85rem;
  background: var(--term-head);
  border-bottom: 1px solid var(--term-line);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--term-dim);
}
.player-head .badge { color: var(--term-fg); }
.player-head button {
  font: inherit;
  color: var(--term-fg);
  background: transparent;
  border: 1px solid var(--term-line);
  border-radius: 4px;
  padding: 0.2rem 0.6rem;
  cursor: pointer;
  min-height: 1.9rem;
}
.player-screen {
  margin: 0;
  padding: 0.9rem 1rem 1rem;
  min-height: 9rem;
  max-height: 26rem;
  overflow: auto;
  color: var(--term-fg);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.6;
  white-space: pre;
}
.player-screen .ps { color: var(--term-dim); }
.player-screen .cmd { color: var(--term-fg); }
.player-screen .out { color: var(--term-fg); opacity: 0.86; }
.player-screen .caret { display: inline-block; width: 0.55em; height: 1.05em; vertical-align: -0.15em; background: var(--term-fg); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* 스프린트 재생 보드 */
.replay-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.4rem; }
.board-col { background: var(--bg); border-radius: var(--radius); padding: 0.4rem; min-height: 15rem; min-width: 0; }
.board-col h4 { margin: 0 0 0.4rem; font-size: 0.72rem; font-family: var(--font-mono); font-weight: 500; color: var(--muted); display: flex; justify-content: space-between; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.35rem 0.45rem;
  margin-bottom: 0.35rem;
  font-size: 0.74rem;
  line-height: 1.35;
  min-width: 0;
  will-change: transform;
}
.card .ck { font-family: var(--font-mono); font-weight: 500; font-size: 0.72rem; display: block; }
.card .ct { display: block; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .cb { display: flex; flex-wrap: wrap; gap: 0.2rem; margin-top: 0.2rem; }
.card .tag { font-family: var(--font-mono); font-size: 0.64rem; padding: 0 0.3rem; border-radius: 3px; border: 1px solid var(--line); color: var(--muted); }
.card .tag.blocked { color: var(--st-blocked); border-color: var(--st-blocked); background: var(--st-blocked-bg); }
.card .tag.pr { color: var(--st-review); border-color: var(--st-review); }
.card.changed { border-color: var(--accent); }
.log { list-style: none; margin: 0.5rem 0 0 !important; padding: 0 !important; font-size: 0.8rem; }
.log li { display: grid; grid-template-columns: 4.6rem minmax(0, 1fr); gap: 0.5rem; padding: 0.25rem 0; border-top: 1px solid var(--line); color: var(--muted); margin: 0; }
.log li.now { color: var(--ink); }
.log li .d { font-family: var(--font-mono); font-size: 0.74rem; font-variant-numeric: tabular-nums; }

/* 일정망 */
.net-wrap { overflow-x: auto; }
.net-node rect { fill: var(--surface); stroke: var(--line); stroke-width: 1; }
.net-node.critical rect { stroke: var(--crit); stroke-width: 2; }
.net-edge { fill: none; stroke: var(--line); stroke-width: 1.5; }
.net-edge.critical { stroke: var(--crit); stroke-width: 2; }
.dur-inputs { display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); gap: 0.4rem 0.75rem; margin-bottom: 0.75rem; }
.dur-inputs label { display: flex; align-items: center; justify-content: space-between; gap: 0.4rem; font-size: 0.82rem; font-family: var(--font-mono); }

/* 몬테카를로 시행 하나 */
.trial { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; font-size: 0.8rem; min-height: 2rem; margin-top: 0.5rem; }
.trial .draw { font-family: var(--font-mono); border: 1px solid var(--line); border-radius: 4px; padding: 0.1rem 0.4rem; background: var(--bg); }
.trial .draw.last { border-color: var(--accent); color: var(--accent); }

.figure { margin: 1.25rem 0 1.5rem; }
.figure img { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.figure .net-wrap img { width: auto; max-width: none; }
.figure figcaption { font-size: 0.82rem; color: var(--muted); margin-top: 0.4rem; }

.replay-grid .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.replay-grid .tile .t-value { font-size: 1.1rem; }
@media (max-width: 760px) {
  .replay-grid { grid-template-columns: minmax(0, 1fr); }
  .board-col { min-height: 11rem; }
  .card .ct { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .player-screen .caret { animation: none; }
}

/* 4회차: 프로세스 지도 */
.pm-opts { margin-bottom: 0.6rem; }
.pm-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 1rem; align-items: start; margin-top: 0.75rem; }
.pm-map { max-width: 700px; margin: 0 auto; }
.pm-map svg { min-width: 600px; }
.chart .pm-edge { fill: none; stroke: var(--muted); stroke-opacity: 0.55; }
.chart .pm-edge.slow { stroke: var(--s2); stroke-opacity: 0.9; }
.chart .pm-arrow { fill: var(--muted); }
.chart .pm-arrow.slow { fill: var(--s2); }
.chart .pm-label rect { fill: var(--surface); stroke: var(--line); }
.chart .pm-label text { font-size: 10.5px; fill: var(--ink); font-variant-numeric: tabular-nums; }
.chart .pm-node rect { fill: var(--surface); stroke: var(--line); stroke-width: 1; }
.chart .pm-node.main rect { stroke: var(--muted); stroke-width: 1.4; }
.chart .pm-node text { font-size: 10.5px; }
.chart .pm-token circle { fill: var(--accent); stroke: var(--surface); stroke-width: 1.5; }
.chart .pm-token:not(.big) circle { fill-opacity: 0.7; stroke: none; }
.chart .pm-token text { fill: var(--accent-ink); font-size: 9px; font-weight: 700; font-family: var(--font-mono); }
.pm-h { font-size: 0.8rem; margin: 0 0 0.4rem; color: var(--muted); font-weight: 500; }
.pm-variants { list-style: none; margin: 0 0 1rem !important; padding: 0 !important; font-size: 0.76rem; }
.pm-variants li { position: relative; margin: 0 0 0.4rem; padding: 0.3rem 0.45rem 0.3rem 3rem; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.pm-vbar { position: absolute; left: 0; top: 0; bottom: 0; background: var(--grid); }
.pm-vn { position: absolute; left: 0.45rem; top: 0.3rem; font-family: var(--font-mono); font-weight: 500; }
.pm-vseq { position: relative; display: block; line-height: 1.45; }
.pm-check { font-size: 0.78rem; margin: 0; }
.pm-check td { padding: 0.3rem 0.4rem; }
.pm-check td.bad { color: var(--st-blocked); }
.pm-check td.ok { color: var(--muted); }

/* 4회차: 리드·래그, 누적 흐름도 */
.chart .ll-plan { fill: var(--grid); }
.chart .ll-act { fill: var(--s1); }
.chart .ll-gap { stroke: var(--s1); stroke-width: 2; stroke-dasharray: 2 3; }
.chart .ll-link { fill: none; stroke-width: 1.6; }
.chart .cfd-band { fill-opacity: 0.85; stroke: var(--surface); stroke-width: 0.5; }
@media (max-width: 760px) {
  .pm-grid { grid-template-columns: minmax(0, 1fr); }
}

/* 2단계: 점 도표, 단계 비교, what-if, PM4Py 실습실 */
.dc-sw { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dc-sw.dc-c0 { background: var(--muted); }
.dc-sw.dc-c1 { background: var(--s1); }
.dc-sw.dc-c2 { background: var(--s2); }
.dc-sw.dc-c3 { background: var(--s3); }
.dc-sw.dc-c4 { background: var(--ink); }
.dc-sw.sb-a, .dc-sw.wi-sw0 { background: var(--grid); border: 1px solid var(--muted); border-radius: 2px; }
.dc-sw.sb-b, .dc-sw.wi-sw1 { background: var(--s1); border-radius: 2px; }
.dc-sw.wi-sw2 { background: var(--s3); width: 3px; border-radius: 0; }
.chart .dc-c0 { fill: var(--muted); }
.chart .dc-c1 { fill: var(--s1); }
.chart .dc-c2 { fill: var(--s2); }
.chart .dc-c3 { fill: var(--s3); }
.chart .dc-c4 { fill: var(--ink); }
.chart .dc-dim { opacity: 0.12; }
.chart .dc-weekend { fill: var(--grid); opacity: 0.55; }
.chart .dc-split { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 4 3; }
.chart .dc-band { fill: var(--accent); fill-opacity: 0.12; }
.sb { display: grid; gap: 0.35rem; }
.sb-row { display: grid; grid-template-columns: 12rem minmax(0, 1fr); gap: 0.25rem 0.75rem; align-items: center; padding: 0.3rem 0.4rem; border-radius: 4px; }
.sb-row.sb-best { background: var(--accent-soft); }
.sb-label { font-size: 0.85rem; font-weight: 500; line-height: 1.3; }
.sb-label span { display: block; font-size: 0.74rem; font-weight: 400; color: var(--muted); }
.sb-bars { display: grid; gap: 3px; min-width: 0; }
.sb-line { display: grid; grid-template-columns: minmax(0, 1fr) 7.2rem; align-items: center; gap: 0.4rem; min-width: 0; }
.sb-track { display: block; min-width: 0; }
.sb-bar { display: block; height: 11px; border-radius: 2px; box-sizing: border-box; }
.sb-bar.sb-a { background: var(--grid); border: 1px solid var(--muted); }
.sb-bar.sb-b { background: var(--s1); }
.sb-val { font-size: 0.76rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.wi-opts { margin-bottom: 0.6rem; }
.wi-cap input[type="range"] { width: min(10rem, 40vw); }
.chart .wi-b0 { fill: var(--grid); stroke: var(--muted); stroke-width: 0.6; }
.chart .wi-b1 { fill: var(--s1); }
.chart .wi-l0 { stroke: var(--muted); stroke-width: 1.2; stroke-dasharray: 4 3; }
.chart .wi-l1 { stroke: var(--s1); stroke-width: 1.6; }
.chart .wi-l2 { stroke: var(--s3); stroke-width: 1.6; stroke-dasharray: 2 2; }
pre.wi-cmd { margin: 0.6rem 0 0; padding: 0.5rem 0.7rem; font-family: var(--font-mono); font-size: 0.78rem; background: var(--term-bg); color: var(--term-fg); border-radius: 4px; overflow-x: auto; white-space: pre; }
.py-status { margin-bottom: 0.75rem; }
.py-cell { border-top: 1px solid var(--line); padding: 0.75rem 0 0.25rem; }
.py-cell-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.6rem; margin-bottom: 0.4rem; }
.py-n { font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted); }
.py-title { font-weight: 500; font-size: 0.9rem; margin-right: auto; }
.py-code {
  display: block; width: 100%; box-sizing: border-box; resize: vertical;
  font-family: var(--font-mono); font-size: 0.78rem; line-height: 1.5; tab-size: 4;
  color: var(--term-fg); background: var(--term-bg); border: 1px solid var(--term-line); border-radius: 4px;
  padding: 0.55rem 0.7rem; overflow-x: auto; white-space: pre;
}
.py-tag { font-size: 0.74rem; color: var(--muted); margin: 0.45rem 0 0.2rem; }
pre.py-out {
  margin: 0; padding: 0.5rem 0.7rem; font-family: var(--font-mono); font-size: 0.76rem; line-height: 1.5;
  background: var(--surface-2); color: var(--ink); border-radius: 4px; overflow-x: auto; white-space: pre; max-height: 22rem;
}
pre.py-out.err { color: var(--st-blocked); background: var(--st-blocked-bg); }
.py-figs { display: grid; gap: 0.6rem; margin-top: 0.6rem; }
.py-fig { margin: 0; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; background: #ffffff; }
.py-fig figcaption { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.3rem 0.5rem; font-size: 0.76rem; font-family: var(--font-mono); color: var(--muted); background: var(--surface-2); }
.py-zoom { min-height: 1.6rem; padding: 0.1rem 0.5rem; font-size: 0.74rem; }
.py-view { overflow: auto; max-height: 34rem; padding: 0.4rem; }
.py-view img, .py-view svg { display: block; max-width: none; height: auto; }
.py-view.fit img, .py-view.fit svg { width: 100%; height: auto; }
@media (max-width: 760px) {
  .sb-row { grid-template-columns: minmax(0, 1fr); }
}

/* 상단 메뉴: Level 1과 심화 트랙 A~D */
.levelbar {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 20;
  height: var(--bar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  overflow-y: hidden;
}
.levelbar ol { list-style: none; margin: 0; padding: 0 0.75rem; display: flex; gap: 0.25rem; height: 100%; align-items: center; min-width: max-content; }
.levelbar li { margin: 0; }
.levelbar a {
  display: inline-flex; align-items: baseline; gap: 0.45rem;
  padding: 0.35rem 0.75rem; border-radius: var(--radius);
  color: var(--muted); text-decoration: none; font-size: 0.86rem; white-space: nowrap;
}
.levelbar a b { font-family: var(--font-mono); font-weight: 500; color: var(--ink); font-size: 0.8rem; }
.levelbar a:hover { background: var(--surface-2); color: var(--ink); }
.levelbar a[aria-current="true"] { background: var(--accent-soft); color: var(--accent); }
.levelbar a[aria-current="true"] b { color: var(--accent); }
.levelbar .lv-home { padding-right: 0.5rem; margin-right: 0.25rem; border-right: 1px solid var(--line); }
.levelbar .lv-home b { color: var(--accent); }
@media (max-width: 900px) {
  .levelbar a span { display: none; }
  .levelbar a[aria-current="true"] span { display: inline; }
  .levelbar .lv-home span { display: none; }
}
