/* Shared match detail view, used by every public match modal. */
.cs-match-view {
  --mv-bg: var(--brand-card-bg, #ffffff);
  --mv-text: var(--brand-card-text, #1f2937);
  --mv-accent: var(--brand-primary, #6f2c91);
  --mv-muted: color-mix(in srgb, var(--mv-text) 60%, transparent);
  --mv-line: color-mix(in srgb, var(--mv-text) 11%, transparent);
  --mv-soft: color-mix(in srgb, var(--mv-accent) 6%, var(--mv-bg));
  --mv-gold: #e0b000;
  color: var(--mv-text);
  font-variant-numeric: tabular-nums;
}

.cs-match-view a.cs-mv-player {
  color: inherit;
  font-weight: 600;
  text-decoration: none;
}

.cs-match-view a.cs-mv-player:hover,
.cs-match-view a.cs-mv-player:focus-visible {
  color: var(--mv-accent);
  text-decoration: underline;
}

.cs-mv-sub {
  color: var(--mv-muted);
  font-size: 0.8em;
  font-weight: 500;
}

.cs-mv-strong {
  font-weight: 800;
}

.cs-mv-role {
  display: inline-block;
  margin-left: 0.15rem;
  padding: 0 0.3rem;
  border-radius: 0.35rem;
  background: color-mix(in srgb, var(--mv-text) 8%, transparent);
  color: var(--mv-muted);
  font-size: 0.7em;
  font-weight: 700;
  line-height: 1.5;
  vertical-align: 0.1em;
}

.cs-mv-motm,
.cs-mv-hattrick {
  color: var(--mv-gold);
}

.cs-mv-hattrick svg {
  vertical-align: -0.125em;
}

.cs-mv-hattrick__count {
  margin-left: 0.1rem;
  font-size: 0.75em;
  font-weight: 700;
}

/* Hero header */
.cs-mv-hero {
  position: relative;
  margin-bottom: 1rem;
  padding: 1.1rem 1rem 0.9rem;
  border: 1px solid color-mix(in srgb, var(--mv-accent) 16%, transparent);
  border-radius: 1rem;
  background:
    radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, var(--mv-accent) 16%, transparent), transparent 70%),
    linear-gradient(160deg, color-mix(in srgb, var(--mv-accent) 9%, var(--mv-bg)), var(--mv-bg));
  text-align: center;
  overflow: hidden;
}

.cs-mv-hero__teams {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 0.75rem;
}

.cs-mv-side {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  min-width: 0;
}

.cs-mv-side--home {
  justify-content: flex-end;
  text-align: right;
}

.cs-mv-side--away {
  justify-content: flex-start;
  text-align: left;
}

.cs-mv-side--home .cs-mv-side__text {
  order: -1;
}

.cs-mv-side__text {
  min-width: 0;
}

.cs-mv-side__name {
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.cs-mv-side.is-ours .cs-mv-side__name {
  font-weight: 800;
}

.cs-mv-side__score {
  margin-top: 0.15rem;
  color: var(--mv-muted);
  font-family: var(--cs-display-font, inherit);
  font-size: 1.55rem;
  font-weight: 800;
  line-height: 1.05;
}

.cs-mv-side.is-winner .cs-mv-side__score {
  color: var(--mv-accent);
}

.cs-mv-hero__vs {
  color: var(--mv-muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.cs-mv-crest {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  overflow: hidden;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.16), 0 0 0 1px rgba(15, 23, 42, 0.06);
  animation: cs-mv-pop 360ms cubic-bezier(0.2, 0.8, 0.3, 1.2) both;
}

/* Rounded tile filled edge to edge so square logos read as an icon, not a square in a circle. */
.cs-mv-crest__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.cs-mv-crest--badge {
  padding: 6px;
  background: color-mix(in srgb, var(--mv-accent) 14%, var(--mv-bg));
  color: var(--mv-accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-align: center;
  line-height: 1.1;
  overflow: hidden;
}

.cs-mv-result {
  display: inline-block;
  margin-top: 0.85rem;
  padding: 0.32rem 0.85rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--mv-accent) 13%, var(--mv-bg));
  color: var(--mv-accent);
  font-size: 0.85rem;
  font-weight: 700;
}

.cs-mv-result.is-win {
  background: color-mix(in srgb, #16a34a 14%, var(--mv-bg));
  color: #15803d;
  box-shadow: 0 0 0 2px #16a34a, 0 0 14px 2px rgba(22, 163, 74, 0.45);
}

.cs-mv-result.is-loss {
  background: color-mix(in srgb, #dc2626 12%, var(--mv-bg));
  color: #b91c1c;
  box-shadow: 0 0 0 2px #dc2626, 0 0 14px 2px rgba(220, 38, 38, 0.4);
}

.cs-mv-result.is-cancelled {
  background: color-mix(in srgb, var(--mv-text) 9%, transparent);
  color: var(--mv-muted);
}

.cs-mv-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem;
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
}

.cs-mv-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--mv-line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--mv-bg) 70%, transparent);
  color: var(--mv-muted);
  font-size: 0.76rem;
}

