:root {
  color-scheme: light;

  --sidebar-w: 272px;
  --content-max: 720px;
  --blue: #007aff;
  --blue-press: #0066d6;
  --green: #34c759;
  --orange: #ff9500;
  --red: #ff3b30;
  --yellow: #ffcc00;
  --bg: #f2f2f7;
  --sidebar: rgba(242, 242, 247, 0.86);
  --surface: #ffffff;
  --surface-2: #f2f2f7;
  --label: #000000;
  --secondary: rgba(60, 60, 67, 0.6);
  --tertiary: rgba(60, 60, 67, 0.3);
  --separator: rgba(60, 60, 67, 0.18);
  --separator-light: rgba(60, 60, 67, 0.12);
  --fill: rgba(120, 120, 128, 0.16);
  --fill-2: rgba(120, 120, 128, 0.08);
  --row-hover: rgba(0, 0, 0, 0.04);
  --shadow-sheet: 0 10px 40px rgba(0, 0, 0, 0.18);
  --radius: 10px;
  --radius-sm: 8px;
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: ui-monospace, Menlo, Monaco, Consolas, monospace;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --blue: #0a84ff;
  --blue-press: #409cff;
  --green: #30d158;
  --orange: #ff9f0a;
  --red: #ff453a;
  --yellow: #ffd60a;
  --bg: #000000;
  --sidebar: rgba(28, 28, 30, 0.88);
  --surface: #1c1c1e;
  --surface-2: #2c2c2e;
  --label: #ffffff;
  --secondary: rgba(235, 235, 245, 0.6);
  --tertiary: rgba(235, 235, 245, 0.3);
  --separator: rgba(84, 84, 88, 0.65);
  --separator-light: rgba(84, 84, 88, 0.45);
  --fill: rgba(120, 120, 128, 0.36);
  --fill-2: rgba(120, 120, 128, 0.24);
  --row-hover: rgba(255, 255, 255, 0.06);
  --shadow-sheet: 0 10px 40px rgba(0, 0, 0, 0.5);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

html {
  height: 100%;
}

body {
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.47;
  color: var(--label);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -40px;
  z-index: 100;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--surface);
  color: var(--blue);
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  top: 12px;
}

.app {
  display: flex;
  min-height: 100dvh;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-w);
  height: 100dvh;
  padding: 12px 10px 20px;
  border-right: 0.5px solid var(--separator);
  background: var(--sidebar);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 10px 16px;
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  flex: none;
  place-items: center;
  border-radius: 9px;
  background: linear-gradient(180deg, #5ac8fa, var(--blue));
  color: #fff;
}

.brand-mark svg {
  width: 20px;
  height: 20px;
}

.brand strong {
  display: block;
  font-size: 15px;
  font-weight: 590;
  letter-spacing: -0.01em;
}

.brand span {
  display: block;
  font-size: 12px;
  color: var(--secondary);
}

.nav-search {
  margin: 0 6px 10px;
}

.nav-search input {
  width: 100%;
  height: 32px;
  padding: 0 10px 0 30px;
  border: 0;
  border-radius: 8px;
  background: var(--fill) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%238e8e93' stroke-width='1.7'%3E%3Ccircle cx='6' cy='6' r='4.2'/%3E%3Cpath d='M9.2 9.2 12 12'/%3E%3C/svg%3E")
    9px 50% no-repeat;
  color: var(--label);
  font: inherit;
  font-size: 13px;
}

.nav-search input::placeholder {
  color: var(--secondary);
}

.nav-search input:focus {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}

.nav-group {
  margin: 6px 0 2px;
  padding: 8px 12px 4px;
  color: var(--secondary);
  font-size: 11px;
  font-weight: 590;
}

.nav a {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 32px;
  padding: 4px 10px;
  border-radius: 6px;
  color: var(--label);
  font-size: 13px;
  font-weight: 400;
  text-decoration: none;
}

.nav a:hover {
  background: var(--row-hover);
}

.nav a[aria-current="page"] {
  background: var(--fill);
  font-weight: 590;
}

.nav .icon {
  display: grid;
  width: 22px;
  height: 22px;
  flex: none;
  place-items: center;
  border-radius: 5px;
  color: #fff;
}

.nav .icon svg {
  width: 13px;
  height: 13px;
}

