:root {
  color-scheme: light;
  --canvas: #f3f5f2;
  --paper: #fff;
  --ink: #162720;
  --muted: #5f7067;
  --line: #d8e0d9;
  --soft: #edf3ee;
  --accent: #225b42;
  --accent-dark: #184832;
  --accent-soft: #e2eee4;
  --warn: #8a5a00;
  --warn-soft: #fff4dc;
  --error: #9b3030;
  --error-soft: #fbeaea;
  --radius: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei UI", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--canvas);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; }
a { color: var(--accent); }
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: 24px; line-height: 1.3; margin-bottom: 8px; letter-spacing: -.01em; }
h2 { font-size: 18px; margin-bottom: 10px; }
h3 { font-size: 15px; margin-bottom: 8px; }
p { line-height: 1.6; }

/* 布局 */
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); backdrop-filter: blur(6px); }
.topbar-inner { max-width: 720px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 10px; }
.brand { font-weight: 750; text-decoration: none; color: var(--ink); display: flex; align-items: center; gap: 8px; margin-right: auto; white-space: nowrap; }
.brand .mark { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: var(--accent); color: #fff; font-size: 14px; }
.wallet { font-size: 13px; color: var(--muted); text-align: right; line-height: 1.3; }
.wallet b { color: var(--ink); font-size: 15px; }
.topbar .link-btn { font-size: 14px; }
main { max-width: 720px; margin: 0 auto; padding: 18px 16px 96px; }
.page-head { margin: 6px 0 16px; }
.page-head p { color: var(--muted); margin-bottom: 0; }

/* 卡片与通用 */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.center { text-align: center; }
.stack > * + * { margin-top: 10px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 18px; border-radius: 10px; border: 1px solid var(--line); background: var(--paper); cursor: pointer; text-decoration: none; color: var(--ink); font-weight: 600; white-space: nowrap; }
.btn:hover { border-color: #b7c5ba; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); }
.btn.danger { color: var(--error); border-color: #e3c4c4; }
.btn.block { width: 100%; }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 14px; }
.btn:disabled, .btn.disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }
.link-btn { background: none; border: 0; padding: 4px; color: var(--accent); cursor: pointer; text-decoration: none; }

.input, .textarea, .select { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 16px; }
.textarea { min-height: 90px; resize: vertical; line-height: 1.5; }
.input:focus, .textarea:focus, .select:focus { outline: 2px solid #9cc3ad; outline-offset: 0; border-color: var(--accent); }
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.counter { font-size: 12px; color: var(--muted); text-align: right; margin-top: 4px; }

.notice { border-radius: 10px; padding: 10px 12px; font-size: 14px; line-height: 1.55; margin-bottom: 12px; background: var(--soft); }
.notice.tip { background: var(--accent-soft); color: var(--accent-dark); }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.notice.error { background: var(--error-soft); color: var(--error); }
.tag { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--soft); color: var(--muted); white-space: nowrap; }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.error { background: var(--error-soft); color: var(--error); }
.tag.ok { background: var(--accent-soft); color: var(--accent-dark); }

/* 步骤条 */
.steps { display: flex; gap: 4px; margin: 0 0 14px; }
.steps span { flex: 1; height: 4px; border-radius: 2px; background: var(--line); }
.steps span.on { background: var(--accent); }
.step-label { font-size: 13px; color: var(--muted); margin-bottom: 4px; }

/* 底部操作栏 */
.actions { display: flex; gap: 10px; margin-top: 18px; }
.actions .btn { flex: 1; }

/* 上传 */
.drop { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border: 1.5px dashed #a9bcae; border-radius: var(--radius); background: #f8fbf8; padding: 22px 12px; text-align: center; cursor: pointer; }
.drop:hover { border-color: var(--accent); background: #eef6f0; }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop .plus { font-size: 26px; color: var(--accent); line-height: 1; }
.thumbs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 12px; }
.thumb { position: relative; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.thumb img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: #eef2ef; }
.thumb .meta { padding: 8px; font-size: 12px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; min-height: 36px; }
.thumb .remove { position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; border-radius: 50%; border: 0; background: rgba(0,0,0,.55); color: #fff; cursor: pointer; font-size: 16px; line-height: 30px; }
.thumb.selected { outline: 3px solid var(--accent); outline-offset: -1px; }
.thumb.dim img { opacity: .45; }
.progress { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; width: 100%; }
.progress > div { height: 100%; background: var(--accent); width: 0; transition: width .15s; }

/* 商品确认 */
.product-title { font-size: 22px; font-weight: 750; margin: 2px 0 6px; }
.attr { font-size: 13px; color: var(--muted); line-height: 1.6; }
.attr b { color: var(--ink); font-weight: 600; }
.choice { display: flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
.choice input { width: 18px; height: 18px; accent-color: var(--accent); }

/* 视频与选片 */
video.player { display: block; width: 100%; max-height: 56vh; background: #000; border-radius: 12px; }
.tiers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0; }
.tier { border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 8px 4px; cursor: pointer; text-align: center; line-height: 1.3; }
.tier b { display: block; font-size: 16px; }
.tier span { font-size: 12px; color: var(--muted); }
.tier.on { border-color: var(--accent); background: var(--accent-soft); }
.tier:disabled { opacity: .4; cursor: not-allowed; }
input[type=range] { width: 100%; accent-color: var(--accent); height: 32px; }
.window-info { font-size: 14px; background: var(--soft); border-radius: 10px; padding: 10px 12px; font-variant-numeric: tabular-nums; }

/* 分段选择按钮组 */
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg button { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: #fff; cursor: pointer; }
.seg button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.target { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-top: 12px; background: #fbfcfb; }
.target-photo { display: flex; gap: 10px; align-items: center; }
.target-photo img { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; background: #eef2ef; }

/* 汇总 */
.summary { display: grid; grid-template-columns: 88px 1fr; gap: 8px 12px; font-size: 14px; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; }
.price { font-size: 26px; font-weight: 750; color: var(--accent-dark); }
.rules { background: var(--warn-soft); border-radius: 10px; padding: 12px; font-size: 14px; line-height: 1.6; color: #5b4300; }

/* 作品库 */
.task-card { display: flex; gap: 12px; align-items: center; text-decoration: none; color: inherit; }
.task-card img { width: 84px; height: 64px; object-fit: cover; border-radius: 8px; background: #eef2ef; flex: none; }
.task-card .info { flex: 1; min-width: 0; }
.task-card .name { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-card .sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }

/* 状态 */
.status-box { text-align: center; padding: 24px 12px; }
.status-box .big { font-size: 18px; font-weight: 700; margin: 10px 0 6px; }
.spinner { width: 36px; height: 36px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .9s linear infinite; margin: 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { padding: 40px 0; }

/* 提示条与横幅 */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50; background: #1f2d26; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; max-width: calc(100% - 32px); box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.offline-banner { position: sticky; top: 0; z-index: 30; background: var(--error); color: #fff; text-align: center; padding: 8px 12px; font-size: 14px; }

/* 模拟模式调试面板 */
.debug { position: fixed; right: 10px; bottom: 10px; z-index: 40; background: #2b2b2b; color: #eee; border-radius: 10px; padding: 8px 10px; font-size: 12px; display: flex; flex-direction: column; gap: 6px; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.debug select { font-size: 12px; padding: 3px; border-radius: 6px; }
.debug button { font-size: 12px; background: none; border: 1px solid #666; color: #ddd; border-radius: 6px; padding: 2px 6px; cursor: pointer; }

/* 登录 */
.login { max-width: 400px; margin: 10vh auto 0; }
.login .input { font-size: 20px; letter-spacing: .08em; text-align: center; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; text-transform: uppercase; }

@media (min-width: 560px) {
  .thumbs { grid-template-columns: repeat(4, 1fr); }
  main { padding-top: 26px; }
}
