:root {
  --bg: #f4f5f5;
  --card: #ffffff;
  --text: #141616;
  --muted: #6b7375;
  --line: #e4e8e9;
  --accent: #00a7a8;
  --accent-ink: #00797a;
  --accent-soft: #e2f6f6;
  --btn: #0b7f80;
  --ok: #15803d;
  --ok-soft: #e7f5ec;
  --warn: #b45309;
  --warn-soft: #fdf3e1;
  --bad: #c92a2f;
  --bad-soft: #fdecec;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 2px 10px rgba(0, 0, 0, .04);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1011;
    --card: #161a1b;
    --text: #eef1f1;
    --muted: #9aa3a5;
    --line: #283032;
    --accent: #14c8c9;
    --accent-ink: #5fe0e0;
    --accent-soft: #0f2a2b;
    --btn: #0e9a9b;
    --ok: #3ccf74;
    --ok-soft: #10261a;
    --warn: #f0a83a;
    --warn-soft: #2a2110;
    --bad: #f2686b;
    --bad-soft: #2c1415;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 var(--font);
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; color: inherit; }
img { display: block; }
h1, h2, h3 { margin: 0; line-height: 1.3; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 650; }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 650; }
.mark {
  display: grid; place-items: center;
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--text); color: var(--bg);
  font-size: 15px; font-weight: 800;
}
.demo-banner {
  max-width: 720px; margin: 10px auto 0; padding: 6px 12px;
  font-size: 13px; color: var(--warn); background: var(--warn-soft);
  border-radius: 10px; text-align: center;
}
main { max-width: 720px; margin: 0 auto; padding: 16px 12px 140px; }

