/* 长辈 AI 视频站 —— 大字、大按钮、暖色 */
:root {
  --bg: #faf5ee;
  --card: #ffffff;
  --primary: #e05a2b;
  --primary-dark: #c74a1f;
  --gold: #b97d10;
  --text: #3a3226;
  --muted: #9a8f80;
  --line: #eee4d8;
  --ok: #3c9a5f;
  --bad: #d4452f;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: 18px; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
button { font-family: inherit; }
h1, h2, h3 { margin: 0; font-weight: 700; }

/* 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: linear-gradient(135deg, #e05a2b, #d8802f);
  color: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.topbar .site-name { font-size: 1.25rem; font-weight: 800; letter-spacing: 1px; }
.topbar .user-chip {
  display: flex; align-items: center; gap: 8px; font-size: .95rem;
  background: rgba(255,255,255,.18); border-radius: 999px; padding: 6px 14px;
}
.topbar .points-chip { background: #fff; color: var(--primary-dark); border-radius: 999px; padding: 2px 10px; font-weight: 700; }

/* 底部导航 */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  display: flex; background: #fff; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1; text-align: center; padding: 10px 0 8px; text-decoration: none;
  color: var(--muted); font-size: .95rem;
}
.tabbar a .icon { display: block; font-size: 1.5rem; line-height: 1.2; }
.tabbar a.active { color: var(--primary); font-weight: 700; }

/* 主体 */
.container { padding: 14px 14px 0; max-width: 640px; margin: 0 auto; }

/* 首页 tabs */
.tabs { display: flex; gap: 10px; margin-bottom: 12px; }
.tabs button {
  flex: 1; border: none; background: #efe6d9; color: var(--text);
  font-size: 1.05rem; font-weight: 700; padding: 12px 0; border-radius: 14px;
}
.tabs button.active { background: var(--primary); color: #fff; }

/* 模板卡片 */
.tpl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tpl-card {
  background: var(--card); border-radius: 16px; overflow: hidden;
  box-shadow: 0 2px 10px rgba(90,60,20,.08); border: none; padding: 0; text-align: left;
  cursor: pointer;
}
.tpl-card .media { position: relative; width: 100%; aspect-ratio: 3 / 4; background: #f1e8dc; }
.tpl-card .media video, .tpl-card .media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tpl-card .info { padding: 10px 12px 12px; }
.tpl-card .title { font-size: 1.02rem; font-weight: 700; line-height: 1.3; }
.tpl-card .meta { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; font-size: .88rem; color: var(--muted); }
.tpl-card .cost { color: var(--primary-dark); font-weight: 700; }
.badge-common {
  position: absolute; top: 8px; left: 8px; background: rgba(224,90,43,.92); color: #fff;
  font-size: .8rem; padding: 3px 8px; border-radius: 999px;
}

/* 通用大按钮 */
.btn {
  display: block; width: 100%; border: none; border-radius: 16px;
  background: var(--primary); color: #fff; font-size: 1.15rem; font-weight: 700;
  padding: 16px 0; text-align: center; cursor: pointer;
}
.btn:active { background: var(--primary-dark); }
.btn[disabled] { background: #cfbfb0; }
.btn.secondary { background: #fff; color: var(--primary-dark); border: 2px solid var(--primary); }
.btn.small { width: auto; padding: 10px 18px; font-size: 1rem; border-radius: 12px; }

/* 卡片 */
.card { background: var(--card); border-radius: 16px; padding: 16px; box-shadow: 0 2px 10px rgba(90,60,20,.08); margin-bottom: 14px; }

/* 制作页 */
.make-media { width: 100%; aspect-ratio: 9 / 16; max-height: 46vh; border-radius: 16px; overflow: hidden; background: #f1e8dc; margin-bottom: 12px; }
.make-media video, .make-media img { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
.require { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 14px; }
.require span { background: #fdeee4; color: var(--primary-dark); border-radius: 10px; padding: 6px 12px; font-size: .92rem; }
.photo-slots { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.photo-slot {
  width: 31%; aspect-ratio: 3/4; border-radius: 12px; overflow: hidden; position: relative;
  background: #f1e8dc; border: 2px dashed #d8c6b2; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 1.6rem; cursor: pointer;
}
.photo-slot img { width: 100%; height: 100%; object-fit: cover; }
.photo-slot .remove {
  position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%;
  background: rgba(0,0,0,.55); color: #fff; border: none; font-size: .95rem; line-height: 1;
}
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 700; margin-bottom: 6px; }
.field input, .field textarea {
  width: 100%; border: 2px solid var(--line); border-radius: 12px; padding: 12px;
  font-size: 1.05rem; font-family: inherit; background: #fff; color: var(--text);
}
.field textarea { min-height: 84px; }
.hint { color: var(--muted); font-size: .9rem; }

/* 作品页 */
.work-card { background: var(--card); border-radius: 16px; overflow: hidden; box-shadow: 0 2px 10px rgba(90,60,20,.08); margin-bottom: 14px; }
.work-card .head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px 6px; }
.work-card .head .t { font-weight: 700; }
.status-chip { font-size: .88rem; border-radius: 999px; padding: 4px 12px; font-weight: 700; }
.status-chip.running { background: #fdf1dd; color: var(--gold); }
.status-chip.done { background: #e3f3e8; color: var(--ok); }
.status-chip.failed, .status-chip.cancelled { background: #fbe5e0; color: var(--bad); }
.work-card video { width: 100%; max-height: 60vh; background: #000; display: block; }
.src-photo { display: flex; align-items: center; gap: 10px; padding: 10px 14px; }
.src-photo img { width: 72px; height: 72px; border-radius: 10px; object-fit: cover; flex-shrink: 0; }
.work-card .foot { padding: 10px 14px 14px; }
.err-text { color: var(--bad); font-size: .92rem; padding: 4px 14px 10px; }

/* 我的 */
.me-points { text-align: center; padding: 26px 0 10px; }
.me-points .num { font-size: 3rem; font-weight: 800; color: var(--primary-dark); }
.me-points .label { color: var(--muted); margin-top: 4px; }

/* 遮罩 / 提示 */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.overlay .box { background: #fff; border-radius: 18px; padding: 24px 20px; width: 100%; max-width: 360px; text-align: center; }
.overlay .box .msg { font-size: 1.1rem; font-weight: 700; margin-bottom: 16px; line-height: 1.5; }
.spinner {
  width: 42px; height: 42px; margin: 0 auto 14px; border-radius: 50%;
  border: 5px solid #f1e2d4; border-top-color: var(--primary); animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#toast {
  position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%);
  background: rgba(40,32,24,.92); color: #fff; padding: 12px 20px; border-radius: 12px;
  font-size: 1rem; z-index: 99; max-width: 82vw; text-align: center; display: none; line-height: 1.4;
}

/* 登录卡 */
.login-card { max-width: 360px; margin: 12vh auto 0; }
.login-card h2 { text-align: center; margin-bottom: 6px; }
.login-card .sub { text-align: center; color: var(--muted); margin-bottom: 18px; font-size: .95rem; }
.login-card input {
  width: 100%; border: 2px solid var(--line); border-radius: 12px; padding: 14px;
  font-size: 1.3rem; text-align: center; letter-spacing: 4px; text-transform: uppercase; margin-bottom: 12px;
}

.empty-tip { text-align: center; color: var(--muted); padding: 40px 0; line-height: 1.6; }
