:root {
  --black: #050505;
  --black-2: #0c0c0c;
  --charcoal: #171717;
  --panel: #111111;
  --panel-2: #1b1b1b;
  --line: rgba(255, 255, 255, 0.13);
  --line-strong: rgba(255, 122, 24, 0.45);
  --text: #fff8f1;
  --muted: #b6aaa0;
  --orange: #ff7a18;
  --orange-2: #ff9f1c;
  --field: #0b0b0b;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--black);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(145deg, rgba(255, 122, 24, 0.18), transparent 34rem),
    linear-gradient(180deg, #070707, #101010 46rem, #050505);
  overflow-x: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px clamp(18px, 4vw, 52px);
  background: rgba(5, 5, 5, 0.88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  min-width: 180px;
  text-decoration: none;
}

.brand-logo {
  display: block;
  width: min(240px, 42vw);
  height: auto;
  object-fit: contain;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tab,
.ghost-btn,
.primary-btn {
  min-height: 44px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 900;
  letter-spacing: 0;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, background 160ms ease;
}

.tab {
  padding: 0 16px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
}

.tab.is-active,
.tab:hover {
  color: var(--text);
  background: rgba(255, 122, 24, 0.14);
  border-color: var(--line-strong);
}

.primary-btn {
  padding: 0 20px;
  color: #100804;
  background: linear-gradient(180deg, var(--orange-2), var(--orange));
  border: 1px solid rgba(255, 190, 103, 0.9);
  box-shadow: 0 14px 30px rgba(255, 122, 24, 0.2);
}

.ghost-btn {
  padding: 0 16px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line);
}

.primary-btn:hover,
.ghost-btn:hover,
.tab:hover {
  transform: translateY(-1px);
}

.primary-btn:disabled {
  cursor: wait;
  opacity: 0.68;
}

main {
  width: min(1240px, calc(100% - 36px));
  margin: 0 auto 64px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 410px);
  gap: clamp(28px, 5vw, 72px);
  align-items: end;
  min-height: min(680px, calc(100vh - 78px));
  padding: clamp(52px, 8vw, 110px) 0 36px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--orange-2);
  font-size: 0.78rem;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1 {
  max-width: 880px;
  margin-bottom: 20px;
  font-size: clamp(3.1rem, 9vw, 7.8rem);
  line-height: 0.88;
  letter-spacing: 0;
  text-transform: uppercase;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.65rem, 3vw, 2.6rem);
  line-height: 1.02;
}

h3 {
  margin-bottom: 6px;
  font-size: 1.16rem;
}

.hero-copy p:not(.eyebrow) {
  max-width: 720px;
  color: var(--muted);
  font-size: clamp(1.03rem, 1.7vw, 1.28rem);
  line-height: 1.65;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.score-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.score-strip div {
  min-width: 0;
  padding: 22px 18px;
  border-left: 1px solid var(--line);
}

.score-strip div:first-child {
  border-left: 0;
}

.score-strip span {
  display: block;
  color: var(--orange-2);
  font-size: clamp(1.55rem, 4vw, 2.45rem);
  font-weight: 950;
}

.score-strip small {
  color: var(--muted);
  font-weight: 800;
}

.view {
  display: none;
  padding: 34px 0 0;
}

.view.is-active {
  display: block;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.muted {
  max-width: 600px;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.form-panel,
.admin-panel,
.leaderboard,
.login-panel {
  background: rgba(17, 17, 17, 0.9);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.form-panel,
.login-panel {
  display: grid;
  gap: 26px;
  padding: clamp(20px, 4vw, 36px);
}

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

legend {
  margin-bottom: 14px;
  color: var(--text);
  font-size: 1.06rem;
  font-weight: 950;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

label {
  display: grid;
  gap: 8px;
  color: #dfd5cb;
  font-size: 0.92rem;
  font-weight: 850;
}

input,
select {
  width: 100%;
  min-height: 48px;
  padding: 0 13px;
  color: var(--text);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
}

select option {
  color: #111;
}

input::placeholder {
  color: #80756d;
}

input:focus,
select:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(255, 122, 24, 0.17);
}

.consent-row {
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  color: var(--text);
  line-height: 1.5;
}

.consent-row input {
  width: 20px;
  min-height: 20px;
  margin-top: 2px;
  accent-color: var(--orange);
}

.form-actions,
.wheel-actions,
.trainer-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

#form-message,
#winner-message,
#trainer-login-message {
  margin: 0;
  color: var(--orange-2);
  font-weight: 900;
}

.leaderboard {
  display: grid;
  gap: 1px;
  overflow: hidden;
  background: var(--line);
}

.leader-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) minmax(92px, auto) minmax(116px, auto);
  gap: 14px;
  align-items: center;
  padding: 18px;
  background: var(--panel);
}

.rank {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  color: #100804;
  background: var(--orange);
  border-radius: 50%;
  font-weight: 950;
}

.leader-name {
  color: var(--text);
  font-weight: 950;
  overflow-wrap: anywhere;
}

.leader-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.ticket-pill {
  justify-self: end;
  min-width: 86px;
  padding: 8px 12px;
  color: #100804;
  text-align: center;
  background: var(--orange-2);
  border-radius: 999px;
  font-weight: 950;
}

.reward {
  justify-self: end;
  color: #dfd5cb;
  font-weight: 850;
}

.trainer-lock {
  display: grid;
  place-items: center;
  min-height: 440px;
}

.login-panel {
  width: min(100%, 520px);
  border-color: var(--line-strong);
}

.login-logo {
  width: min(320px, 78vw);
  height: auto;
}

.locked {
  display: none;
}

.trainer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.28fr) minmax(330px, 0.72fr);
  gap: 22px;
  align-items: start;
}

