/* ═══════════════════════════════════════
   讲师兑奖系统 · 移动端 H5 样式
   适配微信内置浏览器
   ═══════════════════════════════════════ */

:root {
  --navy: #1b2a4a;
  --navy-light: #2c4270;
  --gold: #c9a227;
  --gold-light: #e8c95a;
  --gold-pale: #fdf6e3;
  --red: #d94a3d;
  --green: #2ea56b;
  --orange: #e08a1e;
  --bg: #f4f6fa;
  --card: #ffffff;
  --text: #1f2937;
  --text-sub: #6b7280;
  --text-light: #9ca3af;
  --line: #e8ecf3;
  --radius: 14px;
  --shadow: 0 2px 12px rgba(27, 42, 74, 0.06);
  --shadow-lg: 0 8px 28px rgba(27, 42, 74, 0.12);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Helvetica Neue", Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

.app { min-height: 100vh; position: relative; }

/* ── 页面切换 ── */
.page { display: none; min-height: 100vh; flex-direction: column; }
.page.active { display: flex; }

/* ═══ 首页 Hero ═══ */
.hero {
  position: relative;
  background: linear-gradient(160deg, #1b2a4a 0%, #24365e 45%, #2c4270 100%);
  padding: calc(env(safe-area-inset-top) + 40px) 24px 34px;
  text-align: center;
  color: #fff;
  overflow: hidden;
  border-radius: 0 0 26px 26px;
}
.hero-glow {
  position: absolute; top: -60px; left: 50%; transform: translateX(-50%);
  width: 320px; height: 320px; border-radius: 50%;
  background: radial-gradient(circle, rgba(201,162,39,.32) 0%, rgba(201,162,39,0) 66%);
  pointer-events: none;
}
.hero-badge {
  position: relative;
  width: 60px; height: 60px; margin: 0 auto 16px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--gold-light), var(--gold));
  color: #4a3608;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 20px rgba(201,162,39,.42);
}
.hero-title {
  position: relative;
  font-size: 23px; font-weight: 700; line-height: 1.42; letter-spacing: .4px;
}
.text-gold {
  background: linear-gradient(100deg, #f6e3a1 0%, #e8c95a 45%, #c9a227 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: var(--gold-light);
}
.hero-sub {
  position: relative;
  margin-top: 10px; font-size: 14px; color: rgba(255,255,255,.72); letter-spacing: 1.6px;
}
.hero-divider {
  position: relative;
  width: 46px; height: 2px; margin: 18px auto;
  background: linear-gradient(90deg, transparent, var(--gold-light), transparent);
}
.hero-desc {
  position: relative;
  font-size: 13.5px; color: rgba(255,255,255,.8); line-height: 1.85;
}

/* ═══ 内容区 ═══ */
.content {
  flex: 1;
  padding: 16px 16px calc(120px + env(safe-area-inset-bottom));
}
.content-list { padding-bottom: calc(150px + env(safe-area-inset-bottom)); }

/* ═══ 卡片 ═══ */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.card-head#rules-toggle { margin-bottom: 0; cursor: pointer; }
.card-title { font-size: 15px; font-weight: 600; color: var(--navy); }
.card-note { font-size: 12px; color: var(--text-light); }

/* ═══ 倒计时 ═══ */
.countdown-card {
  background: linear-gradient(135deg, #fff 0%, #fdfaf0 100%);
  border: 1px solid rgba(201,162,39,.2);
  text-align: center;
}
.card-label { font-size: 12.5px; color: var(--text-sub); margin-bottom: 12px; }
.countdown { display: flex; align-items: center; justify-content: center; gap: 4px; }
.cd-item { display: flex; flex-direction: column; align-items: center; min-width: 46px; }
.cd-num {
  font-size: 24px; font-weight: 700; color: var(--navy);
  font-variant-numeric: tabular-nums; line-height: 1.15;
}
.cd-unit { font-size: 11px; color: var(--text-light); margin-top: 2px; }
.cd-sep { color: var(--text-light); font-size: 18px; padding-bottom: 14px; font-weight: 300; }
.countdown-deadline {
  margin-top: 12px; font-size: 11.5px; color: var(--text-light);
}

/* ═══ 奖池列表（首页） ═══ */
.pool-list { display: flex; flex-direction: column; gap: 10px; }
.pool-item {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 12px;
  background: #fafbfd; border-radius: 11px;
  border: 1px solid var(--line);
}
.pool-icon {
  width: 38px; height: 38px; flex: 0 0 38px;
  border-radius: 10px; display: flex; align-items: center; justify-content: center;
  font-size: 19px; background: var(--gold-pale);
}
.pool-info { flex: 1; min-width: 0; }
.pool-name { font-size: 14px; font-weight: 500; color: var(--text); }
.pool-spec {
  font-size: 11.5px; color: var(--text-light); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ═══ 库存徽章 ═══ */
.badge {
  flex: 0 0 auto; font-size: 11.5px; font-weight: 500;
  padding: 3px 9px; border-radius: 20px; white-space: nowrap;
}
.badge-ok      { background: #e8f6ef; color: var(--green); }
.badge-low     { background: #fdf0e0; color: var(--orange); }
.badge-out     { background: #f1f2f4; color: var(--text-light); }
.badge-unlimit { background: #e9effb; color: #3b6bd6; }

/* ═══ 活动规则 ═══ */
.rules-body { max-height: 0; overflow: hidden; transition: max-height .32s ease; }
.rules-body.open { max-height: 620px; }
.chevron { color: var(--text-light); font-size: 13px; transition: transform .3s; }
.chevron.open { transform: rotate(180deg); }
.rules { margin-top: 12px; padding-left: 19px; }
.rules li { font-size: 13px; color: var(--text-sub); line-height: 1.85; margin-bottom: 7px; }
.rules li b { color: var(--red); font-weight: 600; }

/* ═══ 客服 ═══ */
.contact-card { padding: 14px 16px; }
.contact-row { display: flex; align-items: center; justify-content: space-between; }
.contact-label { font-size: 13.5px; color: var(--text-sub); }
.contact-value { font-size: 13.5px; color: var(--navy); font-weight: 500; }

/* ═══ 底部按钮栏 ═══ */
.footer-bar {
  position: fixed; left: 0; right: 0; bottom: 0;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: rgba(255,255,255,.94);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  z-index: 50;
}
.footer-bar-tall { padding-top: 10px; }
.footer-links {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 9px; font-size: 11.5px; color: var(--text-light);
}
.footer-links a { color: var(--text-light); text-decoration: none; }

/* ═══ 按钮 ═══ */
.btn {
  width: 100%; height: 50px; border: none; border-radius: 12px;
  font-size: 16px; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: transform .12s, opacity .2s, box-shadow .2s;
  display: flex; align-items: center; justify-content: center;
}
.btn:active { transform: scale(.985); }
.btn-primary {
  background: linear-gradient(135deg, #24365e, #1b2a4a);
  color: #fff;
  box-shadow: 0 4px 14px rgba(27,42,74,.24);
}
.btn-primary:disabled {
  background: #d4d9e2; color: #fff; box-shadow: none; cursor: not-allowed;
}
.btn-primary:disabled:active { transform: none; }
.btn-ghost {
  background: #f1f3f7; color: var(--text-sub);
}
.btn-gold {
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  color: #4a3608; box-shadow: 0 4px 14px rgba(201,162,39,.32);
}

/* ═══ 导航栏 ═══ */
.nav {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  height: 50px; padding: 0 14px;
  padding-top: env(safe-area-inset-top);
  background: rgba(255,255,255,.96);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav-back {
  width: 34px; height: 34px; border: none; background: transparent;
  font-size: 26px; line-height: 1; color: var(--navy);
  display: flex; align-items: center; justify-content: flex-start;
  cursor: pointer; padding: 0;
}
.nav-title { font-size: 16px; font-weight: 600; color: var(--navy); }
.nav-right { min-width: 34px; text-align: right; }
.nav-user { font-size: 12.5px; color: var(--text-sub); }

/* ═══ 验证页 ═══ */
.verify-icon {
  width: 76px; height: 76px; margin: 26px auto 18px;
  border-radius: 50%;
  background: linear-gradient(145deg, #eef2f9, #e2e9f5);
  color: var(--navy-light);
  display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 2px 6px rgba(27,42,74,.06);
}
.verify-title { text-align: center; font-size: 19px; font-weight: 600; color: var(--navy); }
.verify-desc { text-align: center; font-size: 13px; color: var(--text-sub); margin-top: 8px; }
.input-wrap { margin-top: 26px; }
.input {
  width: 100%; height: 52px; padding: 0 16px;
  border: 1.5px solid var(--line); border-radius: 12px;
  font-size: 16px; font-family: inherit; color: var(--text);
  background: #fff; outline: none; transition: border-color .2s, box-shadow .2s;
  -webkit-appearance: none;
}
.input:focus {
  border-color: var(--navy-light);
  box-shadow: 0 0 0 3px rgba(44,66,112,.08);
}
.input::placeholder { color: #c2c8d2; }
.verify-tip {
  min-height: 22px; margin-top: 12px;
  font-size: 13px; color: var(--red); text-align: center;
}

/* ═══ 选奖页 ═══ */
.welcome-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px 4px; gap: 8px;
}
.welcome-text { font-size: 13.5px; color: var(--text-sub); }
.welcome-text b { color: var(--navy); font-weight: 600; }
.live-dot {
  display: flex; align-items: center; gap: 4px;
  font-size: 11px; color: var(--green); white-space: nowrap;
}
.live-dot i {
  width: 6px; height: 6px; border-radius: 50%; background: var(--green);
  animation: pulse 1.6s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .35; transform: scale(.82); }
}

/* ═══ 奖品卡片 ═══ */
.prize-card {
  position: relative;
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--card); border-radius: var(--radius);
  padding: 15px 14px; margin-bottom: 11px;
  border: 1.5px solid transparent;
  box-shadow: var(--shadow);
  transition: border-color .2s, box-shadow .2s, transform .12s;
  cursor: pointer;
}
.prize-card:active { transform: scale(.992); }
.prize-card.selected {
  border-color: var(--gold);
  box-shadow: 0 4px 18px rgba(201,162,39,.2);
  background: linear-gradient(135deg, #fffdf7 0%, #fff 60%);
}
.prize-card.disabled {
  opacity: .52; cursor: not-allowed; box-shadow: none;
}
.prize-card.disabled:active { transform: none; }

.prize-icon {
  width: 50px; height: 50px; flex: 0 0 50px;
  border-radius: 13px; display: flex; align-items: center; justify-content: center;
  font-size: 25px; background: var(--gold-pale);
}
.prize-card.selected .prize-icon {
  background: linear-gradient(145deg, #fdf0c8, #f8e5a0);
}
.prize-body { flex: 1; min-width: 0; }
.prize-name {
  font-size: 15px; font-weight: 600; color: var(--text);
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.prize-value {
  font-size: 12px; color: var(--gold); font-weight: 600;
  background: var(--gold-pale); padding: 1px 7px; border-radius: 5px;
}
.prize-spec { font-size: 12px; color: var(--text-light); margin-top: 5px; line-height: 1.55; }
.prize-foot { display: flex; align-items: center; gap: 6px; margin-top: 9px; flex-wrap: wrap; }
.tag {
  font-size: 11px; padding: 2px 7px; border-radius: 5px;
  background: #f2f4f8; color: var(--text-sub);
}
.tag-tax { background: #fdecea; color: var(--red); }

.prize-check {
  width: 22px; height: 22px; flex: 0 0 22px; border-radius: 50%;
  border: 1.5px solid #d6dbe4; background: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s; margin-top: 2px;
}
.prize-card.selected .prize-check {
  border-color: var(--gold);
  background: linear-gradient(145deg, var(--gold-light), var(--gold));
}
.prize-check svg { opacity: 0; transition: opacity .2s; }
.prize-card.selected .prize-check svg { opacity: 1; }

/* 选中角标 */
.soldout-mask {
  position: absolute; top: 0; right: 0;
  background: #9aa3b0; color: #fff;
  font-size: 10.5px; padding: 2px 10px 3px;
  border-radius: 0 var(--radius) 0 10px;
}

/* ═══ 已选栏 ═══ */
.selected-bar {
  display: flex; align-items: center; gap: 4px;
  margin-bottom: 9px; font-size: 13px; min-height: 20px;
}
.selected-label { color: var(--text-light); }
.selected-name { color: var(--navy); font-weight: 600; }

/* ═══ 确认页 ═══ */
.confirm-card {
  background: linear-gradient(135deg, #fffdf7 0%, #fff 65%);
  border: 1.5px solid rgba(201,162,39,.26);
  border-radius: var(--radius);
  padding: 22px 18px;
  margin-bottom: 12px;
  text-align: center;
  box-shadow: var(--shadow);
}
.confirm-icon { font-size: 42px; margin-bottom: 12px; }
.confirm-name { font-size: 18px; font-weight: 700; color: var(--navy); }
.confirm-value {
  display: inline-block; margin-top: 9px;
  font-size: 13px; color: var(--gold); font-weight: 600;
  background: var(--gold-pale); padding: 3px 11px; border-radius: 6px;
}
.confirm-spec {
  font-size: 12.5px; color: var(--text-sub); margin-top: 11px; line-height: 1.7;
}

/* ═══ 提示框 ═══ */
.alert {
  display: flex; gap: 9px; align-items: flex-start;
  padding: 13px 14px; border-radius: 12px;
  font-size: 12.8px; line-height: 1.68; margin-bottom: 12px;
}
.alert b { font-weight: 600; }
.alert-icon { flex: 0 0 auto; font-size: 15px; line-height: 1.35; }
.alert-warn { background: #fef6f5; color: #a8352a; border: 1px solid #fadbd7; }
.alert-warn b { color: var(--red); }
.alert-info { background: #f3f6fc; color: #3a5580; border: 1px solid #e0e8f6; }
.alert-info b { color: var(--navy); }

/* ═══ 成功页 ═══ */
.success-content { text-align: center; padding-top: 26px; }
.success-anim { display: flex; justify-content: center; margin-bottom: 18px; }
.success-circle {
  width: 78px; height: 78px; border-radius: 50%;
  background: linear-gradient(145deg, #34b877, var(--green));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 26px rgba(46,165,107,.34);
  animation: pop .48s cubic-bezier(.18,.89,.32,1.28);
}
@keyframes pop {
  0% { transform: scale(.3); opacity: 0; }
  60% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); }
}
.success-title { font-size: 21px; font-weight: 700; color: var(--navy); }
.success-desc { font-size: 13px; color: var(--text-sub); margin-top: 8px; }

/* ═══ 二维码卡 ═══ */
.qr-card {
  background: #fff; border-radius: var(--radius);
  padding: 22px 16px; margin: 16px 0 12px;
  box-shadow: var(--shadow);
  text-align: center;
}
.qr-box {
  width: 168px; height: 168px; margin: 0 auto;
  border-radius: 10px; padding: 9px;
  background: #fff; border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
}
.qr-box canvas, .qr-box img { width: 100%; height: 100%; display: block; }
.qr-code-text {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 17px; font-weight: 700; letter-spacing: 2.4px;
  color: var(--navy); margin-top: 14px;
  user-select: all; -webkit-user-select: all;
}
.qr-hint { font-size: 11.5px; color: var(--text-light); margin-top: 7px; }

/* ═══ 奖品详情 ═══ */
.prize-detail { text-align: left; }
.info-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 0; border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}
.info-row:last-child { border-bottom: none; }
.info-label { color: var(--text-sub); }
.info-value { color: var(--text); font-weight: 500; text-align: right; }

/* ═══ 状态横幅 ═══ */
.status-banner {
  border-radius: var(--radius);
  padding: 15px 16px; margin-bottom: 12px;
  display: flex; align-items: center; gap: 11px;
  font-size: 14px; font-weight: 600;
}
.status-pending { background: #fff8e8; color: #9a6b0f; border: 1px solid #f7e6bb; }
.status-verified { background: #eaf7f1; color: #1e7a4e; border: 1px solid #c8ead9; }
.status-icon { font-size: 20px; }

/* ═══ 弹窗 ═══ */
.modal-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(16,24,40,.5);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  display: none; align-items: center; justify-content: center;
  padding: 0 30px;
}
.modal-mask.show { display: flex; }
.modal {
  width: 100%; max-width: 320px;
  background: #fff; border-radius: 16px; padding: 22px 20px 18px;
  box-shadow: var(--shadow-lg);
  animation: modalIn .26s cubic-bezier(.18,.89,.32,1.1);
}
@keyframes modalIn {
  from { transform: scale(.9) translateY(8px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}
.modal-title { font-size: 16.5px; font-weight: 700; color: var(--navy); text-align: center; }
.modal-body {
  margin: 15px 0 8px; padding: 13px;
  background: var(--gold-pale); border-radius: 10px;
  font-size: 14.5px; font-weight: 600; color: var(--navy); text-align: center;
}
.modal-note { font-size: 12.5px; color: var(--text-sub); text-align: center; }
.modal-note b { color: var(--red); }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal-actions .btn { height: 46px; font-size: 15px; }

/* ═══ Toast ═══ */
.toast {
  position: fixed; left: 50%; top: 42%;
  transform: translate(-50%, -50%) scale(.94);
  background: rgba(24,32,48,.9); color: #fff;
  padding: 11px 20px; border-radius: 10px;
  font-size: 14px; max-width: 76vw; text-align: center;
  z-index: 200; opacity: 0; pointer-events: none;
  transition: opacity .22s, transform .22s;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.toast.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

/* ═══ 加载中遮罩 ═══ */
.loading-mask {
  position: fixed; inset: 0; z-index: 150;
  background: rgba(255,255,255,.72);
  display: none; align-items: center; justify-content: center;
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
.loading-mask.show { display: flex; }
.spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--navy-light);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══ 小屏适配 ═══ */
@media (max-width: 340px) {
  .hero-title { font-size: 20px; }
  .cd-num { font-size: 21px; }
  .cd-item { min-width: 40px; }
  .prize-icon { width: 44px; height: 44px; flex-basis: 44px; font-size: 22px; }
}

/* ═══ 大屏（平板/桌面预览）居中 ═══ */
@media (min-width: 560px) {
  body { background: #e9edf4; }
  .app {
    max-width: 430px; margin: 0 auto;
    background: var(--bg); min-height: 100vh;
    box-shadow: 0 0 40px rgba(27,42,74,.1);
    position: relative;
  }
  .footer-bar, .nav {
    max-width: 430px; left: 50%; transform: translateX(-50%);
  }
}
