:root {
  --blue-700: #075ed8;
  --blue-600: #0876f9;
  --blue-500: #268aff;
  --blue-100: #eaf4ff;
  --yellow-500: #ffc928;
  --yellow-300: #ffdc67;
  --navy-900: #102349;
  --navy-700: #33476d;
  --line: #d8e3f3;
  --white: #ffffff;
  --shadow-soft: 0 10px 30px rgba(27, 84, 154, 0.12);
  --shadow-button: 0 8px 18px rgba(0, 105, 235, 0.24);
  --wheel-size: clamp(300px, 42vw, 430px);
  --motion-fast: 160ms;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  overflow-x: hidden;
  background: var(--white);
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--navy-900);
  background: var(--white);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible {
  outline: 3px solid rgba(38, 138, 255, 0.38);
  outline-offset: 3px;
}

.app-shell {
  width: min(100% - 32px, 760px);
  margin: 0 auto;
  padding: 42px 0 28px;
}

.hero {
  position: relative;
  text-align: center;
}

.hero h1 {
  margin: 0;
  color: var(--navy-900);
  font-size: clamp(34px, 6vw, 54px);
  font-weight: 900;
  line-height: 1.08;
  letter-spacing: -0.04em;
}

.hero h1 span {
  margin-right: 8px;
  color: var(--blue-600);
}

.hero p {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 13px 0 0;
  color: var(--navy-700);
  font-size: 17px;
}

.hero p::before,
.hero p::after {
  width: 32px;
  height: 2px;
  content: "";
  background: var(--blue-500);
  border-radius: 99px;
}

.title-row .spark {
  position: absolute;
  font-size: 18px;
  animation: twinkle 1.8s ease-in-out infinite alternate;
}

.title-row .spark-blue {
  top: 10px;
  left: calc(50% - 174px);
  color: var(--blue-500);
}

.title-row .spark-yellow {
  top: -5px;
  right: calc(50% - 176px);
  color: var(--yellow-500);
  animation-delay: 500ms;
}

.balance-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(100%, 520px);
  min-height: 92px;
  margin: 24px auto 10px;
  padding: 15px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--white);
  box-shadow: var(--shadow-soft);
}