.admin-panel {
  overflow: hidden;
}

.panel-title {
  padding: 20px;
  border-bottom: 1px solid var(--line);
}

.panel-title p {
  margin-bottom: 0;
  color: var(--muted);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  color: var(--orange-2);
  font-size: 0.78rem;
  text-transform: uppercase;
}

td strong {
  display: block;
  overflow-wrap: anywhere;
}

td small {
  color: var(--muted);
}

.status-select,
.amount-input {
  min-width: 150px;
}

.amount-input {
  max-width: 150px;
}

.wheel-panel {
  padding-bottom: 22px;
  border-color: var(--line-strong);
}

.wheel-shell {
  display: grid;
  place-items: center;
  padding: 20px 20px 6px;
}

#wheel {
  display: block;
  width: min(100%, 450px);
  aspect-ratio: 1;
  height: auto;
  filter: drop-shadow(0 24px 35px rgba(0, 0, 0, 0.45));
}

.wheel-actions {
  justify-content: center;
  padding: 0 18px;
  text-align: center;
}

.winners-panel {
  grid-column: 1 / -1;
}

.winner-history {
  display: grid;
  gap: 1px;
  background: var(--line);
}

.winner-record {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 16px;
  align-items: center;
  padding: 16px 20px;
  background: var(--panel);
}

.winner-record strong,
.winner-record span,
.winner-record small {
  display: block;
}

.winner-record span,
.winner-record small {
  color: var(--muted);
}

.winner-prize {
  color: var(--orange-2);
  font-size: 1.35rem;
  font-weight: 950;
}

.spin-stage {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  place-items: center;
  padding: clamp(18px, 4vw, 42px);
  background:
    linear-gradient(145deg, rgba(255, 122, 24, 0.12), transparent 50%),
    rgba(0, 0, 0, 0.94);
  backdrop-filter: blur(6px);
}

.live-draw-active {
  overflow: hidden;
}

.stage-brand {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin-bottom: 8px;
  text-align: center;
}

.stage-logo {
  width: min(300px, 58vw);
  height: auto;
}

.stage-brand p {
  margin: 0;
  color: var(--orange-2);
  font-size: clamp(1rem, 2.5vw, 1.35rem);
  font-weight: 950;
  text-transform: uppercase;
}

.stage-wheel-shell {
  display: grid;
  width: min(82vmin, 760px);
  aspect-ratio: 1;
  place-items: center;
  pointer-events: none;
}

.stage-wheel-shell #wheel {
  width: min(82vmin, 760px);
  max-height: 82vmin;
}

.winner-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(8px);
}

.winner-card {
  width: min(100%, 620px);
  padding: clamp(28px, 5vw, 48px);
  text-align: center;
  background:
    linear-gradient(145deg, rgba(255, 122, 24, 0.22), transparent 60%),
    rgba(12, 12, 12, 0.96);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: 0 32px 100px rgba(0, 0, 0, 0.72);
}

.winner-logo {
  width: min(300px, 72vw);
  height: auto;
  margin-bottom: 22px;
}

.winner-card h2 {
  margin-bottom: 14px;
  color: #fff;
  font-size: clamp(2.4rem, 7vw, 5rem);
  line-height: 0.95;
  text-transform: uppercase;
}

.winner-detail {
  margin-bottom: 26px;
  color: var(--orange-2);
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  font-weight: 950;
}

