:root {
  color-scheme: dark;
  --ink: #f7f4e8;
  --muted: #b9c2ad;
  --dim: #778474;
  --line: rgba(247, 244, 232, 0.14);
  --panel: rgba(13, 24, 18, 0.86);
  --panel-solid: #111d17;
  --felt: #18764a;
  --felt-dark: #0c3d2a;
  --brass: #d9b563;
  --coral: #ef6f4f;
  --mint: #7be495;
  --danger: #ff8f7d;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: #08100c;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 16% -10%, rgba(239, 111, 79, 0.28), transparent 28rem),
    radial-gradient(circle at 92% 8%, rgba(217, 181, 99, 0.24), transparent 24rem),
    linear-gradient(160deg, #08100c 0%, #102017 38%, #0b1711 100%);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(100%, 820px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 14px 14px calc(34px + env(safe-area-inset-bottom));
}

.topbar {
  position: relative;
  min-height: 244px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-solid);
  box-shadow: var(--shadow);
}

.pitch-art {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px) 50% 50% / 42px 42px,
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), transparent 24%),
    radial-gradient(circle at 50% 50%, transparent 0 62px, rgba(255, 255, 255, 0.18) 63px 65px, transparent 66px),
    linear-gradient(135deg, #116b41, #0b2e22);
}

.pitch-art::before,
.pitch-art::after {
  content: "";
  position: absolute;
  inset: 18px;
  border: 2px solid rgba(247, 244, 232, 0.26);
  border-radius: var(--radius);
}

.pitch-art::after {
  inset: 62px 18px;
  border-left: 0;
  border-right: 0;
  border-radius: 0;
}

.rod {
  position: absolute;
  left: -15%;
  right: -15%;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #d8dee0, #6d7578 38%, #eff4ef 50%, #6d7578 64%, #d8dee0);
  box-shadow: 0 12px 22px rgba(0, 0, 0, 0.28);
  transform: rotate(-12deg);
}

.rod::before,
.rod::after {
  content: "";
  position: absolute;
  top: -16px;
  width: 28px;
  height: 42px;
  border-radius: 7px 7px 4px 4px;
  background: var(--coral);
  box-shadow: 76px 0 var(--ink), 152px 0 var(--brass), 228px 0 var(--coral), 304px 0 var(--ink);
}

.rod::before {
  left: 18%;
}

.rod::after {
  right: 24%;
}

.rod-one {
  top: 38px;
}

.rod-two {
  top: 118px;
  transform: rotate(8deg);
}

.rod-three {
  top: 198px;
}

.ball {
  position: absolute;
  right: 18%;
  bottom: 54px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #fff, #d5ceb7 48%, #6c654c 100%);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.32);
}

.topbar-main {
  position: relative;
  z-index: 1;
  min-height: 244px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 16px;
  padding: 22px;
  background: linear-gradient(180deg, rgba(8, 16, 12, 0.1), rgba(8, 16, 12, 0.86) 68%);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--brass);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  max-width: 12ch;
  font-size: 2.6rem;
  line-height: 0.96;
}

h2 {
  font-size: 1.2rem;
}

.league-switcher {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px 48px;
  gap: 8px;
  align-items: end;
}

.field {
  display: grid;
  gap: 6px;
}

.field span,
.choice-row > span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
}

.field input,
.field select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(247, 244, 232, 0.08);
  color: var(--ink);
  outline: none;
  padding: 0 12px;
}

.field select option {
  color: #111;
}

.compact-field span {
  color: var(--ink);
}

.icon-button,
.text-button,
.wide-button,
.chip {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(247, 244, 232, 0.08);
  color: var(--ink);
}

.icon-button {
  width: 48px;
  display: inline-grid;
  place-items: center;
  padding: 0;
}

.icon-button svg,
.text-button svg,
.wide-button svg {
  width: 18px;
  height: 18px;
}

.primary {
  border-color: rgba(123, 228, 149, 0.48);
  background: linear-gradient(135deg, var(--mint), #2fa36a);
  color: #07110b;
  font-weight: 900;
}

.ghost {
  background: rgba(255, 255, 255, 0.04);
}

main {
  display: grid;
  gap: 18px;
  padding-top: 18px;
}

.overview-band,
.standings-section,
.fixtures-section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.overview-band {
  padding: 12px;
}

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

.metric {
  min-height: 72px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 12px;
  border-radius: var(--radius);
  background: rgba(247, 244, 232, 0.07);
}

.metric span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.metric strong {
  overflow: hidden;
  font-size: 1.15rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-track {
  height: 8px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(247, 244, 232, 0.12);
}

.progress-track span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--coral), var(--brass), var(--mint));
  transition: width 260ms ease;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
}

