@page {
  size: A4 portrait;
  margin: 10mm;
}

* { print-color-adjust: exact; -webkit-print-color-adjust: exact; }

body { background: #fff; font-size: 9pt; }
.wrap { width: 100%; margin: 0; }
.masthead, .library, .footer, .reset, #instructions, #kit-preview, .kits > small,
.debut > a { display: none !important; }

.scoreboard { padding: 3mm; margin: 0 0 3mm; border-radius: 2mm; }
.score { margin: 1mm 0; font-size: 17pt; }
.score strong { font-size: 28pt; }
.match-date { font-size: 8pt; }
.match-overview { display: grid; grid-template-columns: 65mm minmax(0,1fr); gap: 2mm 3mm; align-items: start; }
.layout { display: contents; }
.board { grid-column: 1 / -1; padding: 2mm 3mm; border-radius: 2mm; break-inside: avoid; }
.panel-heading h2 { font-size: 12pt; }
.controls { margin: 1.5mm 0; }
.controls label, .controls select { font-size: 7pt; }
.controls select { appearance: none; padding: .4mm 1mm; }
.pitch {
  aspect-ratio: auto;
  height: 96mm;
  background: repeating-linear-gradient(90deg,#246447 0 10%,#286e4d 10% 20%);
}
.player { left: var(--print-x); top: var(--print-y); }
.player svg { width: 10mm; }
.player .name { font-size: 7pt; }
.player .captain { font-size: 5pt; }
.board-footer { margin-top: 1.5mm; font-size: 7pt; }

.match-side {
  display: grid;
  grid-column: 1;
  grid-template-columns: 1fr 1fr;
  align-items: start;
  gap: 0 2mm;
  margin: 0;
  padding: 2mm 3mm;
  border-radius: 2mm;
  break-inside: avoid;
}
.match-side > .kicker, .match-side > h2, #goals, .halftime { grid-column: 1 / -1; }
.match-side > h2 { font-size: 11pt; margin: 0; }
#goals { display: block; }
.goal { grid-template-columns: 9.5mm 1fr auto; margin: 0; padding: .8mm 0; font-size: 7pt; }
.goal small { margin: 0; font-size: 6pt; }
.goal strong { padding: .2mm .6mm; }
.halftime { margin: 1mm 0; font-size: 7pt; }
.debut { grid-column: 1; padding: 2mm; }
.debut-content { gap: 1.5mm; margin: 1mm 0; font-size: 7pt; }
.debut-content strong { font-size: 14pt; }
.debut small { font-size: 6pt; }
.kits { grid-column: 2; padding: 0; }
.kit-row { margin-top: 1mm; gap: 1mm; font-size: 6.5pt; }
.kit-row svg { flex: 0 0 4mm; width: 4mm; }
.kicker { font-size: 6.5pt; }

.match-photos { grid-column: 2; margin: 0; padding: 2mm 3mm; border-radius: 2mm; break-inside: avoid; }
.match-photos h2 { font-size: 11pt; margin: 0 0 1.5mm; }
.photo-grid { grid-template-columns: 1.55fr 1fr; gap: 3mm; }
.photo-grid img { height: 62mm; max-height: none; object-fit: contain; border-radius: 1mm; }
.photo-grid figcaption { margin-top: 1mm; font-size: 7pt; }

/* With no match photos, give the pitch and the match summary the full width. */
.match-overview:not(.has-photos) .pitch { height: 116mm; }
.match-overview:not(.has-photos) .match-side {
  grid-column: 1 / -1;
  grid-template-columns: 1.35fr 1fr 1fr;
}
.match-overview:not(.has-photos) .match-side > .kicker,
.match-overview:not(.has-photos) .match-side > h2,
.match-overview:not(.has-photos) #goals,
.match-overview:not(.has-photos) .halftime { grid-column: 1; }
.match-overview:not(.has-photos) .debut { grid-column: 2; grid-row: 1 / 5; }
.match-overview:not(.has-photos) .kits { grid-column: 3; grid-row: 1 / 5; }

.match-details { break-before: page; margin: 0; }
.match-details h2 { font-size: 21pt; }
.print-match-heading { display: block; margin: 1.5mm 0 5mm; font-size: 11pt; font-weight: 750; }
.facts { grid-template-columns: repeat(4,1fr); }
.facts, .details-grid { margin-top: 4mm; gap: 3mm; }
.facts > div { padding: 3mm; font-size: 9.5pt; }
.facts small, .facts span { font-size: 8pt; }
.details-grid { grid-template-columns: 1fr 1fr; align-items: stretch; }
.detail-card { padding: 3mm; border-radius: 2mm; }
.detail-card h3 { margin: 0 0 2mm; font-size: 12pt; }
.detail-card li.event { grid-template-columns: 10mm 1fr; gap: 1.5mm; padding: 1.25mm 0; font-size: 8.6pt; }
.event-detail { display: block; }
.event-detail .event-kind { font-size: 7.6pt; font-weight: 650; }
.event-detail .event-kind::after { content: " · "; }
details { padding: 2.1mm 0; }
summary { font-size: 9.5pt; list-style: none; }
.roster-list { gap: 1.25mm 2mm; margin: 1.5mm 0; font-size: 8.5pt; }
.roster-list b { min-width: 4mm; }
.coach, .sources { font-size: 8pt; }
.coach { margin: 1mm 0; }
.sources { margin: 4mm 0 0; }

#player-profile { display: none !important; }
.profile-trigger { text-decoration: none; }

body[data-print="player"] main { display: none !important; }
body[data-print="player"] #printed-player {
  display: block;
  max-width: 157mm;
  margin: 6mm auto;
  padding: 7mm;
  border: 1px solid var(--line);
  border-radius: 3mm;
  break-inside: avoid;
}
#printed-player .profile-head { grid-template-columns: 32mm 1fr; }
#printed-player .profile-portrait { height: 42mm; }
#printed-player .profile-head h2 { font-size: 22pt; }
#printed-player h3 { font-size: 12pt; }
#printed-player .profile-stats { grid-template-columns: repeat(3,1fr); }

.score .club-logo{width:9mm;height:11mm}
.controls .club-logo,#rosters summary .club-logo{width:5mm;height:6mm}

.player .captain{min-width:5.5mm;height:5.5mm;top:-1mm;right:-1.5mm;font-size:8pt;border-width:.4mm;box-shadow:none}

/* A full player card may span several pages: never clip its detailed statistics. */
body[data-print="player"] #printed-player {
  max-width: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  break-inside: auto;
}
#printed-player .profile-head,
#printed-player .profile-debut,
#printed-player .profile-stats > div { break-inside: avoid; }
#printed-player h3,
#printed-player h4 { break-after: avoid; }
#printed-player .fm-profile { break-inside: auto; }
#printed-player .fm-details { display: block !important; padding: 0; }
#printed-player .fm-details > summary {
  font-size: 11pt;
  font-weight: 750;
  margin: 3mm 0 2mm;
  break-after: avoid;
}
#printed-player .fm-details > summary::marker { content: ""; }
#printed-player .fm-details > summary::after { content: ""; }
#printed-player .fm-details h4 { font-size: 10pt; margin: 3mm 0 1.5mm; }
#printed-player .fm-stats { gap: 2mm; margin-bottom: 2mm; }
#printed-player .fm-stats > div { padding: 2mm; }
#printed-player .fm-stats dt { font-size: 9pt; }
#printed-player .fm-stats dd { font-size: 10pt; }
#printed-player .profile-note,
#printed-player .profile-sources { font-size: 8pt; }