.cs-mv-hero__actions:not(:empty) {
  margin-top: 0.75rem;
}

/* Tabs and innings switcher */
.cs-mv-tabs {
  position: sticky;
  top: -1rem;
  z-index: 2;
  display: flex;
  gap: 0.25rem;
  margin: 0 0 0.9rem;
  padding: 0.3rem;
  border-radius: 0.8rem;
  background: color-mix(in srgb, var(--mv-text) 6%, var(--mv-bg));
}

.cs-mv-tab {
  flex: 1 1 0;
  padding: 0.5rem 0.75rem;
  border: 0;
  border-radius: 0.6rem;
  background: transparent;
  color: var(--mv-muted);
  font-size: 0.88rem;
  font-weight: 700;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.cs-mv-tab:hover {
  color: var(--mv-text);
}

.cs-mv-tab.is-active {
  background: var(--mv-bg);
  color: var(--mv-accent);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.1);
}

.cs-mv-switch {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.9rem;
}

.cs-mv-switch__btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--mv-line);
  border-radius: 0.75rem;
  background: var(--mv-bg);
  color: var(--mv-text);
  text-align: left;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.cs-mv-switch__btn:hover {
  transform: translateY(-1px);
}

.cs-mv-switch__btn.is-active {
  border-color: var(--mv-accent);
  background: var(--mv-soft);
  box-shadow: inset 0 0 0 1px var(--mv-accent);
}

