/* The host uses the same cards, controls and pink/blue accents as Party.
   The wheel's painted surfaces stay legible over arbitrary OBS footage. */
.raffle-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(16rem, 1fr);
  gap: var(--space-4);
  align-items: start;
}
.raffle-stage, .raffle-controls { min-width: 0; }
.raffle-stage__art {
  display: grid;
  place-items: center;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: var(--space-3);
  background:
    radial-gradient(ellipse at 85% 0%, var(--color-primary-soft), transparent 60%),
    radial-gradient(ellipse at 0 100%, var(--color-glow-secondary), transparent 55%),
    var(--color-surface);
}
.raffle-stage__footer {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: start;
  gap: var(--space-3);
  padding: var(--space-4);
  border-top: var(--border-width) solid var(--color-border);
}
.raffle-stage__footer .obs-menu { margin-inline-start: auto; }
.raffle-stage__footer .obs-menu__panel {
  inset: auto var(--space-4) calc(100% - var(--space-4) + var(--space-1)) auto;
  width: min(var(--size-obs-menu), calc(100% - 2 * var(--space-4)));
  max-height: min(70vh, 30rem);
  overflow-y: auto;
}
.raffle-launcher {
  position: relative;
  display: grid;
  flex: 1 1 10rem;
  border-radius: var(--radius);
  transition: transform 280ms cubic-bezier(.2,1.45,.35,1);
}
.raffle-dismiss { margin: 0 var(--space-4) var(--space-3); }
.raffle-spin {
  position: relative;
  overflow: hidden;
  touch-action: none;
  user-select: none;
}
.raffle-launcher:has(.charging) {
  transform: translateY(var(--space-1)) scale(.985);
  transition: transform 1.6s var(--ease-out);
}
.raffle-spin.charging {
  background: color-mix(in srgb, var(--color-secondary) 14%, var(--color-on-video));
  transform: none;
  border-color: var(--color-secondary);
}
.raffle-spin__meter {
  display: none;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.charging .raffle-spin__meter { display: block; }
.raffle-spin__energy { fill: var(--color-primary-strong); }
.raffle-spin__dividers {
  fill: none;
  stroke: var(--color-on-primary);
  stroke-opacity: .18;
  stroke-width: var(--border-width);
  vector-effect: non-scaling-stroke;
}
.raffle-spin__label {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.raffle-spin.raffle-spin--high {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 var(--focus-width) var(--color-primary-soft);
}
@media (prefers-reduced-motion: no-preference) {
  .raffle-launcher:has(.raffle-spin--high) {
    animation: raffle-power-heartbeat 900ms ease-in-out infinite;
  }
  .raffle-launcher:has(.raffle-spin--peak) { animation-duration: 680ms; }
}
@keyframes raffle-power-heartbeat {
  0%, 24%, 54%, 100% { translate: 0 0; scale: 1; }
  12% { translate: calc(-1 * var(--focus-width)) 0; scale: 1.016; }
  38% { translate: var(--border-width) 0; scale: 1.009; }
}
.raffle-controls .card__header { gap: var(--space-2); }
.raffle-count {
  margin-inline-start: auto;
  border-radius: var(--radius-pill);
  padding: var(--space-1) var(--space-2);
  background: var(--color-primary-soft);
  color: var(--color-primary-text);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  font-variant-numeric: tabular-nums;
}
.raffle-controls fieldset, .raffle-settings__body {
  display: grid;
  gap: var(--space-3);
  min-width: 0;
  padding: 0;
  margin: 0;
  border: 0;
}
.raffle-controls label {
  display: grid;
  gap: var(--space-1);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
}
.raffle-controls textarea.party-input {
  min-height: calc(var(--size-control) * 1.7);
  padding: var(--space-2) var(--space-3);
  font-family: inherit;
  resize: vertical;
}
.raffle-controls .party-input { width: 100%; }
.raffle-add, .raffle-clear { justify-self: start; }
.raffle-roster {
  list-style: none;
  display: grid;
  max-height: 14rem;
  overflow-y: auto;
  margin: 0;
  padding: 0;
  border-block-start: var(--border-width) solid var(--color-border);
}
.raffle-roster:empty, .raffle-settings output:empty { display: none; }
.raffle-roster li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding-inline-start: var(--space-2);
  border-bottom: var(--border-width) solid var(--color-border);
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
}
.raffle-roster li::before {
  content: "";
  flex: none;
  width: var(--space-2);
  height: var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--color-primary-strong);
}
.raffle-roster li:nth-child(even)::before { background: var(--color-secondary); }
.raffle-roster li span { flex: 1; }
.raffle-roster .button { min-height: var(--size-control-small); }
.raffle-settings { padding-top: var(--space-3); border-top: var(--border-width) solid var(--color-border); }
.raffle-settings summary { cursor: pointer; color: var(--color-fg); font-weight: var(--weight-semibold); font-size: var(--text-sm); }
.raffle-settings__body { padding-top: var(--space-3); }
.raffle-settings .raffle-check { display: flex; align-items: center; gap: var(--space-2); font-weight: normal; }
.raffle-check input { accent-color: var(--color-primary); }
.raffle-settings output { color: var(--color-muted); font-size: var(--text-sm); }

