:root {
  color-scheme: dark;
  --display-font: "Gotham Night", "Gotham Knights", Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  --black: #050505;
  --coal: #0b0a07;
  --stone: #16120a;
  --gold: #f4d06f;
  --gold-deep: #c9972c;
  --gold-pale: #fff3bb;
  --text: #fff8df;
  --muted: #bfb8a2;
  --dim: #776f5d;
  --red: #e23b2e;
  --line: rgba(244, 208, 111, 0.2);
  --shadow: rgba(0, 0, 0, 0.48);
}

@font-face {
  font-family: "Gotham Night";
  src: url("./assets/fonts/gotham-night.ttf") format("truetype");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--black);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.burst-canvas {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
}

.app-shell {
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  background:
    radial-gradient(circle at 30% 15%, rgba(244, 208, 111, 0.14), transparent 32%),
    linear-gradient(135deg, #050505 0%, #100d07 58%, #050505 100%);
}

.audience-shell {
  grid-template-columns: 1fr;
}

.stage {
  position: relative;
  min-height: 100svh;
  padding: 40px clamp(24px, 4vw, 64px);
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  isolation: isolate;
}

.stage-video,
.stage-shade,
.grain {
  position: absolute;
  inset: 0;
}

.stage-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.26;
  filter: saturate(0.75) contrast(1.15);
  z-index: -4;
}

.stage-shade {
  z-index: -2;
  background:
    linear-gradient(90deg, rgba(5, 5, 5, 0.86), rgba(5, 5, 5, 0.45) 46%, rgba(5, 5, 5, 0.8)),
    radial-gradient(circle at 50% 52%, rgba(244, 208, 111, 0.15), transparent 38%);
}

.grain {
  z-index: -1;
  opacity: 0.34;
  mix-blend-mode: screen;
  background-image:
    linear-gradient(115deg, transparent 0 48%, rgba(255, 243, 187, 0.08) 49% 50%, transparent 51% 100%),
    repeating-linear-gradient(0deg, rgba(255,255,255,0.04) 0 1px, transparent 1px 5px);
}

.event-header {
  display: flex;
  justify-content: space-between;
  gap: 32px;
  align-items: start;
  animation: riseIn 700ms ease-out both;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.event-brand {
  display: grid;
  gap: 12px;
  align-items: start;
  max-width: min(620px, 100%);
}

.event-logo {
  display: block;
  width: min(560px, 100%);
  height: auto;
  filter: drop-shadow(0 16px 34px rgba(0, 0, 0, 0.44));
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
}

.theme {
  margin: 16px 0 0;
  color: var(--text);
  font-size: clamp(1rem, 2vw, 1.7rem);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.38em;
}

.event-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--text);
  font-weight: 900;
  text-transform: uppercase;
  white-space: nowrap;
}

.event-meta strong {
  color: var(--red);
  font-family: var(--display-font);
  font-size: clamp(2rem, 4vw, 4.5rem);
  letter-spacing: 0;
}

.event-meta span {
  color: var(--text);
}

.draw-wrap {
  align-self: center;
  width: min(920px, 100%);
  padding-top: 24px;
  animation: riseIn 820ms 120ms ease-out both;
}

.draw-status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  color: var(--gold-pale);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.live-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--gold);
  box-shadow: 0 0 0 8px rgba(244, 208, 111, 0.12), 0 0 24px var(--gold);
}

.number-frame {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: clamp(24px, 4vw, 48px) 0;
}

.number-kicker,
.draw-mark {
  display: block;
  color: var(--muted);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.draw-number {
  margin: 8px 0 4px;
  font-family: var(--display-font);
  font-size: clamp(7rem, 22vw, 21rem);
  line-height: 0.82;
  letter-spacing: 0;
  color: var(--gold-pale);
  text-shadow:
    0 6px 0 rgba(119, 111, 93, 0.5),
    0 0 36px rgba(244, 208, 111, 0.42),
    0 42px 80px rgba(0, 0, 0, 0.72);
  font-variant-numeric: tabular-nums;
}

.draw-number.is-rolling {
  animation: numberPulse 420ms ease-in-out infinite alternate;
}

.draw-number.is-winner {
  animation: lockIn 720ms cubic-bezier(.2, .9, .2, 1) both;
}

.primary-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 24px;
}

.audience-note {
  margin-top: 24px;
  color: var(--muted);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.draw-button,
.quiet-button,
.icon-button,
.mode-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, color 180ms ease;
}

.draw-button {
  min-height: 64px;
  padding: 0 32px;
  border-color: rgba(244, 208, 111, 0.72);
  background: linear-gradient(180deg, var(--gold-pale), var(--gold-deep));
  color: #171006;
  font-weight: 1000;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  box-shadow: 0 18px 60px rgba(201, 151, 44, 0.22);
}

.draw-button.small {
  min-height: 52px;
  width: 100%;
}

