/* ============================================
   「我是谁」活动系统 - 用户端样式 v3（品牌化精修）
   设计系统：新物集红主色 + 完整色阶 + 8pt 间距网格 + 清晰字阶
   ============================================ */

:root {
  /* ── 主色：新物集红（完整色阶） ── */
  --red-50:  #fff1f0;
  --red-100: #ffe4e1;
  --red-200: #ffc4bf;
  --red-300: #ff9b94;
  --red-400: #ff6b61;
  --red-500: #ff5b5b;   /* 品牌主色 */
  --red-600: #e64545;
  --red-700: #c23131;
  --red-800: #9a2a2a;

  /* ── 功能色 ── */
  --success: #16a34a;
  --success-bg: #f0fdf4;
  --success-border: #bbf7d0;
  --danger:  #dc2626;
  --danger-bg: #fef2f2;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --info:    #3b82f6;
  --info-bg: #eff6ff;

  /* ── 中性色 ── */
  --gray-50:  #fafafa;
  --gray-100: #f4f4f5;
  --gray-200: #e4e4e7;
  --gray-300: #d4d4d8;
  --gray-500: #71717a;
  --gray-600: #52525b;
  --gray-700: #3f3f46;
  --gray-900: #18181b;

  --color-primary: var(--red-500);
  --color-primary-dark: var(--red-600);
  --color-primary-light: var(--red-200);

  --color-text: var(--gray-900);
  --color-text-muted: var(--gray-500);
  --color-text-light: var(--gray-300);

  --color-bg: var(--gray-50);
  --color-bg-card: #ffffff;
  --color-bg-hover: var(--gray-100);
  --color-border: var(--gray-200);
  --color-border-light: var(--gray-100);

  /* ── 圆角（8pt 感） ── */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  /* ── 阴影（分层） ── */
  --shadow-xs: 0 1px 2px rgba(24, 24, 27, 0.04);
  --shadow-sm: 0 1px 3px rgba(24, 24, 27, 0.06), 0 1px 2px rgba(24, 24, 27, 0.04);
  --shadow-md: 0 4px 12px rgba(24, 24, 27, 0.08), 0 2px 4px rgba(24, 24, 27, 0.04);
  --shadow-lg: 0 12px 32px rgba(24, 24, 27, 0.12), 0 4px 8px rgba(24, 24, 27, 0.06);
  --shadow-red: 0 4px 14px rgba(255, 91, 91, 0.35);

  /* ── 间距（8pt 网格） ── */
  --space-1: 4px;  --space-2: 8px;  --space-3: 12px;
  --space-4: 16px; --space-5: 20px; --space-6: 24px;
  --space-8: 32px; --space-10: 40px;

  /* ── 字阶 ── */
  --font-title-xl: 44px;
  --font-title-lg: 28px;
  --font-title-md: 22px;
  --font-body-lg: 17px;
  --font-body: 15px;
  --font-body-sm: 14px;
  --font-caption: 13px;
  --font-small: 12px;

  /* ── 动效 ── */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 0.15s;
  --dur-med: 0.3s;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a { color: var(--color-primary); text-decoration: none; transition: color var(--dur-fast); }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }

/* ============================================
   按钮
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 12px;
  font-size: var(--font-body);
  font-weight: 600;
  line-height: 1.4;
  transition: all var(--dur-fast) var(--ease-out);
  border: 1.5px solid transparent;
  text-decoration: none;
  user-select: none;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--red-500), var(--red-600));
  color: #fff;
  box-shadow: var(--shadow-red);
}
.btn-primary:hover { box-shadow: 0 6px 18px rgba(255, 91, 91, 0.45); }

.btn-ghost {
  background: #fff;
  border-color: var(--color-border);
  color: var(--gray-700);
  box-shadow: var(--shadow-xs);
}
.btn-ghost:hover { background: var(--gray-50); border-color: var(--gray-300); }

.btn-success { background: var(--success); color: #fff; box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3); }
.btn-success:hover { background: #15803d; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }

.btn-lg { padding: 14px 30px; font-size: var(--font-body-lg); border-radius: 14px; }
.btn-block { width: 100%; }
.btn-sm { padding: 5px 12px; font-size: var(--font-caption); border-radius: 8px; }

/* ============================================
   徽章 / 标签
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: var(--font-small);
  font-weight: 600;
  letter-spacing: 0.2px;
  line-height: 1.5;
}
.badge-draft     { background: var(--gray-100); color: var(--gray-500); }
.badge-published { background: var(--red-50); color: var(--red-700); }
.badge-ended     { background: #eef2ff; color: #4338ca; }
.badge-disabled  { background: #f3f4f6; color: #6b7280; }
.badge-correct   { background: var(--success-bg); color: #15803d; }
.badge-wrong     { background: var(--danger-bg); color: var(--danger); }

.biz-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: var(--font-small);
  font-weight: 500;
  background: var(--info-bg);
  color: #1d4ed8;
  margin-left: 4px;
}

.text-link { color: var(--color-primary); font-weight: 500; }
.text-link:hover { text-decoration: underline; }
.muted { color: var(--color-text-muted); font-size: var(--font-caption); font-weight: normal; }
.meta-time { color: var(--color-text-muted); font-size: var(--font-caption); }

.empty-row {
  padding: var(--space-8);
  text-align: center;
  color: var(--color-text-muted);
}

.form-hint { color: var(--color-text-muted); font-size: var(--font-small); margin-top: var(--space-1); }
.req { color: var(--danger); }

/* ============================================
   容器 / 布局
   ============================================ */
