/* ============================================================
   PiggyCS design system — blood red on black.

   Deliberately avoids the soft-glow / uniform-radius / all-Inter
   look: hard hairline borders, clipped corners on buttons, heavy
   condensed display type and film grain.
   ============================================================ */

:root {
  --ink:      #08070a;
  --ink-2:    #0d0b0f;
  --panel:    #141016;
  --panel-2:  #1b161d;
  --line:     #2a232f;
  --line-hot: rgba(255, 31, 61, .38);

  --blood:    #ff1f3d;
  --blood-dk: #a80d22;
  --blood-lo: rgba(255, 31, 61, .09);

  --bone:     #f4efe9;
  --ash:      #8d8395;
  --ash-dim:  #5f5768;

  --gold:     #f5b12c;
  --green:    #3ddc84;

  --display: 'Anton', 'Arial Narrow', sans-serif;
  --font:    'Barlow', system-ui, sans-serif;
  --mono:    'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 92px; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--bone);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Film grain. Flat noise, no blur — this is what stops the page
   reading as a default dark template. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: .22;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: .01em;
  line-height: .95;
  margin: 0;
}

/* ---------------- Nav ---------------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 26px;
  padding: 0 clamp(14px, 3vw, 40px);
  height: 72px;
  background: var(--ink);
  border-bottom: 1px solid var(--line);
}
.nav::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, var(--blood), transparent 42%);
}

.nav__brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-family: var(--display);
  font-size: 1.4rem;
  text-transform: uppercase;
  letter-spacing: .02em;
}
.nav__brand img { width: 38px; height: 38px; }
.nav__brand em { font-style: normal; color: var(--blood); }

.nav__links {
  display: flex;
  gap: 4px;
  margin-left: auto;
}
.nav__links a {
  padding: 8px 14px;
  font-size: .78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .13em;
  color: var(--ash);
  border: 1px solid transparent;
  transition: color .15s, border-color .15s;
}
.nav__links a:hover { color: var(--bone); border-color: var(--line); }
.nav__links a.is-active { color: var(--blood); border-color: var(--line-hot); }

/* ---------------- Games menu ---------------- */

.menu { position: relative; }
.menu__btn {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  background: none; border: 1px solid transparent;
  color: var(--ash);
  font: 600 .78rem var(--font);
  text-transform: uppercase; letter-spacing: .13em;
  cursor: pointer;
}
.menu__btn:hover { color: var(--bone); border-color: var(--line); }
.menu.is-active .menu__btn { color: var(--blood); border-color: var(--line-hot); }
.menu__caret { font-size: .7em; transition: transform .16s; }
.menu.is-open .menu__caret { transform: rotate(180deg); }

.menu__panel {
  position: absolute;
  top: calc(100% + 8px); left: 0;
  min-width: 232px;
  background: var(--ink-2);
  border: 1px solid var(--line);
  display: none;
  z-index: 60;
  box-shadow: 0 20px 40px rgba(0,0,0,.6);
}
.menu.is-open .menu__panel { display: block; }
.menu__panel a {
  display: block;
  padding: 11px 15px;
  border-bottom: 1px solid rgba(255,255,255,.045);
  border-left: 2px solid transparent;
}
.menu__panel a:last-child { border-bottom: 0; }
.menu__panel a:hover { background: var(--panel-2); border-left-color: var(--blood); }
.menu__panel a.is-active { border-left-color: var(--blood); }
.menu__panel b { display: block; font-size: .84rem; text-transform: uppercase; letter-spacing: .06em; }
.menu__panel span { font-size: .74rem; color: var(--ash-dim); }

/* ---------------- Sub bar / back ---------------- */

.subbar {
  position: sticky; top: 72px; z-index: 40;
  display: flex; align-items: center; gap: 14px;
  padding: 0 clamp(14px, 3vw, 40px);
  height: 42px;
  background: var(--ink-2);
  border-bottom: 1px solid var(--line);
}
.backbtn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 12px;
  background: none;
  border: 1px solid var(--line);
  color: var(--ash);
  font: 600 .72rem var(--font);
  text-transform: uppercase; letter-spacing: .12em;
  cursor: pointer;
  transition: color .14s, border-color .14s;
}
.backbtn:hover { color: var(--blood); border-color: var(--blood); }
.subbar__crumb {
  font-size: .7rem; text-transform: uppercase; letter-spacing: .18em; color: var(--ash-dim);
}

/* ---------------- Account chip ---------------- */
/* Rendered by shell.js on every page, so it has to live in the global sheet. */

