/* 文章可沉淀规则卡片（默认折叠）+ 轻量锚点入口 */

.sgh-rules {
  --sgh-rule-accent: #0b3d6e;
  --sgh-rule-bg: #f3f7fb;
  --sgh-rule-border: #d7e3ef;
  --sgh-rule-text: #142033;
  --sgh-rule-muted: #5b6b80;
  margin: 1.75em 0;
  padding: 0.85em 1.15em 1em;
  background: var(--sgh-rule-bg);
  border: 1px solid var(--sgh-rule-border);
  border-radius: 12px;
  scroll-margin-top: 96px;
  color: var(--sgh-rule-text);
}

.sgh-rules-summary {
  cursor: pointer;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35em 0.75em;
  list-style-position: outside;
}

.sgh-rules-summary::-webkit-details-marker {
  color: var(--sgh-rule-muted);
}

.sgh-rules-title {
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  font-size: 1.05rem !important;
  font-weight: 700;
  line-height: 1.35;
  color: var(--sgh-rule-accent);
}

.sgh-rules-count {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--sgh-rule-muted);
}

.sgh-rules[open] > .sgh-rules-summary {
  margin-bottom: 0.65em;
}

.sgh-rules-lead {
  margin: 0 0 0.75em !important;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--sgh-rule-muted);
}

.sgh-rules-lead a {
  margin-left: 0.4em;
  color: var(--sgh-rule-accent);
  font-weight: 700;
}

.sgh-rules-list {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

.sgh-rule {
  margin: 0 !important;
  padding: 0.85em 0 0;
  border-top: 1px solid var(--sgh-rule-border);
}

.sgh-rule:first-child {
  border-top: 0;
  padding-top: 0.15em;
}

.sgh-rule-text {
  margin: 0 0 0.45em !important;
  font-size: 0.98rem;
  line-height: 1.65;
  font-weight: 600;
}

.sgh-rule-n {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35em;
  height: 1.35em;
  margin-right: 0.35em;
  padding: 0 0.3em;
  border-radius: 999px;
  background: var(--sgh-rule-accent);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  vertical-align: 0.1em;
}

.sgh-rule-meta {
  margin: 0.2em 0;
  font-size: 0.86rem;
  line-height: 1.55;
  color: var(--sgh-rule-muted);
}

.sgh-rule-k {
  display: inline-block;
  margin-right: 0.25em;
  font-weight: 700;
  color: var(--sgh-rule-accent);
}

.sgh-rule-check {
  margin: 0.4em 0 0 !important;
  padding-left: 1.2em !important;
  font-size: 0.86rem;
  color: var(--sgh-rule-muted);
}

.sgh-rule-check li {
  margin: 0.25em 0 !important;
}

/* 桌面：滚动后右侧轻量图钉；手机：底部条 */
a.sgh-rules-fab,
a.sgh-rules-fab:link,
a.sgh-rules-fab:visited {
  position: fixed;
  z-index: 40;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none !important;
  font-weight: 700;
  color: #fff !important;
  background: #0b3d6e;
  box-shadow: 0 8px 22px rgba(11, 61, 110, 0.28);
  transition: opacity 0.2s ease, transform 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

a.sgh-rules-fab:hover,
a.sgh-rules-fab:focus,
a.sgh-rules-fab:focus-visible,
a.sgh-rules-fab:active {
  color: #fff !important;
  background: #072a4d;
  text-decoration: none !important;
  outline: none;
}

a.sgh-rules-fab:focus-visible {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.85), 0 8px 22px rgba(11, 61, 110, 0.35);
}

.sgh-rules-fab[hidden] {
  display: none !important;
}

@media (min-width: 900px) {
  .sgh-rules-fab {
    right: 18px;
    top: 42%;
    writing-mode: vertical-rl;
    letter-spacing: 0.08em;
    padding: 14px 10px;
    border-radius: 10px;
    font-size: 0.82rem;
  }
}

@media (max-width: 899px) {
  .sgh-rules-fab {
    left: 50%;
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    padding: 10px 16px;
    border-radius: 999px;
    font-size: 0.88rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sgh-rules-fab {
    transition: none;
  }
}
