:root {
  --bg1: #07111f;
  --bg2: #0f172a;
  --card: rgba(23,32,51,0.96);
  --muted: #94a3b8;
  --white: #f8fafc;
  --green: #22c55e;
  --blue: #38bdf8;
  --gold: #facc15;
  --silver: #cbd5e1;
  --bronze: #fb923c;
  --pink: #f472b6;
  --line: rgba(255,255,255,0.07);
  --soft: rgba(255,255,255,0.035);
  --up: #22c55e;
  --down: #f97316;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  color: var(--white);
  padding: 14px 14px 10px;
  overflow: hidden;
}

body.theme-mb {
  background:
    radial-gradient(circle at top right, rgba(56,189,248,0.16), transparent 28%),
    radial-gradient(circle at bottom left, rgba(34,197,94,0.15), transparent 24%),
    linear-gradient(180deg, var(--bg1), var(--bg2));
}

body.theme-seller {
  background:
    radial-gradient(circle at top left, rgba(34,197,94,0.12), transparent 25%),
    linear-gradient(180deg, var(--bg1), var(--bg2));
}

body.theme-tb {
  background:
    radial-gradient(circle at top left, rgba(250,204,21,0.14), transparent 22%),
    radial-gradient(circle at top right, rgba(244,114,182,0.10), transparent 22%),
    linear-gradient(180deg, var(--bg1), var(--bg2));
}

body.theme-overview {
  background:
    radial-gradient(circle at top left, rgba(56,189,248,0.12), transparent 30%),
    radial-gradient(circle at top right, rgba(34,197,94,0.14), transparent 28%),
    linear-gradient(180deg, var(--bg1), var(--bg2));
}

.page-header {
  display: grid;
  gap: 4px;
  margin-bottom: 6px;
}

.page-title {
  margin: 0;
  font-size: 34px;
  letter-spacing: 0.3px;
  font-weight: 900;
}

.page-updated {
  color: var(--muted);
  font-size: 14px;
}

.page-main {
  height: calc(100vh - 98px);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 10px;
}

.top-zone {
  display: grid;
  justify-items: center;
  align-items: start;
  min-height: 0;
}

.top-podium {
  position: relative;
  display: grid;
  grid-template-columns: 0.92fr 1.22fr 0.86fr;
  grid-template-areas: "second first third";
  gap: 12px;
  min-height: 345px;
  align-items: start;
  overflow: visible;
  margin-top: -12px;
  z-index: 3;
  width: min(1050px, 100%);
}

.top-podium::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -26px;
  width: 380px;
  height: 380px;
  transform: translateX(-50%);
  background:
    conic-gradient(
      from 0deg,
      rgba(250,204,21,0.00) 0deg,
      rgba(250,204,21,0.18) 18deg,
      rgba(250,204,21,0.00) 36deg,
      rgba(250,204,21,0.16) 54deg,
      rgba(250,204,21,0.00) 72deg,
      rgba(250,204,21,0.18) 90deg,
      rgba(250,204,21,0.00) 108deg,
      rgba(250,204,21,0.14) 126deg,
      rgba(250,204,21,0.00) 144deg,
      rgba(250,204,21,0.18) 162deg,
      rgba(250,204,21,0.00) 180deg,
      rgba(250,204,21,0.18) 198deg,
      rgba(250,204,21,0.00) 216deg,
      rgba(250,204,21,0.14) 234deg,
      rgba(250,204,21,0.00) 252deg,
      rgba(250,204,21,0.18) 270deg,
      rgba(250,204,21,0.00) 288deg,
      rgba(250,204,21,0.16) 306deg,
      rgba(250,204,21,0.00) 324deg,
      rgba(250,204,21,0.18) 342deg,
      rgba(250,204,21,0.00) 360deg
    );
  filter: blur(10px);
  opacity: 0.95;
  pointer-events: none;
  z-index: 0;
}