.app-container {
  max-width: 720px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--color-bg-card);
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 0 1px var(--color-border-light);
}

.public-body {
  background:
    radial-gradient(ellipse 80% 35% at 50% -5%, rgba(255, 91, 91, 0.05), transparent),
    var(--color-bg);
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-border-light);
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 10;
}

.brand { display: flex; align-items: center; gap: var(--space-2); font-weight: 700; }
.brand-icon {
  font-size: 20px;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--red-50), var(--red-100));
  border-radius: 10px;
}
.brand-name { font-size: var(--font-body); color: var(--gray-900); letter-spacing: 0.3px; }

.admin-link {
  font-size: var(--font-caption);
  color: var(--color-text-muted);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  transition: all var(--dur-fast);
}
.admin-link:hover { background: var(--gray-50); color: var(--gray-700); text-decoration: none; }

.app-main { flex: 1; padding: var(--space-5); }

.app-footer {
  text-align: center;
  padding: var(--space-5);
  color: var(--color-text-light);
  font-size: var(--font-small);
  border-top: 1px solid var(--color-border-light);
}

/* ============================================
   首页 Hero
   ============================================ */
.hero {
  text-align: center;
  padding: var(--space-10) 0 var(--space-6);
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  border-radius: 999px;
  font-size: var(--font-caption);
  font-weight: 600;
  color: var(--red-700);
  background: var(--red-50);
  margin-bottom: var(--space-4);
  letter-spacing: 0.5px;
}
.hero-title {
  font-size: var(--font-title-xl);
  font-weight: 800;
  color: var(--gray-900);
  letter-spacing: 4px;
  margin-bottom: var(--space-2);
  line-height: 1.2;
}
.hero-title .accent { color: var(--color-primary); }
.hero-subtitle {
  color: var(--color-text-muted);
  font-size: var(--font-body);
}

/* ============================================
   活动卡片列表
   ============================================ */
.activity-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
  margin-top: var(--space-4);
}
@media (min-width: 600px) {
  .activity-grid { grid-template-columns: repeat(2, 1fr); gap: var(--space-5); }
}

.activity-card {
  background: #fff;
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: inherit;
  transition: all var(--dur-med) var(--ease-out);
  border: 1px solid var(--color-border-light);
}
.activity-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--red-200);
  text-decoration: none;
}

.card-cover {
  height: 132px;
  background: linear-gradient(135deg, var(--red-50), var(--red-100));
  background-size: cover;
  background-position: center;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.card-cover::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(24, 24, 27, 0.06));
  pointer-events: none;
}
.card-cover-fallback {
  font-size: 44px;
  color: var(--red-400);
  opacity: 0.6;
}

.card-body { padding: var(--space-4) var(--space-5) var(--space-5); }
.card-title {
  font-weight: 700;
  font-size: var(--font-body-lg);
  margin-bottom: var(--space-3);
  line-height: 1.4;
  color: var(--gray-900);
}
.card-meta {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}
.card-info {
  display: flex;
  justify-content: space-between;
  font-size: var(--font-caption);
  color: var(--color-text-muted);
  padding-top: var(--space-3);
  border-top: 1px dashed var(--color-border);
}
.card-info b {
  color: var(--red-600);
  font-size: var(--font-body);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.empty {
  text-align: center;
  padding: var(--space-10) var(--space-5);
}
.empty-icon { font-size: 52px; margin-bottom: var(--space-3); opacity: 0.4; }
.empty-sub { color: var(--color-text-light); font-size: var(--font-caption); margin-top: var(--space-2); }

.more-tip {
  text-align: center;
  padding: var(--space-5) 0 var(--space-2);
  color: var(--color-text-light);
  font-size: var(--font-caption);
}

/* ============================================
   活动详情页
   ============================================ */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: var(--space-4);
  color: var(--color-text-muted);
  font-size: var(--font-body-sm);
  font-weight: 500;
  transition: color var(--dur-fast);
}
.back-link:hover { color: var(--color-primary); text-decoration: none; }

.activity-page { padding-bottom: var(--space-5); }

