/* ============================================
   中秋集月饼H5 - 公共样式
   设计风格：中秋橙红+金色系
   ============================================ */

/* --- CSS变量定义 --- */
:root {
  --color-bg-darkest: #2d0000;
  --color-bg-dark: #4a0000;
  --color-bg-mid: #8b0000;
  --color-bg-light: #b22222;
  --color-gold-light: #ffe066;
  --color-gold-mid: #ffd700;
  --color-gold-dark: #d4a017;
  --color-red-accent: #f12711;
  --color-red-mid: #f5af19;
  --color-white: #ffffff;
  --color-gray-light: #cccccc;
  --color-gray-mid: #999999;
  --color-gray-dark: #666666;
  --color-card-border: #c0392b;
  --color-card-bg: rgba(139, 0, 0, 0.3);
  --color-card-shadow: rgba(0, 0, 0, 0.5);
  --color-moon-glow: rgba(255, 255, 240, 0.15);
  --color-moon-inner: #fffff0;
  --color-moon-outer: #fffacd;
  --color-osmanthus: #ffd700;
  --color-osmanthus-light: #ffed4a;
  --color-text-primary: #ffffff;
  --color-text-gold: #ffd700;
  --color-text-dark: #333333;
  --color-success: #4caf50;
  --color-warning: #ff9800;
  --gradient-bg: radial-gradient(ellipse at top, #8b0000 0%, #4a0000 50%, #2d0000 100%);
  --gradient-gold: linear-gradient(135deg, #f5af19, #f12711);
  --gradient-gold-reverse: linear-gradient(135deg, #f12711, #f5af19);
  --gradient-card: linear-gradient(145deg, rgba(178, 34, 34, 0.4), rgba(139, 0, 0, 0.6));
  --shadow-gold: 0 0 15px rgba(255, 215, 0, 0.5);
  --shadow-card: 0 4px 15px rgba(0, 0, 0, 0.4), inset 0 0 10px rgba(255, 215, 0, 0.1);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --font-title: 'STKaiti', 'KaiTi', 'SimSun', serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --header-height: 60px;
  --bottom-nav-height: 60px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

/* --- 全局重置 --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-body);
  background: var(--gradient-bg);
  color: var(--color-text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  position: relative;
  line-height: 1.6;
}

/* --- 自适应容器 --- */
.container {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  padding: 0 16px;
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
}

/* --- 月亮 --- */
.moon-wrapper {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px 0 10px;
}

.moon {
  position: relative;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fffff0, #fffacd 40%, #f0e68c 70%, #daa520 100%);
  box-shadow:
    0 0 20px rgba(255, 255, 240, 0.6),
    0 0 60px rgba(255, 255, 240, 0.3),
    0 0 100px rgba(255, 250, 205, 0.2),
    inset -5px -5px 15px rgba(218, 165, 32, 0.3);
  animation: moonPulse 4s ease-in-out infinite;
}

.moon::before {
  content: '';
  position: absolute;
  top: 15%;
  left: 55%;
  width: 20%;
  height: 20%;
  border-radius: 50%;
  background: rgba(218, 165, 32, 0.2);
  box-shadow:
    15px 20px 0 -3px rgba(218, 165, 32, 0.15),
    -5px 30px 0 2px rgba(218, 165, 32, 0.1);
}

.moon::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 130%;
  height: 130%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 240, 0.15) 0%, transparent 70%);
  pointer-events: none;
}

@keyframes moonPulse {
  0%, 100% { box-shadow: 0 0 20px rgba(255,255,240,0.6), 0 0 60px rgba(255,255,240,0.3), 0 0 100px rgba(255,250,205,0.2); }
  50% { box-shadow: 0 0 30px rgba(255,255,240,0.8), 0 0 80px rgba(255,255,240,0.4), 0 0 130px rgba(255,250,205,0.3); }
}

/* --- 月亮光晕层 --- */
.moon-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,240,0.15) 0%, rgba(255,250,205,0.08) 40%, transparent 70%);
  pointer-events: none;
  z-index: -1;
}

