*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background:
    radial-gradient(circle at 0% 0%, rgba(123, 97, 255, 0.28), transparent 55%),
    radial-gradient(circle at 100% 0%, rgba(0, 221, 255, 0.18), transparent 55%),
    radial-gradient(circle at 50% 100%, rgba(111, 231, 255, 0.18), transparent 55%),
    radial-gradient(circle at top, #05041d, #050016 60%, #010008 100%);
  color: #f5f5f5;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: -40px;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.15) 0, transparent 60%);
  opacity: 0.16;
  mix-blend-mode: screen;
  animation: starDrift 22s linear infinite;
  pointer-events: none;
  z-index: -1;
}

.app {
  text-align: center;
  padding: 28px 24px 32px;
  max-width: 520px;
  background: radial-gradient(circle at top, rgba(8, 10, 40, 0.96), rgba(5, 3, 27, 0.96));
  border-radius: 24px;
  box-shadow:
    0 0 0 1px rgba(183, 135, 255, 0.45),
    0 0 35px rgba(124, 61, 255, 0.75),
    0 0 60px rgba(0, 229, 255, 0.5);
  position: relative;
  overflow: hidden;
}

@media (min-width: 900px) {
  .app {
    max-width: 720px;
    padding: 42px 44px 48px;
    min-height: 0;
  }

  .app-header {
    margin-bottom: 38px;
  }
}

.app::before {
  content: '';
  position: absolute;
  inset: -2px;
  background: conic-gradient(
    from 0deg,
    rgba(103, 58, 183, 0.16),
    rgba(33, 150, 243, 0.5),
    rgba(156, 39, 176, 0.7),
    rgba(255, 235, 59, 0.4),
    rgba(33, 150, 243, 0.5),
    rgba(103, 58, 183, 0.16)
  );
  opacity: 0.9;
  filter: blur(8px);
  z-index: -1;
  animation: rotateAura 18s linear infinite;
}

.app-header {
  margin-bottom: 30px;
  position: static;
}

h1 {
  margin-bottom: 8px;
  font-size: 3rem;
}

.neon-title {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 700;
  background: linear-gradient(120deg, #fff7c0, #b39dff, #6ecbff, #f48fb1);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow:
    0 0 14px rgba(255, 0, 195, 0.8),
    0 0 24px rgba(0, 234, 255, 0.75);
}

p {
  margin-bottom: 24px;
  font-size: 0.95rem;
  color: #d0d0e0;
}

.subtitle {
  color: #f5e9ff;
  opacity: 0.95;
}

.tag-row {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
  width: 100%;
  flex-wrap: nowrap;
}

.lang-toggle {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(0, 0, 0, 0.25);
  cursor: pointer;
  box-shadow:
    0 0 0 1px rgba(183, 135, 255, 0.25),
    0 0 14px rgba(0, 229, 255, 0.35);
}

.lang-icon {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  display: block;
  object-fit: cover;
}

.lang-toggle:hover:not(:disabled),
.lang-toggle:active:not(:disabled) {
  transform: none;
}

.tag {
  appearance: none;
  cursor: pointer;
  font: inherit;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: radial-gradient(circle at 0 0, rgba(255, 255, 255, 0.19), transparent 60%);
  box-shadow:
    0 0 10px rgba(255, 255, 255, 0.18),
    0 0 22px rgba(123, 31, 162, 0.68);
  backdrop-filter: blur(6px);
  white-space: nowrap;
  min-width: 0;
  width: 100%;
  height: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 0;
  text-align: center;
}

.tag--selected {
  border-color: rgba(255, 255, 255, 0.65);
  box-shadow:
    0 0 10px rgba(255, 255, 255, 0.22),
    0 0 26px rgba(0, 229, 255, 0.55),
    0 0 34px rgba(123, 31, 162, 0.72);
}

.tag:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  box-shadow: none;
}

.tag:focus-visible {
  outline: 2px solid rgba(0, 229, 255, 0.55);
  outline-offset: 2px;
}

.tag--lucky {
  border-color: rgba(255, 193, 7, 0.8);
  color: #ffe9a0;
  letter-spacing: 0.08em;
}

.tag--horoscope {
  border-color: rgba(103, 58, 183, 0.9);
  color: #d1c4e9;
}

.tag--fortune {
  border-color: rgba(3, 169, 244, 0.9);
  color: #b3e5fc;
}

.tag--hidden {
  display: none !important;
}

.tag--done {
  white-space: normal;
  text-transform: none;
  letter-spacing: 0.02em;
  line-height: 1.25;
  padding: 10px 14px;
  border-color: rgba(0, 229, 255, 0.55);
  color: #eaffff;
  box-shadow:
    0 0 14px rgba(0, 229, 255, 0.55),
    0 0 22px rgba(255, 32, 121, 0.45),
    0 0 30px rgba(123, 31, 162, 0.65);
  pointer-events: none;
}