.icon-blue { background: var(--blue); }
.icon-green { background: var(--green); }
.icon-orange { background: var(--orange); }
.icon-purple { background: #af52de; }
.icon-gray { background: #8e8e93; }
.icon-teal { background: #64d2ff; color: #00344d; }
.icon-red { background: var(--red); }
.icon-yellow { background: var(--yellow); color: #3a2f00; }
.icon-indigo { background: #5856d6; }

.nav-progress {
  margin-top: auto;
  padding: 12px 10px 4px;
  color: var(--secondary);
  font-size: 12px;
}

.theme-switch {
  display: flex;
  gap: 2px;
  margin: 0 0 12px;
  padding: 2px;
  border-radius: 8px;
  background: var(--fill);
}

.theme-switch button {
  flex: 1;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--secondary);
  font: inherit;
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
}

.theme-switch button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--label);
  font-weight: 590;
  box-shadow: 0 0.5px 2px rgba(0, 0, 0, 0.12);
}

.progress-bar {
  height: 4px;
  margin: 6px 0 4px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--fill);
}

.progress-bar > span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--green);
}

.site-footer {
  margin-top: 10px;
  padding: 10px 10px 2px;
  border-top: 0.5px solid var(--separator-light);
  color: var(--tertiary);
  font-size: 11px;
  line-height: 1.5;
}

.site-footer p {
  margin: 0 0 4px;
}

.site-footer a {
  color: var(--secondary);
}

.site-footer a:hover {
  color: var(--blue);
}

.menu-btn,
.close-nav {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: var(--fill);
  color: var(--label);
  cursor: pointer;
}

.content {
  flex: 1;
  min-width: 0;
  padding: 28px 36px 80px;
}

.page {
  max-width: var(--content-max);
}

.page[hidden] {
  display: none !important;
}

.kicker {
  margin: 0 0 6px;
  color: var(--secondary);
  font-size: 13px;
  font-weight: 400;
}

h1 {
  margin: 0 0 8px;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.lead {
  margin: 0 0 22px;
  max-width: 40em;
  color: var(--secondary);
  font-size: 17px;
}

h2 {
  margin: 28px 0 10px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 590;
}

p {
  margin: 0 0 12px;
}

p:last-child {
  margin-bottom: 0;
}

a {
  color: var(--blue);
}

h1 a,
h2 a,
h3 a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--separator);
  text-underline-offset: 3px;
}

h1 a:hover,
h2 a:hover,
h3 a:hover {
  color: var(--blue);
  text-decoration-color: var(--blue);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

.group {
  overflow: hidden;
  margin: 0 0 16px;
  border-radius: var(--radius);
  background: var(--surface);
}

.row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 11px 16px;
  min-height: 44px;
}

.row + .row {
  border-top: 0.5px solid var(--separator-light);
  margin-top: 0;
}

.row-main {
  flex: 1;
  min-width: 0;
}

.row-title {
  display: block;
  font-weight: 400;
}

.row-sub {
  display: block;
  color: var(--secondary);
  font-size: 13px;
  line-height: 1.35;
}

.chevron {
  margin-left: auto;
  align-self: center;
  color: var(--tertiary);
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: 20px;
  background: var(--fill);
  color: var(--secondary);
  font-size: 12px;
  font-weight: 590;
  white-space: nowrap;
}

.badge-blue {
  background: color-mix(in srgb, var(--blue) 16%, transparent);
  color: var(--blue);
}

.badge-green {
  background: color-mix(in srgb, var(--green) 18%, transparent);
  color: var(--green);
}

.choice-list {
  display: grid;
  gap: 10px;
  margin: 0 0 16px;
}

.choice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border: 0.5px solid transparent;
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
}

.choice:has(input:checked) {
  border-color: var(--blue);
  background: color-mix(in srgb, var(--blue) 8%, var(--surface));
}

.choice input {
  margin-top: 4px;
  accent-color: var(--blue);
}

.result {
  padding: 16px;
  border-radius: var(--radius);
  background: var(--surface);
}

.result[hidden] {
  display: none;
}

.result strong {
  display: block;
  margin-bottom: 4px;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 6px 14px;
  border: 0;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 590;
  text-decoration: none;
  cursor: pointer;
}

.btn:hover {
  background: var(--blue-press);
}

.btn-secondary {
  background: var(--fill);
  color: var(--label);
}

