:root {
  color-scheme: light;
  --bg: #F4F4F1;
  --panel: #FFFFFF;
  --panel-2: #E8E8E2;
  --line: #D9D9D2;
  --text: #111111;
  --muted: #6B6B6B;
  --accent: #25C26E;
  --accent-2: #25C26E;
  --gold: #f6c453;
  --silver: #cbd5e1;
  --bronze: #d98b5f;
  --danger: #E64B3C;
  --warn: #F4C542;
  --radius: 24px;
  --gap: 12px;
  --safe-x: 20px;
  --shadow: 0 18px 38px rgba(17, 17, 17, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html {
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

button, input, select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.ds-app {
  min-height: 100vh;
  padding: max(18px, env(safe-area-inset-top)) var(--safe-x) calc(92px + env(safe-area-inset-bottom));
}

.ds-main {
  width: min(100%, 680px);
  margin: 0 auto;
  display: grid;
  gap: var(--gap);
}

.ds-page-header {
  display: grid;
  gap: 6px;
  padding: 8px 0 4px;
}

.ds-page-header h2 {
  margin: 0;
  color: var(--text);
  font-size: 2.15rem;
  line-height: 0.96;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.ds-page-header p,
.ds-muted {
  margin: 0;
  color: var(--muted);
}

.ds-eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.ds-card {
  display: grid;
  gap: var(--gap);
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.ds-home {
  display: grid;
  gap: var(--gap);
}

.ds-predictions {
  display: grid;
  gap: var(--gap);
}

.ds-playoffs {
  display: grid;
  gap: var(--gap);
}

.ds-hero-card {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  background: var(--text);
  color: var(--panel);
  overflow: hidden;
}

.ds-hero-card .ds-muted,
.ds-hero-card .ds-eyebrow {
  color: rgba(255, 255, 255, 0.68);
}

.ds-hero-number {
  margin-top: 4px;
  font-size: clamp(4.6rem, 22vw, 7.5rem);
  line-height: 0.86;
  font-weight: 950;
  letter-spacing: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.ds-hero-rank {
  display: grid;
  justify-items: end;
  gap: 2px;
  min-width: 72px;
}

.ds-hero-rank span {
  font-size: 2rem;
  line-height: 1;
  font-weight: 950;
}

.ds-hero-rank small {
  color: rgba(255, 255, 255, 0.68);
  font-weight: 750;
}

.ds-stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
}

.ds-stat {
  display: grid;
  gap: 4px;
  padding: 18px;
  min-height: 132px;
  align-content: space-between;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.ds-stat span,
.ds-stat small {
  color: var(--muted);
  font-weight: 750;
}

.ds-stat strong {
  color: var(--text);
  font-size: clamp(2.5rem, 12vw, 4.25rem);
  line-height: 0.9;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.ds-fixture-block {
  gap: 16px;
}

.ds-fixture-main {
  display: grid;
  gap: 8px;
}

.ds-fixture-main p {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.ds-fixture-footer {
  display: grid;
  gap: var(--gap);
}

.ds-fixture-footer span {
  color: var(--muted);
  font-weight: 800;
}

.ds-fixture-list {
  display: grid;
  gap: var(--gap);
}

.ds-prediction-summary {
  gap: 16px;
}

.ds-select-label {
  display: grid;
  gap: 8px;
}

.ds-select-label span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.ds-select-label select {
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--text);
  font-weight: 900;
}

.ds-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(37, 194, 110, 0.16);
  color: #126b3d;
  font-size: 0.78rem;
  font-weight: 900;
}

.ds-pill.locked {
  background: var(--panel-2);
  color: var(--muted);
}

.ds-prediction-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-weight: 800;
  flex-wrap: wrap;
}

.ds-primary {
  width: 100%;
  min-height: 52px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--text);
  font-weight: 900;
}

.ds-prediction-input {
  display: grid;
  grid-template-columns: 44px auto 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--panel-2);
  font-weight: 950;
}

.ds-prediction-input input {
  width: 44px;
  min-height: 38px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  text-align: center;
  font-size: 1.35rem;
  font-weight: 950;
}

.ds-prediction-input.disabled {
  opacity: 0.62;
}

.ds-prediction-input input:disabled {
  opacity: 1;
}

.ds-block-heading {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
  min-width: 0;
}

.ds-block-heading h3 {
  margin: 2px 0 0;
  font-size: 1.45rem;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.ds-block-heading > div {
  min-width: 0;
}

.ds-text-button {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 900;
}

.ds-mini-list {
  display: grid;
  gap: 8px;
}

.ds-mini-list button {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.ds-mini-list span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--panel-2);
  font-weight: 950;
}

.ds-mini-list em {
  font-style: normal;
  font-size: 1.55rem;
  font-weight: 950;
}

.ds-podium {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
}

.ds-podium-player {
  display: grid;
  justify-items: center;
  align-content: end;
  gap: 8px;
  min-width: 0;
  min-height: 128px;
  padding: 14px 8px;
  border-radius: 22px;
  background: var(--panel-2);
  color: var(--text);
  text-align: center;
}

.ds-podium-player.place-1 {
  min-height: 168px;
  background: var(--gold);
  color: var(--text);
  order: 2;
}

.ds-podium-player.place-2 {
  min-height: 142px;
  background: var(--silver);
  order: 1;
}

.ds-podium-player.place-3 {
  background: var(--bronze);
  order: 3;
}

.ds-podium-player span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  font-size: 1.25rem;
  font-weight: 950;
}

.ds-podium-player.place-1 span {
  background: rgba(255, 255, 255, 0.72);
}

.ds-podium-player strong {
  max-width: 100%;
  font-size: 0.9rem;
  line-height: 1.05;
  overflow-wrap: normal;
  word-break: normal;
}

.ds-podium-player em {
  font-style: normal;
  color: rgba(17, 17, 17, 0.68);
  font-size: 0.78rem;
  font-weight: 900;
}

.ds-podium-player.place-1 em {
  color: rgba(17, 17, 17, 0.68);
}

.ds-bottom-nav {
  position: fixed;
  left: max(12px, env(safe-area-inset-left));
  right: max(12px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 15;
  width: min(680px, calc(100% - 24px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow);
}

.ds-bottom-nav button {
  display: grid;
  place-items: center;
  gap: 2px;
  min-width: 0;
  min-height: 48px;
  padding: 6px 4px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 850;
  overflow: hidden;
}

.ds-bottom-nav span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ds-bottom-nav button.active {
  background: var(--text);
  color: var(--panel);
}

.ds-bottom-nav svg {
  width: 18px;
  height: 18px;
}

.app {
  min-height: 100vh;
  padding: max(18px, env(safe-area-inset-top)) 16px max(18px, env(safe-area-inset-bottom));
}

.shell {
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  gap: 18px;
}

.sidebar {
  position: sticky;
  top: 18px;
  align-self: start;
  min-height: calc(100vh - 36px);
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.brand {
  display: grid;
  gap: 4px;
  margin-bottom: 18px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--accent);
  color: var(--text);
  font-weight: 900;
  letter-spacing: 0;
}

.brand h1 {
  margin: 0;
  font-size: 1.16rem;
  line-height: 1.1;
}

.brand p, .muted {
  margin: 0;
  color: var(--muted);
}

.nav {
  display: grid;
  gap: 8px;
}

.nav button, .tab, .chip, .primary, .secondary, .danger, .ghost {
  min-height: 40px;
  border-radius: var(--radius);
  color: var(--text);
}

.nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  text-align: left;
}

.nav button.active, .nav button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.nav svg, .icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.primary svg, .secondary svg, .danger svg, .ghost svg, .chip svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.account-card {
  margin-top: 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
}

.main {
  display: grid;
  gap: 18px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.topbar h2 {
  margin: 0;
  font-size: clamp(1.45rem, 2.4vw, 2.3rem);
  letter-spacing: 0;
}

.section {
  display: grid;
  gap: 14px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tab, .chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
}

.tab.active, .chip.good {
  background: rgba(37, 194, 110, 0.16);
  border-color: rgba(37, 194, 110, 0.38);
  color: #126b3d;
}

.chip.warn {
  background: rgba(244, 197, 66, 0.24);
  border-color: rgba(244, 197, 66, 0.48);
  color: #6f5705;
}

.chip.bad {
  background: rgba(230, 75, 60, 0.12);
  border-color: rgba(230, 75, 60, 0.34);
  color: #9e2419;
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 14px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-pad {
  padding: 16px;
}

.stat {
  grid-column: span 3;
}

.stat strong {
  display: block;
  margin-top: 5px;
  font-size: 1.5rem;
}

.leader-list {
  display: grid;
  gap: 10px;
}

.leaderboard-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
}

.gameweek-picker {
  display: grid;
  gap: 12px;
}

.gameweek-picker select {
  width: 100%;
}

.gameweek-picker.compact {
  min-width: min(360px, 100%);
}

.gameweek-picker.compact label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
}

.gameweek-list {
  max-height: 260px;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 6px;
  padding-right: 4px;
}

.gameweek-list button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 38px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  text-align: left;
}

.gameweek-list button.active {
  background: rgba(33, 208, 122, 0.16);
  border-color: rgba(33, 208, 122, 0.42);
}

.gameweek-list small {
  color: var(--muted);
  font-weight: 700;
}

.leaderboard-results {
  display: grid;
  gap: 12px;
}

.leader-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  min-width: 0;
}

.leader-row > div,
.leader-row strong {
  min-width: 0;
  overflow-wrap: normal;
  word-break: normal;
}

.leader-row.top-1 { border-color: rgba(246, 196, 83, 0.55); background: rgba(246, 196, 83, 0.18); }
.leader-row.top-2 { border-color: rgba(107, 107, 107, 0.20); background: rgba(232, 232, 226, 0.68); }
.leader-row.top-3 { border-color: rgba(217, 139, 95, 0.34); background: rgba(217, 139, 95, 0.14); }

.rank {
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--panel-2);
  font-weight: 900;
}

