:root {
  --gold: #f5b51b;
  --orange: #f27a2e;
  --red: #c94727;
  --purple: #742583;
  --cream: #fff8e9;
  --text: #29162f;
  --silver: #b8c3cf;
  --bronze: #b96740;
  --muted-text: #77503d;
  --card-border: #ecd7bb;
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

html {
  min-width: 320px;
  min-height: 100%;
  background: #f27a2e;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 244, 175, 0.8), transparent 24rem),
    radial-gradient(circle at 88% 88%, rgba(116, 37, 131, 0.82), transparent 30rem),
    linear-gradient(145deg, #ffbd36, var(--orange) 52%, var(--purple));
}

[hidden] {
  display: none !important;
}

.page-shell {
  width: 100%;
  max-width: 430px;
  min-height: 100vh;
  margin-inline: auto;
  overflow: hidden;
  background: var(--cream);
  box-shadow: 0 24px 65px rgba(75, 20, 47, 0.34);
}

.hero {
  position: relative;
  isolation: isolate;
  min-height: 310px;
  padding: clamp(2rem, 8vw, 3rem) 1.25rem 4.25rem;
  overflow: hidden;
  text-align: center;
  background:
    linear-gradient(180deg, rgba(111, 45, 8, 0.2), rgba(255, 224, 140, 0.12) 48%, rgba(71, 24, 10, 0.48)),
    url("./assets/india-independence-2026-hero.webp") center / cover no-repeat,
    linear-gradient(145deg, #ffbd36, #f27a2e 58%, #7c2d68);
  background-size: cover;
}

.hero > * {
  width: min(100%, 31rem);
  margin-inline: auto;
}

.eyebrow,
.campaign-tagline,
.period,
.hero h1 {
  position: relative;
  margin: 0 auto;
}

.eyebrow {
  color: #6b2511;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-shadow: 0 1px 5px rgba(255, 247, 212, 0.9);
}

.hero h1 {
  margin-top: 0.4rem;
  color: #351958;
  font-size: clamp(1.9rem, 9.5vw, 3.4rem);
  font-weight: 950;
  line-height: 0.98;
  letter-spacing: -0.035em;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.82), 0 5px 12px rgba(84, 35, 12, 0.24);
}

.hero h1 span {
  display: block;
}

.hero h1 span:last-child {
  margin-top: 0.16em;
  font-size: 0.62em;
  letter-spacing: 0.035em;
}

.campaign-tagline {
  margin-top: 0.65rem;
  color: #562012;
  font-size: clamp(0.75rem, 2.8vw, 0.9rem);
  font-weight: 850;
  text-shadow: 0 1px 5px rgba(255, 248, 219, 0.95);
}

.period {
  margin-top: 0.75rem;
  color: #53240f;
  font-size: 0.78rem;
  font-weight: 750;
  text-shadow: 0 1px 5px rgba(255, 248, 219, 0.95);
}

.period > span {
  display: block;
}

.week-date-range {
  margin-top: 0.2rem;
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.prize-summary {
  position: relative;
  z-index: 4;
  width: calc(100% - 1.5rem);
  max-width: 700px;
  margin: -1.5rem auto 1rem;
  overflow: hidden;
  background: rgba(255, 253, 247, 0.98);
  border: 1px solid rgba(225, 170, 82, 0.72);
  border-radius: 1.05rem;
  box-shadow: 0 14px 34px rgba(92, 43, 25, 0.2);
}

.prize-summary__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem;
}

.prize-summary__top > div {
  min-width: 0;
}

.prize-summary__label,
.prize-summary__top strong {
  display: block;
}

.prize-summary__label {
  color: #8b4d28;
  font-size: 0.6rem;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.prize-summary__top strong {
  margin-top: 0.18rem;
  color: #4c1c70;
  font-size: clamp(1.35rem, 6vw, 2rem);
  line-height: 1;
}

.prize-summary button {
  flex: none;
  min-height: 2.45rem;
  padding: 0.6rem 0.8rem;
  color: #fff;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 850;
  cursor: pointer;
  background: linear-gradient(135deg, #8b2d73, #4c1c70);
  border: 0;
  border-radius: 999px;
  box-shadow: 0 5px 12px rgba(76, 28, 112, 0.24);
}

.prize-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 0.7rem 0.35rem;
  color: #6d3a24;
  font-size: clamp(0.58rem, 2.5vw, 0.7rem);
  font-weight: 750;
  line-height: 1.25;
  text-align: center;
  background: #fff2db;
  border-top: 1px solid #f0d4ad;
}

.prize-facts span {
  display: grid;
  min-width: 0;
  padding-inline: 0.35rem;
  place-items: center;
}

.prize-facts span + span {
  border-left: 1px solid #e6bd88;
}

.state-panel {
  position: relative;
  z-index: 2;
  width: calc(100% - 1.5rem);
  min-height: 9.5rem;
  margin: 0 auto 1.25rem;
  padding: 1.25rem;
  overflow: hidden;
  color: #63331e;
  font-size: 0.875rem;
  font-weight: 700;
  text-align: center;
  background: rgba(255, 252, 245, 0.96);
  border: 1px solid var(--card-border);
  border-radius: 1.1rem;
  box-shadow: 0 12px 30px rgba(105, 61, 37, 0.14);
}

#loading-state::before {
  display: block;
  width: 100%;
  height: 5.75rem;
  margin-bottom: 0.85rem;
  border-radius: 0.8rem;
  content: "";
  background:
    linear-gradient(#ead9c4 0 0) 0.15rem 0.15rem / 32% 0.75rem no-repeat,
    linear-gradient(#f1e5d5 0 0) 0.15rem 1.9rem / 100% 0.72rem no-repeat,
    linear-gradient(#f1e5d5 0 0) 0.15rem 3.35rem / 84% 0.72rem no-repeat,
    linear-gradient(#f1e5d5 0 0) 0.15rem 4.8rem / 91% 0.72rem no-repeat;
}

#loading-state::after {
  position: absolute;
  inset: 0;
  content: "";
  transform: translateX(-110%);
  background: linear-gradient(105deg, transparent 32%, rgba(255, 255, 255, 0.7) 48%, transparent 64%);
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

.state-panel--error {
  color: #7d2418;
  background: #fff3e9;
  border-color: #e7a284;
}

#leaderboard {
  position: relative;
  z-index: 2;
  margin-top: 0;
}

.podium {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr) minmax(0, 0.92fr);
  align-items: end;
  gap: clamp(0.25rem, 2vw, 0.65rem);
  min-height: 12.8rem;
  padding-inline: clamp(0.65rem, 3vw, 1rem);
}

.podium-place {
  min-width: 0;
  text-align: center;
}

.podium-place--second,
.podium-place[data-rank="2"] {
  order: 1;
  --medal: var(--silver);
  --medal-dark: #74808d;
  --portrait: #f8fbff;
  --base-top: #e8edf2;
  --base-bottom: #b9c5d1;
  --base-height: 3rem;
}

.podium-place--first,
.podium-place[data-rank="1"] {
  order: 2;
  --medal: var(--gold);
  --medal-dark: #8b4908;
  --portrait: #fff6ad;
  --base-top: #ffd95d;
  --base-bottom: #ed9b13;
  --base-height: 4.35rem;
}

.podium-place--first:only-child {
  grid-column: 2;
}

.podium-place--third,
.podium-place[data-rank="3"] {
  order: 3;
  --medal: var(--bronze);
  --medal-dark: #77391f;
  --portrait: #fff1e5;
  --base-top: #e1a275;
  --base-bottom: #b8653f;
  --base-height: 2.45rem;
}

.podium-crown {
  min-height: 1.6rem;
  color: #9a5300;
  font-size: 1.85rem;
  line-height: 0.85;
  filter: drop-shadow(0 3px 4px rgba(116, 57, 4, 0.28));
}

.podium-place:not(.podium-place--first):not([data-rank="1"]) .podium-crown {
  visibility: hidden;
}

.podium-portrait {
  position: relative;
  display: grid;
  width: clamp(3.6rem, 17vw, 4.25rem);
  aspect-ratio: 1;
  margin-inline: auto;
  place-items: center;
  color: var(--medal-dark);
  font-size: 1.2rem;
  font-weight: 950;
  background: var(--portrait);
  border: 0.28rem solid var(--medal);
  border-radius: 50%;
  box-shadow: 0 8px 18px rgba(77, 39, 28, 0.24);
}

.podium-place--first .podium-portrait,
.podium-place[data-rank="1"] .podium-portrait {
  width: clamp(4.65rem, 21vw, 5.5rem);
  box-shadow: 0 0 0 0.32rem rgba(255, 213, 72, 0.27), 0 12px 26px rgba(141, 69, 7, 0.34);
}

.podium-medal {
  position: absolute;
  right: -0.35rem;
  bottom: -0.28rem;
  display: grid;
  width: 1.55rem;
  height: 1.55rem;
  place-items: center;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 950;
  background: var(--medal);
  border: 2px solid #fff;
  border-radius: 50%;
}

.podium-place--first .podium-medal,
.podium-place[data-rank="1"] .podium-medal {
  color: #704007;
  border-color: #fff6c7;
}

.podium-uid {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.podium-uid {
  margin: 0.55rem 0 0;
  font-size: clamp(0.68rem, 2.8vw, 0.78rem);
  font-weight: 850;
}

.podium-amount {
  margin: 0.12rem 0 0;
  overflow: visible;
  color: #a93b16;
  font-size: clamp(0.68rem, 2.8vw, 0.78rem);
  font-weight: 900;
  text-overflow: clip;
  white-space: nowrap;
}

.podium-base {
  display: grid;
  height: var(--base-height);
  margin-top: 0.55rem;
  place-items: center;
  color: var(--medal-dark);
  font-size: clamp(1.2rem, 6vw, 1.75rem);
  font-weight: 950;
  background: linear-gradient(var(--base-top), var(--base-bottom));
  border-radius: 0.85rem 0.85rem 0 0;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.62);
}

.ranking-card {
  max-height: min(58vh, 36rem);
  margin: 0 clamp(0.65rem, 3vw, 1rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: 1rem;
  box-shadow: 0 8px 25px rgba(105, 61, 37, 0.09);
  scrollbar-color: #d8a771 #fff8ed;
  scrollbar-width: thin;
}

.ranking-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0.85rem 0.75rem;
  background: #fffdf9;
}

.ranking-heading > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 0.2rem;
}

.ranking-heading strong {
  color: #5a1834;
  font-size: 0.95rem;
}

.ranking-heading span {
  color: var(--muted-text);
  font-size: 0.69rem;
  font-weight: 650;
  white-space: nowrap;
}

#ranking-week-date-range {
  min-height: 1em;
}

.ranking-columns,
.ranking-list > li {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) minmax(110px, auto);
  align-items: center;
  column-gap: 0.5rem;
}

.ranking-columns {
  position: sticky;
  z-index: 3;
  top: 0;
  padding: 0.65rem 0.85rem;
  color: #76513f;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: #fff1d6;
  box-shadow: 0 1px 0 #ead7bf;
}

.ranking-columns > :last-child,
.ranking-list > li > :last-child {
  text-align: right;
}

.ranking-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.ranking-list > li {
  min-height: 3rem;
  padding: 0.7rem 0.85rem;
  color: #3c283e;
  font-size: 0.78rem;
  border-top: 1px dashed #e6d2bd;
}

.ranking-list > li:first-child {
  border-top: 0;
}

.ranking-list > li:nth-child(even) {
  background: #fffcf7;
}

.ranking-rank {
  font-weight: 850;
}

.ranking-player {
  display: flex;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  flex-direction: row;
  align-items: center;
  gap: 0.25rem;
}

.ranking-uid {
  display: block;
  min-width: 0;
  flex: 0 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ranking-amount {
  display: block;
  width: auto;
  min-width: 0;
  flex: 0 0 auto;
  color: #a93b16;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ranking-reward {
  display: flex;
  min-width: 0;
  max-width: 100%;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.08rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.ranking-reward > span {
  display: block;
  max-width: 100%;
}

.ranking-prize,
.ranking-no-prize,
.ranking-total {
  font-weight: 850;
}

.ranking-lucky-bonus,
.ranking-total {
  font-size: 0.68rem;
}

#prize-dialog {
  position: fixed;
  inset: auto 0 0;
  width: 100%;
  max-width: 430px;
  max-height: min(82vh, 48rem);
  max-height: min(82dvh, 48rem);
  margin: 0 auto;
  padding: 0;
  overflow: hidden;
  color: var(--text);
  background: #fffaf0;
  border: 1px solid #e8c89d;
  border-bottom: 0;
  border-radius: 1.4rem 1.4rem 0 0;
  box-shadow: 0 -18px 55px rgba(48, 18, 46, 0.32);
  opacity: 0;
  transform: translateY(1rem);
  transition: opacity 180ms ease, transform 180ms ease;
}

#prize-dialog[open] {
  opacity: 1;
  transform: translateY(0);
}

#prize-dialog::backdrop {
  background: rgba(61, 26, 51, 0.68);
  backdrop-filter: blur(2px);
  transition: background-color 180ms ease;
}

