:root {
  --bg: #ffffff;
  --fg: #1a1a1a;
  --muted: #555555;
  --border: #c8c8c8;
  --card: #f6f7f9;
  --primary: #0b57d0;
  --primary-fg: #ffffff;
  --ok-bg: #e6f4ea;
  --ok-border: #1e7e34;
  --err-bg: #fdecea;
  --err-border: #b3261e;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171c;
    --fg: #ececec;
    --muted: #b5b5b5;
    --border: #4a4d55;
    --card: #1f2229;
    --primary: #8ab4f8;
    --primary-fg: #10131a;
    --ok-bg: #16301f;
    --ok-border: #6fcf8b;
    --err-bg: #3a1b19;
    --err-border: #f2928b;
  }
}

* { box-sizing: border-box; }
html { font-size: 112.5%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.7;
}
a { color: var(--primary); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

.site-header, main, .site-footer {
  max-width: 46rem;
  margin: 0 auto;
  padding: 1rem;
}
.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; font-size: 1.15rem; text-decoration: none; color: var(--fg); }
nav ul { list-style: none; display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; margin: 0; padding: 0; }
.site-footer { border-top: 1px solid var(--border); color: var(--muted); font-size: 0.9rem; }
.site-footer p { margin: 0.25rem 0; }

h1 { font-size: 1.6rem; line-height: 1.3; margin: 1rem 0; }
h2 { font-size: 1.2rem; margin: 0 0 0.5rem; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin: 1rem 0;
}
.price strong { font-size: 1.3rem; }

dl { display: grid; grid-template-columns: max-content 1fr; gap: 0.25rem 1rem; margin: 0.5rem 0; }
dt { color: var(--muted); }
dd { margin: 0; word-break: break-all; }

.field { margin: 1rem 0; }
label { font-weight: 600; }
.hint { color: var(--muted); font-size: 0.9rem; margin: 0.25rem 0; }
input[type="text"], input[type="tel"], input[type="email"], input[type="password"], input[type="number"], input[type="search"], select {
  display: block;
  width: 100%;
  max-width: 24rem;
  font: inherit;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
}
fieldset { border: 1px solid var(--border); border-radius: 6px; margin: 1rem 0; padding: 0.5rem 1rem 1rem; }
legend { font-weight: 600; padding: 0 0.5rem; }
label.radio, label.checkbox { display: block; font-weight: 400; padding: 0.4rem 0; }
label.radio input, label.checkbox input { width: 1.2rem; height: 1.2rem; vertical-align: middle; margin-right: 0.4rem; }

.btn, button {
  font: inherit;
  cursor: pointer;
}
.btn {
  display: inline-block;
  background: var(--primary);
  color: var(--primary-fg);
  border: 2px solid var(--primary);
  border-radius: 6px;
  padding: 0.65rem 1.5rem;
  font-weight: 600;
  text-decoration: none;
  min-height: 2.75rem;
}
.btn.secondary { background: transparent; color: var(--primary); }
button.small { padding: 0.3rem 0.75rem; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--fg); }
button.link { background: none; border: none; padding: 0; color: var(--primary); text-decoration: underline; }
form.inline { display: inline-block; margin: 0.15rem 0.25rem 0.15rem 0; }

.notice {
  border: 1px solid var(--border);
  border-left-width: 6px;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  background: var(--card);
}
.notice.success { background: var(--ok-bg); border-color: var(--ok-border); }
.notice.error { background: var(--err-bg); border-color: var(--err-border); }
.notice h2 { margin-bottom: 0.25rem; }
.notice p, .notice ul { margin: 0.25rem 0; }
.status { font-weight: 600; }

/* 微信支付二维码：尽量大、居中、白底黑码，方便视力不好的用户对准。
   宽度取三者中最小的：卡片宽度、30rem、屏幕高度的 72%（保证一屏内能完整显示）。 */
.qr {
  background: #ffffff;
  display: block;
  width: min(100%, 30rem, 72vh);
  margin: 1.25rem auto;
  padding: 0.75rem;
  border: 2px solid #000000;
  border-radius: 8px;
  line-height: 0;
}
.qr svg { display: block; width: 100%; height: auto; }

/* 后台 */
.admin-nav { margin: 0.5rem 0 1rem; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; margin: 1rem 0; }
.filters input, .filters select { width: auto; display: inline-block; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.85rem; }
caption { text-align: left; color: var(--muted); padding: 0.25rem 0; }
th, td { border: 1px solid var(--border); padding: 0.4rem 0.5rem; text-align: left; vertical-align: top; }
thead th { background: var(--card); white-space: nowrap; }
.pager { display: flex; gap: 1rem; margin: 1rem 0; }
body:has(.admin-nav) .site-header, body:has(.admin-nav) main, body:has(.admin-nav) .site-footer { max-width: 80rem; }

.closing { font-size: 1.15rem; font-weight: 600; margin: 1.25rem 0; }

/* 购买页的退款提示 */
.notice.warn { border-color: #b26a00; }
.notice h3 { font-size: 1.05rem; margin: 0 0 0.25rem; }

/* 购买完成页的自定义内容 */
.guide h2 { margin-top: 1.25rem; }
.guide h2:first-child { margin-top: 0; }
.guide h3 { font-size: 1.05rem; margin: 1rem 0 0.25rem; }
.guide img { max-width: 100%; height: auto; border-radius: 6px; border: 1px solid var(--border); }
.guide figure.audio { margin: 1rem 0; padding: 0.75rem 1rem; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); }
.guide figcaption { font-weight: 600; margin-bottom: 0.5rem; }
.guide audio { width: 100%; }
.copy { white-space: nowrap; }
.copy-status { position: absolute; left: -9999px; }

/* 后台编辑器 */
textarea {
  display: block;
  width: 100%;
  font: inherit;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem;
  line-height: 1.6;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
}
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.85em; word-break: break-all; }
input[type="file"] { font: inherit; max-width: 100%; }

/* 手机上：订单信息改成“名称在上、内容在下”，避免邮箱和订单号被挤成两行半 */
@media (max-width: 34rem) {
  dl { grid-template-columns: 1fr; gap: 0; }
  dt { margin-top: 0.6rem; font-size: 0.9rem; }
  dt:first-child { margin-top: 0; }
}