.raffle-wheel {
  --paper: var(--color-on-video);
  --pink: var(--color-primary-strong);
  --blue: var(--color-secondary);
  --ink: color-mix(in srgb,var(--color-on-primary) 76%,var(--pink));
  --lacquer: color-mix(in srgb,var(--ink) 65%,var(--pink));
  --blush: color-mix(in srgb,var(--pink) 42%,var(--paper));
  --sky: color-mix(in srgb,var(--blue) 42%,var(--paper));
  width: min(100%, 32rem);
  isolation: isolate;
}
.overlay-page .raffle-wheel {
  --pink: var(--color-overlay-pink);
  --blue: var(--color-overlay-blue);
  --ink: color-mix(in srgb,var(--color-video) 76%,var(--pink));
  width: min(100vw, 108vh, 34rem);
}
.festival-scene { position: relative; }
.festival-scene > svg { width: 100%; display: block; overflow: visible; }
.festival-stop-pink { stop-color: var(--pink); }
.festival-stop-blue { stop-color: var(--blue); }
.festival-stop-ink { stop-color: var(--lacquer); }
.festival-case { fill: url(#festival-rim); stroke: var(--ink); stroke-width: 1.6; }
.festival-inlay { fill: none; stroke: var(--blush); stroke-width: .55; }
.festival-charge-rim, .festival-charge-hub { display: none; }
.festival-charging .festival-charge-rim, .festival-charging .festival-charge-hub { display: inline; }
.festival-charge-rim { fill: none; }
.festival-charge-track { stroke: var(--ink); stroke-width: 7.5; }
.festival-charge-fill { stroke: url(#festival-charge); stroke-width: 6.5; }
.festival-charge-shine { stroke: var(--paper); stroke-width: 1.1; }
.festival-charge-hub text { fill: var(--paper); font-size: 8px; font-weight: var(--weight-bold); font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: no-preference) {
  .festival-charging--high .festival-scene > svg {
    animation: festival-heartbeat 900ms ease-in-out infinite;
    transform-origin: 50% 52%;
  }
  .festival-charging--peak .festival-scene > svg { animation-duration: 680ms; }
}
@keyframes festival-heartbeat {
  0%, 24%, 54%, 100% { scale: 1; }
  12% { scale: 1.021; }
  38% { scale: 1.012; }
}
.festival-bulb, .festival-pointer-pin, .festival-pollen { fill: var(--paper); }
.festival-dial { fill: var(--blush); stroke: var(--ink); stroke-width: .8; }
.raffle-slice { fill: var(--blush); stroke: var(--paper); stroke-width: .65; }
.raffle-slice:nth-child(4n+2) { fill: var(--sky); }
.raffle-slice:nth-child(4n+3) { fill: color-mix(in srgb,var(--blush) 38%,var(--paper)); }
.raffle-slice:nth-child(4n) { fill: color-mix(in srgb,var(--blue) 48%,var(--pink)); }
.raffle-slice text { fill: var(--ink); stroke: none; font-size: 6.2px; font-weight: var(--weight-bold); }
.raffle-slice text.festival-short-label { font-size: 8.6px; }
.raffle-peg { fill: var(--lacquer); stroke: var(--paper); stroke-width: .5; }
.festival-stitch { fill: none; stroke: var(--lacquer); stroke-width: .5; stroke-dasharray: 1.4 1.8; opacity: .65; }
.festival-wave { fill: none; stroke: var(--lacquer); stroke-width: .6; }
.festival-print { opacity: .16; }
.festival-hub { fill: var(--lacquer); stroke: var(--paper); stroke-width: 1.2; }
.festival-hub-ring { fill: none; stroke: var(--pink); stroke-width: .6; }
.festival-flower { fill: var(--pink); stroke: var(--lacquer); stroke-width: .65; }
.raffle-pointer { fill: var(--pink); stroke: var(--ink); stroke-width: 1.5; }
.festival-string, .festival-cord, .festival-ribs, .festival-cap { fill: none; stroke: var(--lacquer); stroke-linecap: round; }
.festival-string, .festival-cord { stroke-width: 1.3; }
.festival-lantern { fill: var(--blush); stroke: var(--lacquer); stroke-width: 1.2; }
.festival-ribs { stroke-width: .75; opacity: .65; }
.festival-cap { stroke-width: 3; }
.festival-lantern-body { transform-origin: 0 -24px; }
.festival-spinning .festival-lantern-body { animation: festival-sway 1.2s ease-in-out infinite alternate; }
.festival-firework { opacity: 0; fill: none; stroke: var(--pink); stroke-width: 1.7; stroke-linecap: round; }
.festival-firework path:nth-child(even) { stroke: var(--blue); }
.festival-reveal .festival-firework { animation: festival-bloom 1.3s ease-out both; }
.festival-mascot {
  position: absolute;
  width: 28%;
  height: auto;
  bottom: 0;
  left: 0;
  pointer-events: none;
  transform-origin: 48% 95%;
  filter: drop-shadow(0 var(--border-width) var(--focus-width) var(--color-video-scrim));
}
.festival-orbit { opacity: 0; fill: var(--pink); stroke: var(--lacquer); stroke-width: .55; }
.festival-orbit path:nth-child(even) { fill: var(--sky); }
.festival-trails { fill: none; stroke: var(--blue); stroke-width: 1.1; stroke-linecap: round; stroke-dasharray: 39 140 8 52; }
.festival-spinning .festival-orbit { opacity: .96; }
.festival-landing .festival-orbit { opacity: .38; transition: opacity 1s ease-out; }
.festival-spinning .festival-mascot { animation: festival-sway-to-music .6s ease-in-out infinite alternate; }
.festival-reveal .festival-mascot { animation: festival-cheer .68s var(--ease-out) 2; }

.raffle-winner { position: absolute; inset: auto 5% 1% 32%; text-align: center; pointer-events: none; }
.festival-result { position: relative; display: block; }
.festival-banner {
  position: relative;
  isolation: isolate;
  display: grid;
  justify-items: center;
  gap: var(--space-1);
  padding: var(--space-2) 10% var(--space-3);
  border: var(--focus-width) solid var(--lacquer);
  border-radius: var(--radius-small);
  box-shadow: inset 0 0 0 var(--border-width) var(--pink), 0 var(--space-1) 0 var(--lacquer);
  background: linear-gradient(115deg,var(--blush),var(--paper) 28% 70%,var(--sky));
  color: var(--ink);
  line-height: var(--line-height-tight);
}
.festival-result::before {
  content: "";
  position: absolute;
  inset: 17% -7% -7%;
  background: linear-gradient(100deg,var(--pink),var(--lacquer) 22% 75%,var(--blue));
  clip-path: polygon(0 0,100% 0,96% 50%,100% 100%,0 100%,4% 50%);
}
.festival-winner-label {
  display: flex; align-items: center; gap: var(--space-2);
  font-size: var(--text-xs); font-weight: var(--weight-bold); letter-spacing: var(--tracking-wide);
}
.festival-winner-label::before, .festival-winner-label::after { content: ""; width: 1.5em; height: var(--border-width); background: var(--lacquer); }
.festival-banner strong { max-width: 100%; overflow-wrap: anywhere; font-size: clamp(1.15rem, 3.4vw, 2rem); }
.festival-reveal .festival-banner { animation: festival-unfold .56s cubic-bezier(.19,1.28,.35,1) both; }
.festival-shower { position: absolute; z-index: 1; inset: 0; }
.festival-shower i {
  --drift: -2em; --lift: -5em; --turn: -125deg;
  position: absolute; left: 12%; top: 0; width: .55em; height: .85em;
  background: var(--pink); border-radius: 90% 10% 80% 20%; opacity: 0;
}
.festival-shower i:nth-child(3n) { --lift: -7.5em; width: .4em; left: 36%; background: var(--blue); }
.festival-shower i:nth-child(3n+2) { --lift: -4em; left: 68%; }
.festival-shower i:nth-child(even) { --drift: 2.8em; --turn: 160deg; }
.festival-shower i:nth-child(4n+1) { left: 88%; --drift: 1.2em; }
.festival-reveal .festival-shower i { animation: festival-scatter 1.25s ease-out both; }
.festival-reveal .festival-shower i:nth-child(3n+2) { animation-delay: .12s; }
.festival-reveal .festival-shower i:nth-child(4n) { animation-delay: .24s; }
@keyframes festival-sway-to-music { to { transform: translateY(-1.5%) rotate(-3deg); } }
@keyframes festival-cheer { 40% { transform: translateY(-7%) rotate(-5deg); } }
@keyframes festival-sway { from { transform: rotate(-6deg); } to { transform: rotate(5deg); } }
@keyframes festival-bloom {
  0% { opacity: 0; transform: scale(.15); }
  26% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.3); }
}
@keyframes festival-unfold {
  from { opacity: 0; transform: translateY(18%) scale(.70,.86); }
  to { opacity: 1; transform: none; }
}
@keyframes festival-scatter {
  0% { opacity: 0; transform: scale(.45); }
  15% { opacity: 1; }
  63% { opacity: 1; transform: translate(var(--drift),var(--lift)) rotate(var(--turn)); }
  100% { opacity: 0; transform: translate(calc(var(--drift) * 1.65),calc(var(--lift) + 2em)) rotate(calc(var(--turn) * 1.5)); }
}
@media (max-width: 700px) { .raffle-layout { grid-template-columns: minmax(0,1fr); } }
@media (prefers-reduced-motion: reduce) {
  .raffle-wheel *, .raffle-spin, .raffle-spin.charging { animation: none; transition: none; }
  .raffle-launcher:has(.charging) { transform: none; }
  .raffle-wheel .festival-orbit, .festival-shower { display: none; }
}
