/* =========================================================
   福瑞画布 · 移动端设计系统
   设计语言：冷静创作工具 · 石墨底 · 青玉焦点 · 暖金点缀
   间距：4pt 基准  圆角：24/16/12/999  动效：decelerate
   ========================================================= */

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

:root {
  /* ---- 表面层级：靠明度差建立纵深，而不是靠边框 ---- */
  --bg: #06080A;
  --surface: #0E1216;
  --surface2: #161B21;
  --surface3: #1E242B;
  --sunken: #040608;

  /* ---- 描边 ---- */
  --line: rgba(255, 255, 255, .055);
  --line2: rgba(255, 255, 255, .1);
  --line3: rgba(255, 255, 255, .16);

  /* ---- 文字：三级层次 ---- */
  --text: #E9EEF2;
  --muted: #94A0AB;
  --muted2: #63707C;

  /* ---- 主色 ---- */
  --accent: #2ED3B7;
  --accent-bright: #46E3C8;
  --accent-deep: #0E9E87;
  --accent-soft: rgba(46, 211, 183, .12);
  --accent-line: rgba(46, 211, 183, .38);
  --accent-ink: #04211C;

  /* ---- 功能色 ---- */
  --gold: #F0B429;
  --gold-soft: rgba(240, 180, 41, .14);
  --ok: #3DDC97;
  --warn: #F0B429;
  --err: #FF6B6B;
  --err-soft: rgba(255, 107, 107, .12);

  /* ---- 圆角 ---- */
  --r-xl: 24px;
  --r-lg: 18px;
  --r-md: 14px;
  --r-sm: 10px;

  /* ---- 动效 ---- */
  --ease: cubic-bezier(.22, .61, .36, 1);
  --ease-spring: cubic-bezier(.34, 1.4, .64, 1);

  /* ---- 布局 ---- */
  --top-h: 56px;
  --tab-h: 62px;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
}

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  overscroll-behavior: none;
  touch-action: manipulation;
}

input, textarea { user-select: text; -webkit-user-select: text; font-family: inherit; color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; transition: transform .15s var(--ease), background .15s, color .15s, border-color .15s, opacity .15s; }
button:active { opacity: .92; }
img { display: block; max-width: 100%; }
a { color: var(--accent); text-decoration: none; }

/* 全局微光：极淡的青玉与暖金，制造呼吸感 */
body::before {
  content: '';
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(680px 320px at 50% -8%, rgba(46, 211, 183, .075), transparent 70%),
    radial-gradient(420px 240px at 98% 2%, rgba(240, 180, 41, .04), transparent 72%);
}

/* ================= 骨架 ================= */
#app {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  height: 100vh;
  padding-top: var(--sat);
  overflow: hidden;
}

/* ================= 顶栏 ================= */
.topbar {
  flex: none;
  height: var(--top-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: relative;
  z-index: 10;
}
.topbar::after {
  content: '';
  position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--line) 18%, var(--line) 82%, transparent);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-logo { width: 28px; height: 28px; flex: none; display: block; }
.brand-dot {
  width: 22px; height: 22px; border-radius: 7px; flex: none;
  background: linear-gradient(135deg, var(--accent-bright), var(--accent-deep));
}
.brand-name {
  font-size: 17px; font-weight: 700; letter-spacing: -.01em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.quota-chip {
  display: flex; align-items: baseline; gap: 5px;
  padding: 6px 12px; border-radius: 999px;
  background: transparent;
  border: 1px solid var(--line2);
  flex: none;
  transition: border-color .15s;
}
.quota-chip:active { border-color: var(--accent-line); }
.quota-num {
  font-size: 14px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  letter-spacing: -.01em;
}
.quota-label { font-size: 10.5px; color: var(--muted2); letter-spacing: .04em; }

/* ================= 页面轨道 ================= */
.viewport { flex: 1; position: relative; overflow: hidden; min-height: 0; }

.track {
  display: flex;
  width: 400%;
  height: 100%;
  transform: translateX(0);
  transition: transform .34s var(--ease);
  will-change: transform;
}

.page {
  width: 25%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}
.scroll { padding: 6px 18px 24px; }
.pad-tab { padding-bottom: calc(var(--tab-h) + var(--sab) + 20px); }
.pad-cta { padding-bottom: calc(var(--tab-h) + var(--sab) + 104px); }

/* ================= 底部导航 ================= */
.tabbar {
  flex: none;
  height: calc(var(--tab-h) + var(--sab));
  padding-bottom: var(--sab);
  display: flex;
  background: rgba(7, 9, 11, .84);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border-top: 1px solid var(--line);
  position: relative;
  z-index: 20;
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--muted2);
  min-height: 44px;
  position: relative;
  transition: color .2s var(--ease);
}
.tab span { font-size: 10.5px; letter-spacing: .06em; font-weight: 500; }
.tab svg { transition: transform .26s var(--ease-spring); }

