@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Manrope:wght@400;500;600;700;800&display=swap");

:root {
  --bg: #faf9fb;
  --surface: #ffffff;
  --stripe: #f4f2f6;
  --text: #17121a;
  --text-2: #6b6473;
  --text-3: #9691a0;
  --border: #ece7ee;
  --purple: #37003c;
  --pink: #e90052;
  --green: #009e58;
  --pink-tint: #fdeaf1;
  --purple-tint: #f2eaf4;
  --green-tint: #e4f8ec;
  --gold: #eab628;
  --gold-tint: #fdf4dd;
  --silver: #9aa1ab;
  --silver-tint: #f1f2f4;
  --bronze: #c9814c;
  --bronze-tint: #f8ead9;
  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-pill: 999px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--pink);
  text-decoration: none;
}
a:hover {
  color: var(--purple);
}

h1, h2, h3 {
  font-family: "Space Grotesk", "Manrope", sans-serif;
  margin: 0;
}

/* ---------- Header / nav ---------- */

header.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.brand-mark {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 0.6rem;
  background: var(--purple);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 1rem;
}

.brand-name {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--purple);
}

.brand-season {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--pink);
  background: var(--pink-tint);
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-pill);
  margin-left: 0.15rem;
}

nav.site-nav {
  display: flex;
  align-items: center;
  gap: 1.35rem;
}

nav.site-nav a {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-3);
  padding: 0.5rem 0.1rem;
  position: relative;
}

nav.site-nav a:hover {
  color: var(--purple);
}

nav.site-nav a.active {
  color: var(--purple);
}

nav.site-nav a.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.2rem;
  height: 2px;
  background: var(--pink);
  border-radius: var(--radius-pill);
}

/* Bottom tab bar, mobile only (see media query) */

nav.tabbar {
  display: none;
}

/* ---------- Layout ---------- */

main {
  max-width: 1040px;
  margin: 0 auto;
  padding: 1.75rem 1.25rem 3rem;
}

.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.4rem;
  margin-bottom: 1.25rem;
  border: 1px solid var(--border);
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.eyebrow {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--pink);
  margin-bottom: 0.4rem;
}

h1.title {
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}

.sub {
  font-size: 0.9rem;
  color: var(--text-2);
  margin: 0.35rem 0 0;
}

.updated {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 0.5rem 0.85rem 0.5rem 0.6rem;
}

.live-dot {
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
}

/* ---------- Standings controls ---------- */

.standings-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.1rem;
}

.gw-select-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

#gw-select {
  appearance: none;
  -webkit-appearance: none;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 0.6rem 2.1rem 0.6rem 1rem;
  cursor: pointer;
}

.gw-chevron {
  position: absolute;
  right: 0.85rem;
  color: var(--text-3);
  pointer-events: none;
  display: flex;
}

.view-toggle {
  display: inline-flex;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 0.2rem;
  gap: 0.2rem;
}

.view-btn {
  border: none;
  background: transparent;
  padding: 0.45rem 1rem;
  border-radius: var(--radius-pill);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-3);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.view-btn:hover {
  color: var(--purple);
}

.view-btn.active {
  background: var(--purple);
  color: #fff;
}

/* ---------- Standings table (grid-based, columns shared by header/rows/detail) ---------- */

.table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.3rem 0.5rem;
  box-shadow: 0 1px 2px rgba(23, 18, 26, 0.03);
}

.row-head,
.standings-row,
.entry-row {
  display: grid;
  grid-template-columns: 2.5rem 1fr minmax(4.2rem, auto) minmax(6rem, auto) 1.6rem;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 0.6rem;
}

.row-head {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-3);
}

.standings-row {
  cursor: pointer;
  border-top: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.standings-row:first-child {
  border-top: none;
}

.standings-row:hover {
  background: var(--bg);
}

.rank-chip {
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-2);
}
.rank-chip.r1 { background: var(--gold-tint); color: #8a6a0a; }
.rank-chip.r2 { background: var(--silver-tint); color: #5b6169; }
.rank-chip.r3 { background: var(--bronze-tint); color: #92511f; }

.team-cell {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.team-name {
  font-weight: 700;
  font-size: 0.94rem;
  color: var(--text);
}

.team-meta {
  font-size: 0.74rem;
  color: var(--text-3);
  margin-top: 1px;
}

.metric-fpl {
  font-weight: 600;
  color: var(--text-2);
  text-align: right;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--pink-tint);
  color: var(--pink);
  font-family: "Space Grotesk", sans-serif;
  border-radius: var(--radius-pill);
  padding: 0.35rem 0.85rem;
  font-weight: 800;
  font-size: 0.82rem;
  width: fit-content;
  justify-self: end;
}

.chev {
  color: var(--text-3);
  display: flex;
  justify-content: flex-end;
}

.chev svg {
  transition: transform 0.15s ease;
}

.standings-row.expanded .chev svg {
  transform: rotate(180deg);
}

.detail-wrap {
  display: none;
  margin: 0.2rem 0 0.6rem;
  padding: 0.5rem 0;
}

.detail-wrap.open {
  display: block;
}

.entry-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-top: 0.5rem;
  padding: 0.55rem 0.6rem;
}

.entry-row:first-child {
  margin-top: 0;
}

.entry-dot {
  display: flex;
  align-items: center;
  justify-content: center;
}

.entry-dot span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border);
}