.draw-button:hover,
.icon-button:hover,
.quiet-button:hover,
.mode-button:hover {
  transform: translateY(-1px);
  border-color: rgba(244, 208, 111, 0.76);
}

.draw-button:disabled {
  opacity: 0.58;
  cursor: wait;
}

.icon-button {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  background: rgba(5, 5, 5, 0.44);
}

.icon-button svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: square;
}

.speaker-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
  animation: riseIn 850ms 220ms ease-out both;
}

.speaker-strip article {
  position: relative;
  height: clamp(90px, 14vw, 150px);
  overflow: hidden;
  border-top: 1px solid rgba(244, 208, 111, 0.35);
  background: rgba(5, 5, 5, 0.42);
}

.speaker-strip img,
.speaker-strip video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.82;
  filter: contrast(1.08) saturate(0.92);
}

.control-room {
  min-height: 100svh;
  padding: 32px 24px;
  background:
    linear-gradient(180deg, rgba(22, 18, 10, 0.98), rgba(5, 5, 5, 0.98)),
    repeating-linear-gradient(90deg, rgba(244, 208, 111, 0.04) 0 1px, transparent 1px 8px);
  border-left: 1px solid var(--line);
  box-shadow: -24px 0 70px rgba(0, 0, 0, 0.42);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.is-hidden {
  display: none !important;
}

.admin-panel {
  display: flex;
  min-height: 100%;
  flex-direction: column;
  gap: 24px;
}

.admin-panel.is-locked {
  display: none;
}

.login-panel {
  display: grid;
  align-content: center;
  min-height: calc(100svh - 64px);
}

.login-panel h2 {
  max-width: 260px;
  margin-bottom: 24px;
  color: var(--gold-pale);
  font-family: var(--display-font);
  font-size: 2.8rem;
  line-height: 0.95;
  letter-spacing: 0;
  text-transform: uppercase;
}

.login-panel form,
.login-panel label {
  display: grid;
  gap: 14px;
}

.login-panel label {
  gap: 8px;
}

.login-panel span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.login-error {
  min-height: 24px;
  margin: 12px 0 0;
  color: var(--red);
  font-weight: 900;
}

.control-head,
.history-head,
.control-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.control-room h2 {
  margin-bottom: 0;
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.quiet-button,
.mode-button {
  min-height: 40px;
  padding: 0 14px;
  background: rgba(255, 248, 223, 0.04);
  font-weight: 800;
}

.link-mode {
  display: grid;
  place-items: center;
  text-decoration: none;
}

.settings {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.settings label {
  display: grid;
  gap: 8px;
}

.settings span,
.meter small,
.control-foot {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

input[type="number"] {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: rgba(0, 0, 0, 0.28);
  color: var(--text);
  font-weight: 900;
}

.number-pool {
  display: grid;
  gap: 8px;
}

.number-pool span,
.number-pool small {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.number-pool textarea {
  width: 100%;
  min-height: 112px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.32);
  color: var(--gold-pale);
  font: 900 0.95rem/1.5 var(--body-font);
  letter-spacing: 0.04em;
}

.number-pool textarea:focus {
  outline: 2px solid rgba(244, 208, 111, 0.45);
  outline-offset: 2px;
}

.number-pool strong {
  color: var(--gold-pale);
  font-size: 0.95rem;
}

.toggle-row {
  grid-column: 1 / -1;
  min-height: 48px;
  grid-template-columns: auto 1fr;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 248, 223, 0.035);
}

.toggle-row input {
  width: 20px;
  height: 20px;
  accent-color: var(--gold);
}

.mode-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.mode-button.is-active {
  background: rgba(244, 208, 111, 0.15);
  color: var(--gold-pale);
}

.meter {
  display: grid;
  gap: 12px;
}

.meter > div:first-child {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.meter span:first-child {
  color: var(--gold-pale);
  font-family: var(--display-font);
  font-size: 3rem;
  line-height: 1;
}

.meter-track {
  height: 8px;
  overflow: hidden;
  background: rgba(255, 248, 223, 0.08);
  border-radius: 999px;
}

.meter-track span {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold-pale));
  transition: width 260ms ease;
}

.visit-counter {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid rgba(244, 208, 111, 0.14);
  border-bottom: 1px solid rgba(244, 208, 111, 0.14);
}

.visit-counter > div,
.visit-counter label {
  display: grid;
  gap: 6px;
}

.visit-counter label {
  width: min(140px, 42%);
}

.visit-counter span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.visit-counter strong {
  color: var(--gold-pale);
  font-family: var(--display-font);
  font-size: 2.25rem;
  line-height: 1;
}

.visit-counter input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: rgba(0, 0, 0, 0.28);
  color: var(--text);
  font-weight: 900;
}

.winner-list {
  min-height: 160px;
  max-height: 34svh;
  overflow: auto;
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.winner-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(244, 208, 111, 0.12);
  animation: slideIn 260ms ease both;
}

.winner-list strong {
  color: var(--gold-pale);
  font-size: 1.45rem;
  font-variant-numeric: tabular-nums;
}

.winner-list span {
  color: var(--dim);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.control-foot {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid rgba(244, 208, 111, 0.16);
  align-items: flex-start;
  flex-wrap: wrap;
}

body.audience-mode .control-room {
  display: none;
}

body.audience-mode .app-shell {
  grid-template-columns: 1fr;
}

body.audience-mode .stage {
  padding: 28px clamp(32px, 6vw, 88px) 34px;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

body.audience-mode .primary-actions {
  display: none;
}

body.audience-mode .event-header {
  align-items: center;
  opacity: 0.58;
}

body.audience-mode .event-brand {
  gap: 8px;
  max-width: min(470px, 100%);
}

body.audience-mode .event-logo {
  width: min(420px, 100%);
}

body.audience-mode .event-meta strong {
  font-size: clamp(2rem, 3.8vw, 4rem);
}

body.audience-mode .draw-wrap {
  align-self: center;
  justify-self: center;
  width: min(1180px, 100%);
  padding-top: 0;
  text-align: center;
}

body.audience-mode .draw-status {
  margin-bottom: 12px;
  justify-content: center;
  color: var(--gold-pale);
}

body.audience-mode .number-frame {
  padding: clamp(18px, 3vw, 34px) 0 clamp(22px, 3.2vw, 42px);
  border-color: rgba(244, 208, 111, 0.48);
  background:
    radial-gradient(circle at 50% 50%, rgba(244, 208, 111, 0.16), transparent 58%),
    linear-gradient(90deg, transparent, rgba(244, 208, 111, 0.12), transparent);
}

body.audience-mode .number-kicker,
body.audience-mode .draw-mark {
  color: var(--gold-pale);
}

body.audience-mode .draw-number {
  font-size: clamp(11rem, 28vw, 30rem);
  text-shadow:
    0 8px 0 rgba(119, 111, 93, 0.56),
    0 0 48px rgba(244, 208, 111, 0.58),
    0 54px 90px rgba(0, 0, 0, 0.78);
}

body.audience-mode .audience-note {
  margin-top: 18px;
  color: rgba(191, 184, 162, 0.82);
}

body.audience-mode .speaker-strip {
  opacity: 0.74;
}

body.audience-mode .speaker-strip article {
  height: clamp(72px, 9vw, 118px);
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(14px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes numberPulse {
  from {
    filter: blur(0);
    transform: translateY(0) scale(1);
  }
  to {
    filter: blur(1px);
    transform: translateY(-3px) scale(1.015);
  }
}

@keyframes lockIn {
  0% {
    transform: scale(0.96);
  }
  58% {
    transform: scale(1.045);
  }
  100% {
    transform: scale(1);
  }
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .stage {
    min-height: 72svh;
  }

  .control-room {
    min-height: auto;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

@media (min-width: 1081px) and (max-height: 820px) {
  .stage {
    padding: 24px clamp(24px, 4vw, 52px);
  }

  h1 {
    font-size: clamp(3.5rem, 9.5vw, 7.6rem);
  }

  .theme {
    margin-top: 10px;
    font-size: 1rem;
    letter-spacing: 0.28em;
  }

  .event-meta strong {
    font-size: 2.9rem;
  }

  .draw-wrap {
    padding-top: 8px;
  }

  .draw-status {
    margin-bottom: 10px;
  }

  .number-frame {
    padding: 20px 0;
  }

  .draw-number {
    font-size: clamp(6.5rem, 16vw, 10rem);
  }

  .primary-actions {
    margin-top: 16px;
  }

  .draw-button,
  .icon-button {
    min-height: 56px;
  }

  .icon-button {
    width: 56px;
    height: 56px;
  }

  .speaker-strip article {
    height: 96px;
  }

  .control-room {
    padding: 16px 24px;
    gap: 16px;
  }

  .winner-list {
    max-height: 28svh;
  }
}

@media (max-width: 720px) {
  .stage {
    padding: 24px 18px;
    min-height: 78svh;
  }

  .event-header,
  .event-meta {
    display: block;
  }

  .event-brand {
    max-width: 100%;
  }

  .event-logo {
    width: min(420px, 100%);
  }

  .event-meta {
    margin-top: 18px;
    white-space: normal;
  }

  .event-meta strong {
    display: block;
    margin: 6px 0;
  }

  .draw-number {
    font-size: clamp(6.4rem, 36vw, 10rem);
  }

  .primary-actions {
    align-items: stretch;
  }

  .draw-button {
    flex: 1;
    padding: 0 18px;
  }

  .speaker-strip {
    grid-template-columns: repeat(2, 1fr);
  }

  .settings {
    grid-template-columns: 1fr;
  }

  .control-room {
    padding: 24px 18px;
  }
}
