/* ========================================================
   AI 订阅卡网 V1 · 统一商用视觉规范系统 (Design System)
   支持明暗模式即时切换、全设备响应式断点 (390px / 768px / 1440px)
   ======================================================== */

:root {
  /* 基础配色 (明亮主题 - 默认优雅金融风格) */
  --bg-primary: #f8fafc;
  --bg-surface: #ffffff;
  --bg-elevated: #f1f5f9;
  --bg-hover: #e2e8f0;
  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;
  --border-focus: #4f46e5;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  
  --accent-brand: #4f46e5;
  --accent-brand-hover: #4338ca;
  --accent-brand-light: #eef2ff;
  --accent-brand-text: #4338ca;

  --status-success: #10b981;
  --status-success-bg: #ecfdf5;
  --status-success-border: #a7f3d0;

  --status-warning: #f59e0b;
  --status-warning-bg: #fffbeb;
  --status-warning-border: #fde68a;

  --status-error: #ef4444;
  --status-error-bg: #fef2f2;
  --status-error-border: #fecaca;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.04);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

[data-theme="dark"] {
  /* 暗黑主题 (Linear 黑曜石质感) */
  --bg-primary: #0a0c10;
  --bg-surface: #12161f;
  --bg-elevated: #1a202c;
  --bg-hover: #242c3d;
  --border-subtle: #232b3b;
  --border-strong: #333f54;
  --border-focus: #6366f1;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-brand: #6366f1;
  --accent-brand-hover: #4f46e5;
  --accent-brand-light: #1e1b4b;
  --accent-brand-text: #a5b4fc;

  --status-success: #34d399;
  --status-success-bg: rgba(16, 185, 129, 0.15);
  --status-success-border: rgba(16, 185, 129, 0.3);

  --status-warning: #fbbf24;
  --status-warning-bg: rgba(245, 158, 11, 0.15);
  --status-warning-border: rgba(245, 158, 11, 0.3);

  --status-error: #f87171;
  --status-error-bg: rgba(239, 68, 68, 0.15);
  --status-error-border: rgba(239, 68, 68, 0.3);

  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.3);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4);
  --shadow-lg: 0 10px 20px -3px rgb(0 0 0 / 0.5);
}

/* 全局重置与排版 */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 原型环境状态标记条 (精致低饱和度灰色，避免抢占品牌主色 - C6) */
.prototype-banner {
  background: #1e293b;
  color: #f1f5f9;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  letter-spacing: 0.01em;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  position: sticky;
  top: 0;
  z-index: 1000;
}

[data-theme="light"] .prototype-banner {
  background: #f1f5f9;
  color: #334155;
  border-bottom: 1px solid #e2e8f0;
}

.prototype-banner .banner-text {
  display: flex;
  align-items: center;
  gap: 8px;
}

.prototype-banner .mock-quick-switch {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
}

.prototype-banner select {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-weight: 500;
  cursor: pointer;
}

/* 顶部通用导航栏 */
.navbar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 700;
  font-size: 17px;
}

.nav-brand-logo {
  font-size: 20px;
  background: var(--accent-brand-light);
  color: var(--accent-brand);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.15s ease;
}

.nav-link:hover, .nav-link.active {
  color: var(--accent-brand);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.theme-toggle-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 6px 10px;
  border-radius: var(--radius-full);
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}

.theme-toggle-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.mobile-sub-nav {
  display: none;
}

/* 主内容容器 */
.main-container {
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 20px;
  flex: 1;
}

/* 卡片容器 */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

/* 按钮规范 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
}

.btn-primary {
  background: var(--accent-brand);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--accent-brand-hover);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.btn-secondary {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--bg-hover);
}

.btn-block {
  width: 100%;
}

.btn:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

/* 徽章 Badge */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-full);
}

.badge-brand {
  background: var(--accent-brand-light);
  color: var(--accent-brand-text);
}

.badge-success {
  background: var(--status-success-bg);
  color: var(--status-success);
  border: 1px solid var(--status-success-border);
}