.btn-secondary:hover {
  background: var(--fill-2);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.flow-note {
  padding: 6px 16px 10px;
  color: var(--tertiary);
  font-size: 12px;
}

.table-wrap {
  overflow: auto;
  margin: 0 0 16px;
  border-radius: var(--radius);
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

th,
td {
  padding: 11px 14px;
  border-bottom: 0.5px solid var(--separator-light);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--secondary);
  font-size: 13px;
  font-weight: 590;
}

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

.callout {
  display: flex;
  gap: 12px;
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--surface);
}

.callout .mark {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  line-height: 22px;
  text-align: center;
}

.callout.warn .mark { background: var(--orange); }
.callout.dont .mark { background: var(--red); }
.callout.ok .mark { background: var(--green); }

.callout p {
  margin: 0;
  font-size: 15px;
}

.step {
  padding: 14px 16px 16px;
}

.step + .step {
  border-top: 0.5px solid var(--separator-light);
}

.step-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.step-head input[type="checkbox"] {
  width: 22px;
  height: 22px;
  margin-top: 1px;
  flex: none;
  accent-color: var(--green);
}

.num {
  display: grid;
  width: 22px;
  height: 22px;
  flex: none;
  place-items: center;
  border-radius: 50%;
  background: var(--fill);
  color: var(--secondary);
  font-size: 12px;
  font-weight: 700;
}

.step-head input:checked + .num {
  background: var(--green);
  color: #fff;
}

.step-title {
  font-weight: 590;
}

.step-body {
  margin: 8px 0 0 68px;
  color: var(--secondary);
  font-size: 15px;
}

.step.is-done .step-title {
  color: var(--secondary);
}

code,
.mono {
  font-family: var(--mono);
  font-size: 0.88em;
}

p code,
li code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--fill-2);
}

.pre {
  position: relative;
  margin: 10px 0;
  padding: 12px 14px 12px;
  border-radius: var(--radius-sm);
  background: #1c1c1e;
  color: #f2f2f7;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.copy {
  position: absolute;
  top: 8px;
  right: 8px;
  height: 26px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font: inherit;
  font-size: 12px;
  font-weight: 590;
  cursor: pointer;
}

.copy:hover {
  background: rgba(255, 255, 255, 0.2);
}

details {
  margin-top: 8px;
}

summary {
  color: var(--blue);
  font-size: 15px;
  cursor: pointer;
}

.checklist {
  margin: 0;
  padding: 0;
  list-style: none;
}

.checklist li {
  display: flex;
  gap: 10px;
  padding: 10px 16px;
}

.checklist li + li {
  border-top: 0.5px solid var(--separator-light);
}

.footer-note {
  margin-top: 36px;
  color: var(--tertiary);
  font-size: 12px;
}

.glossary {
  margin: 0 0 16px;
}

.glossary .row {
  display: block;
  scroll-margin-top: 16px;
}

.glossary dt.row-title {
  display: block;
  margin: 0 0 2px;
  font-weight: 590;
}

.glossary dd.row-sub {
  display: block;
  margin: 0;
  color: var(--secondary);
  font-size: 13px;
  line-height: 1.4;
}

.glossary .row:target,
.glossary .row.is-target {
  background: color-mix(in srgb, var(--blue) 10%, var(--surface));
}

.overlay {
  display: none;
}

@media (max-width: 860px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-105%);
    box-shadow: var(--shadow-sheet);
    transition: transform 0.2s ease;
  }

  body.nav-open .sidebar {
    transform: none;
  }

  .overlay {
    position: fixed;
    inset: 0;
    z-index: 15;
    background: rgba(0, 0, 0, 0.28);
  }

  body.nav-open .overlay {
    display: block;
  }

  .menu-btn,
  .close-nav {
    display: inline-flex;
  }

  .close-nav {
    margin: 0 4px 8px auto;
  }

  .content {
    padding: 16px 16px 64px;
  }

  .mobile-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    margin: 0 0 16px;
  }

  h1 {
    font-size: 28px;
  }

  .step-body {
    margin-left: 0;
  }
}

@media (min-width: 861px) {
  .mobile-bar {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

@media print {
  .sidebar,
  .menu-btn,
  .copy,
  .overlay,
  .skip-link {
    display: none !important;
  }

  .page[hidden] {
    display: block !important;
    break-before: page;
  }

  body {
    background: #fff;
    color: #000;
  }

  .pre {
    color: #000;
    background: #f2f2f7;
  }
}
