:root {
  color-scheme: light;
  --bg: #f7f5ef;
  --panel: #ffffff;
  --text: #171717;
  --muted: #5f5f5f;
  --line: #e8e2d4;
  --line-strong: #d8c79f;
  --gold: #b68a2b;
  --gold-soft: #fbf4df;
  --shadow: 0 12px 28px rgba(23, 23, 23, 0.06);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(182, 138, 43, 0.05) 0, transparent 36%),
    var(--bg);
}

body.is-preview-open {
  overflow: hidden;
}

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

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

.guide-shell {
  min-height: 100vh;
}

.guide-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  min-height: 72px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
}

.guide-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.guide-brand__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #171717;
  color: #f7d77a;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.guide-brand strong {
  display: block;
  color: var(--text);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.guide-brand small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.guide-layout {
  display: grid;
  grid-template-columns: 312px minmax(0, 1fr);
  gap: 22px;
  width: min(100%, 1240px);
  margin: 0 auto;
  padding: 24px;
}

.guide-nav,
.guide-article {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.guide-nav {
  position: sticky;
  top: 96px;
  align-self: start;
  max-height: calc(100vh - 120px);
  overflow: auto;
  padding: 18px;
}

.guide-nav__title {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.guide-nav__title span {
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
}

.guide-nav__group {
  padding-top: 18px;
}

.guide-nav__group h2 {
  margin-bottom: 6px;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.guide-nav__group p {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.guide-nav__items {
  display: grid;
  gap: 4px;
}

.guide-nav__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  color: #343434;
  font-size: 14px;
  transition:
    background 0.18s ease,
    color 0.18s ease,
    border-color 0.18s ease;
}

.guide-nav__link:hover,
.guide-nav__link:focus-visible {
  outline: 2px solid rgba(182, 138, 43, 0.32);
  outline-offset: 2px;
  background: var(--gold-soft);
  color: var(--text);
}

.guide-nav__link--active {
  background: #171717;
  color: #ffffff;
}

.guide-nav__link--active em {
  color: #f7d77a;
}

.guide-nav__link em {
  flex: 0 0 auto;
  color: var(--gold);
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

.guide-article {
  min-height: calc(100vh - 120px);
  padding: 42px;
}

.guide-article__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.guide-article__meta span {
  padding: 5px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--gold-soft);
  color: #7b5c1d;
  font-size: 12px;
  font-weight: 800;
}

.guide-article h1 {
  max-width: 820px;
  margin-bottom: 14px;
  color: var(--text);
  font-size: clamp(32px, 5vw, 52px);
  line-height: 1.05;
  letter-spacing: -0.045em;
}

.guide-article__summary {
  max-width: 760px;
  margin-bottom: 34px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.85;
}

.guide-section {
  padding: 24px 0;
  border-top: 1px solid var(--line);
}

.guide-section h2,
.guide-related h2 {
  margin-bottom: 12px;
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.guide-section p,
.guide-steps,
.guide-list {
  color: #444444;
  font-size: 15px;
  line-height: 1.9;
}

.guide-steps,
.guide-list {
  margin: 0;
  padding-left: 22px;
}

.guide-steps li + li,
.guide-list li + li {
  margin-top: 8px;
}

.guide-code-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.guide-code-list code {
  display: inline-flex;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--gold-soft);
  color: #6f5018;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 14px;
}

.guide-empty {
  padding: 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: #fffdf7;
  color: var(--muted);
  font-size: 14px;
}

.guide-image-grid {
  display: grid;
  gap: 16px;
}

.guide-figure {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffdf7;
}

.guide-figure__preview {
  position: relative;
  display: block;
  width: 100%;
  max-height: 420px;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: #ffffff;
  cursor: zoom-in;
}

.guide-figure__preview img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 420px;
  object-fit: contain;
  object-position: top center;
  background: #ffffff;
}

.guide-figure__preview span {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(23, 23, 23, 0.82);
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
}

.guide-figure__preview:hover,
.guide-figure__preview:focus-visible {
  outline: 2px solid rgba(182, 138, 43, 0.42);
  outline-offset: -2px;
}

.guide-figure figcaption {
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.guide-related {
  margin-top: 20px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.guide-related__actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.guide-related__actions a,
.guide-related__actions span,
.guide-mobile-actions a,
.guide-mobile-actions button,
.guide-mobile-actions span {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 800;
}

.guide-related__actions a,
.guide-related__actions span {
  padding: 14px;
}

.guide-related__actions a:hover,
.guide-related__actions a:focus-visible,
.guide-mobile-actions a:hover,
.guide-mobile-actions a:focus-visible,
.guide-mobile-actions button:hover,
.guide-mobile-actions button:focus-visible {
  outline: 2px solid rgba(182, 138, 43, 0.35);
  outline-offset: 2px;
  background: var(--gold-soft);
}

.guide-related__actions span,
.guide-mobile-actions span {
  color: #a1a1a1;
}

.guide-mobile-actions {
  display: none;
}

.image-preview {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
}

.image-preview__backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.72);
  cursor: zoom-out;
}

.image-preview__panel {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 10px;
  width: min(100%, 1120px);
  max-height: calc(100vh - 36px);
  padding: 14px;
  overflow: auto;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

.image-preview__panel img {
  display: block;
  width: 100%;
  height: auto;
  max-height: calc(100vh - 140px);
  object-fit: contain;
  background: #ffffff;
}

.image-preview__panel p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.image-preview__close {
  justify-self: end;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--gold-soft);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.image-preview__close:focus-visible {
  outline: 2px solid rgba(182, 138, 43, 0.42);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}

@media (max-width: 860px) {
  .guide-header {
    position: static;
    padding: 14px;
  }

  .guide-layout {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .guide-nav {
    position: static;
    max-height: none;
  }

  .guide-nav__items {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .guide-article {
    min-height: auto;
    padding: 24px 22px 86px;
  }

  .guide-figure__preview,
  .guide-figure__preview img {
    max-height: 320px;
  }

  .image-preview {
    padding: 10px;
  }

  .image-preview__panel {
    max-height: calc(100vh - 20px);
    padding: 10px;
  }

  .image-preview__panel img {
    max-height: calc(100vh - 120px);
  }

  .guide-mobile-actions {
    position: fixed;
    right: 14px;
    bottom: 14px;
    left: 14px;
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 14px 36px rgba(23, 23, 23, 0.16);
    backdrop-filter: blur(12px);
  }

  .guide-mobile-actions a,
  .guide-mobile-actions button,
  .guide-mobile-actions span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 10px;
    text-align: center;
    cursor: pointer;
  }
}

@media (max-width: 560px) {
  .guide-brand {
    align-items: flex-start;
  }

  .guide-brand__mark {
    width: 38px;
    height: 38px;
    font-size: 12px;
  }

  .guide-brand strong {
    font-size: 15px;
    line-height: 1.35;
  }

  .guide-nav__items {
    grid-template-columns: 1fr;
  }

  .guide-article h1 {
    font-size: 30px;
  }

  .guide-related__actions {
    grid-template-columns: 1fr;
  }
}