/* 选中：青玉色 + 图标上浮 + 顶部指示点 */
.tab.on { color: var(--accent); }
.tab.on svg { transform: translateY(-2px) scale(1.05); }
.tab.on::before {
  content: '';
  position: absolute; top: 6px; left: 50%; translate: -50% 0;
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(46, 211, 183, .8);
}

/* ================= 悬浮生成按钮 ================= */
.cta {
  position: absolute;
  left: 0; right: 0;
  bottom: calc(var(--tab-h) + var(--sab) + 8px);
  z-index: 18;
  padding: 30px 18px 0;
  background: linear-gradient(180deg, rgba(6, 8, 10, 0) 0%, rgba(6, 8, 10, .9) 52%, var(--bg) 100%);
  transition: transform .28s var(--ease), opacity .2s;
}
#app:not([data-tab="0"]) .cta {
  transform: translateY(135%);
  opacity: 0;
  pointer-events: none;
}
.btn-primary {
  width: 100%;
  min-height: 54px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent-bright), #12B49B);
  color: var(--accent-ink);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .02em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow:
    0 8px 24px rgba(20, 180, 155, .22),
    inset 0 1px 0 rgba(255, 255, 255, .38);
  transition: transform .15s var(--ease), filter .15s, box-shadow .2s;
}
.btn-primary:active { transform: scale(.972); filter: brightness(1.05); }
.btn-primary:disabled { opacity: .35; box-shadow: none; }
.btn-badge {
  font-size: 11px; font-weight: 700;
  padding: 3px 9px; border-radius: 999px;
  background: rgba(4, 33, 28, .18);
  font-variant-numeric: tabular-nums;
}

/* ================= 卡片 ================= */
.card {
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: 18px;
  margin-bottom: 12px;
}
.card-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 14px;
}
.card-head h2 {
  font-size: 14px; font-weight: 600;
  letter-spacing: .01em; flex: none;
}
.card-head .lang-switch { margin-left: 2px; }
.hint {
  font-size: 11px; color: var(--muted2);
  margin-left: auto; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; min-width: 0;
}

/* 页面大标题（画廊） */
.page-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 2px 18px;
}
.page-head h2 {
  font-size: 24px; font-weight: 700;
  letter-spacing: -.03em;
}

.ghost-note {
  background: var(--accent-soft);
  border-radius: var(--r-md);
  padding: 12px 14px;
  font-size: 12.5px;
  color: #8FE9DA;
  margin-bottom: 12px;
  line-height: 1.6;
}

/* ================= 提示词输入 ================= */
.ta-wrap { position: relative; }

textarea#prompt {
  display: block;
  width: 100%;
  min-height: 124px;
  max-height: 40vh;
  resize: none;
  background: var(--sunken);
  border: 1px solid transparent;
  border-radius: var(--r-lg);
  padding: 14px 46px 14px 15px;
  font-size: 15.5px;
  line-height: 1.65;
  letter-spacing: .01em;
  outline: none;
  transition: border-color .2s var(--ease), background .2s;
}
textarea#prompt:focus {
  border-color: var(--accent-line);
  background: #050708;
}
textarea#prompt::placeholder { color: var(--muted2); line-height: 1.6; }