.badge-warning {
  background: var(--status-warning-bg);
  color: var(--status-warning);
  border: 1px solid var(--status-warning-border);
}

.badge-error {
  background: var(--status-error-bg);
  color: var(--status-error);
  border: 1px solid var(--status-error-border);
}

/* 表单输入控件 */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.form-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
  background: var(--bg-surface);
}

.form-control.mono {
  font-family: var(--font-mono);
  letter-spacing: 0.03em;
}

/* 状态提示 Banner */
.alert {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  line-height: 1.5;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
}

.alert-info {
  background: var(--accent-brand-light);
  border: 1px solid rgba(79, 70, 229, 0.2);
  color: var(--accent-brand-text);
}

.alert-success {
  background: var(--status-success-bg);
  border: 1px solid var(--status-success-border);
  color: var(--status-success);
}

.alert-warning {
  background: var(--status-warning-bg);
  border: 1px solid var(--status-warning-border);
  color: #b45309;
}

.alert-error {
  background: var(--status-error-bg);
  border: 1px solid var(--status-error-border);
  color: var(--status-error);
}

/* 首页 Hero 区域 */
.hero-section {
  text-align: center;
  padding: 40px 10px 30px;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-brand-light);
  color: var(--accent-brand-text);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  margin-bottom: 14px;
}

.hero-title {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}

.hero-subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 28px;
}

/* 商品卡片 (V1 单品聚焦) */
.product-card-wrap {
  max-width: 680px;
  margin: 0 auto;
}

.product-pricing-card {
  border: 2px solid var(--accent-brand);
  position: relative;
  overflow: hidden;
}

.product-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 16px;
}

.product-price-block {
  text-align: right;
}

.price-currency {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent-brand);
}

.price-num {
  font-size: 36px;
  font-weight: 800;
  color: var(--accent-brand);
}

.price-orig {
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: line-through;
  display: block;
}

.feature-list {
  list-style: none;
  margin: 20px 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.feature-icon {
  color: var(--status-success);
  font-weight: bold;
}

.terms-box {
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  padding: 14px;
  font-size: 12px;
  color: var(--text-secondary);
  margin: 18px 0;
  line-height: 1.6;
}

/* 按钮组 */
.action-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 12px;
}

/* 支付方式选择器 (A8: 无障碍单选) */
.payment-methods-fieldset {
  border: none;
  padding: 0;
  margin: 0 0 20px;
}

.payment-methods-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.payment-method-label {
  display: block;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 14px;
  text-align: center;
  cursor: pointer;
  background: var(--bg-surface);
  transition: all 0.15s ease;
  position: relative;
}

.payment-method-label input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.payment-method-label:has(input[type="radio"]:checked),
.payment-method-label.active {
  border-color: var(--accent-brand);
  background: var(--accent-brand-light);
  box-shadow: 0 0 0 2px var(--accent-brand);
}

.payment-method-label:has(input[type="radio"]:focus-visible) {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

.payment-method-icon {
  font-size: 22px;
  margin-bottom: 6px;
  display: block;
}

.payment-method-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

/* 模拟二维码弹窗/卡片 */
.qr-container {
  background: var(--bg-elevated);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  margin: 20px 0;
}

.qr-mock-box {
  width: 180px;
  height: 180px;
  background: #ffffff;
  margin: 0 auto 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-subtle);
  color: #0f172a;
}

/* 订单与卡密安全凭证卡片 */
.secure-credential-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 16px;
  margin: 16px 0;
}

.credential-code {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  color: var(--accent-brand);
  letter-spacing: 0.05em;
  background: var(--bg-surface);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* 订单时间线 / 状态管道 */
.status-pipeline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  margin: 24px 0 32px;
}

.pipeline-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 2;
  flex: 1;
}

.pipeline-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 2px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.pipeline-step.active .pipeline-dot {
  background: var(--accent-brand);
  border-color: var(--accent-brand);
  color: #fff;
}

.pipeline-step.success .pipeline-dot {
  background: var(--status-success);
  border-color: var(--status-success);
  color: #fff;
}

