/* app.css — UGC 深色主题(按 UED 设计稿)。全站深色，令牌集中在 :root。
   设计基调:深藏蓝底 #091125 + 顶部蓝/粉光晕 + 粉→蓝渐变主按钮 + 半透明圆角卡片 + 选中项渐变发光描边。 */

:root {
  --bg: #091125;              /* 页面底色:深藏蓝 */
  --surface: rgba(255,255,255,.07);   /* 卡片/输入框:半透明浅色叠加(提亮增可读) */
  --surface-2: rgba(255,255,255,.14);  /* 次级按钮/胶囊:稍强(提亮) */
  --card-solid: #111a30;     /* 需要不透明底的地方(弹层/渐变描边内衬) */
  --text: #F3F5FB;
  --muted: rgba(233,238,250,.66);      /* 次级文字:提高对比,原 .55 过淡 */
  --faint: rgba(233,238,250,.34);
  --line: rgba(255,255,255,.16);       /* 描边:提亮,原 .10 几乎看不见 */
  --accent: #6C8BF0;         /* 单色回退(渐变中段) */
  --accent-contrast: #ffffff;
  --danger: #ff6b6b;
  --ok: #37d39b;
  --radius: 16px;
  --radius-sm: 12px;
  --radius-pill: 26px;
  /* 渐变令牌 */
  --grad-primary: linear-gradient(90deg, #F072C0 0%, #8A78E8 50%, #5B8DEF 100%);  /* 主按钮:粉→紫→蓝 */
  --grad-sel: linear-gradient(135deg, #5CE0E0 0%, #8B5CF0 100%);                   /* 选中:青→紫发光描边 */
  --grad-progress: linear-gradient(90deg, #F4C25A 0%, #EE6FA0 100%);              /* 进度条:暖黄→粉 */
  --shadow: none;
  --shadow-lg: 0 18px 50px rgba(0,0,0,.5);
  --appbar-h: 52px;
  --tabbar-h: 60px;
  --maxw: 480px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: transparent;   /* 透明:露出 App 原生层(状态栏/背景)。需 App 把 WebView 背景也设透明才生效 */
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }

#app {
  position: relative;
  display: flex; flex-direction: column;
  min-height: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  background: transparent;   /* 透明:露出 App 原生层 */
  overflow: hidden;   /* 裁掉光晕溢出 */
}
/* 顶部区域保持透明/纯净:按需求去掉原蓝/粉氛围光晕,顶栏与下方统一深色底 */
#app::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 300px; z-index: 0;
  pointer-events: none;
  background: none;
}

/* ---- 顶栏 ---- */
.appbar {
  position: sticky; top: 0; z-index: 20;
  /* 顶部 24px 间距(对齐 App PageHeader 上方 Spacer(24.dp)),再叠加状态栏安全区 */
  height: calc(var(--appbar-h) + 24px + env(safe-area-inset-top, 0px));
  padding-top: calc(env(safe-area-inset-top, 0px) + 24px);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding-left: 12px; padding-right: 12px;
  background: transparent;
}
/* 标题按整页正中居中(绝对定位),不受左侧返回键/右侧额度徽标宽度影响;字号 20 / Bold(对齐 App PageHeader) */
.appbar-title {
  position: absolute; left: 0; right: 0; top: calc(env(safe-area-inset-top, 0px) + 24px);
  height: var(--appbar-h); margin: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700; color: var(--text);
  pointer-events: none;   /* 不挡住两侧按钮点击 */
}
/* 左上角返回按钮:直接用 App 原始素材图 ic_back_button.png(38dp);容器透明,图即按钮本体 */
.iconbtn {
  width: 38px; height: 38px; flex: none; border: 0; padding: 0;
  background: transparent;
  display: flex; align-items: center; justify-content: center;
  position: relative; z-index: 1;
}
.iconbtn:active { filter: brightness(.95); }
.iconbtn img { width: 38px; height: 38px; display: block; }
.quota-badge {
  min-width: 34px; padding: 3px 9px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted);
  font-size: 12px; font-weight: 600; white-space: nowrap; text-align: center;
}
.quota-badge.warn { background: rgba(255,107,107,.16); color: var(--danger); }

