:root {
  color-scheme: light;
  --bg: #f3f6f3;
  --surface: #fff;
  --surface-soft: #e9eee9;
  --text: #13221d;
  --muted: #74817b;
  --line: #e3e9e4;
  --green: #00a94f;
  --green-soft: #dcf8e6;
  --difficulty-1-background: #375523;
  --difficulty-1-text: #fff;
  --difficulty-2-background: #01fc7a;
  --difficulty-2-text: #37003c;
  --difficulty-3-background: #e7e7e7;
  --difficulty-3-text: #37003c;
  --difficulty-4-background: #ff1b54;
  --difficulty-4-text: #37003c;
  --difficulty-5-background: #80072d;
  --difficulty-5-text: #fff;
  --shadow: 0 16px 44px rgba(20, 45, 31, .07);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c1714;
  --surface: #14221d;
  --surface-soft: #1c2c26;
  --text: #f2f7f3;
  --muted: #9bab9f;
  --line: #293a32;
  --green: #48e68c;
  --green-soft: #183c2b;
  --shadow: 0 16px 44px rgba(0, 0, 0, .18);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background .2s ease, color .2s ease;
}
button, input, select { font: inherit; }
button, select { -webkit-tap-highlight-color: transparent; }
.app { max-width: 860px; margin: 0 auto; padding: 0 20px 46px; }
.topbar {
  height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 850; letter-spacing: -.04em; }
