/* ====== CSS 变量 ====== */
:root {
  --red: #ff2442;
  --red-light: #fff0f3;
  --text: #1a1a1a;
  --text-secondary: #666;
  --text-muted: #999;
  --bg: #ffffff;
  --bg-secondary: #f8f8f8;
  --border: #eee;
  --shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
  --radius: 12px;
  --radius-sm: 8px;
  --max-width: 480px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
}

/* ====== 基础重置 ====== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg-secondary);
  line-height: 1.6;
  min-height: 100vh;
}

/* ====== 主容器（手机卡片式，桌面居中） ====== */
.app-container {
  max-width: var(--max-width);
  margin: 0 auto;
  background: var(--bg);
  min-height: 100vh;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

/* ====== 广告位 ====== */
.ad-slot {
  padding: 8px 16px;
  transition: all 0.3s ease;
}

.ad-slot--top {
  background: var(--bg-secondary);
}

.ad-slot--bottom {
  background: var(--bg-secondary);
  margin-top: auto;
}

.ad-placeholder {
  background: #fafafa;
  border: 1px dashed #ddd;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  text-align: center;
  color: var(--text-muted);
}

.ad-placeholder .ad-label {
  display: inline-block;
  font-size: 0.65rem;
  color: #ccc;
  border: 1px solid #eee;
  padding: 1px 6px;
  border-radius: 3px;
  margin-bottom: 4px;
}

.ad-placeholder p {
  font-size: 0.85rem;
  color: #aaa;
}

.ad-placeholder small {
  font-size: 0.7rem;
  color: #ccc;
}

.ad-hidden {
  display: none !important;
}

/* ====== 主内容区 ====== */
.main-content {
  flex: 1;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ====== 头部品牌区 ====== */
.brand {
  text-align: center;
  padding-top: 12px;
}

.brand-icon {
  font-size: 2rem;
  margin-bottom: 4px;
}

.brand h1 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.5px;
}

.brand-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ====== 输入区域 ====== */
.input-area {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.input-wrapper {
  position: relative;
}

.input-wrapper input {
  width: 100%;
  padding: 14px 16px;
  font-size: 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.2s;
  font-family: var(--font);
}

.input-wrapper input:focus {
  border-color: var(--red);
}

.input-wrapper input::placeholder {
  color: #ccc;
}

.char-count {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.7rem;
  color: var(--text-muted);
  pointer-events: none;
}

.btn-generate {
  width: 100%;
  padding: 14px;
  font-size: 1.05rem;
  font-weight: 600;
  color: #fff;
  background: var(--red);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  font-family: var(--font);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-generate:active {
  transform: scale(0.98);
}

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

/* ====== 加载 spinner ====== */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* ====== 用户状态栏 ====== */
.user-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 0.85rem;
}

.status-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.vip-badge {
  display: inline-block;
  background: linear-gradient(135deg, #ffd700, #ffb400);
  color: #7c5e00;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.guest-badge {
  display: inline-block;
  background: #f0f0f0;
  color: var(--text-secondary);
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 4px;
}

.count-text {
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.count-text .count-num {
  font-weight: 700;
  color: var(--red);
}

.btn-upgrade {
  background: none;
  border: 1px solid var(--red);
  color: var(--red);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font);
  white-space: nowrap;
}

.btn-upgrade:hover {
  background: var(--red-light);
}

.btn-login {
  background: var(--red);
  border: none;
  color: #fff;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  cursor: pointer;
  font-family: var(--font);
  margin-left: 6px;
}

.btn-logout {
  background: none;
  border: 1px solid #ddd;
  color: var(--text-secondary);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  cursor: pointer;
  font-family: var(--font);
}

/* ====== 结果区域 ====== */
.result-section {
  display: none;
}

.result-section.visible {
  display: block;
}

.result-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.result-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.5;
}

.result-title-label {
  font-size: 0.7rem;
  color: var(--red);
  font-weight: 600;
  margin-bottom: 4px;
}

.result-body {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.8;
  white-space: pre-line;
}

.result-body-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.result-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.result-tag {
  font-size: 0.78rem;
  color: var(--red);
  background: var(--red-light);
  padding: 4px 12px;
  border-radius: 20px;
}

/* ====== 复制按钮 ====== */
.copy-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.btn-copy {
  flex: 1;
  padding: 10px;
  font-size: 0.85rem;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

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

.btn-copy.copied {
  background: #e8f5e9;
  border-color: #4caf50;
  color: #2e7d32;
}

/* ====== Toast ====== */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #333;
  color: #fff;
  padding: 10px 24px;
  border-radius: 20px;
  font-size: 0.85rem;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
  z-index: 1000;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.success {
  background: #4caf50;
}

/* ====== 底部状态栏 ====== */
.footer-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.footer-bar a {
  color: var(--text-muted);
  text-decoration: none;
}

.footer-bar a:hover {
  color: var(--red);
}

/* ====== VIP 说明页 ====== */
.vip-container {
  max-width: var(--max-width);
  margin: 0 auto;
  background: var(--bg);
  min-height: 100vh;
  padding: 40px 24px;
}

.vip-header {
  text-align: center;
  margin-bottom: 32px;
}

.vip-header .crown {
  font-size: 3rem;
}

.vip-header h1 {
  font-size: 1.5rem;
  margin-top: 8px;
}

.vip-header p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 4px;
}

.vip-benefits {
  background: var(--red-light);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}

.vip-benefits h3 {
  font-size: 1rem;
  color: var(--red);
  margin-bottom: 16px;
}

.vip-benefits ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.vip-benefits li {
  font-size: 0.9rem;
  padding-left: 20px;
  position: relative;
}

.vip-benefits li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--red);
  font-weight: 700;
}

