.match-analytics {
  --ma-home: var(--primary, #6828ba);
  --ma-away: #34b945;
  --ma-goal: #34b945;
  --ma-save: var(--primary, #6828ba);
  --ma-miss: #ff9a34;
  --ma-block: #f85c5f;
  --ma-ring: #ffffff;
  --ma-grid: #d7d7d7;
  margin: 0 0 20px;
}

.match-analytics__field {
  position: relative;
  width: 100%;
  border-radius: 14px;
  overflow: hidden;
}

.match-analytics__field--ice-hockey {
  --ma-ring: #ffffff;
  --ma-marker-label: 8px;
  --ma-marker-stroke: 1.2;
}

.match-analytics__svg {
  display: block;
  width: 100%;
  height: auto;
}

.match-analytics__marker {
  cursor: pointer;
}

.match-analytics__marker-inner {
  transform-box: view-box;
  transform-origin: 0 0;
  transform: scale(1);
}

.match-analytics__marker-shape {
  fill: var(--ma-marker, var(--ma-home));
  stroke: var(--ma-ring);
  stroke-width: var(--ma-marker-stroke, 1.6);
}

.match-analytics__marker-label {
  fill: #ffffff;
  font-size: var(--ma-marker-label, 13px);
  font-weight: 700;
  text-anchor: middle;
  pointer-events: none;
}

.match-analytics__marker:hover .match-analytics__marker-shape,
.match-analytics__marker--tipped .match-analytics__marker-shape {
  stroke-width: calc(var(--ma-marker-stroke, 1.6) * 2.2);
}

.match-analytics__marker.is-hidden {
  display: none;
}

.match-analytics__legend-teams {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 32px;
}

.match-analytics__legend-team {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  line-height: 1.3;
}

.match-analytics__legend-team--home {
  --ma-legend-color: var(--ma-home);
}

.match-analytics__legend-team--away {
  --ma-legend-color: var(--ma-away);
}

.match-analytics__legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--ma-legend-color);
  flex-shrink: 0;
}

.match-analytics__legend-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
  flex-shrink: 0;
}