.pipeline-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.pipeline-line {
  position: absolute;
  top: 14px;
  left: 10%;
  right: 10%;
  height: 2px;
  background: var(--border-subtle);
  z-index: 1;
}

/* 底部通用栏 */
.footer {
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  padding: 24px 20px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

/* 表格规范 (后台管理) */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.data-table th {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-weight: 600;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.data-table tr:hover td {
  background: var(--bg-hover);
}

/* ========================================================
   响应式断点适配规则
   ======================================================== */

/* 平板端 (小于 768px) */
@media (max-width: 768px) {
  .hero-title {
    font-size: 26px;
  }
  .feature-list {
    grid-template-columns: 1fr;
  }
  .action-grid {
    grid-template-columns: 1fr;
  }
  .payment-methods-grid {
    grid-template-columns: 1fr;
  }
  .nav-links {
    display: none;
  }
  .mobile-sub-nav {
    display: flex;
    overflow-x: auto;
    gap: 12px;
    padding: 8px 16px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    font-size: 13px;
    white-space: nowrap;
  }
  .mobile-sub-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
  }
  .mobile-sub-nav a.active {
    color: var(--accent-brand);
    font-weight: 700;
  }
}

/* 手机端 (小于 480px / 390px 目标视口) */
@media (max-width: 480px) {
  .prototype-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 8px 12px;
  }
  .prototype-banner .mock-quick-switch {
    width: 100%;
    justify-content: space-between;
  }
  .mobile-sub-nav {
    display: flex;
    overflow-x: auto;
    gap: 12px;
    padding: 8px 12px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    font-size: 13px;
    white-space: nowrap;
  }
  .mobile-sub-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
  }
  .mobile-sub-nav a.active {
    color: var(--accent-brand);
    font-weight: 700;
  }
  .navbar {
    padding: 10px 14px;
  }
  .nav-brand {
    font-size: 15px;
  }
  .hero-section {
    padding: 16px 8px 14px;
  }
  .hero-title {
    font-size: 22px;
    margin-bottom: 8px;
  }
  .hero-subtitle {
    font-size: 13px;
    margin-bottom: 16px;
  }
  .main-container {
    padding: 14px 12px;
  }
  .card {
    padding: 16px;
  }
  .product-header {
    flex-direction: column;
    gap: 10px;
  }
  .product-price-block {
    text-align: left;
  }
  .price-num {
    font-size: 30px;
  }
  .status-pipeline {
    gap: 4px;
  }
  .pipeline-label {
    font-size: 10px;
  }
}

/* Capability-controlled UI starts closed, including when scripts fail. */
[hidden] { display:none !important; }
[aria-disabled="true"] { opacity:.6; cursor:not-allowed; }
#channelNotice { margin-bottom:20px; overflow-wrap:anywhere; }

.manual-payment{margin:20px auto;max-width:640px;line-height:1.6}.manual-payment h2{font-size:20px}.manual-payment form{display:grid;gap:14px;margin:18px 0}.manual-payment label{display:grid;gap:6px;font-size:14px}.manual-payment #manualMessage{color:var(--text-secondary);margin:12px 0}.manual-payment a{color:var(--accent-brand)}

.badge-neutral{background:var(--bg-elevated);color:var(--text-secondary);border:1px solid var(--border-subtle)}

/* Turnstile: compact, keyboard-accessible challenge dialog. */
.store-security-challenge { width:min(360px,calc(100vw - 32px)); max-height:calc(100dvh - 32px); margin:auto; box-sizing:border-box; padding:20px; border:1px solid var(--border-subtle,#cbd5e1); border-radius:16px; background:var(--bg-surface,#fff); color:var(--text-primary,#152238); }
.store-security-challenge::backdrop { background:rgba(15,23,42,.45); }
.store-security-challenge h3 { margin:0 0 12px; }
.store-security-challenge p { line-height:1.6; margin:0 0 16px; }
.store-security-challenge button { margin-top:16px; }
