/* R125 年会抽奖系统 */
:root {
  --primary: #E60012;
  --secondary: #C41230;
  --accent: #FFD700;
  --bg: #1A0000;
  --text: #FFF8E7;
  --contact-footer-h: 72px;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-tap-highlight-color: transparent; }
body {
  font-family: -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}
.hidden { display: none !important; }
button { font: inherit; cursor: pointer; border: none; min-height: 44px; min-width: 44px; }
a { color: var(--accent); }

body.has-contact-footer { padding-bottom: calc(var(--contact-footer-h) + env(safe-area-inset-bottom)); }

/* display view */
.display-view {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}
.top-bar {
  padding: 16px 20px 8px;
  text-align: center;
  background: linear-gradient(180deg, rgba(0,0,0,.4), transparent);
}
.event-title {
  font-size: clamp(1.4rem, 4vw, 2.2rem);
  color: var(--accent);
  text-shadow: 0 2px 12px rgba(255,215,0,.4);
  margin-bottom: 8px;
}
.round-progress { max-width: 320px; margin: 0 auto; }
.round-label { font-size: .9rem; opacity: .85; }
.progress-bar {
  height: 6px; background: rgba(255,255,255,.15); border-radius: 3px;
  margin-top: 6px; overflow: hidden;
}
.progress-fill {
  height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent));
  width: 33%; transition: width .4s;
}

.stage {
  flex: 1; display: flex; align-items: center; justify-content: center;
  position: relative; padding: 12px;
}
.stage-mode { display: none; text-align: center; }
.stage-mode.active { display: block; }
#wheel-stage { position: relative; }
#wheel-canvas { display: block; margin: 0 auto; filter: drop-shadow(0 8px 24px rgba(0,0,0,.5)); }
.pointer {
  position: absolute; top: -8px; left: 50%; transform: translateX(-50%);
  font-size: 2rem; color: var(--accent);
  text-shadow: 0 0 12px rgba(255,215,0,.8);
  z-index: 2;
}

.name-display {
  padding: 40px 24px;
  background: rgba(0,0,0,.35);
  border: 2px solid var(--accent);
  border-radius: 20px;
  min-width: 280px;
  box-shadow: 0 0 40px rgba(255,215,0,.2);
}
.name-text {
  font-size: clamp(2rem, 8vw, 4rem);
  font-weight: 800;
  color: var(--accent);
  display: block;
}
.name-text.winner-reveal { animation: winnerPop .6s cubic-bezier(.68,-.55,.265,1.55); }

.bottom-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: rgba(0,0,0,.5); flex-wrap: wrap; gap: 8px;
}
.participant-count { font-size: .9rem; }
.qr-entry { text-align: center; }
.qr-label { display: block; font-size: .7rem; margin-top: 4px; opacity: .8; }
.link-control { font-size: .85rem; text-decoration: none; }

.history-panel {
  position: fixed; right: 0; top: 80px; bottom: 80px; width: 220px;
  background: rgba(0,0,0,.55); backdrop-filter: blur(8px);
  padding: 12px; overflow-y: auto; border-left: 1px solid rgba(255,255,255,.1);
}
.history-panel h3 { font-size: .95rem; margin-bottom: 8px; color: var(--accent); }
.history-item { font-size: .75rem; padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,.08); }
.history-name { color: #fff; font-weight: 600; }
.history-prize { color: var(--accent); }
.history-actions { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.btn-export {
  padding: 8px; font-size: .75rem; background: rgba(255,255,255,.1);
  color: var(--text); border-radius: 8px;
}
.empty-hint { font-size: .8rem; opacity: .6; }

/* celebration */
.celebration-overlay {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.65);
}
#confetti-canvas, .particle-layer {
  position: fixed; inset: 0; pointer-events: none; z-index: 201;
}
.winner-card {
  position: relative; z-index: 202;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  padding: 32px 40px; border-radius: 20px; text-align: center;
  border: 3px solid var(--accent);
  box-shadow: 0 0 60px rgba(255,215,0,.4);
  transform: scale(.8); opacity: 0;
}
.winner-card.card-reveal { animation: cardReveal .5s forwards; }
.winner-label { font-size: 1rem; margin-bottom: 8px; }
.winner-name { font-size: 2.5rem; color: var(--accent); margin: 8px 0; }
.winner-prize { font-size: 1.2rem; }
.winner-name.shimmer {
  background: linear-gradient(90deg, #fff 0%, var(--accent) 50%, #fff 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 1.5s infinite;
}

/* danmaku */
.danmaku-layer {
  position: fixed; inset: 0; pointer-events: none; z-index: 150; overflow: hidden;
}
.danmaku-item {
  position: absolute; right: -100%;
  white-space: nowrap; color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,.8);
  animation: danmakuFly 10s linear forwards;
}