/* 所有玩法共用的 AI 生成/互动披露；不依赖具体页面或玩法分支。 */
.ai-disclosure {
  position: relative; z-index: 1;
  flex: none;
  margin: 0; padding: 2px 16px 8px;
  color: var(--muted);
  font-size: 11px; line-height: 1.45; text-align: center;
}

/* ---- 全局生成任务浮条 ----
   只在本机有未收口 job 时出现；置于顶栏下方，不遮挡底部主操作与安全区。 */
.task-dock-region {
  position: sticky;
  top: calc(var(--appbar-h) + 24px + env(safe-area-inset-top, 0px));
  z-index: 19;
  flex: none;
  padding: 2px 16px 6px;
  background: linear-gradient(to bottom, rgba(9,17,37,.96) 72%, rgba(9,17,37,0));
}
.task-dock-button {
  position: relative;
  width: 100%; min-height: 64px;
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  grid-template-rows: auto auto 3px;
  column-gap: 10px; row-gap: 1px;
  align-items: center;
  overflow: hidden;
  padding: 10px 12px 9px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 14px;
  background: #111a30;
  color: var(--text);
  font: inherit; text-align: start;
  transition: transform .12s ease, background .18s ease, border-color .18s ease;
}
.task-dock-button:active { transform: scale(.985); background: #16213b; }
.task-dock-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.task-dock-dot {
  grid-column: 1; grid-row: 1 / 3;
  width: 9px; height: 9px; border-radius: 50%;
  background: #F072C0;
}
.task-dock-copy { grid-column: 2; grid-row: 1 / 3; min-width: 0; display: flex; flex-direction: column; }
.task-dock-title {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .02em;
}
.task-dock-status {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--text); font-size: 13px; font-weight: 650;
}
.task-dock-eta {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: #C8D5FF; font-size: 11px; font-weight: 600;
}
.task-dock-action {
  grid-column: 3; grid-row: 1 / 3;
  display: inline-flex; align-items: center; gap: 4px;
  padding-inline-start: 6px;
  color: #C8D5FF; font-size: 12px; font-weight: 650; white-space: nowrap;
}
.task-dock-chevron { font-size: 17px; line-height: 1; transform: translateY(-1px); }
.task-dock-track {
  grid-column: 2 / 4; grid-row: 3;
  height: 3px; overflow: hidden; border-radius: 999px;
  background: rgba(255,255,255,.11);
}
.task-dock-fill {
  display: block; height: 100%; width: 0; border-radius: inherit;
  background: var(--grad-progress);
  transition: width .45s ease-out;
}
.task-dock-button.is-active .task-dock-dot { animation: task-pulse 1.5s ease-in-out infinite; }
.task-dock-button.is-attention { border-color: rgba(244,194,90,.38); }
.task-dock-button.is-attention .task-dock-dot { background: #F4C25A; }
.task-dock-button.is-done { border-color: rgba(55,211,155,.34); }
.task-dock-button.is-done .task-dock-dot { background: var(--ok); }
.task-dock-button.is-offline { border-color: rgba(244,194,90,.3); }
.task-dock-button.is-offline .task-dock-dot { background: #F4C25A; }
.task-dock-button.is-error { border-color: rgba(255,107,107,.38); }
.task-dock-button.is-error .task-dock-dot { background: var(--danger); }
.task-dock-button.is-error .task-dock-fill { background: var(--danger); }
.task-dock-button.is-indeterminate .task-dock-fill {
  width: 38% !important;
  animation: task-flow 1.7s cubic-bezier(.4, 0, .2, 1) infinite;
}
@keyframes task-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(240,114,192,0); }
  50% { box-shadow: 0 0 0 5px rgba(240,114,192,.17); }
}
@keyframes task-flow {
  from { transform: translateX(-115%); }
  to { transform: translateX(285%); }
}

