:root {
  color-scheme: dark;
  --bg: #202124;
  --panel: #2b2d31;
  --panel-2: #343740;
  --line: #4b4f58;
  --text: #fff8e7;
  --muted: #bfc6c9;
  --lime: #f4d35e;
  --green: #7bdff2;
  --gold: #f4d35e;
  --red: #ee6352;
  --blue: #7bdff2;
  --shadow: 0 18px 46px rgba(0, 0, 0, 0.24);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  font-size: 15px;
}

body {
  min-height: 100%;
  margin: 0;
  background:
    linear-gradient(rgba(255, 248, 231, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 248, 231, 0.035) 1px, transparent 1px),
    linear-gradient(135deg, rgba(244, 211, 94, 0.08), transparent 34rem),
    var(--bg);
  background-size:
    44px 44px,
    44px 44px,
    auto,
    auto;
  color: var(--text);
  font-family:
    Outfit, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  width: min(1320px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.hero {
  margin-bottom: 18px;
}

.back-link {
  display: inline-flex;
  margin-bottom: 16px;
  color: var(--lime);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.back-link:hover {
  text-decoration: underline;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  gap: 18px;
  align-items: end;
}

.kicker,
.panel-label {
  margin: 0 0 8px;
  color: var(--lime);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: clamp(44px, 8vw, 88px);
  line-height: 0.9;
  letter-spacing: 0;
}

h2 {
  font-size: 22px;
}

.intro {
  max-width: 780px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.55;
}

.policy-panel,
.table-panel,
.control-band {
  border: 1px solid rgba(244, 211, 94, 0.28);
  border-radius: 8px;
  background: rgba(43, 45, 49, 0.92);
  box-shadow: var(--shadow);
}

.policy-panel {
  padding: 18px;
  color: var(--muted);
  line-height: 1.5;
}

.control-band {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 165px), 1fr));
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
  padding: 14px;
}

.control-band > * {
  min-width: 0;
}

.platform-switch {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  grid-column: span 2;
  gap: 4px;
  min-height: 42px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #23252a;
}

.platform-button,
.refresh-button {
  border: 0;
  border-radius: 6px;
  color: var(--text);
  font-weight: 900;
}

.platform-button {
  padding: 8px 12px;
  background: transparent;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.platform-button.is-active {
  background: linear-gradient(135deg, var(--lime), var(--red));
  color: #202124;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.filter-control.is-hidden {
  display: none;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #23252a;
  color: var(--text);
  padding: 9px 10px;
}

input:focus,
select:focus,
button:focus-visible {
  outline: 2px solid rgba(123, 223, 242, 0.78);
  outline-offset: 2px;
}

.refresh-button {
  width: 100%;
  min-height: 42px;
  padding: 9px 14px;
  background: #3b3e45;
  border: 1px solid rgba(244, 211, 94, 0.24);
}

.refresh-button:hover {
  background: #494d56;
}

.table-panel {
  overflow: hidden;
}

.table-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(52, 55, 64, 0.88);
}

.result-count {
  color: var(--muted);
  font-weight: 800;
}

.table-wrap {
  overflow: auto;
  max-height: min(74vh, 900px);
}

table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid rgba(75, 79, 88, 0.72);
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #2f3239;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

tbody tr:hover {
  background: rgba(123, 223, 242, 0.07);
}

.num {
  text-align: right;
}

.player-col,
.player-cell {
  min-width: 180px;
  max-width: 230px;
}

.be-col,
.be-cell {
  width: 86px;
  min-width: 78px;
}

.player-name {
  font-weight: 900;
}

.player-sub {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.team-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 126px;
}

.team-swatch {
  display: inline-block;
  width: 30px;
  height: 18px;
  flex: 0 0 30px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 4px;
  background:
    linear-gradient(135deg, var(--team-primary) 0 52%, transparent 52%),
    var(--team-secondary);
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.22),
    0 4px 10px rgba(0, 0, 0, 0.18);
}

.team-code {
  display: block;
  color: var(--text);
  font-weight: 950;
  line-height: 1;
}

.team-name {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
}

.positions {
  color: var(--text);
  font-weight: 800;
}

.be-value {
  font-size: 18px;
  font-weight: 950;
}

.be-value.good {
  color: var(--blue);
}

.be-value.warn {
  color: var(--gold);
}

.be-value.risk {
  color: var(--red);
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  text-transform: capitalize;
}

.pill.medium {
  background: rgba(123, 223, 242, 0.16);
  color: #a8edfa;
}

.pill.low {
  background: rgba(244, 211, 94, 0.15);
  color: var(--gold);
}

.pill.unavailable {
  background: rgba(238, 99, 82, 0.16);
  color: #ffb9af;
}

.note {
  max-width: 320px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

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

.page-footer {
  padding: 18px 2px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

@media (max-width: 1040px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }

  .platform-switch {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .shell {
    padding: 16px;
  }

  .control-band {
    grid-template-columns: 1fr;
  }

  .platform-switch {
    grid-column: span 1;
  }

  .table-header {
    display: block;
  }

  .result-count {
    margin-top: 8px;
  }

  table {
    min-width: 760px;
  }

  th,
  td {
    padding: 9px 8px;
  }

  .player-col,
  .player-cell {
    min-width: 132px;
    max-width: 150px;
  }

  .be-col,
  .be-cell {
    width: 68px;
    min-width: 64px;
  }

  .player-name,
  .positions,
  .team-code {
    font-size: 13px;
  }

  .player-sub,
  .team-name,
  .note {
    font-size: 11px;
  }

  .be-value {
    font-size: 16px;
  }

  .team-pill {
    min-width: 108px;
    gap: 6px;
  }

  .team-swatch {
    width: 24px;
    height: 16px;
    flex-basis: 24px;
  }
}
