
:root {
  color-scheme: light;
  --paper: #ffffff;
  --panel: #f8fafc;
  --panel-strong: #f1f5f9;
  --text: #111827;
  --muted: #526071;
  --line: #dfe5ec;
  --line-strong: #cbd5e1;
  --blue: #2563eb;
  --green: #059669;
  --amber: #b45309;
  --red: #dc2626;
}
html[data-diagram-theme="dark"] {
  color-scheme: dark;
  --paper: #111113;
  --panel: #18181b;
  --panel-strong: #202127;
  --text: #f8fafc;
  --muted: #cbd5e1;
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.2);
  --blue: #93c5fd;
  --green: #6ee7b7;
  --amber: #fbbf24;
  --red: #fca5a5;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: transparent;
  overflow: hidden;
  letter-spacing: 0;
}
body {
  color: var(--text);
  font-family: Pretendard, "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", "Segoe UI", sans-serif;
  word-break: keep-all;
  overflow-wrap: break-word;
}
.diagram {
  width: 100%;
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius:8px;
  background: var(--paper);
}
.next-ch17-ch17-3-header {
  display: grid;
  gap: 7px;
}
.next-ch17-ch17-3-kicker {
  width: fit-content;
  padding: 3px 8px;
  border: 1px solid var(--line-strong);
  border-radius:6px;
  background: var(--panel);
  color: var(--blue);
  font-size:12px;
  font-weight: 800;
}
h1, h2, h3, p { margin: 0; }
h1 {
  font-size:24px;
  line-height: 1.25;
}
h2 {
  font-size:15px;
  line-height: 1.35;
}
p, span, li, td, th {
  font-size:13px;
  line-height: 1.52;
}
.next-ch17-ch17-3-lead, .muted, td span {
  color: var(--muted);
}
.grid {
  display: grid;
  gap: 10px;
}
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card, .step, .note, .next-ch17-ch17-3-table-wrap {
  border: 1px solid var(--line);
  border-radius:8px;
  background: var(--paper);
}
.card, .step, .note {
  display: grid;
  gap: 7px;
  padding: 11px;
}
.panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius:8px;
  background: var(--panel);
}
.badge {
  width: fit-content;
  padding: 2px 7px;
  border-radius:6px;
  border: 1px solid var(--line-strong);
  background: var(--panel-strong);
  color: var(--green);
  font-size:12px;
  font-weight: 800;
}
.num {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius:6px;
  background: var(--panel);
  color: var(--blue);
  font-size:12px;
  font-weight: 850;
}
.sequence {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.sequence .step {
  align-content: start;
}
.path {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}
.path .step {
  min-height: 104px;
}
table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
th, td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
th {
  background: var(--panel);
  color: var(--text);
  font-size:13px;
}
tr:last-child td { border-bottom: 0; }
.ok { color: var(--green); font-weight: 800; }
.warn { color: var(--amber); font-weight: 800; }
.bad { color: var(--red); font-weight: 800; }
.code {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius:7px;
  background: var(--panel);
  color: var(--text);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size:12px;
  line-height: 1.5;
  white-space: pre-wrap;
}
@media (max-width: 720px) {
  .diagram { padding: 12px; gap: 12px; }
  h1 { font-size:21px; }
  .cols-2, .cols-3, .cols-4, .sequence, .path {
    grid-template-columns: minmax(0, 1fr);
  }
  .path .step { min-height: 0; }
  table, thead, tbody, tr, th, td { display: block; }
  thead { display: none; }
  tr {
    border-bottom: 1px solid var(--line);
    padding: 8px 0;
  }
  tr:last-child { border-bottom: 0; }
  td {
    border-bottom: 0;
    padding: 5px 10px;
  }
  td::before {
    content: attr(data-label);
    display: block;
    color: var(--muted);
    font-size:12px;
    font-weight: 800;
    margin-bottom: 2px;
  }
}
