:root {
  color-scheme: light;
  --bg: #f8fafd;
  --chrome: #f1f3f4;
  --surface: #ffffff;
  --surface-2: #f8fafd;
  --text: #1f1f1f;
  --muted: #5f6368;
  --line: #dadce0;
  --link: #1a73e8;
  --link-soft: #e8f0fe;
  --note: #e8f0fe;
  --danger: #b3261e;
  --shadow: 0 1px 2px rgba(60, 64, 67, 0.18), 0 2px 6px rgba(60, 64, 67, 0.12);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111315;
  --chrome: #171a1d;
  --surface: #1b1f23;
  --surface-2: #22272b;
  --text: #e8eaed;
  --muted: #bdc1c6;
  --line: #3c4043;
  --link: #8ab4f8;
  --link-soft: #263850;
  --note: #22324b;
  --danger: #f28b82;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 2px 8px rgba(0, 0, 0, 0.26);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: "Pretendard", "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  font-size: 16px;
  line-height: 1.7;
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: #fff;
  background: var(--link);
  font-size: 13px;
  font-weight: 800;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--link);
  background: var(--surface);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.theme-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: currentColor;
}

.docs-layout {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr) 220px;
  min-height: calc(100vh - 56px);
}

.left-nav {
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  padding: 24px 8px 24px 16px;
  border-right: 1px solid var(--line);
  background: var(--chrome);
  overflow-y: auto;
}

.filter {
  display: block;
  margin: 0 8px 18px;
}

.filter span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
}

.filter input {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text);
  background: var(--surface);
  outline: none;
}

.filter input:focus {
  border-color: var(--link);
}

.nav-groups {
  display: grid;
  gap: 20px;
}

.nav-group {
  display: grid;
  gap: 2px;
}

.nav-group strong {
  padding: 8px;
  color: var(--muted);
  font-size: 13px;
}

.nav-group a {
  padding: 7px 10px 7px 18px;
  border-radius: 0 18px 18px 0;
  color: var(--muted);
  font-size: 14px;
}

.nav-group a:hover,
.nav-group a.active {
  color: var(--link);
  background: var(--link-soft);
}

.nav-hidden {
  display: none;
}

.doc-main {
  min-width: 0;
  padding: 32px 28px 64px;
}

.doc-card {
  max-width: 936px;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 40px 40px 0;
  color: var(--muted);
  font-size: 13px;
}

.breadcrumbs a {
  color: var(--link);
}

.doc-header {
  padding: 18px 40px 24px;
}

.title-row {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  justify-content: space-between;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(34px, 5vw, 48px);
  line-height: 1.15;
  letter-spacing: -0.045em;
}

h2 {
  margin-bottom: 12px;
  font-size: 28px;
  line-height: 1.28;
  letter-spacing: -0.03em;
}

h3 {
  margin: 28px 0 10px;
  font-size: 20px;
}

p {
  margin-bottom: 14px;
}

.chip {
  display: inline-flex;
  padding: 3px 9px;
  border-radius: 999px;
  color: var(--link);
  background: var(--link-soft);
  font-size: 12px;
  font-weight: 700;
}

.feedback {
  flex: 0 0 auto;
  margin-top: 6px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--link);
  font-weight: 700;
}

.doc-header p,
.doc-section p,
li,
dd {
  color: var(--text);
}

.note {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  padding: 14px 40px;
  color: #174ea6;
  background: var(--note);
}

:root[data-theme="dark"] .note {
  color: #d2e3fc;
}

.note strong {
  color: inherit;
}

.doc-section {
  padding: 44px 40px;
  border-top: 1px solid var(--line);
  scroll-margin-top: 76px;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 700px;
  border-collapse: collapse;
}

th,
td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  background: var(--surface-2);
  font-weight: 700;
}

tr:last-child td {
  border-bottom: 0;
}

.danger td {
  color: var(--danger);
  font-weight: 700;
}

.definition-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0 8px;
}

.definition-grid div {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

dt {
  margin-bottom: 6px;
  color: var(--text);
  font-weight: 800;
}

dd {
  margin: 0;
}

ul {
  margin: 0;
  padding-left: 22px;
}

li {
  margin: 7px 0;
}

.rows,
.command-list {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.rows p,
.command-list p {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.rows span,
.command-list span {
  color: var(--muted);
  text-align: right;
}

code {
  padding: 2px 6px;
  border-radius: 5px;
  color: var(--link);
  background: var(--link-soft);
  font-family: "D2Coding", "Cascadia Code", "Consolas", monospace;
  font-weight: 700;
}

.right-toc {
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  padding: 32px 20px;
  border-left: 1px solid var(--line);
  background: var(--bg);
}

.right-toc strong {
  display: block;
  margin-bottom: 10px;
  font-size: 13px;
}

.right-toc a {
  display: block;
  padding: 5px 0 5px 12px;
  border-left: 2px solid transparent;
  color: var(--muted);
  font-size: 13px;
}

.right-toc a:hover,
.right-toc a.active {
  border-left-color: var(--link);
  color: var(--link);
}

@media (max-width: 1180px) {
  .docs-layout {
    grid-template-columns: 250px minmax(0, 1fr);
  }

  .right-toc {
    display: none;
  }
}

@media (max-width: 820px) {
  .docs-layout {
    grid-template-columns: 1fr;
  }

  .left-nav {
    position: static;
    height: auto;
    padding: 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav-groups {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .nav-group {
    min-width: 170px;
  }

  .doc-main {
    padding: 18px 12px 40px;
  }

  .breadcrumbs,
  .doc-header,
  .doc-section {
    padding-left: 20px;
    padding-right: 20px;
  }

  .note {
    padding-left: 20px;
    padding-right: 20px;
  }

  .definition-grid {
    grid-template-columns: 1fr;
  }

  .rows p,
  .command-list p,
  .title-row {
    flex-direction: column;
  }

  .rows span,
  .command-list span {
    text-align: left;
  }
}
