:root {
  --bg: #f7f9fc;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #3b82f6;
  --instr-bg: #eff6ff;  --instr-bd: #93c5fd;
  --anal-bg:  #fefce8;  --anal-bd:  #fde047;
  --proc-bg:  #f0fdf4;  --proc-bd:  #86efac;
  --res-bg:   #fdf2f8;  --res-bd:   #f9a8d4;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: "Pretendard", "Noto Sans KR", "Apple SD Gothic Neo", system-ui, sans-serif;
  line-height: 1.65;
}
header {
  background: linear-gradient(135deg, #dbeafe 0%, #fce7f3 100%);
  padding: 40px 16px 32px; text-align: center; border-bottom: 1px solid var(--line);
}
header h1 { margin: 0 0 6px; font-size: 1.9rem; }
header p { margin: 0; color: var(--muted); font-size: .95rem; }
main { max-width: 920px; margin: 0 auto; padding: 32px 16px 64px; }
.timeline { position: relative; padding-left: 28px; }
.timeline::before {
  content: ""; position: absolute; left: 8px; top: 6px; bottom: 6px;
  width: 3px; background: #c7d2fe; border-radius: 2px;
}
.entry { position: relative; margin-bottom: 40px; }
.entry::before {
  content: ""; position: absolute; left: -26px; top: 8px; width: 15px; height: 15px;
  border-radius: 50%; background: var(--card); border: 3px solid var(--accent);
}
.entry-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; margin-bottom: 12px; }
.entry-num { font-weight: 700; color: var(--accent); font-size: 1.1rem; }
.entry-title { font-weight: 700; font-size: 1.15rem; }
.entry-time { color: var(--muted); font-size: .85rem; width: 100%; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 2px 8px rgba(30, 64, 175, .05); overflow: hidden;
}
.sec { padding: 16px 20px; border-left: 5px solid transparent; }
.sec + .sec { border-top: 1px solid var(--line); }
.sec h3 { margin: 0 0 8px; font-size: .95rem; display: flex; align-items: center; gap: 8px; }
.sec h3 .t { color: var(--muted); font-weight: 400; font-size: .8rem; }
.instr { background: var(--instr-bg); border-left-color: var(--instr-bd); }
.anal  { background: var(--anal-bg);  border-left-color: var(--anal-bd); }
.proc  { background: var(--proc-bg);  border-left-color: var(--proc-bd); }
.res   { background: var(--res-bg);   border-left-color: var(--res-bd); }
blockquote.original {
  margin: 0; padding: 12px 14px; background: #fff; border-radius: 8px;
  border: 1px dashed var(--instr-bd); white-space: pre-wrap; word-break: break-word;
}
ul, ol { margin: 4px 0; padding-left: 22px; }
li { margin: 3px 0; }
code {
  background: #f1f5f9; padding: 1px 6px; border-radius: 5px;
  font-family: "JetBrains Mono", ui-monospace, monospace; font-size: .86em; word-break: break-all;
}
.step-time { color: var(--muted); font-size: .8rem; margin-right: 6px; font-family: ui-monospace, monospace; }
figure { margin: 12px 0 4px; }
figure img {
  width: 100%; height: auto; display: block; border-radius: 10px;
  border: 1px solid var(--line); background: #fff;
}
figcaption { color: var(--muted); font-size: .82rem; margin-top: 6px; }
.badge {
  display: inline-block; padding: 1px 10px; border-radius: 999px; font-size: .75rem; font-weight: 600;
  background: #dcfce7; color: #166534;
}
footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 0 16px 32px; }
/* ---- pagination & table of contents ---- */
.toc { background: var(--card); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(30, 64, 175, .05); }
.toc summary { cursor: pointer; padding: 12px 18px; font-weight: 700; font-size: .95rem; list-style: none; }
.toc summary::-webkit-details-marker { display: none; }
.toc summary::before { content: "▸"; display: inline-block; margin-right: 8px; color: var(--accent); transition: transform .2s; }
.toc[open] summary::before { transform: rotate(90deg); }
.toc summary .count { color: var(--muted); font-weight: 400; font-size: .82rem; margin-left: 6px; }
.toc ol { margin: 0; padding: 0 18px 14px 40px; columns: 2 320px; column-gap: 28px; }
.toc li { break-inside: avoid; font-size: .88rem; }
.toc a { color: var(--text); text-decoration: none; }
.toc a:hover { color: var(--accent); text-decoration: underline; }
.toc .toc-time { color: var(--muted); font-size: .75rem; margin-left: 4px; }
.pager { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; margin: 0 0 24px; }
.pager.bottom { margin: 8px 0 0; }
.pager button {
  min-width: 38px; height: 36px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); font: inherit; font-size: .88rem; cursor: pointer;
}
.pager button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.pager button.current { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.pager button:disabled { opacity: .4; cursor: default; }
.pager .info { width: 100%; text-align: center; color: var(--muted); font-size: .8rem; margin-top: 2px; }
.entry[hidden] { display: none; }
/* Tall screenshots are shown as a top-cropped preview; click opens the original. */
figure img { max-height: 520px; object-fit: cover; object-position: top; cursor: zoom-in; }
figure img.tall + figcaption::after { content: " (위쪽 일부만 표시 · 클릭하면 원본)"; color: var(--accent); }
@media print { .pager, .toc { display: none; } .entry[hidden] { display: block; } figure img { max-height: none; } }

/* ---- phase pages ---- */
.crumbs { font-size: .85rem; margin-bottom: 10px; }
.crumbs a { color: var(--accent); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.phase-label { display: inline-block; font-size: .75rem; font-weight: 700; letter-spacing: .08em;
  color: var(--accent); background: #fff; border: 1px solid #bfdbfe; border-radius: 999px; padding: 2px 12px; margin-bottom: 8px; }
.phase-summary { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px 20px; margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(30, 64, 175, .05); }
.phase-summary h2 { margin: 0 0 8px; font-size: 1rem; }
.phase-summary ul { margin: 0; }
.phase-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; font-size: .9rem; }
.phase-nav a { color: var(--accent); text-decoration: none; }
.phase-nav a:hover { text-decoration: underline; }

/* ---- landing ---- */
.stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 14px; }
.stat { background: rgba(255,255,255,.75); border: 1px solid var(--line); border-radius: 12px; padding: 8px 16px; min-width: 104px; }
.stat b { display: block; font-size: 1.35rem; }
.stat span { color: var(--muted); font-size: .78rem; }
.section-title { font-size: 1.05rem; margin: 8px 0 14px; }
.phases { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); margin-bottom: 36px; }
.phase-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden;
  box-shadow: 0 2px 10px rgba(30, 64, 175, .06); display: flex; flex-direction: column; text-decoration: none; color: inherit;
  transition: transform .15s, box-shadow .15s; }
.phase-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(30, 64, 175, .12); }
.phase-card .thumb { aspect-ratio: 16 / 9; background: #eef2f7 center top / cover no-repeat; border-bottom: 1px solid var(--line); }
.phase-card .body { padding: 14px 18px 18px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.phase-card h3 { margin: 0; font-size: 1.08rem; }
.phase-card .goal { color: var(--muted); font-size: .88rem; margin: 0; }
.phase-card .meta { color: var(--muted); font-size: .8rem; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.chip { font-size: .75rem; background: #f1f5f9; border-radius: 999px; padding: 2px 10px; }
.phase-card .go { margin-top: auto; padding-top: 8px; color: var(--accent); font-weight: 600; font-size: .88rem; }
.badge.wip { background: #fef3c7; color: #92400e; }
.recent { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 6px 0; }
.recent a { display: flex; gap: 12px; align-items: baseline; padding: 10px 18px; text-decoration: none; color: inherit; }
.recent a + a { border-top: 1px solid var(--line); }
.recent a:hover { background: #f8fafc; }
.recent .n { color: var(--accent); font-weight: 700; min-width: 34px; }
.recent .t { flex: 1; }
.recent .w { color: var(--muted); font-size: .8rem; white-space: nowrap; }
