
:root {
  --bg-0: #0b0a06;
  --bg-1: #14110a;
  --bg-2: #1d1810;
  --gold-1: #f5d56a;
  --gold-2: #c9a648;
  --gold-3: #8a6d23;
  --gold-deep: #5a4416;
  --emerald: #1f6b4a;
  --ink: #f4ecd8;
  --ink-dim: #998a6a;
  --crimson: #8b1c2b;
  --font-display: 'Bodoni Moda', 'Didot', 'Times New Roman', serif;
  --font-mono: 'DM Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-0);
  color: var(--ink);
  font-family: var(--font-mono);
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
  overflow-x: hidden;
}

body {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(245, 213, 106, 0.10), transparent 60%),
    radial-gradient(ellipse at 50% 100%, rgba(31, 107, 74, 0.06), transparent 50%),
    linear-gradient(180deg, var(--bg-0), var(--bg-1));
  background-attachment: fixed;
  min-height: 100vh;
  padding: 32px 20px 80px;
  padding-bottom: max(80px, env(safe-area-inset-bottom));
}

/* Atmosphere */
.grain {
  position: fixed; inset: -50%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  opacity: 0.05;
  pointer-events: none;
  mix-blend-mode: overlay;
  z-index: 1;
}
.rays {
  position: fixed; inset: 0;
  background:
    conic-gradient(from 90deg at 50% -20%,
      transparent 0deg,
      rgba(245, 213, 106, 0.04) 30deg,
      transparent 60deg,
      rgba(245, 213, 106, 0.04) 90deg,
      transparent 120deg,
      rgba(245, 213, 106, 0.04) 150deg,
      transparent 180deg);
  pointer-events: none;
  z-index: 0;
}

/* Vault */
.vault {
  max-width: 560px;
  margin: 0 auto;
  position: relative;
  z-index: 2;
}

/* Masthead */
.masthead { text-align: center; margin-bottom: 36px; }

.display {
  font-family: var(--font-display);
  margin: 0;
  line-height: 0.85;
  font-weight: 900;
}
.display__line {
  display: block;
  font-style: italic;
}
.display__line--big {
  font-size: clamp(64px, 18vw, 112px);
  letter-spacing: -2px;
  font-style: normal;
  background: linear-gradient(180deg, #fff7d8 0%, var(--gold-1) 35%, var(--gold-2) 65%, var(--gold-3) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 0 rgba(0,0,0,0.4)) drop-shadow(0 0 24px rgba(245, 213, 106, 0.25));
}
.display__line--accent {
  font-style: italic;
  letter-spacing: -3px;
}

.sub {
  margin: 20px 0 0;
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(14px, 3.5vw, 17px);
  color: var(--ink-dim);
  letter-spacing: 0.5px;
}

/* Stage */
.stage {
  margin: 28px 0;
  padding: 32px 16px;
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(245, 213, 106, 0.04), transparent 60%),
    var(--bg-2);
  border: 1px solid rgba(245, 213, 106, 0.2);
  box-shadow:
    inset 0 1px 0 rgba(245, 213, 106, 0.15),
    inset 0 -40px 60px -40px rgba(0, 0, 0, 0.6),
    0 20px 40px -20px rgba(0, 0, 0, 0.5);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.stage::before, .stage::after {
  content: '';
  position: absolute;
  width: 28px; height: 28px;
  border: 1px solid var(--gold-2);
  opacity: 0.6;
}
.stage::before { top: 8px; left: 8px; border-right: 0; border-bottom: 0; }
.stage::after { bottom: 8px; right: 8px; border-left: 0; border-top: 0; }

.balls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  min-height: 76px;
  align-items: center;
}
.placeholder {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--gold-deep);
  letter-spacing: 8px;
  font-size: 24px;
}