.ta-icon {
  position: absolute; top: 10px; right: 10px;
  width: 32px; height: 32px; border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  background: var(--surface2);
  color: var(--muted);
  transition: .15s;
}
.ta-icon:active { background: var(--accent-soft); color: var(--accent); }
.ta-icon:disabled { opacity: .45; }
.ta-icon.busy svg { animation: spin .9s linear infinite; }

/* ================= 操作小按钮 ================= */
.tool-row {
  display: flex; align-items: center; gap: 4px;
  margin-top: 12px; flex-wrap: wrap;
}
@media (min-width: 380px) {
  .tool-row { gap: 6px; }
}
.mini-btn {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px;
  padding: 7px 8px;
  min-height: 36px;
  border-radius: 999px;
  background: var(--surface2);
  color: var(--muted);
  white-space: nowrap;
  font-weight: 500;
}
.mini-btn:active { background: var(--surface3); color: var(--text); transform: scale(.96); }
.mini-btn.ghost { background: transparent; color: var(--muted2); }
.mini-btn.ghost:active { color: var(--text); background: var(--surface2); }
.mini-btn.primary { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.mini-btn.accent {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.mini-btn.accent:active { background: rgba(46, 211, 183, .2); }
.mini-btn.icon-only { width: 30px; padding: 0; justify-content: center; flex: none; }
.mini-btn.icon-only.on { background: var(--accent-soft); color: var(--accent); }

/* 收藏成功：星标点亮 */
.faved {
  background: var(--gold-soft);
  color: var(--gold);
  animation: favPop .44s var(--ease-spring);
}
.faved svg { fill: var(--gold); stroke: var(--gold); }
@keyframes favPop {
  0% { transform: scale(1); }
  45% { transform: scale(1.24); }
  100% { transform: scale(1); }
}
.mini-btn:disabled { opacity: .55; }

.tool-row.sub-row { margin-top: 8px; justify-content: space-between; align-items: center; }
.tool-hint { font-size: 11.5px; color: var(--muted2); line-height: 1.45; flex: 1; min-width: 0; }

/* ================= 分段 tab（灵感页） ================= */
.seg-tabs {
  display: flex; gap: 3px; padding: 3px;
  background: var(--surface2); border-radius: var(--r-md); margin-bottom: 16px;
}
.seg-tabs button {
  flex: 1; min-height: 40px; border-radius: 11px;
  font-size: 13px; color: var(--muted); font-weight: 500;
}
.seg-tabs button.on { background: var(--surface3); color: var(--text); font-weight: 600; }

/* ================= 我的 API ================= */
.key-list { display: flex; flex-direction: column; gap: 8px; max-height: 38vh; overflow-y: auto; }
.key-empty { font-size: 12.5px; color: var(--muted2); text-align: center; padding: 20px 0; }
.key-item {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 14px; border-radius: var(--r-md);
  background: var(--surface2);
}
.key-item .ki-main { flex: 1; min-width: 0; }
.key-item .ki-name { font-size: 13.5px; font-weight: 500; margin-bottom: 3px; }
.key-item .ki-meta { font-size: 11px; color: var(--muted2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: .01em; }
.key-item .ki-del { font-size: 12px; color: var(--err); padding: 8px 10px; flex: none; }
.key-form { margin-top: 16px; }
.kf-label { display: block; font-size: 11.5px; color: var(--muted2); margin-bottom: 7px; letter-spacing: .04em; }
.kf-hint { font-size: 11.5px; color: var(--muted2); line-height: 1.55; margin: -2px 0 12px; min-height: 16px; }
select.inp {
  appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted2) 50%), linear-gradient(135deg, var(--muted2) 50%, transparent 50%);
  background-position: calc(100% - 18px) 23px, calc(100% - 13px) 23px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

/* ================= 中/EN 切换 ================= */
.lang-switch {
  display: inline-flex;
  border-radius: 999px;
  flex: none;
  background: var(--surface2);
  padding: 2px;
  gap: 2px;
}
.lang-switch button {
  font-size: 10.5px;
  padding: 3px 8px;
  color: var(--muted2);
  border-radius: 999px;
  min-height: 21px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: .02em;
}
.lang-switch button.on { background: var(--accent); color: var(--accent-ink); }

/* ================= 参数选择 ================= */
.field { margin-bottom: 18px; }
.field.last { margin-bottom: 0; }
.field > label {
  display: block;
  font-size: 11.5px;
  color: var(--muted2);
  margin-bottom: 10px;
  letter-spacing: .06em;
  font-weight: 500;
}
.seg { display: flex; gap: 7px; flex-wrap: wrap; }
.seg button {
  flex: 1 1 0;
  min-width: 60px;
  min-height: 48px;
  border-radius: var(--r-md);
  background: var(--surface3);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 2px;
}
.seg button .sub { font-size: 9.5px; color: var(--muted2); letter-spacing: .02em; font-weight: 400; }
.seg button:active { transform: scale(.965); }
/* 选中 = 青玉实底 + 深墨字，焦点极其明确 */
.seg button.on {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}
.seg button.on .sub { color: rgba(4, 33, 28, .62); font-weight: 500; }
.seg button:disabled { opacity: .38; }
.seg-ratio { display: grid; grid-template-columns: repeat(4, 1fr); }
.seg-ratio button { min-width: 0; }

/* ================= 预设 / 标签 ================= */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button {
  font-size: 13px;
  padding: 9px 15px;
  min-height: 38px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid var(--line2);
  color: var(--muted);
  white-space: nowrap;
  font-weight: 500;
}
.chips button:active { background: var(--surface2); color: var(--text); }
.chips button.on {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent);
  font-weight: 600;
}

/* ================= 画面要素 ================= */
.dim { margin-bottom: 16px; }
.dim:last-child { margin-bottom: 0; }
.dim-label {
  font-size: 11.5px; color: var(--muted2);
  margin-bottom: 9px; letter-spacing: .04em;
}
.dim-label em { font-style: normal; color: var(--accent); font-size: 10px; margin-left: 6px; }
.dim .chips button { font-size: 12.5px; padding: 7px 13px; min-height: 34px; }

/* ================= 画廊 ================= */
.gallery-empty { text-align: center; padding: 84px 20px; }
.empty-icon {
  width: 72px; height: 72px; margin: 0 auto 20px;
  border-radius: var(--r-xl);
  background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  color: var(--muted2);
}
.empty-title { font-size: 16px; font-weight: 600; margin-bottom: 7px; letter-spacing: -.01em; }
.empty-sub { font-size: 12.5px; color: var(--muted2); margin-bottom: 24px; line-height: 1.6; }

.group { margin-bottom: 24px; }
.group-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 11px;
  font-size: 11px;
  color: var(--muted2);
  letter-spacing: .06em;
  text-transform: uppercase;
}
.group-tag {
  flex: none;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .08em;
  color: var(--muted2);
}
.group-tag.live { color: var(--accent); }
.group-tag.live::before {
  content: '';
  display: inline-block;
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent);
  margin-right: 6px;
  vertical-align: 1px;
  animation: pulse 1.4s infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
