:root {
  --bg: #f5f2ed;
  --card: #ffffff;
  --ink: #1e1c1a;
  --ink-2: #6b6560;
  --ink-3: #9a938b;
  --line: #e7e2da;
  --line-2: #f0ece5;
  --accent: #1f5f4b;
  --accent-soft: #e6f0eb;
  --warn: #b4573a;
  --warn-soft: #fbece6;
  --radius: 14px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body { padding-bottom: env(safe-area-inset-bottom); }

#app {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px;
  padding-top: max(16px, env(safe-area-inset-top));
}

.hidden { display: none !important; }

/* ---------- 通用 ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0 14px;
}

.topbar h1 {
  font-size: 19px;
  font-weight: 600;
  margin: 0;
  letter-spacing: 0.01em;
}

.topbar .back {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 15px;
  padding: 10px 6px 10px 0;
  min-height: 44px;
  cursor: pointer;
}

.sub {
  color: var(--ink-2);
  font-size: 13px;
  margin: -6px 0 16px;
}

.muted { color: var(--ink-3); font-size: 13px; }

/* ---------- 口令页 ---------- */

.unlock {
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
}

.unlock h1 { font-size: 22px; margin: 0 0 4px; font-weight: 600; }
.unlock p { margin: 0; color: var(--ink-2); font-size: 14px; }

.code-input {
  width: 100%;
  font-size: 26px;
  letter-spacing: 0.5em;
  text-align: center;
  padding: 16px 12px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
  font-family: inherit;
  outline: none;
  -webkit-appearance: none;
}
.code-input:focus { border-color: var(--accent); }

.btn {
  border: 0;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-size: 16px;
  font-weight: 500;
  font-family: inherit;
  padding: 15px 20px;
  min-height: 50px;
  width: 100%;
  cursor: pointer;
  transition: opacity .15s;
}
.btn:active { opacity: .82; }
.btn[disabled] { opacity: .45; }
.btn.ghost { background: var(--card); color: var(--ink); border: 1.5px solid var(--line); }

.err { color: var(--warn); font-size: 14px; min-height: 20px; }

/* ---------- 批次列表 ---------- */

.batch {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 16px 14px;
  margin-bottom: 12px;
  cursor: pointer;
  display: block;
  width: 100%;
  text-align: left;
  font-family: inherit;
  color: inherit;
  transition: border-color .15s, transform .1s;
}
.batch:active { transform: scale(.99); }
.batch.done { opacity: .55; }

.batch-title { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.batch-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); }

.pill {
  display: inline-block;
  font-size: 12px;
  line-height: 1.5;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 500;
}
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.plain { background: var(--line-2); color: var(--ink-2); }

/* ---------- 详情 ---------- */

.overview {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 14px;
  color: var(--ink-2);
  margin-bottom: 16px;
  white-space: pre-wrap;
}

.post {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
}

.post-head {
  padding: 16px 16px 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
  justify-content: space-between;
}
.post-head .no { font-size: 15px; font-weight: 600; }
.post-head .state { font-size: 12px; }

.imgs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 16px 4px;
  scrollbar-width: none;
}
.imgs::-webkit-scrollbar { display: none; }
.imgs figure { margin: 0; flex: 0 0 auto; }
.imgs img {
  width: 132px;
  height: 132px;
  object-fit: cover;
  border-radius: 10px;
  background: var(--line-2);
  display: block;
  cursor: zoom-in;
}
.imgs figcaption {
  font-size: 11px;
  color: var(--ink-3);
  text-align: center;
  margin-top: 4px;
}

.versions { padding: 8px 16px 0; }

.version {
  border-top: 1px solid var(--line-2);
  padding: 14px 0 12px;
}
.version:first-child { border-top: 0; }

.ver-head { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 8px; }
.ver-key {
  flex: 0 0 auto;
  width: 24px; height: 24px;
  border-radius: 7px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  margin-top: 2px;
}
.ver-title { font-size: 15px; font-weight: 600; line-height: 1.45; }

.ver-body { font-size: 14.5px; color: #35312d; white-space: pre-wrap; margin-bottom: 8px; }
.ver-tags { font-size: 13px; color: var(--accent); margin-bottom: 6px; }
.ver-order { font-size: 12px; color: var(--ink-3); }

/* ---------- 选项 ---------- */

.opts { padding: 4px 16px 0; }

.opts-label {
  font-size: 12px;
  color: var(--ink-3);
  margin: 12px 0 8px;
  letter-spacing: .02em;
}

.opt-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.opt-grid.one { grid-template-columns: 1fr; margin-top: 8px; }

.opt {
  border: 1.5px solid var(--line);
  background: var(--card);
  border-radius: 11px;
  padding: 12px 6px;
  min-height: 48px;
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
  cursor: pointer;
  transition: all .13s;
  line-height: 1.3;
}
.opt:active { transform: scale(.97); }
.opt.on {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.opt.on.revise { border-color: var(--warn); background: var(--warn-soft); color: var(--warn); }

.fb-wrap { padding: 12px 16px 16px; }
.fb {
  width: 100%;
  min-height: 64px;
  border: 1.5px solid var(--line);
  border-radius: 11px;
  padding: 11px 12px;
  font-size: 15px;
  font-family: inherit;
  color: var(--ink);
  background: #fdfcfa;
  resize: vertical;
  outline: none;
  line-height: 1.55;
}
.fb:focus { border-color: var(--accent); background: #fff; }
.fb::placeholder { color: var(--ink-3); }

/* ---------- 底部提交 ---------- */

.submit-bar {
  position: sticky;
  bottom: 0;
  margin: 0 -16px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 72%, rgba(245, 242, 237, 0));
  z-index: 20;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%) translateY(8px);
  background: rgba(30, 28, 26, .92);
  color: #fff;
  font-size: 14px;
  padding: 11px 18px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s, transform .22s;
  max-width: 84vw;
  text-align: center;
  z-index: 60;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 大图 ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(16, 15, 14, .95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
}
.lightbox .close {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: 12px;
  width: 44px; height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,.14);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

/* ---------- 空态 ---------- */

.empty {
  text-align: center;
  padding: 72px 20px;
  color: var(--ink-3);
  font-size: 15px;
}
.empty .big { font-size: 34px; margin-bottom: 12px; }
