:root {
  --bg: #f6f4ef;
  --panel: #ffffff;
  --ink: #1a1815;
  --ink-2: #4a453e;
  --muted: #8a8278;
  --line: #e8e3d9;
  --line-2: #dcd5c8;
  --accent: #b4552b;
  --accent-soft: #fbf1ea;
  --ok: #2f7d5d;
  --ok-soft: #eaf5ef;
  --err: #b23b36;
  --err-soft: #fbeceb;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(26, 24, 21, .04), 0 8px 24px -16px rgba(26, 24, 21, .18);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.55 "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; }
.muted { color: var(--muted); }

/* topbar */
.s-top {
  height: 64px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; background: rgba(255, 255, 255, .86); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 40;
}
.s-brand { display: flex; align-items: center; gap: 10px; }
.s-logo {
  width: 34px; height: 34px; border-radius: 10px; background: var(--ink); color: #f6f1e7;
  display: grid; place-items: center; font-weight: 700; font-size: 15px; letter-spacing: .5px;
}
.s-brand-text h1, .s-brand-text b { display: block; font-size: 15px; font-weight: 650; letter-spacing: .2px; }
.s-brand-text small { display: block; margin-top: 1px; color: var(--muted); font-size: 11.5px; letter-spacing: .3px; }
.s-actions { display: flex; align-items: center; gap: 9px; }
.s-pill {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 13px;
  border-radius: 9px; background: #fff7ec; color: #8c5a1d; border: 1px solid #efd9b8; font-size: 13px;
}
.s-pill b { font-variant-numeric: tabular-nums; font-weight: 650; }
.s-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 15px; border-radius: 9px; border: 1px solid var(--line-2);
  background: #fff; color: var(--ink); font-size: 13px; cursor: pointer; white-space: nowrap;
}
.s-btn:hover { border-color: #c9c1b3; }
.s-btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.s-btn.primary:hover { background: #000; }
.s-btn.ghost { background: transparent; }
.s-btn.sm { height: 32px; padding: 0 12px; font-size: 12.5px; }
.s-btn.lg { height: 46px; padding: 0 24px; font-size: 15px; border-radius: 11px; }
.s-btn.block { width: 100%; }
.s-btn:disabled { opacity: .55; cursor: not-allowed; }
.s-avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--ink); color: #fff;
  display: grid; place-items: center; font-size: 13px; font-weight: 600;
}
.s-main { min-height: calc(100vh - 64px); padding-bottom: 40px; }

