/* 文案高手：手机优先，宽屏居中。颜色都放在变量里，深色模式改变量。 */
:root {
  --bg: #f5f3ee;
  --card: #ffffff;
  --text: #24221e;
  --muted: #6f6a60;
  --line: #e3ded3;
  --accent: #b4532a;
  --accent-ink: #ffffff;
  --accent-soft: #f6e6dc;
  --ok: #2f7a4f;
  --ok-soft: #e3f2e8;
  --warn: #9a6400;
  --warn-soft: #fbf0d9;
  --bad: #b3261e;
  --bad-soft: #fbe4e2;
  --info-soft: #e8eef7;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1b19;
    --card: #262522;
    --text: #ece8df;
    --muted: #a59f93;
    --line: #3a3833;
    --accent: #e08a5d;
    --accent-ink: #1c1b19;
    --accent-soft: #3d2a20;
    --ok: #7fcf9c;
    --ok-soft: #1f3327;
    --warn: #f0c060;
    --warn-soft: #3a3020;
    --bad: #f28b82;
    --bad-soft: #3d2221;
    --info-soft: #232c38;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.3; margin: 0 0 0.5em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
p { margin: 0.4em 0; }
.wrap { max-width: 820px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.hidden { display: none !important; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grow { flex: 1; }
.stack > * + * { margin-top: 12px; }
.pre { white-space: pre-wrap; word-break: break-word; }

/* 顶栏 */
.top { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.top .wrap { display: flex; align-items: center; gap: 12px; min-height: 52px; flex-wrap: wrap; }
.brand { font-weight: 700; color: var(--text); text-decoration: none; font-size: 1.1rem; }
.beta { font-size: 0.7rem; background: var(--accent-soft); color: var(--accent); padding: 1px 6px; border-radius: 99px; margin-left: 4px; vertical-align: middle; }
.nav { display: flex; gap: 2px; flex-wrap: nowrap; overflow-x: auto; }
.top .nav { order: 3; flex-basis: 100%; padding-bottom: 6px; }
.nav a { padding: 6px 10px; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: 0.95rem; white-space: nowrap; }
.top .quota { margin-left: auto; }
@media (min-width: 640px) {
  .top .nav { order: 0; flex: 1; flex-basis: auto; padding-bottom: 0; }
  .top .quota { margin-left: 0; }
}
.nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.quota { font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.linkish { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; font-size: 0.9rem; padding: 6px; }

main { padding: 16px 0 32px; }
#notice:not(:empty) { margin-bottom: 14px; }

/* 卡片和提示条 */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card + .card { margin-top: 14px; }
.note { border-radius: var(--radius); padding: 10px 12px; font-size: 0.92rem; }
.note.info { background: var(--info-soft); }
.note.ok { background: var(--ok-soft); }
.note.warn { background: var(--warn-soft); }
.note.bad { background: var(--bad-soft); }
.note.ai { background: var(--accent-soft); }
.badge { display: inline-block; font-size: 0.78rem; padding: 1px 8px; border-radius: 99px; background: var(--line); color: var(--text); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.run { background: var(--info-soft); }

/* 表单 */
form .field, .field { margin-bottom: 14px; }
label.lbl { display: block; font-weight: 600; font-size: 0.95rem; margin-bottom: 4px; }
.req::after { content: " *"; color: var(--bad); }
.hint { display: block; color: var(--muted); font-size: 0.82rem; margin-top: 3px; }
input[type=text], input[type=tel], input[type=number], select, textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.checks label, label.check { display: inline-flex; align-items: center; gap: 6px; font-size: 0.95rem; cursor: pointer; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--accent); }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 0 12px; }
@media (min-width: 640px) { .grid2 { grid-template-columns: 1fr 1fr; } }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px 2px; margin: 0 0 14px; }
legend { font-weight: 700; padding: 0 6px; }
details.more { margin-bottom: 14px; }
details.more > summary { cursor: pointer; color: var(--accent); font-weight: 600; padding: 6px 0; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pills label { border: 1px solid var(--line); border-radius: 99px; padding: 5px 14px; cursor: pointer; background: var(--bg); }
.pills input { position: absolute; opacity: 0; pointer-events: none; }
.pills label:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.sp { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 6px; }

button, .btn {
  font: inherit;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  padding: 8px 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button.primary, .btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button.big { width: 100%; padding: 12px; font-size: 1.05rem; }
button.danger { color: var(--bad); }
button:disabled { opacity: 0.55; cursor: not-allowed; }
button.mini { padding: 3px 9px; font-size: 0.82rem; }
.err { color: var(--bad); font-size: 0.92rem; margin: 8px 0; }

/* 列表 */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { border-bottom: 1px solid var(--line); padding: 10px 2px; }
.list > li:last-child { border-bottom: 0; }
.list a.item { display: block; color: var(--text); text-decoration: none; }
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
th, td { border-bottom: 1px solid var(--line); padding: 7px 6px; text-align: left; vertical-align: top; }
th { color: var(--muted); font-weight: 600; white-space: nowrap; }
table.shots { min-width: 640px; }
td.t { white-space: nowrap; color: var(--muted); width: 1%; }

/* 结果卡 */
.script h2 { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.kv { margin: 10px 0; }
.kv > .k { font-weight: 700; font-size: 0.9rem; color: var(--muted); }
.hook { background: var(--accent-soft); border-radius: 8px; padding: 8px 10px; font-weight: 600; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tags span { background: var(--bg); border: 1px solid var(--line); border-radius: 99px; padding: 1px 10px; font-size: 0.88rem; }
.checklist { list-style: none; padding: 0; margin: 6px 0; font-size: 0.92rem; }
.checklist li { padding: 4px 0; border-bottom: 1px dashed var(--line); }
.checklist li:last-child { border-bottom: 0; }
.ref { background: none; border: 0; padding: 0 2px; color: var(--accent); cursor: pointer; font: inherit; font-size: 0.82rem; text-decoration: underline dotted; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.ailabel { font-size: 0.8rem; color: var(--muted); margin-top: 8px; }
.steps { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
.steps span { padding: 3px 10px; border-radius: 99px; background: var(--bg); border: 1px solid var(--line); font-size: 0.85rem; color: var(--muted); }
.steps span.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.steps span.done { color: var(--ok); }
.cardref { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
.cardref:target, .cardref.flash { background: var(--warn-soft); }
.bar { height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; }
.bar > div { height: 100%; background: var(--ok); }
.bar.warn > div { background: var(--bad); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.card .nav { flex-wrap: wrap; }
.stat { background: var(--bg); border-radius: 8px; padding: 10px; }
.stat b { display: block; font-size: 1.25rem; }
.codebox { font: 700 1.6rem/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 0.15em; background: var(--accent-soft); border-radius: 8px; padding: 10px 14px; display: inline-block; user-select: all; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 8px 16px; border-radius: 99px; font-size: 0.92rem; z-index: 50; }

/* 弹窗 */
dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--text); width: min(520px, calc(100vw - 32px)); padding: 18px; }
dialog::backdrop { background: rgba(0, 0, 0, 0.35); }

/* 登录页 */
.hero { padding: 36px 0 12px; }
.hero h1 { font-size: 1.8rem; }
.login { max-width: 420px; margin: 0 auto; }

/* 页脚 */
footer.foot { border-top: 1px solid var(--line); padding: 18px 0 28px; color: var(--muted); font-size: 0.8rem; }
footer.foot p { margin: 3px 0; }
footer.foot a { color: var(--muted); }

/* 协议页 */
.doc h2 { margin-top: 1.4em; }
.doc li { margin: 4px 0; }