.cs-mv-switch__team {
  color: var(--mv-muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.cs-mv-switch__score {
  font-size: 1.05rem;
  font-weight: 800;
}

.cs-mv-switch__score small {
  color: var(--mv-muted);
  font-size: 0.72rem;
  font-weight: 600;
}

.cs-match-view .cs-mv-tab:focus-visible,
.cs-match-view .cs-mv-switch__btn:focus-visible {
  outline: 2px solid var(--mv-accent);
  outline-offset: 2px;
}

.cs-mv-innings__head {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
  font-weight: 700;
}

/* Blocks and tables */
.cs-mv-block {
  margin-bottom: 1rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--mv-line);
  border-radius: 0.85rem;
  background: var(--mv-bg);
}

.cs-mv-block__title {
  margin: 0 0 0.45rem;
  color: var(--mv-muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.cs-mv-mt {
  margin-top: 0.7rem;
}

.cs-mv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.cs-mv-table th {
  padding: 0.35rem 0.45rem;
  border-bottom: 1px solid var(--mv-line);
  color: var(--mv-muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-align: left;
}

.cs-mv-table td {
  padding: 0.5rem 0.45rem;
  border-bottom: 1px solid color-mix(in srgb, var(--mv-text) 6%, transparent);
  vertical-align: top;
}

.cs-mv-table tbody tr:last-child td {
  border-bottom: 0;
}

.cs-mv-table tbody tr {
  transition: background 0.15s ease;
}

.cs-mv-table tbody tr:hover {
  background: var(--mv-soft);
}

.cs-mv-table .cs-mv-num {
  width: 3.2rem;
  text-align: right;
  white-space: nowrap;
}

.cs-mv-cell-name {
  min-width: 0;
}

.cs-mv-dismissal {
  margin-top: 0.1rem;
  color: var(--mv-muted);
  font-size: 0.78rem;
}

.cs-mv-dismissal:empty {
  display: none;
}

.cs-mv-mobile {
  display: none;
}

.cs-mv-empty {
  padding: 0.75rem 0;
  color: var(--mv-muted);
}

.cs-mv-note {
  margin-top: 0.5rem;
  color: var(--mv-muted);
  font-size: 0.78rem;
}

.cs-mv-loading {
  padding: 2rem 0;
  color: var(--mv-muted, #6b7280);
  text-align: center;
}

/* Extras and fall of wickets */
.cs-mv-extras__line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem;
}

.cs-mv-extras__line .cs-mv-block__title {
  margin: 0;
}

.cs-mv-fows {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cs-mv-fow {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem 0.2rem 0.25rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--mv-text) 6%, transparent);
  font-size: 0.78rem;
}

.cs-mv-fow__score {
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  background: var(--mv-bg);
  color: var(--mv-accent);
  font-weight: 800;
}

/* Partnerships */
.cs-mv-pships {
  margin: 0;
  padding: 0;
  list-style: none;
}

.cs-mv-pship {
  display: grid;
  grid-template-columns: 2.6rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid color-mix(in srgb, var(--mv-text) 6%, transparent);
}

.cs-mv-pship:last-child {
  border-bottom: 0;
}

.cs-mv-pship__wicket {
  color: var(--mv-muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.cs-mv-pship__names {
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

.cs-mv-pship__bar {
  height: 0.45rem;
  margin-top: 0.3rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--mv-text) 8%, transparent);
  overflow: hidden;
}

.cs-mv-pship__bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, color-mix(in srgb, var(--mv-accent) 55%, var(--mv-bg)), var(--mv-accent));
  transform-origin: left center;
  animation: cs-mv-grow 520ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.cs-mv-pship__runs {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.15;
}

/* Motion */
.cs-mv-panel.is-active,
.cs-mv-innings.is-active {
  animation: cs-mv-fade 240ms ease both;
}

.cs-mv-innings.is-active .cs-mv-table tbody tr {
  animation: cs-mv-rise 280ms ease both;
}

.cs-mv-innings.is-active .cs-mv-table tbody tr:nth-child(2) { animation-delay: 20ms; }
.cs-mv-innings.is-active .cs-mv-table tbody tr:nth-child(3) { animation-delay: 40ms; }
.cs-mv-innings.is-active .cs-mv-table tbody tr:nth-child(4) { animation-delay: 60ms; }
.cs-mv-innings.is-active .cs-mv-table tbody tr:nth-child(5) { animation-delay: 80ms; }
.cs-mv-innings.is-active .cs-mv-table tbody tr:nth-child(6) { animation-delay: 100ms; }
.cs-mv-innings.is-active .cs-mv-table tbody tr:nth-child(7) { animation-delay: 120ms; }
.cs-mv-innings.is-active .cs-mv-table tbody tr:nth-child(8) { animation-delay: 140ms; }
.cs-mv-innings.is-active .cs-mv-table tbody tr:nth-child(n+9) { animation-delay: 160ms; }

@keyframes cs-mv-fade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

@keyframes cs-mv-rise {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

@keyframes cs-mv-grow {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

@keyframes cs-mv-pop {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .cs-match-view *,
  .cs-match-view *::before,
  .cs-match-view *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* Phones: full-screen sheet, compact header, stacked score rows */
@media (max-width: 575.98px) {
  .modal-fullscreen-sm-down > .modal-content {
    border: 0 !important;
    border-radius: 0 !important;
  }

  .modal-fullscreen-sm-down .modal-body {
    padding: 0.75rem !important;
  }

  .cs-mv-hero {
    padding: 0.9rem 0.7rem 0.75rem;
  }

  .cs-mv-hero__teams {
    gap: 0.4rem;
  }

  .cs-mv-side,
  .cs-mv-side--home,
  .cs-mv-side--away {
    flex-direction: column;
    justify-content: flex-start;
    gap: 0.4rem;
    text-align: center;
  }

  .cs-mv-side--home .cs-mv-side__text {
    order: 0;
  }

  .cs-mv-crest {
    width: 48px;
    height: 48px;
    border-radius: 12px;
  }

  .cs-mv-side__name {
    font-size: 0.8rem;
  }

  .cs-mv-side__score {
    font-size: 1.3rem;
  }

  .cs-mv-tabs {
    top: -0.75rem;
  }

  .cs-mv-block {
    padding: 0.6rem 0.65rem;
  }

  .cs-mv-table:not(.cs-mv-table--compact) thead,
  .cs-mv-table:not(.cs-mv-table--compact) .cs-mv-num {
    display: none;
  }

  .cs-mv-table:not(.cs-mv-table--compact) .cs-mv-mobile {
    display: table-cell;
    text-align: right;
    white-space: nowrap;
  }

  .cs-mv-table--compact .cs-mv-num {
    width: 2.4rem;
  }
}