.activity-header { text-align: center; margin-bottom: var(--space-5); }
.cover {
  width: 100%;
  height: 190px;
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, var(--red-50), var(--red-100));
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-5);
  border: 1px solid var(--color-border-light);
}
.cover-fallback {
  font-size: 64px;
  color: var(--red-400);
  opacity: 0.5;
}
.title {
  font-size: var(--font-title-lg);
  font-weight: 800;
  margin-bottom: var(--space-3);
  color: var(--gray-900);
  line-height: 1.3;
}
.meta { display: flex; justify-content: center; gap: var(--space-2); margin-bottom: var(--space-5); }

.rules {
  background: var(--gray-50);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-4);
  text-align: left;
  border: 1px solid var(--color-border-light);
}
.rules h3 {
  font-size: var(--font-body-sm);
  font-weight: 700;
  margin-bottom: var(--space-2);
  color: var(--gray-700);
  display: flex; align-items: center; gap: 6px;
}
.rules pre {
  font-family: inherit;
  font-size: var(--font-body-sm);
  color: var(--color-text-muted);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.8;
}

.reward-banner {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  background: linear-gradient(135deg, var(--red-500), var(--red-600));
  color: #fff;
  padding: var(--space-5) var(--space-6);
  border-radius: var(--radius-xl);
  margin-bottom: var(--space-6);
  box-shadow: var(--shadow-red);
}
.reward-icon { font-size: 34px; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15)); }
.reward-num { font-size: var(--font-title-md); font-weight: 800; line-height: 1.2; font-variant-numeric: tabular-nums; }
.reward-label { font-size: var(--font-small); opacity: 0.92; letter-spacing: 0.5px; }
.reward-divider {
  width: 1px;
  height: 38px;
  background: rgba(255, 255, 255, 0.35);
  margin: 0 var(--space-2);
}

/* ============================================
   表单
   ============================================ */
.join-section {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  margin-bottom: var(--space-5);
  box-shadow: var(--shadow-xs);
}
.join-section h3 {
  font-size: var(--font-body-lg);
  font-weight: 700;
  margin-bottom: var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--gray-900);
}
.join-section h3::before {
  content: '';
  width: 4px;
  height: 18px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--red-400), var(--red-600));
}

.form-row { margin-bottom: var(--space-4); }
.form-row label {
  display: block;
  font-size: var(--font-caption);
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: var(--space-2);
}
.form-row input, .form-row textarea, .form-row select {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--gray-50);
  font-size: var(--font-body);
  transition: all var(--dur-fast);
}
.form-row input:focus, .form-row textarea:focus, .form-row select:focus {
  outline: none;
  border-color: var(--red-400);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(255, 91, 91, 0.12);
}
.form-row input::placeholder { color: var(--gray-300); }

.hidden { display: none !important; }

/* ============================================
   答题区
   ============================================ */
.quiz-section {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-xs);
}

.quiz-progress {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
  font-size: var(--font-caption);
  font-weight: 600;
  color: var(--gray-500);
  font-variant-numeric: tabular-nums;
}
.progress-bar {
  flex: 1;
  height: 8px;
  background: var(--red-50);
  border-radius: 4px;
  overflow: hidden;
}
#progressFill {
  height: 100%;
  background: linear-gradient(90deg, var(--red-400), var(--red-600));
  border-radius: 4px;
  transition: width var(--dur-med) var(--ease-out);
}

.quiz-card { text-align: center; }
.quiz-title {
  font-size: var(--font-title-lg);
  font-weight: 800;
  color: var(--red-600);
  letter-spacing: 3px;
  margin-bottom: var(--space-5);
}
.quiz-image-wrap {
  width: 100%;
  max-width: 480px;
  margin: 0 auto var(--space-5);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--gray-50);
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border: 1px solid var(--color-border-light);
}
.quiz-image-wrap img {
  max-height: 360px;
  width: auto;
  margin: 0 auto;
}
.quiz-image-wrap.img-error .img-fallback { display: flex; }
.img-fallback {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  font-size: var(--font-body-sm);
}

.quiz-answer { margin-bottom: var(--space-5); text-align: left; }
.quiz-answer label {
  display: block;
  font-size: var(--font-caption);
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: var(--space-2);
}
.quiz-answer input {
  width: 100%;
  padding: 13px 16px;
  border: 2px solid var(--red-200);
  border-radius: var(--radius-md);
  font-size: var(--font-body-lg);
  font-weight: 600;
  text-align: center;
  background: var(--gray-50);
  transition: all var(--dur-fast);
  color: var(--gray-900);
}
.quiz-answer input:focus {
  outline: none;
  border-color: var(--red-500);
  background: #fff;
  box-shadow: 0 0 0 5px rgba(255, 91, 91, 0.15);
}
.quiz-answer input::placeholder { color: var(--gray-300); font-weight: 400; }