.group-text {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--muted2);
  text-transform: none;
  letter-spacing: .01em;
  font-size: 11.5px;
}
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 9px;
}
.tile {
  position: relative;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--surface);
  aspect-ratio: var(--ar, 1);
  transition: transform .18s var(--ease);
}
.tile:active { transform: scale(.972); }
.tile img { width: 100%; height: 100%; object-fit: cover; }
.tile.state-box {
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 8px;
  padding: 12px; text-align: center;
  font-size: 11px; color: var(--muted2);
  background: var(--surface);
}
.tile .timer { font-size: 21px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.tile.failed { background: rgba(255, 107, 107, .05); }
.tile.failed .timer { color: var(--err); font-size: 13px; }

/* ================= 画廊多选 ================= */
.tile .pick {
  position: absolute; top: 8px; right: 8px;
  width: 24px; height: 24px; border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, .5);
  background: rgba(0, 0, 0, .35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none; align-items: center; justify-content: center;
  z-index: 3;
  transition: .16s var(--ease);
}
body.selecting .tile .pick { display: flex; }
.tile.selected { outline: 2.5px solid var(--accent); outline-offset: -2.5px; }
.tile.selected .pick { background: var(--accent); border-color: var(--accent); }
.tile.selected .pick::after {
  content: '';
  width: 10px; height: 5px;
  border-left: 2px solid var(--accent-ink);
  border-bottom: 2px solid var(--accent-ink);
  transform: rotate(-45deg) translate(1px, -1px);
}
body.selecting .tile { cursor: pointer; }

.selbar {
  position: fixed;
  left: 50%; translate: -50% 0;
  bottom: calc(var(--tab-h) + var(--sab) + 10px);
  width: min(calc(100vw - 24px), 536px);
  z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 10px 10px 16px;
  border-radius: var(--r-xl);
  background: rgba(22, 27, 33, .96);
  backdrop-filter: blur(24px) saturate(1.5);
  -webkit-backdrop-filter: blur(24px) saturate(1.5);
  box-shadow: 0 16px 44px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .05);
  animation: selUp .26s var(--ease);
}
@keyframes selUp { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }
.selbar-info { display: flex; align-items: center; gap: 10px; }
.selbar-info b { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.selbar-all {
  font-size: 12px; color: var(--accent);
  padding: 5px 9px; border-radius: 8px;
  background: var(--accent-soft);
  font-weight: 600;
}
.selbar-acts { display: flex; align-items: center; gap: 6px; }
.selbar-btn {
  min-height: 40px; padding: 0 17px;
  border-radius: 999px;
  font-size: 13px; font-weight: 600;
}
.selbar-btn.ghost { color: var(--muted); background: var(--surface3); }
.selbar-btn.primary { background: var(--accent); color: var(--accent-ink); }
.selbar-btn:disabled { opacity: .4; }

/* ================= 骨架屏 / 载入 ================= */
.shimmer { position: absolute; inset: 0; overflow: hidden; }
.shimmer::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 25%, rgba(255, 255, 255, .05) 50%, transparent 75%);
  animation: sweep 1.6s infinite;
}
@keyframes sweep { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid rgba(46, 211, 183, .18);
  border-top-color: var(--accent);
  animation: spin .8s linear infinite;
  flex: none;
}

