/**
 * Koło fortuny — realistyczna obudowa (drewno / mosiądz / emalia)
 * Osobny arkusz pod panel na koncie klienta.
 */

.account-card--wheel {
  --fw-ink: #0b0908;
  --fw-panel: #14110f;
  --fw-gold: #c9a227;
  --fw-gold-soft: #e8d5a3;
  --fw-cream: #f7f0de;
  position: relative;
  overflow: hidden;
  text-align: center;
  padding: 1.65rem 1.2rem 1.9rem;
  border: 1px solid rgba(138, 109, 26, 0.45);
  background:
    radial-gradient(ellipse 90% 55% at 50% -10%, rgba(201, 162, 39, 0.14), transparent 55%),
    radial-gradient(ellipse 60% 50% at 0% 100%, rgba(90, 30, 28, 0.22), transparent 50%),
    radial-gradient(ellipse 50% 40% at 100% 80%, rgba(60, 40, 20, 0.35), transparent 45%),
    linear-gradient(168deg, #1a1512 0%, #0d0b0a 42%, #15110e 100%);
  box-shadow:
    inset 0 1px 0 rgba(247, 235, 200, 0.1),
    inset 0 -24px 40px rgba(0, 0, 0, 0.35),
    0 22px 48px rgba(0, 0, 0, 0.42);
}

.account-card--wheel::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.4;
  background:
    repeating-linear-gradient(
      115deg,
      transparent 0 2px,
      rgba(255, 255, 255, 0.012) 2px 3px
    );
  mask-image: radial-gradient(ellipse 75% 70% at 50% 45%, #000 10%, transparent 75%);
}

.account-card--wheel::after {
  content: '';
  position: absolute;
  inset: 10px;
  border-radius: inherit;
  pointer-events: none;
  border: 1px solid rgba(201, 162, 39, 0.12);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.25);
}

.account-card--wheel > * {
  position: relative;
  z-index: 1;
}

.account-card--wheel > h3 {
  margin: 0 0 0.3rem;
  font-family: var(--font-display, 'Playfair Display', Georgia, serif);
  font-size: clamp(1.5rem, 4.2vw, 1.95rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: none;
  background: linear-gradient(185deg, #fff6d8 0%, #e8d090 28%, #c9a227 58%, #8a6d1a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.35));
}

.account-card--wheel #wheel-status {
  max-width: 28rem;
  margin: 0 auto 0.35rem;
  color: rgba(247, 240, 222, 0.58);
  font-size: 0.92rem;
  line-height: 1.45;
}

.fortune-wheel-stage {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0.4rem auto 1.4rem;
  min-height: min(380px, 86vw);
  perspective: 1200px;
}

/* —— konstrukcja —— */

.fortune-wheel {
  position: relative;
  width: min(360px, 90vw);
  aspect-ratio: 1;
  margin: 1.35rem auto 0.25rem;
  isolation: isolate;
  transform-style: preserve-3d;
}

.fortune-wheel__room {
  position: absolute;
  inset: -22%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 42%, rgba(232, 208, 144, 0.16), transparent 40%),
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.05), transparent 35%);
  filter: blur(18px);
  opacity: 0.85;
  pointer-events: none;
  z-index: 0;
  animation: fw-room 5.5s ease-in-out infinite alternate;
}

.fortune-wheel.is-spinning .fortune-wheel__room {
  animation-duration: 0.55s;
  opacity: 1;
}

.fortune-wheel.is-winner .fortune-wheel__room {
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 246, 216, 0.38), rgba(201, 162, 39, 0.18), transparent 55%);
  animation: fw-winner-room 1.15s ease-out;
}

