:root {
  color-scheme: light;
  --bg: #f7f5ef;
  --panel: #ffffff;
  --text: #232323;
  --muted: #68645d;
  --line: #ded9cf;
  --accent: #236a62;
  --accent-weak: #e3f0ed;
  --focus: #c36b2c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

button {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-right: 1px solid var(--line);
  background: #fbfaf6;
  padding: 24px 18px;
  transition: padding 180ms ease;
}

.brand {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
  transition: grid-template-columns 180ms ease, padding-bottom 180ms ease;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border: 2px solid var(--accent);
  color: var(--accent);
  font-weight: 800;
  letter-spacing: 0;
  transition: width 180ms ease, height 180ms ease, font-size 180ms ease;
}

.brand h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
}

.brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.nav {
  margin-top: 22px;
  transition: margin-top 180ms ease;
}

.mobile-breadcrumb {
  display: none;
}

.nav-label {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
}

.nav-label-spaced {
  margin-top: 22px;
}

.section-list {
  display: grid;
  gap: 6px;
}

.section-button {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  padding: 10px 12px;
  text-align: left;
  line-height: 1.3;
}

.section-button:hover,
.section-button:focus-visible {
  outline: 2px solid transparent;
  background: var(--accent-weak);
}

.section-button.active {
  background: var(--accent);
  color: #ffffff;
}

body.is-scrolled .sidebar {
  padding-top: 12px;
  padding-bottom: 14px;
}

body.is-scrolled .brand {
  grid-template-columns: 40px minmax(0, 1fr);
  padding-bottom: 12px;
}

body.is-scrolled .brand-mark {
  width: 40px;
  height: 40px;
  font-size: 14px;
}

body.is-scrolled .brand h1 {
  font-size: 18px;
}

body.is-scrolled .brand p {
  margin-top: 2px;
  font-size: 12px;
}

body.is-scrolled .nav {
  margin-top: 12px;
}

.content {
  min-width: 0;
  padding: 28px clamp(18px, 4vw, 56px) 48px;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.status {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
}

.toolbar h2 {
  margin: 0;
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.2;
  letter-spacing: 0;
}

#refresh-button {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  padding: 9px 14px;
}

#refresh-button:hover,
#refresh-button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.document-view {
  max-width: 880px;
  padding-top: 28px;
  font-size: 17px;
  line-height: 1.85;
}

.document-view h1,
.document-view h2,
.document-view h3 {
  line-height: 1.35;
  letter-spacing: 0;
}

.document-view h1 {
  margin: 0 0 20px;
  font-size: 30px;
}

.document-view h2 {
  margin: 30px 0 10px;
  font-size: 22px;
}

.document-view h3 {
  margin: 24px 0 8px;
  font-size: 18px;
}

.document-view p {
  margin: 0 0 14px;
}

.document-view ul,
.document-view ol {
  padding-left: 1.4em;
}

.document-view code {
  background: #eee9dd;
  padding: 0.1em 0.3em;
}

.change-log-list {
  display: grid;
  gap: 18px;
}

.change-log-entry {
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 18px;
}

.change-log-entry h3 {
  margin-top: 0;
}

.change-log-meta {
  display: grid;
  gap: 6px;
  margin: 10px 0 14px;
  color: var(--muted);
  font-size: 14px;
}

.file-list {
  margin-bottom: 0;
}

.error {
  border-left: 4px solid #a33b2f;
  background: #fff4f1;
  padding: 14px 16px;
}

@media (max-width: 760px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    z-index: 20;
    height: auto;
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 8px 18px rgb(0 0 0 / 0.08);
    padding: 12px 14px;
    transition: padding 180ms ease;
  }

  .brand {
    grid-template-columns: 40px minmax(0, 1fr);
    padding-bottom: 10px;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
    font-size: 14px;
  }

  .brand h1 {
    font-size: 18px;
  }

  .brand p {
    font-size: 12px;
  }

  .mobile-breadcrumb {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding-top: 10px;
  }

  .breadcrumb-path {
    display: flex;
    min-width: 0;
    gap: 7px;
    align-items: center;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.35;
  }

  .breadcrumb-path strong {
    min-width: 0;
    overflow: hidden;
    color: var(--text);
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #mobile-nav-toggle {
    flex: 0 0 auto;
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--text);
    cursor: pointer;
    padding: 7px 11px;
  }

  #mobile-nav-toggle:hover,
  #mobile-nav-toggle:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
  }

  .nav {
    display: none;
    max-height: calc(100vh - 128px);
    overflow-y: auto;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
  }

  body.is-mobile-nav-open .nav {
    display: block;
  }

  body.is-scrolled .sidebar {
    padding-top: 8px;
    padding-bottom: 8px;
  }

  body.is-scrolled .brand {
    display: none;
  }

  body.is-scrolled .mobile-breadcrumb {
    padding-top: 0;
  }

  .toolbar {
    align-items: flex-start;
  }

  .document-view {
    font-size: 16px;
  }
}
