:root {
  --bg: #202020;
  --panel: #120f0d;
  --panel-strong: #1a1510;
  --line: rgba(166, 122, 43, 0.34);
  --text: #fff1a8;
  --muted: #d5bd70;
  --gold: #f4c95d;
  --gold-soft: #80652d;
  --cream: #fff4bd;
  --silver: #e7d7a6;
  --bronze: #bf7d3f;
  --accent: #9b5cff;
  --accent-2: #f4c95d;
}

* { box-sizing: border-box; }

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 82% 12%, rgba(244, 201, 93, 0.08), transparent 28rem),
    linear-gradient(180deg, #242424 0%, #1e1e1e 42%, #191919 100%),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.background-squares {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.emote-squares {
  position: fixed;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
}

.emote-squares span {
  position: absolute;
  bottom: -190px;
  display: grid;
  place-items: center;
  width: 112px;
  height: 112px;
  border: 1px solid rgba(244, 201, 93, 0.22);
  border-radius: 10px;
  background: rgba(18, 15, 13, 0.42);
  box-shadow: inset 0 0 24px rgba(244, 201, 93, 0.06), 0 18px 44px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(4px);
  opacity: 0;
  animation: emoteSquareRise 29s linear infinite;
}

.emote-squares img {
  width: 72%;
  height: 72%;
  object-fit: contain;
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.35));
}

.emote-squares span:nth-child(1) { left: 4%; width: 92px; height: 92px; animation-duration: 24s; animation-delay: -3s; --drift-x: 54px; --spin: 190deg; }
.emote-squares span:nth-child(2) { left: 78%; width: 126px; height: 126px; animation-duration: 33s; animation-delay: -12s; --drift-x: -46px; --spin: -245deg; }
.emote-squares span:nth-child(3) { left: 11%; width: 108px; height: 108px; animation-duration: 29s; animation-delay: -18s; --drift-x: 28px; --spin: 160deg; }
.emote-squares span:nth-child(4) { left: 89%; width: 116px; height: 116px; animation-duration: 27s; animation-delay: -7s; --drift-x: -70px; --spin: 230deg; }
.emote-squares span:nth-child(5) { left: 23%; width: 78px; height: 78px; animation-duration: 22s; animation-delay: -15s; --drift-x: 62px; --spin: -180deg; }
.emote-squares span:nth-child(6) { left: 67%; width: 86px; height: 86px; animation-duration: 25s; animation-delay: -21s; --drift-x: -28px; --spin: 205deg; }
.emote-squares span:nth-child(7) { left: 39%; width: 132px; height: 132px; animation-duration: 36s; animation-delay: -26s; --drift-x: 74px; --spin: -270deg; }
.emote-squares span:nth-child(8) { left: 55%; width: 98px; height: 98px; animation-duration: 31s; animation-delay: -9s; --drift-x: -58px; --spin: 175deg; }

@keyframes emoteSquareRise {
  0% {
    transform: translate3d(0, 0, 0) rotate(-12deg);
    opacity: 0;
  }
  12% { opacity: 0.92; }
  82% { opacity: 0.82; }
  100% {
    transform: translate3d(var(--drift-x, 36px), -125vh, 0) rotate(var(--spin, 210deg));
    opacity: 0;
  }
}

.background-squares span {
  position: absolute;
  bottom: -160px;
  width: 96px;
  height: 96px;
  border: 1px solid rgba(244, 201, 93, 0.22);
  border-radius: 8px;
  background: rgba(244, 201, 93, 0.06);
  box-shadow: inset 0 0 28px rgba(244, 201, 93, 0.08), 0 0 36px rgba(244, 201, 93, 0.08);
  animation: floatSquare 24s linear infinite;
}

.background-squares span:nth-child(1) { left: 4%; width: 72px; height: 72px; animation-duration: 22s; animation-delay: -4s; }
.background-squares span:nth-child(2) { left: 17%; width: 118px; height: 118px; animation-duration: 28s; animation-delay: -12s; }
.background-squares span:nth-child(3) { left: 31%; width: 54px; height: 54px; animation-duration: 20s; animation-delay: -7s; }
.background-squares span:nth-child(4) { left: 48%; width: 148px; height: 148px; animation-duration: 34s; animation-delay: -18s; }
.background-squares span:nth-child(5) { left: 63%; width: 84px; height: 84px; animation-duration: 25s; animation-delay: -3s; }
.background-squares span:nth-child(6) { left: 76%; width: 128px; height: 128px; animation-duration: 31s; animation-delay: -14s; }
.background-squares span:nth-child(7) { left: 88%; width: 66px; height: 66px; animation-duration: 19s; animation-delay: -9s; }
.background-squares span:nth-child(8) { left: 94%; width: 104px; height: 104px; animation-duration: 27s; animation-delay: -21s; }

@keyframes floatSquare {
  0% {
    transform: translate3d(0, 0, 0) rotate(0deg);
    opacity: 0;
  }
  12% { opacity: 1; }
  86% { opacity: 0.82; }
  100% {
    transform: translate3d(42px, -125vh, 0) rotate(220deg);
    opacity: 0;
  }
}

.shell {
  position: relative;
  z-index: 2;
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 34px 0;
}

.hero {
  position: relative;
  min-height: 188px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding-top: 18px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 13px;
}

h1 {
  margin: 0;
  font-size: clamp(48px, 8vw, 92px);
  line-height: 0.92;
  letter-spacing: 0;
  color: var(--gold);
  font-family: inherit;
  font-style: normal;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.6), 0 0 24px rgba(244, 201, 93, 0.14);
}