.balance-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.coin-mark {
  display: grid;
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 3px solid var(--white);
  border-radius: 50%;
  color: var(--white);
  background: linear-gradient(145deg, #33a1ff, #0565ea);
  box-shadow: 0 0 0 2px #9dcaff, 0 5px 12px rgba(0, 105, 235, 0.22);
  font-size: 14px;
  font-weight: 900;
}

.balance-label,
.balance-value {
  margin: 0;
}

.balance-label {
  color: var(--navy-700);
  font-size: 14px;
}

.balance-value {
  display: flex;
  align-items: baseline;
  gap: 6px;
  white-space: nowrap;
}

.balance-value strong {
  color: var(--blue-600);
  font-size: 32px;
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
}

.balance-value span {
  color: var(--navy-700);
  font-size: 14px;
}

.button,
.spin-button,
.modal-button {
  cursor: pointer;
  border: 0;
  transition: transform var(--motion-fast) ease, box-shadow var(--motion-fast) ease, filter var(--motion-fast) ease, opacity var(--motion-fast) ease;
}

.button:hover,
.spin-button:hover,
.modal-button:hover {
  filter: brightness(1.035);
  transform: translateY(-1px) scale(1.015);
}

.button:active,
.spin-button:active,
.modal-button:active {
  transform: scale(0.965);
}

.claim-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding: 0 20px;
  border-radius: 11px;
  color: #2e2600;
  background: linear-gradient(180deg, #ffd832, #ffc20e);
  box-shadow: 0 7px 16px rgba(225, 167, 0, 0.2);
  font-size: 16px;
  font-weight: 800;
  white-space: nowrap;
}

.claim-button svg {
  width: 21px;
  height: 21px;
  fill: currentColor;
}

.claim-button:disabled {
  cursor: not-allowed;
  color: #8793a8;
  background: #e9eef5;
  box-shadow: none;
  filter: none;
  transform: none;
  opacity: 0.88;
}

.game-area {
  text-align: center;
}

.wheel-stage {
  position: relative;
  width: var(--wheel-size);
  height: calc(var(--wheel-size) + 24px);
  margin: 2px auto 0;
  padding-top: 24px;
}

.wheel {
  position: relative;
  width: var(--wheel-size);
  height: var(--wheel-size);
  border: clamp(8px, 1.2vw, 12px) solid var(--blue-600);
  border-radius: 50%;
  background: var(--blue-600);
  box-shadow: 0 16px 30px rgba(0, 99, 226, 0.22), inset 0 0 0 2px rgba(255, 255, 255, 0.85);
}

.wheel::after {
  position: absolute;
  z-index: 3;
  inset: 4px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  content: "";
  pointer-events: none;
}

.wheel-surface {
  position: absolute;
  inset: 8px;
  overflow: hidden;
  border-radius: 50%;
  will-change: transform;
  background: repeating-conic-gradient(from -18deg, var(--blue-500) 0 36deg, var(--yellow-300) 36deg 72deg);
  transition-property: transform;
  transition-timing-function: cubic-bezier(0.12, 0.66, 0.08, 1);
}

.wheel-surface::before {
  position: absolute;
  z-index: 1;
  inset: 0;
  border-radius: 50%;
  content: "";
  background: repeating-conic-gradient(from -18deg, transparent 0 35.6deg, rgba(255, 255, 255, 0.95) 35.6deg 36deg);
  pointer-events: none;
}

.wheel-label {
  position: absolute;
  z-index: 2;
  display: flex;
  width: 74px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-size: clamp(14px, 2.1vw, 19px);
  font-weight: 900;
  line-height: 1.04;
  text-align: center;
  text-shadow: 0 1px 1px rgba(0, 49, 115, 0.2);
  transform: translate(-50%, -50%);
  transform-origin: center;
  transition-property: transform;
  transition-timing-function: cubic-bezier(0.12, 0.66, 0.08, 1);
  will-change: transform;
}

.wheel-label:nth-child(even) {
  color: #15233c;
  text-shadow: none;
}

.wheel-label small {
  margin-top: 3px;
  font-size: 0.66em;
  font-weight: 800;
  white-space: nowrap;
}

.wheel-center-frame {
  position: absolute;
  z-index: 4;
  top: 50%;
  left: 50%;
  width: 29%;
  aspect-ratio: 1;
  border: 7px solid var(--white);
  border-radius: 50%;
  background: var(--blue-600);
  box-shadow: 0 4px 16px rgba(0, 67, 160, 0.3), inset 0 0 0 2px #9ed0ff;
  transform: translate(-50%, -50%);
}

.spin-button {
  position: absolute;
  z-index: 6;
  top: calc(50% + 12px);
  left: 50%;
  display: flex;
  width: 22%;
  min-width: 68px;
  max-width: 96px;
  aspect-ratio: 1;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  border: 0;
  border-radius: 50%;
  color: var(--white);
  background: linear-gradient(150deg, #409dff, #0565eb);
  box-shadow: var(--shadow-button);
  font-size: clamp(15px, 2.3vw, 21px);
  font-weight: 900;
  line-height: 1.05;
  transform: translate(-50%, -50%);
}

.spin-button:hover {
  transform: translate(-50%, -50%) scale(1.035);
}

.spin-button:active {
  transform: translate(-50%, -50%) scale(0.95);
}

.spin-button:disabled {
  cursor: wait;
  filter: saturate(0.55);
  opacity: 0.78;
  transform: translate(-50%, -50%);
}

.spin-button.is-unavailable {
  box-shadow: 0 5px 14px rgba(54, 78, 112, 0.18);
  filter: saturate(0.55);
}

.pointer {
  position: absolute;
  z-index: 8;
  top: 3px;
  left: 50%;
  width: 40px;
  height: 52px;
  border: 4px solid var(--white);
  border-radius: 22px 22px 28px 28px;
  background: var(--yellow-500);
  box-shadow: 0 5px 12px rgba(50, 66, 93, 0.28);
  transform: translateX(-50%);
  pointer-events: none;
}

.pointer::after {
  position: absolute;
  left: 50%;
  bottom: -7px;
  width: 16px;
  height: 16px;
  content: "";
  background: var(--yellow-500);
  transform: translateX(-50%) rotate(45deg);
}

.pointer span {
  position: absolute;
  z-index: 1;
  top: 8px;
  left: 50%;
  width: 13px;
  height: 13px;
  border: 3px solid var(--white);
  border-radius: 50%;
  transform: translateX(-50%);
}

.remaining-text {
  margin: 17px 0 0;
  color: var(--navy-700);
  font-size: 20px;
}

.remaining-text strong {
  display: inline-block;
  margin: 0 3px;
  color: var(--blue-600);
  font-size: 30px;
  font-variant-numeric: tabular-nums;
}

.rules {
  width: min(100%, 530px);
  margin: 26px auto 0;
}

.rules h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 11px;
  font-size: 19px;
}

.rules h2 svg {
  width: 25px;
  height: 25px;
  padding: 4px;
  border-radius: 6px;
  fill: var(--white);
  background: var(--blue-600);
}

.rules ul {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px 20px;
  margin: 0;
  padding: 17px 19px;
  border: 1px solid var(--line);
  border-radius: 14px;
  list-style: none;
  background: linear-gradient(145deg, #fff, #f8fbff);
}

.rules li {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--navy-700);
  font-size: 14px;
}

.rules li span {
  display: grid;
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 50%;
  color: var(--white);
  background: var(--blue-600);
  font-size: 12px;
  font-weight: 900;
}

.page-footer {
  padding-top: 28px;
  text-align: center;
}

.reset-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 4px;
  cursor: pointer;
  border: 0;
  border-bottom: 1px dashed #aab5c7;
  color: #78869e;
  background: transparent;
  font-size: 13px;
  transition: color var(--motion-fast) ease, transform var(--motion-fast) ease;
}