.nav__account { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.who { display: flex; align-items: center; gap: 9px; font-size: .84rem; font-weight: 600; }
.who img {
  width: 28px; height: 28px; flex: none;
  object-fit: cover; background: var(--ink-2); filter: grayscale(.4);
}
.who__name { max-width: 15ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who .pts {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  padding-left: 10px;
  border-left: 1px solid var(--line);
}
.logout {
  background: none; border: 0; cursor: pointer;
  color: var(--ash-dim);
  font: 600 .68rem var(--font);
  text-transform: uppercase; letter-spacing: .14em;
}
.logout:hover { color: var(--blood); }

.livechip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 11px;
  border: 1px solid var(--blood);
  color: var(--blood);
  font: 700 .68rem var(--font);
  text-transform: uppercase; letter-spacing: .14em;
}
.livechip__dot { width: 6px; height: 6px; background: var(--blood); border-radius: 50%; animation: blink 1.4s steps(1) infinite; }

/* ---------------- Buttons ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 12px 22px;
  border: 1px solid var(--blood);
  background: var(--blood);
  color: #fff;
  font-family: var(--font);
  font-weight: 700;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .11em;
  cursor: pointer;
  position: relative;
  clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 9px, 100% 100%, 9px 100%, 0 calc(100% - 9px));
  transition: background .15s, color .15s, transform .1s;
}
.btn:hover { background: var(--blood-dk); border-color: var(--blood-dk); }
.btn:active { transform: translateY(1px); }
.btn--lg { padding: 16px 32px; font-size: .92rem; }
.btn--sm { padding: 9px 15px; font-size: .72rem; }

.btn--ghost { background: transparent; border-color: var(--line); color: var(--bone); }
.btn--ghost:hover { background: var(--panel-2); border-color: var(--blood); color: var(--blood); }

.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.copied { background: var(--gold); border-color: var(--gold); color: #1a1200; }

/* ---------------- Panels ---------------- */

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: clamp(16px, 2.4vw, 24px);
  position: relative;
}

/* Section heading with a red tick before it. */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .22em;
  color: var(--ash);
  margin-bottom: 10px;
}
.eyebrow::before {
  content: '';
  width: 22px;
  height: 2px;
  background: var(--blood);
}

/* ---------------- Hero ---------------- */

.hero {
  padding: clamp(44px, 7vw, 90px) clamp(14px, 3vw, 40px) 46px;
  border-bottom: 1px solid var(--line);
  position: relative;
  overflow: hidden;
}
/* Oversized ghost wordmark bleeding off the edge. */
.hero::after {
  content: 'PIGGYCS';
  position: absolute;
  right: -3vw;
  bottom: -3vw;
  font-family: var(--display);
  font-size: 22vw;
  line-height: .8;
  color: #fff;
  opacity: .022;
  pointer-events: none;
  letter-spacing: -.02em;
}

.hero__inner { max-width: 1080px; margin: 0 auto; position: relative; z-index: 1; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 6px 13px;
  border: 1px solid var(--line-hot);
  background: var(--blood-lo);
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .18em;
  color: var(--blood);
}
.pill__dot { width: 6px; height: 6px; background: var(--blood); animation: blink 1.4s steps(1) infinite; }
@keyframes blink { 50% { opacity: .25; } }

.hero h1 {
  font-size: clamp(3rem, 11vw, 7.4rem);
  margin: 22px 0 0;
  max-width: 15ch;
}
.hero h1 .grad { color: var(--blood); }

.hero__sub {
  color: var(--ash);
  font-size: clamp(1rem, 1.6vw, 1.12rem);
  max-width: 46ch;
  margin: 18px 0 34px;
}

.hero__pool {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0;
  border: 1px solid var(--line);
  background: var(--panel);
  margin-bottom: 28px;
  max-width: 780px;
}
.pool {
  padding: 20px 30px;
  border-right: 1px solid var(--line);
  flex: 1 1 auto;
}
.pool__label,
.cd span {
  display: block;
  font-size: .66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .2em;
  color: var(--ash-dim);
}
.pool__value {
  display: block;
  font-family: var(--display);
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  color: var(--gold);
  line-height: 1;
  margin-top: 6px;
}
.pool__value em { font-style: normal; font-size: .34em; color: var(--ash); }

.countdown { display: flex; }
.cd {
  padding: 20px 16px;
  min-width: 74px;
  text-align: center;
  border-right: 1px solid var(--line);
}
.cd:last-child { border-right: 0; }
.cd b {
  display: block;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.5rem;
  font-variant-numeric: tabular-nums;
  margin-bottom: 4px;
}

.hero__actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------------- Sections ---------------- */

.section { max-width: 1080px; margin: 0 auto; padding: clamp(38px, 5vw, 62px) clamp(14px, 3vw, 40px); }
.section__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 14px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--line);
}
.section__head h2 { font-size: clamp(1.7rem, 3.6vw, 2.6rem); }
.meta__updated {
  font-family: var(--mono);
  font-size: .74rem;
  color: var(--ash-dim);
  text-transform: uppercase;
  letter-spacing: .1em;
}

