/* ── Palette & tokens ────────────────────────────────────────────────── */
:root {
  --red:        #cf2762;
  --pink:       #f4a3b2;
  --cream:      #f1e3d8;
  --tan:        #e1b495;
  --orange:     #d98046;
  --red-dark:   #a01e4c;
  --bg:         #1a0912;
  --bg-card:    #220d18;
  --bg-bento:   #2a1020;
  --border:     #4a1530;
  --text:       #f1e3d8;
  --text-muted: #b07a88;
  --glow-red:   rgba(207,39,98,.4);
  --glow-orange:rgba(217,128,70,.35);
  --font:  'Segoe UI', system-ui, -apple-system, sans-serif;
  --mono:  'Fira Code', 'Courier New', monospace;
  --r:     12px;
  --r-lg:  20px;
  --r-xl:  28px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* radial glows */
body::before {
  content: ''; position: fixed;
  top: -20%; left: -10%; width: 60%; height: 60%;
  background: radial-gradient(ellipse, rgba(207,39,98,.07) 0%, transparent 70%);
  pointer-events: none; z-index: 0;
}
body::after {
  content: ''; position: fixed;
  bottom: -20%; right: -10%; width: 50%; height: 50%;
  background: radial-gradient(ellipse, rgba(217,128,70,.06) 0%, transparent 70%);
  pointer-events: none; z-index: 0;
}

#app {
  position: relative; z-index: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px 80px;
}

/* ── HEADER ──────────────────────────────────────────────────────────── */
header {
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 18px 0 24px;
  gap: 12px; flex-wrap: wrap;
}
.logo { display: flex; align-items: center; gap: 12px; }
.logo-icon {
  width: 46px; height: 46px;
  background: linear-gradient(135deg, var(--red), var(--orange));
  border-radius: 14px;
  display: grid; place-items: center;
  font-size: 24px;
  box-shadow: 0 0 24px var(--glow-red);
  flex-shrink: 0;
}
.logo-text h1 {
  font-size: 1.4rem; font-weight: 800;
  background: linear-gradient(90deg, var(--pink), var(--cream), var(--tan));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; line-height: 1.1;
}
.logo-text p { font-size: .7rem; color: var(--text-muted); letter-spacing: .08em; text-transform: uppercase; }
.header-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .7rem; color: var(--text-muted);
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 50px; padding: 5px 12px;
}
.dot-live { width: 6px; height: 6px; border-radius: 50%; background: #10b981; box-shadow: 0 0 5px #10b981; }

#wallet-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 18px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 50px; color: var(--text);
  cursor: pointer; font-size: .85rem; font-family: var(--font);
  transition: all .25s;
}
#wallet-btn:hover { border-color: var(--red); box-shadow: 0 0 16px var(--glow-red); }
#wallet-btn.connected { border-color: #10b981; box-shadow: 0 0 12px rgba(16,185,129,.22); }
.wallet-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); transition: background .3s; }
.wallet-dot.on { background: #10b981; box-shadow: 0 0 7px #10b981; }

/* ── WHEEL SECTION ───────────────────────────────────────────────────── */
.wheel-section {
  display: flex; flex-direction: column;
  align-items: center; gap: 22px;
  padding: 10px 0 32px;
  position: relative;
}

.wheel-glow-ring {
  position: absolute;
  width: 420px; height: 420px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center,
    rgba(207,39,98,.18) 0%,
    rgba(217,128,70,.10) 40%,
    transparent 70%);
  pointer-events: none;
  animation: glow-pulse 3s ease-in-out infinite alternate;
}
@keyframes glow-pulse {
  from { opacity: .6; transform: scale(.92); }
  to   { opacity: 1;  transform: scale(1.04); }
}

