:root {
  --bg: #fff6fb;
  --bg-soft: #ffffff;
  --card: #ffffff;
  --line: #ffd8ec;
  --text: #2a1250;
  --muted: #8a6ab0;
  --accent: #ff3d9a;
  --accent-strong: #b026ff;
  --win: #12b76a;
  --danger: #ef4444;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(900px 500px at 12% -8%, #ffe0f0, transparent 60%),
    radial-gradient(800px 520px at 92% 0%, #dfefff, transparent 60%),
    radial-gradient(700px 600px at 50% 118%, #fff3c9, transparent 55%),
    linear-gradient(180deg, #fff8fc, var(--bg));
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
}

a { color: var(--accent-strong); }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 2px solid var(--line);
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(8px);
}
.topbar h1 { font-size: 16px; margin: 0; letter-spacing: 0.02em; }
.topbar .links a { margin-left: 16px; font-size: 14px; text-decoration: none; font-weight: 600; }
.topbar .links a:hover { text-decoration: underline; }

/* ---------- guest ---------- */

.guest-wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 32px 20px 60px;
  text-align: center;
}
.guest-wrap h2 {
  font-size: 32px;
  margin: 0 0 6px;
  background: linear-gradient(90deg, #ff3d9a, #ff8a00 45%, #b026ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.guest-wrap .subtitle { color: var(--muted); margin: 0 0 24px; font-weight: 500; }

.wheel-stage {
  position: relative;
  width: min(88vw, 460px);
  aspect-ratio: 1;
  margin: 0 auto 26px;
}
#wheel {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #ffffff;
  box-shadow:
    0 18px 50px rgba(176, 38, 255, 0.28),
    0 0 0 8px #ffffff,
    0 0 0 12px var(--accent);
}
.pointer {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 18px solid transparent;
  border-right: 18px solid transparent;
  border-top: 30px solid #ff8a00;
  filter: drop-shadow(0 3px 4px rgba(176, 38, 255, 0.45));
  z-index: 2;
}

.spin-btn {
  font: inherit;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 0.06em;
  padding: 15px 46px;
  border: none;
  border-radius: 999px;
  color: #ffffff;
  background: linear-gradient(90deg, #ff3d9a, #ff8a00 50%, #b026ff);
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(255, 61, 154, 0.4);
  transition: transform 0.08s ease, filter 0.15s ease, box-shadow 0.15s ease;
}
.spin-btn:hover { filter: brightness(1.06) saturate(1.1); box-shadow: 0 14px 34px rgba(176, 38, 255, 0.45); }
.spin-btn:active { transform: translateY(1px); }
.spin-btn:disabled { filter: grayscale(0.5) brightness(0.95); cursor: not-allowed; }

.result {
  margin-top: 22px;
  min-height: 28px;
  font-size: 20px;
  font-weight: 700;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.result.show { opacity: 1; transform: none; }
.result.win { color: var(--win); }

/* result popup */
.modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(42, 18, 80, 0.45);
  backdrop-filter: blur(4px);
  z-index: 10000;
  animation: modal-fade 0.2s ease;
}
.modal-overlay[hidden] { display: none; }
.modal-card {
  width: min(90vw, 380px);
  background: var(--card);
  border-radius: 20px;
  padding: 32px 26px 26px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(42, 18, 80, 0.35);
  animation: modal-pop 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.modal-icon { font-size: 48px; line-height: 1; margin-bottom: 10px; }
.modal-card h3 {
  margin: 0 0 8px;
  font-size: 22px;
  background: linear-gradient(90deg, #ff3d9a, #ff8a00 45%, #b026ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.modal-card p { margin: 0 0 22px; color: var(--text); font-size: 16px; font-weight: 600; }
.modal-card button { width: 100%; font-size: 16px; padding: 12px 16px; }

@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-pop {
  from { opacity: 0; transform: scale(0.85) translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* confetti */
.confetti-piece {
  position: fixed;
  top: -12px;
  width: 10px;
  height: 14px;
  border-radius: 2px;
  pointer-events: none;
  z-index: 9999;
  will-change: transform, opacity;
  animation: confetti-fall linear forwards;
}
@keyframes confetti-fall {
  0% { transform: translate3d(0, 0, 0) rotate(0deg); opacity: 1; }
  100% { transform: translate3d(var(--dx, 0), 105vh, 0) rotate(720deg); opacity: 0.9; }
}

/* ---------- admin ---------- */

.admin-wrap { max-width: 860px; margin: 0 auto; padding: 28px 20px 80px; }

.card {
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 18px;
  padding: 22px;
  margin-bottom: 22px;
  box-shadow: 0 12px 32px rgba(176, 38, 255, 0.1);
}
.card h3 {
  margin: 0 0 4px;
  font-size: 16px;
}
.card .card-sub { color: var(--muted); font-size: 13px; margin: 0 0 16px; }
.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

button {
  font: inherit;
  font-weight: 700;
  padding: 9px 16px;
  border-radius: 10px;
  border: 2px solid var(--line);
  background: var(--bg-soft);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.12s ease, transform 0.08s ease;
}
button:hover { border-color: var(--accent); }
button:active { transform: translateY(1px); }
button.primary {
  background: linear-gradient(90deg, #ff3d9a, #b026ff);
  color: #ffffff;
  border: none;
}
button.danger { border-color: #ffc2cc; color: #e11d48; background: #fff1f3; }
button:disabled { opacity: 0.6; cursor: default; }

.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 2px solid var(--line);
  background: var(--bg-soft);
  color: var(--text);
  font: inherit;
}
.field input:focus { outline: none; border-color: var(--accent); }

.prize-row {
  display: grid;
  grid-template-columns: 44px 1fr auto auto 58px 34px;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.prize-row:first-child { border-top: none; }
.prize-row input[type="text"] {
  padding: 8px 10px;
  border-radius: 8px;
  border: 2px solid var(--line);
  background: var(--bg-soft);
  color: var(--text);
  font: inherit;
}
.prize-row input[type="color"] {
  width: 44px;
  height: 34px;
  padding: 0;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--bg-soft);
}
.prize-row .mini { font-size: 11px; color: var(--muted); display: flex; flex-direction: column; gap: 3px; }
.prize-row .mini input {
  width: 66px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 2px solid var(--line);
  background: var(--bg-soft);
  color: var(--text);
  font: inherit;
}
.prize-row .odds { font-size: 12px; color: var(--accent-strong); text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.prize-row .del {
  padding: 6px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}
.prize-row .del:hover { color: var(--danger); }

.row-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.row-actions--flush { margin-top: 0; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
td.muted, .muted { color: var(--muted); }
td.empty { text-align: center; color: var(--muted); padding: 24px; }
.table-scroll { max-height: 340px; overflow: auto; border: 2px solid var(--line); border-radius: 12px; }

@media (max-width: 640px) {
  .prize-row { grid-template-columns: 40px 1fr 1fr; }
  .prize-row .odds { grid-column: 2 / 4; text-align: left; }
  .prize-row .del { position: absolute; }
}
