:root {
  --bg: #0e0a1f;
  --bg-2: #1a1236;
  --panel: rgba(255, 255, 255, 0.06);
  --panel-line: rgba(255, 255, 255, 0.12);
  --text: #f4f0ff;
  --muted: #a99fcc;
  --gold: #ffcf4a;
  --pink: #ff4fa3;
  --violet: #8a5cf0;
  --ok: #3ddc84;
  --warn: #ffb020;
  --bad: #ff5a5a;
  --radius: 18px;
  --font-display: "Lilita One", "Arial Rounded MT Bold", system-ui, sans-serif;
  --font-body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(138, 92, 240, 0.35), transparent 60%),
    radial-gradient(900px 500px at 110% 10%, rgba(255, 79, 163, 0.22), transparent 60%),
    radial-gradient(800px 600px at 50% 120%, rgba(255, 207, 74, 0.12), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 20px 16px 48px;
}

header.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.brand {
  font-family: var(--font-display);
  font-size: clamp(26px, 5vw, 38px);
  letter-spacing: 0.5px;
  line-height: 1;
  margin: 0;
  background: linear-gradient(90deg, var(--gold), #fff3c4 45%, var(--pink));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--panel-line);
}
.status .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--warn); }
.status.open .dot { background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.status.closed .dot { background: var(--bad); }

.stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  align-items: start;
}
@media (max-width: 860px) {
  .stage { grid-template-columns: 1fr; }
}

.wheel-wrap {
  position: relative;
  width: min(100%, 600px);
  margin: 0 auto;
}
.wheel-title {
  text-align: center;
  font-family: var(--font-display);
  font-size: clamp(20px, 4vw, 28px);
  margin: 0 0 10px;
}
.wheel-title.premium { color: #ff9ad8; text-shadow: 0 0 18px rgba(255, 79, 163, 0.6); }
.wheel-title.normal { color: var(--gold); text-shadow: 0 0 18px rgba(255, 207, 74, 0.45); }

.wheel-box { position: relative; aspect-ratio: 1; }
.wheel-box canvas { width: 100%; height: 100%; display: block; }

.pointer {
  position: absolute;
  top: -3%;
  left: 50%;
  width: 9%;
  aspect-ratio: 0.8;
  transform: translateX(-50%);
  z-index: 2;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.55));
}
.pointer svg { width: 100%; height: 100%; display: block; }

.result {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.6);
  width: min(88%, 440px);
  padding: 18px 20px 20px;
  text-align: center;
  border-radius: 22px;
  background: rgba(14, 10, 31, 0.92);
  border: 2px solid var(--gold);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.35s cubic-bezier(0.2, 1.4, 0.4, 1);
  z-index: 3;
}
.result.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.result .who { font-weight: 800; color: var(--muted); font-size: 16px; margin-bottom: 6px; overflow-wrap: anywhere; }
.result .prize { font-family: var(--font-display); font-size: clamp(26px, 6vw, 40px); line-height: 1.05; }
.result .round { font-size: 13px; font-weight: 800; color: var(--muted); margin-top: 8px; letter-spacing: 0.5px; text-transform: uppercase; }
.result.lose { border-color: #6b6290; }
.result.lose .prize { color: #d9d3f2; }
.result.fun { border-color: #5aa8ff; }
.result.fun .prize { color: #9fd0ff; }
.result.win { border-color: var(--gold); }
.result.win .prize { color: var(--gold); }
.result.jackpot { border-color: var(--pink); animation: jackpot 0.6s ease-in-out infinite alternate; }
.result.jackpot .prize { color: #ff6b6b; text-shadow: 0 0 20px rgba(255, 59, 59, 0.7); }
@keyframes jackpot {
  from { box-shadow: 0 0 20px rgba(255, 79, 163, 0.5), 0 20px 60px rgba(0, 0, 0, 0.6); }
  to { box-shadow: 0 0 60px rgba(255, 207, 74, 0.9), 0 20px 60px rgba(0, 0, 0, 0.6); }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: var(--radius);
  padding: 16px;
  backdrop-filter: blur(6px);
}
.panel + .panel { margin-top: 16px; }
.panel h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 20px;
  margin: 0 0 12px;
}
.muted { color: var(--muted); }
.small { font-size: 14px; line-height: 1.45; }

.history { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.history li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 14px;
}
.history .chip { width: 12px; height: 12px; border-radius: 4px; flex: none; }
.history .txt { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.history .txt b { font-weight: 800; }
.history .time { color: var(--muted); font-size: 12px; flex: none; }
.history .empty { color: var(--muted); background: none; padding: 0; }

.legend { display: grid; gap: 6px; font-size: 14px; }
.legend div { display: flex; align-items: center; gap: 8px; }
.legend .chip { width: 12px; height: 12px; border-radius: 4px; flex: none; }
.legend .pct { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }

button, .btn {
  font: inherit;
  font-weight: 800;
  border: 0;
  border-radius: 14px;
  padding: 11px 16px;
  cursor: pointer;
  color: var(--text);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--panel-line);
  transition: transform 0.08s ease, background 0.2s ease, opacity 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}
button:active { transform: scale(0.97); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.btn-spin {
  width: 100%;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 30px;
  letter-spacing: 1px;
  padding: 16px;
  color: #231800;
  background: linear-gradient(180deg, #ffe58a, var(--gold) 55%, #e09e14);
  border: 0;
  box-shadow: 0 6px 0 #9c6a06, 0 14px 30px rgba(255, 207, 74, 0.3);
}
.btn-spin.premium {
  color: #fff;
  background: linear-gradient(180deg, #ff8ad6, var(--pink) 55%, #c22c7c);
  box-shadow: 0 6px 0 #7d1650, 0 14px 30px rgba(255, 79, 163, 0.35);
}
.btn-spin:active { transform: translateY(4px); box-shadow: 0 2px 0 #9c6a06; }

.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 5px; border-radius: 16px; background: rgba(0, 0, 0, 0.25); }
.seg button { border: 0; background: transparent; padding: 10px 8px; }
.seg button[aria-pressed="true"] { background: rgba(255, 255, 255, 0.14); }
.seg button[data-wheel="premium"][aria-pressed="true"] { background: rgba(255, 79, 163, 0.28); }
.seg button[data-wheel="normal"][aria-pressed="true"] { background: rgba(255, 207, 74, 0.22); }

label.field { display: grid; gap: 6px; font-weight: 800; font-size: 14px; }
input[type="text"], textarea {
  font: inherit;
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--panel-line);
  background: rgba(0, 0, 0, 0.3);
  color: var(--text);
}
textarea { resize: vertical; min-height: 80px; font-size: 13px; }

.check { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--pink); }

.stack { display: grid; gap: 12px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row > * { flex: 1 1 auto; }

.linkbox {
  font-size: 13px;
  word-break: break-all;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px dashed var(--panel-line);
  user-select: all;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  padding: 12px 18px;
  border-radius: 14px;
  background: #241a48;
  border: 1px solid var(--panel-line);
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 10;
  max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.center-msg { max-width: 560px; margin: 12vh auto 0; text-align: center; }
.center-msg h1 { font-family: var(--font-display); font-weight: 400; font-size: 32px; margin: 0 0 12px; }

details summary { cursor: pointer; font-weight: 800; }
details[open] summary { margin-bottom: 10px; }

[hidden] { display: none !important; }

/* Modo OBS: fondo transparente y solo la ruleta */
body.obs { background: transparent; }
body.obs .page { padding: 8px; max-width: none; }
body.obs header.top, body.obs .side { display: none; }
body.obs .stage { grid-template-columns: 1fr; }