.roulette-outer {
  position: relative; width: 360px; height: 360px;
}
.roulette-outer::before {
  content: ''; position: absolute; inset: -12px; border-radius: 50%;
  background: conic-gradient(var(--red), var(--orange), var(--pink), var(--red), var(--orange));
  animation: spin-glow 6s linear infinite; opacity: .5; filter: blur(12px);
}
.roulette-outer::after {
  content: ''; position: absolute; inset: -3px; border-radius: 50%;
  background: conic-gradient(var(--red), var(--orange), var(--pink), var(--red));
  animation: spin-glow 6s linear infinite;
}
#roulette-canvas { position: relative; z-index: 2; border-radius: 50%; display: block; }
.roulette-pointer {
  position: absolute; top: -18px; left: 50%; transform: translateX(-50%);
  z-index: 10; font-size: 30px;
  filter: drop-shadow(0 0 10px var(--orange));
  animation: ptr-bounce 1s ease-in-out infinite alternate;
}
@keyframes ptr-bounce {
  from { transform: translateX(-50%) translateY(0); }
  to   { transform: translateX(-50%) translateY(-5px); }
}
@keyframes spin-glow { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* Spin button */
.btn-spin {
  background: linear-gradient(135deg, var(--red-dark), var(--red), var(--orange));
  color: #fff; border: none; border-radius: 50px;
  font-family: var(--font); font-weight: 800; font-size: 1rem;
  padding: 14px 44px; cursor: pointer;
  box-shadow: 0 4px 30px var(--glow-red), 0 0 0 0 rgba(207,39,98,.4);
  transition: all .25s; letter-spacing: .04em; text-transform: uppercase;
  position: relative; z-index: 5;
}
.btn-spin:not(:disabled):hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 40px var(--glow-red), 0 0 0 6px rgba(207,39,98,.15);
}
.btn-spin:disabled { opacity: .35; cursor: not-allowed; }
.btn-spin.pulsing {
  animation: spin-btn-pulse 1.2s ease-in-out infinite;
}
@keyframes spin-btn-pulse {
  0%, 100% { box-shadow: 0 4px 30px var(--glow-red), 0 0 0 0 rgba(207,39,98,.5); }
  50%       { box-shadow: 0 4px 30px var(--glow-red), 0 0 0 14px rgba(207,39,98,.0); }
}

/* Wheel stats strip */
.wheel-stats {
  display: flex; align-items: center; gap: 0;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 50px; padding: 8px 24px; gap: 20px;
}
.wstat { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.wstat-val {
  font-size: 1.1rem; font-weight: 800;
  background: linear-gradient(135deg, var(--pink), var(--tan));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  white-space: nowrap;
}
.wstat-lbl { font-size: .65rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .07em; }
.wstat-div { width: 1px; height: 30px; background: var(--border); }

/* ── FORM BENTO ──────────────────────────────────────────────────────── */
.form-bento {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto;
  gap: 14px;
}
@media (max-width: 620px) { .form-bento { grid-template-columns: 1fr; } }

/* base card */
.fcard {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 22px;
  position: relative; overflow: hidden;
  transition: border-color .3s, box-shadow .3s;
}
.fcard::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(207,39,98,.04) 0%, transparent 60%);
  pointer-events: none;
}
.fcard-disabled {
  opacity: .45; pointer-events: none;
}
.fcard-wide  { grid-column: 1 / -1; }
.fcard-log   { grid-column: 1 / -1; }
.fcard-zk    { grid-column: 1 / -1; }

/* active card highlight */
.fcard.active-card {
  border-color: var(--red);
  box-shadow: 0 0 24px var(--glow-red);
  opacity: 1; pointer-events: auto;
}
.fcard.done-card {
  border-color: var(--tan);
  opacity: .75; pointer-events: none;
}

/* card number badge */
.fcard-num {
  font-size: .7rem; font-weight: 800;
  color: var(--red); letter-spacing: .12em; text-transform: uppercase;
  margin-bottom: 4px;
}
.fcard-title {
  font-size: .95rem; font-weight: 700; color: var(--cream);
  margin-bottom: 8px;
}
.fcard-desc { font-size: .8rem; color: var(--text-muted); margin-bottom: 16px; line-height: 1.5; }

