/* 幸运抢红包 · 公共样式（红金喜庆主题） */
:root {
  --red-deep: #7a0c1c;
  --red: #b01226;
  --red-bright: #d93038;
  --gold: #f5c842;
  --gold-deep: #d4a017;
  --gold-light: #ffe9a8;
  --cream: #fff6e5;
  --ink: #3b0a0f;
  --ink-soft: #7a5560;
  --shadow: 0 10px 30px rgba(60, 0, 10, 0.35);
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", system-ui, sans-serif;
  color: var(--ink);
  background: linear-gradient(160deg, #d0202f 0%, #a81021 45%, #7a0c1c 100%);
  background-attachment: fixed;
  min-height: 100vh;
  overflow-x: hidden;
}
/* 背景漂浮红包装饰 */
.bg-float { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.float-packet { position: absolute; top: -120px; opacity: 0.16; animation: floatDown linear infinite; filter: drop-shadow(0 4px 6px rgba(0,0,0,.2)); }
.float-packet .fp-body {
  width: 100%; height: 100%; border-radius: 6px;
  background: linear-gradient(160deg, #ff6b5e, #c8102e 60%, #8e0e1f);
  position: relative; border: 2px solid rgba(255, 215, 120, 0.55);
}
.float-packet .fp-body::after {
  content: "福"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #ffe9a8; font-weight: 700;
}
.float-packet.gold .fp-body { background: linear-gradient(160deg, #ffe08a, #e0a323 60%, #b57d0e); }
.float-packet.gold .fp-body::after { color: #fff; }
@keyframes floatDown { to { transform: translateY(115vh) rotate(360deg); } }

/* 版心 */
.page { position: relative; z-index: 1; max-width: 1080px; margin: 0 auto; padding: 18px 16px 40px; }
.page-mobile { max-width: 520px; }

/* 顶部标题 */
.topbar { text-align: center; padding: 14px 0 6px; }
.topbar .lanterns { font-size: 30px; letter-spacing: 8px; filter: drop-shadow(0 3px 4px rgba(0,0,0,.3)); }
.game-title {
  font-family: "Kaiti SC", "KaiTi", "STKaiti", "SimKai", serif;
  font-size: clamp(34px, 7vw, 62px); font-weight: 800; letter-spacing: 6px; line-height: 1.15;
  background: linear-gradient(180deg, #fff3c4 10%, #ffd75e 45%, #e8a91c 85%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 0 rgba(90, 10, 15, .8)) drop-shadow(0 6px 12px rgba(0, 0, 0, .35));
}
.game-sub { color: #ffd9d9; font-size: 15px; letter-spacing: 3px; margin-top: 6px; opacity: .95; }

/* 卡片 */
.card {
  background: linear-gradient(180deg, #fffaf0, #fff3dd);
  border-radius: 22px; border: 2px solid rgba(212, 160, 23, .55);
  box-shadow: var(--shadow); padding: 22px; position: relative;
}
.card::before {
  content: ""; position: absolute; inset: 6px; border-radius: 16px;
  border: 1px dashed rgba(212, 160, 23, .5); pointer-events: none;
}
.section-title { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 22px; font-weight: 800; color: var(--red-deep); letter-spacing: 2px; margin-bottom: 16px; }
.section-title .deco { color: var(--gold-deep); font-size: 18px; }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; cursor: pointer; font-family: inherit; font-weight: 800;
  border-radius: 999px; transition: transform .12s ease, box-shadow .12s ease, filter .12s;
  user-select: none; letter-spacing: 2px;
}
.btn:active { transform: scale(.96); }
.btn-gold {
  background: linear-gradient(180deg, #ffe08a, #f0b429 55%, #d4920a);
  color: #5c2a00; padding: 15px 40px; font-size: 20px;
  box-shadow: 0 6px 0 #a86f06, 0 12px 22px rgba(0, 0, 0, .3);
}
.btn-gold:active { box-shadow: 0 3px 0 #a86f06, 0 6px 14px rgba(0, 0, 0, .3); }
.btn-red {
  background: linear-gradient(180deg, #ff6b5e, #d93038 60%, #b01226); color: #fff;
  padding: 13px 34px; font-size: 18px; box-shadow: 0 5px 0 #7a0c1c, 0 10px 18px rgba(0, 0, 0, .28);
}
.btn-ghost {
  background: rgba(255, 255, 255, .12); color: #ffe9a8; padding: 12px 26px; font-size: 16px;
  border: 1px solid rgba(255, 220, 130, .5); box-shadow: none;
}
.btn:disabled { filter: grayscale(.6) opacity(.55); cursor: not-allowed; transform: none; }

/* 表单 */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 14px; font-weight: 700; color: var(--red-deep); margin-bottom: 7px; letter-spacing: 1px; }
.field input {
  width: 100%; padding: 13px 16px; font-size: 17px; font-family: inherit; color: var(--ink);
  border: 2px solid rgba(176, 18, 38, .25); border-radius: 12px; background: #fffdf7; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus { border-color: var(--red-bright); box-shadow: 0 0 0 3px rgba(217, 48, 56, .14); }
.field .err { color: #c0392b; font-size: 13px; margin-top: 5px; display: none; }
.field.invalid input { border-color: #c0392b; }
.field.invalid .err { display: block; }

/* 排行榜样式 */
.board { display: flex; flex-direction: column; gap: 9px; }
.board-row {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 14px;
  background: linear-gradient(90deg, rgba(255, 244, 214, .95), rgba(255, 236, 200, .82));
  border: 1px solid rgba(212, 160, 23, .35); animation: rowIn .35s ease both;
}
@keyframes rowIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.board-row .rank { width: 40px; height: 40px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 800; background: rgba(176, 18, 38, .1); color: var(--red-deep); }
.board-row.r1 .rank { background: linear-gradient(180deg, #ffe08a, #e8a91c); color: #6b3d00; box-shadow: 0 0 0 3px rgba(232, 169, 28, .3); }
.board-row.r2 .rank { background: linear-gradient(180deg, #f2f2f2, #b9b9c2); color: #4a4a55; }
.board-row.r3 .rank { background: linear-gradient(180deg, #f5c99a, #c07a3a); color: #5c2f00; }
.board-row .who { flex: 1; min-width: 0; }
.board-row .who .name { font-size: 17px; font-weight: 800; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-row .who .company { font-size: 12.5px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-row .score { font-size: 21px; font-weight: 900; color: var(--red-bright); flex: none; font-variant-numeric: tabular-nums; }
.board-row.me { outline: 3px solid var(--gold); background: linear-gradient(90deg, #fff2c2, #ffe3a0); }
.board-empty { text-align: center; color: var(--ink-soft); padding: 26px 0; font-size: 15px; letter-spacing: 1px; }

/* 领奖台（前三名） */
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 14px; margin: 8px 0 20px; }
.podium .pod { text-align: center; flex: 1; max-width: 180px; }
.podium .pod .avatar {
  width: 64px; height: 64px; margin: 0 auto 8px; border-radius: 50%;
  background: linear-gradient(180deg, #ffe08a, #e8a91c); display: flex; align-items: center; justify-content: center;
  font-size: 30px; box-shadow: 0 6px 14px rgba(0, 0, 0, .25); border: 3px solid #fff;
}
.podium .pod .pname { font-weight: 800; font-size: 16px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.podium .pod .pscore { color: var(--red-bright); font-weight: 900; font-size: 18px; margin-top: 2px; }
.podium .pod .base { margin-top: 8px; border-radius: 10px 10px 0 0; color: #fff; font-weight: 900; display: flex; align-items: flex-end; justify-content: center; font-size: 22px; padding-bottom: 6px; text-shadow: 0 2px 3px rgba(0,0,0,.3); }
.podium .pod.p1 .base { height: 86px; background: linear-gradient(180deg, #f5c842, #c98f1a); }
.podium .pod.p2 .base { height: 62px; background: linear-gradient(180deg, #c8ccd6, #8f95a3); }
.podium .pod.p3 .base { height: 46px; background: linear-gradient(180deg, #e2a06a, #a9642c); }

/* 徽标 / 药丸 */
.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 6px 14px; font-size: 14px; font-weight: 700; }
.pill-gold { background: rgba(245, 200, 66, .18); color: var(--gold-light); border: 1px solid rgba(245, 200, 66, .5); }

/* 提示浮层 */
.toast {
  position: fixed; left: 50%; bottom: 14vh; transform: translateX(-50%) translateY(20px);
  background: rgba(59, 10, 15, .92); color: #ffe9a8; padding: 12px 22px; border-radius: 999px;
  font-size: 15px; z-index: 999; opacity: 0; transition: all .25s ease; pointer-events: none; white-space: nowrap;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .35);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 红包种类图例 */
.legend { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.legend .lg { text-align: center; }
.legend .lg .chip { width: 46px; height: 62px; margin: 0 auto 6px; border-radius: 7px; position: relative; display: flex; align-items: center; justify-content: center; font-size: 17px; font-weight: 800; box-shadow: 0 4px 10px rgba(0, 0, 0, .25); }
.legend .lg .chip::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 34%; border-radius: 7px 7px 40% 40%; background: rgba(0, 0, 0, .18); }
.chip.c-red { background: linear-gradient(160deg, #ff6b5e, #c8102e); color: #ffe9a8; }
.chip.c-gold { background: linear-gradient(160deg, #ffe08a, #df9f1c); color: #fff; }
.chip.c-black { background: linear-gradient(160deg, #4a4a52, #17171c); color: #9a9aa5; }
.chip.c-rg { background: linear-gradient(100deg, #d93038 0 50%, #f0b429 50% 100%); color: #fff; }
.legend .lg .pt { font-size: 13px; font-weight: 800; color: var(--ink); }
.legend .lg .pt.plus { color: #c98f1a; }
.legend .lg .pt.minus { color: #5c6b8a; }
.legend .lg .nm { font-size: 12px; color: var(--ink-soft); margin-top: 1px; }

/* 倒计时大字 */
.countdown-wrap { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; flex-direction: column; background: rgba(90, 5, 15, .55); backdrop-filter: blur(3px); }
.countdown-num {
  font-size: clamp(120px, 34vw, 300px); font-weight: 900; line-height: 1; font-family: "Kaiti SC", "KaiTi", serif;
  background: linear-gradient(180deg, #fff3c4, #ffd75e 55%, #e8a91c);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 6px 0 rgba(90, 10, 15, .85)) drop-shadow(0 14px 30px rgba(0, 0, 0, .5));
  animation: countPop .92s ease infinite;
}
.countdown-label { color: #ffe9a8; font-size: clamp(18px, 4vw, 30px); letter-spacing: 8px; font-weight: 700; margin-top: 8px; text-shadow: 0 2px 6px rgba(0,0,0,.4); }
@keyframes countPop { 0% { transform: scale(.55); opacity: 0; } 22% { transform: scale(1.12); opacity: 1; } 34% { transform: scale(1); } 82% { transform: scale(1); opacity: 1; } 100% { transform: scale(1.3); opacity: 0; } }

/* 动画工具 */
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes shimmer { 0% { box-shadow: 0 0 0 0 rgba(245, 200, 66, .55); } 100% { box-shadow: 0 0 0 26px rgba(245, 200, 66, 0); } }
.shimmer { animation: shimmer 1.8s ease-out infinite; }

/* 屏幕切换 */
.screen { display: none; }
.screen.active { display: block; animation: screenIn .3s ease; }
@keyframes screenIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

@media (max-width: 560px) {
  .page { padding: 14px 12px 32px; }
  .legend { gap: 6px; }
  .legend .lg .chip { width: 40px; height: 54px; }
}
