.character-wheel-section {
  --wheel-blue: #087fc5;
  --wheel-blue-dark: #22506f;
  --wheel-orange: #f39222;
  --wheel-cream: #fff8e8;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  max-width: 980px;
  margin: 72px auto 0;
  padding: 48px 30px 42px;
  border: 1px solid rgba(0, 120, 201, 0.13);
  border-radius: 36px;
  background:
    radial-gradient(circle at 16% 12%, rgba(243, 146, 34, 0.14), transparent 27%),
    radial-gradient(circle at 84% 80%, rgba(0, 120, 201, 0.12), transparent 31%),
    linear-gradient(145deg, #ffffff 0%, #f7fcff 58%, #fffaf1 100%);
  box-shadow: 0 28px 70px rgba(36, 56, 79, 0.13);
  text-align: center;
}

.character-wheel-section::before,
.character-wheel-section::after {
  position: absolute;
  z-index: -1;
  width: 170px;
  height: 170px;
  border: 1px solid rgba(0, 120, 201, 0.1);
  border-radius: 50%;
  content: "";
}

.character-wheel-section::before {
  top: -74px;
  right: -54px;
  box-shadow: 0 0 0 26px rgba(0, 120, 201, 0.03);
}

.character-wheel-section::after {
  bottom: -92px;
  left: -42px;
  border-color: rgba(243, 146, 34, 0.15);
  box-shadow: 0 0 0 34px rgba(243, 146, 34, 0.035);
}

.character-wheel-heading {
  max-width: 650px;
  margin: 0 auto 24px;
}

.character-wheel-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 13px;
  border-radius: 16px;
  background: #eaf8ff;
  color: var(--wheel-blue);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.05em;
}

.character-wheel-heading h3 {
  margin: 12px 0 8px;
  color: var(--wheel-blue-dark);
  font-size: clamp(28px, 4vw, 43px);
  line-height: 1.15;
}

.character-wheel-heading p {
  margin: 0;
  color: #667589;
  font-size: 16px;
  line-height: 1.7;
}

.character-gender-switch {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(112px, 1fr));
  gap: 5px;
  margin-bottom: 28px;
  padding: 5px;
  border: 1px solid #d8e8f2;
  border-radius: 999px;
  background: rgba(234, 248, 255, 0.82);
  box-shadow: inset 0 1px 4px rgba(36, 56, 79, 0.08);
}