.banner {
  padding: 11px 16px;
  margin-bottom: 20px;
  font-size: .82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  border-left: 3px solid;
  background: var(--panel);
}
.banner--demo { border-color: var(--ash); color: var(--ash); }
.banner--stale { border-color: var(--gold); color: var(--gold); }

/* ---------------- Jackpot share bar ---------------- */

.jackpot { margin-bottom: 22px; }
.jackpot__head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  margin-bottom: 9px;
}
.jackpot__title { font-size: .68rem; text-transform: uppercase; letter-spacing: .2em; color: var(--ash-dim); }
.jackpot__total { font-family: var(--mono); font-size: .82rem; color: var(--ash); }
.jackpot__total b { color: var(--gold); }

.jackpot__bar {
  display: flex;
  height: 34px;
  border: 1px solid var(--line);
  background: var(--ink-2);
  overflow: hidden;
}
.jackpot__seg {
  position: relative;
  display: grid; place-items: center;
  min-width: 0;
  font: 700 .72rem var(--mono);
  color: #12080a;
  transition: filter .16s;
  border-right: 1px solid rgba(0,0,0,.45);
}
.jackpot__seg:last-child { border-right: 0; }
.jackpot__seg:hover { filter: brightness(1.18); }
.jackpot__seg span { padding: 0 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jackpot__seg--rest { background: var(--panel-2) !important; color: var(--ash-dim); }

.jackpot__key { display: flex; flex-wrap: wrap; gap: 12px 18px; margin-top: 10px; }
.jackpot__key div { display: flex; align-items: center; gap: 7px; font-size: .78rem; color: var(--ash); }
.jackpot__key i { width: 10px; height: 10px; flex: none; }
.jackpot__key b { color: var(--bone); font-weight: 600; }
.jackpot__key em { font-style: normal; font-family: var(--mono); color: var(--ash-dim); }

/* ---------------- Live ---------------- */

.live { display: grid; gap: 14px; }
.live__frame {
  position: relative;
  aspect-ratio: 16 / 9;
  width: 100%;
  background: var(--ink-2);
  border: 1px solid var(--line);
  overflow: hidden;
}
.live__frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.live__offline {
  position: absolute; inset: 0;
  display: grid; place-content: center; justify-items: center; gap: 14px;
  text-align: center; padding: 24px;
}
.live__offline h3 { font-size: clamp(1.3rem, 3vw, 2rem); }
.live__offline p { color: var(--ash); margin: 0; max-width: 46ch; }
.live__status {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px; border: 1px solid var(--line);
  font: 700 .68rem var(--font); text-transform: uppercase; letter-spacing: .16em;
  color: var(--ash-dim);
}
.live__status.is-live { border-color: var(--blood); color: var(--blood); }
.live__status.is-live i { width: 6px; height: 6px; border-radius: 50%; background: var(--blood); animation: blink 1.4s steps(1) infinite; }

/* ---------------- Podium ---------------- */

.podium {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: stretch;
  gap: 10px;
  margin-bottom: 10px;
}
.pod {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 26px 16px 22px;
  text-align: center;
  position: relative;
  transition: border-color .18s, background .18s;
}
.pod:hover { border-color: var(--line-hot); background: var(--panel-2); }
.pod--1 { border-color: var(--blood); background: linear-gradient(180deg, var(--blood-lo), transparent 60%); order: 2; }
.pod--2 { order: 1; }
.pod--3 { order: 3; }

/* Rank number sitting behind the avatar. */
.pod__rank {
  position: absolute;
  top: 6px; left: 12px;
  font-family: var(--display);
  font-size: 3.4rem;
  line-height: 1;
  color: #fff;
  opacity: .07;
}
.pod--1 .pod__rank { color: var(--blood); opacity: .3; }

.pod__crown { font-size: 1.3rem; line-height: 1; margin-bottom: 4px; }
.pod__ava {
  width: 66px; height: 66px;
  margin: 0 auto 12px;
  object-fit: cover;
  background: var(--ink-2);
  border: 1px solid var(--line);
  filter: grayscale(.35);
}
.pod--1 .pod__ava { width: 78px; height: 78px; border-color: var(--blood); filter: none; }

.pod__name {
  font-family: var(--font);
  font-weight: 700;
  font-size: .98rem;
  text-transform: none;
  letter-spacing: 0;
  margin-bottom: 8px;
  word-break: break-word;
}
.pod__wager { font-family: var(--mono); font-size: 1.1rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.pod__wager span { color: var(--ash-dim); font-size: .68em; }
.pod__prize {
  display: inline-block;
  margin-top: 12px;
  padding: 4px 13px;
  border: 1px solid var(--gold);
  color: var(--gold);
  font-family: var(--mono);
  font-size: .78rem;
  font-weight: 700;
}

/* ---------------- Table ---------------- */

.table { border: 1px solid var(--line); background: var(--panel); }
.table__head, .row {
  display: grid;
  grid-template-columns: 62px 1fr 160px 110px;
  align-items: center;
  gap: 12px;
  padding: 12px clamp(12px, 2vw, 20px);
}
.table__head {
  font-size: .66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .2em;
  color: var(--ash-dim);
  border-bottom: 1px solid var(--line);
}
.table__head span:nth-child(3), .table__head span:nth-child(4),
.row__wager, .row__prize { text-align: right; }

.row { border-bottom: 1px solid rgba(255,255,255,.035); transition: background .14s; }
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--panel-2); }
.row:hover .row__rank { color: var(--blood); }