.fortune-wheel__plinth {
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: -7%;
  height: 12%;
  border-radius: 50%;
  background:
    linear-gradient(180deg, rgba(90, 61, 40, 0.5), rgba(20, 12, 8, 0.85)),
    radial-gradient(ellipse, #3d291c, #160e09 70%);
  box-shadow:
    inset 0 2px 0 rgba(232, 208, 144, 0.15),
    0 8px 16px rgba(0, 0, 0, 0.45);
  z-index: 0;
  pointer-events: none;
  transform: rotateX(55deg);
}

.fortune-wheel__shadow {
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: -2%;
  height: 12%;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(0, 0, 0, 0.65), transparent 72%);
  filter: blur(8px);
  z-index: 0;
  pointer-events: none;
}

.fortune-wheel__housing {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  filter: drop-shadow(0 18px 28px rgba(0, 0, 0, 0.55));
}

.fortune-wheel__housing-svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.fortune-wheel__disk {
  position: absolute;
  inset: 0;
  z-index: 2;
  will-change: transform;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.35));
}

.fortune-wheel.is-spinning .fortune-wheel__disk {
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.4));
}

.fortune-wheel__disk svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.fortune-wheel__glass {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  mix-blend-mode: soft-light;
  opacity: 0.95;
}

.fortune-wheel__glass svg {
  display: block;
  width: 100%;
  height: 100%;
}

.fortune-wheel__pointer {
  position: absolute;
  top: -10px;
  left: 50%;
  z-index: 8;
  width: 44px;
  height: 58px;
  transform: translateX(-50%);
  transform-origin: 50% 16px;
  pointer-events: none;
}

.fortune-wheel__pointer-body {
  display: block;
  width: 100%;
  height: 100%;
}

.fortune-wheel.is-spinning .fortune-wheel__pointer {
  animation: fw-pointer-tick 0.14s ease-in-out infinite alternate;
}

.fortune-wheel.is-spinning .fw-bulb__core.is-lit {
  animation: fw-bulb-chase 0.5s steps(2, end) infinite;
}

.fortune-wheel.is-spinning .fw-bulb__core:not(.is-lit) {
  animation: fw-bulb-chase 0.5s steps(2, end) infinite;
  animation-delay: 0.25s;
}

.fortune-wheel.is-winner .fw-bulb__core {
  animation: fw-bulb-win 0.45s ease-in-out infinite alternate;
}

.fortune-wheel.is-winner .fw-bulb:nth-of-type(3n) .fw-bulb__core {
  animation-delay: 0.12s;
}

.fortune-wheel__sparkles {
  position: absolute;
  inset: -6%;
  z-index: 7;
  pointer-events: none;
  opacity: 0;
}

.fortune-wheel.is-winner .fortune-wheel__sparkles {
  opacity: 1;
  animation: fw-sparkles 1.35s ease-out forwards;
}

.fortune-wheel__sparkle {
  position: absolute;
  top: var(--y);
  left: var(--x);
  width: 5px;
  height: 5px;
  border-radius: 1px;
  background: #fff6d8;
  box-shadow: 0 0 8px rgba(255, 246, 216, 0.9);
  transform: rotate(45deg);
  opacity: 0;
  animation: fw-sparkle-pop 1s ease-out forwards;
  animation-delay: var(--d);
}

.fortune-wheel.is-winner {
  animation: fw-land 0.85s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* —— przycisk —— */

.fortune-wheel__btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-width: 220px;
  padding: 0.9rem 1.55rem;
  margin: 0.15rem auto 0;
  border: 1px solid rgba(90, 72, 16, 0.85);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 246, 216, 0.22), transparent 35%),
    linear-gradient(180deg, #c9a227 0%, #9e1e28 46%, #5c1218 100%);
  color: #fff8e8;
  font-family: var(--font-body, Outfit, system-ui, sans-serif);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  box-shadow:
    0 1px 0 rgba(255, 246, 216, 0.35) inset,
    0 -2px 0 rgba(0, 0, 0, 0.25) inset,
    0 12px 26px rgba(90, 20, 24, 0.4),
    0 2px 0 rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.fortune-wheel__btn::before {
  content: '';
  position: absolute;
  inset: 1px;
  border-radius: inherit;
  border: 1px solid rgba(255, 246, 216, 0.18);
  pointer-events: none;
}

.fortune-wheel__btn:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.04);
  box-shadow:
    0 1px 0 rgba(255, 246, 216, 0.4) inset,
    0 -2px 0 rgba(0, 0, 0, 0.25) inset,
    0 16px 30px rgba(90, 20, 24, 0.48),
    0 2px 0 rgba(0, 0, 0, 0.2);
}