.quiz-hint, .quiz-ip, .quiz-related {
  text-align: left;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: var(--space-3);
  font-size: var(--font-body-sm);
  background: var(--gray-50);
  border-left: 4px solid var(--red-400);
  line-height: 1.7;
}
.quiz-hint b, .quiz-ip b { color: var(--gray-700); }

.related-link {
  color: var(--red-600);
  font-weight: 600;
}

.quiz-nav {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-6);
  padding-top: var(--space-5);
  border-top: 1px solid var(--color-border-light);
  padding-bottom: max(var(--space-4), env(safe-area-inset-bottom));
}
.quiz-nav .btn { flex: 1; }

/* ============================================
   提交完成 / 结果
   ============================================ */
.result-section {
  text-align: center;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-10) var(--space-6);
  box-shadow: var(--shadow-xs);
}
.result-icon {
  font-size: 72px;
  margin-bottom: var(--space-4);
  animation: bounce 1.2s var(--ease-out) infinite;
}
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
.result-section h2 {
  font-size: var(--font-title-md);
  font-weight: 800;
  color: var(--gray-900);
}
.result-summary {
  margin: var(--space-4) 0 var(--space-6);
  font-size: var(--font-body);
  color: var(--gray-700);
}
.result-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-width: 300px;
  margin: 0 auto;
}

.footer-actions {
  text-align: center;
  padding: var(--space-4);
  font-size: var(--font-caption);
}

/* ============================================
   结果页（历史）
   ============================================ */
.result-page .page-title {
  text-align: center;
  font-size: var(--font-title-lg);
  font-weight: 800;
  margin: var(--space-4) 0 var(--space-6);
  color: var(--gray-900);
}
.token-section {
  background: #fff;
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-border);
  padding: var(--space-6) var(--space-5);
  margin-bottom: var(--space-5);
  box-shadow: var(--shadow-xs);
}
.hint-text { color: var(--color-text-muted); margin-bottom: var(--space-4); text-align: center; }
.auto-hint {
  margin-top: var(--space-3);
  text-align: center;
  font-size: var(--font-small);
  color: var(--success);
}

/* ============================================
   三屏活动页（答题结果 banner）
   ============================================ */
.result-banner {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  margin-bottom: var(--space-5);
  display: flex;
  gap: var(--space-4);
  align-items: center;
  flex-wrap: wrap;
  box-shadow: var(--shadow-xs);
}
.prize-image {
  max-width: 200px;
  max-height: 200px;
  border-radius: var(--radius-md);
}
.result-info { flex: 1; min-width: 200px; }
.prize-text {
  font-size: var(--font-body-sm);
  color: var(--gray-600);
  margin-bottom: var(--space-3);
  line-height: 1.7;
}
.reward-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  background: linear-gradient(135deg, var(--red-500), var(--red-600));
  color: #fff;
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-red);
}
.reward-num-big { font-size: var(--font-title-md); font-weight: 800; line-height: 1.2; font-variant-numeric: tabular-nums; }
.reward-label { font-size: var(--font-small); opacity: 0.92; }