@media (max-width: 520px) {
  .tag-row {
    gap: 6px;
  }

  .tag {
    padding: 4px 8px;
    font-size: 0.62rem;
    letter-spacing: 0.09em;
    line-height: 1.05;
    min-height: 18px;
  }

  .tag--lucky {
    font-size: 0.56rem;
    letter-spacing: 0.05em;
    white-space: nowrap;
  }
}

.wheel-container {
  --wheel-size: 320px;
  --wheel-inset: calc(var(--wheel-size) * 0.05625);
  --wheel-border: calc(var(--wheel-size) * 0.025);
  --wheel-shadow: calc(var(--wheel-size) * 0.05625);
  --wheel-glow-cyan: calc(var(--wheel-size) * 0.09375);
  --wheel-glow-pink: calc(var(--wheel-size) * 0.171875);
  --pointer-half: calc(var(--wheel-size) * 0.03125);
  --pointer-height: calc(var(--wheel-size) * 0.0625);
  --pointer-glow-soft: calc(var(--wheel-size) * 0.0125);
  --pointer-glow-strong: calc(var(--wheel-size) * 0.03125);
  --wheel-before-blur: calc(var(--wheel-size) * 0.0125);

  position: relative;
  width: min(var(--wheel-size), 100%);
  aspect-ratio: 1;
  margin: 0 auto 24px;
  filter: drop-shadow(0 0 var(--wheel-shadow) rgba(0, 229, 255, 0.7));
}

.wheel-container::before {
  content: '';
  position: absolute;
  inset: var(--wheel-inset);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.09), transparent 60%);
  opacity: 0.75;
  filter: blur(var(--wheel-before-blur));
  z-index: -1;
}

.wheel {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: var(--wheel-border) solid rgba(255, 255, 255, 0.18);
  background: url('/Background_round.png') center center / 105% 105% no-repeat;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.18),
    0 0 var(--wheel-glow-cyan) rgba(0, 229, 255, 0.9),
    0 0 var(--wheel-glow-pink) rgba(255, 64, 129, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: transform 6s cubic-bezier(0.23, 1, 0.32, 1);
}

.wheel::before {
  content: '';
  position: absolute;
  width: 30%;
  height: 30%;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, #ffe082 0%, #ffb300 45%, transparent 65%);
  box-shadow:
    0 0 12px rgba(255, 241, 118, 0.9),
    0 0 26px rgba(255, 213, 79, 0.8);
  clip-path: polygon(
    50% 0%,
    58.3% 19.1%,
    75% 6.7%,
    72.6% 27.4%,
    93.3% 25%,
    80.9% 41.7%,
    100% 50%,
    80.9% 58.3%,
    93.3% 75%,
    72.6% 72.6%,
    75% 93.3%,
    58.3% 80.9%,
    50% 100%,
    41.7% 80.9%,
    25% 93.3%,
    27.4% 72.6%,
    6.7% 75%,
    19.1% 58.3%,
    0% 50%,
    19.1% 41.7%,
    6.7% 25%,
    27.4% 27.4%,
    25% 6.7%,
    41.7% 19.1%
  );
}

.wheel::after {
  content: '';
  position: absolute;
  width: 40%;
  height: 40%;
  border-radius: 50%;
  box-shadow:
    0 0 18px rgba(255, 241, 118, 0.5),
    0 0 40px rgba(255, 213, 79, 0.35);
}

.sun-face {
  position: absolute;
  width: 10%;
  height: 10%;
  border-radius: 50%;
  background:
    radial-gradient(circle, #fffdf3 0%, #ffe082 38%, #ffca28 68%, #ff8f00 88%, #ff6f00 100%);
  border: 2px solid rgba(255, 244, 214, 0.9);
  box-shadow:
    0 0 8px rgba(255, 255, 255, 0.9),
    0 0 20px rgba(255, 241, 118, 0.9);
  animation: sunPulse 3s ease-in-out infinite;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pointer {
  position: absolute;
  top: calc(var(--wheel-inset) * -1);
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: var(--pointer-half) solid transparent;
  border-right: var(--pointer-half) solid transparent;
  border-top: var(--pointer-height) solid #ffeb3b;
  filter:
    drop-shadow(0 0 var(--pointer-glow-soft) rgba(255, 255, 255, 0.95))
    drop-shadow(0 0 var(--pointer-glow-strong) rgba(255, 235, 59, 0.9));
}

@media (min-width: 900px) {
  .wheel-container {
    --wheel-size: clamp(360px, calc(100vh - 420px), 520px);
  }
}

button {
  padding: 10px 20px;
  font-size: 1rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: linear-gradient(135deg, #ff9800, #ff2079);
  color: #fff;
  cursor: pointer;
  box-shadow:
    0 0 14px rgba(255, 32, 121, 0.95),
    0 8px 26px rgba(0, 0, 0, 0.7);
  transition: transform 0.1s ease, box-shadow 0.1s ease, opacity 0.2s ease;
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.9);
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow:
    0 0 20px rgba(255, 82, 164, 1),
    0 14px 32px rgba(0, 0, 0, 0.85);
}

button:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow:
    0 0 10px rgba(255, 82, 164, 0.95),
    0 6px 16px rgba(0, 0, 0, 0.8);
}

button:disabled {
  opacity: 0.5;
  cursor: default;
}

#spinButton:disabled {
  opacity: 0.35;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: none;
  text-shadow: none;
}

