:root {
  color-scheme: dark;
  font-family: ui-sans-serif, system-ui, sans-serif;
  --ink: #f7f2e9;
  --muted: #a9a7b5;
  --coral: #ff4f83;
  --mint: #61e6cf;
  --violet: #8d6bff;
  --gold: #ffd36b;
  --panel: rgb(15 15 29 / 76%);
  --line: rgb(255 255 255 / 12%);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

.display-page {
  position: relative;
  color: var(--ink);
  background: #070711;
  isolation: isolate;
}

.dj-stage {
  position: fixed;
  inset: 0;
  z-index: -3;
  width: 100%;
  height: 100%;
  display: block;
}

.scanline {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  opacity: 0.16;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 3px,
    rgb(255 255 255 / 3%) 4px
  );
  mix-blend-mode: overlay;
}

.display-header,
.display-footer {
  position: fixed;
  right: clamp(2rem, 4vw, 5rem);
  left: clamp(2rem, 4vw, 5rem);
  z-index: 4;
  display: grid;
  align-items: center;
}

.display-header {
  top: 0;
  grid-template-columns: 1fr auto 1fr;
  min-height: clamp(5.5rem, 10vh, 8rem);
  border-bottom: 1px solid var(--line);
}

.display-brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  font-family: "Arial Black", ui-sans-serif, sans-serif;
  font-size: clamp(1.2rem, 1.7vw, 2rem);
  letter-spacing: -0.05em;
}