.result-summary { margin: var(--space-5) 0; }
.result-summary-banner {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-6);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--danger-bg), #fee2e2);
  border: 1px solid #fecaca;
  color: #b91c1c;
}
.result-summary-banner.passed {
  background: linear-gradient(135deg, var(--success-bg), #d1fae5);
  border-color: var(--success-border);
  color: #166534;
}
.rsb-left { text-align: center; min-width: 100px; }
.rsb-num { font-size: 34px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.rsb-label { font-size: var(--font-small); opacity: 0.85; }
.rsb-status { font-size: var(--font-title-md); font-weight: 800; }
.rsb-meta { font-size: var(--font-caption); opacity: 0.85; margin-top: 2px; }

.result-detail { margin-top: var(--space-4); }
.section-title { font-size: var(--font-body-lg); font-weight: 700; margin: var(--space-6) 0 var(--space-3); color: var(--gray-900); }

.result-card {
  background: #fff;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-3);
  box-shadow: var(--shadow-xs);
  transition: all var(--dur-fast);
}
.result-card.card-correct { border-color: var(--success-border); background: linear-gradient(135deg, #fff, var(--success-bg)); }
.result-card.card-wrong   { border-color: #fecaca; background: linear-gradient(135deg, #fff, var(--danger-bg)); }
.result-card .r-head-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-3);
}
.q-num { font-weight: 600; color: var(--gray-500); font-size: var(--font-body-sm); }

.answer-row {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: var(--font-body-sm);
  margin-bottom: var(--space-2);
  line-height: 1.6;
}
.answer-user     { background: var(--gray-50); color: var(--gray-700); }
.answer-correct  { background: var(--success-bg); color: #15803d; font-weight: 500; }
.answer-mask     { background: var(--warning-bg); color: #b45309; }

.result-img {
  text-align: center;
  margin-bottom: var(--space-3);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--gray-50);
  max-height: 200px;
  border: 1px solid var(--color-border-light);
}
.result-img img { max-height: 200px; margin: 0 auto; }

/* 历史表格 */
.history-table {
  width: 100%;
  background: #fff;
  border-collapse: collapse;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  font-size: var(--font-body-sm);
}
.history-table th {
  background: var(--gray-50);
  text-align: left;
  padding: 10px 12px;
  font-weight: 600;
  color: var(--gray-600);
  border-bottom: 1px solid var(--color-border);
}
.history-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-border-light);
}
.history-table tr:last-child td { border-bottom: none; }

.loading {
  padding: var(--space-10);
  text-align: center;
  color: var(--color-text-muted);
}

/* 动效 */
#quizContainer { transition: opacity 0.18s ease; }

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

/* 屏 */
.screen { padding: 0 0 var(--space-6); }
.screen-bg { display: flex; flex-direction: column; align-items: center; }
.bg-image-wrap {
  width: 100%;
  max-width: 720px;
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: var(--red-50);
  margin-bottom: var(--space-5);
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.bg-image { width: 100%; display: block; }
.bg-fallback {
  padding: var(--space-10) var(--space-5);
  text-align: center;
  color: var(--color-text-muted);
}
.bg-fallback-icon { font-size: 60px; opacity: 0.4; margin-bottom: var(--space-2); }
.bg-content { text-align: center; max-width: 600px; width: 100%; }
.bg-title {
  font-size: var(--font-title-lg);
  font-weight: 800;
  margin-bottom: var(--space-3);
  color: var(--gray-900);
}
.bg-desc {
  font-size: var(--font-body-sm);
  color: var(--gray-500);
  line-height: 1.8;
  margin-bottom: var(--space-6);
  white-space: pre-wrap;
}
.bg-meta {
  margin-top: var(--space-4);
  display: flex;
  justify-content: center;
  gap: var(--space-6);
  font-size: var(--font-caption);
  color: var(--gray-500);
}
.bg-meta b { color: var(--red-600); font-size: var(--font-body); font-weight: 700; font-variant-numeric: tabular-nums; }

/* ============================================
   活动页 v3：背景铺满 + 题目网格 + 弹层 + 统计
   ============================================ */
.activity-page {
  padding: 0;
  margin: -20px -20px 0;   /* 抵消 app-main 内边距，让背景图铺满 */
  overflow-x: hidden;
}
@media (min-width: 720px) {
  .activity-page { margin: -20px auto 0; max-width: 720px; }
}

/* ── 背景图：铺满、无圆角、无文字 ── */
.bg-hero {
  position: relative;
  width: 100%;
  background: linear-gradient(135deg, var(--red-50), var(--red-100));
  overflow: hidden;
  line-height: 0;
}
.bg-hero-img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}
@media (min-width: 720px) {
  .activity-page { margin: -20px auto 0; max-width: 720px; }
}

/* ── 背景图：铺满、无圆角 ── */
.bg-hero {
  position: relative;
  width: 100%;
  min-height: 260px;
  background: linear-gradient(135deg, var(--red-50), var(--red-100));
  overflow: hidden;
}
.bg-hero-img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}
.bg-hero-fallback {
  min-height: 240px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  padding: var(--space-8);
}
.bg-hero-overlay {
  position: relative;
  padding: var(--space-5) var(--space-5) var(--space-6);
  text-align: center;
  background: linear-gradient(180deg, rgba(24,24,27,0.05), rgba(24,24,27,0.12));
}
.bg-title {
  font-size: var(--font-title-lg);
  font-weight: 800;
  margin-bottom: var(--space-2);
  color: var(--gray-900);
  text-shadow: 0 1px 2px rgba(255,255,255,0.6);
}
.bg-desc {
  font-size: var(--font-body-sm);
  color: var(--gray-700);
  line-height: 1.7;
  margin-bottom: var(--space-3);
  white-space: pre-wrap;
}
.bg-meta {
  display: flex;
  justify-content: center;
  gap: var(--space-5);
  flex-wrap: wrap;
  font-size: var(--font-caption);
  color: var(--gray-600);
  background: rgba(255,255,255,0.75);
  border-radius: 999px;
  padding: var(--space-2) var(--space-5);
  display: inline-flex;
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,0.6);
}
.bg-meta b { color: var(--red-600); font-weight: 700; font-variant-numeric: tabular-nums; }

/* ── 题目区域 ── */
.quiz-area {
  padding: var(--space-5);
}
.quiz-area-head {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-border-light);
  flex-wrap: wrap;
}
.quiz-area-title { font-size: var(--font-title-md); font-weight: 800; color: var(--gray-900); letter-spacing: 0.5px; }
.quiz-area-sub { font-size: var(--font-caption); color: var(--gray-500); }

/* ── 题目网格 ── */
.question-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
}

