.match-profile-card,
.match-profile-body,
.match-profile-system,
.match-profile-identity {
  min-width: 0;
}

/* Birthday context gets a second line instead of reducing the name's width. */
html body .league-bench-player .bench-player-main:has(>.league-birthday-badge){display:flex;flex-direction:column;align-items:flex-start;justify-content:center;gap:0}
html body .bench-player-main>.league-birthday-badge{display:flex;width:max-content;max-width:100%;height:14px;margin:2px 0 0;padding:0 3px;gap:2px;font-size:.47rem;line-height:1;vertical-align:top}
html body .bench-player-main>.league-birthday-badge svg{width:8px;height:8px}

/* Optional Match Center feature shared by leagues and cup environments. */
.match-storylines-disabled [data-match-storylines] {
  display: none !important;
}

.match-storylines-panel {
  padding: 14px;
}

.storylines-panel {
  --storyline-accent: var(--accent, #087f86);
  color: var(--ink, var(--text, #17222d));
  background: var(--panel, #fff);
  border: 1px solid var(--line, #d4e0e5);
  border-radius: 16px;
  padding: 16px;
}

.storylines-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 13px;
}

.storylines-heading span,
.storylines-heading em {
  color: var(--muted, #64717c);
  font-size: .76rem;
  font-style: normal;
  font-weight: 850;
}

.storylines-heading h2 { margin: 0; color: var(--ink, var(--text, #17222d)); font-size: 1.35rem; }

.storylines-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.storyline-card {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  min-width: 0;
  min-height: 154px;
  padding: 12px;
  border: 1px solid var(--line, #d4e0e5);
  border-top: 4px solid var(--storyline-color, var(--storyline-accent));
  border-radius: 13px;
  background: var(--panel-soft, var(--surface, #f3f7f8));
  box-shadow: 0 6px 18px rgba(20, 45, 55, .06);
}

.storyline-card.category-live { --storyline-color: #1d9b60; }
.storyline-card.category-history { --storyline-color: #6b63c7; }
.storyline-card.category-form { --storyline-color: #ca8b13; }
.storyline-card.category-personnel { --storyline-color: #2980b9; }
.storyline-card.category-venue { --storyline-color: #8c6544; }

.storyline-card > header,
.storyline-card > footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.storyline-card > strong { margin: 8px 0 5px; color: var(--ink, var(--text, #17222d)); font-size: 1rem; line-height: 1.15; }
.storyline-copy { color: var(--muted, #53636d); font-size: .86rem; font-weight: 700; line-height: 1.35; }
.storyline-category { display: inline-flex; align-items: center; gap: 6px; color: var(--storyline-color, var(--storyline-accent)); font-size: .72rem; font-weight: 950; text-transform: uppercase; }
.storyline-category i { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: color-mix(in srgb, var(--storyline-color, var(--storyline-accent)) 14%, transparent); font-style: normal; }
.storyline-dismiss { border: 0; background: transparent; color: var(--muted, #64717c); font-size: 1.2rem; line-height: 1; cursor: pointer; }
.storyline-action,
.storylines-more { border: 1px solid var(--line, #cbd9de); border-radius: 9px; background: var(--panel, #fff); color: var(--storyline-accent); padding: 6px 9px; font: inherit; font-size: .76rem; font-weight: 900; cursor: pointer; }
.storyline-card > footer { justify-content: flex-end; margin-top: 9px; }
.storylines-more { display: block; margin: 12px auto 0; }
.storylines-empty { display: grid; gap: 4px; place-items: center; min-height: 110px; text-align: center; color: var(--muted, #64717c); }
.storylines-empty strong { color: var(--ink, var(--text, #17222d)); }

.league-storylines-wrap { padding: 0 12px 12px; }
.league-storylines-wrap[hidden] { display: none; }
.league-storylines-wrap .storylines-panel { border-radius: 12px; }
.meta-icon.storylines-active { color: var(--accent, #087f86); background: var(--accent-soft, #dff3f3); }

@media (max-width: 1050px) {
  .storylines-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  .match-storylines-panel { padding: 8px; }
  .storylines-panel { padding: 11px; }
  .storylines-heading { align-items: start; flex-direction: column; }
  .storylines-grid { grid-template-columns: 1fr; }
  .storyline-card { min-height: 0; }
}

.match-profile-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line, rgba(125, 180, 184, 0.28));
}

.match-profile-identity strong,
.match-profile-identity em {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.match-profile-identity strong {
  color: var(--text, #f4f8f8);
  font-weight: 950;
}

.match-profile-identity em {
  color: var(--muted, #adbac0);
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 850;
}

.match-profile-body {
  display: grid;
  min-width: 0;
}

.match-profile-system {
  min-width: 0;
}

.match-center-lineup-workspace,
.match-center-lineup-board,
.match-center-bench,
.match-center-pitch {
  min-width: 0;
}

.match-center-lineup-slot {
  display: contents;
}

.match-center-timeline-head,
.match-center-timeline-track {
  min-width: 0;
}

.match-center-participant,
.match-center-participant-identity,
.match-center-participant-markers {
  min-width: 0;
}

.match-center-pitch-slot {
  min-width: 0;
}

/* One football card marker for domestic, international, and test match centers. */
.match-center-card-button.has-match-card,
.bench-markers .match-center-card-button.has-match-card,
.bench-player.bench-coach .match-center-card-button.has-match-card,
.bench-player.bench-coach.national-bench-staff .match-center-card-button.has-match-card,
.player-row .match-center-card-button.has-match-card {
  position: relative;
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 17px;
  min-width: 17px;
  max-width: 17px;
  height: 19px;
  min-height: 19px;
  padding: 0;
  gap: 0;
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 5px;
  box-sizing: border-box;
  opacity: 1;
  visibility: visible;
  overflow: visible;
  transform: none;
  z-index: 8;
}
.match-center-card-button.has-match-card::before {
  content: "";
  position: absolute;
  display: block;
  inset: 1px;
  width: auto;
  height: auto;
  margin: 0;
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(8, 18, 21, .34);
  background: inherit;
}
.match-center-card-button.has-match-card.card-yellow { background: #f4c542; }
.match-center-card-button.has-match-card.card-red { background: #dc3948; }
.match-center-card-button.has-match-card.card-second-yellow,
.match-center-card-button.has-match-card.card-yellowred {
  background: linear-gradient(90deg, #f4c542 0 50%, #dc3948 50% 100%);
}
.match-center-card-button.has-match-card > :is(.card-icon, .card-stack, .card-shape) { display: none; }
.match-center-card-button.has-match-card .match-center-card-minute {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: auto;
  min-width: 0;
  margin: 0;
  padding: 0;
  background: transparent;
  font-size: 7px;
  font-weight: 800;
  opacity: 1;
  line-height: 1;
  white-space: nowrap;
  color: #17201b;
  overflow: visible;
}
.match-center-card-button.has-match-card .match-center-card-minute.is-added-time { font-size: 6px; }
.match-center-card-button.has-match-card:is(.card-red, .card-second-yellow, .card-yellowred) .match-center-card-minute {
  color: #fff;
  text-shadow: 0 1px 2px #361016;
}
:is(.league-pitch-slot, .pitch-player, .field-player) .match-center-card-button.has-match-card {
  position: absolute;
  top: -8px;
  right: 4px;
  bottom: auto;
  transform: none;
}
.league-card-button.match-center-card-button.has-match-card {
  position: absolute;
}

.match-center-card-button .match-center-card-empty {
  display: block;
  width: 7px;
  height: 9px;
  border: 1px dashed currentColor;
  border-radius: 2px;
  opacity: .55;
}
.league-card-button.match-center-card-button:not(.has-match-card)::before { display: none; }
.football-card-editor {
  position: fixed;
  z-index: 200005;
  width: 260px;
  max-width: calc(100vw - 16px);
  padding: 12px;
  border: 1px solid var(--line, #80969d);
  border-radius: 12px;
  background: var(--panel, var(--surface, #fff));
  color: var(--ink, var(--text, #17222d));
  box-shadow: 0 8px 30px #0005;
  font: 13px/1.3 system-ui, sans-serif;
}
.football-card-editor header, .football-card-editor footer { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.football-card-editor header strong { min-width: 0; overflow-wrap: anywhere; }
.football-card-editor label { display: grid; grid-template-columns: 1fr 1fr 60px; gap: 5px; align-items: center; margin-top: 10px; }
.football-card-editor :is(button, input, select) { min-width: 0; padding: 5px; border: 1px solid var(--line, #80969d); border-radius: 6px; background: var(--surface, var(--panel, #fff)); color: inherit; font: inherit; }
.football-card-editor input { width: 60px; }
.football-card-editor [data-football-card-error] { color: #df4a4a; font-size: 12px; }
.football-card-editor [data-football-card-error]:empty { display: none; }
.football-card-editor footer { margin-top: 12px; }

/* Keep birthdays below the pitch marker: names retain their entire line. */
:is(.pitch-player,.league-pitch-slot,.field-player)>.match-pitch-birthday{position:absolute;top:calc(100% + 2px);left:3px;z-index:3;display:flex;max-width:calc(100% - 24px);height:13px;line-height:1;cursor:help}
:is(.pitch-player,.league-pitch-slot,.field-player)>.match-pitch-birthday:empty{display:none}
html body .match-pitch-birthday>:is(.birthday-badge,.league-birthday-badge){display:inline-flex;align-items:center;gap:2px;margin:0;padding:0 3px;height:13px;box-sizing:border-box;font-size:calc(7px * var(--ui-font-scale,1));line-height:1;white-space:nowrap}
html body .match-pitch-birthday :is(svg,[aria-hidden]){width:9px;height:9px;font-size:9px}
/* The full bench uses the same compact head-row and expansion in every cup. */
.bench-player.bench-coach.match-bench-staff{display:flex;align-items:center;gap:5px;min-height:28px}
.bench-player.bench-coach.match-bench-staff .bench-player-name{flex:1;min-width:0;display:grid;gap:1px;text-align:left}
.match-bench-staff .bench-player-name>small{font-size:.75em;opacity:.8;font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.match-bench-staff .bench-staff-toggle{display:grid;place-items:center;flex:0 0 22px;width:22px;min-width:22px;height:22px;min-height:22px;padding:0;border:1px solid currentColor;border-radius:5px;background:transparent;color:inherit;font:inherit;line-height:1;cursor:pointer}
.match-bench-staff .bench-staff-toggle:hover,.match-bench-staff .bench-staff-toggle:focus-visible{background:#ffffff30;outline:2px solid currentColor;outline-offset:1px}
.bench-player.bench-coach.match-bench-staff.staff-member{position:relative;top:auto;background:var(--panel-soft,var(--panel));border-left:3px solid var(--line);color:var(--ink,var(--text))}

.bench-staff-empty,.test-staff-empty{padding:6px 8px;font-size:.7rem;line-height:1.35;color:var(--muted,#64717c);overflow-wrap:anywhere}