#spinButton.spin-button--ready {
  box-shadow:
    0 0 18px rgba(0, 229, 255, 0.75),
    0 0 24px rgba(255, 32, 121, 0.95),
    0 10px 28px rgba(0, 0, 0, 0.72);
}

.result {
  margin-top: 16px;
  min-height: 24px;
  font-size: 1.05rem;
  font-weight: 500;
  color: #ffe082;
  text-shadow:
    0 0 10px rgba(255, 241, 118, 0.9),
    0 0 16px rgba(255, 193, 7, 0.9);
  border-top: 1px dashed rgba(255, 255, 255, 0.2);
  padding-top: 12px;
}

.scroll-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 30;
}

.scroll-overlay--open {
  display: flex;
}

.scroll-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top, rgba(13, 17, 40, 0.3), rgba(2, 3, 10, 0.9));
  backdrop-filter: blur(4px);
}

.scroll-modal {
  position: relative;
  max-width: 420px;
  width: 100%;
  padding: 24px 20px 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scroll-fireworks {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 4;
  opacity: 0;
}

.scroll-fireworks::before,
.scroll-fireworks::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff3e0;
  transform: translate(-50%, -50%) scale(0.2);
  box-shadow:
    0 -220px 0 0 #ffe082,
    160px -160px 0 0 #ffd54f,
    220px 0 0 0 #ffb74d,
    160px 160px 0 0 #ffcc80,
    0 220px 0 0 #ffe082,
    -160px 160px 0 0 #ffd54f,
    -220px 0 0 0 #ffb74d,
    -160px -160px 0 0 #ffcc80;
  opacity: 0;
}

.scroll-fireworks::after {
  box-shadow:
    0 -160px 0 0 #fff9c4,
    115px -115px 0 0 #ffe082,
    160px 0 0 0 #fff59d,
    115px 115px 0 0 #ffe082,
    0 160px 0 0 #fff9c4,
    -115px 115px 0 0 #ffe082,
    -160px 0 0 0 #fff59d,
    -115px -115px 0 0 #ffe082;
}

.scroll-fireworks--active {
  animation: fireworksFade 3s ease-out forwards;
}

.scroll-fireworks--active::before {
  animation: fireworksBurst 3s ease-out forwards;
}

.scroll-fireworks--active::after {
  animation: fireworksBurst 3s ease-out 0.15s forwards;
}

.scroll-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: none;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  z-index: 5;
}

.scroll-close:hover {
  background: rgba(0, 0, 0, 0.8);
}

.scroll {
  position: relative;
  max-width: 360px;
  width: 100%;
  padding: 14px 18px;
  border-radius: 16px;
  background: transparent;
  box-shadow: none;
  border: none;
  overflow: hidden;
  transform-origin: top center;
  transform: scaleY(0.1);
  opacity: 0;
  z-index: 2;
}

.scroll::before,
.scroll::after {
  content: '';
  position: absolute;
  left: -40px;
  right: -40px;
  height: 22px;
  background: transparent;
  border-radius: 999px;
  box-shadow: none;
}

.scroll::before {
  top: -14px;
}

.scroll::after {
  bottom: -14px;
  box-shadow: none;
}

.scroll-inner {
  position: relative;
  z-index: 1;
  padding: 6px 4px 4px;
}

