@import url("tokens.css");

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

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.wrap {
  width: 100%;
  max-width: 560px;
  padding: 0 var(--margin) calc(var(--capsule-height) + 48px);
}

/* ---- top bar ---- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0 0;
  animation: rise 0.5s ease both;
}
.brand {
  font-family: var(--font-heavy);
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.brand a { color: var(--ink); text-decoration: none; }
.badge {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.4px;
  line-height: 13px;
  padding: 6px 10px;
  border-radius: var(--radius-capsule);
  background: var(--raised);
  color: var(--secondary);
  text-transform: uppercase;
  white-space: nowrap;
}
.badge.live { background: var(--volt); color: var(--on-volt); }
.badge.replay { background: var(--raised); color: var(--ink); }

/* ---- hero ---- */
.hero { padding: 28px 0 8px; animation: rise 0.5s 0.06s ease both; }
.hero h1 {
  font-family: var(--font-heavy);
  font-size: 44px;
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: 0;
  text-transform: uppercase;
}
.hero h1 .volt-word { color: var(--volt); }
.hero .sub {
  margin-top: 10px;
  font-size: 15px;
  font-weight: 600;
  line-height: 20px;
  color: var(--secondary);
}
.hero .sub b { color: var(--ink); }

/* ---- split bar: pool vs prizes ---- */
.split { margin-top: 20px; animation: rise 0.5s 0.12s ease both; }
.split .figures { display: flex; justify-content: space-between; align-items: baseline; }
.split .figures .big {
  font-family: var(--font-heavy);
  font-size: 56px;
  font-weight: 900;
  line-height: 56px;
  font-variant-numeric: tabular-nums;
}
.split .figures .small {
  font-family: var(--font-heavy);
  font-size: 28px;
  font-weight: 900;
  line-height: 32px;
  color: var(--secondary);
  font-variant-numeric: tabular-nums;
}
.split .figures .small b { color: var(--ink); }
.split .bar {
  height: 10px;
  border-radius: var(--radius-bar);
  background: var(--track);
  margin-top: 8px;
  overflow: hidden;
  display: flex;
}
.split .bar .lead { background: var(--volt); width: 1.4%; }
.split .bar .rest { background: var(--track); flex: 1; }
.split .captions {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 13px;
  line-height: 17px;
  color: var(--tertiary);
}

/* ---- slots ---- */
.slots { margin-top: var(--section-gap); display: flex; flex-direction: column; gap: var(--panel-gap); }
.slot {
  background: var(--surface);
  border-radius: var(--radius-panel);
  padding: var(--panel-padding);
  display: flex;
  align-items: center;
  gap: 14px;
  animation: rise 0.5s ease both;
}
.slot:nth-child(1) { animation-delay: 0.18s; }
.slot:nth-child(2) { animation-delay: 0.24s; }
.slot:nth-child(3) { animation-delay: 0.30s; }
.disc {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: var(--radius-capsule);
  background: var(--raised);
  color: var(--tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heavy);
  font-size: 15px;
  font-weight: 900;
  transition: background 0.25s ease, color 0.25s ease, transform 0.25s ease;
}
.slot.won .disc { background: var(--volt); color: var(--on-volt); transform: scale(1.08); }
.slot .reel { flex: 1; min-width: 0; }
.slot .reel .label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.4px;
  line-height: 13px;
  color: var(--tertiary);
  text-transform: uppercase;
}
.slot .reel .uid {
  font-family: var(--font-heavy);
  font-size: 40px;
  font-weight: 900;
  line-height: 44px;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.slot .reel .uid.rolling { color: var(--secondary); }
.slot .reel .uid.placeholder { color: var(--tertiary); }
.slot .prize {
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 600;
  line-height: 17px;
  color: var(--secondary);
  text-align: right;
}
.slot.won .prize { color: var(--ink); }

/* ---- status line ---- */
.status {
  margin-top: var(--section-gap);
  font-size: 15px;
  font-weight: 600;
  line-height: 20px;
  color: var(--secondary);
  text-align: center;
  min-height: 20px;
}
.status b { color: var(--ink); }

/* ---- fairness panel ---- */
.fair {
  margin-top: var(--section-gap);
  background: var(--surface);
  border-radius: var(--radius-panel);
  padding: var(--panel-padding);
  animation: rise 0.5s 0.36s ease both;
}
.fair h2 {
  font-family: var(--font-heavy);
  font-size: 15px;
  font-weight: 800;
  line-height: 18px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.fair p {
  margin-top: 8px;
  font-size: 13px;
  line-height: 18px;
  color: var(--secondary);
}
.fair dl { margin-top: 10px; display: grid; gap: 6px; }
.fair .kv {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  line-height: 17px;
  border-top: 1px solid var(--hairline);
  padding-top: 6px;
}
.fair .kv dt { color: var(--tertiary); flex: 0 0 auto; }
.fair .kv dd {
  color: var(--ink);
  text-align: right;
  word-break: break-all;
  font-variant-numeric: tabular-nums;
}
.fair .kv dd.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; }

/* ---- result actions (owner, after a fresh draw) ---- */
.actions {
  margin-top: var(--section-gap);
  background: var(--surface);
  border-radius: var(--radius-panel);
  padding: var(--panel-padding);
}
.actions h2 {
  font-family: var(--font-heavy);
  font-size: 15px;
  font-weight: 800;
  line-height: 18px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.actions p { margin-top: 8px; font-size: 13px; line-height: 18px; color: var(--secondary); }
.actions .row { display: flex; gap: 10px; margin-top: 12px; }
.btn-ghost {
  flex: 1;
  height: 44px;
  border: none;
  border-radius: var(--radius-row);
  background: var(--raised);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.btn-ghost:active { transform: scale(0.97); }
.actions pre {
  margin-top: 12px;
  background: var(--canvas);
  border-radius: var(--radius-row);
  padding: 10px;
  font-size: 12px;
  line-height: 16px;
  color: var(--secondary);
  overflow-x: auto;
  white-space: pre;
}
.actions .copied { color: var(--volt); font-weight: 600; }

/* ---- pinned draw capsule ---- */
.drawbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: center;
  padding: 12px var(--margin) calc(12px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to bottom, transparent, var(--canvas) 40%);
  pointer-events: none;
}
.drawbar .inner { width: 100%; max-width: 560px; pointer-events: auto; }
#drawBtn {
  width: 100%;
  height: var(--capsule-height);
  border: none;
  border-radius: var(--radius-capsule);
  background: var(--volt);
  color: var(--on-volt);
  font-family: var(--font-body);
  font-size: 17px;
  font-weight: 600;
  line-height: 22px;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
}
#drawBtn:active { transform: scale(0.97); background: var(--volt-pressed); }
#drawBtn:disabled { background: var(--raised); color: var(--tertiary); cursor: default; transform: none; }
#drawBtn.replay { background: var(--raised); color: var(--ink); }

/* ---- confetti (pure CSS pieces, JS-spawned) ---- */
.confetti { position: fixed; top: -12px; z-index: 50; pointer-events: none; animation: fall linear forwards; }
@keyframes fall {
  to { transform: translateY(105vh) rotate(720deg); opacity: 0.9; }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---- footer ---- */
.foot { margin-top: var(--section-gap); text-align: center; font-size: 13px; line-height: 17px; color: var(--tertiary); }
.foot a { color: var(--secondary); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0ms !important; transition-duration: 0.01ms !important; }
  .confetti { display: none; }
}