/* ================= 灵感 ================= */
.inspire-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 2px 18px;
}
.inspire-head h2 { font-size: 24px; font-weight: 700; letter-spacing: -.03em; }
.filter-chips { margin-bottom: 16px; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; }
.filter-chips::-webkit-scrollbar { display: none; }
.filter-chips button { font-size: 12px; padding: 8px 14px; min-height: 34px; flex: none; }

.inspire-list { display: flex; flex-direction: column; gap: 10px; }
.inspire-card {
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: 16px;
  text-align: left;
  transition: background .16s;
}
.inspire-card:active { background: var(--surface2); }
.inspire-card .ic-tag {
  display: inline-block;
  font-size: 10px; font-weight: 600;
  padding: 3px 9px; border-radius: 7px;
  background: var(--accent-soft); color: var(--accent);
  margin-bottom: 10px;
  letter-spacing: .04em;
}
.inspire-card p { font-size: 13.5px; line-height: 1.7; color: #CFD8DF; letter-spacing: .01em; }
.inspire-card .ic-go { margin-top: 11px; font-size: 11.5px; color: var(--accent); font-weight: 600; }
.inspire-card .ic-row { display: flex; align-items: center; justify-content: space-between; margin-top: 11px; }
.inspire-card .ic-time { font-size: 11px; color: var(--muted2); }
.inspire-card .ic-go.small { margin-top: 0; }
.inspire-card .ic-del {
  font-size: 11.5px; color: var(--err);
  padding: 5px 10px; border-radius: 8px;
  background: var(--err-soft);
}

/* ================= 我的 ================= */
.profile {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 2px 22px;
}
.avatar {
  width: 56px; height: 56px; border-radius: var(--r-lg);
  background: linear-gradient(140deg, var(--accent-bright), var(--accent-deep));
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; font-weight: 700;
  letter-spacing: -.02em;
  color: var(--accent-ink);
  flex: none;
}
.profile-info { flex: 1; min-width: 0; }
.profile-name {
  font-size: 16px; font-weight: 600;
  margin-bottom: 3px; letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
}
.profile-sub {
  font-size: 12px; color: var(--muted2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.usage-row {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12.5px; color: var(--muted);
  margin-bottom: 12px;
}
.usage-row span:last-child { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.usage-bar { height: 6px; border-radius: 999px; background: var(--surface2); overflow: hidden; }
.usage-fill {
  height: 100%; width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-deep));
  transition: width .45s var(--ease);
}

.list-card { padding: 4px 0; }
.list-item {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px;
  font-size: 14px;
  text-align: left;
  min-height: 54px;
  position: relative;
  color: var(--text);
}
.list-item::after {
  content: '';
  position: absolute; left: 18px; right: 0; bottom: 0; height: 1px;
  background: var(--line);
}
.list-item:last-child::after { display: none; }
.list-item:active { background: var(--surface2); }
.list-val {
  font-size: 13px; color: var(--muted2);
  font-variant-numeric: tabular-nums;
  letter-spacing: .01em;
}
.list-item .danger { color: var(--err); }

.about { text-align: center; padding: 26px 18px; background: transparent; }
.about-title { font-size: 13.5px; font-weight: 600; margin-bottom: 5px; letter-spacing: .01em; }
.about-sub { font-size: 11.5px; color: var(--muted2); margin-bottom: 9px; }
.about-meta { font-size: 10.5px; color: var(--muted2); opacity: .62; letter-spacing: .02em; line-height: 1.6; }

/* ================= 生成进度浮层 ================= */
.progress-mask {
  position: fixed; inset: 0; z-index: 70;
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0 18px calc(var(--tab-h) + var(--sab) + 80px);
  background: linear-gradient(180deg, transparent, rgba(6, 8, 10, .6));
  pointer-events: none;
}
.progress-card {
  pointer-events: auto;
  width: 100%;
  background: rgba(22, 27, 33, .97);
  backdrop-filter: blur(24px) saturate(1.5);
  -webkit-backdrop-filter: blur(24px) saturate(1.5);
  border-radius: var(--r-xl);
  padding: 16px 18px;
  box-shadow: 0 16px 44px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .05);
  animation: slideUp .3s var(--ease);
}
@keyframes slideUp { from { transform: translateY(26px); opacity: 0; } }
.progress-top { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.progress-title { font-size: 14px; font-weight: 600; letter-spacing: -.01em; }
.progress-sub { font-size: 12px; color: var(--muted2); margin-bottom: 12px; font-variant-numeric: tabular-nums; }
.progress-track { height: 4px; border-radius: 999px; background: var(--surface3); overflow: hidden; margin-bottom: 14px; }
.progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-deep)); transition: width .35s var(--ease); }
#goGallery { width: 100%; justify-content: center; background: var(--surface3); }