.q-card {
  background: #fff;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
}
.q-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--red-300);
}
.q-card-img-wrap {
  aspect-ratio: 4/3;
  background: var(--gray-50);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.q-card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.q-card-img-wrap.img-error { color: var(--gray-300); }
.q-card-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3);
}
.q-card-num { font-size: var(--font-caption); font-weight: 600; color: var(--gray-600); }

.q-status {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: var(--font-small);
  font-weight: 600;
}
.q-st-unanswered { background: var(--gray-100); color: var(--gray-500); }
.q-st-correct { background: var(--success-bg); color: #15803d; }
.q-st-wrong { background: var(--danger-bg); color: var(--danger); }

/* ── 单题弹层 ── */
.quiz-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
@media (min-width: 560px) {
  .quiz-modal { align-items: center; }
}
.quiz-modal.hidden { display: none; }
.modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(24, 24, 27, 0.55);
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-body {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: 92vh;
  background: #fff;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: var(--space-5) var(--space-5) 0;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.25s var(--ease-out);
}
.modal-content {
  flex: 1;
  overflow-y: auto;
  padding-bottom: var(--space-4);
  min-height: 0;
  margin-bottom: 0;
}
.modal-footer {
  position: sticky;
  bottom: 0;
  background: #fff;
  padding: var(--space-4) 0 max(var(--space-4), env(safe-area-inset-bottom));
  border-top: 1px solid var(--color-border-light);
  z-index: 5;
  display: flex;
  gap: var(--space-3);
}
@media (min-width: 560px) {
  .modal-body { border-radius: var(--radius-xl); }
}
@keyframes slideUp {
  from { transform: translateY(40px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}
.modal-qnum { font-weight: 700; color: var(--gray-700); }
.modal-close {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 999px;
  background: var(--gray-100);
  color: var(--gray-600);
  font-size: 14px;
  transition: all var(--dur-fast);
}
.modal-close:hover { background: var(--gray-200); }

.modal-content { margin-bottom: var(--space-5); }
.quiz-img-wrap {
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--gray-50);
  margin-bottom: var(--space-4);
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 340px;
  border: 1px solid var(--color-border-light);
}
.quiz-img-wrap img { max-height: 340px; width: auto; }

.answer-banner {
  text-align: center;
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-3);
}
.banner-correct { background: var(--success-bg); border: 1px solid var(--success-border); }
.banner-wrong { background: var(--danger-bg); border: 1px solid #fecaca; }
.ab-big { font-size: 22px; font-weight: 800; }
.banner-correct .ab-big { color: #15803d; }
.banner-wrong .ab-big { color: var(--danger); }

.answer-row {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: var(--font-body-sm);
  margin-bottom: var(--space-2);
  line-height: 1.6;
}
.answer-user { background: var(--gray-50); color: var(--gray-700); }
.answer-correct { background: var(--success-bg); color: #15803d; font-weight: 500; }

.quiz-answer { margin-bottom: var(--space-3); text-align: left; }
.quiz-answer label {
  display: block;
  font-size: var(--font-caption);
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: var(--space-2);
}
.quiz-answer input {
  width: 100%;
  padding: 13px 16px;
  border: 2px solid var(--red-200);
  border-radius: var(--radius-md);
  font-size: var(--font-body-lg);
  font-weight: 600;
  text-align: center;
  background: var(--gray-50);
  transition: all var(--dur-fast);
  color: var(--gray-900);
}
.quiz-answer input:focus {
  outline: none;
  border-color: var(--red-500);
  background: #fff;
  box-shadow: 0 0 0 5px rgba(255, 91, 91, 0.15);
}

.quiz-hint {
  text-align: left;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: var(--space-3);
  font-size: var(--font-body-sm);
  background: var(--gray-50);
  border-left: 4px solid var(--red-400);
  line-height: 1.7;
}

.modal-footer {
  display: flex;
  gap: var(--space-3);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border-light);
}
.modal-footer .btn { flex: 1; }

.redo-btn { margin-top: var(--space-2); }
.already-note {
  text-align: center;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: var(--font-caption);
  color: var(--gray-500);
  background: var(--gray-50);
  margin-top: var(--space-2);
  border: 1px dashed var(--color-border);
}

/* ============================================
   单题独立页（点击卡片新开页面）
   ============================================ */
.question-page {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 80px);
  padding-bottom: 90px;   /* 给底部吸底按钮留空间 */
}
.qp-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}
.qp-top .back-link { margin-bottom: 0; }
.qp-image-wrap {
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--gray-50);
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 380px;
  border: 1px solid var(--color-border-light);
  margin-bottom: var(--space-4);
}
.qp-image-wrap {
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--gray-50);
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 420px;
  border: 1px solid var(--color-border-light);
  margin-bottom: var(--space-4);
}
.qp-image-wrap img {
  width: 100%;
  height: auto;
  object-fit: contain;
  max-height: 420px;
}
.qp-image-wrap.img-error { min-height: 180px; }
.qp-image-wrap .img-fallback { display: none; }
.qp-image-wrap.img-error .img-fallback { display: block; padding: 40px; color: var(--gray-400); }

