:root {
  color-scheme: light dark;
  --bg: #f7f4ee;
  --panel: #fffdf8;
  --text: #1f2933;
  --muted: #667085;
  --line: #d9d2c3;
  --accent: #0f766e;
  --accent-strong: #134e4a;
  --shadow: 0 12px 32px rgba(42, 32, 18, 0.08);
  font-family: ui-serif, "Songti SC", "Noto Serif CJK SC", Georgia, serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px clamp(18px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.78rem;
  font-family: ui-sans-serif, system-ui, sans-serif;
  text-transform: uppercase;
}

h1, h2, h3, h4 { line-height: 1.25; letter-spacing: 0; }
h1, h2, h3, h4, p, li, a, .case-card {
  overflow-wrap: anywhere;
}
h1 { margin: 0; font-size: clamp(1.6rem, 4vw, 2.8rem); }
h2 { margin-top: 0; font-size: 1.2rem; }
h3 { margin-top: 2rem; font-size: 1.35rem; }
h4 { margin-bottom: 0.35rem; font-size: 1.05rem; }
p { margin: 0.6rem 0 1rem; }

.download-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.download-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

a {
  color: var(--accent-strong);
  text-decoration: none;
}

.download-links a,
.download-inline a,
.bottom-nav a,
.chips button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  background: #ffffff;
  color: var(--accent-strong);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.92rem;
}

.layout {
  display: grid;
  grid-template-columns: minmax(180px, 250px) minmax(0, 1fr) minmax(240px, 320px);
  gap: 24px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px clamp(14px, 3vw, 32px) 72px;
}

.sidebar,
.tools {
  position: sticky;
  top: 16px;
  align-self: start;
  max-height: calc(100vh - 32px);
  overflow: auto;
}

.sidebar,
.tools section,
.reader {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.sidebar,
.tools section {
  padding: 18px;
  border-radius: 8px;
}

.sidebar nav {
  display: grid;
  gap: 8px;
}

.sidebar a {
  display: block;
  padding: 8px 0;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.94rem;
}

.reader {
  min-width: 0;
  border-radius: 8px;
  padding: clamp(20px, 4vw, 52px);
  font-size: 1.05rem;
}

.reader section {
  padding: 18px 0 28px;
  border-bottom: 1px solid var(--line);
}

.reader ul,
.reader ol {
  padding-left: 1.3rem;
}

.tools {
  display: grid;
  gap: 16px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.chips button[aria-pressed="true"] {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.case-list {
  display: grid;
  gap: 12px;
}

.case-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.case-card p {
  margin: 0.35rem 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.tag-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.tag {
  border-radius: 999px;
  padding: 2px 8px;
  background: #e6f4f1;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-family: ui-sans-serif, system-ui, sans-serif;
}

.checklists ul {
  padding-left: 1.1rem;
}

.bottom-nav {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171717;
    --panel: #20201e;
    --text: #ece7dc;
    --muted: #b5aa9a;
    --line: #3d3931;
    --accent: #5eead4;
    --accent-strong: #99f6e4;
    --shadow: none;
  }
  .download-links a,
  .bottom-nav a,
  .chips button,
  .case-card {
    background: #262622;
  }
  .tag {
    background: #134e4a;
    color: #ccfbf1;
  }
}

@media (max-width: 1020px) {
  .layout {
    grid-template-columns: minmax(170px, 220px) minmax(0, 1fr);
  }
  .tools {
    grid-column: 1 / -1;
    position: static;
    max-height: none;
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 760px) {
  .topbar {
    display: block;
    padding-bottom: 16px;
  }
  .download-links {
    margin-top: 14px;
  }
  .download-inline a {
    width: 100%;
  }
  .layout {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 14px 12px 88px;
  }
  .sidebar,
  .tools {
    position: static;
    max-height: none;
  }
  .sidebar nav {
    grid-template-columns: 1fr;
  }
  .tools {
    grid-template-columns: 1fr;
  }
  .reader {
    padding: 20px 16px;
    font-size: 1rem;
  }
  .bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 8px;
    background: color-mix(in srgb, var(--panel) 92%, transparent);
    border-top: 1px solid var(--line);
  }
  .bottom-nav a {
    min-width: 0;
    padding: 8px 6px;
    font-size: 0.86rem;
  }
}
