:root {
  --bg: #0b0b0c;
  --bg-elev: #141416;
  --bg-card: #1b1b1f;
  --line: rgba(244, 241, 234, 0.1);
  --text: #f4f1ea;
  --muted: #9a958c;
  --red: #e23b2a;
  --red-dim: rgba(226, 59, 42, 0.16);
  --gold: #e8c36a;
  --green: #7dcea0;
  --blue: #8ab4ff;
  --amber: #e0a45a;
  --safe-top: env(safe-area-inset-top);
  --safe-bottom: env(safe-area-inset-bottom);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
body {
  font-family: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  min-height: 100dvh;
}

#app {
  max-width: 720px;
  margin: 0 auto;
  padding-bottom: calc(108px + var(--safe-bottom));
}

.topbar {
  padding: calc(18px + var(--safe-top)) 20px 12px;
  background:
    radial-gradient(1200px 240px at 80% -40%, rgba(226, 59, 42, 0.28), transparent 60%),
    linear-gradient(180deg, #161618, var(--bg));
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}
.kicker {
  margin: 0;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 11px;
  color: var(--red);
  font-weight: 600;
}
h1, h2, h3 { font-family: "Bebas Neue", Impact, sans-serif; letter-spacing: 0.03em; margin: 0; }
h1 { font-size: 42px; line-height: 0.95; margin-top: 6px; }
.lede { margin: 10px 0 0; color: var(--muted); font-size: 14px; line-height: 1.45; }

.content { padding: 16px 16px 24px; }
.loading, .empty { color: var(--muted); padding: 28px 8px; text-align: center; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.stat {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 10px;
  text-align: center;
}
.stat b {
  display: block;
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: 28px;
  line-height: 1;
}
.stat span { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; }

.section { margin: 22px 0; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
}
.section h2 { font-size: 26px; }
.section .hint { color: var(--muted); font-size: 12px; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 10px;
}
.card.expandable { cursor: pointer; }
.rank-row, .trade-row {
  display: flex;
  gap: 12px;
  align-items: center;
}
.avatar, .initials {
  width: 42px; height: 42px; border-radius: 50%;
  flex: none; object-fit: cover; background: #2a2a2e;
}
.initials {
  display: grid; place-items: center;
  font-weight: 700; color: var(--gold);
  border: 1px solid var(--line);
}
.who { flex: 1; min-width: 0; }
.who strong, .who .team { display: block; }
.who strong { font-size: 15px; }
.who .team, .meta { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.delta { font-variant-numeric: tabular-nums; font-weight: 700; }
.delta.pos { color: var(--green); }
.delta.neg { color: var(--red); }
.delta.zero { color: var(--muted); }

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--red-dim);
  color: #ffb4ab;
}
.badge.gold { background: rgba(232, 195, 106, 0.14); color: var(--gold); }
.badge.green { background: rgba(125, 206, 160, 0.14); color: var(--green); }
.badge.amber { background: rgba(224, 164, 90, 0.16); color: var(--amber); }
.badge.blue { background: rgba(138, 180, 255, 0.14); color: var(--blue); }
.badge.muted { background: rgba(154, 149, 140, 0.14); color: var(--muted); }

.vs {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: start;
  margin-top: 10px;
}
.side { min-width: 0; }
.side.winner .pts { color: var(--gold); }
.side .mgr { font-weight: 650; font-size: 13px; line-height: 1.3; }
.side .pts {
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: 28px;
  line-height: 1;
  margin: 4px 0;
}
.side .assets { color: var(--muted); font-size: 12px; line-height: 1.35; }
.mid {
  align-self: center;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding-top: 18px;
}
.card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  gap: 8px;
}
.weekchip { color: var(--muted); font-size: 12px; }

.detail {
  display: none;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.card.open .detail { display: block; }
.periods {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.period {
  background: var(--bg-elev);
  border-radius: 12px;
  padding: 8px;
  text-align: center;
}
.period label { display: block; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; }
.period b { font-size: 13px; }
.player-line {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.player-line:last-child { border-bottom: 0; }
.pos {
  display: inline-block;
  min-width: 28px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 700;
}

.filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 10px;
  margin: 0 -16px 12px;
  padding-left: 16px;
  padding-right: 16px;
  -webkit-overflow-scrolling: touch;
}
.filters button, select, input[type="search"] {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--bg-card);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 12px;
  font: inherit;
  font-size: 13px;
  white-space: nowrap;
}
.filters button.active { background: var(--text); color: var(--bg); }
input[type="search"] { flex: 1; min-width: 140px; border-radius: 12px; }

.method p { color: var(--muted); line-height: 1.5; font-size: 14px; }
.method ul { padding-left: 18px; color: var(--text); }
.method li { margin: 6px 0; }

.tabs {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: rgba(11, 11, 12, 0.94);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding: 6px 8px calc(8px + var(--safe-bottom));
  z-index: 10;
}
.tabs button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 10px 4px;
}
.tabs button.active { color: var(--text); }

.tiny { font-size: 12px; color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 8px; }
.spotlight .pts { font-size: 36px; color: var(--gold); }
.spotlight .sub { color: var(--muted); margin-top: 4px; }
