/*
 * 豆包会员兑换页样式。
 *
 * 设计取向：浅色渐变背景 + 单张主卡片，信息层级靠字号与留白拉开，
 * 不使用任何图标字体或表情符号，图形一律用内联 SVG 或纯 CSS 绘制。
 */

:root {
  --db-bg-from: #eef2f9;
  --db-bg-to: #f7f9fc;
  --db-card: #ffffff;
  --db-line: #e5e9f0;
  --db-text: #1b2330;
  --db-text-weak: #6b7686;
  --db-brand: #2b6cf6;
  --db-brand-dark: #1c53cc;
  --db-ok: #17945f;
  --db-ok-bg: #eaf7f0;
  --db-warn: #c8791a;
  --db-warn-bg: #fdf4e7;
  --db-err: #c93a3a;
  --db-err-bg: #fdeeee;
  --db-radius: 16px;
  --db-shadow: 0 12px 32px rgba(23, 42, 84, 0.08);
}

* {
  box-sizing: border-box;
}

body.db-page {
  margin: 0;
  min-height: 100vh;
  padding: 32px 16px 56px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  color: var(--db-text);
  background: linear-gradient(160deg, var(--db-bg-from), var(--db-bg-to));
  -webkit-font-smoothing: antialiased;
}

.db-shell {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
}

/* ---------- 页头 ---------- */

.db-head {
  text-align: center;
  margin-bottom: 22px;
}

.db-head__mark {
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--db-brand), #5b9bff);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(43, 108, 246, 0.28);
}

.db-head__mark svg {
  width: 26px;
  height: 26px;
}

.db-head__title {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.db-head__subtitle {
  margin: 0;
  font-size: 13px;
  color: var(--db-text-weak);
}

/* ---------- 主卡片 ---------- */

.db-card {
  background: var(--db-card);
  border-radius: var(--db-radius);
  box-shadow: var(--db-shadow);
  padding: 26px 24px;
}

.db-step[hidden] {
  display: none !important;
}

.db-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--db-text-weak);
  margin-bottom: 8px;
}

.db-input {
  width: 100%;
  padding: 13px 14px;
  font-size: 17px;
  font-family: inherit;
  color: var(--db-text);
  background: #fafbfd;
  border: 1px solid var(--db-line);
  border-radius: 10px;
  transition: border-color 0.18s, background 0.18s;
}

.db-input:focus {
  outline: none;
  border-color: var(--db-brand);
  background: #fff;
}

.db-input::placeholder {
  color: #a9b1bd;
}

.db-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.db-row .db-input {
  flex: 1;
  min-width: 0;
}

.db-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 13px 18px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  background: var(--db-brand);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.18s, opacity 0.18s;
}

.db-btn:hover:not(:disabled) {
  background: var(--db-brand-dark);
}

.db-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.db-btn--block {
  width: 100%;
  margin-top: 16px;
}

.db-btn--ghost {
  color: var(--db-brand);
  background: #eef3ff;
}

.db-btn--ghost:hover:not(:disabled) {
  background: #e2ebff;
}

.db-btn--quiet {
  width: 100%;
  margin-top: 10px;
  color: var(--db-text-weak);
  background: transparent;
  border: 1px solid var(--db-line);
}

.db-btn--quiet:hover:not(:disabled) {
  background: #f6f8fb;
  color: var(--db-text);
}

.db-field + .db-field {
  margin-top: 14px;
}

.db-hint {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--db-text-weak);
  line-height: 1.6;
}

/* ---------- 模式切换 ---------- */

.db-tabs {
  display: flex;
  padding: 4px;
  margin-bottom: 20px;
  background: #f1f4f9;
  border-radius: 11px;
}

.db-tabs[hidden] {
  display: none !important;
}

.db-tab {
  flex: 1;
  padding: 9px 0;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  color: var(--db-text-weak);
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.18s, background 0.18s;
}

.db-tab.is-active {
  color: var(--db-text);
  background: #fff;
  box-shadow: 0 1px 3px rgba(23, 42, 84, 0.1);
}

/* ---------- 二维码 ---------- */

.db-qr {
  text-align: center;
}