/* landing */
.hero {
  max-width: 1180px; margin: 0 auto; padding: 64px 28px 40px;
  display: grid; grid-template-columns: 1.05fr .95fr; gap: 42px; align-items: center;
}
.eyebrow {
  display: inline-block; padding: 5px 11px; border-radius: 999px; background: var(--accent-soft);
  color: var(--accent); font-size: 12px; letter-spacing: .5px; margin-bottom: 16px;
}
.hero h1 { margin: 0; font-size: 46px; line-height: 1.15; letter-spacing: -1.5px; font-weight: 700; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero-sub { color: var(--ink-2); font-size: 15px; max-width: 500px; margin: 18px 0 24px; line-height: 1.8; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-note { color: var(--muted); font-size: 12.5px; margin-top: 16px; }
.hero-art { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.art-card { margin: 0; border-radius: 16px; overflow: hidden; background: #eae5db; box-shadow: var(--shadow); }
.art-card img { width: 100%; height: 210px; object-fit: cover; display: block; }
.art-card.a1 { transform: translateY(18px) rotate(-2deg); }
.art-card.a2 { transform: translateY(-8px) rotate(2deg); }
.art-card.a3 { transform: translateY(4px) rotate(1deg); }
.art-badge {
  position: absolute; left: 10px; bottom: -10px; background: rgba(26, 24, 21, .82);
  color: #fff; font-size: 11px; padding: 5px 10px; border-radius: 999px;
}
.feature-row {
  max-width: 1180px; margin: 20px auto 0; padding: 0 28px;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
}
.feature { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.feature b { display: block; font-size: 15px; margin-bottom: 4px; }
.feature p { margin: 0; color: var(--muted); font-size: 13px; }
.price-sec { max-width: 1180px; margin: 52px auto 0; padding: 0 28px; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.sec-head h2 { font-size: 22px; margin: 0; letter-spacing: -.4px; }
.sec-head a { color: var(--accent); font-size: 13px; }
.price-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.price-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.price-card span { color: var(--muted); font-size: 12.5px; }
.price-card b { display: block; font-size: 22px; margin: 6px 0 2px; letter-spacing: -.3px; }
.price-card small { color: var(--muted); font-size: 11.5px; }
.price-note { color: var(--muted); font-size: 12px; margin-top: 12px; }
.s-footer {
  max-width: 1180px; margin: 54px auto 0; padding: 22px 28px; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; color: var(--muted); font-size: 12px;
}

/* auth */
.auth-wrap { min-height: calc(100vh - 64px); display: grid; place-items: center; padding: 30px 16px 70px; }
.auth-card { width: 100%; max-width: 410px; background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 28px; box-shadow: var(--shadow); }
.auth-brand { display: flex; align-items: center; gap: 9px; margin-bottom: 18px; font-size: 14px; }
.auth-card h1 { margin: 0; font-size: 24px; letter-spacing: -.5px; }
.auth-sub { color: var(--muted); font-size: 13px; margin: 5px 0 18px; }
.auth-tabs { display: flex; background: #f3f0e9; border-radius: 10px; padding: 3px; margin-bottom: 18px; }
.auth-tabs a { flex: 1; text-align: center; padding: 8px; border-radius: 8px; font-size: 13px; color: var(--muted); }
.auth-tabs a.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); font-weight: 600; }
.auth-card label { display: block; font-size: 12.5px; color: var(--ink-2); margin-bottom: 12px; }
.auth-card input[type=text], .auth-card input[type=email], .auth-card input[type=password] {
  width: 100%; height: 42px; margin-top: 5px; padding: 0 12px; border: 1px solid var(--line-2);
  border-radius: 9px; background: #fdfcf9; outline: none; font-size: 14px;
}
.auth-card input:focus { border-color: var(--ink); background: #fff; }
.auth-check { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; color: var(--muted); }
.auth-check input { margin-top: 3px; }
.auth-err { background: var(--err-soft); color: var(--err); padding: 9px 12px; border-radius: 9px; font-size: 12.5px; margin-bottom: 12px; }
.auth-tip { text-align: center; color: var(--muted); font-size: 12.5px; margin: 14px 0 0; }
.auth-tip a { color: var(--accent); }

/* app */
.app-grid { max-width: 1180px; margin: 0 auto; padding: 22px 28px 20px; display: grid; grid-template-columns: 420px minmax(0, 1fr); gap: 20px; align-items: start; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.composer { padding: 18px; }
.seg { display: flex; background: #f3f0e9; border-radius: 10px; padding: 3px; margin-bottom: 16px; }
.seg-btn { flex: 1; border: 0; background: transparent; padding: 9px; border-radius: 8px; font-size: 13px; color: var(--muted); cursor: pointer; }
.seg-btn.on { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.field-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 7px; }
.field-head label { font-size: 13px; font-weight: 600; }
.hint { color: var(--muted); font-size: 11.5px; }
.prompt-box { border: 1px solid var(--line-2); border-radius: 11px; background: #fdfcf9; padding: 10px; margin-bottom: 14px; }
.prompt-box textarea { width: 100%; border: 0; background: transparent; resize: vertical; min-height: 116px; outline: none; font-size: 13.5px; line-height: 1.7; color: var(--ink); }
.prompt-bar { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 11.5px; }
.prompt-tools { display: flex; gap: 6px; }
.ai-chip { border: 1px solid #ecd3c2; background: var(--accent-soft); color: var(--accent); border-radius: 7px; padding: 5px 9px; font-size: 11.5px; cursor: pointer; }
.mini-field.full { margin-bottom: 12px; }

.formats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.format-btn { height: 38px; border: 1px solid var(--line-2); border-radius: 9px; background: #fff; font-size: 13px; font-weight: 600; color: var(--ink); cursor: pointer; }
.format-btn.on { background: var(--ink); color: #fff; border-color: var(--ink); }

.dropzone {
  border: 1px dashed var(--line-2); border-radius: 12px; background: #fdfcf9;
  padding: 16px; text-align: center; color: var(--muted); cursor: pointer;
  display: flex; flex-direction: column; gap: 3px;
}
.dropzone.drag { background: #f7f3ea; border-color: var(--ink); }
.dropzone span { font-size: 12.5px; }
.dropzone small { font-size: 11px; }
.thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 8px 0 12px; }
.thumb { position: relative; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: #fff; }
.thumb img { width: 100%; height: 74px; object-fit: cover; display: block; }
.thumb .idx { position: absolute; left: 4px; top: 4px; background: rgba(26,24,21,.75); color: #fff; font-size: 10px; padding: 2px 5px; border-radius: 999px; }
.thumb .del { position: absolute; right: 4px; top: 4px; width: 18px; height: 18px; border: 0; border-radius: 50%; background: rgba(26,24,21,.75); color: #fff; font-size: 12px; line-height: 1; cursor: pointer; }
.thumb .left, .thumb .right { position: absolute; bottom: 4px; width: 18px; height: 18px; border: 0; border-radius: 50%; background: rgba(255,255,255,.9); color: #111; font-size: 12px; line-height: 1; cursor: pointer; }
.thumb .left { left: 4px; }
.thumb .right { right: 4px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.mini-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.mini-field > span { color: var(--muted); font-size: 11.5px; }
.mini-field select, .custom-pay input {
  height: 38px; border: 1px solid var(--line-2); border-radius: 9px; background: #fff;
  padding: 0 10px; font-size: 13px; color: var(--ink); outline: none; width: 100%;
}
.upload-btn { height: 38px; border: 1px dashed var(--line-2); border-radius: 9px; background: #fdfcf9; color: var(--ink-2); font-size: 12.5px; cursor: pointer; }
.ref-preview { position: relative; margin: -2px 0 12px; }
.ref-preview img { width: 100%; max-height: 160px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); display: block; }
.ref-preview button { position: absolute; right: 8px; bottom: 8px; border: 0; background: rgba(26,24,21,.8); color: #fff; border-radius: 7px; padding: 4px 9px; font-size: 11.5px; cursor: pointer; }
.gen-btn { height: 44px; margin-top: 4px; }
.gen-meta { text-align: center; color: var(--muted); font-size: 11.5px; margin: 9px 0 0; }
.gen-result { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 14px; }
.gen-result img, .gen-result video { width: 100%; border-radius: 10px; display: block; }
.gen-result .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.gen-progress { height: 8px; border-radius: 999px; background: #f0ece3; overflow: hidden; margin: 4px 0 7px; }
.gen-progress i { display: block; height: 100%; width: 0; background: var(--ink); transition: width .35s; }
.gen-progress-text { display: flex; justify-content: space-between; color: var(--muted); font-size: 11.5px; }
.gen-error { background: var(--err-soft); color: var(--err); border-radius: 9px; padding: 10px 12px; font-size: 12.5px; }
.records-panel { min-width: 0; }
.rec-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.rec-head h2 { font-size: 18px; margin: 0; }
.rec-head a { color: var(--muted); font-size: 12.5px; }
.job-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.job-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
.job-thumb { height: 150px; background: #f0ece3; position: relative; display: grid; place-items: center; }
.job-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.job-ph { color: var(--muted); font-size: 12px; }
.job-badge { position: absolute; left: 8px; top: 8px; background: rgba(26,24,21,.72); color: #fff; font-size: 10.5px; padding: 3px 7px; border-radius: 999px; }
.job-badge.succeeded { background: rgba(47,125,93,.88); }
.job-badge.failed { background: rgba(178,59,54,.88); }
.job-body { padding: 9px 10px 10px; }
.job-prompt { margin: 0 0 5px; font-size: 12.5px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; }
.empty-note { grid-column: 1 / -1; text-align: center; color: var(--muted); font-size: 13px; padding: 40px 10px; border: 1px dashed var(--line-2); border-radius: 12px; }

/* records page */
.page-head { max-width: 1180px; margin: 0 auto; padding: 28px 28px 12px; display: flex; align-items: baseline; gap: 12px; }
.page-head h1 { font-size: 24px; margin: 0; }
.filter-row { max-width: 1180px; margin: 0 auto; padding: 0 28px 14px; display: flex; gap: 9px; flex-wrap: wrap; }
.filter-row select { height: 34px; border: 1px solid var(--line-2); border-radius: 8px; background: #fff; padding: 0 10px; font-size: 12.5px; }
.job-grid.wide { max-width: 1180px; margin: 0 auto; padding: 0 28px; grid-template-columns: repeat(3, 1fr); }
.pager { display: flex; gap: 6px; justify-content: center; margin: 22px 0; }
.pager a { min-width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid var(--line-2); border-radius: 8px; background: #fff; font-size: 12.5px; }
.pager a.on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* wallet */
.wallet-grid { max-width: 1180px; margin: 0 auto; padding: 22px 28px 16px; display: grid; grid-template-columns: .85fr 1.15fr; gap: 18px; }
.balance-card { padding: 22px; background: linear-gradient(135deg, #26221d, #3b332a); color: #fff; border: 0; }
.balance-label { color: rgba(255,255,255,.6); font-size: 12.5px; }
.balance-num { display: block; font-size: 40px; letter-spacing: -1px; margin: 8px 0 2px; }
.balance-sub { color: rgba(255,255,255,.62); font-size: 12.5px; }
.balance-actions { display: flex; gap: 10px; margin-top: 18px; }
.balance-actions .s-btn.primary { background: #fff; color: var(--ink); border-color: #fff; }
.balance-actions .s-btn.ghost { color: #fff; border-color: rgba(255,255,255,.25); }
.balance-tip { color: rgba(255,255,255,.55); font-size: 11.5px; margin: 16px 0 0; }
.wallet-grid .card { padding: 18px; }
.package-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.package { border: 1px solid var(--line-2); background: #fdfcf9; border-radius: 10px; padding: 12px 6px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.package:hover { border-color: var(--ink); }
.package b { font-size: 19px; }
.package span { color: var(--muted); font-size: 12px; }
.package i { font-style: normal; color: var(--accent); font-size: 10.5px; }
.custom-pay { display: flex; gap: 8px; margin-top: 12px; }
.custom-pay input { flex: 1; }
.pay-note { color: var(--muted); font-size: 11.5px; margin: 10px 0 0; }
.price-card-wrap { max-width: 1124px; margin: 0 auto; padding: 18px; }
.price-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.price-table th { text-align: left; color: var(--muted); font-weight: 500; font-size: 11.5px; padding: 8px; border-bottom: 1px solid var(--line); }
.price-table td { padding: 10px 8px; border-bottom: 1px solid #f1ede5; }
.price-table b { color: var(--accent); }
.wallet-grid + .card { margin-top: 16px; }
.ledger-list { display: flex; flex-direction: column; }
.ledger-row { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid #f1ede5; }
.ledger-row:last-child { border-bottom: 0; }
.ledger-row b { font-size: 13px; display: block; }
.ledger-row small { color: var(--muted); font-size: 11px; }
.ledger-row .plus { color: var(--ok); font-weight: 600; }
.ledger-row .minus { color: var(--ink-2); font-weight: 600; }

/* profile */
.profile-wrap { max-width: 820px; margin: 22px auto; padding: 0 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.profile-card { padding: 20px; }
.profile-card h2 { font-size: 18px; margin: 0 0 14px; }
.info-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid #f1ede5; font-size: 13px; }
.info-row:last-child { border-bottom: 0; }
.info-row span { color: var(--muted); }
.info-row b { font-weight: 600; text-align: right; }
.profile-card .mini-field { margin-bottom: 10px; }
.profile-card .mini-field input { height: 40px; border: 1px solid var(--line-2); border-radius: 9px; padding: 0 11px; background: #fdfcf9; font-size: 13.5px; outline: none; }
.auth-err.ok { background: var(--ok-soft); color: var(--ok); }

/* modal / toast */
.s-modal { position: fixed; inset: 0; background: rgba(26,24,21,.45); display: grid; place-items: center; z-index: 80; padding: 18px; }
.s-modal-box { position: relative; width: 100%; max-width: 420px; background: #fff; border-radius: 16px; padding: 22px; box-shadow: 0 24px 60px rgba(0,0,0,.22); max-height: 86vh; overflow: auto; }
.s-modal-x { position: absolute; right: 12px; top: 9px; border: 0; background: none; font-size: 24px; color: var(--muted); cursor: pointer; }
.s-modal-box h3 { margin: 0 0 6px; font-size: 18px; }
.pay-box { text-align: center; }
.pay-box #payBody { margin-top: 14px; }
.pay-qr { width: 210px; height: 210px; margin: 10px auto; display: block; }
.s-toast { position: fixed; left: 50%; bottom: 88px; transform: translateX(-50%); background: rgba(26,24,21,.92); color: #fff; padding: 9px 16px; border-radius: 9px; font-size: 12.5px; z-index: 90; }
.site-alert { max-width: 1124px; margin: 16px auto 0; padding: 10px 14px; border-radius: 10px; background: var(--err-soft); color: var(--err); font-size: 12.5px; }
.site-alert.ok { background: var(--ok-soft); color: var(--ok); }
.s-tabbar { display: none; }

/* H5 */
@media (max-width: 860px) {
  .s-top { height: 56px; padding: 0 14px; }
  .s-brand-text small { display: none; }
  .s-brand-text b { font-size: 14px; }
  .s-logo { width: 30px; height: 30px; font-size: 13px; }
  .hide-sm { display: none; }
  .s-main { padding-bottom: 72px; }
  .hero { grid-template-columns: 1fr; padding: 34px 18px 20px; gap: 24px; }
  .hero h1 { font-size: 34px; }
  .hero-art { max-width: 440px; }
  .art-card img { height: 150px; }
  .feature-row, .price-grid { grid-template-columns: 1fr 1fr; padding: 0 18px; }
  .price-sec { padding: 0 18px; margin-top: 34px; }
  .price-grid { padding: 0; }
  .app-grid { grid-template-columns: 1fr; padding: 14px 14px 10px; }
  .job-grid { grid-template-columns: 1fr 1fr; }
  .job-grid.wide { grid-template-columns: 1fr 1fr; padding: 0 14px; }
  .page-head, .filter-row { padding-left: 14px; padding-right: 14px; }
  .wallet-grid { grid-template-columns: 1fr; padding: 14px; }
  .profile-wrap { grid-template-columns: 1fr; padding: 0 14px; }
  .price-card-wrap { margin: 0 14px; }
  .s-footer { flex-direction: column; gap: 6px; padding: 20px 18px; }
  .s-tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    background: rgba(255,255,255,.96); backdrop-filter: blur(12px); border-top: 1px solid var(--line);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  }
  .s-tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--muted); font-size: 10.5px; padding: 4px 0; }
  .s-tabbar a span { font-size: 16px; line-height: 1; }
  .s-tabbar a.on { color: var(--ink); font-weight: 600; }
}
@media (max-width: 480px) {
  .job-grid, .job-grid.wide { grid-template-columns: 1fr 1fr; }
  .feature-row { grid-template-columns: 1fr; }
  .price-grid { grid-template-columns: 1fr 1fr; }
  .package-grid { grid-template-columns: 1fr 1fr; }
  .s-actions .s-btn.primary { padding: 0 12px; }
}
