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

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

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: #1e293b;
  background: #f3f6fa;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
  overflow-x: hidden;
}

body.page-home {
  background: linear-gradient(180deg, #d7e5fb 0%, #e8effb 380px, #f3f6fa 760px);
}

.page {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px 48px;
}

/* ── Promo Banner ─ */

.promo-banner {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  padding: 24px 24px 26px;
  margin: 16px 0 14px;
  background: linear-gradient(115deg, #3e7bff 0%, #4f6cff 48%, #7b5cfa 100%);
  color: #fff;
  box-shadow: 0 12px 32px rgba(62, 105, 255, 0.28);
}

.promo-banner::before {
  content: "";
  position: absolute;
  top: -80px;
  left: 28%;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(122, 220, 255, 0.35) 0%, rgba(122, 220, 255, 0) 70%);
  pointer-events: none;
}

.promo-glow {
  position: absolute;
  bottom: -100px;
  left: -50px;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0) 70%);
  pointer-events: none;
}

.promo-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 14px 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  background: linear-gradient(135deg, #8a5cff, #5b3df2);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 2px 10px rgba(43, 28, 140, 0.35);
  margin-bottom: 10px;
}

.promo-badge svg {
  width: 14px;
  height: 14px;
  color: #ffd54d;
}

.promo-title {
  position: relative;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.15;
  margin-bottom: 6px;
}

.promo-title em {
  font-style: normal;
  color: #ffd54d;
  margin-left: 2px;
}

.promo-sub {
  position: relative;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.85);
}

.promo-robot {
  position: absolute;
  right: 4px;
  bottom: -4px;
  width: 168px;
  height: auto;
  pointer-events: none;
}

/* ── Quick Tools ─ */

.quick-tools {
  display: flex;
  gap: 10px;
  padding: 10px;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 2px 10px rgba(30, 60, 120, 0.06);
  margin-bottom: 10px;
}

.tool-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: 12px 6px;
  border-radius: 14px;
  text-decoration: none;
  min-width: 0;
  transition: transform 0.15s;
}

.tool-item:active {
  transform: scale(0.97);
}