.entry-name-cell {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.entry-name-cell a {
  color: var(--purple);
  font-weight: 700;
  font-size: 0.85rem;
  text-decoration: none;
}

.entry-name-cell a:hover {
  text-decoration: underline;
}

.entry-manager {
  color: var(--text-3);
  font-size: 0.75rem;
  margin-top: 1px;
}

.entry-fpl {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  color: var(--text);
  text-align: right;
}

.copy-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.55rem;
  height: 1.55rem;
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 8px;
  color: var(--text-3);
  font-size: 0.8rem;
  line-height: 1;
  cursor: pointer;
  vertical-align: middle;
  margin-left: 0.25rem;
  padding: 0;
  justify-self: end;
  transition: all 0.15s ease;
}

.copy-link-btn:hover {
  color: var(--pink);
  border-color: var(--pink);
}

.copy-link-btn.copied {
  color: #fff;
  background: var(--green);
  border-color: var(--green);
}

/* ---------- Teams ---------- */

.note {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  background: var(--green-tint);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  font-size: 0.83rem;
  color: #175c3a;
  margin-bottom: 1.5rem;
}

.note svg {
  flex-shrink: 0;
  margin-top: 1px;
  color: #1a8a56;
}

.teams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.team-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--pink);
  border-radius: var(--radius-lg);
  padding: 1.2rem;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.team-tag {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--purple);
  background: var(--purple-tint);
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius-pill);
}

.team-total {
  font-size: 0.75rem;
  color: var(--text-3);
  font-weight: 600;
}

.team-card ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.team-card li {
  padding: 0.5rem 0;
  border-top: 1px solid var(--border);
  font-size: 0.88rem;
}

.team-card li:first-child {
  border-top: none;
  padding-top: 0;
}

/* ---------- Rules page ---------- */

.section {
  margin-bottom: 2rem;
}

.section h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.6rem;
}

.section p {
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--text-2);
  margin: 0;
}

.rank-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.6rem;
  margin-top: 1rem;
}

.rank-grid-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem 0.6rem;
  text-align: center;
}

.rank-grid-item .r {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.rank-grid-item .p {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--pink);
  margin-top: 0.35rem;
}

.callout {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  background: var(--purple-tint);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  font-size: 0.82rem;
  color: var(--purple);
  margin-top: 1rem;
  line-height: 1.55;
}

.callout svg {
  flex-shrink: 0;
  margin-top: 2px;
}

.prize-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-top: 1.1rem;
}

.prize {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.1rem;
  text-align: center;
}

.prize.gold { border-top-color: var(--gold); }
.prize.silver { border-top-color: var(--silver); }
.prize.bronze { border-top-color: var(--bronze); }

.prize-num {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  margin: 0 auto 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
}
.prize.gold .prize-num { background: var(--gold-tint); color: #8a6a0a; }
.prize.silver .prize-num { background: var(--silver-tint); color: #5b6169; }
.prize.bronze .prize-num { background: var(--bronze-tint); color: #92511f; }

.prize .amount {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--text);
}

.prize .muted {
  margin-top: 0.3rem;
}

.prizes-note {
  font-size: 0.78rem;
  color: var(--text-3);
  margin-top: 0.9rem;
  text-align: center;
}

.muted {
  color: var(--text-3);
  font-size: 0.85rem;
}

.updated-at {
  color: var(--text-3);
  font-size: 0.8rem;
}

footer {
  text-align: center;
  color: var(--text-3);
  font-size: 0.8rem;
  padding: 1.5rem 1rem;
}

/* ---------- Mobile ---------- */

@media (max-width: 640px) {
  header.site-header {
    padding: 0.85rem 1rem;
  }

  nav.site-nav {
    display: none;
  }

  main {
    padding: 1.25rem 1rem 5.5rem;
  }

  h1.title {
    font-size: 1.5rem;
  }

  .row-head,
  .standings-row,
  .entry-row {
    grid-template-columns: 2.1rem 1fr minmax(3rem, auto) minmax(4.4rem, auto) 1.3rem;
    gap: 0.35rem;
    padding: 0.65rem 0.35rem;
  }

  .standings-row,
  .entry-row {
    font-size: 0.85rem;
  }

  .row-head {
    font-size: 0.6rem;
    letter-spacing: 0.02em;
  }

  .rank-chip {
    width: 1.7rem;
    height: 1.7rem;
    font-size: 0.78rem;
  }

  .prize-list {
    grid-template-columns: 1fr 1fr;
  }

  nav.tabbar {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    height: 4rem;
    background: var(--surface);
    border-top: 1px solid var(--border);
    align-items: center;
    justify-content: space-around;
    padding-bottom: 0.25rem;
  }

  nav.tabbar a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    color: var(--text-3);
    font-size: 0.66rem;
    font-weight: 600;
  }

  nav.tabbar a.active {
    color: var(--pink);
  }
}
