:root {
  --lottery-gold: #e9c86e;
  --lottery-gold-bright: #ffe7a0;
  --lottery-gold-deep: #9a6c1c;
  --lottery-panel: rgba(19, 16, 10, .9);
  --lottery-line: rgba(233, 200, 110, .35);
  --lottery-text: #f4ead0;
  --lottery-muted: #a89a7c;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body.lottery-page {
  min-height: 100vh;
  display: block;
  overflow-x: hidden;
  overflow-y: auto;
  background: #11130f;
  color: var(--lottery-text);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", sans-serif;
}

.member-topbar.lottery-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  width: 100%;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 58px;
  padding: 8px 16px;
  border-bottom: 1px solid rgba(212, 175, 55, .28);
  background: linear-gradient(180deg, rgba(9, 8, 5, .72), rgba(12, 10, 6, .55));
  backdrop-filter: blur(10px);
}
.member-brand {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #f3e7c2;
  text-decoration: none;
  min-width: 0;
}
.member-logo {
  width: 27px;
  height: 27px;
  flex: 0 0 27px;
  display: grid;
  place-items: center;
  border: 1px solid #e3c66f;
  border-radius: 50%;
  color: #f5d98d;
  font: 700 17px/1 Georgia, serif;
  background: radial-gradient(circle at 35% 30%, #3b2c11, #120e07);
  box-shadow: 0 0 8px #d4af5540;
}
.member-title {
  font: 600 16px/1 Georgia, "Microsoft YaHei", serif;
  letter-spacing: .04em;
  white-space: nowrap;
}
.member-title em { color: #e9c86e; font-style: normal; }
.member-top-spacer { margin-left: auto; }
.member-menu-btn {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  color: #e8c56a;
  font-size: 17px;
  line-height: 1;
  background: transparent;
  border: 0;
  cursor: pointer;
}
.member-menu {
  position: absolute;
  top: 56px;
  right: 8px;
  z-index: 40;
  width: 160px;
  padding: 5px;
  border: 1px solid #6b5624;
  border-radius: 7px;
  background: linear-gradient(180deg, #1a170e, #0c0b07);
  box-shadow: 0 12px 30px #000b;
}
.member-menu[hidden] { display: none !important; }
.member-menu a,
.member-menu button {
  display: block;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #d9c68f;
  text-align: left;
  text-decoration: none;
  font-size: 11px;
  cursor: pointer;
}
.member-menu a:hover,
.member-menu button:hover { background: #251e0f; color: #ffe08a; }

.lottery-main {
  position: relative;
  z-index: 1;
  width: min(460px, calc(100% - 32px));
  margin: 0 auto;
  padding: 6px 0 118px;
}

.lottery-wheel-stage {
  position: relative;
  width: min(360px, 90vw);
  aspect-ratio: 1;
  margin: 60px auto 0;
  display: grid;
  place-items: center;
}
.lottery-wheel-rim {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  padding: 11px;
  background:
    radial-gradient(circle at 50% 0%, #fff1b8, #d7a53c 18%, #7d5110 45%, #f4d57d 66%, #8b5c14 88%, #3a2606);
  box-shadow:
    0 0 0 2px #f7dc8d,
    0 0 0 6px #6c4710,
    0 0 26px #f6c74d77,
    0 0 60px #f6c74d33,
    inset 0 0 22px #4b2e06;
}
.lottery-wheel-rim::before {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  border: 2px dashed rgba(255, 242, 187, .55);
  pointer-events: none;
}
.lottery-wheel {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  background: #2a1538;
  box-shadow: inset 0 0 30px #000a, 0 8px 28px #000b;
  transform: rotate(0deg);
  will-change: transform;
}
.lottery-segments {
  position: absolute;
  inset: 0;
  border-radius: 50%;
}
.lottery-segments::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 42%, transparent 35%, rgba(0, 0, 0, .22) 78%, rgba(0, 0, 0, .4));
  pointer-events: none;
}
.lottery-labels { position: absolute; inset: 0; }
.lottery-label {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 86px;
  margin-left: -43px;
  margin-top: -27px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: #fff8e6;
  text-align: center;
  text-shadow: 0 2px 3px #000c, 0 0 8px #000a;
  pointer-events: none;
}
.lottery-label i {
  font-style: normal;
  font-size: 22px;
  line-height: 1;
  filter: drop-shadow(0 2px 3px #0009);
}
.lottery-label b {
  display: block;
  font-size: 15px;
  line-height: 1.1;
  font-weight: 900;
  letter-spacing: .01em;
  white-space: nowrap;
}
.lottery-label.thanks i { font-size: 25px; }
.lottery-label.thanks b { font-size: 13px; }

.lottery-pointer {
  position: absolute;
  top: -15px;
  left: 50%;
  z-index: 6;
  width: 34px;
  height: 46px;
  transform: translateX(-50%);
  filter: drop-shadow(0 4px 5px #000b);
}
.lottery-pointer::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #fff4bd, #f5c93f 35%, #d33f2d 36%, #a51f19);
  clip-path: polygon(50% 100%, 0 0, 100% 0);
  border-radius: 4px 4px 50% 50%;
}
.lottery-pointer::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff8d8;
  transform: translateX(-50%);
  box-shadow: 0 0 8px #fff;
}

.lottery-start {
  position: absolute;
  z-index: 8;
  width: 106px;
  height: 106px;
  border-radius: 50%;
  padding: 0;
  border: 4px solid #ffe39a;
  background:
    radial-gradient(circle at 36% 28%, #fff0b0, #e9bd52 28%, #a86f17 62%, #5f3a08);
  color: #2b1a03;
  font: 900 18px/1.15 "Microsoft YaHei", sans-serif;
  text-align: center;
  cursor: pointer;
  box-shadow:
    0 0 0 3px #7a5012,
    0 0 0 7px #f3d47a,
    0 0 24px #ffd35c99,
    0 8px 18px #000b,
    inset 0 2px 0 #fff8d0, inset 0 -5px 9px #6b430b;
  text-shadow: 0 1px 0 #fff5c2;
  transition: transform .15s, filter .15s;
}
.lottery-start:active:not(:disabled) { transform: scale(.94); }
.lottery-start:disabled { filter: grayscale(.55) brightness(.75); cursor: default; }
.lottery-start span { display: block; transform: translateY(1px); }
.lottery-start::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  border: 1px solid rgba(91, 52, 4, .35);
  pointer-events: none;
}

.lottery-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: min(360px, 90vw);
  margin: 16px auto 0;
}
.lottery-stat {
  padding: 10px 12px;
  border: 1px solid var(--lottery-line);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(45, 35, 14, .86), rgba(10, 9, 6, .92));
  box-shadow: inset 0 1px 0 #ffe9aa1c, 0 4px 14px #0008;
}
.lottery-stat > span { display: block; color: var(--lottery-muted); font-size: 11px; }
.lottery-stat p { margin: 3px 0 0; display: flex; align-items: baseline; gap: 3px; }
.lottery-stat b { color: var(--lottery-gold-bright); font: 700 20px/1.1 Georgia, serif; font-variant-numeric: tabular-nums; }
.lottery-stat small { color: var(--lottery-muted); font-size: 10px; }
.lottery-stat.times p { justify-content: flex-start; }
.lottery-stat.times button {
  width: 22px;
  height: 22px;
  margin-left: auto;
  padding: 0;
  border: 1px solid #e2c26a;
  border-radius: 50%;
  background: linear-gradient(180deg, #f3d77f, #ad7d25);
  color: #2b1a03;
  font: 900 15px/1 "Microsoft YaHei", sans-serif;
  cursor: pointer;
  box-shadow: 0 2px 5px #0008, inset 0 1px 0 #fff2b8;
}
.lottery-stat.times button:active { transform: scale(.92); }

.lottery-draw-btn {
  display: block;
  width: min(360px, 90vw);
  min-height: 58px;
  margin: 18px auto 0;
  border: 2px solid #ffe9a2;
  border-radius: 999px;
  background:
    linear-gradient(180deg, #ffe9a0 0%, #f0c44d 32%, #c58b2a 72%, #8d5a12 100%);
  color: #2b1902;
  font: 900 22px/1.2 "Microsoft YaHei", sans-serif;
  letter-spacing: .08em;
  cursor: pointer;
  box-shadow:
    0 0 0 4px #6d450e,
    0 0 0 6px #f2d47a,
    0 0 26px #ffd45c88,
    0 10px 22px #000b,
    inset 0 2px 0 #fff9ce, inset 0 -5px 8px #7a4c0a;
  text-shadow: 0 1px 0 #fff3b5;
  transition: transform .15s, filter .15s;
}
.lottery-draw-btn:active:not(:disabled) { transform: translateY(1px) scale(.99); }
.lottery-draw-btn:disabled { filter: grayscale(.6) brightness(.72); cursor: default; }
.lottery-draw-btn.spinning { animation: lottery-pulse 1s ease-in-out infinite; }
@keyframes lottery-pulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.16); }
}