.row__rank { font-family: var(--display); font-size: 1.05rem; color: var(--ash-dim); transition: color .14s; }
.row__player { display: flex; align-items: center; gap: 11px; min-width: 0; }
.row__ava { width: 30px; height: 30px; object-fit: cover; background: var(--ink-2); flex: none; filter: grayscale(.4); }
.row__name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row__wager { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: .92rem; }
.row__wager span { color: var(--ash-dim); font-size: .8em; }
.row__prize { font-family: var(--mono); font-weight: 700; color: var(--gold); font-variant-numeric: tabular-nums; }
.row__prize.is-zero { color: var(--ash-dim); font-weight: 400; }

.empty { text-align: center; color: var(--ash-dim); padding: 44px 0; text-transform: uppercase; letter-spacing: .12em; font-size: .84rem; }

/* ---------------- Prizes ---------------- */

.prizes { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 8px; }
.prize {
  padding: 16px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  text-align: center;
}
.prize b {
  display: block;
  font-size: .64rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .18em;
  color: var(--ash-dim);
}
.prize strong { display: block; font-family: var(--display); font-size: 1.6rem; color: var(--bone); margin: 8px 0 2px; }
.prize__cur { font-family: var(--mono); font-size: .66rem; color: var(--ash-dim); text-transform: uppercase; }
.prize--top { border-color: var(--line-hot); }
.prize--top strong { color: var(--gold); }

/* ---------------- Steps ---------------- */

.steps {
  list-style: none;
  counter-reset: s;
  padding: 0; margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.steps li { counter-increment: s; padding: 24px 20px; background: var(--panel); }
.steps li::before {
  content: counter(s, decimal-leading-zero);
  display: block;
  font-family: var(--display);
  font-size: 1.9rem;
  color: var(--blood);
  line-height: 1;
  margin-bottom: 12px;
}
.steps b { display: block; margin-bottom: 5px; text-transform: uppercase; letter-spacing: .06em; font-size: .88rem; }
.steps span { color: var(--ash); font-size: .9rem; }
.code { color: var(--gold); font-family: var(--mono); font-weight: 700; }

/* ---------------- Footer ---------------- */

.footer {
  border-top: 1px solid var(--line);
  padding: 34px clamp(14px, 3vw, 40px);
  display: grid;
  gap: 14px;
  justify-items: center;
  text-align: center;
}
.footer__brand { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-size: 1.1rem; text-transform: uppercase; }
.footer__brand img { width: 30px; height: 30px; }
.footer__links { display: flex; gap: 20px; flex-wrap: wrap; justify-content: center; font-size: .74rem; text-transform: uppercase; letter-spacing: .14em; color: var(--ash-dim); }
.footer__links a:hover { color: var(--blood); }
.footer__legal { color: var(--ash-dim); font-size: .76rem; max-width: 620px; margin: 0; }
.footer__legal a { color: var(--blood); }

/* ---------------- Reveal ---------------- */

.reveal { opacity: 0; transform: translateY(14px); transition: opacity .5s, transform .5s; }
.reveal.in { opacity: 1; transform: none; }

/* ---------------- Responsive ---------------- */

@media (max-width: 900px) { .nav__links { display: none; } }

@media (max-width: 720px) {
  .podium { grid-template-columns: 1fr; }
  .pod--1, .pod--2, .pod--3 { order: 0; }
  .table__head, .row { grid-template-columns: 38px 1fr 92px; gap: 8px; }
  .table__head span:nth-child(4), .row__prize { display: none; }
  .row__wager span { display: none; }
  .hero__pool { flex-direction: column; }
  .pool { border-right: 0; border-bottom: 1px solid var(--line); }
  .cd { flex: 1; min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
}
