.lineup-preview-section {
  position: relative;
}

.lineup-team-cards {
  display: grid;
  grid-template-columns: minmax(0,1fr) 26px minmax(0,1fr);
  gap: 8px;
  align-items: stretch;
}

.lineup-team-card {
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--cyan);
  border-radius: 18px;
  background: linear-gradient(160deg, rgba(24,201,232,.1), rgba(255,255,255,.025) 42%, rgba(7,18,15,.68));
  box-shadow: 0 14px 30px rgba(0,0,0,.18);
}

.lineup-team-card.away {
  border-top-color: var(--green);
  background: linear-gradient(200deg, rgba(117,214,90,.1), rgba(255,255,255,.025) 42%, rgba(7,18,15,.68));
}

.lineup-team-card > header {
  display: grid;
  gap: 2px;
  margin-bottom: 9px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  text-align: center;
}

.lineup-team-card > header span {
  color: var(--muted);
  font-size: 6px;
  font-weight: 1000;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.lineup-team-card > header strong {
  color: var(--cyan);
  font-size: 13px;
  font-weight: 1000;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.lineup-team-card.away > header strong {
  color: var(--green);
}

.lineup-match-vs {
  display: grid;
  place-items: center;
  align-self: center;
  width: 30px;
  height: 30px;
  margin-left: -2px;
  border: 1px solid rgba(255,202,87,.36);
  border-radius: 50%;
  background: #15261f;
  color: var(--gold);
  font-size: 8px;
  font-weight: 1000;
  box-shadow: 0 8px 18px rgba(0,0,0,.28);
  z-index: 1;
}

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

.lineup-team-player {
  min-width: 0;
  text-align: center;
}

.lineup-team-player .portrait {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  border-radius: 16px;
  font-size: 34px;
  box-shadow: 0 10px 22px rgba(0,0,0,.24);
}

.lineup-player-copy {
  order: 1;
  width: 100%;
  min-width: 0;
}

.lineup-player-name {
  overflow: hidden;
  color: #f5fbf8;
  font-size: 13px;
  font-weight: 1000;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lineup-team-player.has-sub {
  margin: 0;
  padding: 5px;
  border: 1px solid rgba(255,202,87,.34);
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(255,202,87,.09), rgba(117,214,90,.055));
}

.lineup-sub-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
  margin-top: 4px;
}

.lineup-team-player.away .lineup-sub-actions {
  justify-content: center;
}

.lineup-sub-button,
.lineup-sub-remove {
  width: auto;
  padding: 3px 8px;
  border: 1px solid rgba(24,201,232,.3);
  border-radius: 999px;
  background: rgba(24,201,232,.07);
  color: #aeeefa;
  font-size: 6px;
  font-weight: 900;
  line-height: 1.15;
  cursor: pointer;
}

.lineup-team-player.away .lineup-sub-button {
  border-color: rgba(117,214,90,.32);
  background: rgba(117,214,90,.07);
  color: #c1edb0;
}

.lineup-sub-button.active {
  border-color: rgba(255,202,87,.38);
  background: rgba(255,202,87,.1);
  color: var(--gold);
}

.lineup-sub-remove {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.scoresheet-substitutions {
  margin: 0 16px 16px;
  padding: 10px;
  border: 1px solid rgba(64,111,49,.32);
  border-radius: 8px;
  background: rgba(221,237,212,.7);
  color: #243a28;
}

.scoresheet-substitutions header {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 7px;
}

.scoresheet-substitutions header > span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #4e8c38;
  color: #fff;
  font-weight: 1000;
}

.scoresheet-substitutions header strong,
.scoresheet-substitutions header small {
  display: block;
}

.scoresheet-substitutions header strong {
  font-size: 9px;
  text-transform: uppercase;
}

.scoresheet-substitutions header small {
  margin-top: 1px;
  color: #56705b;
  font-size: 7px;
}

.scoresheet-substitutions > div {
  display: grid;
  grid-template-columns: 58px minmax(0,1fr) auto;
  align-items: center;
  gap: 7px;
  padding: 6px 0;
  border-top: 1px solid rgba(64,111,49,.2);
  font-size: 7px;
}

.scoresheet-substitutions > div > span {
  color: #56705b;
  font-weight: 900;
  text-transform: uppercase;
}

.scoresheet-substitutions p {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  font-size: 8px;
  font-weight: 900;
}

.scoresheet-substitutions p s {
  color: #7a8580;
}

.scoresheet-substitutions p b {
  color: #4e8c38;
}

.scoresheet-substitutions em {
  color: #3b7534;
  font-size: 6px;
  font-style: normal;
  font-weight: 1000;
  text-transform: uppercase;
}

.substitution-overlay {
  position: fixed;
  z-index: 90;
  inset: 0;
  overflow-y: auto;
  padding: max(18px, env(safe-area-inset-top)) 14px max(24px, env(safe-area-inset-bottom));
  background: rgba(2,10,8,.86);
  backdrop-filter: blur(13px);
}

.substitution-dialog {
  width: min(100%, 480px);
  margin: 0 auto;
  padding: 17px;
  border: 1px solid rgba(24,201,232,.28);
  border-radius: 21px;
  background:
    radial-gradient(circle at 85% 0, rgba(24,201,232,.12), transparent 35%),
    linear-gradient(145deg, #132820, #091712);
  box-shadow: 0 28px 70px rgba(0,0,0,.55);
}

.substitution-dialog > header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.substitution-dialog > header span {
  color: var(--cyan);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.substitution-dialog > header h2 {
  margin-top: 5px;
  font-size: 22px;
}

.substitution-dialog > header > button {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255,255,255,.05);
  color: var(--ink);
  font-size: 20px;
  cursor: pointer;
}

.substitution-protection {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 9px;
  align-items: center;
  margin: 15px 0 11px;
  padding: 10px;
  border: 1px solid rgba(117,214,90,.27);
  border-radius: 12px;
  background: rgba(117,214,90,.075);
}

.substitution-protection > span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: rgba(117,214,90,.12);
}

.substitution-protection p,
.substitution-help {
  margin: 0;
  color: #b9cbc4;
  font-size: 9px;
  line-height: 1.45;
}

.substitution-protection b {
  color: #bef0aa;
}

.substitution-help {
  margin-bottom: 12px;
}

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

.substitution-option {
  display: grid;
  grid-template-columns: 48px minmax(0,1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.035);
}

.substitution-option.current {
  border-color: rgba(255,202,87,.4);
  background: rgba(255,202,87,.06);
}

.substitution-option .portrait {
  height: 48px;
  border-radius: 12px;
  font-size: 18px;
}

.substitution-option strong,
.substitution-option span,
.substitution-option small {
  display: block;
}

.substitution-option strong {
  font-size: 12px;
}

.substitution-option span,
.substitution-option small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 8px;
}

.substitution-option small {
  color: var(--gold);
}

.substitution-option > button {
  padding: 8px 9px;
  border: 1px solid rgba(24,201,232,.38);
  border-radius: 8px;
  background: rgba(24,201,232,.1);
  color: #c6f6ff;
  font-size: 8px;
  font-weight: 900;
  cursor: pointer;
}

.substitution-option.current > button {
  border-color: rgba(255,202,87,.4);
  background: rgba(255,202,87,.1);
  color: var(--gold);
}

.substitution-cancel {
  width: 100%;
  margin-top: 11px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
  cursor: pointer;
}

@media (max-width: 390px) {
  .lineup-team-cards {
    grid-template-columns: minmax(0,1fr) 20px minmax(0,1fr);
    gap: 4px;
  }

  .lineup-team-card {
    padding: 6px;
    border-radius: 14px;
  }

  .lineup-team-player .portrait {
    border-radius: 13px;
  }

  .lineup-player-name {
    font-size: 11px;
  }

  .lineup-sub-button,
  .lineup-sub-remove {
    padding: 2px 7px;
    font-size: 5px;
  }

  .lineup-match-vs {
    width: 24px;
    height: 24px;
    margin-left: -2px;
    font-size: 7px;
  }
}