.qp-hint {
  text-align: left;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
  font-size: var(--font-body-sm);
  background: var(--gray-50);
  border-left: 4px solid var(--red-400);
  line-height: 1.7;
}

.qp-content { flex: 1; }
.qp-answer { margin-bottom: var(--space-3); text-align: left; }
.qp-answer label {
  display: block;
  font-size: var(--font-caption);
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: var(--space-2);
}
.qp-answer input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--red-200);
  border-radius: var(--radius-md);
  font-size: var(--font-body-lg);
  font-weight: 600;
  text-align: center;
  background: var(--gray-50);
  transition: all var(--dur-fast);
  color: var(--gray-900);
}
.qp-answer input:focus {
  outline: none;
  border-color: var(--red-500);
  background: #fff;
  box-shadow: 0 0 0 5px rgba(255, 91, 91, 0.15);
}

/* 底部吸底按钮 */
.qp-footer {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 720px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--color-border-light);
  padding: var(--space-3) var(--space-5) max(var(--space-3), env(safe-area-inset-bottom));
  display: flex;
  gap: var(--space-3);
  z-index: 50;
}
.qp-footer .btn { flex: 1; }

/* 停用提示页 */
.disabled-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  padding: 24px;
}
.disabled-card {
  text-align: center;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: 40px 32px;
  max-width: 360px;
  box-shadow: var(--shadow-sm);
}