/* --- 中式边框卡片 --- */
.cn-card {
  position: relative;
  background: var(--gradient-card);
  border: 2px solid var(--color-card-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin: 16px 0;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  overflow: hidden;
}

.cn-card::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 3px;
  background: var(--gradient-gold);
  border-radius: 0 0 3px 3px;
}

.cn-card::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 40%;
  height: 3px;
  background: var(--gradient-gold);
  border-radius: 3px 3px 0 0;
}

/* 灯笼装饰 */
.cn-card-lantern {
  position: absolute;
  top: -12px;
  width: 24px;
  height: 30px;
}

.cn-card-lantern.left {
  left: 15%;
}

.cn-card-lantern.right {
  right: 15%;
}

.cn-card-lantern .lantern-body {
  width: 20px;
  height: 24px;
  margin: 0 auto;
  background: linear-gradient(180deg, #ff4500, #cc0000);
  border-radius: 50%;
  position: relative;
  box-shadow: 0 0 10px rgba(255, 69, 0, 0.5);
  animation: lanternSwing 3s ease-in-out infinite;
}

.cn-card-lantern .lantern-body::before {
  content: '';
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 10px;
  height: 5px;
  background: #ffd700;
  border-radius: 3px 3px 0 0;
}

.cn-card-lantern .lantern-body::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 8px;
  background: #ffd700;
}

.cn-card-lantern .lantern-string {
  width: 1px;
  height: 8px;
  background: #ffd700;
  margin: 0 auto;
}

@keyframes lanternSwing {
  0%, 100% { transform: rotate(-3deg); }
  50% { transform: rotate(3deg); }
}

/* --- 标题样式 --- */
.page-title {
  font-family: var(--font-title);
  font-size: 1.8rem;
  font-weight: bold;
  text-align: center;
  color: var(--color-text-gold);
  text-shadow: 0 2px 10px rgba(255, 215, 0, 0.5), 0 0 30px rgba(255, 215, 0, 0.2);
  margin: 10px 0;
  letter-spacing: 4px;
}

.section-title {
  font-family: var(--font-title);
  font-size: 1.3rem;
  color: var(--color-text-gold);
  text-align: center;
  margin: 12px 0 8px;
  text-shadow: 0 1px 5px rgba(255, 215, 0, 0.3);
}

/* --- 金色渐变按钮 --- */
.btn-gold {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 28px;
  border: none;
  border-radius: var(--radius-full);
  background: var(--gradient-gold);
  color: var(--color-white);
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 4px 15px rgba(245, 175, 25, 0.4), inset 0 -2px 5px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.btn-gold::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  transition: left 0.5s ease;
}

.btn-gold:active::before {
  left: 100%;
}

.btn-gold:active {
  transform: scale(0.95);
  box-shadow: 0 2px 8px rgba(245, 175, 25, 0.3);
}

.btn-gold:disabled {
  background: linear-gradient(135deg, #666666, #444444);
  box-shadow: none;
  color: #999999;
  cursor: not-allowed;
}

/* 次级按钮 */
.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 24px;
  border: 2px solid var(--color-gold-mid);
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--color-gold-mid);
  font-size: 0.95rem;
  font-weight: bold;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.3s ease;
}

.btn-outline:active {
  transform: scale(0.95);
  background: rgba(255, 215, 0, 0.1);
}

.btn-outline:disabled {
  border-color: #555555;
  color: #555555;
  cursor: not-allowed;
}

/* 购买按钮 */
.btn-buy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #ff6b6b, #ee0979);
  color: var(--color-white);
  font-size: 0.9rem;
  font-weight: bold;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 3px 12px rgba(238, 9, 121, 0.3);
  transition: all 0.3s ease;
  white-space: nowrap;
}

.btn-buy:active {
  transform: scale(0.95);
}

/* --- 进度条 --- */
.progress-wrapper {
  margin: 16px 0;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.9rem;
  color: var(--color-gold-light);
}

.progress-bar {
  width: 100%;
  height: 12px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: var(--radius-full);
  overflow: hidden;
  border: 1px solid rgba(255, 215, 0, 0.3);
  position: relative;
}

