:root {
  color-scheme: light;
  --brand: #e5484d;
  --brand-dark: #b83237;
  --brand-soft: #fff1f1;
  --ink: #1d252d;
  --muted: #66717d;
  --line: #e5e8eb;
  --canvas: #f5f6f7;
  --panel: #ffffff;
  --soft: #f7f8f9;
  --shadow: 0 12px 34px rgba(28, 35, 43, 0.07);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font: 15px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}
a { color: var(--brand-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input { font: inherit; }
button { color: inherit; }

.layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 250px minmax(820px, 1fr);
  max-width: 1540px;
  margin: 0 auto;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 22px;
  overflow: auto;
  border-right: 1px solid var(--line);
  background: var(--panel);
}
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: white;
  background: linear-gradient(145deg, #f15d62, var(--brand-dark));
  box-shadow: 0 8px 20px rgba(229, 72, 77, 0.24);
  font-size: 22px;
  font-weight: 800;
}
.brand strong,
.brand small { display: block; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 12px; }
.version-picker { position: relative; }
.version-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border: 1px solid #f1c8ca;
  border-radius: 14px;
  color: var(--ink);
  background: var(--brand-soft);
  text-align: left;
  cursor: pointer;
}
.version-trigger:hover, .version-trigger:focus-visible { border-color: var(--brand); outline: none; }
.version-trigger-copy small, .version-trigger-copy strong { display: block; }
.version-trigger-copy small { color: var(--brand-dark); font-size: 11px; font-weight: 750; }
.version-trigger-copy strong { margin-top: 2px; font-size: 17px; }
.version-chevron { color: var(--brand-dark); font-size: 20px; transition: transform 0.18s ease; }
.version-picker.open .version-chevron { transform: rotate(180deg); }
.version-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 8px);
  right: 0;
  left: 0;
  display: grid;
  gap: 3px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 14px 34px rgba(28, 35, 43, 0.14);
}
.version-menu[hidden] { display: none; }
.version-menu a { display: flex; align-items: center; justify-content: space-between; padding: 9px 10px; border-radius: 8px; color: var(--ink); }
.version-menu a:hover, .version-menu a.selected { color: var(--brand-dark); background: var(--brand-soft); text-decoration: none; }
.version-option-copy strong, .version-option-copy small { display: block; }
.version-option-copy small { margin-top: 1px; color: var(--muted); font-size: 11px; }
.version-check { color: var(--brand-dark); font-weight: 800; }
.module-nav { display: grid; gap: 5px; margin-top: 22px; }
.module-nav a { display: flex; align-items: center; justify-content: space-between; padding: 10px 11px; border-radius: 9px; color: var(--ink); }
.module-nav a:hover { color: var(--brand-dark); background: var(--brand-soft); text-decoration: none; }
.module-nav small { min-width: 24px; padding: 1px 6px; border-radius: 8px; color: var(--muted); background: var(--soft); text-align: center; }
.sidebar-actions { display: grid; gap: 6px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.sidebar-actions a { padding: 8px 11px; border-radius: 9px; color: var(--muted); }
.sidebar-actions a:hover { color: var(--brand-dark); background: var(--soft); text-decoration: none; }
.sidebar-note { margin: 20px 10px 0; color: var(--muted); font-size: 12px; }

.main { min-width: 0; padding: 0 40px 44px; }
.topbar {
  position: sticky;
  z-index: 10;
  top: 0;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  background: rgba(245, 246, 247, 0.94);
  backdrop-filter: blur(14px);
}
.topbar span { display: block; color: var(--brand-dark); font-size: 10px; font-weight: 800; letter-spacing: 0.12em; }
.topbar strong { display: block; margin-top: 2px; }
.topbar p { margin: 0; color: var(--muted); font-size: 12px; }

.hero {
  max-width: 1120px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 30px;
  margin: 26px auto 0;
  padding: 32px 36px;
  border: 1px solid #f0d1d2;
  border-radius: 20px;
  background: linear-gradient(135deg, #fff 0%, #fff8f8 100%);
  box-shadow: var(--shadow);
}
.hero-kicker { color: var(--brand-dark); font-size: 10px; font-weight: 800; letter-spacing: 0.12em; }
.hero h1 { margin: 7px 0 7px; font-size: 42px; line-height: 1.12; letter-spacing: -0.035em; }
.hero p { max-width: 720px; margin: 0; color: var(--muted); font-size: 16px; }
.hero dl { display: grid; grid-template-columns: repeat(3, 84px); gap: 8px; margin: 0; }
.hero dl div { padding: 13px 8px; border: 1px solid var(--line); border-radius: 13px; background: white; text-align: center; }
.hero dt { font-size: 24px; font-weight: 800; line-height: 1; }
.hero dd { margin: 7px 0 0; color: var(--muted); font-size: 11px; }

.controls {
  position: sticky;
  z-index: 8;
  top: 72px;
  max-width: 1120px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin: 22px auto 0;
  padding: 12px 0;
  background: rgba(245, 246, 247, 0.96);
  backdrop-filter: blur(12px);
}
.module-filters { display: flex; flex-wrap: wrap; gap: 7px; }
.module-filters button { padding: 8px 11px; border: 1px solid var(--line); border-radius: 9px; background: white; cursor: pointer; }
.module-filters button.active { border-color: #efbfc1; color: var(--brand-dark); background: var(--brand-soft); font-weight: 700; }
.search-box { min-width: 260px; display: grid; gap: 4px; color: var(--muted); font-size: 11px; }
.search-box input { min-height: 38px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: white; outline: none; }
.search-box input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(229, 72, 77, 0.12); }
.result-line { max-width: 1120px; display: flex; justify-content: space-between; margin: 4px auto 0; color: var(--muted); font-size: 12px; }
.result-line strong { color: var(--ink); }

#requirementsRoot { max-width: 1120px; margin: 0 auto; }
.module-section { scroll-margin-top: 142px; margin-top: 30px; }
.module-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 12px; }
.module-heading span { color: var(--brand-dark); font-size: 12px; font-weight: 800; }
.module-heading h2 { margin: 2px 0 0; font-size: 21px; line-height: 1.3; }
.module-heading > strong { color: var(--muted); font-size: 12px; }
.module-requirements { display: grid; gap: 12px; }

.requirement-card { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: white; box-shadow: 0 6px 20px rgba(28, 35, 43, 0.04); }
.requirement-card:has(.requirement-details[open]) { border-color: #efbfc1; box-shadow: 0 12px 30px rgba(28, 35, 43, 0.07); }
.requirement-header { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: start; gap: 14px; padding: 18px 20px 10px; }
.requirement-id { width: 40px; padding: 4px 0; border-radius: 8px; color: white; background: var(--brand); font-size: 12px; font-weight: 800; text-align: center; }
.requirement-header h3 { margin: 0; font-size: 19px; line-height: 1.3; }
.requirement-header p { margin: 5px 0 0; color: var(--muted); }
.requirement-header p code,
.example-block code,
.rule-row code,
.acceptance-row code { padding: 1px 5px; border-radius: 5px; color: #963237; background: #fff0f0; font: 0.9em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.acceptance-badge { padding: 4px 8px; border-radius: 8px; color: var(--brand-dark); background: var(--brand-soft); font-size: 11px; font-weight: 700; white-space: nowrap; }
.example-block { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 10px; margin: 2px 20px 16px 76px; padding: 11px 13px; border-left: 3px solid var(--brand); border-radius: 0 10px 10px 0; background: var(--soft); }
.example-block > span { color: var(--brand-dark); font-size: 12px; font-weight: 800; }
.example-block p { margin: 0; }

.requirement-details { border-top: 1px solid var(--line); }
.requirement-details > summary { display: flex; align-items: center; justify-content: space-between; padding: 11px 20px 11px 76px; color: var(--brand-dark); cursor: pointer; list-style: none; }
.requirement-details > summary::-webkit-details-marker { display: none; }
.requirement-details > summary span { font-weight: 750; }
.requirement-details > summary span::after { content: "展开"; margin-left: 8px; color: var(--muted); font-size: 11px; font-weight: 500; }
.requirement-details[open] > summary span::after { content: "收起"; }
.requirement-details > summary small { color: var(--muted); }
.requirement-details > summary:hover { background: #fffafa; }
.details-content { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(340px, 0.65fr); gap: 18px; padding: 4px 20px 22px 76px; }
.details-content h4 { margin: 12px 0 8px; font-size: 14px; }
.rule-list,
.acceptance-list { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; }
.rule-row { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px; padding: 11px 12px; border-bottom: 1px solid var(--line); }
.rule-row:last-child { border-bottom: 0; }
.rule-row strong { color: var(--brand-dark); font-size: 12px; }
.rule-row > div { overflow-wrap: anywhere; }
.single-statement { margin: 0; }
.numbered-list { margin: 0; padding-left: 24px; }
.numbered-list li { padding-left: 3px; }
.numbered-list li + li { margin-top: 6px; }
.numbered-list li::marker { color: var(--brand-dark); font-weight: 800; }
.acceptance-row { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 10px; padding: 12px; border-bottom: 1px solid var(--line); }
.acceptance-row:last-child { border-bottom: 0; }
.acceptance-row > span { width: 36px; height: 25px; display: grid; place-items: center; border-radius: 7px; color: var(--brand-dark); background: var(--brand-soft); font-size: 11px; font-weight: 800; }
.acceptance-row strong { font-size: 13px; }
.acceptance-row .single-statement,
.acceptance-row .numbered-list { margin-top: 5px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.no-results { max-width: 1120px; margin: 28px auto 0; padding: 40px; border: 1px dashed #ccd2d7; border-radius: 14px; color: var(--muted); background: white; text-align: center; }

.bottom-details { max-width: 1120px; margin: 20px auto 0; border: 1px solid var(--line); border-radius: 13px; background: white; }
.bottom-details > summary { padding: 14px 17px; font-weight: 750; cursor: pointer; }
.bottom-details > div { padding: 0 17px 16px; }
.bottom-details ul { margin: 0; padding-left: 20px; color: var(--muted); }
.revision-list { display: grid; gap: 8px; }
.revision-list article { padding: 12px 13px; border-radius: 10px; background: var(--soft); }
.revision-list time { color: var(--brand-dark); font-size: 11px; font-weight: 800; }
.revision-list p { margin: 4px 0; }
.revision-list small { color: var(--muted); }
footer { max-width: 1120px; margin: 24px auto 0; color: var(--muted); text-align: center; font-size: 12px; }

.back-top {
  position: fixed;
  z-index: 20;
  right: 22px;
  bottom: 22px;
  height: 40px;
  padding: 0 13px;
  border: 0;
  border-radius: 11px;
  color: white;
  background: var(--brand);
  box-shadow: 0 8px 22px rgba(229, 72, 77, 0.28);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.back-top.show { opacity: 1; pointer-events: auto; }

@media print {
  .sidebar, .topbar, .controls, .back-top { display: none !important; }
  .layout { display: block; }
  .main { padding: 0; }
  .requirement-details { display: block; }
}