.tool-blue { background: #edf3ff; }
.tool-green { background: #e7f7ef; }
.tool-purple { background: #f2edff; }

.tool-icon {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  color: #fff;
  box-shadow: 0 4px 10px rgba(30, 60, 120, 0.18);
}

.tool-blue .tool-icon { background: linear-gradient(135deg, #4a90ff, #2f6bff); }
.tool-green .tool-icon { background: linear-gradient(135deg, #1cc08d, #0da371); }
.tool-purple .tool-icon { background: linear-gradient(135deg, #9a6cf9, #7a48f2); }

.tool-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}

.tool-label {
  font-size: 14px;
  font-weight: 700;
  color: #243044;
  line-height: 1.3;
}

.tool-sub {
  font-size: 10px;
  color: #8a94a6;
  line-height: 1.4;
}

.tool-chevron {
  display: none;
  margin-left: auto;
  flex: none;
  color: #b7c1d0;
}

/* ── Vendor Section ─ */

.model-list {
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.vendor-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 4px 4px 0;
  margin-bottom: 14px;
}

.vendor-spark {
  flex: none;
  display: flex;
  margin-top: 3px;
}

.vendor-head-text {
  min-width: 0;
}

.vendor-name {
  font-size: 22px;
  font-weight: 800;
  color: #17233b;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.vendor-sub {
  font-size: 13px;
  color: #8a94a6;
  margin-top: 2px;
}

.vendor-more {
  margin-left: auto;
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding-top: 6px;
  font-size: 13px;
  font-weight: 500;
  color: #5b7ba6;
  text-decoration: none;
}

.vendor-more svg {
  width: 13px;
  height: 13px;
}

.cards-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ── Model Cards ─ */

.model-card {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  padding: 16px;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  box-shadow: 0 2px 10px rgba(30, 60, 120, 0.05);
}

.model-card.theme-blue {
  --c1: #4a90ff;
  --c2: #2f6bff;
  --card-bg: #f4f8ff;
  --card-border: #a7c6ff;
  --panel: #eaf1ff;
  --panel-line: #d5e2fb;
  --price: #2f6bdd;
}

.model-card.theme-green {
  --c1: #1cc08d;
  --c2: #0da371;
  --card-bg: #f0fbf6;
  --card-border: #bfe8d5;
  --panel: #e6f7ee;
  --panel-line: #cdeeda;
  --price: #0f9d6e;
}

.model-card.theme-purple {
  --c1: #9a6cf9;
  --c2: #7a48f2;
  --card-bg: #f7f4ff;
  --card-border: #ddcdfb;
  --panel: #f1ecff;
  --panel-line: #e0d5fa;
  --price: #7a4fe0;
}

.model-card.theme-violet {
  --c1: #b18cfa;
  --c2: #9268f7;
  --card-bg: #f9f7ff;
  --card-border: #e4dafc;
  --panel: #f3efff;
  --panel-line: #e6defb;
  --price: #8b5cf6;
}

.model-card.theme-teal {
  --c1: #18b3c4;
  --c2: #0a93a8;
  --card-bg: #effafb;
  --card-border: #bce4e9;
  --panel: #e6f6f8;
  --panel-line: #cfebee;
  --price: #0a93a8;
}

.model-card.is-highlighted {
  border-color: #7fb0ff;
  box-shadow: 0 8px 26px rgba(64, 109, 255, 0.16);
}

.card-corner {
  position: absolute;
  top: 0;
  right: 0;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  background: linear-gradient(135deg, #63a2ff, #2f6bff);
  clip-path: polygon(0 0, 100% 0, 100% 100%);
}

.card-corner svg {
  width: 15px;
  height: 15px;
  color: #fff;
  margin: 6px 6px 0 0;
  transform: rotate(45deg);
}

.card-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.card-icon {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--c1), var(--c2));
  box-shadow: 0 6px 16px rgba(30, 60, 120, 0.18);
}

.card-title-row {
  flex: 1 1 160px;
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 4px;
}

.card-model-name {
  font-size: 20px;
  font-weight: 800;
  color: #17233b;
  letter-spacing: -0.01em;
}

.badge-new {
  padding: 3px 10px;
  border-radius: 9px;
  background: linear-gradient(135deg, #4a90ff, #2f6bff);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
}

.badge-cache {
  padding: 3px 10px;
  border-radius: 9px;
  background: #d8f4e4;
  color: #0ba36a;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
}

.price-panel {
  flex: 1 1 230px;
  display: flex;
  border-radius: 14px;
  background: var(--panel);
  padding: 10px 4px;
}

.price-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 2px 12px;
  min-width: 0;
}

.price-col + .price-col {
  border-left: 1px solid var(--panel-line);
}

.price-col-label {
  font-size: 12px;
  color: #8a94a6;
  line-height: 1.4;
}

.price-col-value {
  display: flex;
  align-items: baseline;
  gap: 3px;
  min-width: 0;
}

.price-col-value b {
  font-size: 20px;
  font-weight: 800;
  color: var(--price);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.price-col-value i {
  font-style: normal;
  font-size: 11px;
  color: #8a94a6;
  white-space: nowrap;
}

.price-col.is-muted .price-col-value b {
  font-size: 15px;
  font-weight: 600;
  color: #b3bdcb;
}

.card-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.card-desc {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: #7c8798;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.buy-btn {
  font: inherit;
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--c1), var(--c2));
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(30, 60, 120, 0.18);
  transition: transform 0.15s, box-shadow 0.15s;
}

.buy-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(30, 60, 120, 0.24);
}

.buy-btn svg {
  width: 14px;
  height: 14px;
}

.card-tier {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--panel-line);
}

.card-tier-context {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: #7c8798;
}

/* ── Status ─ */

.status-msg {
  text-align: center;
  padding: 48px 20px;
  color: #94a3b8;
  font-size: 14px;
  display: none;
}

.status-msg.visible {
  display: block;
}

.status-msg.error {
  color: #ef4444;
}

/* ── Loading Animation ─ */

.loading-dots {
  display: inline-flex;
  gap: 4px;
  padding: 48px 0;
}

.loading-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #94a3b8;
  animation: bounce 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* ── Footer  */

.footer {
  margin-top: 32px;
  text-align: center;
  font-size: 12px;
  color: #94a3b8;
}

.footer a {
  color: #94a3b8;
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

/* ── Pay amount modal (WeChat 内不支持 window.prompt) ─ */

.pay-modal.hidden {
  display: none;
}

.pay-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.pay-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.pay-modal-panel {
  position: relative;
  width: 100%;
  max-width: 340px;
  background: #fff;
  border-radius: 14px;
  padding: 20px 18px 16px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.18);
}

.pay-modal-title {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 600;
  color: #0f172a;
}

.pay-modal-desc {
  margin: 0 0 14px;
  font-size: 13px;
  color: #64748b;
}

.pay-channel-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 12px 0 14px;
}

.pay-channel-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #fff;
  font-size: 14px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
}

.pay-channel-btn.active {
  border-color: #2563eb;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(8, 145, 178, 0.08));
  color: #1d4ed8;
}

.pay-channel-name {
  text-align: left;
}

.pay-channel-radio {
  position: relative;
  flex: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #cbd5e1;
  background: #fff;
  transition: border-color 0.15s ease;
}

.pay-channel-radio::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #2563eb;
  transform: translate(-50%, -50%) scale(0);
  transition: transform 0.15s ease;
}

.pay-channel-btn.active .pay-channel-radio {
  border-color: #2563eb;
}

.pay-channel-btn.active .pay-channel-radio::after {
  transform: translate(-50%, -50%) scale(1);
}

.pay-modal-link {
  margin: 0 0 4px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f1f5f9;
  font-size: 12px;
  color: #334155;
  word-break: break-all;
  line-height: 1.5;
}

.pay-modal-desc-block {
  line-height: 1.55;
  margin-bottom: 18px;
}

.pay-modal-btn-full {
  flex: none;
  width: 100%;
}

.pay-modal-input {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: 16px;
  outline: none;
}

.pay-modal-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.apikey-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
}

