:root {
  --bg: #f3f7f7;
  --panel: #ffffff;
  --brand-bg: #fcfcfc;
  --ink: #071b33;
  --muted: #657483;
  --line: #d5e4e7;
  --accent: #00aeba;
  --accent-dark: #047783;
  --xi: #74d80c;
  --xi-dark: #4b9e07;
  --warn: #a34d00;
  --good: #1b8f42;
  --shadow: 0 10px 28px rgba(7, 27, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 12px clamp(16px, 3vw, 40px);
  flex-wrap: wrap;
  border-bottom: 1px solid #f0f2f4;
  background: var(--brand-bg);
  color: var(--ink);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  min-width: 0;
}

.brand-logo {
  width: 58px;
  height: 58px;
  border-radius: 10px;
  display: block;
  object-fit: cover;
}

.brand-title {
  display: flex;
  align-items: baseline;
  gap: 5px;
  margin: 0;
  font-size: clamp(1.35rem, 2vw, 1.8rem);
  font-style: italic;
  font-weight: 950;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}

.brand-fpl {
  color: var(--ink);
}

.brand-engine {
  color: var(--accent-dark);
}

.brand-xi {
  color: var(--xi-dark);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.eyebrow {
  margin: 0 0 4px;
  color: #9ad4cc;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  font-size: clamp(1.8rem, 4vw, 3rem);
}

h2 {
  font-size: 1.05rem;
}

.status {
  margin-left: auto;
  min-width: 120px;
  padding: 10px 14px;
  border: 1px solid rgba(0, 174, 186, 0.25);
  border-radius: 6px;
  color: #06364f;
  background: rgba(0, 174, 186, 0.06);
  text-align: center;
}

.shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 24px clamp(14px, 2vw, 32px) 40px;
}

.tabs {
  display: flex;
  gap: 8px;
  justify-content: flex-start;
  margin: 0;
  overflow-x: auto;
  flex: 0 1 auto;
  min-width: min-content;
  scrollbar-width: thin;
}

.tab {
  flex: 0 0 max-content;
  border: 1px solid rgba(0, 174, 186, 0.35);
  background: rgba(0, 174, 186, 0.08);
  color: var(--accent-dark);
  font-weight: 800;
}

.tab.active {
  border-color: var(--xi);
  color: #071b33;
  background: var(--xi);
  box-shadow: 0 8px 18px rgba(116, 216, 12, 0.22);
}

.view {
  display: none;
  margin-bottom: 14px;
}

.view.active {
  display: block;
}

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

.controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr)) auto;
  align-items: end;
  gap: 14px;
  padding: 16px;
  margin-bottom: 14px;
}

.team-load-controls {
  grid-template-columns: minmax(220px, 420px) auto auto;
  justify-content: start;
}

.team-settings-controls {
  grid-template-columns: repeat(4, minmax(120px, 1fr));
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.label-with-info {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.info-tip {
  position: relative;
  display: inline-grid;
  width: 17px;
  height: 17px;
  place-items: center;
  border: 1px solid rgba(0, 174, 186, 0.55);
  border-radius: 50%;
  color: var(--accent-dark);
  background: rgba(0, 174, 186, 0.08);
  cursor: help;
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1;
}

.info-tip::after {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  z-index: 20;
  width: min(320px, calc(100vw - 32px));
  padding: 9px 10px;
  border: 1px solid rgba(7, 27, 51, 0.12);
  border-radius: 6px;
  color: #ffffff;
  background: #071b33;
  box-shadow: 0 12px 28px rgba(7, 27, 51, 0.18);
  content: attr(data-tooltip);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 120ms ease, transform 120ms ease;
}

.info-tip:hover::after,
.info-tip:focus::after {
  opacity: 1;
  transform: translateY(0);
}

.table-info-tip {
  margin-left: 4px;
  vertical-align: text-bottom;
}

.table-info-tip::after {
  content: none;
}

.floating-tooltip {
  position: fixed;
  z-index: 200;
  max-width: min(320px, calc(100vw - 20px));
  padding: 9px 10px;
  border: 1px solid rgba(7, 27, 51, 0.12);
  border-radius: 6px;
  color: #ffffff;
  background: #071b33;
  box-shadow: 0 12px 28px rgba(7, 27, 51, 0.18);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.35;
  pointer-events: none;
}

.floating-tooltip[hidden] {
  display: none;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--ink);
  background: white;
  font: inherit;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 174, 186, 0.16);
  outline: none;
}