.mine-field {
  min-width: 128px;
}

.mine-field select {
  min-height: 40px;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(123, 228, 149, 0.12);
  color: var(--mint);
  font-size: 0.78rem;
  font-weight: 900;
}

.live-pill span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 12px currentColor;
}

.live-pill.offline {
  background: rgba(255, 143, 125, 0.12);
  color: var(--danger);
}

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

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

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

.league-table th {
  color: var(--dim);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.league-table th:nth-child(2),
.league-table td:nth-child(2) {
  text-align: left;
}

.position,
.points {
  color: var(--brass);
  font-weight: 900;
}

.player-cell {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
}

.player-cell > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.avatar {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(217, 181, 99, 0.4);
  border-radius: 50%;
  background: rgba(217, 181, 99, 0.14);
  color: var(--brass);
  font-size: 0.78rem;
  font-weight: 900;
}

.positive {
  color: var(--mint);
}

.negative {
  color: var(--danger);
}

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

.segmented.small {
  width: 190px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 0;
}

.segmented button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: rgba(247, 244, 232, 0.07);
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.segmented button.active {
  border-color: rgba(217, 181, 99, 0.52);
  background: rgba(217, 181, 99, 0.16);
  color: var(--ink);
}

.fixtures-list {
  display: grid;
  gap: 10px;
  padding: 0 12px 12px;
}

.fixture-card {
  display: grid;
  gap: 12px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(247, 244, 232, 0.055);
}

.fixture-card.played {
  border-color: rgba(123, 228, 149, 0.24);
}

.fixture-meta,
.fixture-actions,
.score-row,
.choice-row,
.picker-head,
.person-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.fixture-meta {
  color: var(--dim);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.score-row {
  min-height: 54px;
}

.score-row.winner .player-cell {
  color: var(--mint);
}

.score-control {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 38px 48px 38px;
  gap: 4px;
  align-items: center;
}

.score-control .icon-button {
  width: 38px;
  min-height: 38px;
}

.score-control input {
  width: 48px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.18);
  color: var(--ink);
  text-align: center;
  font-weight: 900;
  outline: none;
}

.fixture-actions {
  justify-content: flex-end;
}

.text-button,
.wide-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 13px;
  font-weight: 900;
}

.text-button.compact {
  min-height: 38px;
  padding: 0 10px;
}

.wide-button {
  width: 100%;
}

.sheet {
  width: min(calc(100vw - 20px), 560px);
  margin: auto auto 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #101b15;
  color: var(--ink);
  box-shadow: var(--shadow);
}

.sheet::backdrop {
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(6px);
}

.sheet-body {
  display: grid;
  gap: 16px;
  padding: 16px;
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.picker-head {
  align-items: end;
}

.picker-head .field {
  flex: 1;
}

.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 210px;
  overflow: auto;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 5px;
  font-weight: 800;
}

.chip.selected {
  border-color: rgba(123, 228, 149, 0.55);
  background: rgba(123, 228, 149, 0.13);
}

.selected-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 34px;
}

.selected-strip span {
  padding: 7px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

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

.person-row {
  flex-wrap: wrap;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.045);
}

.person-row.in-current {
  border-color: rgba(123, 228, 149, 0.22);
}

.person-row input {
  min-width: 120px;
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--ink);
  outline: none;
}

.status-pill {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  border-radius: 999px;
  background: rgba(123, 228, 149, 0.12);
  color: var(--mint);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.empty-block {
  display: grid;
  gap: 6px;
  padding: 18px;
  color: var(--muted);
  text-align: center;
}

.empty-block strong {
  color: var(--ink);
}

.toast {
  position: fixed;
  left: 14px;
  right: 14px;
  bottom: calc(14px + env(safe-area-inset-bottom));
  z-index: 10;
  max-width: 540px;
  margin: 0 auto;
  padding: 12px 14px;
  border: 1px solid rgba(217, 181, 99, 0.4);
  border-radius: var(--radius);
  background: rgba(16, 27, 21, 0.96);
  color: var(--ink);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 160ms ease, transform 160ms ease;
  pointer-events: none;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (min-width: 680px) {
  .app-shell {
    padding-top: 24px;
  }

  h1 {
    font-size: 3.5rem;
  }

  .metric-row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .fixtures-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 420px) {
  .app-shell {
    padding-left: 10px;
    padding-right: 10px;
  }

  .topbar-main {
    padding: 18px;
  }

  h1 {
    font-size: 2.24rem;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .mine-field {
    width: 100%;
  }

  .segmented {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .score-row {
    align-items: stretch;
    flex-direction: column;
  }

  .score-control {
    align-self: stretch;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
  }

  .score-control input {
    width: 100%;
  }
}