.leader-row.top-1 .rank { background: var(--gold); color: #151007; }
.leader-row.top-2 .rank { background: var(--silver); color: #0c1117; }
.leader-row.top-3 .rank { background: var(--bronze); color: #130905; }

.fixture {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 16px;
  min-width: 0;
}

.teams {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.teams strong {
  font-size: 1.08rem;
  overflow-wrap: normal;
  word-break: normal;
}

.score-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
}

.score-inputs input, input, select {
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  min-height: 40px;
  padding: 9px 10px;
}

.score-inputs input {
  width: 58px;
  text-align: center;
  font-weight: 800;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  min-width: 0;
}

.primary {
  background: var(--accent);
  color: var(--text);
  font-weight: 850;
  padding: 10px 13px;
}

.secondary {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  padding: 10px 13px;
}

.danger {
  background: rgba(230, 75, 60, 0.12);
  color: #9e2419;
  border: 1px solid rgba(230, 75, 60, 0.34);
  padding: 10px 13px;
}

.ghost {
  background: var(--panel-2);
  border: 1px solid var(--line);
  padding: 10px 13px;
}

.history-row, .result-row, .admin-row {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.fixture-overrides, .manual-overrides {
  display: grid;
  gap: 10px;
}

.fixture-overrides > summary, .manual-overrides > summary {
  color: var(--muted);
  cursor: pointer;
  min-height: 38px;
  display: flex;
  align-items: center;
}

.fixture-overrides[open], .manual-overrides[open] {
  padding-top: 8px;
}

.line-row {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  min-width: 0;
}

.line-row > * {
  min-width: 0;
}

.prediction-table {
  width: 100%;
  border-collapse: collapse;
}

.prediction-table th, .prediction-table td {
  padding: 10px;
  border-top: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.prediction-table th {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.table-card {
  overflow-x: auto;
}

.league-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.league-table th, .league-table td {
  padding: 12px 10px;
  border-top: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.league-table th {
  color: var(--muted);
  font-size: 0.8rem;
}

.position-cell {
  width: 44px;
  font-weight: 900;
}

.team-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 190px;
  max-width: 100%;
  overflow-wrap: normal;
  word-break: normal;
}

.team-cell.mini {
  min-width: 0;
  flex: 0 1 auto;
  max-width: min(190px, 100%);
}

.team-cell strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-cell img, .crest-fallback {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  object-fit: contain;
  flex: 0 0 28px;
}

.crest-fallback {
  display: grid;
  place-items: center;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
}

.fixture-teams {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}

.result-matrix .fixture-teams {
  flex-wrap: nowrap;
}

.fixture-teams .versus {
  color: var(--muted);
  font-weight: 800;
}

.result-matrix {
  min-width: 960px;
}

.result-matrix td:not(:first-child), .result-matrix th:not(:first-child) {
  white-space: nowrap;
}

.result-matrix td .chip {
  margin-top: 6px;
  min-height: 30px;
  padding: 5px 8px;
}

.result-matrix .chip.in-play {
  box-shadow: inset 0 0 0 2px rgba(244, 197, 66, 0.55);
}

.result-total-row td {
  background: var(--panel-2);
  border-top: 2px solid var(--text);
}

.history-table {
  min-width: 680px;
}

.form-strip {
  display: flex;
  gap: 4px;
}

.form-dot {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 900;
}

.form-dot.good { background: rgba(37, 194, 110, 0.16); color: #126b3d; }
.form-dot.warn { background: rgba(244, 197, 66, 0.24); color: #6f5705; }
.form-dot.bad { background: rgba(230, 75, 60, 0.12); color: #9e2419; }

.ds-playoff-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap);
}

.ds-draft-list {
  display: grid;
  gap: 8px;
}

.ds-draft-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) minmax(88px, auto);
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
}

.ds-draft-row.current {
  border-color: rgba(37, 194, 110, 0.48);
  background: rgba(37, 194, 110, 0.1);
}

.ds-draft-row span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--panel-2);
  font-weight: 950;
}

.ds-draft-row div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.ds-draft-row strong,
.ds-draft-row em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ds-draft-row small {
  color: var(--muted);
  font-weight: 800;
}

.ds-draft-row em {
  color: var(--muted);
  font-style: normal;
  font-weight: 900;
  text-align: right;
}

.ds-team-pick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.ds-team-pick {
  display: grid;
  justify-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 150px;
  padding: 14px 10px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  color: var(--text);
  text-align: center;
}

.ds-team-pick.mine {
  border-color: rgba(37, 194, 110, 0.48);
  background: rgba(37, 194, 110, 0.12);
}

.ds-team-pick span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--panel-2);
  font-weight: 950;
}

.ds-team-pick img,
.ds-team-pick .crest-fallback {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: contain;
}

.ds-team-pick strong {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ds-team-pick small {
  color: var(--muted);
  font-weight: 900;
}

.ds-bracket {
  display: grid;
  gap: 8px;
}

.ds-bracket-match {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
}

.ds-bracket-match > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.ds-bracket-match > div:first-child > span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.ds-bracket-teams {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
}

.ds-bracket-teams .team-cell {
  min-width: 0;
}

.ds-tbd {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  font-weight: 900;
  white-space: nowrap;
}

.api-form {
  margin-top: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.api-form .actions, .api-form .check-row {
  grid-column: 1 / -1;
}

.check-row {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: center;
}

.check-row input {
  min-height: auto;
  width: auto;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.58);
  z-index: 20;
}

.modal {
  width: min(760px, 100%);
  max-height: min(780px, 88vh);
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.auth-panel {
  width: min(460px, 100%);
  padding: 22px;
}

.form {
  display: grid;
  gap: 10px;
}

.form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.empty {
  padding: 28px 18px;
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  padding: 12px 14px;
  background: var(--text);
  color: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-weight: 750;
}

@media (max-width: 820px) {
  .ds-main {
    max-width: 520px;
  }
  .app { padding-inline: 10px; }
  .shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
    min-height: auto;
    padding: 12px;
  }
  .brand {
    grid-template-columns: 42px minmax(0, 1fr);
    align-items: center;
  }
  .nav {
    display: flex;
    overflow-x: auto;
    padding-bottom: 4px;
  }
  .nav button {
    width: auto;
    white-space: nowrap;
  }
  .account-card {
    display: none;
  }
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }
  .stat {
    grid-column: span 6;
  }
  .gameweek-list {
    grid-template-columns: 1fr;
  }
  .fixture {
    grid-template-columns: 1fr;
  }
  .score-inputs {
    justify-content: space-between;
  }
}

@media (max-width: 520px) {
  :root {
    --safe-x: 16px;
  }
  .ds-app {
    padding-bottom: calc(86px + env(safe-area-inset-bottom));
  }
  .ds-page-header h2 {
    font-size: 1.9rem;
  }
  .ds-card {
    padding: 18px;
  }
  .ds-hero-card {
    grid-template-columns: 1fr;
    align-items: start;
  }
  .ds-hero-rank {
    justify-items: start;
    min-width: 0;
  }
  .ds-hero-number {
    font-size: clamp(3.8rem, 25vw, 5.4rem);
  }
  .ds-podium {
    gap: 6px;
  }
  .ds-podium-player {
    min-height: 118px;
    padding: 12px 6px;
  }
  .ds-podium-player.place-1 {
    min-height: 150px;
  }
  .ds-podium-player.place-2 {
    min-height: 132px;
  }
  .ds-podium-player strong {
    font-size: 0.78rem;
  }
  .ds-podium-player em {
    font-size: 0.7rem;
  }
  .ds-bottom-nav {
    width: min(680px, calc(100% - 16px));
    left: max(8px, env(safe-area-inset-left));
    right: max(8px, env(safe-area-inset-right));
    bottom: max(8px, env(safe-area-inset-bottom));
    padding: 7px;
  }
  .ds-bottom-nav button {
    min-height: 44px;
    font-size: 0.58rem;
  }
  .ds-team-pick-grid {
    grid-template-columns: 1fr;
  }
  .ds-draft-row {
    grid-template-columns: 38px minmax(0, 1fr);
  }
  .ds-draft-row em {
    grid-column: 2;
    text-align: left;
  }
  .ds-bottom-nav svg {
    width: 17px;
    height: 17px;
  }
  .stat {
    grid-column: span 12;
  }
  .leader-row {
    grid-template-columns: 40px minmax(0, 1fr) auto;
  }
  .split {
    grid-template-columns: 1fr;
  }
  .prediction-table {
    font-size: 0.88rem;
  }
  .api-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 390px) {
  .ds-bottom-nav button {
    min-height: 42px;
  }
  .ds-bottom-nav span {
    display: none;
  }
  .ds-podium-player span {
    width: 32px;
    height: 32px;
    font-size: 1rem;
  }
  .ds-stat-grid {
    grid-template-columns: 1fr;
  }
}