.prize-dialog__sheet {
  display: flex;
  max-height: min(82vh, 48rem);
  max-height: min(82dvh, 48rem);
  flex-direction: column;
}

.prize-dialog__sheet > header {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1rem 0.85rem;
  color: #fff;
  background: linear-gradient(135deg, #8b2d73, #4c1c70);
}

.prize-dialog__sheet > header span {
  display: block;
  color: #ffd998;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.prize-dialog__sheet h2 {
  margin: 0.15rem 0 0;
  font-size: 1.25rem;
}

#close-prize-dialog {
  display: grid;
  width: 2.5rem;
  height: 2.5rem;
  flex: none;
  padding: 0;
  place-items: center;
  color: #fff;
  font: inherit;
  font-size: 1.65rem;
  line-height: 1;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.13);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
}

.prize-dialog__content {
  min-height: 0;
  padding: 1rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: #cf9f6f #fff8ed;
  scrollbar-width: thin;
}

.prize-dialog__content h3 {
  margin: 0 0 0.6rem;
  color: #5a1834;
  font-size: 0.9rem;
}

.prize-dialog__content h3:not(:first-child) {
  margin-top: 1.2rem;
}

.prize-table__heading,
.prize-tier-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(110px, auto);
  align-items: center;
  gap: 0.75rem;
}