.reset-button:hover {
  color: var(--blue-600);
  transform: translateY(-1px);
}

.reset-button:active {
  transform: scale(0.96);
}

.reset-button svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.modal {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: grid;
  visibility: hidden;
  place-items: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 180ms ease, visibility 180ms ease;
}

.modal.is-open {
  visibility: visible;
  opacity: 1;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 31, 68, 0.46);
  backdrop-filter: blur(3px);
}

.modal-card {
  position: relative;
  width: min(100%, 360px);
  padding: 30px 26px 24px;
  border: 1px solid rgba(216, 227, 243, 0.95);
  border-radius: 20px;
  background: var(--white);
  box-shadow: 0 24px 70px rgba(5, 37, 87, 0.28);
  text-align: center;
  transform: translateY(12px) scale(0.96);
  transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.modal.is-open .modal-card {
  transform: translateY(0) scale(1);
}

.modal-close {
  position: absolute;
  top: 11px;
  right: 11px;
  display: grid;
  width: 34px;
  height: 34px;
  padding: 7px;
  cursor: pointer;
  border: 0;
  border-radius: 50%;
  place-items: center;
  color: #71809a;
  background: transparent;
  transition: background var(--motion-fast) ease, transform var(--motion-fast) ease;
}

.modal-close:hover {
  background: var(--blue-100);
  transform: rotate(4deg);
}

.modal-close:active {
  transform: scale(0.92);
}

.modal-close svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.modal-icon {
  display: grid;
  width: 76px;
  height: 76px;
  margin: 0 auto 14px;
  place-items: center;
  border: 5px solid #fff2ad;
  border-radius: 50%;
  color: #e79800;
  background: linear-gradient(145deg, #fff2a5, #ffd33d);
  box-shadow: 0 0 0 2px #ffc829;
  font-size: 33px;
  font-weight: 900;
}

.modal-icon.is-info {
  border-color: #d7eaff;
  color: var(--blue-600);
  background: var(--blue-100);
  box-shadow: 0 0 0 2px #8ec4ff;
}

.modal-icon.is-warning {
  border-color: #ffe9b1;
  color: #bf7900;
  background: #fff5d7;
  box-shadow: 0 0 0 2px #ffd66c;
}

.modal-card h2 {
  margin: 0;
  color: var(--blue-600);
  font-size: 25px;
}

.modal-card p {
  min-height: 46px;
  margin: 10px 0 20px;
  color: var(--navy-700);
  font-size: 16px;
  line-height: 1.65;
}

.modal-actions {
  display: flex;
  gap: 10px;
}

.modal-button {
  flex: 1;
  min-height: 46px;
  border-radius: 10px;
  color: var(--white);
  background: var(--blue-600);
  box-shadow: var(--shadow-button);
  font-weight: 800;
}

.modal-button.secondary {
  color: var(--navy-700);
  background: #eef3f9;
  box-shadow: none;
}

.modal-button.danger {
  background: #e84f55;
  box-shadow: 0 8px 18px rgba(211, 55, 65, 0.22);
}

.confetti-layer {
  position: fixed;
  z-index: 60;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.confetti {
  position: absolute;
  top: -18px;
  width: 9px;
  height: 14px;
  border-radius: 2px;
  opacity: 0;
  animation: confetti-fall 1.9s ease-out forwards;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes twinkle {
  from { opacity: 0.42; transform: scale(0.82) rotate(-8deg); }
  to { opacity: 1; transform: scale(1.12) rotate(8deg); }
}

@keyframes confetti-fall {
  0% { opacity: 1; transform: translate3d(0, -10px, 0) rotate(0); }
  100% { opacity: 0; transform: translate3d(var(--drift), 105vh, 0) rotate(var(--turn)); }
}

@media (max-width: 560px) {
  :root {
    --wheel-size: min(86vw, 348px);
  }

  .app-shell {
    width: min(100% - 24px, 480px);
    padding-top: 28px;
  }

  .hero h1 {
    font-size: clamp(33px, 10.4vw, 45px);
  }

  .hero p {
    margin-top: 9px;
    font-size: 15px;
  }

  .title-row .spark-blue {
    left: 4%;
  }

  .title-row .spark-yellow {
    right: 4%;
  }

  .balance-panel {
    min-height: 80px;
    margin-top: 19px;
    padding: 12px;
    border-radius: 14px;
  }

  .coin-mark {
    flex-basis: 40px;
    width: 40px;
    height: 40px;
    font-size: 12px;
  }

  .balance-info {
    gap: 9px;
  }

  .balance-value strong {
    font-size: 27px;
  }

  .claim-button {
    min-height: 46px;
    padding: 0 12px;
    font-size: 14px;
  }

  .claim-button svg {
    width: 18px;
    height: 18px;
  }

  .wheel-stage {
    margin-top: 5px;
  }

  .wheel-label {
    width: 58px;
  }

  .remaining-text {
    margin-top: 13px;
    font-size: 18px;
  }

  .remaining-text strong {
    font-size: 27px;
  }

  .rules {
    margin-top: 22px;
  }

  .rules ul {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 15px 17px;
  }
}

@media (max-width: 365px) {
  .app-shell {
    width: min(100% - 18px, 480px);
  }

  .balance-label {
    font-size: 12px;
  }

  .balance-value strong {
    font-size: 24px;
  }

  .balance-value span {
    font-size: 12px;
  }

  .claim-button {
    padding: 0 9px;
    font-size: 13px;
  }

  .claim-button svg {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