button {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  padding: 0 16px;
  font-weight: 800;
  cursor: pointer;
}

.primary {
  color: #071b33;
  background: var(--xi);
  box-shadow: 0 8px 18px rgba(116, 216, 12, 0.18);
}

.primary:hover {
  background: #8bf018;
}

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

.metric {
  display: grid;
  gap: 6px;
  padding: 16px;
}

.metric span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.metric strong {
  font-size: 1.65rem;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 14px;
  margin-bottom: 14px;
}

.team-layout {
  display: grid;
  gap: 14px;
}

.chip-list {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.chip-summary {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
}

.chip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}

.chip-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.chip-card.good {
  border-color: rgba(116, 216, 12, 0.7);
  background: #f5ffe9;
}

.chip-card.watch {
  border-color: rgba(0, 174, 186, 0.4);
  background: #f1fcfd;
}

.chip-card.muted {
  opacity: 0.72;
}

.chip-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.chip-card-head strong {
  color: var(--ink);
}

.chip-card-head span {
  flex: 0 0 auto;
  padding: 2px 7px;
  border-radius: 999px;
  color: var(--accent-dark);
  background: rgba(0, 174, 186, 0.12);
  font-size: 0.72rem;
  font-weight: 850;
}

.chip-available-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.chip-available-toggle input {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
}

.chip-meter {
  overflow: hidden;
  height: 8px;
  border-radius: 999px;
  background: rgba(7, 27, 51, 0.1);
}

.chip-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--xi));
}

.chip-score {
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 850;
}

.chip-future-outlook {
  display: grid;
  gap: 8px;
  font-size: 0.76rem;
}

.chip-future-outlook h3 {
  margin: 2px 0 0;
  color: var(--ink);
  font-size: 0.86rem;
}