.prize-table__heading {
  padding: 0.6rem 0.75rem;
  color: #76513f;
  font-size: 0.65rem;
  font-weight: 850;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: #fff1d6;
  border-radius: 0.65rem 0.65rem 0 0;
}

.prize-table__heading > :last-child,
.prize-tier-row > :last-child {
  text-align: right;
}

.prize-tier-list,
.lucky-rank-list {
  overflow: hidden;
  background: #fff;
  border: 1px solid #ead7bf;
  border-radius: 0 0 0.65rem 0.65rem;
}

.lucky-rank-list {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.75rem;
  flex-wrap: wrap;
  border-radius: 0.65rem;
}

.prize-tier-row {
  min-height: 2.65rem;
  padding: 0.55rem 0.75rem;
  font-size: 0.76rem;
  border-top: 1px dashed #e6d2bd;
}

.prize-tier-row:first-child {
  border-top: 0;
}

.lucky-rank-chip {
  display: inline-grid;
  min-width: 2.25rem;
  min-height: 2.25rem;
  padding: 0.35rem;
  place-items: center;
  color: #5a1834;
  font-size: 0.72rem;
  font-weight: 850;
  background: #fff1d6;
  border: 1px solid #ebca9c;
  border-radius: 999px;
}

.lucky-rank-value {
  margin-left: auto;
  color: #8b2d73;
  font-size: 0.76rem;
}

