:root {
  --bg: #0f1115;
  --fg: #e8e8e8;
  --muted: #9aa0a6;
  --accent: #5eead4;
  --card: #171a21;
  --gold: #f6c945;
  --silver: #c0c0c0;
  --bronze: #cd7f32;
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: linear-gradient(180deg, #0b0d12, #0f1115);
  color: var(--fg);
  /* Background image layer */
  background-image:
    linear-gradient(rgba(10,11,15,0.80), rgba(10,11,15,0.90)),
    url('/images/bg.jpg');
  background-size: cover; /* scale to cover viewport */
  background-position: center center;
  background-attachment: fixed; /* subtle parallax */
  position: relative;
  overflow-x: hidden;
}

body.board-2 {
  background-image:
    linear-gradient(rgba(10,11,15,0.80), rgba(10,11,15,0.90)),
    url('/images/bsite%20backround.jpg');
}

/* Animated sparkle particles */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image:
    radial-gradient(2px 2px at 20% 30%, white, transparent),
    radial-gradient(2px 2px at 60% 70%, white, transparent),
    radial-gradient(1px 1px at 50% 50%, white, transparent),
    radial-gradient(1px 1px at 80% 10%, white, transparent),
    radial-gradient(2px 2px at 90% 60%, white, transparent),
    radial-gradient(1px 1px at 33% 80%, white, transparent),
    radial-gradient(1px 1px at 15% 60%, white, transparent);
  background-size: 200% 200%;
  background-position: 0% 0%;
  animation: sparkle 8s ease-in-out infinite;
  pointer-events: none;
  opacity: 0.4;
  z-index: 1;
}

@keyframes sparkle {
  0%, 100% {
    background-position: 0% 0%;
    opacity: 0.3;
  }
  50% {
    background-position: 100% 100%;
    opacity: 0.6;
  }
}

header.site-header, main.layout, footer {
  position: relative;
  z-index: 2;
}

/* Floating background items */
.bg-float {
  position: fixed;
  inset: 0;
  z-index: 1; /* below content, above base bg */
  pointer-events: none;
  overflow: hidden;
}
.bg-float img {
  position: absolute;
  width: 140px;
  height: auto;
  /* Depth + soft glow */
  filter: drop-shadow(0 10px 18px rgba(0,0,0,0.35)) drop-shadow(0 0 12px rgba(255,200,80,0.18)) brightness(0.98);
  opacity: 0.25;
  animation: drift 28s linear infinite, glowPulse 6s ease-in-out infinite;
}
.bg-float img.f1 { top: 10%; left: 6%; animation-duration: 32s; animation-delay: -4s; }
.bg-float img.f2 { top: 60%; left: 12%; animation-duration: 30s; animation-delay: -10s; }
.bg-float img.f3 { top: 25%; right: 8%; animation-duration: 34s; animation-delay: -16s; }
.bg-float img.f4 { bottom: 8%; right: 14%; animation-duration: 36s; animation-delay: -22s; }

body.board-2 .bg-float img {
  animation: driftFree 20s ease-in-out infinite, glowPulse 5s ease-in-out infinite;
}

body.board-2 .bg-float img.f1 { animation-duration: 19s, 5s; animation-delay: -3s, -1s; }
body.board-2 .bg-float img.f2 { animation-duration: 23s, 6s; animation-delay: -11s, -2s; }
body.board-2 .bg-float img.f3 { animation-duration: 21s, 5.5s; animation-delay: -7s, -3s; }
body.board-2 .bg-float img.f4 { animation-duration: 25s, 6.5s; animation-delay: -15s, -4s; }

@keyframes drift {
  0% { transform: translate3d(0,0,0) rotate(0deg) scale(1); opacity: 0.18; }
  25% { transform: translate3d(60px,-40px,0) rotate(6deg) scale(1.06); opacity: 0.24; }
  50% { transform: translate3d(0,-80px,0) rotate(0deg) scale(1.02); opacity: 0.20; }
  75% { transform: translate3d(-60px,-40px,0) rotate(-6deg) scale(1.06); opacity: 0.24; }
  100% { transform: translate3d(0,0,0) rotate(0deg) scale(1); opacity: 0.18; }
}