.apikey-row .pay-modal-input {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  word-break: break-all;
}

.apikey-row .pay-modal-btn {
  flex: none;
  padding: 12px 16px;
}

.pay-modal-error {
  min-height: 18px;
  margin: 8px 0 0;
  font-size: 12px;
  color: #ef4444;
}

.pay-modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.pay-modal-btn {
  flex: 1;
  padding: 11px 12px;
  border-radius: 10px;
  border: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.pay-modal-btn-muted {
  background: #f1f5f9;
  color: #475569;
}

.pay-modal-btn-primary {
  background: linear-gradient(135deg, #2563eb, #0891b2);
  color: #fff;
}

/* ── Responsive ─ */

@media (max-width: 640px) {
  .promo-title {
    font-size: 24px;
  }
  .promo-robot {
    width: 122px;
    right: 0;
  }
  .vendor-name {
    font-size: 19px;
  }
  .card-model-name {
    font-size: 18px;
  }
  .card-desc {
    -webkit-line-clamp: 2;
  }
}

@media (min-width: 640px) {
  .tool-item {
    flex-direction: row;
    align-items: center;
    text-align: left;
    gap: 10px;
    padding: 12px;
  }
  .tool-text {
    align-items: flex-start;
  }
  .tool-sub {
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .tool-chevron {
    display: block;
  }
}

@media (min-width: 769px) {
  .promo-banner {
    padding: 30px 32px;
  }
  .promo-title {
    font-size: 34px;
  }
  .promo-sub {
    font-size: 14px;
  }
  .promo-robot {
    width: 196px;
  }
}

/* ── Safe area for iPhone ─ */

@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .page {
    padding-bottom: calc(48px + env(safe-area-inset-bottom));
  }
}