.display-brand em {
  margin-left: 0.3rem;
  color: #8e8c9c;
  font-family: ui-monospace, monospace;
  font-size: 0.62rem;
  font-style: normal;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.brand-disc {
  position: relative;
  width: clamp(2.4rem, 3vw, 3.5rem);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 0.22rem solid var(--coral);
  border-radius: 50%;
  box-shadow: 0 0 2rem rgb(255 79 131 / 38%);
}

.brand-disc::before,
.brand-disc i {
  content: "";
  border-radius: 50%;
}

.brand-disc::before {
  position: absolute;
  inset: 23%;
  border: 1px solid rgb(255 255 255 / 36%);
}

.brand-disc i {
  width: 17%;
  aspect-ratio: 1;
  background: var(--mint);
}

.display-status {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgb(8 8 18 / 52%);
  backdrop-filter: blur(14px);
  font-size: clamp(0.68rem, 0.9vw, 0.86rem);
  font-weight: 700;
}

.state-dot,
.motion-pulse {
  width: 0.62rem;
  height: 0.62rem;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 1.2rem var(--mint);
}

.preview-tag {
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  color: #111019;
  background: var(--gold);
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.phase-label {
  justify-self: end;
  text-align: right;
}

.phase-label span,
.phase-label strong {
  display: block;
}

.phase-label span {
  color: #777584;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.phase-label strong {
  margin-top: 0.2rem;
  font-size: clamp(0.95rem, 1.4vw, 1.35rem);
  text-transform: capitalize;
}

.display-shell {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(26rem, 0.85fr);
  align-items: center;
  gap: clamp(1rem, 3vw, 4rem);
  padding: clamp(8rem, 14vh, 11rem) clamp(2rem, 5vw, 6rem) clamp(6rem, 10vh, 8rem);
}

.story-column {
  width: min(100%, 39rem);
  justify-self: end;
  padding: clamp(1.5rem, 3vw, 3rem);
  border: 1px solid var(--line);
  border-radius: clamp(1.4rem, 2vw, 2.2rem);
  background: linear-gradient(145deg, rgb(19 18 36 / 80%), rgb(8 8 17 / 62%));
  box-shadow: 0 2rem 8rem rgb(0 0 0 / 34%);
  backdrop-filter: blur(24px);
}

.story-kicker {
  margin: 0;
  color: var(--coral);
  font-size: clamp(0.68rem, 0.8vw, 0.85rem);
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.story-column h1 {
  margin: 0.65rem 0 1rem;
  font-family: "Arial Black", ui-sans-serif, sans-serif;
  font-size: clamp(2.5rem, 3.35vw, 4.6rem);
  line-height: 0.92;
  letter-spacing: -0.065em;
}

.story-copy {
  max-width: 38rem;
  margin: 0;
  color: var(--muted);
  font-size: clamp(0.95rem, 1.3vw, 1.3rem);
  line-height: 1.55;
}

.now-playing-card {
  margin-top: clamp(1.2rem, 2.4vh, 2rem);
  padding: 1rem 1.15rem;
  border: 1px solid rgb(97 230 207 / 32%);
  border-radius: 1rem;
  background: rgb(97 230 207 / 9%);
}

.now-playing-card span,
.now-playing-card strong,
.now-playing-card em {
  display: block;
}

.now-playing-card span {
  color: var(--mint);
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.now-playing-card strong {
  margin-top: 0.35rem;
  font-size: clamp(1.05rem, 1.45vw, 1.5rem);
}

.now-playing-card em {
  margin-top: 0.16rem;
  color: var(--muted);
  font-size: 0.86rem;
  font-style: normal;
}

.now-playing-card.paused {
  border-color: var(--line);
  background: rgb(255 255 255 / 4%);
}

.vote-board,
.winner-card,
.protected-card {
  margin-top: clamp(1.4rem, 3vh, 2.5rem);
  border-radius: 1.15rem;
}

.vote-board {
  padding: 1rem;
  border: 1px solid rgb(141 107 255 / 35%);
  background: rgb(141 107 255 / 8%);
}

.vote-board-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
  color: #bcb2e9;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.display-candidates {
  display: grid;
  gap: 0.48rem;
}

.display-candidate {
  --share: 0%;
  position: relative;
  isolation: isolate;
  min-height: 3.25rem;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.7rem;
  padding: 0.65rem 0.75rem;
  overflow: hidden;
  border-radius: 0.75rem;
  background: rgb(255 255 255 / 5%);
}

.display-candidate::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  z-index: -1;
  width: var(--share);
  background: linear-gradient(90deg, rgb(97 230 207 / 25%), transparent);
  transition: width 500ms ease;
}

.candidate-rank {
  color: #7c7990;
  font-family: ui-monospace, monospace;
  font-size: 0.7rem;
}

.candidate-name strong,
.candidate-name span {
  display: block;
}

.candidate-name strong {
  overflow: hidden;
  font-size: 0.88rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.candidate-name span {
  margin-top: 0.12rem;
  color: #8c8999;
  font-size: 0.68rem;
}

.candidate-votes {
  color: var(--mint);
  font-family: "Arial Black", ui-sans-serif, sans-serif;
  font-size: 1rem;
}

.winner-card {
  position: relative;
  padding: 1.2rem 1.35rem;
  overflow: hidden;
  color: #121019;
  background: linear-gradient(130deg, var(--gold), #ff8e70 65%, var(--coral));
  box-shadow: 0 0 4rem rgb(255 110 110 / 24%);
}

.winner-card::after {
  content: "";
  position: absolute;
  width: 8rem;
  height: 8rem;
  right: -2rem;
  top: -4rem;
  border: 1.4rem solid rgb(255 255 255 / 20%);
  border-radius: 50%;
}

.winner-card span,
.winner-card strong {
  position: relative;
  z-index: 1;
  display: block;
}

.winner-label {
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.winner-card strong {
  margin: 0.28rem 0 0.15rem;
  font-family: "Arial Black", ui-sans-serif, sans-serif;
  font-size: clamp(1.35rem, 2.2vw, 2.4rem);
  letter-spacing: -0.045em;
}

.winner-card > span:last-child {
  font-size: 0.8rem;
  font-weight: 700;
}

.protected-card {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 1rem 1.1rem;
  border: 1px solid rgb(255 79 131 / 28%);
  background: rgb(255 79 131 / 9%);
}

.protected-icon {
  width: 2.8rem;
  height: 2.8rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #14111a;
  background: var(--coral);
  font-size: 1.2rem;
}

.protected-card strong,
.protected-card div span {
  display: block;
}

.protected-card div span {
  margin-top: 0.2rem;
  color: #aaa6b4;
  font-size: 0.76rem;
}

.qr-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: clamp(1rem, 2.5vh, 1.8rem);
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: rgb(255 255 255 / 4%);
}

.qr-card img {
  width: clamp(6rem, 9vw, 8.5rem);
  height: clamp(6rem, 9vw, 8.5rem);
  flex: 0 0 auto;
  padding: 0.45rem;
  border-radius: 0.7rem;
  background: white;
}

.qr-card strong,
.qr-card span,
.qr-card a {
  display: block;
}

.qr-card strong {
  font-size: clamp(0.85rem, 1.2vw, 1.1rem);
}

.qr-card span {
  margin-top: 0.3rem;
  color: #8f8c9c;
  font-size: clamp(0.68rem, 0.9vw, 0.85rem);
  line-height: 1.45;
}

.qr-card a {
  margin-top: 0.45rem;
  color: var(--mint);
  font-size: clamp(0.7rem, 0.9vw, 0.85rem);
  font-weight: 750;
}

.motion-note {
  position: fixed;
  left: clamp(2rem, 4vw, 5rem);
  bottom: clamp(5rem, 9vh, 7rem);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: #6e6c7a;
  font-size: clamp(0.6rem, 0.75vw, 0.75rem);
  font-weight: 650;
}

.motion-pulse {
  width: 0.45rem;
  height: 0.45rem;
  background: var(--violet);
  box-shadow: 0 0 1rem var(--violet);
}

.display-footer {
  bottom: 0;
  grid-template-columns: 1fr auto;
  min-height: clamp(4rem, 8vh, 6rem);
  border-top: 1px solid var(--line);
  color: #858290;
  font-size: clamp(0.68rem, 0.9vw, 0.88rem);
}

.display-clock {
  color: #efebf3;
  font-family: ui-monospace, monospace;
  font-size: clamp(0.95rem, 1.3vw, 1.25rem);
  font-weight: 700;
  letter-spacing: 0.08em;
}

.webgl-fallback {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 0.7rem;
  padding: 2rem;
  color: white;
  background: #0d0d16;
  text-align: center;
}

.webgl-fallback strong {
  font-family: "Arial Black", ui-sans-serif, sans-serif;
  font-size: clamp(2rem, 5vw, 5rem);
}

.webgl-fallback span {
  max-width: 34rem;
  color: #aaa7b5;
}

[data-display-state="voting"] .story-kicker {
  color: var(--mint);
}

[data-display-state="winner"] .story-kicker {
  color: var(--gold);
}

[data-display-state="locked"] .story-kicker {
  color: var(--coral);
}

[data-display-state="degraded"] .state-dot {
  background: var(--gold);
  box-shadow: 0 0 1.2rem var(--gold);
}

@media (max-aspect-ratio: 4 / 3) {
  .display-shell {
    grid-template-columns: 1fr;
    align-items: end;
  }

  .stage-spacer {
    display: none;
  }

  .story-column {
    width: min(92vw, 42rem);
    justify-self: center;
  }

  .motion-note {
    display: none;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .state-dot,
  .motion-pulse {
    animation: pulse 1.8s ease-in-out infinite;
  }

  .winner-card:not([hidden]) {
    animation: winner-in 520ms cubic-bezier(0.2, 1.6, 0.4, 1) both;
  }
}

@keyframes pulse {
  50% {
    opacity: 0.55;
    transform: scale(0.72);
  }
}

@keyframes winner-in {
  from {
    opacity: 0;
    transform: translateY(1rem) rotate(-1deg);
  }
}