/* ================= 全屏看图 ================= */
.viewer {
  position: fixed; inset: 0; z-index: 90;
  background: #030405;
  display: flex; flex-direction: column;
  padding-top: var(--sat); padding-bottom: var(--sab);
  animation: fadeIn .2s ease;
}
@keyframes fadeIn { from { opacity: 0; } }
.viewer-top {
  flex: none; height: 56px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px;
}
.icon-btn {
  width: 42px; height: 42px; border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  color: #fff; background: rgba(255, 255, 255, .07);
  backdrop-filter: blur(10px);
}
.icon-btn:active { background: rgba(255, 255, 255, .16); }
.viewer-counter {
  font-size: 12.5px; color: var(--muted);
  font-variant-numeric: tabular-nums; letter-spacing: .04em;
}
.viewer-stage {
  flex: 1; display: flex; align-items: center; justify-content: center;
  overflow: hidden; padding: 8px;
  touch-action: none;
}
.viewer-stage img {
  max-width: 100%; max-height: 100%;
  border-radius: var(--r-md);
  transition: transform .22s var(--ease);
  transform-origin: center;
}
.viewer-bottom {
  flex: none; display: flex; gap: 10px;
  padding: 16px 18px 26px;
}
.v-btn {
  flex: 1; min-height: 50px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .09);
  color: #fff; font-size: 14px; font-weight: 600;
}
.v-btn:active { background: rgba(255, 255, 255, .18); }
.v-btn:first-child { background: var(--accent); color: var(--accent-ink); }