.progress-fill {
  height: 100%;
  background: var(--gradient-gold);
  border-radius: var(--radius-full);
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.4) 50%, transparent 100%);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* --- 底部导航 --- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 420px;
  height: calc(var(--bottom-nav-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: linear-gradient(180deg, rgba(60, 0, 0, 0.95), rgba(30, 0, 0, 0.98));
  border-top: 1px solid rgba(255, 215, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.bottom-nav .nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  height: 100%;
  text-decoration: none;
  color: var(--color-gray-mid);
  font-size: 0.7rem;
  padding: 8px 0;
  transition: color 0.3s ease;
  position: relative;
}

.bottom-nav .nav-item.active {
  color: var(--color-gold-mid);
}

.bottom-nav .nav-item .nav-icon {
  font-size: 1.4rem;
  margin-bottom: 2px;
  transition: transform 0.3s ease;
}

.bottom-nav .nav-item.active .nav-icon {
  transform: scale(1.1);
}

.bottom-nav .nav-item.active::after {
  content: '';
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 2px;
  background: var(--gradient-gold);
  border-radius: 2px;
}

/* --- Toast提示 --- */
.toast-container {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 9999;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.toast {
  background: rgba(0, 0, 0, 0.85);
  color: var(--color-white);
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  animation: toastIn 0.3s ease, toastOut 0.3s ease 1.7s forwards;
  max-width: 80%;
  text-align: center;
  border: 1px solid rgba(255, 215, 0, 0.3);
}

.toast.success {
  border-color: var(--color-success);
  color: #a5d6a7;
}

.toast.error {
  border-color: #f44336;
  color: #ef9a9a;
}

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

@keyframes toastOut {
  from { opacity: 1; }
  to { opacity: 0; transform: translateY(-20px); }
}

/* --- Loading --- */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  backdrop-filter: blur(5px);
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 3px solid rgba(255, 215, 0, 0.2);
  border-top-color: #ffd700;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* --- 空状态 --- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: var(--color-gray-mid);
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state .empty-text {
  font-size: 0.9rem;
}

/* --- 通用工具类 --- */
.text-center { text-align: center; }
.text-gold { color: var(--color-gold-mid); }
.text-red { color: #ff6b6b; }
.text-gray { color: var(--color-gray-mid); }
.mt-10 { margin-top: 10px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mb-10 { margin-bottom: 10px; }
.mb-16 { margin-bottom: 16px; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }

/* --- 安全间距 --- */
.safe-area-bottom {
  height: calc(var(--bottom-nav-height) + var(--safe-bottom) + 20px);
}

.safe-area-top {
  height: calc(var(--safe-top) + 10px);
}

/* --- 模态框 --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5000;
  animation: fadeIn 0.3s ease;
  padding: 20px;
}

.modal-dialog {
  width: 100%;
  max-width: 360px;
  background: linear-gradient(160deg, #5c0000, #3d0000);
  border: 2px solid var(--color-card-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  position: relative;
  animation: slideUp 0.3s ease;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 14px;
  width: 28px;
  height: 28px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  font-size: 1.2rem;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-title {
  font-family: var(--font-title);
  font-size: 1.3rem;
  color: var(--color-gold-mid);
  text-align: center;
  margin-bottom: 16px;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

/* --- 顶部栏 --- */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  height: var(--header-height);
  position: relative;
}

.top-bar .bar-title {
  font-family: var(--font-title);
  font-size: 1.2rem;
  color: var(--color-gold-mid);
  flex: 1;
  text-align: center;
  text-shadow: 0 1px 5px rgba(255, 215, 0, 0.3);
}

.top-bar .bar-left,
.top-bar .bar-right {
  width: 40px;
  display: flex;
  align-items: center;
}

.top-bar .bar-left { justify-content: flex-start; }
.top-bar .bar-right { justify-content: flex-end; }

.top-bar .bar-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: rgba(255, 215, 0, 0.1);
  border-radius: 50%;
  color: var(--color-gold-mid);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- 响应式 --- */
@media (max-width: 360px) {
  html { font-size: 14px; }
  .moon { width: 80px; height: 80px; }
  .cn-card { padding: 16px; }
}

@media (min-width: 768px) {
  html { font-size: 18px; }
  .moon { width: 120px; height: 120px; }
}
