:root {
  --red-950: #3b0509;
  --red-900: #62070d;
  --red-800: #8f0712;
  --red-700: #b20d1b;
  --red-600: #d61f2c;
  --gold: #f5bd43;
  --gold-light: #ffe28d;
  --cream: #fffaf0;
  --ink: #211317;
  --muted: #705f64;
  --line: #eadde0;
  --white: #ffffff;
  --shadow: 0 30px 80px rgba(42, 3, 8, 0.28);
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  margin: 0;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.spin-page {
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 12% 10%, rgba(245, 189, 67, .22), transparent 27rem),
    radial-gradient(circle at 90% 80%, rgba(255, 113, 124, .18), transparent 30rem),
    linear-gradient(135deg, var(--red-950), var(--red-800) 58%, #4b050b);
  color: var(--cream);
}

.ambient {
  position: fixed;
  width: 380px;
  height: 380px;
  border: 1px solid rgba(255, 226, 141, .14);
  border-radius: 50%;
  pointer-events: none;
}

.ambient::before, .ambient::after {
  content: "";
  position: absolute;
  inset: 32px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: inherit;
}

.ambient::after { inset: 78px; }
.ambient-one { left: -170px; top: 25%; }
.ambient-two { right: -190px; top: -100px; }

.spin-shell {
  position: relative;
  z-index: 1;
  width: min(1240px, calc(100% - 40px));
  margin: 0 auto;
  padding: 26px 0 44px;
}

.spin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(255,255,255,.12);
}

.public-brand, .admin-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.public-brand p { margin: 0; font-size: 18px; font-weight: 850; letter-spacing: .08em; }
.public-brand span:not(.brand-mark) { color: #e9cfd2; font-size: 12px; }

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--gold-light), var(--gold));
  box-shadow: 0 8px 22px rgba(245,189,67,.26);
  color: var(--red-900);
  font-weight: 900;
}

.brand-mark-large { width: 46px; height: 46px; border-radius: 15px; font-size: 21px; }

.secure-chip {
  padding: 9px 14px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 999px;
  background: rgba(255,255,255,.07);
  color: #f5dfe1;
  font-size: 12px;
}

.spin-stage {
  display: grid;
  grid-template-columns: minmax(0, .95fr) minmax(430px, 1.05fr);
  align-items: center;
  gap: clamp(36px, 6vw, 86px);
  min-height: calc(100vh - 122px);
  padding: 48px 0 28px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--red-700);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .19em;
}

.eyebrow.light { color: var(--gold-light); }

.spin-copy h1 {
  max-width: 660px;
  margin: 0;
  font-size: clamp(42px, 5.8vw, 76px);
  line-height: .98;
  letter-spacing: -.045em;
}

.lead {
  max-width: 640px;
  margin: 24px 0 0;
  color: #eed9dc;
  font-size: 16px;
  line-height: 1.75;
}

.reward-row { display: flex; flex-wrap: wrap; gap: 9px; margin: 24px 0; }
.reward-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 999px;
  background: rgba(255,255,255,.07);
  color: #fff7f1;
  font-size: 12px;
  font-weight: 750;
}
.reward-pill span { width: 8px; height: 8px; border: 1px solid rgba(255,255,255,.55); border-radius: 50%; }

.voucher-card {
  max-width: 650px;
  padding: 20px;
  border: 1px solid rgba(255,255,255,.17);
  border-radius: 22px;
  background: rgba(255,255,255,.09);
  box-shadow: 0 22px 50px rgba(25,0,4,.2);
  backdrop-filter: blur(16px);
}

.voucher-card label { display: block; margin-bottom: 9px; color: #ffecee; font-size: 12px; font-weight: 750; }
.voucher-input-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }

input[type="text"], input[type="password"], input[type="number"], input[type="color"] {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  background: #fff;
  color: var(--ink);
  transition: border-color .2s, box-shadow .2s;
}

input:focus { border-color: var(--red-600); box-shadow: 0 0 0 4px rgba(214,31,44,.12); }