.lottery-tip {
  margin: 12px 0 0;
  color: #9f9278;
  font-size: 11px;
  text-align: center;
  line-height: 1.6;
}

.lottery-modal, .lottery-rules {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(3, 3, 5, .72);
  backdrop-filter: blur(6px);
}
.lottery-modal[hidden], .lottery-rules[hidden] { display: none; }
.lottery-modal-card {
  position: relative;
  width: min(320px, 90vw);
  padding: 28px 22px 22px;
  border: 1px solid #e6c66e;
  border-radius: 14px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(129, 90, 20, .55), transparent 65%),
    linear-gradient(180deg, #1b160c, #0a0906);
  text-align: center;
  box-shadow: 0 0 0 4px #0008, 0 0 34px #f2c44b44, 0 24px 60px #000c;
  animation: lottery-pop .28s cubic-bezier(.2, .9, .3, 1.3);
}
@keyframes lottery-pop { from { opacity: 0; transform: scale(.86) translateY(10px); } to { opacity: 1; transform: none; } }
.lottery-modal-icon { font-size: 48px; line-height: 1; filter: drop-shadow(0 4px 8px #0009); }
.lottery-modal-card h2 { margin: 10px 0 0; color: var(--lottery-gold-bright); font: 700 22px/1.2 Georgia, "Microsoft YaHei", serif; }
.lottery-modal-prize { margin: 10px 0 0; color: #fff; font: 900 30px/1.1 Georgia, "Microsoft YaHei", serif; text-shadow: 0 0 16px #f5c94e77; }
.lottery-modal-sub { margin: 8px 0 18px; color: #b3a586; font-size: 12px; }
.lottery-modal-card button {
  width: 100%;
  height: 46px;
  border: 1px solid #ffe7a2;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffe7a2, #e4b84a 45%, #a9741e);
  color: #2b1902;
  font: 900 16px/1 "Microsoft YaHei", sans-serif;
  cursor: pointer;
  box-shadow: inset 0 1px 0 #fff8cd, 0 4px 12px #000a;
}
.lottery-modal-card.lose .lottery-modal-prize { color: #c9bda6; font-size: 22px; }

.lottery-rules-card {
  width: min(380px, 94vw);
  max-height: 80vh;
  overflow: auto;
  padding: 18px;
  border: 1px solid #6c5528;
  border-radius: 12px;
  background: linear-gradient(180deg, #19150d, #0a0907);
  box-shadow: 0 20px 50px #000c;
}
.lottery-rules-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.lottery-rules-head h2 { margin: 0; color: var(--lottery-gold-bright); font: 700 18px/1.2 Georgia, "Microsoft YaHei", serif; }
.lottery-rules-head button {
  width: 28px; height: 28px; border: 1px solid #6c5528; border-radius: 50%;
  background: #151109; color: #d9c68f; font-size: 18px; line-height: 1; cursor: pointer;
}
.lottery-rules-card > p { margin: 12px 0 0; color: #a99b7e; font-size: 12px; line-height: 1.7; }
.lottery-rule-prizes { display: grid; gap: 6px; margin-top: 14px; }
.lottery-rule-prizes div {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 10px; border: 1px solid #2e281b; border-radius: 7px; background: #100e09; font-size: 12px;
}
.lottery-rule-prizes b { color: #efd792; }
.lottery-rule-prizes small { color: #9b8c6d; }

.lottery-toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  z-index: 90;
  max-width: 86vw;
  padding: 10px 16px;
  border: 1px solid #9b7a34;
  border-radius: 999px;
  background: rgba(18, 15, 8, .94);
  color: #f3e2b2;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, 10px);
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.lottery-toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 380px) {
  .lottery-header h1 { font-size: 20px; }
  .lottery-wheel-stage { width: 88vw; }
  .lottery-label b { font-size: 13px; }
  .lottery-label.thanks b { font-size: 11px; }
  .lottery-label i { font-size: 19px; }
  .lottery-start { width: 92px; height: 92px; font-size: 16px; }
  .lottery-draw-btn { font-size: 19px; }
}
