/* Match Formation Card + Player Formation Card */

.mf-lineup {
  width: 100%;
}

.mf-lineup--split {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-radius: 16px;
  border: 1px solid rgba(0, 194, 203, 0.2);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.05) 0%, rgba(0, 0, 0, 0.18) 100%);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.32);
  overflow: hidden;
}

.mf-lineup--split .fp-split-pitches {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px 12px 0;
}

.mf-lineup--split .fp-split-team {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.18);
}

.mf-lineup--split .mf-card--solo {
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

.mf-lineup--split .mf-card--solo::before {
  display: none;
}

.mf-lineup--split .mf-card--solo .mf-card__pitch {
  aspect-ratio: 3 / 4;
  min-height: min(52vh, 420px);
  max-height: none;
}

.mf-lineup--split .mf-pc {
  width: clamp(48px, 14vw, 62px);
}

.mf-lineup--split .mf-pc__shirt {
  width: 36px;
  height: 40px;
}

.mf-lineup--split .mf-pc__num {
  font-size: 15px;
}

.mf-lineup--split .mf-pc__name {
  margin-top: 5px;
  padding: 3px 7px;
  font-size: 9px;
  letter-spacing: 0.05em;
}

.mf-lineup--split .fp-split-actions {
  display: flex;
  justify-content: center;
  padding: 14px 12px 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin-top: 4px;
}

.mf-lineup--split .fp-subs-panel {
  margin: 0 12px 14px;
}

.mf-card .fp-subs-panel {
  border-top: 1px solid rgba(0, 194, 203, 0.14);
  background: rgba(10, 22, 40, 0.55);
}

.mf-card__footer .fp-toggle {
  justify-self: center;
}

.mf-card {
  position: relative;
  border-radius: 16px;
  border: 1px solid rgba(0, 194, 203, 0.28);
  background:
    radial-gradient(ellipse 90% 70% at 50% -20%, rgba(0, 194, 203, 0.14), transparent 58%),
    linear-gradient(165deg, rgba(255, 255, 255, 0.07) 0%, rgba(255, 255, 255, 0.02) 38%, rgba(0, 0, 0, 0.22) 100%);
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.mf-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(0, 194, 203, 0.12);
}

.mf-card__pitch {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 2;
  min-height: clamp(300px, 44vw, 460px);
  max-height: 500px;
  /* Fallback pitch if SVG fails to paint */
  background:
    radial-gradient(ellipse 70% 60% at 50% 50%, transparent 55%, rgba(0, 0, 0, 0.35) 100%),
    repeating-linear-gradient(
      90deg,
      #145A32 0,
      #145A32 15px,
      #0F4D28 15px,
      #0F4D28 30px
    );
  overflow: hidden;
}

.mf-card__grass {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 1;
  pointer-events: none;
}

.mf-card__players {
  position: absolute;
  inset: 14px 18px;
  z-index: 2;
}

.mf-card__footer {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
  padding: 14px 18px;
  border-top: 1px solid rgba(0, 194, 203, 0.18);
  background: linear-gradient(180deg, rgba(10, 22, 40, 0.72) 0%, rgba(10, 22, 40, 0.92) 100%);
  backdrop-filter: blur(10px);
}

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

.mf-card__foot--home {
  justify-content: center;
}

.mf-card__foot--away {
  justify-content: center;
}

.mf-card__foot-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  align-items: flex-start;
}

.mf-card__foot-text--away {
  align-items: flex-end;
  text-align: right;
}

.mf-card__team {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.02em;
  color: #fff;
  white-space: nowrap;
}

.mf-card__form {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: #00C2CB;
  letter-spacing: 0.08em;
}

.mf-card__footer-spacer {
  display: block;
  width: 1px;
  height: 1px;
}

.mf-card .team-flag-img {
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

/* ── Player Formation Card ── */

.mf-pc {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  width: clamp(52px, 14%, 72px);
  text-align: center;
  transition: transform 180ms ease, opacity 180ms ease, filter 180ms ease;
}

.mf-pc:hover,
.mf-pc:focus-within {
  transform: translate(-50%, -50%) scale(1.04);
  z-index: 4;
}

.mf-pc.is-subbed-out {
  opacity: 0.42;
  filter: grayscale(0.4);
}

.mf-pc.is-subbed-in .mf-pc__kit {
  box-shadow:
    0 0 0 2px rgba(74, 222, 128, 0.65),
    0 10px 24px rgba(0, 0, 0, 0.45);
}

.mf-pc__badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 3px;
  min-height: 16px;
  margin-bottom: 4px;
}