.match-analytics__legend-name {
  color: var(--text, #232323);
  text-decoration: none;
}

a.match-analytics__legend-name:hover,
.match-analytics__legend-name:hover {
  color: var(--primary, #6828ba);
}

.match-analytics__tip {
  --arrow-x: 50%;
  position: fixed;
  z-index: 60;
  max-width: min(280px, 100vw - 16px);
  padding: 14px;
  border-radius: 14px;
  background: var(--white, #ffffff);
  color: var(--text, #232323);
  font-size: 12px;
  line-height: 1.35;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
}

.match-analytics__tip[hidden] {
  display: none;
}

.match-analytics__tip::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -12px;
  height: 12px;
}

.match-analytics__tip--below::before {
  bottom: auto;
  top: -12px;
}

.match-analytics__tip::after {
  content: "";
  position: absolute;
  left: var(--arrow-x);
  bottom: -7px;
  width: 16px;
  height: 8px;
  margin-left: -8px;
  background: var(--white, #ffffff);
  clip-path: polygon(50% 100%, 0 0, 100% 0);
}

.match-analytics__tip--below::after {
  bottom: auto;
  top: -7px;
  clip-path: polygon(50% 0, 0 100%, 100% 100%);
}

.match-analytics__tip-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.match-analytics__tip-photo {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--grey-light, #f4f4f4);
}

.match-analytics__tip-name {
  display: flex;
  flex-direction: column;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text, #232323);
}

a.match-analytics__tip-name {
  text-decoration: none;
}

a.match-analytics__tip-name:hover,
a.match-analytics__tip-name:focus-visible {
  color: var(--primary, #6828ba);
}

.match-analytics__tip-club {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  color: var(--text, #232323);
}

.match-analytics__tip-club img {
  width: 16px;
  height: 16px;
  object-fit: contain;
  flex-shrink: 0;
}

.match-analytics__tip-note {
  margin-top: 6px;
  color: var(--grey, #7d7d7d);
}

.match-shotmap__card,
.match-momentum__card,
.match-average-positions__card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.match-shotmap .match-shotmap__title,
.match-momentum .match-momentum__title,
.match-average-positions .match-average-positions__title {
  margin: 0;
}

.match-shotmap__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.match-shotmap__pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.match-shotmap .sort-btn.match-shotmap__pill {
  max-width: 190px;
  min-width: 0;
}

.match-shotmap__pill-text {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.match-shotmap .sort-btn.match-shotmap__pill:not(.sort-btn--active) {
  background: var(--grey-light, #f4f4f4);
  color: var(--text, #232323);
}

.match-shotmap .sort-btn.match-shotmap__pill:not(.sort-btn--active):hover {
  color: var(--primary, #6828ba);
}

.match-shotmap__shot--goal {
  --ma-marker: var(--ma-goal);
}

.match-shotmap__shot--save {
  --ma-marker: var(--ma-save);
}

.match-shotmap__shot--miss {
  --ma-marker: var(--ma-miss);
}

.match-shotmap__shot--block {
  --ma-marker: var(--ma-block);
}

.match-shotmap__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
}

.match-shotmap__check {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  line-height: 1.3;
  color: var(--text, #232323);
  cursor: pointer;
  user-select: none;
}

.match-shotmap .match-shotmap__check-input {
  position: absolute;
  width: 20px;
  height: 20px;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
}

.match-shotmap__check-mark {
  position: relative;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  border-radius: 4px;
  border: 2px solid var(--grey, #7d7d7d);
  background: var(--white, #ffffff);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.match-shotmap__check-mark::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 4px;
  height: 8px;
  border: solid var(--white, #ffffff);
  border-width: 0 2px 2px 0;
  transform: translate(-50%, -60%) rotate(45deg);
  opacity: 0;
}

.match-shotmap__check-input:checked + .match-shotmap__check-mark {
  background: var(--primary, #6828ba);
  border-color: var(--primary, #6828ba);
}

.match-shotmap__check-input:checked + .match-shotmap__check-mark::after {
  opacity: 1;
}

.match-shotmap__check-input:focus-visible + .match-shotmap__check-mark {
  box-shadow: 0 0 0 3px rgba(104, 40, 186, 0.25);
}

.match-shotmap__check-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.match-shotmap__check-dot--goal {
  background: var(--ma-goal);
}

.match-shotmap__check-dot--save {
  background: var(--ma-save);
}

.match-shotmap__check-dot--miss {
  background: var(--ma-miss);
}

.match-shotmap__check-dot--block {
  background: var(--ma-block);
}

.match-shotmap__subtitle,
.match-average-positions__subtitle {
  font-size: 20px;
  line-height: 1.3;
  font-weight: 700;
  color: var(--text, #232323);
  margin: 0 0 8px;
}

.match-shotmap__table {
  display: grid;
  grid-template-columns: var(--shotmap-cols, minmax(0, 1.6fr) repeat(5, minmax(0, 1fr)));
  gap: 1px;
  padding: 1px;
  width: 100%;
  border-radius: 10px;
  overflow: hidden;
  background: var(--grey-light, #f4f4f4);
  font-size: 12px;
}

.match-shotmap__table thead,
.match-shotmap__table tbody,
.match-shotmap__table tr {
  display: contents;
}

.match-shotmap__table th,
.match-shotmap__table td {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 8px 16px;
  text-align: left;
  line-height: 1.25;
  overflow-wrap: anywhere;
  background: var(--white, #ffffff);
  color: var(--text, #232323);
  font-weight: 400;
}

.match-shotmap__table thead th {
  background: var(--primary, #6828ba);
  color: var(--white, #ffffff);
  font-weight: 700;
}

.match-shotmap__table tbody th,
.match-shotmap__table .match-shotmap__table-total {
  font-weight: 700;
}

.match-momentum {
  --momentum-height: 172px;
  --momentum-axis: 44px;
  --momentum-gap: 10px;
}

.match-momentum .match-momentum__subtitle {
  margin: 0 0 8px;
  font-size: 16px;
  line-height: 1.25;
  font-weight: 700;
  color: var(--text, #232323);
}

.match-momentum__chart {
  display: grid;
  grid-template-columns: var(--momentum-axis) minmax(0, 1fr);
  grid-template-rows: auto auto;
}

.match-momentum__axis {
  grid-area: 1 / 1;
  position: relative;
  height: var(--momentum-height);
}

.match-momentum__tick {
  position: absolute;
  right: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  transform: translateY(-50%);
  font-size: 12px;
  line-height: 1;
  color: var(--text, #232323);
}

.match-momentum__tick-value {
  flex: 1 0 auto;
  text-align: right;
}

.match-momentum__tick-line {
  width: 16px;
  height: 1px;
  background: var(--ma-grid);
  flex-shrink: 0;
}

.match-momentum__tick--minor .match-momentum__tick-line {
  width: 8px;
}

.match-momentum__plot {
  grid-area: 1 / 2;
  position: relative;
  display: flex;
  height: var(--momentum-height);
}

.match-momentum__period {
  display: flex;
  flex-direction: column;
  flex-basis: 0;
  min-width: 0;
  padding: var(--momentum-gap) 0;
  border-left: 1px solid var(--ma-grid);
}

.match-momentum__period:last-child {
  border-right: 1px solid var(--ma-grid);
}

.match-momentum__half {
  display: flex;
  align-items: flex-end;
  gap: 1px;
  flex: 1 1 50%;
  min-height: 0;
}

.match-momentum__half--home {
  border-bottom: 1px solid var(--ma-grid);
}

.match-momentum__half--away {
  align-items: flex-start;
}

.match-momentum__cell {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  flex: 1 1 0;
  min-width: 0;
  height: 100%;
}

.match-momentum__half--away .match-momentum__cell {
  justify-content: flex-start;
}

.match-momentum__bar {
  display: block;
  width: 100%;
  min-height: 1px;
  flex-shrink: 0;
  background: var(--ma-home);
}

.match-momentum__half--away .match-momentum__bar {
  background: var(--ma-away);
}

.match-momentum__event {
  position: relative;
  z-index: 1;
  display: block;
  width: clamp(6px, 220%, 16px);
  margin-bottom: 3px;
  flex-shrink: 0;
  color: var(--ma-home);
  filter: drop-shadow(0 0 1px var(--ma-ring)) drop-shadow(0 0 1px var(--ma-ring));
}

.match-momentum__half--away .match-momentum__event {
  margin: 3px 0 0;
  color: var(--ma-away);
}

.match-momentum__event-icon {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: contain;
}

.match-momentum__event-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.match-momentum__labels {
  grid-area: 2 / 2;
  display: flex;
  padding-top: 10px;
  border-top: 1px solid var(--ma-grid);
}

.match-momentum__label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex-basis: 0;
  min-width: 0;
  border-left: 1px solid transparent;
}

.match-momentum__label:last-child {
  border-right: 1px solid transparent;
}

.match-momentum__label-time {
  font-size: 12px;
  line-height: 1.25;
  color: var(--text, #232323);
}

.match-momentum__label-added {
  font-size: 10px;
  line-height: 1.3;
  color: var(--grey, #7d7d7d);
}

.match-average-positions__player--home {
  --ma-marker: var(--ma-home);
}

.match-average-positions__player--away {
  --ma-marker: var(--ma-away);
}

.match-average-positions__subs {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.match-average-positions .match-average-positions__subtitle {
  margin: 0;
}

.match-average-positions__subs-cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px 32px;
}

.match-average-positions__subs-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.match-average-positions .match-average-positions__subs-team {
  margin: 0;
}

.match-average-positions__subs-team .match-analytics__legend-team {
  font-size: 16px;
  font-weight: 700;
}

.match-average-positions__subs-empty {
  margin: 0;
  font-size: 14px;
  line-height: 1.3;
  color: var(--grey, #7d7d7d);
}

.match-average-positions__subs-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.match-average-positions__sub {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-size: 14px;
  line-height: 1.3;
}

.match-average-positions .match-average-positions__sub-minute {
  min-width: 0;
  flex-shrink: 0;
}

.match-average-positions__sub-tag {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap;
}

@media (max-width: 768px) {
  .match-analytics {
    margin: 0 0 16px;
  }

  .match-analytics__marker-inner {
    transform: scale(1.45);
  }

  .match-shotmap__card,
  .match-momentum__card,
  .match-average-positions__card {
    gap: 12px;
  }

  .match-analytics__field {
    border-radius: 10px;
  }

  .match-analytics__tip {
    padding: 8px;
    max-width: min(240px, 100vw - 16px);
    font-size: 10px;
  }

  .match-analytics__tip-head {
    gap: 8px;
  }

  .match-analytics__tip-photo {
    width: 32px;
    height: 32px;
  }

  .match-analytics__tip-name {
    font-size: 14px;
  }

  .match-analytics__legend-teams {
    flex-direction: column;
    gap: 8px;
  }

  .match-analytics__legend-logo {
    width: 24px;
    height: 24px;
  }

  .match-average-positions__subs,
  .match-average-positions__subs-list {
    gap: 12px;
  }

  .match-average-positions__subs-cols {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }

  .match-average-positions__subs-team .match-analytics__legend-team {
    font-size: 14px;
  }

  .match-shotmap__head {
    flex-direction: column;
    align-items: stretch;
  }

  .match-shotmap .sort-btn.match-shotmap__pill {
    max-width: 100%;
  }

  .match-shotmap__legend {
    flex-direction: column;
    gap: 12px;
  }

  .match-shotmap__subtitle,
  .match-average-positions__subtitle {
    font-size: 16px;
  }

  .match-shotmap__table {
    grid-auto-flow: column;
    grid-template-rows: var(--shotmap-rows, repeat(6, auto));
    grid-template-columns: minmax(0, 1.2fr) repeat(2, minmax(0, 1fr));
  }

  .match-momentum {
    --momentum-axis: 38px;
    --momentum-gap: 9px;
  }

  .match-momentum__tick {
    font-size: 11px;
  }

  .match-momentum__tick-line {
    width: 12px;
  }

  .match-momentum__tick--minor .match-momentum__tick-line {
    width: 6px;
  }

  .match-momentum__label-time {
    font-size: 11px;
  }

  .match-momentum__label-added {
    font-size: 9px;
  }
}

@media (max-width: 480px) {
  .match-analytics__marker-inner {
    transform: scale(1.8);
  }

  .match-shotmap__table th,
  .match-shotmap__table td {
    padding: 8px 10px;
  }
}