.payment-info {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
}

.payment-info h3 {
  font-size: 1rem;
  margin-bottom: 8px;
}

.payment-info .price {
  font-size: 2rem;
  font-weight: 700;
  color: var(--red);
  margin: 12px 0;
}

.payment-info .price span {
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--text-secondary);
}

.payment-methods {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.btn-back {
  display: block;
  text-align: center;
  margin-top: 24px;
  color: var(--red);
  text-decoration: none;
  font-size: 0.9rem;
}

.btn-back:hover {
  text-decoration: underline;
}

/* ====== 响应式 ====== */
@media (min-width: 768px) {
  body {
    padding: 40px 0;
  }

  .app-container {
    border-radius: var(--radius);
    min-height: auto;
  }

  .vip-container {
    border-radius: var(--radius);
    min-height: auto;
  }
}

@media (max-width: 380px) {
  .main-content {
    padding: 16px 14px;
    gap: 16px;
  }

  .brand h1 {
    font-size: 1.15rem;
  }

  .result-card {
    padding: 16px;
  }
}

/* ====== 登录/注册页 ====== */
.auth-container {
  max-width: var(--max-width);
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  width: 100%;
  background: var(--bg);
  border-radius: var(--radius);
  padding: 32px 24px;
  box-shadow: var(--shadow);
}

.auth-back {
  display: inline-block;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  margin-bottom: 16px;
}

.auth-back:hover {
  color: var(--red);
}

.auth-header {
  text-align: center;
  margin-bottom: 24px;
}

.auth-header h2 {
  font-size: 1.25rem;
  margin: 8px 0 4px;
}

.auth-header p {
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* Tab */
.auth-tabs {
  display: flex;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--border);
}

.auth-tab {
  flex: 1;
  padding: 10px;
  background: none;
  border: none;
  font-size: 0.9rem;
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}

.auth-tab.active {
  color: var(--red);
  border-bottom-color: var(--red);
  font-weight: 600;
}

.auth-form {
  display: none;
}

.auth-form.active {
  display: block;
}

/* 表单 */
.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 12px 14px;
  font-size: 0.95rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.2s;
  font-family: var(--font);
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--red);
}

.form-error {
  color: var(--red);
  font-size: 0.8rem;
  margin-bottom: 12px;
  display: none;
}

.form-error.show {
  display: block;
}

.auth-submit {
  width: 100%;
  padding: 13px;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: var(--red);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: opacity 0.2s;
}

.auth-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ====== 用户中心 ====== */
.dashboard-container {
  max-width: var(--max-width);
  margin: 0 auto;
  background: var(--bg);
  min-height: 100vh;
  padding: 24px 20px;
}

