.event-row {
  cursor: pointer;
  transition: background-color .16s ease, transform .16s ease;
}

#lineupSection {
  scroll-margin-top: 82px;
}

.event-row:hover,
.event-row:focus-visible {
  border-radius: 9px;
  background: rgba(225, 247, 255, .72);
  transform: translateX(2px);
}

.event-row[data-event-type="goal"]:hover,
.event-row[data-event-type="goal"]:focus-visible {
  background: rgba(223, 252, 241, .82);
}

.event-row[data-event-type="yellow-card"]:hover,
.event-row[data-event-type="yellow-card"]:focus-visible {
  background: rgba(255, 245, 199, .74);
}

.event-row.is-event-selected {
  border-radius: 9px;
  background: linear-gradient(90deg, rgba(225, 247, 255, .92), rgba(255, 234, 245, .7));
  box-shadow: inset 3px 0 #35bdf8;
}

.event-hover,
.comment-hover {
  display: none !important;
}

.formation-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  flex-wrap: wrap;
}

.substitution-balance {
  border: 1px solid rgba(23, 48, 79, .1);
  border-radius: 999px;
  background: #fff;
  padding: 5px 7px;
  color: #46617d;
  font-size: 8px;
  font-weight: 950;
  white-space: nowrap;
}

.player-dot {
  transition: opacity .14s ease, filter .14s ease, transform .16s ease;
}

.player-dot.subbed-in {
  animation: lineupPlayerIn .72s cubic-bezier(.2, .8, .2, 1) both;
}

.player-portrait {
  position: relative;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  overflow: visible;
  border: 2px solid rgba(255, 255, 255, .92);
  border-radius: 50%;
  background: linear-gradient(145deg, #e6f8ff, #fff, #ffeaf5);
  box-shadow: 0 5px 13px rgba(0, 0, 0, .18);
  padding: 0 !important;
  color: #17304f;
}

.player-portrait img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
}

.player-portrait.jersey img {
  object-fit: contain;
  padding: 4px;
}

.player-initials {
  border-radius: 0 !important;
  background: transparent !important;
  padding: 0 !important;
  color: #17304f;
  font-size: 11px;
  font-weight: 1000;
}

.lineup-focus-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 8px;
  border: 1px solid rgba(53, 189, 248, .3);
  border-radius: 10px;
  background: linear-gradient(90deg, #e9f9ff, #fff, #fff0f7);
  padding: 8px 9px 8px 11px;
  color: #17304f;
  font-size: 9px;
  font-weight: 900;
  line-height: 1.45;
  box-shadow: 0 8px 20px rgba(35, 119, 170, .08);
}

.lineup-focus-note[hidden] {
  display: none;
}

.lineup-focus-note span {
  min-width: 0;
}

.lineup-focus-note button {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid rgba(23, 48, 79, .1);
  border-radius: 50%;
  background: #fff;
  color: #46617d;
  font-weight: 1000;
}

.player-number {
  position: absolute;
  right: -4px;
  bottom: -4px;
  display: grid;
  place-items: center;
  min-width: 19px;
  height: 19px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: var(--team-color, #17304f);
  padding: 0 3px;
  color: #fff;
  font-size: 8px;
  font-weight: 1000;
  line-height: 1;
}

.player-card {
  position: absolute;
  top: -3px;
  width: 9px;
  height: 13px;
  border: 1px solid rgba(0, 0, 0, .1);
  border-radius: 2px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, .18);
}

.player-card.prior {
  left: -5px;
  display: grid;
  place-items: center;
  width: 14px;
  height: 16px;
  background: #ffdf3d;
  color: #644900;
  font-size: 7px;
  font-style: normal;
  font-weight: 1000;
}

.player-card.yellow {
  right: -2px;
  background: #ffdf3d;
}

.player-card.red {
  right: 8px;
  background: #ef476f;
}

.player-name {
  max-width: 90px !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.lineup-grid.has-event-focus .player-dot:not(.is-event-focus),
.lineup-grid.has-event-focus .bench-player:not(.is-event-focus) {
  opacity: .28;
  filter: saturate(.55);
}

.lineup-grid.has-event-focus .player-dot.is-event-focus {
  z-index: 4;
  transform: translateY(-3px) scale(1.1);
}

.lineup-grid.has-event-focus .player-dot.is-event-focus .player-portrait {
  box-shadow: 0 0 0 4px rgba(53, 189, 248, .38), 0 9px 22px rgba(8, 67, 96, .28);
}

.lineup-grid[data-focus-type="goal"] .player-dot.is-event-focus .player-portrait {
  box-shadow: 0 0 0 4px rgba(32, 214, 164, .46), 0 9px 22px rgba(8, 110, 93, .3);
}

.lineup-grid[data-focus-type="yellow-card"] .player-dot.is-event-focus .player-portrait {
  box-shadow: 0 0 0 4px rgba(255, 223, 61, .58), 0 9px 22px rgba(120, 88, 0, .25);
}

.lineup-grid[data-focus-type="red-card"] .player-dot.is-event-focus .player-portrait {
  box-shadow: 0 0 0 4px rgba(239, 71, 111, .5), 0 9px 22px rgba(130, 20, 50, .28);
}

.lineup-grid.has-event-focus .bench-player.is-event-focus {
  border-color: #35bdf8;
  background: #e1f7ff;
  color: #0f6f9f;
}

.formation-changes > span:last-child {
  animation: lineupChangeIn .62s cubic-bezier(.2, .8, .2, 1) both;
}

@keyframes lineupPlayerIn {
  0% { opacity: 0; transform: translateX(-18px) scale(.78); }
  58% { opacity: 1; transform: translateX(2px) scale(1.1); }
  100% { transform: none; }
}

@keyframes lineupChangeIn {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 560px) {
  #lineupSection {
    scroll-margin-top: 118px;
  }

  .formation-head {
    align-items: flex-start;
  }

  .formation-meta {
    max-width: 52%;
  }

  .player-portrait {
    width: 36px;
    height: 36px;
  }

  .player-number {
    min-width: 17px;
    height: 17px;
    font-size: 7px;
  }

  .player-name {
    max-width: 66px !important;
  }

  .lineup-focus-note {
    position: sticky;
    top: 62px;
    z-index: 6;
    font-size: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .event-row,
  .player-dot {
    animation: none;
    transition: none;
  }

  .formation-changes > span:last-child {
    animation: none;
  }
}