/* ---------- buttons, pills ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 18px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--card); font-weight: 600; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--btn); border-color: var(--btn); color: #fff; }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--accent-ink); padding: 0 8px; }
.btn-block { width: 100%; }

.pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; line-height: 20px; white-space: nowrap;
  background: var(--line); color: var(--muted);
}
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-bad { background: var(--bad-soft); color: var(--bad); }
.pill-info { background: var(--accent-soft); color: var(--accent-ink); }
.pill-new { background: var(--btn); color: #fff; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- cards ---------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; margin-bottom: 12px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.card-head .sub { font-size: 13px; color: var(--muted); }
.card-accent { border-color: var(--accent); background: linear-gradient(var(--accent-soft), var(--card) 70%); }
.hint { margin: -4px 0 12px; font-size: 13px; color: var(--muted); }

.page-head { display: flex; align-items: baseline; justify-content: space-between; margin: 4px 4px 14px; }

/* ---------- task list ---------- */
.task-list { display: grid; gap: 10px; }
.task-card {
  display: flex; gap: 12px; padding: 10px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.task-thumb { width: 76px; height: 96px; object-fit: cover; border-radius: 10px; flex: none; background: var(--line); }
.task-info { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.task-title { font-weight: 650; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.task-meta { font-size: 13px; color: var(--muted); }
.task-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.empty { text-align: center; padding: 64px 0; color: var(--muted); }

/* ---------- new task form ---------- */
.field { display: block; }
.field + .field { margin-top: 12px; }
.field-label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.input, .textarea {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); outline: none;
}
.input:focus, .textarea:focus { border-color: var(--accent); background: var(--card); }
.textarea { resize: vertical; min-height: 84px; line-height: 1.6; }
.step-no {
  display: inline-grid; place-items: center; width: 22px; height: 22px; margin-right: 6px;
  border-radius: 50%; background: var(--text); color: var(--bg); font-size: 13px; font-weight: 700;
}

.up-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.up-item, .up-add { position: relative; aspect-ratio: 3 / 4; border-radius: 10px; overflow: hidden; }
.up-item img { width: 100%; height: 100%; object-fit: cover; }
.up-item .num {
  position: absolute; left: 6px; top: 6px; min-width: 22px; height: 22px; padding: 0 6px;
  display: grid; place-items: center; border-radius: 11px;
  background: rgba(0, 0, 0, .65); color: #fff; font-size: 12px; font-weight: 700;
}
.up-del {
  position: absolute; right: 4px; top: 4px; width: 26px; height: 26px;
  border: 0; border-radius: 50%; background: rgba(0, 0, 0, .55); color: #fff;
  font-size: 17px; line-height: 26px; cursor: pointer;
}
.up-add {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border: 1.5px dashed var(--line); background: var(--bg); color: var(--muted);
  font-size: 12px; cursor: pointer;
}
.up-add .plus { font-size: 24px; line-height: 1; }

.submit-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.submit-bar > div { max-width: 720px; margin: 0 auto; display: flex; gap: 10px; align-items: center; }
.submit-bar .note { flex: 1; font-size: 13px; color: var(--muted); }

/* ---------- task page ---------- */
.task-head { margin: 0 4px 12px; }
.back { display: inline-block; font-size: 14px; color: var(--accent-ink); margin-bottom: 6px; }
.task-head .row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--line); gap: 2px; overflow-x: auto; max-width: 100%; }
.seg a { padding: 4px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.seg a.on { background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.status-btn { border: 0; cursor: pointer; }

.feedback-note { font-size: 13px; color: var(--muted); padding: 10px 12px; border-left: 3px solid var(--accent); background: var(--card); border-radius: 0 10px 10px 0; margin-bottom: 12px; }
.feedback-note b { color: var(--text); font-weight: 600; }

/* questions */
.q-list { display: grid; gap: 12px; }
.q-item label { display: block; font-weight: 600; margin-bottom: 6px; }

/* photo strip */
.strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scroll-snap-type: x proximity; scrollbar-width: none; }
.strip::-webkit-scrollbar { display: none; }
.tile { position: relative; flex: none; width: 104px; scroll-snap-align: start; cursor: zoom-in; }
.tile img { width: 104px; height: 138px; object-fit: cover; border-radius: 10px; background: var(--line); }
.tile .pos {
  position: absolute; left: 6px; top: 6px; min-width: 22px; height: 22px; padding: 0 6px;
  display: grid; place-items: center; border-radius: 11px;
  background: rgba(0, 0, 0, .65); color: #fff; font-size: 12px; font-weight: 700;
}
.tile .cover-badge {
  position: absolute; right: 6px; top: 6px; padding: 0 6px; height: 20px; line-height: 20px;
  border-radius: 6px; background: var(--accent); color: #002b2b; font-size: 11px; font-weight: 800;
}
.tile .flags { position: absolute; left: 6px; right: 6px; bottom: 28px; display: flex; flex-wrap: wrap; gap: 3px; }
.tile .flags span { font-size: 10.5px; font-weight: 700; padding: 0 5px; line-height: 17px; border-radius: 5px; color: #fff; }
.tile .flags .fail { background: var(--bad); }
.tile .flags .warn { background: #c27a12; }
.tile .orig { font-size: 12px; color: var(--muted); text-align: center; margin-top: 4px; }
.tile.removed img { filter: grayscale(1); opacity: .45; }
.tile.removed .pos { background: var(--bad); }
.cover-note { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: var(--bg); font-size: 14px; }
.cover-note b { font-weight: 650; }
.issues { margin: 12px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.issues li { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }
.issues .pill { flex: none; margin-top: 1px; }

/* titles */
.title-list { display: grid; gap: 8px; }
.title-item {
  display: block; width: 100%; text-align: left; cursor: pointer;
  padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card);
}
.title-item.rec { border-color: var(--accent); background: var(--accent-soft); }
.title-item .t { display: flex; justify-content: space-between; gap: 8px; font-size: 16px; font-weight: 650; }
.title-item .t .copy-ic { color: var(--accent-ink); font-size: 13px; font-weight: 600; flex: none; }
.title-item .why { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 4px; font-size: 13px; color: var(--muted); }
.title-item .reason { margin-top: 2px; font-size: 13px; color: var(--muted); }

/* body */
.body-box {
  width: 100%; min-height: 220px; padding: 12px; resize: none; overflow: hidden;
  border: 1px solid var(--line); border-radius: 12px; background: var(--bg);
  font-size: 16px; line-height: 1.75; outline: none;
}
.body-box:focus { border-color: var(--accent); background: var(--card); }
.body-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.body-foot .left { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* topics */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 5px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; font-size: 14px; border: 0; cursor: pointer; }
.chip.manual { background: var(--bg); color: var(--muted); border: 1px dashed var(--line); cursor: default; }

/* todo */
.todo { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.todo label { display: flex; gap: 10px; align-items: flex-start; padding: 8px 4px; cursor: pointer; border-radius: 8px; }
.todo input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--btn); flex: none; }
.todo .done span { color: var(--muted); text-decoration: line-through; }

/* checks */
details.checks summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
details.checks summary::-webkit-details-marker { display: none; }
details.checks summary .arrow { transition: transform .2s; color: var(--muted); }
details.checks[open] summary .arrow { transform: rotate(90deg); }
.check-group { margin-top: 14px; }
.check-group h3 { font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.check-row { display: flex; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.check-row:last-child { border-bottom: 0; }
.check-row .ic { flex: none; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; margin-top: 1px; }
.ic.pass { background: var(--ok-soft); color: var(--ok); }
.ic.warn { background: var(--warn-soft); color: var(--warn); }
.ic.fail { background: var(--bad-soft); color: var(--bad); }
.check-row .note { display: block; font-size: 13px; color: var(--muted); }

/* generating */
/* ---------- login, page footer ---------- */
.login { max-width: 360px; margin: 48px auto 0; padding: 24px 20px; }
.login h1 { margin-bottom: 16px; }
.login-msg { margin: 10px 0 0; font-size: 14px; color: var(--bad); }
.page-foot { text-align: center; margin: 28px 0 8px; }
.link-btn { background: none; border: 0; padding: 8px 12px; font-size: 14px; color: var(--muted); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.link-btn.danger { color: var(--bad); }
.gen-detail { margin-top: 10px; word-break: break-word; }

.gen { text-align: center; padding: 28px 16px; }
.gen-steps { list-style: none; padding: 0; margin: 18px auto 0; max-width: 260px; text-align: left; display: grid; gap: 10px; }
.gen-steps li { display: flex; gap: 10px; align-items: center; color: var(--muted); }
.gen-steps li .dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line); flex: none; display: grid; place-items: center; font-size: 11px; }
.gen-steps li.done { color: var(--text); }
.gen-steps li.done .dot { background: var(--btn); border-color: var(--btn); color: #fff; }
.gen-steps li.now { color: var(--text); font-weight: 600; }
.gen-steps li.now .dot { border-color: var(--accent); border-top-color: transparent; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* revise bar */
.revise-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.revise-bar form { max-width: 720px; margin: 0 auto; display: flex; gap: 8px; align-items: flex-end; }
.revise-bar textarea {
  flex: 1; min-height: 44px; max-height: 120px; resize: none;
  padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); outline: none;
}
.revise-bar textarea:focus { border-color: var(--accent); }

/* lightbox, toast */
.lightbox { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .9); display: grid; place-items: center; padding: 16px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; }
.toast {
  position: fixed; left: 50%; bottom: 96px; z-index: 60;
  transform: translate(-50%, 12px); opacity: 0; pointer-events: none;
  padding: 8px 16px; border-radius: 999px; background: var(--text); color: var(--bg);
  font-size: 14px; font-weight: 600; transition: .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 560px) {
  .up-grid { grid-template-columns: repeat(6, 1fr); }
  main { padding-top: 24px; }
}
