:root{
  --bg:#0b1220;
  --card:#0f1a2e;
  --text:#e5e7eb;
  --muted:#9ca3af;
  --line:rgba(255,255,255,.08);
  --accent:#22c55e;
  --shadow: 0 18px 50px rgba(0,0,0,.35);
}

*{ box-sizing:border-box; }
html,body{ height:100%; }

body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background:
    radial-gradient(1200px 600px at 20% 0%, rgba(56,189,248,.18), transparent 60%),
    radial-gradient(1000px 500px at 80% 10%, rgba(34,197,94,.16), transparent 55%),
    var(--bg);
  color:var(--text);
}

.wrap{
  min-height:100%;
  display:grid;
  place-items:center;
  padding:18px;
}

.card{
  width:min(980px, 100%);
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02));
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.top{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
  flex-wrap:wrap;
}

.brand h1{
  margin:0;
  font-size: 22px;
  letter-spacing:.2px;
}

.muted{
  color:var(--muted);
  margin:6px 0 0;
}

.stats{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}

.pill{
  display:flex;
  gap:10px;
  align-items:center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(0,0,0,.15);
  min-width: 160px;
  justify-content:space-between;
}

.stage{
  position:relative;
  margin-top: 14px;
  border-radius: 16px;
  overflow:hidden;
  border: 1px solid var(--line);
  background: rgba(0,0,0,.20);
  min-height: 420px;
}

/* Canvas responsive */
canvas{
  display:block;
  width:100%;
  height: 420px; /* base (el JS ajusta a DPR) */
}

/* Caja de ganador */
.winner{
  position:absolute;
  left: 14px;
  bottom: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,.35);
  backdrop-filter: blur(8px);
  min-width: 260px;
  max-width: calc(100% - 28px);
}

.winner-label{
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.winner-number{
  font-size: 40px;
  font-weight: 800;
  letter-spacing: 1px;
  line-height: 1;
}

.winner-user{
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.2;
}

/* Botones */
.actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-top: 14px;
}

.btn{
  border: 1px solid rgba(34,197,94,.35);
  background: linear-gradient(180deg, rgba(34,197,94,.95), rgba(34,197,94,.75));
  color:#061018;
  font-weight: 700;
  padding: 10px 14px;
  border-radius: 12px;
  cursor:pointer;
}

.btn:hover{
  filter: brightness(1.03);
}

.btn:disabled{
  opacity:.45;
  cursor:not-allowed;
}

.btn.ghost{
  border: 1px solid var(--line);
  background: rgba(255,255,255,.04);
  color: var(--text);
}

/* Debug */
.panel{
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

pre{
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(0,0,0,.25);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  overflow:auto;
}

/* Mobile tweaks */
@media (max-width: 520px){
  canvas{ height: 360px; }
  .stage{ min-height: 360px; }
  .winner-number{ font-size: 36px; }
  .pill{ min-width: 140px; }
}