/* control view */
.control-view {
  max-width: 480px; margin: 0 auto; padding: 16px;
  min-height: 100vh;
}
.control-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px;
}
.control-header h2 { font-size: 1.2rem; }
.link-display { font-size: .85rem; }
.control-buttons { display: grid; gap: 10px; margin-bottom: 20px; }
.btn-control {
  width: 100%; padding: 14px; border-radius: 12px;
  font-size: 1rem; font-weight: 700;
}
.btn-start { background: var(--primary); color: #fff; }
.btn-stop { background: #333; color: #fff; }
.btn-next { background: var(--secondary); color: #fff; }
.btn-reset { background: rgba(255,255,255,.12); color: var(--text); }
.btn-import { background: var(--accent); color: #333; }
.control-info {
  background: rgba(255,255,255,.06); padding: 12px; border-radius: 12px;
  font-size: .9rem; line-height: 1.6; margin-bottom: 16px;
}
.control-info code { font-size: .75rem; word-break: break-all; }
.ctrl-hint { opacity: .7; font-size: .8rem; }
.quick-prizes { display: grid; gap: 8px; margin-bottom: 16px; }
.prize-card {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 12px; background: rgba(255,255,255,.08); border-radius: 10px;
  position: relative;
}
.prize-card.sold-out { opacity: .45; }
.prize-tier { font-size: .7rem; background: var(--primary); padding: 2px 6px; border-radius: 4px; }
.prize-name { flex: 1; font-weight: 600; }
.prize-count { font-size: .8rem; color: var(--accent); }
.sold-out-stamp {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%) rotate(-12deg);
  border: 2px solid #999; color: #999; padding: 2px 8px; font-size: .7rem;
}
.participant-editor label { display: block; font-size: .85rem; margin-bottom: 6px; }
.participant-editor textarea {
  width: 100%; padding: 10px; border-radius: 8px; border: 1px solid rgba(255,255,255,.2);
  background: rgba(0,0,0,.3); color: var(--text); margin-bottom: 8px;
}

/* join overlay */
.join-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.join-form {
  background: #fff; color: #333; padding: 24px; border-radius: 16px;
  width: 100%; max-width: 360px; text-align: center;
}
.join-form h3 { margin-bottom: 16px; color: var(--primary); }
.join-form input {
  width: 100%; padding: 12px; margin-bottom: 10px; border: 1px solid #ddd;
  border-radius: 8px; font-size: 1rem;
}
.btn-join {
  width: 100%; padding: 12px; background: var(--primary); color: #fff;
  border-radius: 10px; font-weight: 700; margin-top: 4px;
}
.join-success, .join-duplicate { margin-top: 12px; font-size: .9rem; }
.join-close { margin-top: 12px; background: #eee; color: #666; width: 100%; border-radius: 8px; padding: 10px; }

.toast-box { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 400; }
.toast-item {
  background: rgba(0,0,0,.8); color: #fff; padding: 10px 18px;
  border-radius: 20px; margin-bottom: 8px; font-size: .9rem;
}

/* contact footer */
.contact-footer {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  background: #fff; border-top: 1px solid #eee;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
}
.contact-footer__btns {
  display: grid; grid-template-columns: repeat(3, minmax(0, 88px));
  gap: 8px; max-width: 320px; margin: 0 auto; justify-content: center;
}
.contact-footer__cta, .contact-footer__btn {
  display: flex; align-items: center; justify-content: center;
  font-size: .72rem; padding: .48rem .2rem; border-radius: 8px;
  text-decoration: none; color: #333; background: #f5f5f5; border: none;
}
.contact-footer__cta { background: #c41e1e !important; color: #fff !important; font-weight: 600; }
.contact-footer__brand { text-align: center; font-size: .6rem; color: #999; margin-top: 6px; }
body.has-contact-footer .zw-root .zw-fab {
  bottom: calc(var(--contact-footer-h) + 12px + env(safe-area-inset-bottom)) !important;
}

/* share page */
.share-page .share-main { padding: 24px 16px; max-width: 420px; margin: 0 auto; }
.share-card {
  background: #fff; color: #333; border-radius: 16px; padding: 24px;
  text-align: center; box-shadow: 0 8px 24px rgba(0,0,0,.15);
}
.share-cta {
  display: block; width: 100%; margin: 16px 0; padding: 14px;
  background: #E60012; color: #fff !important; text-decoration: none;
  border-radius: 12px; font-weight: 700; font-size: 1.05rem;
}
.share-cta.secondary { background: #1565C0; margin-top: 8px; }
.share-qr { margin: 16px auto; }

@media (max-width: 900px) {
  .history-panel {
    position: static; width: auto; max-height: 160px;
    margin: 0 12px 12px; border-left: none; border-top: 1px solid rgba(255,255,255,.1);
  }
}

@keyframes winnerPop {
  0% { transform: scale(.5); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes cardReveal {
  0% { transform: scale(.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@keyframes danmakuFly {
  0% { transform: translateX(0); }
  100% { transform: translateX(calc(-100vw - 100%)); }
}