.chip-future-table {
  display: grid;
  grid-template-columns: 46px repeat(4, minmax(70px, 1fr));
  gap: 1px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.chip-future-table > * {
  padding: 6px 8px;
  background: #ffffff;
  white-space: nowrap;
}

.chip-future-table > :nth-child(-n + 5) {
  color: var(--accent-dark);
  font-weight: 900;
}

.chip-wait-model {
  display: grid;
  gap: 8px;
  font-size: 0.76rem;
}

.chip-wait-model h3 {
  margin: 2px 0 0;
  color: var(--ink);
  font-size: 0.86rem;
}

.chip-wait-grid {
  display: grid;
  grid-template-columns: minmax(110px, 1.1fr) repeat(5, minmax(70px, 1fr)) minmax(130px, 1.2fr);
  gap: 1px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.chip-wait-grid > * {
  padding: 6px 8px;
  background: #ffffff;
  white-space: nowrap;
}

.chip-wait-grid > :nth-child(-n + 7) {
  color: var(--accent-dark);
  font-weight: 900;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid rgba(0, 174, 186, 0.18);
}

.section-head span {
  color: var(--muted);
  font-size: 0.86rem;
}

.section-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.small-button {
  min-height: 30px;
  padding: 5px 10px;
  font-size: 0.76rem;
}

.section-note {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 650;
  line-height: 1.35;
}

.section-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.model-inputs {
  display: grid;
  gap: 5px;
  padding: 0 16px 16px;
  color: var(--muted);
}

.model-inputs h3 {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.model-inputs ul {
  display: grid;
  gap: 2px;
  margin: 0;
  padding-left: 16px;
}

.model-inputs li {
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.35;
}

.loading-block {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 850;
}

.pitch-loading {
  width: 100%;
  min-height: 180px;
  justify-content: center;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 3px solid rgba(0, 174, 186, 0.18);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 780ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.player-filters {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  min-width: min(100%, 560px);
}

.player-filters input {
  flex: 1 1 220px;
}

.player-filters select {
  flex: 0 1 150px;
}

.table-pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 16px 16px;
  border-top: 1px solid rgba(0, 174, 186, 0.12);
}

.table-pager span {
  margin-right: auto;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.table-pager label {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
}

.table-pager select {
  width: auto;
  min-width: 84px;
}

.gw-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.gw-controls span {
  min-width: 120px;
  color: var(--muted);
  font-size: 0.86rem;
  text-align: center;
}

.secondary {
  border: 1px solid rgba(0, 174, 186, 0.35);
  color: var(--accent-dark);
  background: rgba(0, 174, 186, 0.06);
}

.secondary:disabled {
  color: #98a2b3;
  cursor: not-allowed;
  background: #f2f4f7;
}

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

.team-pitch {
  padding: 16px;
}

.pitch-surface {
  display: grid;
  container-type: inline-size;
  gap: 10px;
  width: min(100%, 720px);
  margin: 0 auto;
  padding: 14px;
  border: 1px solid rgba(0, 174, 186, 0.3);
  border-radius: 8px;
  background: #eef7f4;
}

.pitch-field {
  position: relative;
  display: grid;
  --pitch-line: rgba(255, 255, 255, 0.68);
  --half-pitch-height: 77.21cqw;
  --goal-width: 10.76cqw;
  --goal-area-width: 26.94cqw;
  --goal-area-depth: 8.09cqw;
  --penalty-area-width: 59.29cqw;
  --penalty-area-depth: 24.26cqw;
  --penalty-spot-top: 16.18cqw;
  --arc-size: 26.91cqw;
  --arc-half-size: 13.45cqw;
  gap: 10px;
  height: var(--half-pitch-height);
  min-height: 0;
  padding: 44px 14px 28px;
  overflow: hidden;
  border-radius: 8px;
  background:
    repeating-linear-gradient(180deg, rgba(22, 132, 92, 0.55) 0 12.87cqw, rgba(10, 91, 70, 0.55) 12.87cqw 25.74cqw),
    linear-gradient(180deg, #147c58 0%, #0f6c51 48%, #0a5a46 100%);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.28);
}

.pitch-field::before,
.pitch-field::after {
  content: none;
}

.pitch-markings,
.pitch-markings span {
  position: absolute;
  pointer-events: none;
}

.pitch-markings {
  inset: 0;
  z-index: 0;
}

.pitch-goal-area {
  top: 0;
  left: 50%;
  width: var(--goal-area-width);
  height: var(--goal-area-depth);
  border: 2px solid var(--pitch-line);
  border-top: 0;
  transform: translateX(-50%);
}

.pitch-penalty-area {
  top: 0;
  left: 50%;
  width: var(--penalty-area-width);
  height: var(--penalty-area-depth);
  border: 2px solid var(--pitch-line);
  border-top: 0;
  transform: translateX(-50%);
}

.pitch-penalty-spot {
  top: var(--penalty-spot-top);
  left: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--pitch-line);
  transform: translate(-50%, -50%);
}

.pitch-penalty-arc {
  top: calc(var(--penalty-spot-top) - var(--arc-half-size));
  left: 50%;
  width: var(--arc-size);
  height: var(--arc-size);
  border: 2px solid var(--pitch-line);
  border-radius: 50%;
  clip-path: inset(80% 0 0 0);
  transform: translateX(-50%);
}

.pitch-halfway-line {
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  background: var(--pitch-line);
}

.pitch-centre-circle {
  bottom: calc(-1 * var(--arc-half-size));
  left: 50%;
  width: var(--arc-size);
  height: var(--arc-size);
  border: 2px solid var(--pitch-line);
  border-radius: 50%;
  transform: translateX(-50%);
}

.pitch-line {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 6px;
  align-content: center;
}

.pitch-line-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.pitch-slots {
  display: grid;
  grid-template-columns: repeat(var(--slots), minmax(86px, 132px));
  gap: 8px;
  align-items: stretch;
  justify-content: center;
}

.pitch-player {
  position: relative;
  display: grid;
  align-content: center;
  gap: 3px;
  min-height: 62px;
  min-width: 0;
  padding: 6px 7px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  color: #071b33;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 18px rgba(7, 27, 51, 0.16);
  text-align: center;
  cursor: pointer;
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease,
    transform 140ms ease;
}

.pitch-player:not(.pitch-player-empty):hover,
.pitch-player:not(.pitch-player-empty):focus-visible,
.pitch-player.selected {
  border-color: var(--xi);
  background: linear-gradient(180deg, #efffdb, #dff8c2);
  box-shadow:
    0 0 0 3px rgba(116, 216, 12, 0.32),
    0 9px 20px rgba(7, 27, 51, 0.18);
  outline: none;
  transform: translateY(-1px);
}

.slot-action-menu {
  position: fixed;
  top: var(--slot-menu-top, 12px);
  left: var(--slot-menu-left, 12px);
  z-index: 140;
  display: flex;
  align-items: center;
  gap: 4px;
  width: max-content;
  max-width: var(--slot-menu-max-width, min(360px, calc(100vw - 32px)));
  padding: 6px;
  border: 1px solid rgba(0, 174, 186, 0.34);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(7, 27, 51, 0.22);
}

.slot-action-menu.team-menu {
  gap: 6px;
  max-width: var(--slot-menu-max-width, min(560px, calc(100vw - 32px)));
}

.slot-action-menu.xi-menu {
  max-width: var(--slot-menu-max-width, min(260px, calc(100vw - 32px)));
}

.slot-action-menu.availability-menu-open {
  max-width: var(--slot-menu-max-width, min(440px, calc(100vw - 32px)));
}

.slot-action-menu[hidden] {
  display: none;
}

.slot-action-menu::after {
  position: absolute;
  left: var(--slot-menu-arrow-left, 50%);
  bottom: -6px;
  width: 10px;
  height: 10px;
  border-right: 1px solid rgba(0, 174, 186, 0.34);
  border-bottom: 1px solid rgba(0, 174, 186, 0.34);
  background: #ffffff;
  content: "";
  transform: translateX(-50%) rotate(45deg);
}

.slot-action-menu.below::after {
  top: -6px;
  bottom: auto;
  border: 0;
  border-top: 1px solid rgba(0, 174, 186, 0.34);
  border-left: 1px solid rgba(0, 174, 186, 0.34);
}

.slot-action-menu button {
  position: relative;
  z-index: 1;
  min-height: 28px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--accent-dark);
  background: #f7fcfd;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 850;
  white-space: nowrap;
}

.slot-action-menu button:hover,
.slot-action-menu button:focus-visible {
  border-color: var(--xi);
  color: var(--ink);
  background: rgba(116, 216, 12, 0.18);
  outline: none;
}

.slot-menu-availability {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.pitch-role-badge {
  position: absolute;
  top: 4px;
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 50%;
  color: #071b33;
  background: var(--xi);
  box-shadow: 0 2px 6px rgba(7, 27, 51, 0.2);
  font-size: 0.78rem;
  font-weight: 950;
  line-height: 1;
}

.captain-badge {
  right: 5px;
}

.vice-captain-badge {
  left: 5px;
  background: #ffffff;
  border: 1px solid rgba(0, 174, 186, 0.42);
  color: var(--accent-dark);
}

.pitch-player-top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 0;
}

.availability-warning {
  position: relative;
  display: inline-grid;
  flex: 0 0 auto;
  width: 17px;
  height: 15px;
  place-items: end center;
  clip-path: polygon(50% 0, 0 100%, 100% 100%);
  color: #ffffff;
  cursor: help;
  font-size: 0.72rem;
  font-weight: 950;
  line-height: 1;
  outline: none;
}

.availability-warning:focus-visible {
  box-shadow: 0 0 0 3px rgba(0, 174, 186, 0.28);
}

.availability-yellow {
  color: #071b33;
  background: #ffd85a;
}

.availability-red {
  background: #c20d3d;
}

.pitch-player strong {
  overflow: hidden;
  font-size: 0.74rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pitch-player span,
.pitch-player small {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pitch-player-empty {
  border-style: dashed;
  color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.12);
  box-shadow: none;
  cursor: default;
}

.pitch-player-empty span {
  color: rgba(255, 255, 255, 0.72);
}

.bench-area {
  position: relative;
  padding: 24px 12px 12px;
  border: 1px solid rgba(7, 27, 51, 0.12);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(232, 240, 239, 0.92)),
    repeating-linear-gradient(90deg, rgba(7, 27, 51, 0.08) 0 1px, transparent 1px 34px);
  box-shadow: inset 0 5px 0 rgba(0, 174, 186, 0.22);
}

.bench-area::before {
  position: absolute;
  top: 7px;
  left: 14px;
  color: var(--muted);
  content: "Bench";
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.pitch-row-bench .pitch-player {
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 5px 12px rgba(7, 27, 51, 0.1);
}

.pitch-row-bench .pitch-player-empty {
  border-color: rgba(7, 27, 51, 0.18);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.45);
}

.pitch-row-bench .pitch-player-empty span {
  color: var(--muted);
}

.pitch-empty {
  padding: 24px;
  color: var(--muted);
}

.squad-actions {
  display: grid;
  gap: 12px;
  padding: 14px 16px 16px;
  border-top: 1px solid var(--line);
  background: #fbfdfe;
}

.squad-actions.transfer-open {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  align-content: center;
  padding: 18px;
  border: 0;
  background: rgba(7, 27, 51, 0.38);
}

.squad-actions[hidden],
.squad-transfer-panel[hidden] {
  display: none;
}

.squad-actions-head,
.squad-action-buttons,
.transfer-picker-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.squad-actions-head {
  justify-content: space-between;
}

.squad-actions-head > div {
  min-width: 0;
}

.legal-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 850;
  white-space: nowrap;
}

.legal-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--xi);
}

.squad-actions.transfer-open .squad-actions-head,
.squad-actions.transfer-open .squad-action-buttons,
.squad-actions.transfer-open .squad-transfer-panel {
  width: min(980px, calc(100vw - 36px));
  margin-inline: auto;
  background: #ffffff;
}

.squad-actions.transfer-open .squad-actions-head {
  padding: 12px 14px 4px;
  border-radius: 8px 8px 0 0;
}

.squad-actions.transfer-open .squad-action-buttons {
  display: none;
}

.squad-actions.transfer-open .squad-transfer-panel {
  padding: 0 14px 14px;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 24px 60px rgba(7, 27, 51, 0.28);
}

.eyebrow {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.icon-button {
  display: grid;
  box-sizing: border-box;
  width: 32px;
  height: 32px;
  min-height: 32px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0;
  color: var(--accent-dark);
  background: #f7fcfd;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1;
}

.icon-button:hover,
.icon-button:focus-visible {
  border-color: var(--xi);
  color: var(--ink);
  background: rgba(116, 216, 12, 0.18);
  outline: none;
}

.squad-transfer-panel {
  display: grid;
  gap: 10px;
}

.transfer-picker-controls input,
.transfer-picker-controls select {
  min-width: 160px;
}

.transfer-picker-list {
  display: grid;
  max-height: 420px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.squad-actions.transfer-open .transfer-picker-list {
  max-height: min(58vh, 520px);
}

.transfer-picker-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.4fr) 56px 62px 68px 64px minmax(105px, 1fr) 76px;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 9px;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  background: #ffffff;
  text-align: left;
}

.transfer-picker-row:last-child {
  border-bottom: 0;
}

.transfer-picker-row:hover,
.transfer-picker-row:focus-within {
  background: rgba(116, 216, 12, 0.12);
  outline: none;
}

.transfer-picker-row.disabled {
  color: #8a98a5;
  background: #f3f6f7;
  opacity: 0.68;
}

.transfer-picker-row span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.transfer-picker-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.transfer-picker-row small {
  color: var(--muted);
  font-weight: 750;
}

.transfer-pick-button {
  min-height: 30px;
  padding: 5px 8px;
  font-size: 0.72rem;
}

.transfer-pick-button:disabled {
  color: #8a98a5;
  border-color: var(--line);
  background: #eef3f4;
  cursor: not-allowed;
}

.player-card,
.transfer-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  min-width: 0;
}

