/* Voting System overlay base */
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: transparent;
  font-family: 'Rajdhani', sans-serif;
}

#vote-root {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  --vs-bar-fill: #fbd07c;
  --vs-bar-track: #2a2a22;
  --vs-text: #ffffff;
  --vs-panel: #14140f;
  --vs-accent: #f7f779;
  --vs-bar-ease: 450ms;
  --vs-font: 'Rajdhani', sans-serif;
  font-family: var(--vs-font);
  color: var(--vs-text);
  pointer-events: none;
}

#vote-root.pos-left { justify-content: flex-start; padding-left: 3vw; }
#vote-root.pos-right { justify-content: flex-end; padding-right: 3vw; }
#vote-root.pos-center { justify-content: center; }

.vote-panel {
  position: relative;
  z-index: 2;
  width: min(520px, 92vw);
  padding: 18px 20px 14px;
  border-radius: 14px;
  overflow: hidden;
  background: color-mix(in srgb, var(--vs-panel) 88%, transparent);
  border: 1px solid color-mix(in srgb, var(--vs-accent) 35%, transparent);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(12px);
  opacity: 0;
  transform: translateY(12px) scale(0.97);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.vote-panel.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.vote-panel.hidden {
  display: none;
}

.vote-panel.results .vote-option.winner {
  border-color: var(--vs-accent);
  z-index: 2;
  overflow: visible;
}

.vote-panel.results .vote-option.loser {
  opacity: 0.42;
  filter: grayscale(0.25);
  transform: scale(0.98);
  transition: opacity 0.55s ease, filter 0.55s ease, transform 0.55s ease;
}

.vote-winner-tag {
  display: none;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #1a1a10;
  background: linear-gradient(90deg, var(--vs-bar-fill), var(--vs-accent));
  padding: 2px 7px;
  border-radius: 999px;
}

.vote-panel.results .vote-option.winner .vote-winner-tag {
  display: inline-flex;
  animation: vsWinnerTagIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes vsWinnerTagIn {
  from { opacity: 0; transform: translateY(6px) scale(0.8); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.vote-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.vote-question {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.02em;
  flex: 1;
}

.vote-timer {
  flex-shrink: 0;
  min-width: 48px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--vs-accent);
}

.vote-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.vote-option {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: color-mix(in srgb, var(--vs-panel) 70%, #000);
  transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.28s ease;
}

.vote-option.pulse {
  transform: scale(1.015);
}

.vote-option.juice {
  transform: scale(1.025);
}

.vote-option.juice .vote-option-bar {
  opacity: 0.62;
  filter: brightness(1.35) saturate(1.15);
  box-shadow: 0 0 22px color-mix(in srgb, var(--vs-accent) 55%, transparent);
}

.vote-option-inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
}

.vote-option-index {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  background: color-mix(in srgb, var(--vs-accent) 22%, transparent);
  color: var(--vs-accent);
}

.vote-option-label {
  font-weight: 600;
  font-size: 1.05rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vote-option-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
}

.vote-option-bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  background: linear-gradient(90deg, var(--vs-bar-fill), var(--vs-accent));
  opacity: 0.35;
  transition: width var(--vs-bar-ease) cubic-bezier(0.22, 1, 0.36, 1),
              opacity 0.35s ease, filter 0.35s ease, box-shadow 0.35s ease;
  z-index: 0;
}

.vote-option-track {
  position: absolute;
  inset: 0;
  background: var(--vs-bar-track);
  opacity: 0.35;
  z-index: 0;
}

.vote-avatars {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  margin-top: 4px;
  padding: 0 12px 8px;
  gap: 3px;
  position: relative;
  z-index: 1;
  min-height: 0;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.vote-avatars:empty {
  display: none;
}

.vote-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--vs-panel) 80%, #000);
  object-fit: cover;
  margin-left: 0;
  background: #333;
  box-sizing: border-box;
  flex-shrink: 0;
}

.vote-avatar.fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  color: #111;
}

.show-avatar-rings .vote-avatar.plat-twitch,
.show-avatar-rings .magnet-flyer.plat-twitch {
  border-color: #9146ff;
}

.show-avatar-rings .vote-avatar.plat-youtube,
.show-avatar-rings .magnet-flyer.plat-youtube {
  border-color: #ff0000;
}

.show-avatar-rings .vote-avatar.plat-kick,
.show-avatar-rings .magnet-flyer.plat-kick {
  border-color: #53fc18;
}

.platform-tally-row {
  display: none;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.15em 0.35em;
  margin-top: 3px;
  font-size: 0.85rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.show-platform-votes .platform-tally-row:not(:empty) {
  display: flex;
}

.platform-tally {
  display: inline-flex;
  align-items: center;
  gap: 0.2em;
}

.platform-tally-logo {
  width: 1em;
  height: 1em;
  display: block;
  object-fit: contain;
  flex-shrink: 0;
}

.platform-tally-num {
  line-height: 1;
  font-size: 1em;
}

.platform-tally-sep {
  opacity: 0.45;
  font-weight: 600;
  padding: 0 0.05em;
}

.vote-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.85rem;
  opacity: 0.9;
}

.vote-status {
  color: var(--vs-accent);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.75rem;
}

.magnet-layer {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  overflow: hidden;
}

.magnet-flyer {
  position: absolute;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--vs-accent);
  object-fit: cover;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  will-change: transform, opacity;
  z-index: 5;
}

.magnet-flyer.fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: #1a1a10;
  background: linear-gradient(135deg, var(--vs-bar-fill), var(--vs-accent));
}

.hide-percent .vote-percent { display: none; }
.hide-counts .vote-count { display: none; }
