:root {
  --bg: #08040f;
  --ink: #f3eefb;
  --mute: #8f84a8;
  --line: rgba(255, 255, 255, 0.1);
  --gold: #f2b83f;
  --gold-soft: rgba(242, 184, 63, 0.16);
  --display: "Baloo 2", system-ui, sans-serif;
  --body: "Inter Tight", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--bg); scroll-behavior: smooth; }
body {
  margin: 0; color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.5;
  background: radial-gradient(900px 600px at 50% 32%, rgba(120, 70, 210, 0.22), transparent 65%), var(--bg);
  min-height: 100vh; overflow-x: hidden; -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.9em; }
.hidden { display: none !important; }

/* top */
.top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 28px;
  padding: 14px clamp(16px, 4vw, 40px); background: rgba(8, 4, 15, 0.82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.wordmark { font-family: var(--display); font-weight: 800; font-size: 24px; letter-spacing: -0.02em; display: flex; align-items: center; gap: 9px; }
.wordmark img { width: 30px; height: 30px; filter: drop-shadow(0 0 10px rgba(120, 70, 210, 0.6)); }
nav { display: flex; gap: 22px; font-size: 15px; font-weight: 500; flex: 1; }
nav a { color: var(--mute); }
nav a:hover { color: var(--ink); }
.pot { color: var(--mute); font-size: 14px; white-space: nowrap; }
.pot span { color: var(--gold); font-family: var(--display); font-weight: 800; font-size: 20px; margin-right: 5px; }
@media (max-width: 860px) {
  nav { display: none; }
  .pot { flex: 1; }
}
@media (max-width: 480px) { .pot { display: none; } .wordmark { flex: 1; } }

/* the clock */
main { max-width: 1100px; margin: 0 auto; padding: clamp(6px, 2vw, 24px) clamp(16px, 4vw, 40px) 40px; display: flex; flex-direction: column; align-items: center; }
.clock { text-align: center; margin-bottom: clamp(4px, 1vw, 12px); }
.clock-big { font-family: var(--display); font-weight: 800; font-size: clamp(72px, 12vw, 132px); line-height: 1; letter-spacing: -0.03em; color: var(--gold); font-variant-numeric: tabular-nums; }
.clock-big.draw { color: var(--ink); }
.clock-sub { color: var(--mute); font-size: 16px; margin-top: 2px; max-width: 52ch; }
.clock-sub b { color: var(--ink); font-weight: 600; }

/* the drum */
.drum { position: relative; width: min(100%, 640px, 72vh); }
#drum-canvas { display: block; width: 100%; aspect-ratio: 1 / 1.22; }
.reveal {
  position: absolute; left: 50%; bottom: 2%; transform: translateX(-50%); width: min(100%, 460px);
  display: flex; gap: 14px; align-items: center; padding: 14px 16px; border-radius: 18px;
  background: #1a1030; border: 1px solid rgba(242, 184, 63, 0.5); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  animation: pop 0.5s cubic-bezier(0.2, 1.4, 0.4, 1);
}
@keyframes pop { from { transform: translateX(-50%) translateY(24px) scale(0.9); opacity: 0; } }
.reveal-ball { flex: none; width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: 26px; color: #2b1a00; background: radial-gradient(circle at 35% 30%, #fff1c0, var(--gold) 50%, #9a6a10); box-shadow: 0 0 26px rgba(242, 184, 63, 0.55); }
.reveal-body { min-width: 0; }
.reveal-line { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.reveal-line b { font-size: 17px; font-weight: 700; }
.reveal-line span { color: var(--gold); font-family: var(--display); font-weight: 800; font-size: 22px; }
.reveal p { margin: 2px 0 4px; font-size: 14px; color: #cfc4e6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.reveal a { font-size: 13px; color: var(--gold); }

/* post your thesis */
.enter { width: 100%; max-width: 640px; margin-top: 18px; }
.enter-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.enter-head h2 { margin: 0; color: var(--ink); font-size: 15px; }
.enter-head span { font-size: 13px; color: var(--mute); }
#thesis { width: 100%; resize: none; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.05); color: var(--ink); font: inherit; font-size: 16px; line-height: 1.4; }
#thesis:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
#thesis:disabled { opacity: 0.5; }
.enter-row { display: flex; align-items: center; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
.enter-status { flex: 1; font-size: 14px; color: var(--mute); min-width: 200px; }
.enter-status.bad { color: #ff6b8a; }
.enter-status.ok { color: var(--gold); }
.enter-status a { color: var(--gold); }
.gold:disabled { opacity: 0.5; cursor: default; }

/* balls this round, last draws */
main section { width: 100%; max-width: 900px; margin-top: 28px; }
main h2 { font-size: 15px; font-weight: 600; color: var(--mute); margin: 0 0 10px; }
main h2 span { font-weight: 400; }
main h2 b { color: var(--ink); font-weight: 600; }
main section ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
main section li { display: flex; align-items: center; gap: 10px; padding: 6px 12px 6px 6px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03); font-size: 14px; max-width: 100%; }
main section li.win { border-color: rgba(242, 184, 63, 0.6); background: var(--gold-soft); }
main section li.empty { border-style: dashed; color: var(--mute); padding: 8px 14px; }
.ball { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: 13px; color: #1a0a30; position: relative; overflow: hidden; }
.ball img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ball i { position: relative; z-index: 1; font-style: normal; background: rgba(8, 4, 15, 0.85); color: #fff; font-size: 10px; padding: 0 5px; border-radius: 7px; line-height: 15px; }
main section li b { font-weight: 600; white-space: nowrap; }
main section li span { color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 32ch; }
main section li span.prize { color: var(--gold); font-weight: 600; }
.draws li { cursor: pointer; }
.draws li:hover { border-color: rgba(255, 255, 255, 0.25); }

footer { max-width: calc(900px + 2 * clamp(16px, 4vw, 40px)); margin: 48px auto 0; padding: 18px clamp(16px, 4vw, 40px) 48px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 6px 28px; font-size: 13px; color: var(--mute); }
footer a { color: var(--gold); }

/* how to enter, what you win, why it's fair */
.how, main { scroll-margin-top: 72px; }
.how { max-width: calc(900px + 2 * clamp(16px, 4vw, 40px)); margin: 0 auto; padding: 56px clamp(16px, 4vw, 40px) 8px; }
.how h2 { font-family: var(--display); font-weight: 800; font-size: 32px; letter-spacing: -0.02em; color: var(--ink); margin: 0 0 22px; }
.how h3 { font-size: 17px; font-weight: 600; margin: 0 0 6px; }
.how h3 span { color: var(--gold); }
.how p { margin: 0; color: var(--mute); font-size: 15px; line-height: 1.55; }
.how p b { color: var(--ink); font-weight: 600; }
.how code { color: var(--gold); font-size: 13px; }
.how .note { color: var(--ink); font-size: 15px; border-left: 3px solid var(--gold); padding-left: 12px; }
.steps { list-style: none; margin: 0 0 22px; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.steps li > span { display: block; font-family: var(--display); font-weight: 800; font-size: 40px; line-height: 1; color: var(--gold); margin-bottom: 10px; }
.cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
#fair .cols { grid-template-columns: 1fr 1fr; }
@media (max-width: 760px) { .steps, .cols, #fair .cols { grid-template-columns: 1fr; gap: 20px; } }
.gold { display: inline-flex; align-items: center; padding: 10px 16px; border-radius: 999px; background: var(--gold); color: #2b1a00; font-weight: 700; font-size: 14px; white-space: nowrap; }
.gold:hover { filter: brightness(1.08); }
#check-form { display: flex; gap: 10px; margin-top: 14px; }
#check-form input { width: 130px; padding: 9px 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.05); color: var(--ink); font: inherit; font-size: 16px; }
#check-form input:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.out { margin-top: 14px; padding: 14px; border-radius: 14px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); font-size: 13px; }
.out .ok { color: var(--gold); font-weight: 600; }
.out .bad { color: #ff6b8a; font-weight: 600; }
.out dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 12px; margin: 10px 0 0; }
.out dt { color: var(--mute); }
.out dd { margin: 0; font-family: ui-monospace, Menlo, monospace; font-size: 12px; word-break: break-all; }
.out ol { margin: 10px 0 0; padding-left: 20px; color: var(--mute); }
.out ol li.win { color: var(--gold); font-weight: 600; }
.out a { color: var(--gold); }
