@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/outfit-latin-wght-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/outfit-latin-ext-wght-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --base: #fbf8f6;
  --ink: #1d1730;
  --ink-rgb: 29, 23, 48;
  --accent: #6a3fd6;
  --accent2: #e0669a;
  --rim-a: 0deg;
  --rim-o: 0;
  --logo-scale: 1;
  --title1-scale: 1;
  --title2-scale: 1;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* Everything is sized in rem, and 1rem follows the screen, so the layout
   holds on any projector or LED wall. */
html { font-size: min(0.9vw, 1.6vh); }

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

body {
  font-family: 'Outfit', 'Avenir Next', 'Segoe UI', system-ui, sans-serif;
  color: var(--ink);
  background: var(--base);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}
body.quiet { cursor: none; }

#bg, #fx { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#bg { z-index: 0; }
#fx { z-index: 30; pointer-events: none; }

/* ---------- layout ---------- */

.screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 4rem 7rem;
  text-align: center;
}

/* Shrinks as a whole when a large logo or title would not fit the screen. */
.fit {
  flex: none;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform-origin: center center;
}

.head, .now { transition: opacity 0.9s ease, transform 0.9s ease; }
body[data-phase='running'] .head { opacity: 0.45; }

.logo {
  display: block;
  /* a fixed height, so small logo files can be enlarged too */
  height: calc(5.2rem * var(--logo-scale));
  width: auto;
  max-width: min(calc(40rem * var(--logo-scale)), 90vw);
  margin: 0 auto 1.4rem;
  object-fit: contain;
}

.label {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.42em;
  margin-right: -0.42em;
  opacity: 0.85;
}
.label:empty { display: none; }

.title {
  margin-top: 1.1rem;
  line-height: 1.02;
  font-weight: 200;
}
.title span { display: block; }
.title span:empty { display: none; }
.title-light { font-size: calc(4.3rem * var(--title1-scale)); font-weight: 200; letter-spacing: 0.02em; }
.title-bold {
  font-size: calc(4.5rem * var(--title2-scale));
  font-weight: 800;
  letter-spacing: 0.01em;
  background: linear-gradient(100deg, var(--ink) 20%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.now { margin-top: 2.6rem; min-height: 4.6rem; }
.eyebrow {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.44em;
  margin-right: -0.44em;
  text-transform: uppercase;
  opacity: 0.6;
}
.prize {
  margin-top: 0.5rem;
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  opacity: 0.72;
}

/* ---------- glass card ---------- */

.card {
  position: relative;
  margin-top: 1.6rem;
  width: min(64rem, 100%);
  min-height: 17rem;
  border-radius: 1.7rem;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.46));
  -webkit-backdrop-filter: blur(26px) saturate(1.25);
  backdrop-filter: blur(26px) saturate(1.25);
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow:
    0 2.4rem 4.5rem -1.8rem rgba(var(--ink-rgb), 0.28),
    0 0.3rem 1rem -0.4rem rgba(var(--ink-rgb), 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  display: grid;
  place-items: center;
  will-change: transform;
}
.card > * { grid-area: 1 / 1; }

/* travelling light on the card's edge while a draw runs */
.rim {
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  padding: 3px;
  background: conic-gradient(from var(--rim-a),
    transparent 0deg, transparent 235deg,
    var(--accent2) 300deg, var(--accent) 338deg, #fff 352deg, transparent 360deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  opacity: var(--rim-o);
  pointer-events: none;
}

.hint {
  font-size: 1.35rem;
  font-weight: 500;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  opacity: 0.62;
  transition: opacity 0.5s ease;
  padding: 0 2rem;
}
.hint kbd {
  font: inherit;
  font-size: 0.72em;
  font-weight: 700;
  letter-spacing: 0.2em;
  padding: 0.25em 0.6em 0.25em 0.8em;
  margin: 0 0.5em;
  border-radius: 0.5em;
  border: 1px solid rgba(var(--ink-rgb), 0.3);
  background: rgba(255, 255, 255, 0.6);
  vertical-align: 0.12em;
}

/* ---------- reel ---------- */

.reel {
  position: relative;
  width: 100%;
  height: 17rem;
  overflow: hidden;
  border-radius: inherit;
  opacity: 0;
  transition: opacity 0.6s ease;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 28%, #000 72%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0%, #000 28%, #000 72%, transparent 100%);
}
.reel-rows { position: absolute; inset: 0; }
.reel-row {
  position: absolute;
  left: 50%;
  top: 50%;
  max-width: 90%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 3.6rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.25;
  will-change: transform, opacity;
}
.reel-line {
  position: absolute;
  left: 12%;
  right: 12%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--accent2), transparent);
  opacity: 0.55;
}
.reel-line-top { top: calc(50% - 3.1rem); }
.reel-line-bottom { top: calc(50% + 3.1rem); }

/* ---------- winner ---------- */

