:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --text: #16191f;
  --muted: #5f6b7a;
  --border: #e3e6eb;
  --accent: #ff9900;
  --accent-ink: #b36b00;
  --link: #0972d3;
  --note-bg: #eef6ff;
  --note-border: #9cc7f5;
  --warn-bg: #fff6e6;
  --warn-border: #f2c26b;
  --code-bg: #f1f3f5;
  --shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 4px 16px rgba(0, 0, 0, .05);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1216;
    --surface: #171b21;
    --text: #e8ebef;
    --muted: #9aa5b1;
    --border: #2a313a;
    --accent: #ffad33;
    --accent-ink: #ffc266;
    --link: #6cb4ff;
    --note-bg: #13243a;
    --note-border: #2d5a8c;
    --warn-bg: #2c2312;
    --warn-border: #7a5a1e;
    --code-bg: #222831;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  }
}
:root[data-theme="dark"] {
  --bg: #0f1216; --surface: #171b21; --text: #e8ebef; --muted: #9aa5b1; --border: #2a313a;
  --accent: #ffad33; --accent-ink: #ffc266; --link: #6cb4ff; --note-bg: #13243a; --note-border: #2d5a8c;
  --warn-bg: #2c2312; --warn-border: #7a5a1e; --code-bg: #222831; --shadow: 0 1px 2px rgba(0, 0, 0, .4);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 16px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  line-height: 1.7;
  font-size: 16px;
  word-break: keep-all;
}
a { color: var(--link); }
code {
  background: var(--code-bg);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: .92em;
  word-break: break-all;
}

.wrap { max-width: 880px; margin: 0 auto; padding: 0 16px; }

header.top {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
header.top .wrap { display: flex; align-items: center; justify-content: space-between; height: 60px; }
header.top a.brand {
  display: flex; align-items: center; gap: 12px;
  color: var(--accent-ink); text-decoration: none; font-weight: 700; font-size: 15px;
}
header.top a.brand img.logo { display: block; height: 34px; width: auto; }
header.top a.brand .divider { width: 1px; height: 20px; background: var(--border); }
/* The logo is black on transparent; flip it to white on dark backgrounds */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) header.top a.brand img.logo { filter: invert(1); }
}
:root[data-theme="dark"] header.top a.brand img.logo { filter: invert(1); }

.hero { padding: 40px 0 16px; }
.hero h1 { font-size: 30px; line-height: 1.3; margin: 0 0 8px; }
.hero p { color: var(--muted); margin: 0; }

nav.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  margin: 24px 0;
}
nav.toc strong { display: block; margin-bottom: 4px; }
nav.toc ol { margin: 0; padding-left: 20px; }

section.chapter {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px 24px 8px;
  margin: 24px 0;
  box-shadow: var(--shadow);
}
section.chapter > h2 { margin: 0 0 4px; font-size: 22px; display: flex; gap: 10px; align-items: center; }
section.chapter > h2 .num {
  display: inline-grid; place-items: center;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent); color: #16191f; font-size: 15px; flex: none;
}
section.chapter > p.lead { color: var(--muted); margin-top: 0; }

ol.steps { list-style: none; counter-reset: step; padding: 0; margin: 16px 0; }
ol.steps > li { counter-increment: step; position: relative; padding-left: 40px; margin-bottom: 24px; }
ol.steps > li::before {
  content: counter(step);
  position: absolute; left: 0; top: 1px;
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
}

figure.shot { margin: 12px 0 4px; }
figure.shot img {
  display: block; width: 100%; height: auto;
  border: 1px solid var(--border); border-radius: 10px;
  background: #fff;
}
figure.shot figcaption { color: var(--muted); font-size: 14px; margin-top: 6px; }
figure.shot.pending img { display: none; }
figure.shot.pending::before {
  content: "스크린샷 준비 중";
  display: grid; place-items: center; height: 160px;
  border: 1px dashed var(--border); border-radius: 10px; color: var(--muted);
}

.note, .warn {
  border-radius: 10px; padding: 12px 16px; margin: 12px 0 20px; font-size: 15px;
}
.note { background: var(--note-bg); border: 1px solid var(--note-border); }
.warn { background: var(--warn-bg); border: 1px solid var(--warn-border); }
.note p, .warn p { margin: 0; }

table.kv { border-collapse: collapse; width: 100%; margin: 12px 0 20px; font-size: 15px; }
table.kv th, table.kv td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; vertical-align: top; }
table.kv th { background: var(--code-bg); width: 34%; font-weight: 600; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin: 24px 0 48px; }
.card {
  display: block; text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 20px; box-shadow: var(--shadow); transition: border-color .15s, transform .15s;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card .tag { font-size: 12px; color: var(--accent-ink); font-weight: 700; letter-spacing: .02em; }
.card h3 { margin: 6px 0; font-size: 18px; }
.card p { margin: 0; color: var(--muted); font-size: 14px; }

details.faq { border-top: 1px solid var(--border); padding: 12px 0; }
details.faq summary { cursor: pointer; font-weight: 600; }

footer { color: var(--muted); font-size: 13px; padding: 32px 0 48px; text-align: center; }

@media (max-width: 600px) {
  header.top a.brand img.logo { height: 24px; }
  header.top a.brand { gap: 10px; font-size: 14px; }
  .hero h1 { font-size: 24px; }
  section.chapter { padding: 18px 16px 4px; }
  ol.steps > li { padding-left: 34px; }
  table.kv th { width: 40%; }
}