.brand-mark {
  width: 31px; height: 31px; display: grid; place-items: center;
  border-radius: 10px; background: var(--green); color: #062416;
  font-size: 15px; font-weight: 950; transform: rotate(-5deg);
}
.brand-name { font-size: 16px; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.icon-button {
  min-width: 42px; min-height: 42px; padding: 0 12px; display: inline-flex;
  align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface); color: var(--text); cursor: pointer;
}
.icon-button:hover { border-color: var(--green); }
.icon-button:disabled { opacity: .6; cursor: wait; }
.icon-button svg { width: 18px; height: 18px; }
.hero { padding: 36px 0 8px; }
.eyebrow {
  margin: 0 0 8px; color: var(--green); font-size: 11px;
  font-weight: 850; letter-spacing: .14em; text-transform: uppercase;
}
h1 { margin: 0; font-size: clamp(31px, 8vw, 46px); line-height: 1.06; letter-spacing: -.055em; }
.intro { margin: 12px 0 0; color: var(--muted); font-size: 14px; }
.summary {
  margin-top: 24px; padding: 17px 18px; display: flex; align-items: center;
  justify-content: space-between; gap: 12px;
  border: 1px solid var(--line); border-radius: 18px;
  background: var(--surface); box-shadow: var(--shadow);
}
.summary-label { color: var(--muted); font-size: 12px; font-weight: 650; }
.summary-period { margin-top: 3px; font-size: 19px; font-weight: 850; letter-spacing: -.03em; }
.summary-chip {
  padding: 8px 11px; border-radius: 999px;
  background: var(--green-soft); color: var(--green);
  font-size: 11px; font-weight: 850; white-space: nowrap;
}
.window-control {
  margin-top: 12px; padding: 13px 15px 10px;
  border: 1px solid var(--line); border-radius: 15px;
  background: var(--surface);
}
.window-heading { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; }
.window-heading label { color: var(--muted); font-weight: 700; }
.window-heading output { color: var(--text); font-weight: 800; }
#gameweek-range {
  width: 100%; height: 24px; margin: 8px 0 0;
  accent-color: var(--green); cursor: pointer;
}
.range-labels { display: flex; justify-content: space-between; margin-top: -1px; color: var(--muted); font-size: 10px; }
.data-status { margin: 10px 2px 0; color: var(--muted); font-size: 12px; }
.toolbar { margin: 20px 0 14px; display: grid; gap: 11px; }
.search-wrap { position: relative; }
.search-wrap svg {
  position: absolute; left: 14px; top: 50%; width: 17px; height: 17px;
  color: var(--muted); transform: translateY(-50%); pointer-events: none;
}
.search, .team-select {
  width: 100%; height: 48px; outline: none;
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface); color: var(--text);
}
.search { padding: 0 14px 0 42px; }
.team-select { padding: 0 13px; }
.search:focus, .team-select:focus { border-color: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 15%, transparent); }
.filters { display: flex; gap: 7px; overflow-x: auto; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filter {
  flex: 0 0 auto; min-height: 40px; padding: 0 15px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); color: var(--muted); font-size: 13px;
  font-weight: 750; cursor: pointer;
}
.filter[aria-pressed="true"] { border-color: var(--green); background: var(--green-soft); color: var(--green); }
.list-heading { display: flex; align-items: center; justify-content: space-between; margin: 22px 2px 10px; }
.list-heading h2 { margin: 0; font-size: 16px; letter-spacing: -.02em; }
.result-count { color: var(--muted); font-size: 12px; }
.difficulty-legend {
  display: flex; align-items: center; gap: 5px;
  margin: -3px 2px 11px; color: var(--muted); font-size: 10px;
}
.legend-title { margin-right: 2px; font-size: 9px; font-weight: 850; letter-spacing: .06em; }
.legend-cell {
  width: 18px; height: 18px; display: inline-grid; place-items: center;
  border-radius: 5px; font-size: 10px; font-weight: 850;
}
.legend-note { margin-left: 2px; }
.player-list { display: grid; gap: 9px; }
.player-card {
  padding: 12px 14px; display: grid;
  grid-template-columns: 35px minmax(0, 1fr) auto; align-items: center; gap: 11px 12px;
  border: 1px solid var(--line); border-radius: 16px;
  background: var(--surface); box-shadow: 0 5px 16px rgba(20, 45, 31, .025);
  animation: rise .24s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.rank {
  width: 32px; height: 32px; display: grid; place-items: center;
  border-radius: 11px; background: var(--surface-soft); color: var(--muted);
  font-size: 12px; font-weight: 850;
}
.player-card:nth-child(-n+3) .rank { background: var(--green-soft); color: var(--green); }
.player-info { min-width: 0; }
.player-name { overflow: hidden; color: var(--text); font-size: 14px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.player-meta { display: flex; align-items: center; gap: 6px; margin-top: 4px; overflow: hidden; color: var(--muted); font-size: 11px; white-space: nowrap; }
.club { color: var(--text); font-weight: 700; }
.dot { opacity: .55; }
.points { min-width: 49px; text-align: right; }
.points-value { font-size: 21px; font-weight: 900; line-height: 1; letter-spacing: -.04em; }
.points-label { margin-top: 5px; color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.weekly-points {
  grid-column: 1 / -1; display: grid;
  grid-template-columns: repeat(var(--week-columns, 5), minmax(0, 1fr)); gap: 6px;
}
.week-point {
  min-width: 0; min-height: 43px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); font-variant-numeric: tabular-nums;
}
.week-label { overflow: hidden; max-width: 100%; color: var(--muted); font-size: 9px; font-weight: 700; white-space: nowrap; }
.week-value { color: var(--text); font-size: 13px; font-weight: 850; line-height: 1.1; }
.fixture-row { grid-column: 1 / -1; display: flex; align-items: center; gap: 9px; min-width: 0; }
.fixture-caption { flex: 0 0 auto; color: var(--muted); font-size: 9px; font-weight: 850; letter-spacing: .08em; }
.fixtures { min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.fixture {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 7px;
  border-radius: 7px; background: var(--surface-soft);
  color: var(--text); font-size: 10px; font-weight: 800;
}
.fixture--difficulty-1 { background: var(--difficulty-1-background); color: var(--difficulty-1-text); }
.fixture--difficulty-2 { background: var(--difficulty-2-background); color: var(--difficulty-2-text); }
.fixture--difficulty-3 { background: var(--difficulty-3-background); color: var(--difficulty-3-text); }
.fixture--difficulty-4 { background: var(--difficulty-4-background); color: var(--difficulty-4-text); }
.fixture--difficulty-5 { background: var(--difficulty-5-background); color: var(--difficulty-5-text); }
.fixture-venue { color: var(--muted); font-size: 9px; font-weight: 700; }
.fixture--difficulty-1 .fixture-venue,
.fixture--difficulty-5 .fixture-venue { color: inherit; opacity: .8; }
.fixture--difficulty-2 .fixture-venue,
.fixture--difficulty-3 .fixture-venue,
.fixture--difficulty-4 .fixture-venue { color: inherit; opacity: .7; }
.no-fixtures { color: var(--muted); font-size: 10px; }
.status {
  margin: 16px 0; padding: 25px 18px; border: 1px solid var(--line);
  border-radius: 16px; background: var(--surface); color: var(--muted);
  text-align: center; font-size: 13px;
}
.status strong { display: block; margin-bottom: 5px; color: var(--text); font-size: 15px; }
.retry {
  min-height: 40px; margin-top: 12px; padding: 0 14px; border: 0;
  border-radius: 12px; background: var(--green); color: #062416;
  font-weight: 800; cursor: pointer;
}
.footer { margin-top: 24px; padding-bottom: env(safe-area-inset-bottom); color: var(--muted); text-align: center; font-size: 11px; }
.spinner { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (min-width: 620px) {
  .app { padding: 0 32px 55px; }
  .hero { padding-top: 48px; }
  .toolbar { grid-template-columns: minmax(180px, 1fr) 185px; align-items: center; }
  .filters { grid-column: 1 / -1; grid-row: 2; }
  .player-card { padding: 13px 18px; }
}
@media (max-width: 370px) {
  .app { padding-right: 14px; padding-left: 14px; }
  .summary { padding: 14px; }
  .summary-period { font-size: 17px; }
  .summary-chip { padding: 7px 9px; font-size: 10px; }
  .player-card { gap: 9px; padding: 11px; }
}
