:root {
  color-scheme: dark;
  --polish-bg: #07110f;
  --polish-surface: #0d1916;
  --polish-surface-raised: #12211d;
  --polish-line: rgba(209, 225, 212, 0.13);
  --polish-line-strong: rgba(229, 193, 103, 0.34);
  --polish-text: #f3f0e7;
  --polish-muted: #a8b8af;
  --polish-jade: #55b494;
  --polish-gold: #e3bd67;
  --polish-red: #d46f61;
  --polish-radius: 18px;
  --polish-shadow: 0 20px 55px rgba(0, 0, 0, 0.26);
}

html {
  background: var(--polish-bg);
  scrollbar-color: rgba(85, 180, 148, 0.52) transparent;
  scrollbar-width: thin;
}

body {
  background:
    radial-gradient(circle at 12% 2%, rgba(85, 180, 148, 0.09), transparent 28rem),
    radial-gradient(circle at 92% 10%, rgba(227, 189, 103, 0.08), transparent 26rem),
    var(--polish-bg);
  color: var(--polish-text);
}

button,
a,
input {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--polish-gold);
  outline-offset: 3px;
}

.app-shell {
  width: min(100%, 1540px);
  margin-inline: auto;
  padding-inline: clamp(12px, 2.2vw, 34px);
}

.site-header {
  top: 0;
  z-index: 30;
  min-height: 72px;
  padding: 12px clamp(12px, 1.6vw, 24px);
  border: 1px solid transparent;
  border-bottom-color: var(--polish-line);
  background: rgba(7, 17, 15, 0.92);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.16);
  backdrop-filter: none;
}

.header-brand img {
  width: 36px;
  height: 36px;
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.28));
}

.header-brand strong {
  letter-spacing: 0.05em;
}

.header-brand span,
.section-kicker,
.pool-progress-reset,
.record-count,
.site-footer {
  color: var(--polish-muted);
}

.header-summary {
  max-width: min(56vw, 720px);
}

.account-bar {
  border-color: var(--polish-line);
  background: linear-gradient(135deg, rgba(18, 33, 29, 0.96), rgba(12, 25, 22, 0.96));
  box-shadow: none;
}

.account-metric strong,
.draw-counter strong,
.reward-prize-value,
.pool-progress-heading > strong {
  color: var(--polish-text);
  font-variant-numeric: tabular-nums;
}

.icon-command,
.account-link,
.history-retry,
.state-action,
.state-page-action {
  border-color: var(--polish-line);
  background: rgba(255, 255, 255, 0.035);
  color: var(--polish-text);
  transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.icon-command:hover,
.account-link:hover,
.history-retry:hover:not(:disabled),
.state-action:hover,
.state-page-action:hover {
  border-color: rgba(85, 180, 148, 0.52);
  background: rgba(85, 180, 148, 0.1);
  color: #dff8ec;
  transform: translateY(-1px);
}

.lottery-viewport,
.detail-layout {
  content-visibility: auto;
  contain-intrinsic-size: 900px;
}

.primary-layout,
.detail-layout,
.secondary-layout {
  gap: clamp(14px, 1.8vw, 26px);
}

.wheel-stage,
.legend-panel,
.pool-progress,
.access-window,
.benefit-section,
.history-section,
.rule-block,
.result-dialog,
.rules-drawer {
  border-color: var(--polish-line);
  background: linear-gradient(155deg, rgba(18, 33, 29, 0.98), rgba(10, 22, 19, 0.98));
  box-shadow: none;
}

.wheel-stage {
  position: relative;
  overflow: hidden;
}

.wheel-stage::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--polish-jade), var(--polish-gold), transparent 88%);
  opacity: 0.88;
}

.wheel-shell {
  filter: none;
}

.wheel-rotor {
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.1),
    0 22px 52px rgba(0, 0, 0, 0.34);
  will-change: auto;
  backface-visibility: hidden;
}

.wheel-rotor-spinning {
  will-change: transform;
}

.wheel-number {
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.58);
}