.mf-pc__badges--empty {
  min-height: 0;
  margin-bottom: 0;
}

.mf-pc__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.mf-pc__badge--sub-out { background: rgba(127, 29, 29, 0.92); color: #FECACA; }
.mf-pc__badge--sub-in { background: rgba(20, 83, 45, 0.95); color: #BBF7D0; }
.mf-pc__badge--goal { background: rgba(10, 22, 40, 0.88); font-size: 10px; }
.mf-pc__badge--card { width: 8px; height: 11px; min-width: 8px; padding: 0; border-radius: 2px; }
.mf-pc__badge--yellow { background: #EAB308; }
.mf-pc__badge--red { background: #EF4444; }

.mf-pc__link {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: inherit;
  text-decoration: none;
  max-width: 100%;
}

.mf-pc__kit-shell {
  padding: 2px;
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0.04));
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.42);
}

.mf-pc__kit {
  position: relative;
  border-radius: 12px;
  padding: 3px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(0, 0, 0, 0.12));
}

.mf-pc__shirt {
  position: relative;
  width: clamp(36px, 4.8vw, 44px);
  height: clamp(40px, 5.4vw, 48px);
  display: flex;
  align-items: center;
  justify-content: center;
  clip-path: polygon(20% 0%, 80% 0%, 100% 18%, 100% 100%, 0% 100%, 0% 18%);
  border: 1px solid var(--mf-kit-border, rgba(0, 0, 0, 0.14));
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.35) 0%, transparent 38%),
    linear-gradient(180deg, var(--mf-kit-bg, #fff) 0%, color-mix(in srgb, var(--mf-kit-bg, #fff) 72%, #000) 100%);
  color: var(--mf-kit-num, #0A1628);
  box-shadow: inset 0 -4px 10px rgba(0, 0, 0, 0.18);
}

.mf-pc__shirt::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 15px;
  height: 7px;
  background: inherit;
  clip-path: polygon(0 0, 100% 0, 78% 100%, 22% 100%);
  filter: brightness(1.06);
}

.mf-pc__shirt-highlight {
  position: absolute;
  top: 18%;
  left: 22%;
  width: 28%;
  height: 36%;
  border-radius: 40%;
  background: rgba(255, 255, 255, 0.22);
  pointer-events: none;
}

.mf-pc__num {
  position: relative;
  z-index: 1;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
  font-size: clamp(15px, 1.9vw, 18px);
  line-height: 1;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25);
}

.mf-pc__name {
  margin-top: 7px;
  padding: 4px 8px;
  max-width: 100%;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: clamp(8px, 1vw, 10px);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.15;
  color: #fff;
  background: linear-gradient(180deg, rgba(10, 22, 40, 0.94), rgba(10, 22, 40, 0.78));
  border: 1px solid rgba(0, 194, 203, 0.22);
  border-radius: 999px;
  white-space: normal;
  word-break: break-word;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(6px);
  transition: border-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.mf-pc__name-link {
  color: inherit;
  text-decoration: none;
}

.mf-pc__link:hover .mf-pc__name,
.mf-pc__link:focus-visible .mf-pc__name,
.mf-pc__name-link:hover,
.mf-pc__name-link:focus-visible {
  color: #00C2CB;
  border-color: rgba(0, 194, 203, 0.55);
  box-shadow: 0 4px 16px rgba(0, 194, 203, 0.2);
}

.mf-pc__rating-wrap {
  position: absolute;
  right: -5px;
  bottom: -5px;
  z-index: 2;
}

.mf-pc__rating {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.38);
}

.mf-pc__rating--excellent { background: rgba(0, 194, 203, 0.95); color: #0A1628; }
.mf-pc__rating--good { background: rgba(134, 239, 172, 0.95); color: #052e16; }
.mf-pc__rating--avg { background: rgba(250, 204, 21, 0.95); color: #422006; }
.mf-pc__rating--low { background: rgba(248, 113, 113, 0.95); color: #450a0a; }
.mf-pc__rating--pending { background: rgba(255, 255, 255, 0.14); color: rgba(255, 255, 255, 0.55); min-width: 22px; }

@media (max-width: 520px) {
  .mf-card__players {
    inset: 10px 12px;
  }

  .mf-pc {
    width: clamp(48px, 15%, 62px);
  }

  .mf-card__footer {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 10px;
  }

  .mf-card__foot--home,
  .mf-card__foot--away {
    justify-content: center;
  }

  .mf-card__foot-text,
  .mf-card__foot-text--away {
    align-items: center;
    text-align: center;
  }
}