.podium-card {
  position: relative;
  z-index: 1;
  border-radius: 20px;
  padding: 20px 18px 18px;
  border: 1px solid var(--line);
  box-shadow: 0 12px 30px rgba(0,0,0,0.22);
  overflow: hidden;
  animation: podiumFloat 4.2s ease-in-out infinite;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-self: start;
}

.podium-card:nth-child(1) {
  grid-area: first;
  min-height: 345px;
  margin-top: 0;
  animation-delay: 0s;
}

.podium-card:nth-child(2) {
  grid-area: second;
  min-height: 255px;
  margin-top: 70px;
  animation-delay: .2s;
}

.podium-card:nth-child(3) {
  grid-area: third;
  min-height: 210px;
  margin-top: 118px;
  animation-delay: .45s;
}

.podium-card.glow-1 {
  box-shadow:
    0 0 0 1px rgba(250,204,21,0.28),
    0 0 44px rgba(250,204,21,0.22),
    0 12px 30px rgba(0,0,0,0.22);
}

.podium-card.glow-2 {
  box-shadow:
    0 0 0 1px rgba(203,213,225,0.20),
    0 0 28px rgba(203,213,225,0.14),
    0 12px 30px rgba(0,0,0,0.22);
}

.podium-card.glow-3 {
  box-shadow:
    0 0 0 1px rgba(251,146,60,0.20),
    0 0 24px rgba(251,146,60,0.13),
    0 12px 30px rgba(0,0,0,0.22);
}

.podium-card::before {
  content: "";
  position: absolute;
  inset: auto -20px -35px auto;
  width: 150px;
  height: 150px;
  border-radius: 999px;
  filter: blur(24px);
  opacity: .22;
}

.podium-1 {
  background: linear-gradient(135deg, rgba(250,204,21,0.22), rgba(56,189,248,0.16), rgba(23,32,51,0.98));
}
.podium-1::before {
  background: var(--gold);
}

.podium-2 {
  background: linear-gradient(135deg, rgba(203,213,225,0.18), rgba(56,189,248,0.14), rgba(23,32,51,0.98));
}
.podium-2::before {
  background: var(--silver);
}

.podium-3 {
  background: linear-gradient(135deg, rgba(251,146,60,0.20), rgba(34,197,94,0.12), rgba(23,32,51,0.98));
}
.podium-3::before {
  background: var(--bronze);
}

.podium-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  font-weight: 900;
  color: #08111d;
  box-shadow: 0 8px 18px rgba(0,0,0,0.18);
}

.podium-1 .podium-badge {
  background: var(--gold);
}

.podium-2 .podium-badge {
  background: var(--silver);
}

.podium-3 .podium-badge {
  background: var(--bronze);
}

.podium-kicker {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  font-weight: 800;
  margin-bottom: 6px;
}

.podium-name {
  font-size: 30px;
  font-weight: 900;
  line-height: 1.02;
  margin-bottom: 12px;
  max-width: 82%;
}

.podium-card:nth-child(1) .podium-name {
  font-size: 42px;
}

.podium-card:nth-child(2) .podium-name {
  font-size: 31px;
}

.podium-card:nth-child(3) .podium-name {
  font-size: 26px;
}

.podium-stats {
  font-size: 22px;
  line-height: 1.35;
  color: #e8f2ff;
  font-weight: 800;
}

.podium-stats strong {
  color: #fff;
  font-weight: 900;
}

.lane {
  position: relative;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  border-radius: 18px;
}

.track {
  display: grid;
  gap: 12px;
  align-content: start;
  will-change: transform;
}

.track.scrolling {
  animation-name: boardLoopScroll;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  animation-duration: var(--scroll-duration, 26s);
}

.track.scrolling::after {
  content: "";
  display: block;
  height: 1px;
}

.rank-card {
  position: relative;
  background: var(--card);
  border-radius: 16px;
  padding: 18px 18px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  border: 1px solid var(--line);
  box-shadow: 0 10px 24px rgba(0,0,0,0.18);
  min-height: 0;
}