.db-qr__frame {
  width: 208px;
  height: 208px;
  margin: 0 auto 16px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--db-line);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.db-qr__frame img {
  width: 100%;
  height: 100%;
  display: block;
}

.db-qr__frame img[hidden] {
  display: none;
}

.db-qr__spinner {
  width: 26px;
  height: 26px;
  border: 2px solid var(--db-line);
  border-top-color: var(--db-brand);
  border-radius: 50%;
  animation: db-spin 0.9s linear infinite;
}

.db-qr__spinner[hidden] {
  display: none;
}

@keyframes db-spin {
  to {
    transform: rotate(360deg);
  }
}

.db-qr__countdown {
  font-size: 14px;
  font-weight: 600;
  color: var(--db-brand);
  margin-top: 4px;
}

/* 扫码等待态：带脉冲点的状态行，避免页面在等待时完全静止 */
.db-qr__status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 14px 0 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--db-text-weak);
}

.db-qr__pulse {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--db-brand);
  animation: db-pulse 1.4s ease-in-out infinite;
}

.db-qr__pulse[hidden] {
  display: none;
}

@keyframes db-pulse {
  0%, 100% {
    opacity: 1;
    box-shadow: 0 0 0 0 rgba(43, 108, 246, 0.42);
  }
  50% {
    opacity: 0.55;
    box-shadow: 0 0 0 6px rgba(43, 108, 246, 0);
  }
}

/* ---------- 领取进度 ---------- */

.db-proc {
  padding: 14px 0 6px;
  text-align: center;
}

.db-proc__ring {
  position: relative;
  width: 78px;
  height: 78px;
  margin: 0 auto 20px;
}

.db-proc__ring svg {
  position: relative;
  width: 100%;
  height: 100%;
  display: block;
}

.db-proc__glow {
  position: absolute;
  inset: 15px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(43, 108, 246, 0.18), rgba(43, 108, 246, 0) 70%);
  animation: db-proc-breathe 2.1s ease-in-out infinite;
}

.db-proc__track {
  fill: none;
  stroke: var(--db-line);
}

.db-proc__arc {
  fill: none;
  stroke: var(--db-brand);
  stroke-dasharray: 40 86;
  transform-origin: 24px 24px;
  animation: db-proc-rotate 1.05s linear infinite;
}

@keyframes db-proc-rotate {
  to {
    transform: rotate(360deg);
  }
}

@keyframes db-proc-breathe {
  0%, 100% {
    opacity: 0.4;
    transform: scale(0.9);
  }
  50% {
    opacity: 1;
    transform: scale(1.08);
  }
}

.db-proc__title {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 600;
  color: var(--db-text);
}

.db-proc__hint {
  margin: 0;
  font-size: 13px;
  color: var(--db-text-weak);
}

/* 文案切换时重放一次淡入，让阶段推进看得出来 */
.db-proc__title.is-swap,
.db-proc__hint.is-swap {
  animation: db-proc-fade 0.42s ease-out;
}

@keyframes db-proc-fade {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.db-proc__steps {
  list-style: none;
  margin: 24px auto 0;
  padding: 0;
  max-width: 220px;
  display: flex;
  flex-direction: column;
  gap: 13px;
  text-align: left;
}

.db-proc__step {
  position: relative;
  padding-left: 25px;
  font-size: 13px;
  color: var(--db-text-weak);
  transition: color 0.3s;
}

.db-proc__step::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 9px;
  height: 9px;
  margin-top: -4.5px;
  border-radius: 50%;
  background: var(--db-line);
  transition: background 0.3s, box-shadow 0.3s;
}

.db-proc__step.is-done {
  color: var(--db-text);
}

.db-proc__step.is-done::before {
  background: var(--db-ok);
}

.db-proc__step.is-active {
  color: var(--db-brand);
  font-weight: 600;
}

.db-proc__step.is-active::before {
  background: var(--db-brand);
  animation: db-pulse 1.4s ease-in-out infinite;
}

/* ---------- 账号选择 ---------- */

.db-account-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.db-account {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 14px 16px;
  text-align: left;
  font-family: inherit;
  background: #fafbfd;
  border: 1px solid var(--db-line);
  border-radius: 11px;
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s;
}

