:root {
  --wheel-size: min(92vw, 380px);
  --bg: whitesmoke;
  --fg: #eae6d0;
  --text: rgba(55, 51, 42, 0.85);
  --metal-gold: #e3c067;
  --metal-gold-deep: #b88a2f;
  --metal-gold-light: #f8e7b5;

  --gem-ruby: #b31a4b;
  --gem-sapphire: #18457f;
  --gem-emerald: #0f8660;
  --gem-amethyst: #5b2c83;
  --gem-topaz: #f4b742;
  --gem-garnet: #7a1026;
}

.sw-game-container {
  display: flex;
  align-items: center;
  flex-direction: column;
  max-width: 900px;
  width: 100%;
  /* height: 95vh; */
  background: url("game-bg-2.gif") center/cover no-repeat;
  border-radius: 12px;
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  position: relative;
  margin: 0 auto;
}

.sw-title {
  font-weight: 700;
  font-size: 2rem;
  text-align: center;
  margin-bottom: 20px;
  background: linear-gradient(to right, yellow, whitesmoke);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: block;
}

.sw-ticket-info {
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 0 10px rgba(113, 53, 9, 0.9);
  margin: 10px;
  z-index: 10;
  width: 95%;
  position: relative;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 8px 8px 20px rgba(0, 0, 0, 0.15),
    -8px -8px 20px rgba(255, 255, 255, 0.05);
}

#sw-tickets {
  margin-top: 8px;
  display: flex;
  overflow-x: auto;
  align-items: flex-start;
  gap: 1em; /* space between product groups */
  padding-bottom: 4px;
}

.button-container {
  display: flex;
}

.sw-ticket-group {
  flex: 0 0 auto; /* so each group is a tile in the horizontal scroller */
  padding: 8px 10px;
  border-radius: 10px;
  min-width: 140px; /* tweak as you like */
}

.sw-ticket-group-label {
  margin-bottom: 4px;
  font-weight: 600;
  font-size: 0.9rem;
  color: #fff6dc;
  white-space: nowrap;
}

.sw-ticket-row {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
  overflow-x: auto;
}

.sw-ticket {
  background: rgba(255, 255, 255, 0.1);
  color: #fff6dc;
  font-weight: 600;
  font-size: 0.8rem;
  border: 1px solid #999;
  padding: 4px 8px;
  margin: 4px 6px 4px 0;
  display: inline-block;
  border-radius: 10px;
  transition: all 0.3s ease;
}
.sw-ticket.popped {
  text-decoration: line-through;
  color: #777;
}
.sw-ticket.win {
  background-color: #c7f8c7;
}
.sw-ticket.nowin {
  background-color: #f9cccc;
}

#sw-toggle-spin,
.spin-btn {
  background-color: #ebc82b;
  padding: 4px 8px;
  margin: 4px 6px 4px 0;
  color: white;
  font-weight: bold;
  border: 1px solid #999;
  display: inline-block;
  border-radius: 10px;
  transition: background-color 0.3s ease;
  width: 50%;
  text-align: center;

  position: relative; /* needed for pseudo-elements */
  overflow: hidden; /* hide ripple overflow */
}

/* first ripple */
#sw-toggle-spin::before,
#sw-toggle-spin::after,
.spin-btn::before,
.spin-btn::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 20%;
  aspect-ratio: 1 / 1; /* keeps the circle shape */
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.7); /* thin line */
  transform: translate(-50%, -50%) scale(0.1);
  opacity: 0;
  mix-blend-mode: screen;
  animation: swRipple 2s ease-out infinite;
}

.spin-btn {
  width: auto;
  border: none;
}

/* second ripple, offset in time so it feels continuous */
#sw-toggle-spin::after,
.spin-btn::after {
  animation-delay: 1s;
}

@keyframes swRipple {
  0% {
    transform: translate(-50%, -50%) scale(0.2);
    opacity: 0.8;
  }
  70% {
    opacity: 0;
  }
  100% {
    transform: translate(-50%, -50%) scale(3);
    opacity: 0;
  }
}

#sw-toggle-spin-all {
  /* background-color: #4b3614; */
  padding: 4px 8px;
  margin: 4px 6px 4px 0;
  color: white;
  font-weight: bold;
  border: 1px solid #e5e5e5;
  display: inline-block;
  border-radius: 10px;
  transition: background-color 0.3s ease;
  width: 50%;
  text-align: center;
}

#sw-toggle-spin-all:hover {
  background-color: #4b3614;
}

#sw-wrapper {
  width: var(--wheel-size);
}