.rank-card.up {
  animation: rise .7s ease;
  border-color: rgba(34,197,94,0.55);
  box-shadow:
    0 0 0 1px rgba(34,197,94,0.18),
    0 12px 28px rgba(0,0,0,0.24);
}

.rank-card.down {
  animation: sink .7s ease;
  border-color: rgba(249,115,22,0.55);
  box-shadow:
    0 0 0 1px rgba(249,115,22,0.18),
    0 12px 28px rgba(0,0,0,0.24);
}

.move-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 11px;
  font-weight: 900;
  padding: 6px 8px;
  border-radius: 999px;
  line-height: 1;
}

.move-badge.up {
  background: rgba(34,197,94,0.18);
  color: #bbf7d0;
}

.move-badge.down {
  background: rgba(249,115,22,0.18);
  color: #fdba74;
}

.rank-card-left {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  min-width: 0;
}

.rank-circle {
  width: 58px;
  height: 58px;
  border-radius: 999px;
  color: #04110a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 900;
  flex-shrink: 0;
  margin-top: 2px;
}

.theme-mb .rank-circle {
  background: linear-gradient(135deg, var(--blue), var(--green));
}

.theme-seller .rank-circle {
  background: linear-gradient(135deg, var(--green), var(--blue));
}

.theme-tb .rank-circle {
  background: linear-gradient(135deg, var(--gold), var(--pink));
  color: #1f1400;
}

.rank-name {
  font-size: 31px;
  font-weight: 900;
  line-height: 1.02;
  margin-bottom: 10px;
}

.rank-meta {
  color: #e4edf8;
  font-size: 20px;
  line-height: 1.42;
  font-weight: 800;
}

.rank-meta strong {
  color: #ffffff;
  font-weight: 900;
}

.rank-score {
  min-width: 170px;
  display: grid;
  gap: 8px;
  align-content: center;
}

.rank-score-box {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  text-align: right;
}

.rank-score-label {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  margin-bottom: 4px;
  font-weight: 800;
}

.rank-score-value {
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
  color: #fff;
}

.theme-tb .rank-score-value {
  color: #fde68a;
}

.empty-card {
  background: var(--card);
  border-radius: 16px;
  padding: 24px;
  border: 1px solid var(--line);
  font-size: 18px;
  font-weight: 800;
  color: var(--muted);
}

.page-footer {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: end;
  gap: 12px;
  min-height: 42px;
}

.footer-nav {
  display: flex;
  gap: 8px;
  align-items: center;
  opacity: .35;
}

.footer-nav a {
  color: #cbd5e1;
  text-decoration: none;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .4px;
}

.footer-nav a.active {
  color: #fff;
  opacity: .95;
}

.footer-motto {
  justify-self: center;
  text-align: center;
  color: #dbeafe;
  font-size: 13px;
  font-weight: 700;
  opacity: .78;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@keyframes pulseTitle {
  0% { transform: scale(1); }
  50% { transform: scale(1.014); }
  100% { transform: scale(1); }
}

@keyframes podiumFloat {
  0% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
  100% { transform: translateY(0); }
}

@keyframes rise {
  0% { transform: translateY(16px) scale(.985); }
  100% { transform: translateY(0) scale(1); }
}

@keyframes sink {
  0% { transform: translateY(-16px) scale(.985); }
  100% { transform: translateY(0) scale(1); }
}

@keyframes boardLoopScroll {
  0% {
    transform: translateY(0);
  }
  92% {
    transform: translateY(calc(-1 * var(--scroll-distance, 0px)));
  }
  96% {
    transform: translateY(calc(-1 * (var(--scroll-distance, 0px) + 10px)));
  }
  100% {
    transform: translateY(0);
  }
}

@media (max-width: 1450px) {
  .top-podium {
    width: 100%;
    margin-top: 0;
  }
}

@media (max-width: 1200px) {
  .rank-name {
    font-size: 26px;
  }

  .rank-meta {
    font-size: 17px;
  }

  .rank-score-value {
    font-size: 22px;
  }

  .footer-motto {
    font-size: 12px;
  }
}