/* field layout */
.field-row { display: flex; gap: 12px; margin-bottom: 14px; }
@media (max-width: 480px) { .field-row { flex-direction: column; } }
.field { flex: 1; }
.field label {
  display: block; font-size: .72rem; color: var(--text-muted);
  margin-bottom: 5px; text-transform: uppercase; letter-spacing: .07em;
}
.input-addon {
  display: flex; align-items: center;
  background: var(--bg-bento); border: 1px solid var(--border);
  border-radius: var(--r); overflow: hidden; transition: border .2s;
}
.input-addon:focus-within { border-color: var(--red); box-shadow: 0 0 0 3px rgba(207,39,98,.13); }
.input-addon input {
  flex: 1; background: transparent; border: none;
  padding: 10px 12px; color: var(--text);
  font-family: var(--mono); font-size: .86rem; outline: none;
}
.input-addon .addon {
  padding: 0 12px; font-size: .75rem; color: var(--text-muted);
  background: rgba(207,39,98,.08); border-left: 1px solid var(--border); height: 100%;
  display: flex; align-items: center;
}

/* plain inputs */
input[type="text"], input[type="number"] {
  width: 100%;
  background: var(--bg-bento); border: 1px solid var(--border);
  border-radius: var(--r); padding: 10px 13px;
  color: var(--text); font-family: var(--mono); font-size: .86rem;
  outline: none; transition: border .2s;
}
input:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(207,39,98,.13); }

/* connected pill */
.connected-pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(16,185,129,.08); border: 1px solid rgba(16,185,129,.3);
  border-radius: 50px; padding: 8px 16px;
  font-family: var(--mono); font-size: .82rem;
  color: #10b981; margin-top: 4px;
}

/* wallet progress */
.wallet-prog-row {
  display: flex; align-items: center; gap: 10px;
  font-size: .75rem; color: var(--text-muted); margin-bottom: 12px;
}
.wprog-bar { flex: 1; height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.wprog-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--red), var(--orange));
  border-radius: 2px; transition: width .4s ease;
}

/* wallet entry row */
.wallet-entry-row { display: flex; gap: 8px; margin-bottom: 12px; }
.wallet-entry-row input { flex: 1; }

/* participants grid */
#participants-grid {
  display: flex; flex-direction: column; gap: 7px;
  max-height: 220px; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.p-card {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 13px;
  background: var(--bg-bento); border: 1px solid var(--border);
  border-radius: 10px; font-size: .8rem; font-family: var(--mono);
  transition: all .2s; animation: slide-in .25s ease;
}
.p-card.winner {
  border-color: var(--orange); background: rgba(217,128,70,.1);
  box-shadow: 0 0 20px var(--glow-orange);
}
.p-avatar {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--red), var(--orange));
  display: grid; place-items: center; font-size: .76rem; font-weight: 700; color: #fff;
}
.p-addr { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-muted); }
.p-badge {
  font-size: .66rem; padding: 2px 8px; border-radius: 50px;
  background: rgba(217,128,70,.2); color: var(--orange); font-weight: 700;
}

/* activity log */
#event-log {
  max-height: 130px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 4px;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
  margin-top: 8px;
}
.log-entry {
  font-family: var(--mono); font-size: .72rem;
  padding: 4px 10px; border-radius: 6px;
  border-left: 3px solid var(--border); line-height: 1.4;
  animation: slide-in .2s ease;
}
.log-entry.info  { border-color: var(--pink);   color: var(--pink); }
.log-entry.ok    { border-color: var(--tan);    color: var(--tan); }
.log-entry.warn  { border-color: var(--orange); color: var(--orange); }
.log-entry.error { border-color: #ef4444; color: #fca5a5; }

/* ZK grid */
.zk-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 8px; margin-top: 8px;
}
@media (max-width: 480px) { .zk-grid { grid-template-columns: 1fr; } }
.zk-item {
  background: var(--bg-bento); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px;
}
.zk-lbl { display: block; font-size: .68rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .07em; margin-bottom: 4px; }
.zk-val { font-family: var(--mono); font-size: .76rem; color: var(--pink); word-break: break-all; }
.zk-val.ok   { color: var(--tan); }
.zk-val.warn { color: var(--orange); }
.zk-val.dim  { color: var(--text-muted); font-style: italic; }

