:root {
  --bg: #0f1226;
  --card: #1b1f3b;
  --accent: #ff5c8a;
  --accent2: #7c5cff;
  --gold: #ffd34e;
  --text: #f4f5ff;
  --muted: #9aa0c7;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: radial-gradient(1200px 600px at 50% -10%, #2a2160 0%, var(--bg) 60%);
  color: var(--text);
  min-height: 100vh;
}
.hidden { display: none !important; }

#app { max-width: 480px; margin: 0 auto; padding: 14px; }
.loading { text-align: center; padding: 80px 0; color: var(--muted); }

.card {
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.25);
}

.product { text-align: center; }
.product-img-wrap { position: relative; width: 100%; min-height: 120px; }
.product-img {
  width: 100%; max-height: 180px; object-fit: cover; border-radius: 14px;
  display: none; background: rgba(255,255,255,0.06);
}
.product-img-fallback {
  display: flex; align-items: center; justify-content: center;
  min-height: 120px; border-radius: 14px;
  background: rgba(255,255,255,0.06); font-size: 48px;
}
.product-img-fallback.hidden { display: none; }
.product-name { font-size: 20px; margin: 12px 0 6px; }
.product-desc { font-size: 13px; color: var(--muted); margin: 0; }

.progress-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.progress-tag { font-size: 13px; color: var(--muted); font-weight: 500; }
.percent-label { font-size: 18px; font-weight: 800; color: var(--accent); }
.progress-bar { height: 14px; border-radius: 10px; background: rgba(255,255,255,0.08); overflow: hidden; }
.progress-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent2), var(--accent), var(--gold));
  border-radius: 10px;
  transition: width 0.8s cubic-bezier(.22,1,.36,1);
}
.progress-hint {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--gold);
  font-weight: 600;
  text-align: center;
}

.slots { display: none; }

/* 随机浮窗福袋 — 转盘右上角空白区 */
.play-area {
  position: relative;
  min-height: 280px;
  margin-bottom: 16px;
}
.float-layer {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 12;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  width: 56px;
  pointer-events: none;
}
.float-bag {
  position: relative;
  pointer-events: auto;
  animation: bag-float 2.8s ease-in-out infinite;
}
@keyframes bag-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}
.float-bag-inner {
  position: relative;
  cursor: pointer;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.35));
}
.float-bag-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: linear-gradient(145deg, #ff6b6b, #ffd34e);
  border: 2px solid rgba(255,255,255,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}
.float-bag-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
}
.float-bag-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 156px;
  padding: 12px;
  background: linear-gradient(160deg, #2a2250, #1b1f3b);
  border: 1px solid rgba(255,211,78,0.35);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.45);
  opacity: 0;
  transform: scale(0.85) translateY(-4px);
  transform-origin: top right;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 20;
}
.float-bag.open .float-bag-panel {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
}
.float-bag-title { font-size: 13px; font-weight: 800; color: var(--gold); margin: 0 0 4px; }
.float-bag-desc { font-size: 11px; color: var(--muted); margin: 0 0 8px; line-height: 1.4; }
.float-bag-timer {
  font-size: 16px; font-weight: 800; color: #fff;
  font-variant-numeric: tabular-nums; margin-bottom: 8px;
}
.float-bag-btn {
  width: 100%; padding: 8px 6px; border: none; border-radius: 10px;
  font-size: 12px; font-weight: 700; cursor: pointer; color: #3a2b00;
  background: linear-gradient(90deg, #ff9a3d, var(--gold));
}
.float-bag-btn:disabled { opacity: .45; cursor: not-allowed; }
.float-bag.leaving { animation: bag-out .35s ease forwards; }
@keyframes bag-out {
  to { opacity: 0; transform: translateY(20px) scale(0.8); }
}

.stage { text-align: center; }
.interaction-title { font-size: 15px; font-weight: 700; margin-bottom: 14px; color: var(--gold); }

/* 转盘 */
.wheel-wrap {
  position: relative;
  width: 280px;
  height: 280px;
  margin: 0 auto;
}
.wheel {
  width: 100%; height: 100%; border-radius: 50%; position: relative;
  overflow: hidden;
  border: 7px solid rgba(255, 211, 78, 0.85);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35), inset 0 0 0 3px rgba(0, 0, 0, 0.15);
  transition: transform 3.2s cubic-bezier(0.15, 0.85, 0.2, 1);
}
.wheel-svg {
  width: 100%; height: 100%; display: block;
}
.wheel-svg svg {
  width: 100%; height: 100%; display: block;
}
.wheel-center {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff 0%, #ffd34e 55%, #e8a317 100%);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3), inset 0 0 0 3px rgba(255, 255, 255, 0.9);
  z-index: 5;
  pointer-events: none;
}
.wheel-pointer {
  position: absolute; top: 2px; left: 50%; transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 14px solid transparent; border-right: 14px solid transparent;
  border-top: 24px solid #ffd34e; z-index: 6;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.45));
}
.prize-result {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(255,92,138,.25), rgba(255,211,78,.2));
  border: 1px solid rgba(255,211,78,.35);
  font-size: 15px;
  font-weight: 700;
  color: #ffe8a3;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.prize-result.hidden { display: none !important; }

/* 老虎机 */
.slot-wrap { display: flex; gap: 10px; justify-content: center; margin: 10px auto 0; }
.reel {
  width: 64px; height: 84px; border-radius: 12px; overflow: hidden;
  background: #0d0f24; border: 2px solid #ffffff22;
}
.reel-inner { display: flex; flex-direction: column; font-size: 40px; line-height: 84px; }
.reel-inner div { height: 84px; }

.btn {
  display: block; width: 100%; padding: 14px; border: none; border-radius: 14px;
  font-size: 16px; font-weight: 700; cursor: pointer; margin-top: 8px; color: #fff;
  transition: transform .1s, opacity .2s;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: .5; }
.btn-primary { background: linear-gradient(90deg, var(--accent2), var(--accent)); }
.btn-accent { background: linear-gradient(90deg, #ff9a3d, var(--gold)); color: #3a2b00; }
.btn-ghost { background: rgba(255,255,255,0.08); }
.chance-tip { font-size: 12px; color: var(--muted); margin-top: 10px; min-height: 16px; }

.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px;
}
.modal-box {
  background: var(--card); border-radius: 18px; padding: 24px; width: 100%; max-width: 340px;
  text-align: center; border: 1px solid #ffffff1a;
}
.modal-box h2 { margin: 6px 0 10px; }
.modal-box p { color: var(--muted); font-size: 14px; margin: 0 0 16px; }
.done-emoji { font-size: 52px; animation: pop .5s ease; }
@keyframes pop { 0%{transform:scale(0)} 70%{transform:scale(1.3)} 100%{transform:scale(1)} }

.toast {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
  background: #000a; color: #fff; padding: 10px 18px; border-radius: 12px;
  font-size: 14px; z-index: 60; max-width: 90%;
}