/* ---- 视图区 ---- */
.stage {
  position: relative; z-index: 1;
  flex: 1;
  display: flex; flex-direction: column;   /* 让内部视图可用弹性布局(首页垂直居中) */
  padding: 16px 16px calc(28px + env(safe-area-inset-bottom, 0px));
}
.view { animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---- 底部标签 ---- */
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; z-index: 20;
  width: 100%; max-width: var(--maxw);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: flex; background: rgba(9,16,36,.92); border-top: 1px solid var(--line);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.tab {
  flex: 1; border: 0; background: transparent; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 11px;
}
.tab .tab-icon { font-size: 19px; line-height: 1; }
.tab.active { color: var(--text); }

/* ---- 按钮 ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: var(--radius-pill); padding: 13px 20px;
  font-size: 15px; font-weight: 600; line-height: 1; color: var(--text);
}
.btn.primary { background: var(--grad-primary); color: #fff; }
.btn.primary:active { filter: brightness(1.06); }
.btn.ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); }
.btn.ghost:active { background: rgba(255,255,255,.14); }
.btn.block { width: 100%; }
/* 按压反馈加强(2026-07-15 用户真机反馈"按下去要有真实感觉"): 全站按钮按下瞬间缩小+提亮, 松手弹回 */
.btn { transition: transform .08s ease, filter .12s ease; }
.btn:active:not(:disabled) { transform: scale(.96); filter: brightness(1.3); }
.btn:disabled { opacity: 1; }
.btn.primary:disabled { background: #1c2440; color: rgba(255,255,255,.35); }
.btn.ghost:disabled { opacity: .5; }
.btn.danger { background: transparent; color: var(--danger); }

/* ---- 可见焦点(键盘/辅助功能) ---- */
.btn:focus-visible, .chip:focus-visible, .tab:focus-visible, .iconbtn:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* ---- 表单 ---- */
.field { margin-bottom: 16px; }
.field > label { display: block; font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.input, .textarea, .select {
  width: 100%; background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 13px 14px; font-size: 15px; font-family: inherit;
}
.input::placeholder, .textarea::placeholder { color: var(--muted); }
.textarea { min-height: 120px; resize: vertical; line-height: 1.6; }
.select { -webkit-appearance: none; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23aab2c8' d='M6 8 0 0h12z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 32px; }
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: rgba(240,114,192,.6); }

/* ---- 胶囊(音色/选项等) ---- */
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
/* 横向滑动一行(示例词用):不换行、可横滑、隐藏滚动条 */
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chips.scroll .chip { flex: 0 0 auto; white-space: nowrap; }
.chip {
  border: 1.5px solid var(--line); background: var(--surface-2);
  border-radius: 999px; padding: 9px 16px; font-size: 14px; color: rgba(240,244,252,.86);
}
.chip.active {
  color: var(--text); font-weight: 600;
  background: linear-gradient(var(--bg), var(--bg)) padding-box, var(--grad-primary) border-box;
}

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.section-title { font-size: 15px; font-weight: 600; margin: 0 0 10px; color: var(--text); }
.muted { color: var(--muted); }

/* ---- 候选网格 ---- */
.candidates-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.cand-card { position: relative; border: 2px solid transparent; border-radius: 14px; overflow: hidden; background: var(--surface); }
.cand-card img { width: 100%; aspect-ratio: 1/1; object-fit: cover; background: var(--surface); }
.cand-card .cap { padding: 7px 10px; font-size: 12px; color: var(--muted); }
.cand-card.sel {
  border: 2px solid transparent;
  background: linear-gradient(var(--bg), var(--bg)) padding-box, var(--grad-sel) border-box;
}
.cand-card.pending { opacity: .55; }
.cand-card.click:active { transform: scale(.98); }

/* ---- 进度 ---- */
.progress { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 56px 0; text-align: center; }
.spinner { width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--surface-2); border-top-color: #F072C0; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress-stage { color: var(--muted); font-size: 14px; }

/* 分阶段步骤条(构思→绘制→动画→打包) */
.pg-steps { display: flex; align-items: flex-start; justify-content: center; margin-bottom: 4px; }
.pg-step { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 56px; }
.pg-step .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--surface-2); transition: background .3s, box-shadow .3s; }
.pg-step-label { font-size: 11px; color: var(--muted); }
.pg-step.active .dot { background: #F072C0; animation: pg-pulse 1.4s ease-in-out infinite; }
.pg-step.active .pg-step-label { color: var(--text); font-weight: 600; }
.pg-step.done .dot { background: #8A78E8; opacity: .7; }
.pg-connector { width: 18px; height: 2px; margin-top: 4px; border-radius: 1px; background: var(--surface-2); flex: none; }
@keyframes pg-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(240,114,192,0); } 50% { box-shadow: 0 0 0 5px rgba(240,114,192,.18); } }