.player-card.starter {
  border-color: rgba(11, 122, 117, 0.45);
  background: #f1fbf8;
}

.name-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.name-row strong {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag {
  flex: 0 0 auto;
  padding: 2px 7px;
  border-radius: 999px;
  color: #071b33;
  background: var(--xi);
  font-size: 0.72rem;
  font-weight: 800;
}

.sub {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.84rem;
}

.list {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.fixture-list {
  display: grid;
  gap: 12px;
  padding: 12px 14px 14px;
}

.fixture-list.slide-left {
  animation: slide-left 180ms ease-out;
}

.fixture-list.slide-right {
  animation: slide-right 180ms ease-out;
}

@keyframes slide-left {
  from {
    opacity: 0.35;
    transform: translateX(24px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slide-right {
  from {
    opacity: 0.35;
    transform: translateX(-24px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.fixture-group {
  display: grid;
  gap: 6px;
}

.fixture-group h3 {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  letter-spacing: 0;
}

.fixture-row {
  display: grid;
  grid-template-columns: 92px minmax(140px, 1fr) 132px minmax(140px, 1fr);
  gap: 10px;
  align-items: center;
  border: 1px solid rgba(0, 174, 186, 0.2);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--ink);
  background: linear-gradient(90deg, rgba(0, 174, 186, 0.035), #ffffff 22%, #ffffff 78%, rgba(116, 216, 12, 0.04));
}

.fixture-row strong {
  font-size: 0.95rem;
}

.fixture-home {
  text-align: right;
}

.fixture-away {
  text-align: left;
}

.team-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  vertical-align: middle;
}

.team-label-home {
  justify-content: flex-end;
}

.team-label span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-badge {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  object-fit: contain;
  vertical-align: middle;
}

.fixture-score {
  color: #071b33;
  font-weight: 900;
  text-align: center;
}

.prob-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.78rem;
}

.prob-row span {
  display: inline-flex;
  gap: 3px;
}

.upload-box {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.odds-panel {
  margin-top: 14px;
}

.transfer-card {
  display: grid;
  gap: 8px;
}

@media (min-width: 1180px) {
  .team-layout {
    align-items: start;
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  }
}

.gain {
  color: var(--xi-dark);
  font-weight: 800;
}

.muted {
  color: var(--muted);
}

.table-wrap {
  max-height: 640px;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

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

th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  color: var(--muted);
  cursor: pointer;
  z-index: 1;
}

td:first-child {
  font-weight: 500;
}

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

.league-table th:nth-child(1),
.league-table td:nth-child(1) {
  width: 48px;
  color: var(--muted);
}

.league-table td:nth-child(2) {
  font-weight: 850;
}

.player-name {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.player-name strong {
  font-weight: 850;
}

.breakdown {
  min-width: 180px;
  white-space: normal;
}

.breakdown summary {
  color: var(--accent-dark);
  font-weight: 850;
  cursor: pointer;
}

.breakdown-grid {
  display: grid;
  grid-template-columns: max-content minmax(90px, 1fr);
  gap: 4px 10px;
  margin-top: 8px;
  padding: 8px;
  border: 1px solid rgba(0, 174, 186, 0.18);
  border-radius: 6px;
  background: #f8fcfd;
  color: var(--muted);
  font-size: 0.8rem;
}

.breakdown-grid strong {
  color: var(--ink);
  font-weight: 800;
}

.availability-edit {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 8px;
  padding: 8px;
  border: 1px solid rgba(116, 216, 12, 0.32);
  border-radius: 6px;
  background: #fbfff5;
  font-size: 0.76rem;
}

.availability-edit label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-weight: 800;
}

.availability-edit input[type="number"] {
  width: 64px;
  min-height: 28px;
  padding: 3px 6px;
}

.availability-edit button {
  min-height: 28px;
  padding: 4px 8px;
  font-size: 0.72rem;
}

.availability-pitch {
  justify-content: center;
  gap: 4px;
  margin-top: 2px;
  padding: 0;
  border: 0;
  background: transparent;
}

.availability-menu {
  flex-wrap: nowrap;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.availability-menu input[type="number"] {
  width: 54px;
  min-height: 28px;
}

.availability-menu button {
  min-height: 28px;
  padding: 4px 7px;
  font-size: 0.7rem;
}

.availability-pitch label {
  gap: 3px;
  color: var(--ink);
  font-size: 0.62rem;
}

.availability-pitch input[type="number"] {
  width: 38px;
  min-height: 20px;
  padding: 1px 3px;
  font-size: 0.62rem;
}

.availability-pitch button {
  min-height: 20px;
  padding: 1px 4px;
  border-radius: 4px;
  font-size: 0.58rem;
}


textarea {
  display: block;
  min-height: 210px;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
  font-family: Consolas, "Courier New", monospace;
  resize: vertical;
}

@media (max-width: 1000px) {
  .topbar {
    align-items: flex-start;
  }

  .tabs {
    order: 3;
    flex-basis: 100%;
    min-width: 0;
    justify-content: flex-start;
  }

  .status {
    margin-left: 0;
  }

  .controls,
  .grid,
  .split,
  .squad,
  .fixture-row {
    grid-template-columns: 1fr 1fr;
  }

  .pitch-slots {
    grid-template-columns: repeat(var(--slots), minmax(76px, 118px));
    gap: 7px;
  }

  .pitch-player {
    min-height: 60px;
    padding: 6px;
  }
}

@media (max-width: 680px) {
  .topbar,
  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .tabs {
    order: 0;
    width: 100%;
    flex-basis: auto;
    justify-content: flex-start;
  }

  .tab {
    flex: 0 0 max-content;
  }

  .player-filters,
  .player-filters input,
  .player-filters select {
    width: 100%;
  }

  .brand {
    align-items: center;
    flex-direction: row;
    gap: 10px;
  }

  .brand-logo {
    width: 52px;
    height: 52px;
  }

  .brand-title {
    font-size: 1.35rem;
  }

  .controls,
  .grid,
  .split,
  .squad,
  .fixture-row {
    grid-template-columns: 1fr;
  }

  .team-pitch {
    padding: 10px;
  }

  .pitch-surface {
    min-height: 0;
    padding: 12px;
  }

  .pitch-field {
    min-height: 0;
    padding: 42px 10px 24px;
  }

  .pitch-slots {
    grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  }

  .transfer-picker-row {
    grid-template-columns: minmax(150px, 1fr) 58px 66px;
  }

  .transfer-picker-row span:nth-child(4),
  .transfer-picker-row span:nth-child(5),
  .transfer-picker-row small {
    grid-column: 1 / -1;
  }

  .transfer-pick-button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .fixture-score {
    text-align: left;
  }
}