.draw-button {
  border: 1px solid rgba(227, 189, 103, 0.55);
  background: linear-gradient(145deg, #edcd81, #c99739);
  color: #1b160b;
  box-shadow: 0 12px 30px rgba(201, 151, 57, 0.24);
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

.draw-button:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: brightness(1.04);
  box-shadow: 0 16px 36px rgba(201, 151, 57, 0.31);
}

.draw-button:active:not(:disabled) {
  transform: translateY(0);
}

.draw-button:disabled {
  box-shadow: none;
  filter: saturate(0.35);
}

.legend-number,
.pool-tier-number,
.reward-zone-marker {
  border-color: var(--polish-line);
  background: rgba(255, 255, 255, 0.045);
}

.reward-prize,
.benefit-row,
.history-row,
.sponsorship-access,
.demo-controls {
  border-color: var(--polish-line);
  background: rgba(255, 255, 255, 0.025);
  transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.reward-prize:hover,
.benefit-row:hover,
.history-row:hover {
  border-color: rgba(85, 180, 148, 0.32);
  background: rgba(85, 180, 148, 0.055);
  transform: translateY(-1px);
}

.pool-tier-current {
  border-color: var(--polish-line-strong);
  background: rgba(227, 189, 103, 0.075);
}

.pool-tier-reached .pool-tier-number {
  border-color: rgba(85, 180, 148, 0.45);
  background: rgba(85, 180, 148, 0.14);
  color: #bcf0da;
}

.inline-alert {
  border-color: rgba(212, 111, 97, 0.45);
  background: rgba(212, 111, 97, 0.1);
  color: #ffd5cf;
}

.dialog-backdrop,
.drawer-backdrop {
  background: rgba(2, 8, 7, 0.78);
  backdrop-filter: blur(5px);
}

.result-dialog,
.rules-drawer {
  box-shadow: var(--polish-shadow);
}

.site-footer {
  border-top-color: var(--polish-line);
}

@media (max-width: 900px) {
  .app-shell {
    padding-inline: 10px;
  }

  .site-header {
    min-height: 62px;
    padding-inline: 10px;
  }

  .header-brand span,
  .header-summary {
    display: none;
  }

  .header-actions {
    margin-left: auto;
  }

  .icon-command,
  .account-link {
    min-height: 40px;
  }

  .wheel-stage,
  .legend-panel,
  .pool-progress,
  .access-window,
  .benefit-section,
  .history-section {
    border-radius: 14px;
  }
}

@media (max-width: 560px) {
  .site-header {
    position: sticky;
  }

  .header-brand img {
    width: 32px;
    height: 32px;
  }

  .account-link span {
    max-width: 84px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .draw-button {
    width: 142px;
    height: 142px;
  }
  }

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
  }

  .spin-icon,
  .wheel-rotor-spinning {
    animation-duration: 1ms !important;
  }

  .icon-command,
  .account-link,
  .history-retry,
  .state-action,
  .state-page-action,
  .draw-button,
  .reward-prize,
  .benefit-row,
  .history-row {
    transition-duration: 1ms !important;
  }
}


/* ==== Wheel polish (activity wheel only): glare/glow + pointer jitter ====
   Pseudo-element effects only. The rotor transform remains the sole source of
   the spin; onTransitionEnd guard is untouched. */
.wheel-shell::before{
  content:"";position:absolute;inset:-8px;border-radius:50%;pointer-events:none;z-index:0;
  background:radial-gradient(circle,transparent 62%,rgba(255,214,140,0) 66%,rgba(255,214,140,.55) 72%,rgba(255,214,140,0) 78%);
  opacity:.45;animation:lotEdgeGlow 2.6s ease-in-out infinite;
}
.wheel-shell:has(.wheel-rotor-spinning)::after{
  content:"";position:absolute;inset:3%;border-radius:50%;pointer-events:none;z-index:6;mix-blend-mode:screen;
  background:conic-gradient(from 0deg,rgba(255,255,255,0) 0 78deg,rgba(255,236,190,.12) 92deg,rgba(255,255,255,.24) 102deg,rgba(255,236,190,.12) 112deg,rgba(255,255,255,0) 126deg 360deg);
  animation:lotGlareSweep 2.1s linear infinite;
}
.wheel-shell:has(.wheel-rotor-spinning) .wheel-pointer{animation:lotPointerJitter .09s linear infinite}
@keyframes lotEdgeGlow{0%,100%{opacity:.3}50%{opacity:.6}}
@keyframes lotGlareSweep{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}
@keyframes lotPointerJitter{
  0%,100%{transform:translate(-50%) rotate(0deg)}
  25%{transform:translate(-50%) rotate(1.6deg)}
  50%{transform:translate(-50%) rotate(-1.2deg)}
  75%{transform:translate(-50%) rotate(1deg)}
}
@media (prefers-reduced-motion: reduce){
  .wheel-shell::before,.wheel-shell:has(.wheel-rotor-spinning)::after,
  .wheel-shell:has(.wheel-rotor-spinning) .wheel-pointer{
    animation-duration:1ms !important;animation-iteration-count:1 !important;
  }
}
/* ==== Wheel polish v2 (activity wheel only) ================================
   Pseudo-element + box-shadow only. The rotor transform stays the SOLE source
   of the spin: no animation/transition is ever placed on .wheel-rotor/.wheel-
   rotor-spinning's own transform, so React's transform transitionend callback
   and the aligned final angle are untouched. Recoil is applied to the POINTER
   (a sibling element). ===================================================== */
.wheel-shell {
  border-radius: 50%;
  background:
    conic-gradient(from 215deg at 50% 50%, #24313f, #0c1420 28%, #2a3746 50%, #0b131f 72%, #16212c),
    linear-gradient(145deg, #2d3745, #0c141f);
  box-shadow:
    0 0 0 1px rgba(229, 243, 238, 0.14),
    0 0 0 12px rgba(16, 41, 60, 0.92),
    0 0 0 13px rgba(255, 255, 255, 0.07),
    0 0 0 19px rgba(16, 41, 60, 0.34),
    0 0 0 20px rgba(255, 255, 255, 0.02),
    0 32px 70px rgba(0, 0, 0, 0.5);
}

.wheel-shell::before {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(circle at 30% 22%, rgba(255, 255, 255, 0.20), transparent 30%),
    radial-gradient(circle, transparent 62%, rgba(255, 214, 140, 0) 66%, rgba(255, 214, 140, 0.55) 72%, rgba(255, 214, 140, 0) 78%);
  opacity: 0.5;
  animation: lotEdgeGlow 2.6s ease-in-out infinite;
}

/* Static specular top-light that always rests on the metal bezel. */
.wheel-shell::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
  z-index: 3;
  background:
    radial-gradient(circle at 32% 20%, rgba(255, 255, 255, 0.10), transparent 34%),
    radial-gradient(circle at 72% 84%, rgba(227, 189, 103, 0.06), transparent 42%);
}

/* Rotor depth: barrel falloff toward the hub without touching transform. */
.wheel-rotor {
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.10),
    inset 0 16px 32px rgba(7, 17, 31, 0.52),
    inset 0 -12px 26px rgba(7, 17, 31, 0.46),
    0 0 0 1px rgba(255, 255, 255, 0.12),
    0 0 0 9px #10293c,
    0 0 0 10px rgba(255, 255, 255, 0.05),
    0 0 0 14px rgba(16, 41, 60, 0.6),
    0 24px 58px rgba(0, 0, 0, 0.5);
  filter: saturate(1.06) brightness(1.02);
}

.wheel-rotor-spinning {
  will-change: transform;
}

/* Pointer: metallic gloss. transform stays inline-controlled (+ translate). */
.wheel-pointer {
  filter: drop-shadow(0 0 6px rgba(227, 189, 103, 0.5)) drop-shadow(0 6px 12px rgba(0, 0, 0, 0.6));
  transition: transform 0.18s cubic-bezier(0.22, 1.2, 0.36, 1);
}

/* Rotating glossy scan + mechanical pointer jitter while spinning. */
.wheel-shell:has(.wheel-rotor-spinning)::after {
  background:
    conic-gradient(from 0deg,
      rgba(255, 255, 255, 0) 0deg 8deg,
      rgba(255, 236, 190, 0.0) 20deg,
      rgba(255, 255, 255, 0.28) 36deg,
      rgba(255, 236, 190, 0.12) 50deg,
      rgba(255, 255, 255, 0) 64deg),
    radial-gradient(circle at 32% 20%, rgba(255, 255, 255, 0.10), transparent 34%),
    radial-gradient(circle at 72% 84%, rgba(227, 189, 103, 0.06), transparent 42%);
  mix-blend-mode: screen;
  animation: lotGlareSweep 2.1s linear infinite;
}
.wheel-shell:has(.wheel-rotor-spinning) .wheel-pointer {
  animation: lotPointerJitter 0.09s linear infinite;
  transition: none;
}

@keyframes lotEdgeGlow { 0%, 100% { opacity: 0.32; } 50% { opacity: 0.62; } }
@keyframes lotGlareSweep { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes lotPointerJitter {
  0%, 100% { transform: translate(-50%) rotate(0deg); }
  25%      { transform: translate(-50%) translateY(-1px) rotate(1.8deg); }
  50%      { transform: translate(-50%) translateY(1px) rotate(-1.3deg); }
  75%      { transform: translate(-50%) rotate(1.1deg); }
}

/* Stop recoil: the moment the spinning flag drops, this one-shot settle runs
   on the POINTER (a sibling, never the rotor) to give a spring-back feel. It
   also plays once on load, which is subtle and harmless. */
.wheel-shell:not(:has(.wheel-rotor-spinning)) .wheel-pointer {
  animation: lotPointerSettle 0.5s cubic-bezier(0.24, 1.5, 0.4, 1) both;
}
@keyframes lotPointerSettle {
  0%   { transform: translate(-50%) rotate(2.2deg); }
  55%  { transform: translate(-50%) rotate(-0.8deg); }
  100% { transform: translate(-50%) rotate(0deg); }
}

@media (prefers-reduced-motion: reduce) {
  .wheel-shell::before,
  .wheel-shell::after,
  .wheel-shell:has(.wheel-rotor-spinning)::after,
  .wheel-shell:has(.wheel-rotor-spinning) .wheel-pointer,
  .wheel-shell:not(:has(.wheel-rotor-spinning)) .wheel-pointer {
    animation: none !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
  }
  .wheel-pointer {
    transition: none !important;
  }
}


/* ===== 连抽（五/十连）===== */
.draw-batch-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.draw-batch-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 96px;
  padding: 8px 14px;
  border: 1px solid rgba(227, 189, 103, 0.5);
  border-radius: 8px;
  background: linear-gradient(160deg, #12303f, #0d2533);
  color: var(--polish-gold, #e5b957);
  cursor: pointer;
  font-weight: 700;
  transition: transform 160ms ease, filter 160ms ease;
}
.draw-batch-btn strong { font-size: 14px; line-height: 1.2; }
.draw-batch-btn span { font-size: 11px; color: var(--polish-muted, #8aa0b5); line-height: 1.2; }
.draw-batch-btn:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.06); }
.draw-batch-btn:disabled { cursor: not-allowed; filter: saturate(0.35); opacity: 0.55; }

.batch-dialog {
  position: relative;
  width: min(100%, 520px);
  max-height: min(90vh, 760px);
  overflow-y: auto;
  padding: 24px;
  border: 1px solid var(--polish-line, #26384a);
  border-top: 4px solid var(--polish-gold, #e5b957);
  border-radius: 7px;
  background: linear-gradient(155deg, rgba(18, 33, 29, 0.98), rgba(10, 22, 19, 0.98));
  box-shadow: 0 28px 80px #00000094;
  text-align: center;
}
.batch-dialog-head p { margin: 2px 0 4px; color: var(--polish-muted, #8aa0b5); font-size: 12px; }
.batch-dialog-head h2 { margin: 0 0 12px; font-size: 20px; }
.batch-dialog-list {
  display: grid;
  gap: 6px;
  margin: 14px 0 16px;
  padding: 0;
  list-style: none;
  text-align: left;
}
.batch-dialog-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--polish-line, #26384a);
  border-left: 3px solid var(--prize-color, var(--polish-gold));
  border-radius: 6px;
  background: #ffffff08;
}
.batch-dialog-item-zone {
  flex: 0 0 auto;
  min-width: 88px;
  color: var(--polish-muted, #8aa0b5);
  font-size: 12px;
}
.batch-dialog-item-copy {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}
.batch-dialog-item-copy strong { font-size: 14px; }
.batch-dialog-item-copy small { color: var(--polish-muted, #8aa0b5); font-size: 11px; }

@media (max-width: 560px) {
  .draw-batch-row { margin-top: 8px; }
  .draw-batch-btn { min-width: 88px; padding: 7px 10px; }
}

/* ===== First-load performance v1 ==========================================
   Keep below-the-fold records out of the initial paint/layout workload and
   only run the decorative bezel pulse while the wheel is actually spinning.
   ======================================================================= */
@supports (content-visibility: auto) {
  .secondary-layout,
  .site-footer {
    content-visibility: auto;
    contain-intrinsic-size: auto 360px;
  }

  .benefit-row,
  .history-row {
    content-visibility: auto;
    contain-intrinsic-size: auto 64px;
  }
}

.wheel-shell::before {
  animation: none;
  opacity: 0.42;
}

.wheel-shell:has(.wheel-rotor-spinning)::before {
  animation: lotEdgeGlow 2.6s ease-in-out infinite;
}

/* ===== First-load performance v2 ==========================================
   Keep idle wheel labels out of permanent compositor layers. Promote only
   during the real spin and isolate the moving glare to the wheel stacking
   context, reducing first-paint GPU allocation and animation repaint scope.
   ======================================================================= */
.wheel-shell {
  isolation: isolate;
}

.wheel-number {
  will-change: auto;
  backface-visibility: hidden;
}

.wheel-rotor-spinning .wheel-number {
  will-change: transform;
}

.wheel-shell:has(.wheel-rotor-spinning)::after {
  will-change: transform;
  backface-visibility: hidden;
}

/* Reward expiry and redemption limits are essential terms, not truncated hints. */
.legend-panel .reward-zone-heading small {
  display: block;
  overflow: visible;
  -webkit-line-clamp: unset;
}

/* Long reward terms must not force an implicit grid column beyond the viewport. */
.detail-layout {
  grid-template-columns: minmax(0, 1fr);
}