.fortune-wheel__btn:active:not(:disabled) {
  transform: translateY(1px);
}

.fortune-wheel__btn:disabled {
  opacity: 0.72;
  cursor: wait;
  filter: saturate(0.85);
}

.fortune-wheel__btn-icon {
  display: inline-grid;
  place-items: center;
  font-size: 0.95rem;
  color: #fff6d8;
  animation: fw-btn-icon 2.8s ease-in-out infinite;
}

.fortune-wheel__btn:disabled .fortune-wheel__btn-icon {
  animation: fw-btn-spin 0.7s linear infinite;
}

.fortune-wheel__result {
  text-align: center;
  margin-top: 1.15rem;
  font-size: 1.08rem;
  font-weight: 600;
  color: var(--fw-gold-soft);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.fortune-wheel__result:not([hidden]) {
  animation: fw-result-in 0.55s ease-out;
}

.fortune-wheel__result.is-error {
  color: #ff9a9a;
}

/* —— motion —— */

@keyframes fw-room {
  from { transform: scale(0.97); opacity: 0.65; }
  to { transform: scale(1.04); opacity: 0.95; }
}

@keyframes fw-winner-room {
  0% { transform: scale(0.94); opacity: 0.4; }
  40% { transform: scale(1.12); opacity: 1; }
  100% { transform: scale(1.02); opacity: 0.85; }
}

@keyframes fw-land {
  0% { transform: scale(1) rotateX(0deg); }
  30% { transform: scale(1.028) rotateX(2deg); }
  100% { transform: scale(1) rotateX(0deg); }
}

@keyframes fw-pointer-tick {
  from { transform: translateX(-50%) rotate(-9deg); }
  to { transform: translateX(-50%) rotate(9deg); }
}

@keyframes fw-bulb-chase {
  0%, 49% { opacity: 0.35; }
  50%, 100% { opacity: 1; }
}

@keyframes fw-bulb-win {
  from { opacity: 0.45; }
  to { opacity: 1; }
}

@keyframes fw-sparkles {
  0% { opacity: 0; }
  15% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes fw-sparkle-pop {
  0% { opacity: 0; transform: rotate(45deg) scale(0.2) translateY(10px); }
  30% { opacity: 1; transform: rotate(45deg) scale(1.15) translateY(0); }
  100% { opacity: 0; transform: rotate(45deg) scale(0.35) translateY(-22px); }
}

@keyframes fw-btn-icon {
  0%, 100% { transform: rotate(-8deg) scale(1); }
  50% { transform: rotate(8deg) scale(1.08); }
}

@keyframes fw-btn-spin {
  to { transform: rotate(360deg); }
}

@keyframes fw-result-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 480px) {
  .fortune-wheel {
    width: min(320px, 92vw);
  }

  .fortune-wheel-stage {
    min-height: min(340px, 88vw);
  }

  .fortune-wheel__btn {
    min-width: 0;
    width: 100%;
    max-width: 280px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .fortune-wheel__room,
  .fortune-wheel__pointer,
  .fortune-wheel__sparkles,
  .fortune-wheel__btn-icon,
  .fortune-wheel.is-spinning .fw-bulb__core,
  .fortune-wheel.is-winner .fw-bulb__core {
    animation: none !important;
  }

  .fortune-wheel__disk {
    transition-duration: 0.01ms !important;
  }
}