.db-account:hover:not(:disabled) {
  border-color: var(--db-brand);
  background: #f4f8ff;
}

.db-account:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.db-account.is-loading {
  border-color: var(--db-brand);
  background: #f4f8ff;
}

.db-account__name {
  font-size: 15px;
  font-weight: 600;
  color: var(--db-text);
}

.db-account__tenant {
  font-size: 12px;
  color: var(--db-text-weak);
}

/* ---------- 结果 ---------- */

.db-result__banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 15px;
  margin-bottom: 20px;
  background: var(--db-ok-bg);
  border-radius: 11px;
}

.db-result__banner svg {
  width: 20px;
  height: 20px;
  flex: none;
}

.db-result__banner-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--db-ok);
}

.db-expire {
  text-align: center;
  padding: 20px 16px;
  margin-bottom: 18px;
  background: linear-gradient(140deg, #f2f7ff, #eaf1ff);
  border-radius: 13px;
}

.db-expire__label {
  display: block;
  font-size: 12px;
  color: var(--db-text-weak);
  margin-bottom: 8px;
}

.db-expire__value {
  display: block;
  font-size: 24px;
  font-weight: 700;
  color: var(--db-brand-dark);
  letter-spacing: 0.3px;
  font-variant-numeric: tabular-nums;
}

.db-expire__note {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  color: var(--db-brand);
}

.db-facts {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--db-line);
  border-radius: 11px;
  overflow: hidden;
}

.db-fact {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 15px;
  font-size: 13px;
  background: #fff;
}

.db-fact__key {
  color: var(--db-text-weak);
  flex: none;
}

.db-fact__value {
  color: var(--db-text);
  text-align: right;
  word-break: break-all;
  font-variant-numeric: tabular-nums;
}

/* ---------- 阻断提示 ---------- */

.db-blocked {
  text-align: center;
  padding: 14px 0 4px;
}

.db-blocked svg {
  width: 40px;
  height: 40px;
  margin-bottom: 14px;
}

.db-blocked__text {
  margin: 0;
  font-size: 14px;
  line-height: 1.7;
  color: var(--db-text-weak);
}

/* ---------- 条款确认 ---------- */

.db-gate {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--db-line);
}

.db-gate[hidden] {
  display: none !important;
}

.db-gate__text {
  margin: 0 0 16px;
  padding: 14px 15px;
  font-size: 13px;
  line-height: 1.75;
  color: var(--db-text);
  background: #f7f9fc;
  border-radius: 11px;
}

.db-gate__actions {
  display: flex;
  gap: 10px;
}

.db-gate__actions .db-btn {
  flex: 1;
}

/* ---------- 浮层与提示 ---------- */

.db-lock {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(20, 30, 48, 0.55);
}

.db-lock[hidden] {
  display: none !important;
}

.db-lock__box {
  width: 100%;
  max-width: 320px;
  padding: 26px 22px;
  text-align: center;
  background: #fff;
  border-radius: var(--db-radius);
}

.db-lock__box svg {
  width: 34px;
  height: 34px;
  margin-bottom: 14px;
}

.db-lock__text {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.7;
}

.db-toast {
  position: fixed;
  left: 50%;
  bottom: 36px;
  z-index: 950;
  max-width: 88vw;
  padding: 12px 18px;
  font-size: 13px;
  color: #fff;
  background: rgba(27, 35, 48, 0.92);
  border-radius: 10px;
  transform: translate(-50%, 12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}

.db-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.db-toast.is-ok {
  background: rgba(23, 148, 95, 0.95);
}

.db-toast.is-warn {
  background: rgba(200, 121, 26, 0.95);
}

.db-toast.is-error {
  background: rgba(201, 58, 58, 0.95);
}

/* ---------- 页脚 ---------- */

.db-foot {
  margin-top: 22px;
  text-align: center;
  font-size: 12px;
  color: var(--db-text-weak);
  line-height: 1.8;
}

@media (max-width: 420px) {
  .db-card {
    padding: 22px 18px;
  }

  .db-expire__value {
    font-size: 21px;
  }
}