@keyframes driftFree {
  0% { transform: translate3d(0, 0, 0) rotate(0deg) scale(1); opacity: 0.14; }
  16% { transform: translate3d(90px, -60px, 0) rotate(8deg) scale(1.08); opacity: 0.24; }
  32% { transform: translate3d(25px, -140px, 0) rotate(16deg) scale(1.03); opacity: 0.20; }
  48% { transform: translate3d(-120px, -90px, 0) rotate(4deg) scale(1.10); opacity: 0.25; }
  64% { transform: translate3d(-70px, 30px, 0) rotate(-10deg) scale(1.04); opacity: 0.19; }
  82% { transform: translate3d(110px, 45px, 0) rotate(-18deg) scale(1.09); opacity: 0.23; }
  100% { transform: translate3d(0, 0, 0) rotate(0deg) scale(1); opacity: 0.14; }
}

@keyframes glowPulse {
  0%, 100% { filter: drop-shadow(0 10px 18px rgba(0,0,0,0.35)) drop-shadow(0 0 10px rgba(255,200,80,0.14)) brightness(0.98); }
  50% { filter: drop-shadow(0 12px 22px rgba(0,0,0,0.4)) drop-shadow(0 0 16px rgba(255,220,120,0.24)) brightness(1.02); }
}
header.site-header { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 16px 24px; }
.brand { display:flex; align-items:center; gap:10px; }
.brand { justify-self: start; }
.logo-row { display: inline-flex; align-items: center; color: inherit; }
.logo-img { width: 36px; height: 36px; margin-right: 10px; vertical-align: middle; }
.subtitle { color: var(--muted); margin: 4px 0 0; }
.discord-btn { justify-self: end; background: #5865f2; color: white; padding: 10px 14px; border-radius: 10px; text-decoration: none; font-weight: 700; border: 1px solid #4049b6; }
.discord-btn:hover { background: #4752c4; }

.nav.board-switch {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 20px;
}

.board-logo-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 260px;
  min-height: 95px;
  padding: 8px 18px;
  border: none;
  background: transparent;
  border-radius: 999px;
  overflow: hidden;
  clip-path: ellipse(50% 50% at 50% 50%);
  text-decoration: none;
  transition: transform 0.2s ease;
}

.board-logo-link:hover {
  transform: translateY(-2px);
}

.board-logo-link.active {
  transform: translateY(-1px);
}

.board-logo {
  max-height: 92px;
  max-width: 330px;
  width: auto;
  height: auto;
  display: block;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.board-logo-link:hover .board-logo {
  transform: scale(1.03);
  filter: drop-shadow(0 6px 14px rgba(0,0,0,0.35));
}

.board-logo-link.active .board-logo {
  filter: drop-shadow(0 0 0 rgba(0,0,0,0.0)) drop-shadow(0 0 14px rgba(242,201,76,0.35));
}

#board2-link .board-logo {
  -webkit-mask-image: radial-gradient(ellipse 98% 94% at center, rgba(0,0,0,1) 16%, rgba(0,0,0,0.92) 26%, rgba(0,0,0,0.78) 38%, rgba(0,0,0,0.58) 52%, rgba(0,0,0,0.36) 66%, rgba(0,0,0,0.18) 80%, rgba(0,0,0,0.08) 90%, rgba(0,0,0,0) 100%);
  mask-image: radial-gradient(ellipse 98% 94% at center, rgba(0,0,0,1) 16%, rgba(0,0,0,0.92) 26%, rgba(0,0,0,0.78) 38%, rgba(0,0,0,0.58) 52%, rgba(0,0,0,0.36) 66%, rgba(0,0,0,0.18) 80%, rgba(0,0,0,0.08) 90%, rgba(0,0,0,0) 100%);
}

.board-logo-fallback {
  color: #f2c94c;
  font-weight: 900;
  letter-spacing: 1px;
  font-size: 18px;
}

.layout { display: grid; grid-template-rows: auto auto 1fr; min-height: 100vh; }
.tagline { display:flex; align-items:center; justify-content:center; gap:12px; margin: 28px 0; font-size: 22px; }
.tagline a { color:#5ea0ff; font-weight:800; text-decoration:none; }
.gear-blob { display:inline-block; padding: 14px; border-radius: 50%; background: radial-gradient(ellipse at center, rgba(27,68,255,0.7), rgba(27,68,255,0) 60%); filter: drop-shadow(0 0 16px rgba(27,68,255,0.6)); }
.scrap-icon { width: 40px; height: 40px; display:block; }
.countdown { text-align: center; padding: 16px 0 28px; color: var(--fg); }
.countdown h2 { margin: 0; font-weight: 800; letter-spacing: 0.5px; }
.countdown .new { color: #5ea0ff; }
.timer { display: inline-grid; grid-auto-flow: column; gap: 16px; align-items: end; margin: 12px 0 0; }
.timer div { text-align: center; }
.timer span { font-size: 28px; font-weight: 800; }
.timer small { display: block; color: var(--muted); text-transform: uppercase; font-size: 10px; margin-top: 2px; }
.timer .sep { font-size: 24px; color: var(--muted); align-self: center; }

/* Period Navigation Buttons - At Top */
.period-nav {
  text-align: center;
  padding: 16px 0;
  position: relative;
  z-index: 100;
}

.prev-period-btn,
.current-period-btn {
  padding: 8px 20px;
  font-size: 15px;
  font-weight: 800;
  border: 1.5px solid #f6c945;
  background: linear-gradient(135deg, rgba(246, 201, 69, 0.2), rgba(255, 215, 0, 0.15));
  color: #ffd700;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
  box-shadow: 0 4px 20px rgba(246, 201, 69, 0.4), 0 0 30px rgba(255, 215, 0, 0.2);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.prev-period-btn:hover,
.current-period-btn:hover {
  background: linear-gradient(135deg, rgba(246, 201, 69, 0.3), rgba(255, 215, 0, 0.25));
  box-shadow: 0 6px 25px rgba(246, 201, 69, 0.6), 0 0 40px rgba(255, 215, 0, 0.4);
  transform: translateY(-3px);
  border-color: #ffed4e;
  color: #ffed4e;
}

.prev-period-btn:active,
.current-period-btn:active {
  transform: translateY(-1px);
  box-shadow: 0 3px 15px rgba(246, 201, 69, 0.5), 0 0 25px rgba(255, 215, 0, 0.3);
}

.podium {
  display: grid;
  grid-template-columns: repeat(3, minmax(240px, 1fr));
  gap: 22px; max-width: 1200px; margin: 0 auto; padding: 20px 28px;
  align-items: end;
}

/* Second place - left side, smaller */
.podium-style .card:nth-child(1) { 
  background: linear-gradient(180deg, #3a3e45, #0e0f12); 
  border: 2px solid rgba(192,192,192,0.4); 
  box-shadow: 0 0 0 2px rgba(192,192,192,0.1) inset, 0 8px 40px rgba(192,192,192,0.3);
  transform: scale(0.95);
}

/* First place - center, bigger */
.podium-style .card:nth-child(2) { 
  background: linear-gradient(180deg, #4a4020, #1a1508); 
  border: 3px solid rgba(255,215,0,0.6); 
  box-shadow: 0 0 0 3px rgba(255,215,0,0.2) inset, 0 12px 60px rgba(255,215,0,0.5);
  transform: scale(1.18);
  z-index: 10;
}

/* Third place - right side, smaller */
.podium-style .card:nth-child(3) { 
  background: linear-gradient(180deg, #3a2f28, #0e0f12); 
  border: 2px solid rgba(205,127,50,0.4); 
  box-shadow: 0 0 0 2px rgba(205,127,50,0.1) inset, 0 8px 40px rgba(205,127,50,0.3);
  transform: scale(0.95);
}

.podium-style .avatar { width: 130px; height: 130px; }
.podium-style .card:nth-child(2) .avatar { width: 160px; height: 160px; }
.podium-style .name { margin-top: 12px; font-weight: 700; }
.podium-style .wagered { display: inline-flex; align-items:center; gap:8px; margin-top: 12px; padding: 6px 12px; border-radius: 8px; border: 1px solid #343a46; background:#12151b; }
.podium-style .wagered::before { content: ""; display:inline-block; width:20px; height:20px; background:url('/images/scrap.png') center/contain no-repeat; filter: drop-shadow(0 0 2px rgba(0,0,0,0.4)); }
body.board-2 .podium-style .wagered::before { background:url('/images/bsite%20coin.webp') center/contain no-repeat; }
.podium-style .prize { display:inline-flex; align-items:center; gap:8px; margin-top: 8px; padding: 6px 12px; border-radius: 8px; background: #f2c94c; color: #111; font-weight:700; }
.podium-style .prize .ico { width:18px; height:18px; background:url('/images/scrap.png') center/contain no-repeat; filter: drop-shadow(0 0 2px rgba(0,0,0,0.25)); display:inline-block; }
body.board-2 .podium-style .prize .ico { background:url('/images/bsite%20coin.webp') center/contain no-repeat; }
.card {
  background: var(--card);
  border-radius: 16px; padding: 18px; text-align: center; position: relative;
  border: 1px solid #242a34;
}
.rank {
  position: absolute; top: -10px; left: 12px; 
  padding: 8px 14px; border-radius: 999px; font-weight: 800; font-size: 16px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

/* Gold medal - vibrant gradient */
.rank.g1 { 
  background: linear-gradient(135deg, #ffd700, #ffed4e, #ffa500);
  color: #1a0f00;
  border: 2px solid #ffed4e;
  animation: pulse-gold 2s ease-in-out infinite;
}

/* Silver medal - shiny gradient */
.rank.g2 { 
  background: linear-gradient(135deg, #e8e8e8, #c0c0c0, #a8a8a8);
  color: #1a1a1a;
  border: 2px solid #e8e8e8;
  animation: pulse-silver 2s ease-in-out infinite;
}

/* Bronze medal - warm gradient */
.rank.g3 { 
  background: linear-gradient(135deg, #f4a460, #cd7f32, #a0522d);
  color: #1a0800;
  border: 2px solid #f4a460;
  animation: pulse-bronze 2s ease-in-out infinite;
}

@keyframes pulse-gold {
  0%, 100% { box-shadow: 0 4px 12px rgba(255,215,0,0.4), 0 0 20px rgba(255,215,0,0.3); }
  50% { box-shadow: 0 4px 16px rgba(255,215,0,0.6), 0 0 30px rgba(255,215,0,0.5); }
}

@keyframes pulse-silver {
  0%, 100% { box-shadow: 0 4px 12px rgba(192,192,192,0.4), 0 0 15px rgba(192,192,192,0.2); }
  50% { box-shadow: 0 4px 16px rgba(192,192,192,0.6), 0 0 25px rgba(192,192,192,0.4); }
}

@keyframes pulse-bronze {
  0%, 100% { box-shadow: 0 4px 12px rgba(205,127,50,0.4), 0 0 15px rgba(205,127,50,0.2); }
  50% { box-shadow: 0 4px 16px rgba(205,127,50,0.6), 0 0 25px rgba(205,127,50,0.4); }
}
.avatar { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; border: 2px solid #2c3440; }
.name { margin: 8px 0 0; font-size: 16px; font-weight: 600; }
.name-link { color: #5ea0ff; text-decoration: none; transition: color 0.2s; }
.name-link:hover { color: #8ec5ff; text-decoration: underline; }
.avatar-link { display: inline-block; }
.steamid { color: var(--muted); font-size: 12px; }
.wagered { margin: 8px 0; font-size: 16px; }
.prize { font-weight: 700; color: var(--accent); }
.controls { display: none; }
.error { max-width: 1000px; margin: 0 auto; color: #ff8a8a; padding: 0 24px 24px; }

@media (max-width: 800px) {
  header.site-header {
    grid-template-columns: 1fr;
    gap: 10px;
    justify-items: center;
  }
  .brand,
  .discord-btn,
  .nav.board-switch { justify-self: center; }

  .nav.board-switch {
    gap: 12px;
  }

  .board-logo-link {
    min-width: 160px;
    min-height: 64px;
  }

  .board-logo {
    max-height: 62px;
    max-width: 210px;
  }

  .podium { 
    grid-template-columns: 1fr;
    align-items: center;
  }
  .podium-style .card:nth-child(1),
  .podium-style .card:nth-child(2),
  .podium-style .card:nth-child(3) {
    transform: scale(1);
  }
  .podium-style .card:nth-child(2) .avatar {
    width: 120px;
    height: 120px;
  }
}

/* Others list */
.others { max-width: 1100px; margin: 0 auto; padding: 0 24px 24px; height: 55vh; overflow-y: auto; }
.others .table-head { display: grid; grid-template-columns: 80px 1fr 170px; gap: 12px; color: var(--muted); padding: 0 12px 8px; position: sticky; top: 0; background: linear-gradient(180deg, #0b0d12, #0f1115); z-index: 1; }
.others .row {
  display: grid; grid-template-columns: 80px 1fr 170px; gap: 12px;
  align-items: center; padding: 10px 12px; border-bottom: 1px solid #242a34;
}
.others .row .rank { position: static; background: transparent; border: none; color: var(--muted); }
.others .row .user { display:flex; align-items:center; }
.others .row .name { font-weight: 600; color: #e8e8e8; text-decoration: none; }
.others .row .row-avatar { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; border: 1px solid #2c3440; margin-right: 8px; }
.others .row .prize-badge { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; padding: 3px 8px; border-radius: 6px; background: #f2c94c; color: #111; font-weight: 700; font-size: 13px; }
.others .row .prize-badge .ico { width: 14px; height: 14px; background: url('/images/scrap.png') center/contain no-repeat; display: inline-block; }
body.board-2 .others .row .prize-badge .ico { background: url('/images/bsite%20coin.webp') center/contain no-repeat; }
.others .row .steamid { color: var(--muted); font-size: 12px; }
.others .row .wagered { text-align: right; font-variant-numeric: tabular-nums; }
.others .row .wagered { display:flex; justify-content:flex-end; align-items:center; gap:8px; }
.others .row .wagered::before { content: ""; display:inline-block; width:18px; height:18px; background:url('/images/scrap.png') center/contain no-repeat; filter: drop-shadow(0 0 2px rgba(0,0,0,0.4)); }
body.board-2 .others .row .wagered::before { background:url('/images/bsite%20coin.webp') center/contain no-repeat; }

@media (max-width: 700px) {
  .others { height: auto; }
  .others .table-head { grid-template-columns: 60px 1fr 100px; }
  .others .row { grid-template-columns: 60px 1fr 100px; }
  .others .row .steamid { display: none; }
}

footer {
  text-align: center;
  padding: 22px 20px;
  margin-top: 28px;
}

footer .disclaimer {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 12px 0;
  opacity: 0.8;
  font-style: italic;
}

footer small {
  color: var(--muted);
  opacity: 0.6;
}

.kick-pip {
  position: fixed;
  right: 14px;
  bottom: 14px;
  width: 320px;
  height: 180px;
  z-index: 120;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 12px 34px rgba(0,0,0,0.45);
  background: #0d0f14;
}

.kick-pip iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

@media (max-width: 700px) {
  .kick-pip {
    width: 220px;
    height: 124px;
    right: 10px;
    bottom: 10px;
  }
}