.voucher-card input {
  min-height: 54px;
  border: 0;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.btn {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  padding: 11px 18px;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  text-decoration: none;
  font-weight: 800;
  transition: transform .18s, opacity .18s, box-shadow .18s;
}

.btn:hover { transform: translateY(-1px); }
.btn:disabled { cursor: not-allowed; opacity: .55; transform: none; }
.btn-primary { background: linear-gradient(145deg, var(--gold-light), var(--gold)); box-shadow: 0 12px 28px rgba(245,189,67,.22); color: #4b2400; }
.btn-danger { background: var(--red-600); color: #fff; }
.btn-ghost { border: 1px solid var(--line); background: #fff; color: var(--ink); }
.btn-small { min-height: 38px; padding: 8px 13px; font-size: 12px; }
.btn-block { width: 100%; }

.form-message { min-height: 20px; margin: 10px 2px 0; color: #dcbec2; font-size: 12px; }
.form-message.error { color: #ffd1d5; font-weight: 700; }
.form-message.success { color: var(--gold-light); font-weight: 700; }

.wheel-column { display: flex; min-width: 0; flex-direction: column; align-items: center; }
.wheel-kicker { margin-bottom: 14px; color: var(--gold-light); font-size: 10px; font-weight: 850; letter-spacing: .24em; }
.wheel-wrap { position: relative; width: min(540px, 78vw); aspect-ratio: 1; }
.wheel-ring {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  border: 2px solid rgba(255,226,141,.58);
  border-radius: 50%;
  background: linear-gradient(145deg, rgba(255,255,255,.15), rgba(255,255,255,.03));
  box-shadow: 0 38px 90px rgba(22,0,3,.42), inset 0 0 0 10px rgba(255,255,255,.06);
}

#prizeWheel { display: block; width: 100%; height: 100%; border-radius: 50%; filter: drop-shadow(0 16px 30px rgba(0,0,0,.28)); }
.wheel-pointer {
  position: absolute;
  z-index: 4;
  top: -9px;
  left: 50%;
  width: 0;
  height: 0;
  transform: translateX(-50%);
  border-right: 22px solid transparent;
  border-left: 22px solid transparent;
  border-top: 48px solid var(--gold-light);
  filter: drop-shadow(0 5px 4px rgba(42,3,8,.4));
}

.wheel-center {
  position: absolute;
  display: grid;
  width: 94px;
  height: 94px;
  place-content: center;
  border: 8px solid var(--gold-light);
  border-radius: 50%;
  background: var(--red-900);
  box-shadow: 0 12px 28px rgba(0,0,0,.35);
  text-align: center;
}
.wheel-center span { font-size: 19px; font-weight: 950; letter-spacing: .08em; }
.wheel-center small { color: var(--gold-light); font-size: 9px; font-weight: 850; letter-spacing: .25em; }
.wheel-note { max-width: 440px; margin: 18px 0 0; color: #d9bfc3; font-size: 11px; line-height: 1.6; text-align: center; }

.modal[hidden] { display: none; }
.modal { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; padding: 22px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(30,1,5,.78); backdrop-filter: blur(10px); }
.modal-card {
  position: relative;
  width: min(430px, 100%);
  padding: 34px;
  border: 1px solid #f0d8dc;
  border-radius: 28px;
  background: var(--cream);
  box-shadow: var(--shadow);
  color: var(--ink);
  text-align: center;
  animation: modal-in .35s ease-out;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(16px) scale(.96); } }
.modal-card .result-icon { display: grid; width: 66px; height: 66px; margin: 0 auto 18px; place-items: center; border-radius: 50%; background: var(--gold); color: var(--red-900); font-size: 28px; }
.modal-card h2 { margin: 0 0 8px; font-size: 31px; }
.modal-card p { margin: 0; color: var(--muted); }
.modal-card strong { display: block; margin: 12px 0; color: var(--red-700); font-size: 34px; }
.modal-card small { display: block; margin: 0 auto 22px; color: var(--muted); line-height: 1.6; }
.modal-open { overflow: hidden; }

/* Admin */
.admin-body { min-height: 100vh; background: #f7f3f4; color: var(--ink); }
.admin-topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  height: 68px;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(14px);
}
.admin-brand { color: var(--red-900); font-weight: 900; }
.admin-brand small { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; font-weight: 600; }
.admin-shell { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: calc(100vh - 68px); }
.admin-sidebar { padding: 24px 16px; border-right: 1px solid var(--line); background: #fff; }
.admin-sidebar nav { position: sticky; top: 92px; display: grid; gap: 5px; }
.nav-link { padding: 11px 13px; border-radius: 10px; color: #5e4e52; font-size: 13px; font-weight: 700; text-decoration: none; }
.nav-link:hover, .nav-link.active { background: #fff0f1; color: var(--red-700); }
.admin-main { min-width: 0; padding: 34px; }
.page-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.page-heading h1 { margin: 0; font-size: clamp(26px, 3vw, 38px); letter-spacing: -.035em; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card, .panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(62,22,28,.05);
}
.stat-card { padding: 20px; }
.stat-card span { color: var(--muted); font-size: 12px; font-weight: 650; }
.stat-card strong { display: block; margin-top: 8px; color: var(--red-800); font-size: 29px; }
.panel { margin-bottom: 20px; overflow: hidden; }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.panel-header h2 { margin: 0; font-size: 17px; }
.panel-body { padding: 20px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 15px; border-bottom: 1px solid #f0e7e9; font-size: 12px; text-align: left; vertical-align: middle; }
th { background: #fcf9fa; color: var(--muted); font-size: 10px; letter-spacing: .07em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
.badge { display: inline-flex; padding: 5px 8px; border-radius: 999px; font-size: 10px; font-weight: 800; }
.badge-success { background: #eaf8ef; color: #15783c; }
.badge-muted { background: #f0ecee; color: #6c5c61; }
.badge-danger { background: #ffeaec; color: #aa1723; }
.empty-state { padding: 32px; color: var(--muted); text-align: center; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 15px; }
.form-group label { display: block; margin-bottom: 7px; color: #55464a; font-size: 11px; font-weight: 800; }
.form-group small { display: block; margin-top: 6px; color: var(--muted); line-height: 1.5; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.checkbox-line { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 700; }
.alert { margin-bottom: 18px; padding: 13px 15px; border-radius: 12px; font-size: 12px; font-weight: 700; }
.alert-success { border: 1px solid #bce9cb; background: #ecfbf1; color: #166a38; }
.alert-error { border: 1px solid #f3c5c9; background: #fff0f1; color: #9f1420; }
.alert-warning { border: 1px solid #f3daa2; background: #fff9e8; color: #805b08; }
.probability-total { font-weight: 900; }
.color-dot { display: inline-block; width: 16px; height: 16px; border-radius: 50%; vertical-align: middle; }
.code-box { width: 100%; min-height: 190px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); font: 12px/1.65 ui-monospace, monospace; resize: vertical; }

.login-page { display: grid; min-height: 100vh; place-items: center; padding: 22px; background: linear-gradient(145deg, var(--red-950), var(--red-800)); }
.login-card { width: min(420px, 100%); padding: 32px; border-radius: 24px; background: #fff; box-shadow: var(--shadow); }
.login-card .brand-mark { margin-bottom: 20px; }
.login-card h1 { margin: 0 0 8px; font-size: 30px; }
.login-card > p { margin: 0 0 24px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.login-card .form-group { margin-bottom: 14px; }

@media (max-width: 980px) {
  .spin-stage { grid-template-columns: 1fr; padding-top: 36px; }
  .spin-copy { text-align: center; }
  .spin-copy h1, .lead, .voucher-card { margin-right: auto; margin-left: auto; }
  .reward-row { justify-content: center; }
  .wheel-column { order: -1; }
  .wheel-wrap { width: min(500px, 82vw); }
  .stats-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 720px) {
  .spin-shell { width: min(100% - 28px, 1240px); padding-top: 16px; }
  .spin-header { padding-bottom: 16px; }
  .secure-chip { display: none; }
  .spin-stage { gap: 30px; }
  .wheel-wrap { width: min(430px, 88vw); }
  .wheel-center { width: 72px; height: 72px; border-width: 6px; }
  .wheel-center span { font-size: 15px; }
  .voucher-input-row { grid-template-columns: 1fr; }
  .voucher-card .btn { width: 100%; }
  .admin-shell { display: block; }
  .admin-sidebar { overflow-x: auto; padding: 10px 14px; border-right: 0; border-bottom: 1px solid var(--line); }
  .admin-sidebar nav { position: static; display: flex; width: max-content; }
  .nav-link { white-space: nowrap; }
  .admin-main { padding: 22px 14px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .admin-topbar { padding: 0 14px; }
}

@media (max-width: 430px) {
  .spin-copy h1 { font-size: 39px; }
  .lead { font-size: 14px; }
  .wheel-wrap { width: 92vw; }
  .wheel-pointer { border-right-width: 17px; border-left-width: 17px; border-top-width: 38px; }
  .stats-grid { grid-template-columns: 1fr; }
  .modal-card { padding: 28px 22px; }
}