.ball {
  --size: 64px;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 28px;
  color: var(--bg-0);
  background:
    radial-gradient(circle at 32% 28%, #fff8d8 0%, var(--gold-1) 22%, var(--gold-2) 55%, var(--gold-3) 85%, var(--gold-deep) 100%);
  box-shadow:
    inset -3px -4px 8px rgba(0,0,0,0.35),
    inset 3px 4px 8px rgba(255, 247, 216, 0.6),
    0 8px 20px -6px rgba(0, 0, 0, 0.6),
    0 0 24px -4px rgba(245, 213, 106, 0.5);
  text-shadow: 0 1px 0 rgba(255,255,255,0.4);
  position: relative;
  animation: roll 0.5s cubic-bezier(.2, .8, .2, 1) backwards;
}
.ball::after {
  content: '';
  position: absolute;
  top: 8px; left: 12px;
  width: 18px; height: 12px;
  background: rgba(255, 255, 255, 0.55);
  border-radius: 50%;
  filter: blur(2px);
}
.ball:nth-child(1) { animation-delay: 0.00s; }
.ball:nth-child(2) { animation-delay: 0.08s; }
.ball:nth-child(3) { animation-delay: 0.16s; }
.ball:nth-child(4) { animation-delay: 0.24s; }
.ball:nth-child(5) { animation-delay: 0.32s; }
.ball:nth-child(6) { animation-delay: 0.40s; }
.ball:nth-child(7) {
  animation-delay: 0.48s;
  background:
    radial-gradient(circle at 32% 28%, #fff 0%, #ffeaa3 22%, #d83a4d 55%, #8b1c2b 85%, #4a0c14 100%);
  color: #fff;
  text-shadow: 0 1px 0 rgba(0,0,0,0.4);
}

@keyframes roll {
  0%   { transform: translateY(-40px) rotate(-180deg) scale(0.5); opacity: 0; }
  60%  { transform: translateY(6px) rotate(15deg) scale(1.05); opacity: 1; }
  100% { transform: translateY(0) rotate(0) scale(1); opacity: 1; }
}

.balls--loading .ball {
  animation: shake 0.4s infinite;
  background: radial-gradient(circle at 32% 28%, #555 0%, #2a2a2a 60%, #111 100%);
  color: var(--ink-dim);
}
.balls--loading .ball::after { opacity: 0.2; }
@keyframes shake {
  0%, 100% { transform: translate(0, 0) rotate(0); }
  25% { transform: translate(-2px, -1px) rotate(-3deg); }
  75% { transform: translate(2px, 1px) rotate(3deg); }
}

.meta {
  margin: 20px 0 0;
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--ink-dim);
  text-transform: uppercase;
}
#draw-count { color: var(--gold-2); font-weight: 500; }

/* Actions */
.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 24px 0;
}
.bet {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 22px 16px;
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  border: 1px solid rgba(245, 213, 106, 0.3);
  border-radius: 10px;
  color: var(--ink);
  cursor: pointer;
  font-family: var(--font-mono);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: transform 0.1s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  box-shadow: 0 4px 0 rgba(0,0,0,0.4), inset 0 1px 0 rgba(245, 213, 106, 0.1);
}
.bet:hover { border-color: var(--gold-2); }
.bet:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 rgba(0,0,0,0.4), inset 0 1px 0 rgba(245, 213, 106, 0.1);
}
.bet:disabled { opacity: 0.5; cursor: wait; }

.bet__label {
  font-size: 10px;
  letter-spacing: 4px;
  color: var(--gold-2);
  text-transform: uppercase;
}
.bet__num {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 56px;
  line-height: 1;
  background: linear-gradient(180deg, #fff7d8, var(--gold-1) 50%, var(--gold-3));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.bet__sub {
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--ink-dim);
  text-transform: uppercase;
}
.bet--gold {
  background: linear-gradient(180deg, var(--gold-deep), #2d2310);
  border-color: var(--gold-1);
}
.bet--gold .bet__label { color: var(--gold-1); }

/* Footer */
.foot {
  text-align: center;
  margin: 48px auto 0;
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--ink-dim);
  position: relative;
  z-index: 2;
}
.foot a { color: var(--gold-2); text-decoration: none; }
.foot a:hover { color: var(--gold-1); }
.dot { margin: 0 10px; opacity: 0.4; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .ball { animation: none; }
  .balls--loading .ball { animation: none; }
}

/* Bigger screens — slightly larger balls */
@media (min-width: 600px) {
  .ball { --size: 76px; font-size: 32px; }
}