.question-teaser {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  margin-top: 18px;
  padding: 0 14px;
  border: 1px solid rgba(244, 201, 93, 0.24);
  border-radius: 8px;
  background: rgba(18, 15, 13, 0.64);
  color: var(--cream);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.2);
  font-size: 16px;
  font-weight: 800;
}

#questionWord {
  color: var(--gold);
}

.typing-caret {
  width: 2px;
  height: 20px;
  margin-left: 3px;
  border-radius: 999px;
  background: var(--gold);
  animation: caretBlink 0.9s steps(2, start) infinite;
}

@keyframes caretBlink {
  50% { opacity: 0; }
}

.subtitle {
  max-width: 620px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.5;
}

.channel {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid rgba(155, 92, 255, 0.42);
  border-radius: 999px;
  color: white;
  text-decoration: none;
  background: linear-gradient(135deg, rgba(155, 92, 255, 0.96), rgba(129, 73, 224, 0.92));
  white-space: nowrap;
  font-weight: 900;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24);
}

.pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 5px rgba(244, 201, 93, 0.16);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stats div,
.toolbar,
.leader-row,
.podium-card,
.empty {
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 238, 170, 0.035), transparent 42%),
    rgba(18, 15, 13, 0.9);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.28);
}

.stats div {
  min-height: 96px;
  padding: 16px;
}

.stats span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.stats strong {
  display: block;
  margin-top: 8px;
  font-size: 32px;
  color: var(--cream);
  font-family: inherit;
}

.toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  margin-bottom: 18px;
}

.search {
  flex: 1;
}

.search span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
button {
  min-height: 44px;
  border-radius: 8px;
  font: inherit;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  background: #0f0c0a;
  color: var(--text);
  padding: 0 13px;
  outline: none;
}

input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(244, 201, 93, 0.13);
}

button {
  border: 0;
  background: linear-gradient(135deg, var(--gold), var(--gold-soft));
  color: #15100b;
  padding: 0 16px;
  font-weight: 800;
  cursor: pointer;
}

.podium {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.podium-card {
  position: relative;
  padding: 18px;
  min-height: 190px;
}

.podium-card:first-child { border-color: rgba(246, 200, 95, 0.5); }
.podium-card:nth-child(2) { border-color: rgba(200, 211, 223, 0.45); }
.podium-card:nth-child(3) { border-color: rgba(217, 145, 91, 0.45); }

.podium-top-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
}

.podium-card:nth-child(1) .podium-top-badge {
  color: #ffe08a;
  background: rgba(246, 200, 95, 0.14);
  border-color: rgba(246, 200, 95, 0.34);
}

.podium-card:nth-child(2) .podium-top-badge {
  color: #dde8f2;
  background: rgba(200, 211, 223, 0.12);
  border-color: rgba(200, 211, 223, 0.3);
}

.podium-card:nth-child(3) .podium-top-badge {
  color: #ffb47c;
  background: rgba(217, 145, 91, 0.14);
  border-color: rgba(217, 145, 91, 0.32);
}

.avatar,
.initials {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  object-fit: cover;
  background: linear-gradient(135deg, var(--accent), var(--gold));
  display: grid;
  place-items: center;
  font-weight: 900;
}

.podium-card .avatar,
.podium-card .initials {
  width: 76px;
  height: 76px;
  font-size: 24px;
}

.rank {
  color: var(--muted);
  font-weight: 900;
}

.podium-card h2 {
  margin: 14px 0 4px;
  font-size: 22px;
  overflow-wrap: anywhere;
  color: var(--cream);
}

.points {
  color: var(--gold);
  font-size: 28px;
  font-weight: 900;
}

.meta {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.leaderboard {
  display: grid;
  gap: 8px;
}

.leader-row {
  min-height: 76px;
  display: grid;
  grid-template-columns: 54px 58px 1fr auto auto;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
}

.leader-row .name {
  font-weight: 850;
  overflow-wrap: anywhere;
  color: var(--cream);
}

.leader-row .small {
  color: var(--muted);
  font-size: 13px;
}

.leader-row .score {
  min-width: 120px;
  text-align: right;
  color: var(--gold);
  font-size: 22px;
  font-weight: 900;
}

.leader-row .firsts {
  min-width: 95px;
  text-align: right;
  color: var(--muted);
}

.empty {
  padding: 32px;
  text-align: center;
  color: var(--muted);
}

@media (max-width: 820px) {
  .hero,
  .toolbar {
    display: grid;
  }

  .hero {
    min-height: 210px;
  }

  .question-teaser {
    max-width: calc(100vw - 32px);
    min-height: 48px;
    align-items: center;
    white-space: normal;
    font-size: 14px;
  }

  .emote-squares span {
    width: 70px;
    height: 70px;
  }

  .emote-squares span:nth-child(n+4) {
    display: none;
  }

  .emote-squares span:nth-child(1) { left: 4%; }
  .emote-squares span:nth-child(2) { left: 78%; }
  .emote-squares span:nth-child(3) { left: 10%; }

  .stats,
  .podium {
    grid-template-columns: 1fr;
  }

  .leader-row {
    grid-template-columns: 42px 52px 1fr;
  }

  .leader-row .score,
  .leader-row .firsts {
    grid-column: 3;
    min-width: 0;
    text-align: left;
  }
}