.scroll-message {
  font-size: 0.95rem;
  color: transparent;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: linear-gradient(120deg, #fff7c0, #b39dff, #6ecbff, #f48fb1);
  -webkit-background-clip: text;
  background-clip: text;
  text-shadow:
    0 0 12px rgba(255, 0, 195, 0.85),
    0 0 22px rgba(0, 234, 255, 0.8);
  text-align: center;
  line-height: 1.4;
}

.scroll--paper {
  background: radial-gradient(circle at top, #fff3e0, #ffe0b2 60%, #ffcc80 100%);
  box-shadow:
    0 10px 24px rgba(0, 0, 0, 0.4),
    0 0 18px rgba(255, 241, 118, 0.6);
  border: 1px solid rgba(121, 85, 72, 0.6);
}

.scroll--paper::before,
.scroll--paper::after {
  background: radial-gradient(circle at 50% 50%, #f5e0c4, #e0b889);
  box-shadow: 0 4px 8px rgba(121, 85, 72, 0.6);
}

.scroll-message--paper {
  font-size: 0.95rem;
  color: #4e342e;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  background: none;
  -webkit-background-clip: initial;
  background-clip: border-box;
  text-shadow: none;
}

.scroll-title {
  font-size: 1rem;
  margin-bottom: 8px;
  color: #4e342e;
  font-weight: 600;
  text-align: center;
}

.scroll--visible {
  animation: scrollOpen 0.7s cubic-bezier(0.25, 0.9, 0.25, 1.2) forwards;
}

.zodiac-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 35;
}

#zodiacErrorOverlay {
  z-index: 40;
}

.zodiac-overlay--open {
  display: flex;
}

.zodiac-modal {
  position: relative;
  max-width: 420px;
  width: 100%;
  padding: 24px 20px 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 16px;
}

.zodiac-title {
  font-size: 1.1rem;
  margin-bottom: 12px;
  color: #4e342e;
}

.zodiac-label {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 6px;
  text-align: left;
  color: #5d4037;
}

.zodiac-select {
  width: 100%;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(121, 85, 72, 0.6);
  margin-bottom: 12px;
  background: rgba(255, 255, 255, 0.9);
  font-size: 0.9rem;
  color: #4e342e;
}

.zodiac-pill-row {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
}

.zodiac-pill {
  padding: 6px 14px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, #ff9800, #ff2079);
  color: #fff;
  font-size: 0.85rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  white-space: nowrap;
  flex-shrink: 1;
}

.zodiac-pill--hidden {
  display: none;
}

.zodiac-pill--disabled {
  pointer-events: none;
  opacity: 0.45;
  filter: grayscale(0.2);
  cursor: default;
}

.zodiac-pill--locked {
  cursor: default;
  pointer-events: none;
  opacity: 0.9;
}

.zodiac-confirm {
  padding: 8px 16px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, #ff9800, #ff2079);
  color: #fff;
  cursor: pointer;
  font-size: 0.9rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.zodiac-confirm:hover {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
}

.labels {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.label {
  position: absolute;
  left: 50%;
  top: 50%;
  transform-origin: 0 0;
  font-size: 0.75rem;
  color: #fff;
  text-shadow:
    0 0 3px rgba(0, 0, 0, 0.9),
    0 0 10px rgba(0, 0, 0, 0.7);
}

.label-text {
  display: block;
}

@keyframes scrollOpen {
  0% {
    transform: scaleY(0.1);
    opacity: 0;
  }
  50% {
    transform: scaleY(1.04);
    opacity: 1;
  }
  100% {
    transform: scaleY(1);
    opacity: 1;
  }
}

@keyframes fireworksBurst {
  0% {
    transform: translate(-50%, -50%) scale(0.2);
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  80% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.3);
    opacity: 0;
  }
}

@keyframes fireworksFade {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes rotateAura {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes starDrift {
  from {
    transform: translate3d(0, 0, 0);
  }
  to {
    transform: translate3d(-60px, -30px, 0);
  }
}

@keyframes pulseWheelGlow {
  0%,
  100% {
    box-shadow:
      0 0 0 1px rgba(255, 255, 255, 0.18),
      0 0 30px rgba(0, 229, 255, 0.9),
      0 0 55px rgba(255, 64, 129, 0.9);
  }
  50% {
    box-shadow:
      0 0 0 1px rgba(255, 255, 255, 0.3),
      0 0 40px rgba(0, 229, 255, 1),
      0 0 70px rgba(255, 64, 129, 1);
  }
}

@keyframes sunPulse {
  0%,
  100% {
    transform: scale(1);
    box-shadow:
      0 0 12px rgba(255, 255, 255, 0.95),
      0 0 26px rgba(255, 241, 118, 0.95),
      0 0 40px rgba(255, 213, 79, 0.9);
  }
  50% {
    transform: scale(1.06);
    box-shadow:
      0 0 18px rgba(255, 255, 255, 1),
      0 0 34px rgba(255, 241, 118, 1),
      0 0 55px rgba(255, 213, 79, 1);
  }
}