.winner {
  width: 100%;
  padding: 1.5rem 3rem;
  opacity: 0;
  pointer-events: none;
}
.winner-meta {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.44em;
  margin-right: -0.44em;
  text-transform: uppercase;
  color: var(--accent);
}
.winner-name {
  margin-top: 0.7rem;
  font-size: 5.4rem;
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: 0;
  overflow-wrap: anywhere;
  background: linear-gradient(100deg, var(--ink) 10%, var(--accent) 110%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  padding-bottom: 0.08em;
}

/* ---------- final list ---------- */

.finale {
  list-style: none;
  width: 100%;
  padding: 2rem 3.5rem;
  display: none;
}
.finale li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 2rem;
  padding: 1.15rem 0.5rem;
  text-align: left;
  opacity: 0;
  animation: rise 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
.finale li + li { border-top: 1px solid rgba(var(--ink-rgb), 0.1); }
.finale li:nth-child(2) { animation-delay: 0.25s; }
.finale li:nth-child(3) { animation-delay: 0.5s; }
.finale .f-prize {
  flex: none;
  max-width: 45%;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.3em;
  color: var(--accent);
}
.finale .f-name {
  font-size: 2.7rem;
  font-weight: 700;
  line-height: 1.1;
  text-align: right;
  overflow-wrap: anywhere;
}

/* ---------- phases ---------- */

body[data-phase='running'] .hint,
body[data-phase='revealed'] .hint,
body[data-phase='finale'] .hint { opacity: 0; }

body[data-phase='running'] .reel { opacity: 1; }

body[data-phase='revealed'] .winner { opacity: 1; }
body[data-phase='revealed'].animate .winner-meta { animation: rise 0.9s 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
body[data-phase='revealed'].animate .winner-name { animation: arrive 1.3s cubic-bezier(0.16, 0.84, 0.24, 1) both; }
body[data-phase='revealed'].animate .card { animation: glow 2.4s ease-out both; }

body[data-phase='finale'] .finale { display: block; }
body[data-phase='finale'] .reel,
body[data-phase='finale'] .winner,
body[data-phase='finale'] .hint { display: none; }
body[data-phase='revealed'] .reel { display: none; }

@keyframes arrive {
  0% { opacity: 0; transform: scale(0.9); filter: blur(14px); letter-spacing: 0.18em; }
  60% { opacity: 1; filter: blur(0); }
  100% { opacity: 1; transform: scale(1); filter: blur(0); letter-spacing: 0; }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(0.8rem); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes glow {
  0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.9), 0 2.4rem 4.5rem -1.8rem rgba(var(--ink-rgb), 0.28); }
  30% { box-shadow: 0 0 5rem 1rem rgba(255, 255, 255, 0.85), 0 2.4rem 4.5rem -1.8rem rgba(var(--ink-rgb), 0.28); }
  100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0), 0 2.4rem 4.5rem -1.8rem rgba(var(--ink-rgb), 0.28); }
}

/* ---------- button ---------- */

.actions { margin-top: 2.6rem; height: 4.2rem; }
.cta {
  font: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: #fff;
  padding: 1.25rem 3.4rem 1.25rem 3.7rem;
  border: 0;
  border-radius: 99rem;
  background: linear-gradient(100deg, var(--accent2), var(--accent));
  box-shadow: 0 1.2rem 2.2rem -0.9rem var(--accent), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  cursor: pointer;
  transition: transform 0.25s ease, opacity 0.5s ease, box-shadow 0.25s ease;
}
.cta:hover { transform: translateY(-2px); }
.cta:active { transform: translateY(1px) scale(0.99); }
.cta:focus-visible { outline: 3px solid rgba(var(--ink-rgb), 0.5); outline-offset: 4px; }
.cta[disabled] { opacity: 0.35; cursor: default; transform: none; }
.cta.is-hidden { opacity: 0; pointer-events: none; }
body.no-button .actions, body.viewer .actions { visibility: hidden; }
body.no-heading .now { display: none; }
body.no-heading .card { margin-top: 3rem; }

/* ---------- footer and ticker ---------- */

.foot {
  position: fixed;
  left: 3.4rem;
  bottom: 2.6rem;
  z-index: 12;
  text-align: left;
  letter-spacing: 0.2em;
  font-size: 0.95rem;
  transition: bottom 0.4s ease;
}
.foot-date { font-weight: 700; }
.foot-venue { margin-top: 0.35rem; font-weight: 500; opacity: 0.6; }
body.has-ticker .foot { bottom: 5.4rem; }

.ticker {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 12;
  height: 3.2rem;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.5);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  border-top: 1px solid rgba(255, 255, 255, 0.8);
}
.ticker-track {
  display: inline-flex;
  height: 100%;
  align-items: center;
  white-space: nowrap;
  will-change: transform;
  animation: ticker linear infinite;
}
.ticker-item {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  padding: 0 2rem;
}
.ticker-item::after {
  content: '';
  display: inline-block;
  width: 0.4rem;
  height: 0.4rem;
  margin-left: 4rem;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: 0.15em;
}
@keyframes ticker {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* ---------- full screen button ---------- */

.fs-btn {
  position: fixed;
  top: 1.2rem;
  right: 1.4rem;
  z-index: 40;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
  padding: 8px 14px;
  border-radius: 99px;
  border: 1px solid rgba(var(--ink-rgb), 0.2);
  background: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  transition: opacity 0.4s ease;
}
body.quiet .fs-btn, :fullscreen .fs-btn { opacity: 0; pointer-events: none; }
