* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root {
  --red: #FF2442; --pink: #FF6B9D; --bg: #f7f7f8; --card: #fff;
  --text: #1a1a1a; --muted: #8a8a8a; --line: #ececec; --radius: 16px;
}
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.6;
  max-width: 540px; margin: 0 auto; padding-bottom: 80px;
}
header {
  background: linear-gradient(135deg, var(--pink), var(--red));
  color: #fff; padding: 18px 20px; position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
}
header h1 { font-size: 19px; font-weight: 700; }
header .quota { font-size: 12px; background: rgba(255,255,255,0.25); padding: 4px 10px; border-radius: 20px; }

/* 底部 tab */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 540px; background: #fff; border-top: 1px solid var(--line);
  display: flex; z-index: 50;
}
.tabbar button {
  flex: 1; border: none; background: none; padding: 10px 0 14px; font-size: 11px;
  color: var(--muted); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.tabbar button .ico { font-size: 22px; }
.tabbar button.active { color: var(--red); }

.page { display: none; padding: 16px; }
.page.active { display: block; }

.card { background: var(--card); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; box-shadow: 0 2px 12px rgba(0,0,0,0.04); }
.card h3 { font-size: 15px; margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }

label { font-size: 13px; color: var(--muted); display: block; margin: 10px 0 5px; }
input, textarea, select {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px;
  font-size: 15px; font-family: inherit; background: #fafafa; color: var(--text);
}
textarea { resize: vertical; min-height: 80px; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--pink); background: #fff; }

.btn {
  width: 100%; border: none; border-radius: 12px; padding: 14px; font-size: 16px; font-weight: 600;
  cursor: pointer; transition: opacity .2s; margin-top: 12px;
}
.btn-primary { background: linear-gradient(135deg, var(--pink), var(--red)); color: #fff; }
.btn-ghost { background: #f0f0f0; color: var(--text); }
.btn:active { opacity: .8; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm { width: auto; padding: 7px 14px; font-size: 13px; margin: 0; border-radius: 8px; }

.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.muted { color: var(--muted); font-size: 13px; }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; font-size: 14px; }

/* 列表项 */
.list-item { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; cursor: pointer; transition: all .15s; }
.list-item.sel { border-color: var(--red); background: #fff5f7; }
.list-item .li-title { font-weight: 600; font-size: 14px; }
.list-item .li-meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.tag { display: inline-block; background: #fff0f3; color: var(--red); font-size: 11px; padding: 2px 8px; border-radius: 10px; margin: 2px 3px 0 0; }
.chip-actions { display: flex; gap: 8px; margin-top: 8px; }

/* 生成结果 */
.result-imgs { display: flex; gap: 10px; overflow-x: auto; padding: 4px 0 8px; scroll-snap-type: x mandatory; }
.result-imgs img { height: 320px; border-radius: 12px; scroll-snap-align: start; flex-shrink: 0; box-shadow: 0 2px 10px rgba(0,0,0,.1); }
.result-body { white-space: pre-wrap; font-size: 14px; background: #fafafa; border-radius: 10px; padding: 12px; margin-top: 10px; }

/* 分享弹窗 */
.modal { display: none; position: fixed; inset: 0; z-index: 999; }
.modal.show { display: block; }
.modal .mask { position: absolute; inset: 0; background: rgba(0,0,0,.6); }
.modal .sheet {
  position: absolute; bottom: 0; left: 0; right: 0; background: #fff;
  border-radius: 22px 22px 0 0; max-height: 90vh; overflow-y: auto; padding: 0 18px 30px;
  max-width: 540px; margin: 0 auto;
}
.modal .bar { width: 44px; height: 5px; background: #ddd; border-radius: 3px; margin: 12px auto; }
.modal h3 { display: flex; justify-content: space-between; align-items: center; font-size: 18px; padding: 6px 0 14px; }
.modal h3 .x { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--muted); }
#shareImages { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 8px; }
#shareImages img { height: 220px; border-radius: 10px; cursor: pointer; flex-shrink: 0; }
#shareCaption { white-space: pre-wrap; font-size: 14px; background: #fff5f7; border-radius: 12px; padding: 14px; margin: 12px 0; max-height: 180px; overflow-y: auto; }

/* toast */
.toast {
  position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,.82); color: #fff; padding: 10px 20px; border-radius: 22px;
  font-size: 14px; z-index: 9999; opacity: 0; transition: opacity .3s; pointer-events: none;
}
.toast.show { opacity: 1; }

.loading { text-align: center; padding: 30px; color: var(--muted); }
.spinner { width: 32px; height: 32px; border: 3px solid #eee; border-top-color: var(--red); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }

.banner { background: #fff5e6; border: 1px solid #ffe0b0; color: #8a5a00; font-size: 13px; padding: 10px 12px; border-radius: 10px; margin-bottom: 12px; }
