:root {
  --bg: #f6f7f9; --surface: #fff; --text: #17202e; --muted: #5d6878; --line: #e2e6ec;
  --accent: #714b67; --ok: #1f8a4c; --bad: #c0392b; --warn: #b7791f;
  --radius: 12px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 4px 16px rgba(16,24,40,.06);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #11151c; --surface: #1a2029; --text: #e7ebf1; --muted: #9aa5b5; --line: #2b3340; --accent: #b98aae; --ok: #3fbf74; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
main { max-width: 1080px; margin: 0 auto; padding: 24px 16px 64px; }
h1 { font-size: 26px; margin: 0 0 4px; } h2 { font-size: 19px; margin: 0; }
.muted { color: var(--muted); }
a { color: var(--accent); font-weight: 600; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
button { font: inherit; font-weight: 600; border: 1px solid var(--line); background: var(--surface); color: var(--text); padding: 8px 14px; border-radius: 8px; cursor: pointer; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.danger { color: var(--bad); }
button:disabled { opacity: .5; cursor: not-allowed; }
input, textarea { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; }
textarea { resize: vertical; }
label { font-weight: 600; font-size: 13px; color: var(--muted); display: block; margin: 10px 0 4px; }
.check { display: inline-flex; gap: 6px; align-items: center; margin-top: 12px; font-weight: 500; }
.check input { width: auto; }
table { width: 100%; border-collapse: collapse; } th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); font-size: 14px; }
.hint { font-size: 13px; margin: 4px 0 0; }
.warn-box { border-left: 4px solid var(--warn); background: color-mix(in srgb, var(--warn) 12%, transparent); padding: 10px 14px; border-radius: 6px; font-size: 14px; }

.stage { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.stage:fullscreen { justify-content: center; border-radius: 0; background: var(--surface); }
.stage:fullscreen .next { font-size: 30px; }
.stage:fullscreen .winner { font-size: 34px; }
.next { margin: 0; font-size: 20px; line-height: 1.35; min-height: 2.7em; }
.wheel { width: 100%; display: flex; justify-content: center; }
.wheel canvas { max-width: 100%; }
.winner { margin: 0; font-size: 22px; line-height: 1.3; min-height: 1.6em; opacity: 0; transform: scale(.9); transition: opacity .25s, transform .25s; }
.winner.show { opacity: 1; transform: scale(1); }
.spin { font-size: 18px; padding: 10px 34px; }

.live { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }
.live.on::before { background: var(--ok); }

#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 8px; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: 90%; z-index: 10; }
#toast.show { opacity: 1; }

/* Control */
.layout { display: grid; gap: 14px; grid-template-columns: minmax(240px, 340px) minmax(0, 1fr); align-items: start; margin-top: 16px; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } }
.share { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.share .qr { width: 150px; height: 150px; background: #fff; border-radius: 8px; padding: 6px; flex: none; }
.share .qr svg { width: 100%; height: 100%; display: block; }
.share .url { font-size: 20px; font-weight: 700; word-break: break-all; }
.share h2 { font-size: 16px; }
.access { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); }

/* Teléfonos */
.phone { max-width: 560px; }
.phone .card { margin-top: 14px; }
.phone .winner { font-size: 24px; }
.mine { margin: 10px 0 0; font-size: 17px; }
.mine.won { color: var(--ok); font-weight: 700; }
.list { list-style: none; margin: 10px 0 0; padding: 0; }
.list li { display: flex; gap: 10px; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .who { font-weight: 700; }
.list .what { color: var(--muted); text-align: right; }
.list li.me { background: color-mix(in srgb, var(--ok) 12%, transparent); border-radius: 8px; padding: 10px 8px; }
.list li.fresh { animation: fresh 1.5s ease-out; }
@keyframes fresh { from { background: color-mix(in srgb, var(--accent) 30%, transparent); } }
.ci-big { position: fixed; inset: 0; z-index: 20; background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 20px; text-align: center; }
.ci-big h1 { font-size: clamp(26px, 5vw, 48px); }
.ci-big p { font-size: clamp(16px, 2.5vw, 24px); margin: 0; }
.ci-big .qr { width: min(70vh, 80vw); height: min(70vh, 80vw); padding: 14px; background: #fff; border-radius: 12px; }
.ci-big .qr svg { width: 100%; height: 100%; display: block; }
.pick { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.pick button { width: 100%; text-align: left; padding: 12px 14px; font-size: 16px; }
.pick button:disabled { opacity: .55; }
.attendance { max-height: 360px; overflow: auto; margin-top: 10px; border: 1px solid var(--line); border-radius: 8px; }
.attendance label { display: flex; gap: 10px; align-items: center; margin: 0; padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 14px; font-weight: 500; color: var(--text); cursor: pointer; }
.attendance label:last-child { border-bottom: 0; }
.attendance input { width: auto; }
.attendance .when { margin-left: auto; font-size: 12px; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .winner { transition: none; } .list li.fresh { animation: none; } }
