/* ================================================
   全局公共样式 - 礼物场景系统
   ================================================ */

/* Google Fonts blocked by CSP — fonts fallback to system-ui */

:root {
  --bg: #fffaf5;
  --text: #2d2420;
  --muted: #8a7d75;
  --radius: 16px;
  --shadow: 0 8px 40px rgba(0,0,0,0.08);
  --shadow-lg: 0 20px 80px rgba(0,0,0,0.12);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', 'Noto Serif SC', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  overflow-x: hidden;
}

/* 背景画布 */
.bg-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

/* 主容器 */
.container {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

/* 通用卡片 */
.card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* 通用按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 32px;
  border-radius: 50px;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.25s cubic-bezier(0.34,1.56,0.64,1);
  text-decoration: none;
  letter-spacing: 0.02em;
}
.btn:active { transform: scale(0.96); }
.btn:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.15); }

/* 动画关键帧 */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-12px); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.7; transform: scale(1.05); }
}
@keyframes twinkle {
  0%, 100% { opacity: 0.2; }
  50%       { opacity: 1; }
}
@keyframes fall {
  0%   { transform: translateY(-10vh) rotate(0deg); opacity: 1; }
  100% { transform: translateY(110vh) rotate(360deg); opacity: 0; }
}
@keyframes shimmer {
  0%   { background-position: -200% center; }
  100% { background-position: 200% center; }
}
@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  15%       { transform: scale(1.25); }
  30%       { transform: scale(1); }
  45%       { transform: scale(1.15); }
  60%       { transform: scale(1); }
}
@keyframes candleFlicker {
  0%, 100% { opacity: 1; transform: scaleY(1); }
  25%       { opacity: 0.9; transform: scaleY(0.95); }
  50%       { opacity: 1; transform: scaleY(1.02); }
  75%       { opacity: 0.85; transform: scaleY(0.97); }
}
@keyframes starFloat {
  0%   { transform: translate(0,0) scale(1); opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { transform: translate(var(--tx), var(--ty)) scale(0.5); opacity: 0; }
}

/* 通用输入框 */
.input-field {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid #e8e0d8;
  border-radius: 12px;
  font-family: 'DM Sans', 'Noto Serif SC', sans-serif;
  font-size: 15px;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  resize: none;
}
.input-field:focus {
  border-color: #c9a96e;
  box-shadow: 0 0 0 3px rgba(201,169,110,0.15);
}
.input-field::placeholder { color: #b0a090; }

/* 通用标签 */
.label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

/* 模态框 */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(6px);
  z-index: 999;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.show { display: flex; }
.modal {
  background: white;
  border-radius: 20px;
  padding: 36px 32px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  animation: fadeUp 0.3s ease;
}
.modal h2 {
  font-family: 'Playfair Display', 'Noto Serif SC', serif;
  font-size: 22px;
  margin-bottom: 6px;
}
.modal .subtitle {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 24px;
}
.modal .form-group { margin-bottom: 18px; }
.modal .btn-group { display: flex; gap: 10px; margin-top: 20px; }
.modal .btn-group .btn { flex: 1; }

/* Toast */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #2d2420;
  color: white;
  padding: 12px 24px;
  border-radius: 50px;
  font-size: 14px;
  font-weight: 500;
  z-index: 10001;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.34,1.56,0.64,1);
  pointer-events: none;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 进度条 */
.progress-bar {
  width: 100%;
  height: 4px;
  background: #f0ebe4;
  border-radius: 2px;
  overflow: hidden;
}
.progress-bar .fill {
  height: 100%;
  background: linear-gradient(90deg, #c9a96e, #e8c87a);
  border-radius: 2px;
  transition: width 0.4s ease;
}

/* 响应式 */
@media (max-width: 600px) {
  .container { padding: 32px 16px 60px; }
  .modal { padding: 28px 20px; border-radius: 20px 20px 0 0; align-self: flex-end; margin: 0; max-height: 85vh; }
  .modal-overlay { align-items: flex-end; }
}

/* 礼物ID输入框特殊样式（管理员提供） - 深色背景下醒目 */
.gift-id-wrap {
  position: relative;
}
.gift-id-wrap .card-label {
  color: #ffa726;
  font-weight: 700;
  text-shadow: 0 0 10px rgba(255,167,38,0.5);
}
.gift-id-wrap .card-label::before {
  content: '🔑 ';
}
.gift-id-wrap input {
  border: 2px solid #ff9800;
  background: linear-gradient(135deg, #2a1f00 0%, #3d2a00 50%, #2a1f00 100%);
  font-family: 'JetBrains Mono', 'Consolas', monospace;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-align: center;
  color: #ffc107;
  box-shadow: 0 0 15px rgba(255,152,0,0.4), inset 0 0 20px rgba(255,193,7,0.1);
  animation: giftIdPulse 2s ease-in-out infinite;
}
@keyframes giftIdPulse {
  0%, 100% { box-shadow: 0 0 15px rgba(255,152,0,0.4), inset 0 0 20px rgba(255,193,7,0.1); }
  50% { box-shadow: 0 0 25px rgba(255,152,0,0.6), inset 0 0 30px rgba(255,193,7,0.2); }
}
.gift-id-wrap input:focus {
  border-color: #ffc107;
  box-shadow: 0 0 30px rgba(255,193,7,0.7), 0 0 60px rgba(255,152,0,0.4);
  animation: none;
}
.gift-id-wrap input::placeholder {
  color: rgba(255,193,7,0.5);
  font-weight: 400;
  letter-spacing: 0.05em;
}
.gift-id-wrap input::-webkit-outer-spin-button,
.gift-id-wrap input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.gift-id-wrap input[type=number] {
  -moz-appearance: textfield;
}