/* WHEEL */
#wheel {
  width: var(--wheel-size);
  height: var(--wheel-size);
  border-radius: 50%;
  position: relative;
  overflow: hidden;
  border: 6px solid transparent;
  background: radial-gradient(
      circle at 30% 15%,
      rgba(255, 255, 255, 0.35),
      transparent 60%
    ),
    radial-gradient(
      circle at 70% 85%,
      rgba(255, 255, 255, 0.2),
      transparent 55%
    ),
    conic-gradient(from 0deg, #3c2b16, #140f0a, #22160b, #140f0a, #3c2b16);
  background-clip: padding-box, padding-box, border-box;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.9), 0 0 40px rgba(0, 0, 0, 0.9),
    0 0 60px rgba(255, 215, 128, 0.35);
}
#wheel::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  border: 2px solid rgba(255, 235, 190, 0.45);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.9), inset 0 0 15px rgba(0, 0, 0, 0.9);
  z-index: 2;
}
#inner-wheel {
  width: 100%;
  height: 100%;
  transition: transform 6s cubic-bezier(0, 0.99, 0.44, 0.99);
  position: relative;
}

/* Triangular slices (8 wedges) */
#wheel .sec {
  position: absolute;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 200px 83px 0; /* geometry */
  border-color: #88c2b0 transparent;
  transform-origin: 83px 200px;
  left: calc(50% - 83px);
  top: calc(50% - 200px);
  opacity: 1;
  border-color: var(--gem-emerald) transparent;
  filter: drop-shadow(0 0 6px rgba(0, 0, 0, 0.9));
}

/* Prize text */
#wheel .sec .label {
  position: relative;
  display: block;
  margin-top: -140px;
  margin-left: -40px;
  width: 80px;
  text-align: center;
  font-weight: 700;
  font-size: clamp(11px, 2.8vw, 16px);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.2);
  user-select: none;
  color: #fff6e0;
  text-shadow: 0 0 2px rgba(0, 0, 0, 0.9), 0 1px 0 rgba(0, 0, 0, 0.8);
}

/* jewel tones & gold accents per wedge */
#wheel .sec:nth-child(1) {
  transform: rotate(45deg);
  border-color: var(--gem-ruby) transparent;
}
#wheel .sec:nth-child(2) {
  transform: rotate(90deg);
  border-color: var(--gem-topaz) transparent;
}
#wheel .sec:nth-child(3) {
  transform: rotate(135deg);
  border-color: var(--gem-emerald) transparent;
}
#wheel .sec:nth-child(4) {
  transform: rotate(180deg);
  border-color: var(--gem-sapphire) transparent;
}
#wheel .sec:nth-child(5) {
  transform: rotate(225deg);
  border-color: var(--gem-amethyst) transparent;
}
#wheel .sec:nth-child(6) {
  transform: rotate(270deg);
  border-color: var(--gem-garnet) transparent;
}
#wheel .sec:nth-child(7) {
  transform: rotate(315deg);
  border-color: #f0d46a transparent; /* bright gold slice */
}
#wheel .sec:nth-child(8) {
  transform: rotate(360deg);
  border-color: #c08f34 transparent; /* deep antique gold slice */
}

/* Spin button + pomonospace */
#spin {
  width: 68px;
  height: 68px;
  position: absolute;
  top: 50%;
  left: 50%;
  margin: -34px 0 0 -34px;
  border-radius: 50%;
  box-shadow: rgba(55, 51, 42, 0.1) 0 3px 0;
  z-index: 3;
  background: var(--fg);
  user-select: none;
  display: grid;
  place-items: center;
}
#spin span {
  position: relative;
  z-index: 2;
  font-size: 18px;
  font-weight: 700;
  color: #bfbba6;
}
#spin::before {
  content: "";
  position: absolute;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 20px 28px 20px;
  border-color: transparent transparent #f2eedd transparent;
  top: -12px;
  left: 14px;
}
#inner-spin {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: radial-gradient(
    ellipse at center,
    rgba(234, 230, 208, 1) 0%,
    rgba(211, 208, 193, 1) 100%
  );
  box-shadow: inset 0 2px 0 rgba(234, 230, 208, 1),
    inset 0 -2px 0 rgba(234, 230, 208, 1), 0 0 5px rgba(0, 0, 0, 0.4);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* subtle sheen */
#shine {
  width: 70%;
  height: 70%;
  position: absolute;
  top: 0;
  left: 0;
  background: radial-gradient(
    ellipse at center,
    rgba(234, 230, 208, 0.9) 0%,
    rgba(234, 230, 208, 0) 60%
  );
  opacity: 0.08;
}

/* result text */
#result {
  text-align: center;
  margin-top: 10px;
  font-weight: 700;
  font-size: clamp(14px, 3.2vw, 18px);
  color: var(--fg);
}

/* Pomonospace rattle */
@keyframes ticker-rattle {
  0% {
    transform: rotate(0deg) translateY(0);
  }
  30% {
    transform: rotate(-3deg) translateY(-1px);
  }
  60% {
    transform: rotate(2deg) translateY(1px);
  }
  100% {
    transform: rotate(0deg) translateY(0);
  }
}
#spin.tick::before {
  animation: ticker-rattle 120ms ease-out;
}
