:root {
  /* Brand & surface colours */
  --color-text-primary: #141210;
  --color-text-inverse: #ffffff;
  --color-border-subtle: #e3e1da;
  --color-border-neutral: #7a7468;
  --color-profit: #17a36b;

  --color-bg: #0f0f0f;
  --color-bg-row: #1b1b1b;
  --color-bg-row-alt: #151515;

  --color-brand: #facc15;

  /* Signature gold gradient */
  --gold-gradient: linear-gradient(131deg, #d4af37 0%, #f5e6a8 50%, #d4af37 100%);
  --gold-gradient-flat: linear-gradient(143.6deg, #d4af37 0%, #f5e6a8 50%, #d4af37 100%);
  --btn-gradient: linear-gradient(90deg, #e7c975 0%, #cd9d37 100%);

  /* Rank card surface gradients */
  --rank-gold: linear-gradient(136deg, #ffd25e 1.6%, #fff4cd 47.6%, #ffd540 98.4%);
  --rank-silver: linear-gradient(133deg, #d7d7d7 1.6%, #f3f3f3 47.6%, #b9b9b9 98.4%);
  --rank-bronze: linear-gradient(120deg, #dac294 1.6%, #f0debc 47.6%, #bc9b5c 98.4%);
  --rank-blue: linear-gradient(120deg, #93bddb 1.6%, #c2daeb 47.6%, #5295c5 98.4%);
  --rank-purple: linear-gradient(136deg, #deb7f5 1.6%, #e9dbf1 47.6%, #deb7f5 98.4%);

  /* Reward card border colours */
  --reward-border-gold: #ffc83e;
  --reward-border-silver: #a3a6ac;
  --reward-border-bronze: #9d612d;
  --reward-border-blue: #7baed3;
  --reward-border-purple: #b280cf;

  /* Typography */
  --font-base: "Poppins", "Noto Sans Thai", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Type scale */
  --fs-display: 56px;
  --fs-hero: 64px;
  --fs-h-lg: 28px;
  --fs-h-md: 20px;
  --fs-body-lg: 18px;
  --fs-label: 16px;
  --fs-small: 14px;

  /* Spacing & layout */
  --container-max: 1640px;
  --gutter: 20px;
  --section-py: 48px;
  --radius-md: 24px;
  --radius-lg: 32px;
  --radius-pill: 100px;
}

/* ----------------------------- RESET ------------------------------ */
*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-base);
  font-size: var(--fs-label);
  line-height: 1.5;
  color: var(--color-text-inverse);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button { font-family: inherit; cursor: pointer; }
h1, h2, h3, p { margin: 0; }

/* ----------------------------- HELPERS ---------------------------- */
.container {
  width: 100%;
  max-width: calc(var(--container-max) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.text-gold-gradient {
  display: inline-block;
  padding-bottom: 0.08em;
  background: var(--gold-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* ----------------------------- BUTTONS ---------------------------- */
.btn:not(.center) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-pill);
  font-weight: 600;
  line-height: 1.2;
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn--primary {
  background: var(--btn-gradient);
  color: var(--color-text-primary);
  padding: 14px 22px;
  font-size: var(--fs-body-lg);
  box-shadow: 0 4px 2px rgba(0, 0, 0, .05);
}
.btn--primary:hover { box-shadow: 0 8px 20px rgba(205, 157, 55, .35); }

/* =============================== HERO ============================= */
.hero {
  position: relative;
  display: flex;
  align-items: flex-start;
  aspect-ratio: 1086 / 1766;
  min-height: 460px;
  padding-block: 120px 56px;
  background: #000 url("./assets/hero-mobile.png") center / cover no-repeat;
}
.hero__content { max-width: 660px; }
.hero__title {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-weight: 600;
  font-size: clamp(28px, 7vw, var(--fs-hero));
  line-height: 1.2;
  color: #fff;
  overflow-wrap: break-word;
}
.hero__title-line { display: block; }
.hero__desc {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: var(--fs-body-lg);
  line-height: 1.6;
  color: #fff;
  max-width: 465px;
}
.hero__cta { margin-top: 24px; }

/* ========================== REWARDS ============================== */
.rewards {
  position: relative;
  padding-block: var(--section-py);
  background-color: var(--color-bg);
  overflow: hidden;
}
.rewards::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("./assets/prize-banner.png") right top / cover no-repeat;
  z-index: 0;
}
.rewards::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(15, 15, 15, .25), rgba(15, 15, 15, .45));
  z-index: 1;
}
.rewards__inner {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
}

.rewards__header { text-align: center; max-width: 680px; }
.rewards__title {
  font-weight: 600;
  font-size: clamp(30px, 7vw, var(--fs-display));
  line-height: 1.15;
  color: #fff;
}
.rewards__subtitle {
  margin-top: 16px;
  font-size: var(--fs-body-lg);
  line-height: 1.6;
  color: #fff;
}

.rewards__podium,
.rewards__runners {
  display: grid;
  gap: 20px;
  width: 100%;
}

.reward-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 36px 24px;
  border: 1.5px solid var(--reward-border-gold);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(43, 38, 26, .35), rgba(25, 22, 14, .35)),
    url("./assets/prize-banner.png") center / cover no-repeat;
  isolation: isolate;
}
.reward-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 80% at 50% 0%, var(--reward-glow, rgba(255,200,62,.18)), transparent 70%);
  z-index: -1;
}
.reward-card--gold   { border-color: var(--reward-border-gold);   --reward-glow: rgba(255, 200, 62, .22); }
.reward-card--silver { border-color: var(--reward-border-silver); --reward-glow: rgba(163, 166, 172, .20); }
.reward-card--bronze { border-color: var(--reward-border-bronze); --reward-glow: rgba(157, 97, 45, .22); }
.reward-card--blue   { border-color: var(--reward-border-blue);   --reward-glow: rgba(123, 174, 211, .22); }
.reward-card--purple { border-color: var(--reward-border-purple); --reward-glow: rgba(178, 128, 207, .22); }

.reward-card__rank {
  font-size: var(--fs-h-md);
  font-weight: 600;
  letter-spacing: .5px;
}
.reward-card__rank--silver { color: #d8dade; }
.reward-card__rank--bronze { color: #e7b07e; }
.reward-card__rank--blue   { color: #b9d7ec; }
.reward-card__rank--purple { color: #d7b8f2; }

.reward-card__medal {
  width: 90px; height: 85px;
  object-fit: cover;
  object-position: center;
  margin-block: 8px;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, .45));
}
.reward-card--featured .reward-card__medal {
  width: 134px; height: 127px;
}

.reward-card__label { font-size: var(--fs-body-lg); color: var(--color-border-subtle); }
.reward-card__prize {
  font-size: clamp(40px, 9vw, var(--fs-display));
  font-weight: 700;
  line-height: 1.1;
}
.reward-card__prize--silver { color: #e9eaec; }
.reward-card__prize--bronze { background: var(--rank-bronze); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent; }
.reward-card__prize--blue   { color: #cfe4f2; }
.reward-card__prize--purple { background: linear-gradient(180deg, #ac7cff, #e2cbff 71%, #7b3fe4); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent; }

.rewards__certificate {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-body-lg);
  color: #fff;
  text-align: center;
}
.rewards__certificate-icon { width: 18px; height: 18px; object-fit: contain; }

/* ========================= LEADERBOARD =========================== */
.leaderboard { padding-block: var(--section-py); background: var(--color-bg); }
.leaderboard__inner { display: flex; flex-direction: column; gap: 40px; }

.leaderboard__header { text-align: center; max-width: 820px; margin-inline: auto; }
.leaderboard__title {
  font-weight: 600;
  font-size: clamp(30px, 7vw, var(--fs-display));
  line-height: 1.15;
  color: #fff;
}
.leaderboard__desc {
  margin-top: 16px;
  font-size: var(--fs-body-lg);
  line-height: 1.6;
  color: #fff;
}

.leaderboard__body { display: flex; flex-direction: column; gap: 24px; }

.leaderboard__cards { display: flex; flex-direction: column; gap: 18px; }
.lb-card {
  position: relative;
  display: grid;
  grid-template-columns: 96px 1fr;
  align-items: center;
  gap: 18px;
  min-height: 150px;
  padding: 12px 20px 12px 16px;
  border-radius: var(--radius-md);
  overflow: hidden;
  color: var(--color-text-primary);
}
.lb-card--1 { background: var(--rank-gold); }
.lb-card--2 { background: var(--rank-silver); }
.lb-card--3 { background: var(--rank-bronze); }
.lb-card--4 { background: var(--rank-blue); }
.lb-card--5 { background: var(--rank-purple); }

.lb-card__medal {
  width: 96px; height: 122px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .25));
}
.lb-card__info { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.lb-card__info > div { display: flex; flex-direction: column; gap: 4px; }
.lb-card__name {
  font-size: var(--fs-h-md);
  font-weight: 600;
  line-height: 1.2;
  color: var(--color-text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lb-card__profit-label {
  font-size: var(--fs-small);
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--color-text-primary);
}
.lb-card__profit {
  font-size: var(--fs-h-lg);
  font-weight: 600;
  line-height: 1.1;
  color: var(--color-profit);
}

.lb-card__ribbon {
  position: absolute;
  top: 0; right: -4px;
  width: 130px; height: 130px;
  background: url("./assets/rank-ribbon.png") top right / contain no-repeat;
  pointer-events: none;
}
.lb-card__ribbon span {
  position: absolute;
  top: 39px; right: 4px;
  width: 92px;
  text-align: center;
  transform: rotate(45deg);
  color: #fff;
  font-size: var(--fs-small);
  font-weight: 700;
  letter-spacing: 1px;
  text-shadow: 1px 2px 4px rgba(0, 0, 0, .25);
  white-space: nowrap;
}

.leaderboard__table-wrap {
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .06);
  overflow-x: auto;
}
.leaderboard__table {
  width: 100%;
  border-collapse: collapse;
  min-width: 420px;
}
.leaderboard__table thead tr { background: var(--gold-gradient-flat); }
.leaderboard__table thead th {
  background: transparent;
  color: var(--color-text-primary);
  font-size: var(--fs-small);
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 20px 16px;
  text-align: center;
  white-space: nowrap;
}
.leaderboard__table thead th:nth-child(2) { text-align: left; }
.leaderboard__table tbody td {
  padding: 18px 16px;
  font-size: var(--fs-label);
  font-weight: 500;
  text-align: center;
  color: #fff;
}
.leaderboard__table tbody td:nth-child(2) { text-align: left; }
.leaderboard__table tbody tr { background: var(--color-bg-row-alt); }
.leaderboard__table tbody tr:nth-child(even) { background: var(--color-bg-row); }
.leaderboard__table tbody tr:hover { background: #232323; }

/* ========================= INSTRUCTIONS ========================= */
.instructions { padding-block: var(--section-py); background: var(--color-bg); }
.instructions__box {
  border: 1px solid var(--color-border-neutral);
  border-radius: var(--radius-md);
  padding: 32px 24px;
}
.instructions__grid {
  display: flex;
  flex-direction: column;
  gap: 40px;
}
.instructions__col {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
  width: 100%;
}
.instructions__heading {
  font-weight: 400;
  font-size: var(--fs-h-lg);
  line-height: 1.3;
  color: var(--color-brand);
}
.instructions__text,
.instructions__list {
  font-size: var(--fs-label);
  font-weight: 500;
  line-height: 1.5;
  color: var(--color-text-inverse);
  overflow-wrap: anywhere;
}
.instructions__list {
  list-style: decimal;
  padding-left: 22px;
}
.instructions__list li + li { margin-top: 4px; }

/* ============================== CTA ============================== */
.cta { padding-block: var(--section-py); background: var(--color-bg); }

.cta__banner {
  position: relative;
  display: flex;
  align-items: flex-start;
  aspect-ratio: 1346 / 1368;
  border-radius: var(--radius-md);
  overflow: hidden;
  padding: 32px 28px;
  background: #000 url("./assets/CTA-banner-mobile.png") center / cover no-repeat;
}
.cta__content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 20px;
  max-width: 481px;
}
.cta__title {
  font-weight: 600;
  font-size: clamp(28px, 7vw, var(--fs-display));
  line-height: 1.1;
  color: var(--color-brand);
  overflow-wrap: break-word;
}
.cta__desc {
  font-size: var(--fs-label);
  line-height: 1.5;
  color: var(--color-text-inverse);
}
.cta__cta { margin-top: 4px; }

/* =================================================================
   RESPONSIVE — mobile-first; min-width breakpoints
   ================================================================= */

/* ---- 375px ---- */
@media (min-width: 375px) {
  :root { --gutter: 24px; }
}

/* ---- 768px: tablet ---- */
@media (min-width: 768px) {
  :root { --section-py: 64px; }

  .hero {
    aspect-ratio: auto;
    align-items: center;
    min-height: 520px;
    background-image: url("./assets/hero-desktop.png");
  }

  .rewards__podium { grid-template-columns: repeat(3, 1fr); align-items: center; gap: 24px; }
  .rewards__runners { grid-template-columns: repeat(2, 1fr); gap: 24px; max-width: 760px; }
  .reward-card { min-height: 360px; }
  .reward-card--featured { min-height: 432px; }

  .lb-card { grid-template-columns: 110px 1fr; gap: 22px; padding-left: 18px; }
  .lb-card__medal { width: 110px; height: 134px; }

  .reward-card__medal { width: 128px; height: 122px; }
  .reward-card--featured .reward-card__medal { width: 192px; height: 182px; }

  .cta__banner {
    aspect-ratio: 2449 / 642;
    align-items: center;
    padding: 40px 56px;
    background-image: url("./assets/CTA-banner-desktop.png");
  }
  .cta__title { font-size: 40px; line-height: 44px; }
  .cta__desc { line-height: 24px; }
}

/* ---- 1024px: small desktop ---- */
@media (min-width: 1024px) {
  .hero {
    aspect-ratio: auto;
    align-items: center;
    min-height: 600px;
    padding-block: 150px 64px;
    background-image: url("./assets/hero-desktop.png");
  }
  .hero__title { font-size: var(--fs-hero); gap: 6px; }

  .instructions__box { padding: 49px; }
  .instructions__grid { flex-direction: row; justify-content: space-between; gap: 48px; }
  .instructions__col { flex: 0 1 611px; gap: 36px; }
  .instructions__heading { line-height: 36px; }
  .instructions__text,
  .instructions__list { line-height: 24px; }

  .leaderboard__body { flex-direction: row; align-items: flex-start; gap: 40px; }
  .leaderboard__cards { flex: 0 0 460px; }
  .leaderboard__table-wrap { flex: 1; overflow-x: visible; }
  .leaderboard__table { min-width: 0; }
  .leaderboard__table thead th,
  .leaderboard__table tbody td { padding: 22px 24px; }

  .cta__banner { padding: 40px 80px; }
}

/* ---- 1280px: full desktop ---- */
@media (min-width: 1280px) {
  :root { --gutter: 40px; }

  .reward-card { padding: 40px 28px; min-height: 377px; }
  .reward-card--featured { min-height: 452px; }

  .leaderboard__cards { flex: 0 0 520px; }
  .lb-card { min-height: 168px; grid-template-columns: 116px 1fr; gap: 24px; padding: 10px 20px 10px 19px; }
  .lb-card__medal { width: 116px; height: 146px; }
  .lb-card__info { gap: 30px; }

  .cta__banner { padding: 0 100px; }
}

/* ---- below 768px: stack reward cards in rank order (TOP 1 first) ---- */
@media (max-width: 767.98px) {
  .reward-card[data-rank="1"] { order: 1; }
  .reward-card[data-rank="2"] { order: 2; }
  .reward-card[data-rank="3"] { order: 3; }
}

/* ---- below 375px ---- */
@media (max-width: 374.98px) {
  :root { --fs-body-lg: 16px; }
  body { font-size: 16px; }
}
