*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: #1a1a1a;
  background: #fff;
}

.page {
  min-height: 100vh;
  padding: 0 20px 32px;
}

.page-header {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 16px 0 12px;
  background: #fff;
  border-bottom: 1px solid #eee;
}

.page-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
}

.page-body {
  padding-top: 16px;
}

/* 纯文本：保留 \n 换行与连续空格 */
.content-text {
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* 富文本 HTML 正文 */
.content-html {
  word-break: break-word;
  overflow-wrap: anywhere;
}

.content-html > :first-child {
  margin-top: 0;
}

.content-html > :last-child {
  margin-bottom: 0;
}

.content-html p,
.content-html div {
  margin: 0 0 0.75em;
}

.content-html br {
  display: block;
  content: "";
  margin-top: 0.35em;
}

.content-html h1,
.content-html h2,
.content-html h3,
.content-html h4,
.content-html h5,
.content-html h6 {
  margin: 1.2em 0 0.6em;
  font-weight: 600;
  line-height: 1.4;
}

.content-html h1 { font-size: 1.35em; }
.content-html h2 { font-size: 1.25em; }
.content-html h3 { font-size: 1.15em; }
.content-html h4 { font-size: 1.05em; }

.content-html ul,
.content-html ol {
  margin: 0 0 0.75em;
  padding-left: 1.5em;
}

.content-html li {
  margin: 0.25em 0;
}

.content-html li > ul,
.content-html li > ol {
  margin-top: 0.25em;
  margin-bottom: 0;
}

.content-html a {
  color: #1677ff;
  text-decoration: underline;
  word-break: break-all;
  cursor: pointer;
}

.content-html a:active {
  opacity: 0.75;
}

.content-html b a,
.content-html a b,
.content-html strong a,
.content-html a strong {
  color: #1677ff;
  font-weight: 600;
}

.content-html img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0.75em 0;
}

.content-html table {
  width: 100%;
  max-width: 100%;
  margin: 0.75em 0;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 1.5;
}

.content-html th,
.content-html td {
  padding: 8px 10px;
  border: 1px solid #ddd;
  vertical-align: top;
  text-align: left;
}

.content-html th {
  background: #f7f7f7;
  font-weight: 600;
}

.content-html blockquote {
  margin: 0.75em 0;
  padding: 0.5em 0 0.5em 1em;
  border-left: 3px solid #ddd;
  color: #555;
}

.content-html pre {
  margin: 0.75em 0;
  padding: 12px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.5;
  background: #f5f5f5;
  border-radius: 6px;
  white-space: pre-wrap;
  word-break: break-word;
}

.content-html code {
  padding: 0.1em 0.35em;
  font-size: 0.92em;
  background: #f5f5f5;
  border-radius: 4px;
}

.content-html pre code {
  padding: 0;
  background: none;
}

.content-html hr {
  margin: 1em 0;
  border: none;
  border-top: 1px solid #e8e8e8;
}

.content-html strong,
.content-html b {
  font-weight: 600;
}

.content-html em,
.content-html i {
  font-style: italic;
}

.content-html u,
.content-html ins {
  text-decoration: underline;
}

.content-html s,
.content-html strike,
.content-html del {
  text-decoration: line-through;
}

.content-html sub,
.content-html sup {
  font-size: 0.75em;
  line-height: 0;
}

.state-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  color: #666;
}

.state-panel[hidden],
.content-panel[hidden] {
  display: none !important;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #e8e8e8;
  border-top-color: #1677ff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.state-message {
  margin: 16px 0 0;
  max-width: 320px;
  line-height: 1.6;
}

.btn-retry {
  margin-top: 20px;
  padding: 10px 28px;
  font-size: 15px;
  color: #fff;
  background: #1677ff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.btn-retry:active {
  opacity: 0.85;
}
