* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: #1aad19;
  --danger-color: #e64340;
  --text-color: #333;
  --text-light: #999;
  --border-color: #e5e5e5;
  --bg-color: #f5f5f5;
  --card-bg: #fff;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 750px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  position: relative;
}

/* 购买记录按钮 */
.btn-history {
  position: fixed;
  top: 20px;
  right: 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 20px;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
  z-index: 1000;
  transition: all 0.3s;
}

.btn-history:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(102, 126, 234, 0.5);
}

.btn-history:active {
  transform: translateY(0);
}

.btn-history span:first-child {
  font-size: 18px;
}

/* 主内容 */
.content {
  flex: 1;
  padding: 20px;
}

.purchase-page {
  animation: fadeIn 0.3s;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-title {
  font-size: 20px;
  margin-bottom: 20px;
  color: var(--text-color);
  text-align: center;
}

/* 表单行 - 一行显示 */
.form-row {
  display: flex;
  gap: 15px;
  margin-bottom: 20px;
}

.form-row .form-group {
  flex: 1;
  margin-bottom: 0;
}

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

.form-label {
  display: block;
  font-size: 14px;
  color: var(--text-color);
  margin-bottom: 10px;
  font-weight: bold;
}

.select-box {
  background: var(--card-bg);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  padding: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: all 0.3s;
}

.select-box:hover {
  border-color: var(--primary-color);
}

.select-box span:first-child {
  flex: 1;
  color: var(--text-color);
}

.arrow {
  color: var(--text-light);
  font-size: 12px;
}

/* 价格徽章 - 右下角固定 */
.price-badge {
  position: fixed;
  bottom: 90px;
  right: 20px;
  background: #fff;
  border: 2px solid #ff4444;
  border-radius: 12px;
  padding: 12px 20px;
  box-shadow: 0 4px 12px rgba(255, 68, 68, 0.3);
  z-index: 100;
  animation: pulse 2s infinite;
}

.price-value {
  color: #ff4444;
  font-size: 28px;
  font-weight: bold;
  line-height: 1;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

/* 功能描述 */
.features-section {
  background: var(--bg-color);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 80px;
}

.features-title {
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 15px;
  color: var(--text-color);
  padding-bottom: 10px;
  border-bottom: 2px solid var(--primary-color);
}

.features-content {
  color: var(--text-color);
  line-height: 1.8;
  font-size: 14px;
  white-space: pre-line;
}



/* 卡密页面 */
.card-page {
  animation: fadeIn 0.3s;
}

.success-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--primary-color);
  color: white;
  font-size: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.card-info {
  background: var(--bg-color);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}

.card-item {
  margin-bottom: 20px;
}

.card-item:last-child {
  margin-bottom: 0;
}

.card-item label {
  display: block;
  font-size: 14px;
  color: var(--text-light);
  margin-bottom: 8px;
}

.card-key {
  background: white;
  border: 2px dashed var(--primary-color);
  border-radius: 8px;
  padding: 15px;
  font-size: 18px;
  font-weight: bold;
  text-align: center;
  color: var(--primary-color);
  word-break: break-all;
  margin-bottom: 10px;
}

.card-item div:not(.card-key) {
  font-size: 16px;
  color: var(--text-color);
}

.tips {
  background: #fff3cd;
  border-left: 4px solid #ffc107;
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 20px;
}

.tips p {
  font-size: 14px;
  margin-bottom: 5px;
}

.tips p:last-child {
  margin-bottom: 0;
}

/* 按钮 */
.btn {
  width: 100%;
  padding: 15px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s;
  margin-bottom: 10px;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background: #179b16;
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.btn-back {
  background: var(--bg-color);
  color: var(--text-color);
}

.btn-copy {
  background: var(--primary-color);
  color: white;
  padding: 10px;
}

.btn-secondary {
  background: #6c757d;
  color: white;
  padding: 12px 40px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-secondary:hover {
  background: #5a6268;
}

/* 底部 */
.footer {
  text-align: center;
  padding: 20px;
  color: var(--text-light);
  font-size: 12px;
  border-top: 1px solid var(--border-color);
}

/* 加载提示 */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-light);
}

.loading-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.loading-overlay.show {
  display: flex;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.loading-overlay p {
  color: white;
  margin-top: 15px;
  font-size: 16px;
}

/* Toast */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 15px 25px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 10000;
  display: none;
}

.toast.show {
  display: block;
  animation: toastFade 2s;
}

@keyframes toastFade {
  0%, 100% { opacity: 0; }
  10%, 90% { opacity: 1; }
}

/* 弹窗 */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9998;
  align-items: flex-end;
  justify-content: center;
}

.modal.show {
  display: flex;
  animation: fadeIn 0.3s;
}

.modal-content {
  background: white;
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 750px;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.3s;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
  font-size: 18px;
  color: var(--text-color);
}

.close {
  font-size: 28px;
  color: var(--text-light);
  cursor: pointer;
  line-height: 1;
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}

.modal-footer {
  padding: 15px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: center;
}

.modal-item {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background 0.2s;
}

.modal-item:hover {
  background: var(--bg-color);
}

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

/* 简化的产品选择项 - 只显示名字 */
.simple-item {
  justify-content: center;
  padding: 18px 15px;
}

.simple-item .modal-item-name {
  font-size: 16px;
  font-weight: bold;
  text-align: center;
  margin: 0;
}

.modal-item-icon {
  width: 50px;
  height: 50px;
  border-radius: 10px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.modal-item-content {
  flex: 1;
}

.modal-item-name {
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 5px;
}

.modal-item-desc {
  font-size: 13px;
  color: var(--text-light);
}

.version-item {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.version-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.version-item-name {
  font-size: 16px;
  font-weight: bold;
}

.version-item-price {
  font-size: 20px;
  color: var(--danger-color);
  font-weight: bold;
}

.version-item-duration {
  font-size: 13px;
  color: var(--text-light);
}




/* 购买记录弹窗 */
.history-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s;
}

.history-modal {
  background: white;
  border-radius: 12px;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.history-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.history-header h3 {
  margin: 0;
  font-size: 18px;
  color: var(--text-color);
}

.history-header .close {
  font-size: 28px;
  color: var(--text-light);
  cursor: pointer;
  line-height: 1;
}

.history-list {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
}

.history-item {
  background: var(--bg-color);
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 15px;
}

.history-item:last-child {
  margin-bottom: 0;
}

.history-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

.product-name {
  font-size: 16px;
  font-weight: bold;
  color: var(--text-color);
}

.order-status {
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
}

.status-paid {
  background: #d4edda;
  color: #155724;
}

.status-unpaid {
  background: #f8d7da;
  color: #721c24;
}

.history-item-body {
  font-size: 14px;
  color: var(--text-color);
  line-height: 1.8;
}

.history-item-body > div {
  padding: 3px 0;
}

.card-key-display {
  background: #fff3cd;
  padding: 8px 12px;
  border-radius: 6px;
  margin-top: 8px;
  font-family: monospace;
  color: #856404;
  word-break: break-all;
}