.dashboard-header {
  text-align: center;
  margin: 16px 0 24px;
}

.dashboard-header h2 {
  font-size: 1.25rem;
  margin: 4px 0;
}

.dashboard-header p {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.dash-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.dash-card h3 {
  font-size: 0.95rem;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.vip-status-badge {
  display: inline-block;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
}

.vip-status-badge.vip-active {
  background: linear-gradient(135deg, #ffd700, #ffb400);
  color: #7c5e00;
}

.vip-status-badge.vip-inactive {
  background: var(--bg-secondary);
  color: var(--text-secondary);
}

.btn-upgrade-dash {
  display: inline-block;
  margin-top: 12px;
  background: var(--red);
  color: #fff;
  padding: 8px 20px;
  border-radius: 20px;
  text-decoration: none;
  font-size: 0.85rem;
}

/* 订单列表 */
.order-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.order-item:last-child {
  border-bottom: none;
}

.order-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.order-id {
  font-weight: 600;
  font-size: 0.85rem;
}

.order-status {
  font-size: 0.7rem;
  padding: 2px 10px;
  border-radius: 12px;
  font-weight: 600;
}

.order-pending {
  background: #fff3cd;
  color: #856404;
}

.order-confirmed {
  background: #e8f5e9;
  color: #2e7d32;
}

.order-rejected {
  background: #ffebee;
  color: #c62828;
}

.order-detail {
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
}

/* ====== 管理后台 ====== */
.admin-container {
  max-width: 600px;
  margin: 0 auto;
  background: var(--bg);
  min-height: 100vh;
  padding: 24px 20px;
}

.admin-header {
  text-align: center;
  margin: 16px 0 20px;
}

.admin-header h2 {
  font-size: 1.25rem;
  margin: 4px 0;
}

.admin-header p {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.admin-tabs {
  display: flex;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--border);
}

.admin-tab {
  flex: 1;
  padding: 10px;
  background: none;
  border: none;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}

.admin-tab.active {
  color: var(--red);
  border-bottom-color: var(--red);
  font-weight: 600;
}

.admin-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 0;
}

.admin-order-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 12px;
}

.admin-order-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.admin-order-id {
  font-weight: 700;
}

.admin-order-status {
  font-size: 0.75rem;
  padding: 3px 12px;
  border-radius: 12px;
  font-weight: 600;
}

.status-pending {
  background: #fff3cd;
  color: #856404;
}

.status-confirmed {
  background: #e8f5e9;
  color: #2e7d32;
}

.status-rejected {
  background: #ffebee;
  color: #c62828;
}

.admin-order-info {
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

.admin-order-actions {
  display: flex;
  gap: 10px;
}

.btn-confirm {
  flex: 1;
  padding: 10px;
  background: #4caf50;
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  cursor: pointer;
  font-family: var(--font);
}

.btn-reject {
  flex: 1;
  padding: 10px;
  background: #fff;
  color: #c62828;
  border: 1px solid #c62828;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  cursor: pointer;
  font-family: var(--font);
}

/* ====== VIP 页新增：支付方式卡片 ====== */
.payment-methods {
  margin: 20px 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.payment-method {
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
}

.payment-method h4 {
  font-size: 0.9rem;
  margin-bottom: 12px;
}

.qr-code {
  width: 140px;
  height: 140px;
  margin: 0 auto;
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-code img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.qr-placeholder {
  background: #fafafa;
  border: 1px dashed #ddd;
  border-radius: var(--radius-sm);
  padding: 16px;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.qr-placeholder p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
}

.qr-placeholder small {
  font-size: 0.6rem;
  color: #ccc;
}

/* 订单表单 */
.order-form {
  margin-top: 24px;
  padding: 20px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  text-align: left;
}

.order-form h4 {
  font-size: 0.95rem;
  margin-bottom: 4px;
}

.order-form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.order-notice {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 16px;
}

.btn-submit-order {
  width: 100%;
  padding: 13px;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: var(--red);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: opacity 0.2s;
}

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

@media (max-width: 400px) {
  .payment-methods {
    grid-template-columns: 1fr;
  }
}