/* ================= 底部弹层 ================= */
.sheet { position: fixed; inset: 0; z-index: 95; }
.sheet-mask {
  position: absolute; inset: 0;
  background: rgba(3, 4, 5, .68);
  backdrop-filter: blur(3px);
  animation: fadeIn .2s;
}
.sheet-body {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: var(--surface);
  border-radius: 28px 28px 0 0;
  padding: 10px 22px calc(26px + var(--sab));
  animation: sheetUp .34s var(--ease);
  box-shadow: 0 -12px 40px rgba(0, 0, 0, .4);
}
@keyframes sheetUp { from { transform: translateY(100%); } }
.sheet-handle {
  width: 40px; height: 4px; border-radius: 999px;
  background: var(--line3); margin: 0 auto 20px;
}
.sheet-body h3 { font-size: 20px; font-weight: 700; letter-spacing: -.02em; margin-bottom: 6px; }
.sheet-sub { font-size: 12.5px; color: var(--muted2); margin-bottom: 22px; line-height: 1.6; }
.inp {
  width: 100%; min-height: 52px;
  background: var(--sunken);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  padding: 0 16px;
  font-size: 15px;
  margin-bottom: 10px;
  outline: none;
  transition: border-color .2s;
}
.inp:focus { border-color: var(--accent-line); }
.form-msg { font-size: 12.5px; color: var(--err); min-height: 18px; margin-bottom: 8px; }
.link-btn {
  display: block; width: 100%; text-align: center;
  font-size: 13px; color: var(--muted); padding: 16px 0 0;
}
.sheet-body.compact { padding-bottom: calc(16px + var(--sab)); }
.action-item {
  width: 100%; min-height: 58px;
  font-size: 15px;
  font-weight: 500;
  position: relative;
  text-align: center;
  color: var(--text);
}
.action-item::after {
  content: '';
  position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: var(--line);
}
.action-item:last-child::after { display: none; }
.action-item:active { background: var(--surface2); }
.action-item.danger { color: var(--err); }

/* ================= Toast ================= */
.toast {
  position: fixed;
  left: 50%; bottom: calc(var(--tab-h) + var(--sab) + 92px);
  transform: translate(-50%, 14px);
  z-index: 120;
  background: rgba(26, 32, 38, .97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  padding: 12px 20px;
  border-radius: 999px;
  max-width: calc(100vw - 48px);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .45);
  transition: .24s var(--ease);
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: rgba(58, 22, 26, .97); }

/* ================= 适配 ================= */
@media (min-width: 640px) {
  .scroll { padding-left: 26px; padding-right: 26px; }
  .grid { grid-template-columns: repeat(3, 1fr); }
  .cta { left: 26px; right: 26px; }
}
@media (min-width: 900px) {
  #app {
    max-width: 560px; margin: 0 auto;
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
  }
  .grid { grid-template-columns: repeat(2, 1fr); }
}

/* 极窄屏（360px 及以下）：五个操作必须保住单行 */
@media (max-width: 379px) {
  .tool-row { gap: 3px; }
  .mini-btn { font-size: 11px; padding: 7px 7px; }
  .mini-btn.icon-only { width: 28px; }
  .scroll { padding-left: 15px; padding-right: 15px; }
  .card { padding: 16px; }
  .seg button { min-height: 46px; font-size: 12.5px; }
  .page-head h2, .inspire-head h2 { font-size: 22px; }
}