/* 流光进度条 */
.pg-bar { width: min(260px, 72vw); height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.pg-bar-fill { height: 100%; width: 0; border-radius: 999px; background: var(--grad-primary); background-size: 200% 100%; animation: pg-flow 1.6s linear infinite; transition: width .5s ease; }
@keyframes pg-flow { from { background-position: 0 0; } to { background-position: 200% 0; } }

/* 预计耗时 + 轮播小贴士 */
.pg-eta { font-size: 12px; color: var(--muted); opacity: .8; }
.pg-tip { font-size: 12px; color: var(--muted); min-height: 18px; opacity: 0; }
.pg-tip.swap { animation: pg-fade .45s ease forwards; }
@keyframes pg-fade { from { opacity: 0; transform: translateY(5px); } to { opacity: .85; transform: none; } }

/* ---- 成品 / 动画头像 ---- */
.avatar-anim { width: 200px; height: 200px; margin: 0 auto; border-radius: 24px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow-lg); }
.avatar-anim img { width: 100%; height: 100%; object-fit: cover; }

/* ---- 创作中心(首页 hub) ---- */
/* 广告位:滚动轮播,后台可配,空则不渲染(见 flow-home.js) */
.ad-wrap { margin-bottom: 18px; }
.ad-view { border-radius: var(--radius); overflow: hidden; }
.ad-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 10px; -webkit-overflow-scrolling: touch; }
.ad-track::-webkit-scrollbar { display: none; }
.ad-slide { flex: 0 0 100%; scroll-snap-align: start; border-radius: var(--radius); overflow: hidden; }
.ad-slide img { width: 100%; height: 150px; object-fit: cover; }
.ad-dots { display: flex; gap: 6px; justify-content: center; margin-top: 8px; }
.ad-dots i { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,.2); }
.ad-dots i.on { width: 16px; border-radius: 4px; background: rgba(255,255,255,.55); }
/* 广告占位:无广告数据时显示,后台配置后自动被真广告替换 */
.ad-placeholder {
  height: 88px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, rgba(92,121,240,.12), rgba(139,92,240,.12));
  border: 1px solid rgba(255,255,255,.06);
}
.ad-ph-text { color: var(--faint); font-size: 12.5px; letter-spacing: 1px; }