.prize-dialog__content > p {
  margin: 0.9rem 0 0;
  color: var(--muted-text);
  font-size: 0.7rem;
  line-height: 1.5;
}

footer {
  padding: 0.9rem 1.25rem 1.35rem;
  color: #76513f;
  font-size: 0.69rem;
  font-weight: 550;
  line-height: 1.5;
  text-align: center;
}

a,
button,
[tabindex] {
  border-radius: 0.25rem;
}

:focus-visible {
  outline: 3px solid #4c1c70;
  outline-offset: 3px;
}

@keyframes skeleton-shimmer {
  to {
    transform: translateX(110%);
  }
}

@media (min-width: 768px) {
  body {
    padding: 2rem;
  }

  .page-shell {
    max-width: 760px;
    min-height: calc(100vh - 4rem);
    border-radius: 1.9rem;
  }

  .hero {
    min-height: 360px;
    padding-top: 3.5rem;
  }

  .prize-summary {
    width: calc(100% - 3rem);
  }

  .podium {
    max-width: 590px;
    min-height: 14.5rem;
    margin-inline: auto;
  }

  .ranking-card {
    margin-inline: 1.5rem;
  }

  #prize-dialog {
    inset: 0;
    width: min(calc(100% - 3rem), 620px);
    max-width: 620px;
    max-height: min(80vh, 48rem);
    margin: auto;
    border-bottom: 1px solid #e8c89d;
    border-radius: 1.4rem;
    box-shadow: 0 24px 75px rgba(48, 18, 46, 0.38);
    transform: translateY(0.75rem) scale(0.985);
  }

  #prize-dialog[open] {
    transform: translateY(0) scale(1);
  }

  .prize-dialog__sheet {
    max-height: min(80vh, 48rem);
  }
}

@media (max-width: 359px) {
  .ranking-card {
    margin-inline: 0.5rem;
  }

  .ranking-columns,
  .ranking-list > li {
    grid-template-columns: 44px minmax(0, 1fr) minmax(96px, auto);
    column-gap: 0.25rem;
    padding-inline: 0.65rem;
  }

  .ranking-heading {
    padding-inline: 0.65rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition: none !important;
  }

  #loading-state::after {
    display: none;
  }
}