.empty-state {
  display: grid;
  gap: 6px;
  padding: 28px;
  color: var(--muted);
  text-align: center;
  background: var(--panel);
}

.empty-state strong {
  color: var(--text);
  font-size: 1.1rem;
}

@media (max-width: 930px) {
  .topbar,
  .section-heading,
  .hero {
    align-items: stretch;
  }

  .topbar,
  .section-heading {
    flex-direction: column;
  }

  .hero,
  .trainer-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }
}

@media (max-width: 660px) {
  main {
    width: min(100% - 20px, 1240px);
    margin-bottom: 28px;
  }

  .topbar {
    position: static;
    gap: 14px;
    padding: 14px 10px 10px;
  }

  .brand-lockup {
    justify-content: center;
    width: 100%;
    min-width: 0;
  }

  .brand-logo {
    width: min(250px, 74vw);
  }

  .hero {
    gap: 22px;
    padding: 32px 0 24px;
  }

  h1 {
    font-size: clamp(3rem, 17vw, 4.6rem);
  }

  h2 {
    font-size: clamp(1.55rem, 9vw, 2.1rem);
  }

  .hero-copy p:not(.eyebrow),
  .muted {
    font-size: 0.98rem;
    line-height: 1.55;
  }

  .tabs,
  .score-strip,
  .grid.two,
  .leader-row {
    grid-template-columns: 1fr;
  }

  .tabs {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  .tab,
  .hero-actions .primary-btn,
  .hero-actions .ghost-btn {
    width: 100%;
  }

  .tab {
    min-height: 40px;
    padding: 0 8px;
    font-size: 0.88rem;
  }

  .primary-btn,
  .ghost-btn {
    min-height: 48px;
  }

  .section-heading {
    gap: 10px;
    margin-bottom: 14px;
  }

  .form-panel,
  .login-panel {
    gap: 22px;
    padding: 18px 14px;
  }

  input,
  select {
    min-height: 50px;
    font-size: 16px;
  }

  .form-actions,
  .trainer-actions,
  .wheel-actions {
    display: grid;
    width: 100%;
    grid-template-columns: 1fr;
  }

  .form-actions .primary-btn,
  .trainer-actions .ghost-btn,
  .wheel-actions .primary-btn {
    width: 100%;
  }

  .score-strip div {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .score-strip div:first-child {
    border-top: 0;
  }

  .leader-row {
    gap: 8px;
  }

  .ticket-pill,
  .reward {
    justify-self: start;
  }

  .winner-record {
    grid-template-columns: 1fr;
  }

  .panel-title {
    padding: 16px 14px;
  }

  .table-wrap {
    overflow: visible;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  tr {
    padding: 14px;
    border-bottom: 1px solid var(--line);
    background: var(--panel);
  }

  td {
    display: grid;
    grid-template-columns: 106px minmax(0, 1fr);
    gap: 10px;
    padding: 8px 0;
    border-bottom: 0;
  }

  td::before {
    color: var(--orange-2);
    font-size: 0.75rem;
    font-weight: 950;
    text-transform: uppercase;
  }

  td:nth-child(1)::before {
    content: "Member";
  }

  td:nth-child(2)::before {
    content: "Referral";
  }

  td:nth-child(3)::before {
    content: "Contact";
  }

  td:nth-child(4)::before {
    content: "Status";
  }

  td:nth-child(5)::before {
    content: "Sign-up";
  }

  td:nth-child(6)::before {
    content: "Reward";
  }

  .status-select,
  .amount-input {
    min-width: 0;
    max-width: none;
  }

  .wheel-shell {
    padding: 14px 10px 4px;
  }

  #wheel {
    width: min(100%, 350px);
  }

  .spin-stage {
    padding: 12px;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .stage-logo {
    width: min(230px, 70vw);
  }

  .stage-wheel-shell,
  .stage-wheel-shell #wheel {
    width: min(94vw, 72vh);
    max-height: 72vh;
  }

  .winner-card {
    padding: 24px 16px;
  }

  .winner-logo {
    width: min(240px, 72vw);
  }

  .winner-card h2 {
    font-size: clamp(2rem, 13vw, 3.4rem);
    overflow-wrap: anywhere;
  }
}

@media (max-width: 420px) {
  main {
    width: min(100% - 14px, 1240px);
  }

  .tabs {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: clamp(2.55rem, 18vw, 3.55rem);
  }

  td {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .score-strip div,
  .leader-row,
  tr {
    padding: 12px;
  }

  .stage-wheel-shell,
  .stage-wheel-shell #wheel {
    width: min(96vw, 68vh);
    max-height: 68vh;
  }
}

.locked {
  display: none !important;
}