/* 首页(创作中心):内容在可用高度内垂直居中,避免头重脚轻/下半屏大片空 */
#view-home { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.home-row { display: flex; gap: 12px; }
.home-big {
  flex: 1; border: 0; border-radius: var(--radius); padding: 16px 14px; min-height: 92px;
  display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 22px;
  font-size: 16px; font-weight: 600; text-align: left;
}
.home-big.coral { background: linear-gradient(135deg, #F6A07E 0%, #F4C39E 100%); color: #3a1710; }
.home-big.deep { background: linear-gradient(135deg, #5C79F0 0%, #8B5CF0 100%); color: #f4f1ff; }
.home-big:active { filter: brightness(1.05); transform: scale(.99); }
.home-big-ic { font-size: 22px; line-height: 1; }
.home-more { text-align: center; color: var(--muted); font-size: 12.5px; margin: 18px 0 20px; }
.home-entry {
  width: 100%; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  border-radius: var(--radius); padding: 15px 16px; font-size: 15px; font-weight: 600;
  display: flex; align-items: center; justify-content: space-between;
}
.home-entry:active { background: rgba(255,255,255,.09); }
.home-entry-arrow { color: var(--muted); font-size: 20px; line-height: 1; }

/* ---- 一键生成 输入页(边到边 + 底部固定操作栏) ---- */
.create-body { padding-bottom: 96px; }   /* 给底部固定操作栏留白 */
.create-ta { min-height: 120px; }
.addimg-box {
  border: 1.5px dashed rgba(255,255,255,.28); border-radius: var(--radius);
  min-height: 88px; display: flex; flex-direction: row; align-items: center; justify-content: center;
  gap: 10px; color: var(--muted); overflow: hidden;
}
.addimg-plus { font-size: 22px; line-height: 1; color: var(--muted); }
.addimg-hint { font-size: 13px; color: var(--muted); }
.addimg-preview { width: 72px; height: 72px; object-fit: cover; border-radius: var(--radius-sm); }
.photo-source-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.photo-source-btn {
  min-height: 44px; border: 1px solid var(--line); border-radius: var(--radius-pill);
  padding: 9px 12px; background: var(--surface-2); color: var(--text);
  font: 600 13px/1.25 inherit; text-align: center;
  transition: transform .08s ease, background .12s ease;
}
.photo-source-btn:active { transform: scale(.97); background: rgba(255,255,255,.18); }
.photo-source-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.photo-permission-note { margin-top: 8px; color: var(--muted); font-size: 11px; line-height: 1.45; text-align: center; }
.actionbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; z-index: 30;
  width: 100%; max-width: var(--maxw);
  padding: 12px 16px calc(14px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to top, var(--bg) 62%, rgba(9,17,37,0));
}

/* ---- 场景玩法入口 ---- */
.scene-list { display: flex; flex-direction: column; gap: 12px; }
.scene-card {
  display: flex; align-items: center; gap: 14px; padding: 14px;
  background: var(--surface); border: 2px solid transparent; border-radius: var(--radius);
}
.scene-card.sel {
  border: 2px solid transparent;
  background: linear-gradient(var(--bg), var(--bg)) padding-box, var(--grad-sel) border-box;
}
.scene-card.click:active { transform: scale(.98); }
.scene-icon { font-size: 32px; line-height: 1; flex: none; }
.scene-info { min-width: 0; }
.scene-name { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--text); }
.scene-badge {
  font-size: 11px; font-weight: 600; color: #F3B0D0;
  background: rgba(240,114,192,.14); border: 1px solid rgba(240,114,192,.4);
  border-radius: 999px; padding: 1px 8px; white-space: nowrap;
}
.scene-desc { font-size: 12px; color: var(--muted); margin-top: 2px; }
.scene-photo {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 132px; border-radius: var(--radius); background: var(--surface);
  border: 1.5px dashed rgba(255,255,255,.22); overflow: hidden; cursor: pointer;
}
.scene-photo img { width: 108px; height: 108px; object-fit: cover; border-radius: var(--radius-sm); }
.scene-photo-plus { font-size: 28px; color: var(--muted); line-height: 1; }
.scene-photo-hint { font-size: 12px; color: var(--muted); }
.scene-note { font-size: 12px; margin: -6px 0 12px; }

/* ---- 深度定制(答题玩法) ---- */
.quiz-intro {
  position: relative; isolation: isolate; overflow: hidden;
  margin: 2px 0 8px; padding: clamp(20px, 6vw, 28px) clamp(18px, 5.5vw, 26px) 20px;
  border: 1px solid rgba(244,194,90,.28);
  border-radius: 22px;
  background:
    radial-gradient(circle at 88% 8%, rgba(244,194,90,.13) 0 2px, transparent 3px),
    radial-gradient(circle at 78% 16%, rgba(243,245,251,.15) 0 1px, transparent 2px),
    radial-gradient(circle at 94% 24%, rgba(243,245,251,.11) 0 1px, transparent 2px),
    linear-gradient(155deg, rgba(244,194,90,.08), rgba(17,26,48,.82) 34%, rgba(9,17,37,.94));
  animation: quiz-intro-in .42s cubic-bezier(.22, 1, .36, 1) both;
}
.quiz-intro::after {
  content: ""; position: absolute; z-index: -1; right: -32px; top: -38px;
  width: 150px; height: 150px; border: 1px solid rgba(244,194,90,.12); border-radius: 50%;
}
.quiz-intro-head {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; align-items: start;
}
.quiz-intro-kicker {
  color: #F4C25A; font-size: 10px; font-weight: 750; letter-spacing: .18em; text-transform: uppercase;
}
.quiz-intro-title {
  margin: 7px 0 0; max-width: 12em;
  color: var(--text); font-size: clamp(25px, 7.2vw, 34px); line-height: 1.08; letter-spacing: -.025em;
}
.quiz-intro-emblem {
  display: grid; place-items: center; width: 42px; height: 42px; color: #F4C25A;
  border: 1px solid rgba(244,194,90,.42); border-radius: 50%; background: rgba(244,194,90,.08);
}
.quiz-intro-emblem strong { font-size: 23px; line-height: 1; }
.quiz-intro-story {
  margin: 16px 0 18px; max-width: 32em; color: rgba(243,245,251,.84); line-height: 1.58;
}
.quiz-intro-highlights {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0 -4px; padding: 14px 0;
  border-top: 1px solid rgba(244,194,90,.2); border-bottom: 1px solid rgba(244,194,90,.2);
}
.quiz-intro-highlight { min-width: 0; padding: 0 10px; }
.quiz-intro-highlight + .quiz-intro-highlight { border-left: 1px solid rgba(244,194,90,.16); }
.quiz-intro-highlight strong {
  display: block; color: #F4C25A; font-size: 24px; line-height: 1; font-variant-numeric: tabular-nums;
}
.quiz-intro-highlight span {
  display: block; margin-top: 6px; color: var(--text); font-size: 11px; font-weight: 700; line-height: 1.25;
}
.quiz-intro-start { margin-top: 18px; }
.quiz-intro-more {
  margin-top: 13px; color: var(--muted); font-size: 12px;
}
.quiz-intro-more summary {
  width: max-content; margin: 0 auto; padding: 6px 8px; cursor: pointer;
  color: rgba(243,245,251,.72); font-weight: 650; list-style-position: inside;
}
.quiz-intro-more[open] summary { color: #F4C25A; }
.quiz-intro-rules {
  margin: 10px 0 0; padding: 13px 12px 13px 32px;
  border-radius: 14px; background: rgba(8,15,32,.48);
}
.quiz-intro-rules li { padding-left: 3px; line-height: 1.48; }
.quiz-intro-rules li + li { margin-top: 8px; }
@keyframes quiz-intro-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
.quiz-wrap { padding: 8px 4px; }
.quiz-bar { height: 8px; border-radius: 8px; background: var(--surface-2); overflow: hidden; margin: 6px 0 30px; }
.quiz-bar i { display: block; height: 100%; border-radius: 8px; background: var(--grad-progress); transition: width .35s ease; }
.quiz-round-title {
  margin: 0 0 9px; color: #F4C25A; text-align: center; font-size: 12px; font-weight: 750;
  line-height: 1.35; letter-spacing: .055em;
}
.quiz-q { text-align: center; font-size: 18px; font-weight: 600; color: var(--text); margin: 0 0 26px; line-height: 1.5; }
.quiz-opts { display: flex; flex-direction: column; gap: 14px; }
.quiz-opt { border-radius: 28px; padding: 16px 18px; text-align: center; font-size: 15px; color: var(--text); background: var(--surface); border: 1.5px solid var(--line); }
.quiz-opt.on { border: 2px solid transparent; font-weight: 600; background: linear-gradient(var(--bg), var(--bg)) padding-box, var(--grad-sel) border-box; }
.quiz-opt.click:active { transform: scale(.99); }
.quiz-footer { margin-top: 28px; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.quiz-count { color: var(--muted); font-size: 13px; }
.quiz-encounter { text-align: center; padding: 22px 18px; }
.quiz-character-preview {
  display: block; width: min(100%, 300px); aspect-ratio: 1; object-fit: contain;
  margin: 0 auto 12px; border-radius: 22px;
}
.quiz-hidden-note {
  display: inline-block; margin-bottom: 10px; padding: 6px 11px; border-radius: 999px;
  color: var(--text); background: var(--surface-2); font-size: 12px; letter-spacing: .02em;
}
.quiz-character-name { color: var(--text); font-size: 25px; font-weight: 700; line-height: 1.2; }
.quiz-character-line { margin-top: 6px; color: var(--muted); font-size: 14px; font-style: italic; }
.quiz-encounter-copy { margin: 16px auto 0; max-width: 34em; color: var(--text); line-height: 1.65; }
.quiz-match-reasons {
  margin: 18px 0 0; padding: 0; list-style: none; display: grid; gap: 9px; text-align: left;
}
.quiz-match-reasons li {
  position: relative; padding: 11px 13px 11px 31px; border-radius: 14px;
  color: var(--text); background: var(--surface-2); line-height: 1.45;
}
.quiz-match-reasons li::before { content: "✦"; position: absolute; left: 12px; color: var(--accent); }
.quiz-result-actions { display: grid; gap: 10px; margin-top: 20px; }

/* ---- 形象库网格 ---- */
.lib-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.lib-card { position: relative; border-radius: 14px; overflow: hidden; background: var(--surface); border: 2px solid transparent; }
.lib-card img { width: 100%; aspect-ratio: 1/1; object-fit: cover; }
.lib-card .lib-meta { padding: 8px 10px; font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; align-items: center; }
.lib-card.current {
  border: 2px solid transparent;
  background: linear-gradient(var(--bg), var(--bg)) padding-box, var(--grad-sel) border-box;
}
.lib-card .current-flag { position: absolute; top: 8px; left: 8px; background: var(--grad-primary); color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 999px; }

/* ---- 空态 ---- */
.empty { text-align: center; color: var(--muted); padding: 48px 16px; }

/* ---- Toast ---- */
.toast {
  position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%) translateY(8px);
  max-width: 86%; background: #16203c; color: #fff; padding: 11px 18px; border-radius: 12px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 60;
  border: 1px solid var(--line);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: #4a1626; border-color: rgba(255,107,107,.5); }
.toast.ok { background: #123528; border-color: rgba(55,211,155,.5); }

/* ---- 华太推送状态(失败提示 + 重传 / 传输中) ---- */
.huatai:empty { display: none; }
.huatai { margin-top: 12px; }
.huatai.failed {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  background: rgba(255,107,107,.12); border: 1px solid rgba(255,107,107,.34);
}
.huatai-msg { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; line-height: 1.4; }
.huatai.failed .huatai-msg { color: #ffb4b4; }
.huatai.pending .huatai-msg { color: var(--muted); font-size: 12.5px; }
.huatai-ic {
  width: 18px; height: 18px; flex: none; border-radius: 50%;
  background: var(--danger); color: #3a0d0d; font-size: 12px; font-weight: 800; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.huatai-btn { width: auto; padding: 7px 16px; font-size: 13px; flex: none; }
.huatai.pending { display: flex; align-items: center; justify-content: center; padding: 6px 0; }
.huatai-spin {
  width: 14px; height: 14px; flex: none; display: inline-block; border-radius: 50%;
  border: 2px solid var(--surface-2); border-top-color: var(--muted); animation: spin .9s linear infinite;
}

/* ---- 弹层 ---- */
.modal-overlay { position: fixed; inset: 0; z-index: 80; background: rgba(4,8,20,.6); display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal-card { width: 100%; max-width: 320px; background: var(--card-solid); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 20px; box-shadow: var(--shadow-lg); animation: pop .18s ease; }
@keyframes pop { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
.modal-title { margin: 0 0 8px; font-size: 17px; color: var(--text); }
.modal-body { margin: 0 0 18px; color: var(--muted); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* Quick create 弹窗版(#50): 复用 modal-card,略宽 + 文本框矮一些 */
.create-panel { max-width: 340px; }
.create-panel .field { margin-bottom: 14px; }
.create-panel .modal-title { text-align: center; }
.create-panel-ta { min-height: 84px; }

@media (max-width: 340px) {
  .photo-source-actions { grid-template-columns: 1fr; }
  .task-dock-region { padding-inline: 12px; }
  .task-dock-button { column-gap: 8px; padding-inline: 10px; }
  .task-dock-action { font-size: 11px; }
  .quiz-intro { padding-inline: 17px; }
  .quiz-intro-head { gap: 10px; }
  .quiz-intro-highlight { padding-inline: 6px; }
  .quiz-intro-highlight strong { font-size: 21px; }
  .quiz-intro-highlight span { font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .task-dock-button, .task-dock-fill { transition: none; }
  .task-dock-button.is-active .task-dock-dot,
  .task-dock-button.is-indeterminate .task-dock-fill { animation: none; }
  .quiz-intro { animation: none; }
}

@media (forced-colors: active) {
  .task-dock-button { border: 1px solid ButtonText; }
  .task-dock-dot, .task-dock-fill { forced-color-adjust: none; }
  .quiz-intro, .quiz-intro-highlights, .quiz-intro-highlight + .quiz-intro-highlight {
    border-color: ButtonText;
  }
}

[hidden] { display: none !important; }

/* ---- 宽屏(电脑/平板)下按 App 版面呈现 ----
   仅在窗口比手机宽时生效: 把 480px 的 App 画布框成居中的"手机屏幕",
   两侧留深色留白 + 描边阴影, 不再散成一条飘在空白里。
   真手机/App 内(窗口窄, 不触发本段)完全不受影响, 与线上 1:1 一致。 */
@media (min-width: 600px) {
  body { background: #04060d; }
  #app {
    min-height: 100vh;
    border-left: 1px solid rgba(255,255,255,.06);
    border-right: 1px solid rgba(255,255,255,.06);
    box-shadow: 0 0 0 1px rgba(255,255,255,.04), 0 30px 90px rgba(0,0,0,.55);
  }
}
