/* Colours here are fixed rather than themed: the wheel has to look the same on stream
   regardless of the viewer's or OBS's light/dark setting. */
.wheel-view {
  --wv-ink: #1c2540;
  --wv-paper: #fdfeff;
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  container-type: inline-size;
  opacity: 0;
  transform: scale(0.85) rotate(-6deg);
  transition: opacity 0.45s ease, transform 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.wheel-view.is-visible {
  opacity: 1;
  transform: none;
}
.wv-stage {
  position: absolute;
  inset: 5%;
  /* hard offset shadow, like a cut-out stuck on paper */
  filter: drop-shadow(0.9cqw 1.1cqw 0 rgba(28, 37, 64, 0.85));
}
.wv-canvas {
  width: 100%;
  height: 100%;
  display: block;
  will-change: transform;
}
.wv-hub {
  position: absolute;
  inset: 39%;
  border-radius: 50%;
  background: var(--wv-paper) center / cover no-repeat;
  border: 0.9cqw solid var(--wv-ink);
  box-shadow: inset 0 0 0 0.5cqw var(--wv-paper);
}
.wv-hub.has-image {
  /* a picture needs more room than the plain cap */
  inset: 35%;
}
.wv-pointer {
  position: absolute;
  top: -4%;
  left: 50%;
  width: 10%;
  aspect-ratio: 1 / 1.3;
  transform: translateX(-50%) rotate(2deg);
  background: var(--wv-ink);
  clip-path: polygon(4% 2%, 97% 0, 52% 100%);
}
.wv-pointer::after {
  content: '';
  position: absolute;
  inset: 0;
  background: #ffd43b;
  clip-path: polygon(16% 9%, 85% 8%, 52% 84%);
}

.wv-for,
.wv-result {
  position: absolute;
  left: 50%;
  bottom: 6%;
  z-index: 1;
  max-width: 92%;
  border: 0.7cqw solid var(--wv-ink);
  border-radius: 255px 18px 225px 18px / 18px 225px 18px 255px;
  box-shadow: 0.9cqw 1.1cqw 0 var(--wv-ink);
  font-family: 'Caveat Brush', 'Shantell Sans Variable', cursive;
  text-align: center;
}
.wv-for {
  /* same slot as the result banner, which replaces it when the wheel stops */
  transform: translateX(-50%) rotate(-1.5deg);
  padding: 0.15em 0.9em;
  background: var(--wv-paper);
  color: var(--wv-ink);
  font-size: clamp(14px, 5.5cqw, 60px);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wv-result {
  transform: translateX(-50%) rotate(-2deg);
  padding: 0.15em 0.8em 0.2em;
  background: var(--win, #ffd43b);
  color: var(--win-text, #1c2540);
  font-size: clamp(18px, 9cqw, 104px);
  line-height: 1.1;
  animation: wv-pop 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.4);
}
.wv-result-for {
  display: block;
  font-size: 0.5em;
  opacity: 0.9;
}
.wv-for[hidden],
.wv-result[hidden],
.wv-result-for[hidden] {
  display: none;
}
@keyframes wv-pop {
  from {
    opacity: 0;
    transform: translateX(-50%) rotate(8deg) scale(0.5);
  }
}
@media (prefers-reduced-motion: reduce) {
  .wheel-view,
  .wv-result {
    transition: none;
    animation: none;
  }
}

/* ---- Windows 98 theme (tannedtuna.com), set by the wheel's theme setting ---- */
.wv-rim,
.wv-titlebar {
  display: none;
}
.wheel-view.wv-win98 {
  transform: scale(0.85);
}
.wheel-view.wv-win98.is-visible {
  transform: none;
}
.wv-win98 .wv-stage {
  filter: drop-shadow(1cqw 1cqw 0 rgba(0, 0, 0, 0.35));
}
/* a raised grey frame around the wheel, lit from the top left */
.wv-win98 .wv-rim {
  display: block;
  position: absolute;
  inset: calc(2.83% - 2.3cqw);
  border-radius: 50%;
  border: 2.7cqw solid #c0c0c0;
  box-shadow: -0.35cqw -0.35cqw 0 #ffffff, 0.35cqw 0.35cqw 0 #0a0a0a, 0 0 0 0.35cqw #808080,
    inset 0.35cqw 0.35cqw 0 #808080, inset -0.35cqw -0.35cqw 0 #ffffff, inset 0 0 0 0.6cqw #0a0a0a;
  pointer-events: none;
}
.wv-win98 .wv-hub {
  background-color: #c0c0c0;
  border: 0.35cqw solid #0a0a0a;
  box-shadow: inset 0.55cqw 0.55cqw 0 #ffffff, inset -0.55cqw -0.55cqw 0 #808080;
}
/* the arrow cursor, turned to point down at the wheel */
.wv-win98 .wv-pointer {
  top: -6%;
  width: 7.5%;
  aspect-ratio: 14 / 21;
  transform: translateX(-92.8%) rotate(180deg);
  clip-path: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-1 -1 14 21' shape-rendering='crispEdges'%3E%3Cpath d='M0 0V16L4 12L7 19L9 18L6 11H11Z' fill='%23fff' stroke='%23000' stroke-width='1' stroke-linejoin='miter'/%3E%3C/svg%3E") center / contain no-repeat;
}
.wv-win98 .wv-pointer::after {
  display: none;
}
.wv-win98 .wv-for,
.wv-win98 .wv-result {
  border: 0.35cqw solid;
  border-color: #ffffff #0a0a0a #0a0a0a #ffffff;
  border-radius: 0;
  background: #c0c0c0;
  color: #0a0a0a;
  box-shadow: inset -0.25cqw -0.25cqw 0 #808080, inset 0.25cqw 0.25cqw 0 #dfdfdf, 0.8cqw 0.8cqw 0 rgba(0, 0, 0, 0.35);
  font-family: Tahoma, 'MS Sans Serif', Verdana, Geneva, sans-serif;
}
.wv-win98 .wv-for {
  transform: translateX(-50%);
  padding: 0.5em 1.2em;
  font-size: clamp(12px, 3.6cqw, 40px);
  font-weight: 700;
}
.wv-win98 .wv-result {
  transform: translateX(-50%);
  /* sized to the text rather than the half-width left of centre, so short labels stay on one line */
  width: max-content;
  min-width: 46%;
  padding: 0.35cqw;
  font-size: clamp(16px, 7cqw, 80px);
  font-weight: 700;
  animation-name: wv-win98-open;
}
.wv-win98 .wv-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1cqw;
  padding: 0.5cqw 0.5cqw 0.5cqw 1cqw;
  background: linear-gradient(90deg, #000080, #1084d0);
  color: #ffffff;
  font-size: clamp(10px, 2.6cqw, 30px);
  text-align: left;
}
.wv-win98 .wv-titlebar i {
  width: 1.3em;
  height: 1.15em;
  box-sizing: border-box;
  border: 0.2cqw solid;
  border-color: #ffffff #0a0a0a #0a0a0a #ffffff;
  background: #c0c0c0;
  color: #0a0a0a;
  font-style: normal;
  line-height: 0.95;
  text-align: center;
}
.wv-win98 .wv-result-for {
  margin-top: 0.4em;
  font-size: 0.4em;
  font-weight: 400;
}
.wv-win98 .wv-result-label {
  display: block;
  padding: 0.15em 0.5em 0.25em;
}
/* the winning slice's colour, as a sunken swatch */
.wv-win98 .wv-result-label::before {
  content: '';
  display: inline-block;
  width: 0.62em;
  height: 0.62em;
  margin-right: 0.3em;
  vertical-align: -0.04em;
  background: var(--win);
  border: 0.06em solid;
  border-color: #808080 #ffffff #ffffff #808080;
  box-shadow: inset 0.04em 0.04em 0 #0a0a0a;
}
@keyframes wv-win98-open {
  from {
    opacity: 0;
    transform: translateX(-50%) scale(0.6);
  }
}
@media (prefers-reduced-motion: reduce) {
  .wv-win98 .wv-result {
    animation: none;
  }
}