/* ── BUTTONS ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 20px; border: none; border-radius: 50px;
  font-family: var(--font); font-size: .85rem; font-weight: 700;
  cursor: pointer; transition: all .2s;
  text-transform: uppercase; letter-spacing: .04em; width: 100%;
}
.btn:disabled { opacity: .35; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, var(--red), var(--orange));
  color: #fff; box-shadow: 0 4px 20px var(--glow-red);
}
.btn-primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 28px var(--glow-red); }
.btn-ghost {
  background: var(--bg-bento); border: 1px solid var(--border); color: var(--text);
}
.btn-ghost:hover:not(:disabled) { border-color: var(--red); }
.btn-sm { padding: 8px 14px; font-size: .76rem; width: auto; }
.btn-overlay-close { margin-top: 10px; }

/* ── WINNER OVERLAY ──────────────────────────────────────────────────── */
#winner-overlay {
  display: none; position: fixed; inset: 0; z-index: 200;
  background: rgba(20,4,14,.94); backdrop-filter: blur(16px);
  align-items: center; justify-content: center;
}
#winner-overlay.show { display: flex; }
.w-card {
  background: var(--bg-card); border: 2px solid var(--orange);
  border-radius: var(--r-xl); padding: 40px 32px; text-align: center;
  max-width: 440px; width: 92%;
  box-shadow: 0 0 80px var(--glow-orange), 0 0 180px rgba(217,128,70,.1);
  animation: pop .5s cubic-bezier(.175,.885,.32,1.275);
  position: relative; overflow: hidden;
}
@keyframes pop { from { transform: scale(.72); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.w-trophy { font-size: 3.2rem; margin-bottom: 10px; }
.w-title {
  font-size: 1.6rem; font-weight: 900;
  background: linear-gradient(90deg, var(--pink), var(--tan), var(--orange));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  margin-bottom: 6px;
}
.w-sub { color: var(--text-muted); margin-bottom: 18px; font-size: .8rem; }
.w-addr {
  font-family: var(--mono); font-size: .78rem; color: var(--pink);
  background: var(--bg-bento); border: 1px solid var(--border);
  border-radius: var(--r); padding: 10px 12px; word-break: break-all; margin-bottom: 8px;
}
.w-prize { font-size: 1.3rem; font-weight: 800; color: var(--orange); margin-bottom: 8px; }
.w-badge {
  display: inline-block; background: rgba(217,128,70,.16); color: var(--orange);
  font-weight: 700; padding: 3px 14px; border-radius: 50px;
  font-size: .8rem; margin-bottom: 16px;
}
.w-tx {
  font-family: var(--mono); font-size: .7rem; color: var(--tan);
  background: var(--bg-bento); border: 1px solid var(--border);
  border-radius: var(--r); padding: 8px 10px; word-break: break-all;
  margin-bottom: 10px; text-align: left;
}

/* ── MISC ────────────────────────────────────────────────────────────── */
.spinner {
  display: inline-block; width: 13px; height: 13px;
  border: 2px solid rgba(255,255,255,.2); border-top-color: #fff;
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin     { to { transform: rotate(360deg); } }
@keyframes slide-in { from { opacity:0; transform:translateY(-5px); } to { opacity:1; transform:translateY(0); } }

code { font-family: var(--mono); font-size: .85em; color: var(--pink); }