.character-gender-switch button {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #61758a;
  font: inherit;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
  transition: color 180ms ease, background 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.character-gender-switch button span {
  font-size: 19px;
}

.character-gender-switch button:hover:not(:disabled) {
  color: var(--wheel-blue);
  transform: translateY(-1px);
}

.character-gender-switch button.is-active {
  background: #fff;
  color: var(--wheel-blue);
  box-shadow: 0 5px 16px rgba(36, 56, 79, 0.13);
}

.character-gender-switch button:focus-visible,
.character-wheel-button:focus-visible {
  outline: 4px solid rgba(243, 146, 34, 0.42);
  outline-offset: 4px;
}

.character-gender-switch button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.character-wheel-stage {
  position: relative;
  width: min(470px, 84vw);
  aspect-ratio: 1;
  margin: 0 auto;
  filter: drop-shadow(0 25px 28px rgba(36, 56, 79, 0.2));
}

.character-wheel-pointer {
  position: absolute;
  z-index: 6;
  top: -28px;
  left: 50%;
  width: 60px;
  height: 78px;
  transform: translateX(-50%);
  transform-origin: 50% 8px;
  clip-path: polygon(50% 100%, 4% 16%, 22% 0, 78% 0, 96% 16%);
  background: linear-gradient(145deg, #ffb343, #e97818);
  box-shadow: 0 8px 15px rgba(117, 65, 13, 0.25);
  pointer-events: none;
}

.character-wheel-pointer.is-ticking {
  animation: character-wheel-pointer-tick 150ms ease-out;
}

@keyframes character-wheel-pointer-tick {
  0% {
    transform: translateX(-50%) rotate(0);
  }

  36% {
    transform: translateX(-50%) rotate(-12deg) translateY(-2px);
  }

  72% {
    transform: translateX(-50%) rotate(4deg);
  }

  100% {
    transform: translateX(-50%) rotate(0);
  }
}

.character-wheel-pointer::after {
  position: absolute;
  inset: 8px 19px 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.72);
  content: "";
}

.character-wheel-button {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  padding: 0;
  border: 9px solid #fff;
  border-radius: 50%;
  background: #fff;
  box-shadow:
    0 0 0 2px rgba(0, 120, 201, 0.18),
    inset 0 0 0 2px rgba(255, 255, 255, 0.7);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

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

.character-wheel-button:hover:not(:disabled) .character-wheel {
  filter: saturate(1.08) brightness(1.02);
}

.character-wheel-button:active:not(:disabled) {
  transform: scale(0.992);
}

.character-wheel-button:disabled {
  cursor: wait;
}

.character-wheel {
  --wheel-rotation: 0deg;
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 50%;
  background:
    repeating-conic-gradient(from -25.714deg, rgba(255, 255, 255, 0.9) 0 0.75deg, transparent 0.75deg 51.428deg),
    conic-gradient(
      from -25.714deg,
      #dff5ff 0 51.428deg,
      #fff0d9 51.428deg 102.856deg,
      #d8f3ed 102.856deg 154.284deg,
      #fce3ed 154.284deg 205.712deg,
      #ece7ff 205.712deg 257.14deg,
      #e8f0ff 257.14deg 308.568deg,
      #fff6c9 308.568deg 360deg
    );
  transform: rotate(var(--wheel-rotation));
  transition: transform 8.5s cubic-bezier(0.12, 0.67, 0.08, 1);
  will-change: transform;
}

.character-wheel::before {
  position: absolute;
  z-index: 1;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle, transparent 0 23%, rgba(255, 255, 255, 0.08) 23.5% 62%, rgba(255, 255, 255, 0.3) 100%);
  content: "";
  pointer-events: none;
}

.character-wheel-peg {
  --slot-angle: 0deg;
  position: absolute;
  z-index: 4;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 29px;
  border: 2px solid rgba(168, 92, 16, 0.42);
  border-radius: 9px 9px 5px 5px;
  background:
    radial-gradient(circle at 50% 27%, rgba(255, 255, 255, 0.9) 0 2px, transparent 2.5px),
    linear-gradient(90deg, #d97716, #ffbd54 48%, #db7a17);
  box-shadow:
    0 3px 5px rgba(98, 56, 12, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.62);
  transform:
    translate(-50%, -50%)
    rotate(var(--slot-angle))
    translateY(-197px);
  transform-origin: center;
}

.character-wheel-avatar {
  --slot-angle: 0deg;
  --slot-counter: 0deg;
  --wheel-counter: 0deg;
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 50%;
  display: grid;
  width: 88px;
  height: 144px;
  place-items: center;
  align-content: center;
  gap: 3px;
  color: #344b60;
  transform:
    translate(-50%, -50%)
    rotate(var(--slot-angle))
    translateY(-142px)
    rotate(var(--slot-counter))
    rotate(var(--wheel-counter));
  transition: transform 8.5s cubic-bezier(0.12, 0.67, 0.08, 1), filter 250ms ease;
  will-change: transform;
}

.character-wheel-avatar.is-winner {
  filter: drop-shadow(0 0 8px #fff) drop-shadow(0 0 8px rgba(243, 146, 34, 0.92));
}

.character-wheel-avatar-image {
  display: block;
  width: 31px;
  height: 112px;
  background-position: var(--sprite-position) center;
  background-repeat: no-repeat;
  background-size: auto 100%;
}

.character-wheel-avatar-male .character-wheel-avatar-image {
  background-image: url("assets/age-progression-men.png");
}

.character-wheel-avatar-female .character-wheel-avatar-image {
  background-image: url("assets/age-progression-women.png");
}

.character-wheel-avatar small {
  display: block;
  max-width: 86px;
  overflow: hidden;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.character-wheel-hub {
  position: absolute;
  z-index: 5;
  top: 50%;
  left: 50%;
  display: grid;
  width: 116px;
  height: 116px;
  transform: translate(-50%, -50%);
  place-items: center;
  align-content: center;
  border: 8px solid rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  background: linear-gradient(145deg, #0795dc, #066da9);
  box-shadow:
    0 12px 28px rgba(6, 85, 130, 0.34),
    inset 0 2px 0 rgba(255, 255, 255, 0.32);
  color: #fff;
  pointer-events: none;
}

.character-wheel-hub b,
.character-wheel-hub small {
  display: block;
}

.character-wheel-hub b {
  font-size: 18px;
}

.character-wheel-hub small {
  margin-top: -4px;
  color: #dff5ff;
  font-size: 11px;
  font-weight: 800;
}

.character-wheel-button.is-spinning .character-wheel-hub {
  background: linear-gradient(145deg, #f5a43a, #e67518);
}

.character-wheel-button.is-spinning .character-wheel-hub b {
  font-size: 15px;
}

.character-wheel-status {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  margin: 24px auto 0;
  padding: 0 20px;
  border: 1px solid #d8e8f2;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: #62758a;
  font-size: 14px;
  font-weight: 800;
}

.character-wheel-status.is-result {
  border-color: rgba(243, 146, 34, 0.4);
  background: #fff7e8;
  color: #98550f;
  box-shadow: 0 8px 18px rgba(152, 85, 15, 0.1);
}

.character-pinball {
  position: relative;
  width: min(720px, 96%);
  margin: 18px auto 0;
  padding: 18px 20px 14px;
  border: 5px solid #263746;
  border-radius: 22px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.12), transparent 22%),
    linear-gradient(145deg, #31495a, #121d26 62%, #263b4a);
  box-shadow:
    0 18px 34px rgba(20, 35, 47, 0.28),
    inset 0 0 0 2px #6e8797,
    inset 0 0 0 7px #0a1117;
  direction: rtl;
}

.character-pinball[hidden] {
  display: none !important;
}

.character-pinball::before,
.character-pinball::after {
  position: absolute;
  top: 50%;
  width: 13px;
  height: 44%;
  border: 2px solid #091016;
  border-radius: 8px;
  background: linear-gradient(90deg, #708798, #263a48 48%, #9aabba);
  box-shadow: inset 0 0 4px #dbe7ef, 0 3px 8px rgba(0, 0, 0, 0.35);
  content: "";
  transform: translateY(-50%);
}

.character-pinball::before {
  right: -10px;
}

.character-pinball::after {
  left: -10px;
}

.character-pinball-bulbs {
  display: flex;
  justify-content: space-between;
  margin: -5px 5px 10px;
}

.character-pinball-bulbs span {
  width: 11px;
  height: 11px;
  border: 2px solid #6d3513;
  border-radius: 50%;
  background: #ff9e2f;
  box-shadow: 0 0 4px #fff, 0 0 11px #ff8a1d, 0 0 18px rgba(255, 100, 12, 0.7);
  animation: character-pinball-bulb 1.1s ease-in-out infinite alternate;
}

.character-pinball-bulbs span:nth-child(2n) {
  animation-delay: -550ms;
}

.character-pinball-screen {
  position: relative;
  overflow: hidden;
  min-height: 174px;
  padding: 20px 26px 18px;
  border: 4px solid #090b0d;
  border-radius: 12px;
  background:
    repeating-linear-gradient(0deg, rgba(255, 85, 0, 0.035) 0 1px, transparent 1px 4px),
    radial-gradient(circle at 50% 45%, #29120a, #090706 68%);
  box-shadow:
    inset 0 0 28px #000,
    inset 0 0 5px rgba(255, 112, 22, 0.7),
    0 0 0 2px #4f6472;
  color: #ff9c42;
  font-family: "Courier New", "Noto Sans Hebrew", monospace;
  text-shadow: 0 0 3px #ff711c, 0 0 9px rgba(255, 76, 0, 0.78);
}

.character-pinball-screen::after {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 0, rgba(255, 255, 255, 0.1), transparent 42%);
  content: "";
  pointer-events: none;
}

.character-pinball-heading,
.character-pinball-meta {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.character-pinball-heading span {
  color: #ffd27c;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.13em;
}

.character-pinball-heading b {
  color: #ffbd65;
  font-size: 18px;
}

.character-pinball-ticker {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: 76px;
  align-items: center;
  overflow: hidden;
  margin: 12px 0;
  border-block: 1px dashed rgba(255, 164, 71, 0.34);
}

.character-pinball-ticker p {
  margin: 0;
  color: #ff9b39;
  font-size: clamp(20px, 3vw, 31px);
  font-weight: 900;
  line-height: 1.2;
  text-align: center;
}

.character-pinball-ticker p.is-changing {
  animation: character-pinball-ticker-in 600ms cubic-bezier(0.2, 0.78, 0.25, 1);
}

.character-pinball-meta {
  color: #f8b669;
  font-size: 12px;
  font-weight: 800;
  opacity: 0.86;
}

.character-pinball-disclaimer {
  margin: 10px 7px 0;
  color: #dce7ee;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.45;
  text-align: center;
}

@keyframes character-pinball-ticker-in {
  from {
    opacity: 0;
    transform: translateX(65%);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes character-pinball-bulb {
  from {
    opacity: 0.38;
    transform: scale(0.82);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (max-width: 640px) {
  .character-wheel-section {
    margin-top: 54px;
    padding: 38px 14px 34px;
    border-radius: 26px;
  }

  .character-wheel-heading p {
    font-size: 14px;
  }

  .character-gender-switch {
    width: min(100%, 280px);
    grid-template-columns: repeat(2, 1fr);
  }

  .character-wheel-stage {
    width: min(330px, 88vw);
  }

  .character-wheel-pointer {
    top: -18px;
    width: 46px;
    height: 62px;
  }

  .character-wheel-peg {
    width: 10px;
    height: 23px;
    border-width: 1px;
    transform:
      translate(-50%, -50%)
      rotate(var(--slot-angle))
      translateY(-133px);
  }

  .character-wheel-avatar {
    width: 64px;
    height: 104px;
    transform:
      translate(-50%, -50%)
      rotate(var(--slot-angle))
      translateY(-96px)
      rotate(var(--slot-counter))
      rotate(var(--wheel-counter));
  }

  .character-wheel-avatar-image {
    width: 21px;
    height: 78px;
  }

  .character-wheel-avatar small {
    max-width: 62px;
    font-size: 9px;
  }

  .character-wheel-hub {
    width: 86px;
    height: 86px;
    border-width: 6px;
  }

  .character-wheel-hub b {
    font-size: 15px;
  }

  .character-wheel-hub small {
    font-size: 9px;
  }

  .character-wheel-status {
    max-width: 95%;
    min-height: 38px;
    padding: 7px 14px;
    font-size: 12px;
    line-height: 1.35;
  }

  .character-pinball {
    width: 100%;
    margin-top: 14px;
    padding: 14px 12px 11px;
    border-width: 4px;
    border-radius: 17px;
  }

  .character-pinball-screen {
    min-height: 156px;
    padding: 16px 13px 14px;
  }

  .character-pinball-heading {
    align-items: flex-start;
    flex-direction: column-reverse;
    gap: 3px;
  }

  .character-pinball-heading b {
    font-size: 15px;
  }

  .character-pinball-heading span {
    font-size: 10px;
  }

  .character-pinball-ticker {
    min-height: 68px;
    margin: 9px 0;
  }

  .character-pinball-ticker p {
    font-size: clamp(17px, 5.5vw, 23px);
  }

  .character-pinball-meta {
    font-size: 10px;
  }

  .character-pinball-disclaimer {
    font-size: 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .character-wheel,
  .character-wheel-avatar {
    transition-duration: 900ms;
  }

  .character-wheel-pointer.is-ticking {
    animation: none;
  }

  .character-pinball-bulbs span,
  .character-pinball-ticker p.is-changing {
    animation: none;
  }
}