/* ===== 需求#5 奖池横幅 ===== */
.prize-banner {
  background: rgba(255, 255, 255, 0.5);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 14px;
  padding: 10px 14px;
  margin-bottom: 4px;
  font-size: 14px;
  color: #9f1239;
}
.prize-banner b { color: #be123c; font-size: 16px; }
.prize-banner.on-hero { position: absolute; left: 12px; right: 12px; bottom: 12px; margin-bottom: 0; box-shadow: 0 2px 12px rgba(0,0,0,0.12); }

/* ===== 需求#4 筛选栏 ===== */
.filter-bar { display: flex; gap: 8px; margin-bottom: 16px; }
.chip {
  flex: 1;
  justify-content: center;
  white-space: nowrap;
  border: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 999px;
  padding: 6px 8px;
  font-size: 13px;
  cursor: pointer;
  color: #374151;
}
.chip.active { background: #fb7185; color: #fff; border-color: transparent; }
/* tab 数字徽标（需求：数字直接显示在 tab 上） */
.chip-num {
  display: inline-block;
  min-width: 20px;
  padding: 1px 7px;
  margin-left: 4px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.06);
  font-size: 12px;
  font-weight: 700;
  line-height: 18px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.chip.active .chip-num { background: rgba(255, 255, 255, 0.25); color: #fff; }

/* ===== 答题卡（含输入框） ===== */
.q-card { display: flex; flex-direction: column; gap: 6px; }
.q-card-img { display: block; border-radius: 10px; overflow: hidden; background: #f9fafb; }
.q-card-img img { width: 100%; display: block; }
.q-answer-input {
  width: 100%; border: 1px solid #e5e7eb;
  border-radius: 10px; padding: 8px 10px; font-size: 14px;
}
.q-answer-input:disabled { background: #f3f4f6; color: #6b7280; }
.q-explain { font-size: 12px; color: #6b7280; background: #fffbeb; border-radius: 8px; padding: 6px 8px; }
.q-st-answered .q-status { color: #2563eb; }

/* ===== 需求#3 提交栏 / 锁定 ===== */
.submit-bar { position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%); width: calc(100% - 32px); max-width: 480px; z-index: 40; margin-top: 0; }
.activity-page { padding-bottom: 96px; }
.btn-block { width: 100%; }
.lock-note {
  text-align: center; padding: 12px; border-radius: 12px;
  background: #f3f4f6; color: #6b7280; font-size: 14px; font-weight: 600;
}

/* ===== 需求#6 再答任务面板 ===== */
.retry-panel {
  margin-top: 16px; background: #fff;
  border: 1px solid #e5e7eb; border-radius: 14px; padding: 16px;
}
.retry-panel h3 { margin: 0 0 10px; font-size: 15px; }
.task-row { display: flex; justify-content: space-between; font-size: 14px; padding: 8px 0; border-bottom: 1px dashed #eee; }

/* ===== 弹窗 ===== */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center; z-index: 999; padding: 20px;
}
.modal-box {
  background: #fff; border-radius: 16px; padding: 22px; max-width: 320px; width: 100%; text-align: center;
}
.modal-text { font-size: 15px; margin-bottom: 18px; line-height: 1.5; }
.modal-actions { display: flex; gap: 10px; }
.modal-actions .btn { flex: 1; }
.poster-box canvas { width: 100%; max-width: 320px; border-radius: 12px; }
.poster-tip { font-size: 12px; color: #6b7280; margin: 10px 0; }

/* ===== 单题页：已答题/解析 ===== */
.banner-answered { background: #eff6ff; color: #1d4ed8; border-radius: 12px; padding: 14px; text-align: center; }
.answer-explain { background: #fffbeb; border-radius: 10px; padding: 10px 12px; font-size: 14px; color: #92400e; margin-top: 8px; }
.disabled-icon {
  font-size: 44px;
  margin-bottom: 12px;
}
.disabled-card h2 {
  font-size: var(--font-title-md);
  margin-bottom: 10px;
  color: var(--gray-900);
}
.disabled-card p {
  color: var(--gray-500);
  font-size: var(--font-body-sm);
  line-height: 1.7;
}

.upgrade-note {
  text-align: center;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: var(--font-body-sm);
  font-weight: 600;
  color: #b45309;
  background: #fffbeb;
  border: 1px solid #fde68a;
  margin-bottom: var(--space-3);
}

/* ===== 奖品卡（奖品图+说明文字，后台「屏幕3 奖品图/奖品说明」） ===== */
.prize-card { background: #fff; border: 1px solid #fecdd3; border-radius: 14px; padding: 12px; margin-bottom: 16px; }
.prize-card-imgs { display: flex; flex-wrap: wrap; gap: 10px; }
.prize-item { width: 88px; text-align: center; }
.prize-item img { width: 88px; height: 88px; object-fit: cover; border-radius: 10px; display: block; }
.prize-item-text { font-size: 11px; color: #9f1239; margin-top: 4px; line-height: 1.3; word-break: break-all; }
.prize-card-text { font-size: 14px; color: #9f1239; margin-top: 8px; line-height: 1.5; }

/* ===== 排行榜 ===== */
.lb-entry { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; font-size: 24px; line-height: 1; background: rgba(0,0,0,0.35); border: 1px solid rgba(255,255,255,0.55); border-radius: 50%; cursor: pointer; margin: 0 0 10px; -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); box-shadow: 0 2px 8px rgba(0,0,0,0.2); }
.lb-entry.lb-float { position: absolute; top: 12px; right: 12px; margin: 0; z-index: 5; }
.lb-box { text-align: left; max-width: 340px; }
.lb-title { text-align: center; margin: 0 0 12px; font-size: 18px; }
.lb-list { max-height: 55vh; overflow-y: auto; margin-bottom: 12px; }
.lb-row { display: flex; align-items: center; gap: 8px; padding: 10px 4px; border-bottom: 1px dashed #f3e8e8; font-size: 14px; }
.lb-rank { width: 26px; height: 26px; border-radius: 50%; background: #f3f4f6; color: #374151; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.lb-rank.rank-1 { background: #f59e0b; color: #fff; }
.lb-rank.rank-2 { background: #9ca3af; color: #fff; }
.lb-rank.rank-3 { background: #d97706; color: #fff; }
.lb-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.lb-rate { color: #dc2626; font-weight: 700; font-size: 15px; }
.lb-meta { color: #9ca3af; font-size: 12px; }
.lb-empty { text-align: center; color: #9ca3af; padding: 24px 0; font-size: 14px; }

/* ===== 奖池里程碑进度条 ===== */
.pool-ms { margin-top: 8px; }
.pool-ms-bar { height: 8px; background: rgba(0,0,0,0.08); border-radius: 999px; overflow: hidden; }
.pool-ms-fill { height: 100%; background: linear-gradient(90deg, #fb7185, #e0245e); border-radius: 999px; transition: width .4s; }
.pool-ms-text { font-size: 12px; color: #9f1239; margin-top: 5px; line-height: 1.4; }

/* 活动规则与上方横幅/背景图拉开间距 */
.rules { margin-top: 2px !important; }

/* ===== 活动倒计时 ===== */
.pool-cd { margin-top: 6px; font-size: 13px; color: #be123c; font-weight: 600; }
/* ===== 活动结束结果卡 ===== */
.result-card { background: rgba(255,255,255,0.6); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); border: 1px solid rgba(255,255,255,0.7); border-radius: 14px; padding: 14px 16px; margin-bottom: 16px; text-align: center; }
.result-big { font-size: 18px; font-weight: 800; color: #be123c; margin-bottom: 8px; }
.result-row { font-size: 13px; color: #374151; line-height: 1.7; }
.result-row b { color: #be123c; }
/* ===== 卡片正确答案行 ===== */
.q-correct-ans { background: #ecfdf5; }

/* ===== 奖品卡标题 ===== */
.prize-card-title { font-size: 15px; font-weight: 800; color: #be123c; margin-bottom: 8px; }
