:root {
  color-scheme: light;
  --bg: #f7f4ed;
  --paper: #fffdf8;
  --ink: #191713;
  --muted: #665f54;
  --line: #ded5c8;
  --accent: #6f3f19;
  --accent-soft: #f2e5d7;
  --sidebar: #f1eadf;
  --shadow: 0 16px 34px rgba(38, 28, 17, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans CJK SC", "Microsoft YaHei", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.68;
}

a {
  color: var(--accent);
  text-decoration: none;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover,
a:focus {
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

.top-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 10px 14px;
  background: rgba(247, 244, 237, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.top-nav a {
  flex: 0 0 auto;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-weight: 650;
  text-decoration: none;
}

.top-nav a.active,
.top-nav a:active,
.top-nav a:focus,
.top-nav a:hover {
  background: var(--accent-soft);
  text-decoration: none;
  outline: 2px solid rgba(111, 63, 25, 0.24);
}

.layout {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 16px 34px;
}

.side-nav {
  display: none;
}

.content {
  max-width: 980px;
  margin: 0 auto;
}

.breadcrumbs {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

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

h1,
h2,
h3,
h4,
h5,
h6 {
  line-height: 1.25;
  scroll-margin-top: 92px;
}

h1 {
  margin: 22px 0 16px;
  font-size: 2rem;
}

h2 {
  margin-top: 38px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 1.55rem;
}

h3 {
  margin-top: 30px;
  font-size: 1.28rem;
}

h4 {
  margin-top: 22px;
  font-size: 1.1rem;
}

table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  -webkit-overflow-scrolling: touch;
  margin: 12px 0 22px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
}

th,
td {
  min-width: 88px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  vertical-align: top;
}

th {
  background: var(--accent-soft);
  text-align: left;
}

blockquote {
  margin: 16px 0;
  padding: 8px 14px;
  border-left: 4px solid var(--line);
  background: rgba(255, 255, 255, 0.45);
  color: var(--muted);
}

pre,
code {
  font-family: "Cascadia Mono", Consolas, "Liberation Mono", monospace;
}

pre {
  overflow-x: auto;
  padding: 12px;
  border-radius: 8px;
  background: #24211c;
  color: #fffaf0;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin: 20px 0 28px;
}

.category-card,
.page-list a,
.group-list a {
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
}

.category-card {
  padding: 14px;
}

.category-card strong {
  display: block;
  margin-bottom: 4px;
  font-size: 1.08rem;
}

.category-card span,
.meta {
  color: var(--muted);
}

.page-list,
.group-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
  margin: 14px 0 24px;
}

.page-list a,
.group-list a {
  padding: 9px 11px;
}

.category-card:hover,
.category-card:focus,
.page-list a:hover,
.page-list a:focus,
.group-list a:hover,
.group-list a:focus {
  background: var(--accent-soft);
  text-decoration: none;
  outline: 2px solid rgba(111, 63, 25, 0.18);
}

.boss-list-icon {
  filter: brightness(0) contrast(1.18);
}

@media (max-width: 640px) {
  body {
    font-size: 15px;
  }

  .layout {
    padding-left: 14px;
    padding-right: 14px;
  }

  h1 {
    font-size: 1.62rem;
  }

  h2 {
    font-size: 1.34rem;
  }

  h3 {
    font-size: 1.16rem;
  }

  th,
  td {
    min-width: 82px;
    padding: 7px 8px;
  }
}

@media (min-width: 1100px) {
  body {
    font-size: 17px;
  }

  .top-nav {
    margin-left: 300px;
    flex-wrap: wrap;
    overflow-x: visible;
    padding-left: 24px;
    padding-right: 24px;
  }

  .layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 34px;
    max-width: none;
    margin: 0;
    padding-left: 0;
    padding-right: 34px;
  }

  .side-nav {
    position: sticky;
    top: 0;
    display: block;
    height: 100vh;
    padding: 24px 20px 32px;
    overflow-y: auto;
    background: var(--sidebar);
    border-right: 1px solid var(--line);
  }

  .side-nav .brand {
    display: block;
    margin-bottom: 14px;
    color: var(--ink);
    font-size: 1.16rem;
    font-weight: 800;
    text-decoration: none;
  }

  .side-nav ul {
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .side-nav a {
    display: block;
    padding: 7px 8px;
    border-radius: 8px;
    color: var(--muted);
    text-decoration: none;
  }

  .side-nav a.active,
  .side-nav a:hover,
  .side-nav a:focus {
    background: var(--accent-soft);
    color: var(--accent);
    text-decoration: none;
    outline: none;
  }

  .content {
    width: min(calc(100vw - 360px), 1180px);
    max-width: 1180px;
    margin: 0;
  }

  h1 {
    margin-top: 36px;
    font-size: 2.42rem;
  }

  h2 {
    font-size: 1.8rem;
  }

  th,
  td {
    min-width: 110px;
  }
}
