:root {
    --ink: #161616;
    --muted: #666b73;
    --line: #b9bdc3;
    --paper: #fff;
    --canvas: #eef0f2;
    --home: #f04444;
    --away: #20bf62;
    --section: #737373;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    min-width: 320px;
    min-height: 100vh;
    color: var(--ink);
    background: var(--canvas);
    font-family: "Arial Narrow", "Roboto Condensed", "Segoe UI", Arial, sans-serif;
}

button, input { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }

.app-header {
    height: 96px;
    padding: 4px 20px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
}

.brand {
    display: block;
    text-decoration: none;
}

.brand-mark {
    width: 92px;
    height: 92px;
    display: block;
}

.brand-mark img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.app-main {
    padding: 10px clamp(24px, 4vw, 64px) clamp(24px, 4vw, 64px);
}

.search-stage {
    max-width: 1180px;
    min-height: 0;
    margin: 0 auto;
    padding-top: 8px;
    display: grid;
    grid-template-columns: 1.1fr .9fr;
    gap: clamp(40px, 8vw, 120px);
    align-items: center;
}

.eyebrow {
    display: block;
    margin-bottom: 13px;
    color: var(--home);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .15em;
    text-transform: uppercase;
}

.search-copy h1 {
    max-width: 660px;
    margin: 0 0 24px;
    font-size: clamp(44px, 6vw, 78px);
    line-height: .98;
    letter-spacing: -.055em;
}

.search-copy p {
    max-width: 570px;
    margin: 0;
    color: var(--muted);
    font-size: 18px;
    line-height: 1.55;
}

.team-search-box {
    padding: 36px;
    border-top: 5px solid var(--home);
    background: var(--paper);
    box-shadow: 0 24px 70px rgba(20, 24, 30, .12);
}

.team-search-box label {
    display: block;
    margin-bottom: 14px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.search-control { position: relative; }
.search-control span {
    position: absolute;
    top: 50%;
    right: 18px;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: 24px;
    pointer-events: none;
}

.history-link {
    display: inline-block;
    margin-top: 12px;
    color: #4f555d;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
}

.history-link:hover,
.history-link:focus-visible {
    color: var(--home);
    text-decoration: underline;
}

.team-input {
    width: 100%;
    padding: 17px 52px 17px 17px;
    border: 1px solid #c9ccd0;
    border-radius: 0;
    outline: 0;
    background: #fafafa;
    font-size: 17px;
}

.team-input:focus {
    border-color: var(--ink);
    box-shadow: 0 0 0 2px var(--ink);
}

.search-result {
    min-height: 40px;
    margin-top: 14px;
    color: var(--muted);
    font-size: 13px;
}

.search-result strong, .search-result small { display: block; }
.search-result strong { color: var(--ink); font-size: 15px; }
.search-result small { margin-top: 3px; }
.error { color: #c82424 !important; }

.loading-dot {
    width: 8px;
    height: 8px;
    display: inline-block;
    margin-right: 5px;
    border-radius: 50%;
    background: var(--home);
    animation: pulse 1s infinite alternate;
}

@keyframes pulse { to { opacity: .25; } }

.matches-section {
    max-width: 1180px;
    margin: 0 auto;
}

.text-button, .print-button {
    border: 0;
    background: transparent;
    cursor: pointer;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.text-button { padding: 10px 0; }
.text-button:hover { color: var(--home); }

.team-header {
    display: flex;
    gap: 24px;
    align-items: center;
    margin: 30px 0 36px;
}

.team-logo-frame {
    width: 84px;
    height: 84px;
    display: grid;
    place-items: center;
    background: #fff;
    border: 1px solid #d4d6da;
}

.team-logo-frame img { max-width: 68px; max-height: 68px; object-fit: contain; }
.team-header .eyebrow { margin-bottom: 6px; }
.team-header h2 { margin: 0; font-size: 38px; letter-spacing: -.04em; }
.muted { margin-top: 5px; color: var(--muted); }

.matches-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.match-card {
    width: 100%;
    padding: 22px;
    display: grid;
    gap: 20px;
    border: 1px solid #d1d4d8;
    border-left: 4px solid transparent;
    background: #fff;
    text-align: left;
    cursor: pointer;
    transition: transform .18s, border-color .18s, box-shadow .18s;
}

.match-card:hover {
    transform: translateY(-3px);
    border-left-color: var(--home);
    box-shadow: 0 14px 30px rgba(20, 24, 30, .09);
}

.match-card-date, .match-card-meta {
    color: var(--muted);
    font-size: 12px;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.match-card-teams {
    display: grid;
    grid-template-columns: 1fr 22px 1fr;
    gap: 8px;
    align-items: center;
}

.match-card-teams > span {
    min-width: 0;
    display: flex;
    gap: 10px;
    align-items: center;
}

.match-card-teams > span:last-child { justify-content: flex-end; text-align: right; }
.match-card-teams img { width: 34px; height: 34px; object-fit: contain; }
.match-card-teams strong { overflow: hidden; text-overflow: ellipsis; }
.match-card-teams em { color: #a1a4aa; font-style: normal; text-align: center; }
.state-message { grid-column: 1 / -1; padding: 50px; background: #fff; text-align: center; }

.match-panel { display: none; }
.match-panel.active { display: block; }
.sheet-actions {
    max-width: 1520px;
    margin: 0 auto 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sheet-action-group {
    display: flex;
    gap: 8px;
    align-items: center;
}
.sheet-save-status {
    max-width: 280px;
    margin-right: 6px;
    color: var(--muted);
    font-size: 11px;
    text-align: right;
}
.action-button {
    padding: 11px 14px;
    border: 1px solid #b9bdc3;
    background: #fff;
    cursor: pointer;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.action-button:hover { border-color: #111; }
.save-button { border-color: var(--away); }
.refresh-button { border-color: #4f6fd2; }
.events-button { border-color: #d59b20; }
.action-button:disabled { cursor: wait; opacity: .55; }
.print-button { padding: 11px 16px; background: #111; color: #fff; }
.print-button:hover { background: var(--home); }
.sheet-scroll { display: grid; gap: 28px; }

.match-sheet {
    width: 1520px;
    min-height: 1075px;
    margin: 0 auto;
    padding: 12px;
    background: var(--paper);
    box-shadow: 0 18px 52px rgba(25, 29, 35, .12);
}

.sheet-match-header {
    min-height: 76px;
    display: grid;
    grid-template-columns: 1fr 1.2fr 1fr;
    align-items: center;
    padding: 0 3px 10px;
}

.sheet-team { display: flex; gap: 12px; align-items: center; }
.sheet-team-away { justify-content: flex-end; }
.sheet-team strong {
    max-width: 410px;
    overflow: hidden;
    color: var(--home);
    font-size: 32px;
    font-weight: 900;
    letter-spacing: -.045em;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}
.sheet-team-away strong { color: var(--away); }

.sheet-crest {
    width: 56px;
    height: 56px;
    display: grid;
    place-items: center;
    background: transparent;
}

.sheet-crest img { width: 50px; height: 50px; object-fit: contain; }
.sheet-crest.is-empty {
    position: relative;
    overflow: hidden;
    border: 2px solid #1b1b1b;
    background: #26282c;
    clip-path: polygon(8% 0, 92% 0, 92% 70%, 50% 100%, 8% 70%);
}
.sheet-crest.is-empty::after {
    content: attr(data-initials);
    color: #fff;
    font-size: 15px;
    font-weight: 900;
    letter-spacing: -.03em;
}
.sheet-crest.is-empty img { display: none; }
.sheet-team-away .sheet-crest.is-empty { background: var(--away); }
.sheet-team-home .sheet-crest.is-empty { background: var(--home); }

.sheet-match-meta { text-align: center; }
.sheet-match-meta span { color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.sheet-match-meta h2 { margin: 4px 0 2px; font-size: 20px; text-transform: capitalize; }
.sheet-match-meta p { margin: 0; font-size: 16px; font-weight: 700; }

.formation-toolbar {
    min-height: 44px;
    margin-bottom: 10px;
    padding: 6px 10px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    align-items: center;
    border: 1px solid #c7c9cc;
    background: #f4f5f6;
}
.formation-toolbar label {
    display: flex;
    gap: 10px;
    align-items: center;
    color: var(--home);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .06em;
    text-transform: uppercase;
}
.formation-toolbar label:last-child {
    justify-content: flex-end;
    color: var(--away);
}
.formation-toolbar select {
    min-width: 178px;
    padding: 6px 28px 6px 9px;
    border: 1px solid #aeb2b7;
    background: #fff;
    color: #15171a;
    cursor: pointer;
    font: 800 12px/1 sans-serif;
}

.match-layout {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1.32fr) minmax(0, .65fr);
    grid-template-rows: repeat(2, 430px);
    gap: 10px 12px;
}

.roster-block, .pitch, .lineup-block { min-width: 0; border: 1px solid #747474; }
.roster-block { display: grid; grid-template-rows: 42px 1fr; overflow: hidden; }
.roster-block h3 {
    margin: 0;
    display: grid;
    place-items: center;
    background: var(--home);
    color: #fff;
    font-size: 17px;
    font-weight: 900;
    text-transform: uppercase;
}
.roster-block.team-away h3 { background: var(--away); }

.player-grid {
    min-height: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: minmax(0, 1fr);
}

.player-row {
    min-width: 0;
    min-height: 0;
    padding: 4px 6px;
    overflow: hidden;
    border: 0;
    border-right: 1px solid #999;
    border-bottom: 1px solid #999;
    background: #fff;
    text-align: left;
    cursor: pointer;
}
.player-row:nth-child(even) { border-right: 0; }
.player-row:hover { background: #f1f2f3; }
.player-row strong, .player-row span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-row strong { font-size: 10.5px; line-height: 1.2; }
.player-row span { margin-top: 2px; color: #60646a; font-size: 9px; }
.empty-cell { grid-column: 1 / -1; margin: auto; color: var(--muted); font-size: 13px; }

.pitch {
    position: relative;
    overflow: hidden;
    background: #fff;
    user-select: none;
}
.pitch::before {
    content: "";
    position: absolute;
    inset: -1px;
    background: linear-gradient(90deg, transparent 49.8%, rgba(0,0,0,.035) 50%, transparent 50.2%);
    pointer-events: none;
}
.center-arc {
    position: absolute;
    top: -78px;
    left: 50%;
    width: 150px;
    height: 150px;
    transform: translateX(-50%);
    border: 2px solid #747474;
    border-radius: 50%;
}
.penalty-box {
    position: absolute;
    bottom: -1px;
    left: 50%;
    width: 58%;
    height: 124px;
    transform: translateX(-50%);
    border: 2px solid #747474;
}
.goal-box {
    position: absolute;
    bottom: -1px;
    left: 50%;
    width: 27%;
    height: 48px;
    transform: translateX(-50%);
    border: 2px solid #747474;
}
.penalty-arc {
    position: absolute;
    bottom: 80px;
    left: 50%;
    width: 112px;
    height: 64px;
    transform: translateX(-50%);
    border: 2px solid #747474;
    border-bottom: 0;
    border-radius: 80px 80px 0 0;
}
.penalty-spot {
    position: absolute;
    bottom: 76px;
    left: 50%;
    width: 5px;
    height: 5px;
    transform: translateX(-50%);
    border-radius: 50%;
    background: #747474;
}

.pitch-player {
    position: absolute;
    z-index: 2;
    width: 48px;
    height: 48px;
    padding: 0;
    display: grid;
    place-content: center;
    transform: translate(-50%, -50%);
    border: 2px solid var(--home);
    border-radius: 50%;
    background: #fff;
    cursor: grab;
    line-height: 1;
    touch-action: none;
    will-change: left, top, transform;
    transition:
        left .16s cubic-bezier(.2, .75, .25, 1),
        top .16s cubic-bezier(.2, .75, .25, 1),
        transform .14s ease,
        box-shadow .14s ease,
        background-color .14s ease,
        color .14s ease;
}
.pitch-player:active { cursor: grabbing; }
.team-away .pitch-player { border-color: var(--away); }
.pitch-player:hover { color: #fff; background: var(--home); }
.team-away .pitch-player:hover { background: var(--away); }
.pitch-player.is-dragging {
    z-index: 12;
    transform: translate(-50%, -50%) scale(1.08);
    cursor: grabbing;
    box-shadow: 0 10px 24px rgba(17, 20, 24, .24);
    transition:
        transform .1s ease,
        box-shadow .1s ease,
        background-color .1s ease,
        color .1s ease;
}
.pitch-player.is-swap-target {
    z-index: 8;
    transform: translate(-50%, -50%) scale(1.12);
    box-shadow: 0 0 0 5px rgba(17, 20, 24, .13);
}
.pitch.is-moving-player .pitch-player:not(.is-dragging):not(.is-swap-target) {
    opacity: .78;
}
.pitch-player strong { font-size: 12px; }
.pitch-player span { max-width: 42px; margin-top: 2px; overflow: hidden; font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }

.lineup-block { display: grid; grid-template-rows: 42px 1fr; overflow: hidden; }
.lineup-head, .lineup-list > div { display: grid; grid-template-columns: 1fr 1fr; }
.lineup-head { background: var(--home); color: #fff; font-size: 14px; font-weight: 900; }
.team-away .lineup-head { background: var(--away); }
.lineup-head span, .lineup-list span { display: grid; place-items: center; padding: 3px; text-align: center; }
.lineup-head span + span, .lineup-list span + span { border-left: 1px solid #747474; }
.lineup-list { display: grid; grid-template-rows: repeat(11, 1fr); }
.lineup-list > div { min-height: 0; border-top: 1px solid #888; }
.lineup-list span { overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.lineup-list > div > :nth-child(2) { border-left: 1px solid #747474; }
.lineup-player-button {
    position: relative;
    min-width: 0;
    padding: 3px;
    overflow: visible;
    border: 0;
    background: transparent;
    font-size: 10px;
    text-align: center;
    cursor: pointer;
}
.lineup-player-button:hover { background: #edf0f2; }
.lineup-player-button.selected {
    outline: 2px solid var(--ink);
    outline-offset: -2px;
    background: #fff4c7;
}
.lineup-player-button > span { display: block; padding: 0; }
.lineup-empty { color: var(--muted); }
.match-event-badges {
    position: absolute;
    top: -6px;
    right: -7px;
    z-index: 3;
    display: flex;
    gap: 2px;
    font-style: normal;
}
.lineup-player-button .match-event-badges {
    top: 1px;
    right: 2px;
}
.match-event {
    width: 15px;
    height: 15px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(0, 0, 0, .18);
    border-radius: 50%;
    background: #fff;
    color: #111;
    font-size: 9px;
    font-style: normal;
    font-weight: 900;
    line-height: 1;
}
.match-event-yellow { color: #e5b800; }
.match-event-red { color: #d2232a; }
.match-event-sub-in { color: #128343; }
.match-event-sub-out { color: #b34b22; }

.coach-row {
    height: 70px;
    margin-top: 10px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.coach { display: grid; grid-template-columns: 165px 1fr; border: 1px solid #747474; }
.coach > strong { display: grid; place-items: center; background: var(--home); color: #fff; font-size: 18px; }
.coach.team-away > strong { background: var(--away); }
.coach p {
    margin: 0;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.35;
}
.coach-name {
    align-self: flex-start;
    margin-bottom: 5px;
    padding: 3px 9px;
    background: var(--home);
    color: #fff;
    font-size: 14px;
    line-height: 1.2;
}
.coach.team-away .coach-name { background: var(--away); }
.coach p span { color: #555b61; font-weight: 600; }

.match-sheet-secondary { display: grid; grid-template-rows: 155px 1fr; gap: 12px; }
.info-section { min-height: 0; display: grid; grid-template-rows: 44px 1fr; border: 1px solid #777; }
.info-section h2 {
    margin: 0;
    display: grid;
    place-items: center;
    background: var(--section);
    font-size: 18px;
    font-weight: 900;
}
.referee-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; padding: 8px; font-size: 12px; }
.referee-grid p { margin: 4px 0; }
.editorial-grid { min-height: 0; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1.4fr; gap: 12px; }
.info-content { padding: 12px; font-size: 13px; line-height: 1.5; }
.info-content p { margin: 0 0 10px; }
.info-content dl { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.info-content dl div { padding-bottom: 8px; border-bottom: 1px solid #ddd; }
.info-content dt { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.info-content dd { margin: 3px 0 0; font-weight: 700; }
.history-matchup {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 9px;
    border-bottom: 1px solid #d6d8db;
}
.history-matchup span,
.next-match > span,
.team-report header span {
    color: var(--muted);
    font-size: 9px;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.history-matchup strong { font-size: 17px; }
.history-matchup em,
.next-match em { color: var(--muted); font-style: normal; }
.history-squad-counts {
    margin-top: 9px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.history-squad-counts div {
    padding: 7px 10px;
    display: flex;
    gap: 8px;
    align-items: baseline;
    border-left: 4px solid var(--home);
    background: #f2f3f4;
}
.history-squad-counts div.away { border-left-color: var(--away); }
.history-squad-counts strong { font-size: 18px; }
.history-squad-counts span { color: #4f5358; font-size: 10px; font-weight: 700; }
.history-stats {
    margin-top: 9px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border: 1px solid #cfd2d5;
}
.history-stats div { padding: 7px 5px; text-align: center; }
.history-stats div + div { border-left: 1px solid #cfd2d5; }
.history-stats strong { display: block; font-size: 19px; line-height: 1; }
.history-stats span {
    margin-top: 4px;
    display: block;
    color: var(--muted);
    font-size: 8px;
    font-weight: 800;
    line-height: 1.2;
    text-transform: uppercase;
}
.next-matches {
    margin-top: 9px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.next-match {
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid #d4d6d9;
    border-top: 3px solid var(--home);
}
.next-match.away { border-top-color: var(--away); }
.next-match strong,
.next-match small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.next-match strong { margin: 3px 0; font-size: 11px; }
.next-match small { color: var(--muted); font-size: 9px; line-height: 1.35; }
.editorial-empty { padding: 9px; background: #f2f3f4; color: var(--muted); }
.team-reports {
    height: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.team-report {
    min-width: 0;
    border: 1px solid #d0d3d6;
    border-top: 4px solid var(--home);
    background: #fafafa;
}
.team-report.away { border-top-color: var(--away); }
.team-report header { padding: 9px 11px 8px; border-bottom: 1px solid #ddd; }
.team-report header span,
.team-report header strong { display: block; }
.team-report header strong { margin-top: 3px; font-size: 14px; }
.team-report-group { padding: 8px 10px; }
.team-report-group + .team-report-group { border-top: 1px solid #ddd; }
.team-report-group h3 {
    margin: 0 0 5px;
    display: flex;
    justify-content: space-between;
    color: #34383d;
    font-size: 9px;
    letter-spacing: .06em;
    text-transform: uppercase;
}
.team-report-group h3 b {
    min-width: 20px;
    padding: 2px 5px;
    border-radius: 10px;
    background: #e3e5e7;
    text-align: center;
}
.team-report-group ul { margin: 0; padding: 0; list-style: none; }
.team-report-group li {
    min-width: 0;
    padding: 3px 0;
    display: grid;
    grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr);
    gap: 6px;
    border-top: 1px dotted #d4d6d8;
    font-size: 9px;
}
.team-report-group li strong,
.team-report-group li span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.team-report-group li span,
.team-report-group p,
.team-report-group small {
    color: var(--muted);
}
.team-report-group p { margin: 3px 0; font-size: 9px; }
.team-report-group small { font-size: 8px; }
.curiosities-dense .info-content { padding: 7px; }
.curiosities-dense .team-reports { gap: 6px; }
.curiosities-dense .team-report { border-top-width: 3px; }
.curiosities-dense .team-report header { padding: 5px 7px; }
.curiosities-dense .team-report header strong { margin-top: 1px; font-size: 11px; }
.curiosities-dense .team-report-group { padding: 4px 6px; }
.curiosities-dense .team-report-group h3 { margin-bottom: 2px; font-size: 8px; }
.curiosities-dense .team-report-group h3 b { min-width: 18px; padding: 1px 4px; }
.curiosities-dense .team-report-group li { padding: 1px 0; font-size: 8px; line-height: 1.15; }
.curiosities-dense .team-report-group p { margin: 1px 0; font-size: 8px; }
.curiosities-ultra-dense .team-report header { padding: 3px 5px; }
.curiosities-ultra-dense .team-report header strong { font-size: 10px; }
.curiosities-ultra-dense .team-report-group { padding: 2px 5px; }
.curiosities-ultra-dense .team-report-group li { padding: 0; font-size: 7px; }
.notes-lines { margin: 12px; background: repeating-linear-gradient(to bottom, transparent 0, transparent 31px, #d7d7d7 32px); }

.player-detail {
    --player-accent: var(--home);
    position: fixed;
    top: 0;
    right: -440px;
    z-index: 30;
    width: min(420px, 100%);
    height: 100vh;
    padding: 56px 32px 32px;
    overflow-y: auto;
    background: #fff;
    box-shadow: -20px 0 60px rgba(0,0,0,.16);
    transition: right .25s ease;
}
.player-detail.team-away { --player-accent: var(--away); }
.player-detail.active { right: 0; }
.close-btn {
    position: absolute;
    top: 16px;
    right: 18px;
    width: 34px;
    height: 34px;
    border: 1px solid #ccc;
    background: #fff;
    cursor: pointer;
    font-size: 24px;
}
.modal-backdrop { position: fixed; inset: 0; z-index: 29; display: none; background: rgba(0,0,0,.32); }
.modal-backdrop.active { display: block; }
.action-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: none;
    padding: 20px;
    place-items: center;
    background: rgba(16, 18, 21, .58);
    backdrop-filter: blur(3px);
}
.action-modal-backdrop.active { display: grid; }
.action-modal {
    position: relative;
    width: min(100%, 480px);
    padding: 32px;
    border-top: 5px solid var(--home);
    background: #fff;
    box-shadow: 0 28px 90px rgba(0, 0, 0, .3);
}
.action-modal-close {
    position: absolute;
    top: 12px;
    right: 14px;
    width: 32px;
    height: 32px;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 24px;
    cursor: pointer;
}
.action-modal-label {
    display: block;
    color: var(--home);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .12em;
    text-transform: uppercase;
}
.action-modal h2 {
    margin: 9px 36px 10px 0;
    font-size: 24px;
    line-height: 1.12;
}
.action-modal p {
    margin: 0;
    color: #5b6067;
    font-size: 14px;
    line-height: 1.55;
}
.action-modal-buttons {
    margin-top: 26px;
    display: flex;
    gap: 9px;
    justify-content: flex-end;
}
.action-modal-buttons button {
    min-height: 42px;
    padding: 9px 15px;
    border: 1px solid #b9bdc3;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .03em;
    text-transform: uppercase;
    cursor: pointer;
}
.action-modal-secondary { background: #fff; color: var(--ink); }
.action-modal-primary { border-color: var(--home) !important; background: var(--home); color: #fff; }
.action-modal-buttons button:focus-visible {
    outline: 3px solid rgba(22, 22, 22, .25);
    outline-offset: 2px;
}
.app-loading {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
    padding: 20px;
    place-items: center;
    background: rgba(238, 240, 242, .88);
    backdrop-filter: blur(5px);
}
.app-loading.active {
    display: grid;
    animation: loading-fade-in .2s ease-out both;
}
.app-loading-card {
    width: min(100%, 330px);
    padding: 30px 28px 26px;
    overflow: hidden;
    border-top: 4px solid var(--home);
    background: #fff;
    box-shadow: 0 24px 80px rgba(20, 24, 30, .2);
    text-align: center;
}
.loading-ball {
    width: 58px;
    height: 58px;
    margin: 0 auto 17px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #f1f3f4;
    font-size: 35px;
    filter: drop-shadow(0 5px 5px rgba(0, 0, 0, .18));
    animation: loading-ball-move 1.15s ease-in-out infinite;
}
.app-loading-card strong,
.app-loading-card > span { display: block; }
.app-loading-card strong { font-size: 16px; }
.app-loading-card > span {
    margin-top: 7px;
    color: var(--muted);
    font-size: 11px;
}
.loading-progress {
    height: 3px;
    margin-top: 22px;
    overflow: hidden;
    background: #e5e7e9;
}
.loading-progress i {
    width: 42%;
    height: 100%;
    display: block;
    background: linear-gradient(90deg, var(--home), var(--away));
    animation: loading-progress-move 1.05s ease-in-out infinite;
}
@keyframes loading-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes loading-ball-move {
    0%, 100% { transform: translateX(-15px) rotate(-18deg) scale(.96); }
    50% { transform: translateX(15px) rotate(18deg) scale(1.05); }
}
@keyframes loading-progress-move {
    from { transform: translateX(-110%); }
    to { transform: translateX(350%); }
}
@media (prefers-reduced-motion: reduce) {
    .app-loading.active,
    .loading-ball,
    .loading-progress i { animation-duration: .01ms; animation-iteration-count: 1; }
}
.player-modal-head { text-align: center; }
.player-avatar {
    width: 96px;
    height: 96px;
    margin: 0 auto 16px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 50%;
    background: #eceeef;
    color: var(--player-accent);
    font-size: 30px;
    font-weight: 900;
}
.player-avatar img { width: 100%; height: 100%; object-fit: cover; }
.player-modal-head span { color: var(--player-accent); font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.player-modal-head h2 { margin: 6px 0; font-size: 29px; }
.player-modal-head p { margin: 0; color: var(--muted); }
.player-facts { margin: 30px 0; display: grid; grid-template-columns: repeat(3, 1fr); border-block: 1px solid #ddd; }
.player-facts div { padding: 16px 6px; text-align: center; }
.player-facts div + div { border-left: 1px solid #ddd; }
.player-facts dt { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.player-facts dd { margin: 5px 0 0; font-weight: 800; }
.player-description { padding: 16px; border-left: 3px solid var(--player-accent); background: #f3f4f5; color: #4c5056; line-height: 1.55; }
.player-description > strong { color: var(--ink); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.player-description p { margin: 7px 0; }
.player-description small { color: var(--muted); font-size: 9px; }
.player-profile-extras {
    margin-top: 11px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    border: 1px solid #d3d6d8;
    background: #fff;
}
.player-profile-extras div { padding: 9px 8px; text-align: center; }
.player-profile-extras div:nth-child(even) { border-left: 1px solid #d3d6d8; }
.player-profile-extras div:nth-child(n + 3) { border-top: 1px solid #d3d6d8; }
.player-profile-extras strong,
.player-profile-extras span { display: block; }
.player-profile-extras strong { color: var(--ink); font-size: 13px; }
.player-profile-extras span {
    margin-top: 2px;
    color: var(--muted);
    font-size: 8px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.profile-extra-empty { padding: 10px; background: #fff; color: var(--muted); font-size: 11px; }
.ai-profile-text { margin-top: 12px !important; }

.player-season {
    margin: 0 0 24px;
}
.player-season h3 {
    margin: 0 0 12px;
    font-size: 13px;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.player-season-stats {
    margin-top: 13px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border: 1px solid #ddd;
}
.player-season-stats b {
    padding: 8px 4px;
    text-align: center;
    font-size: 15px;
}
.player-season-stats b:nth-child(3n + 2),
.player-season-stats b:nth-child(3n + 3) { border-left: 1px solid #ddd; }
.player-season-stats b:nth-child(n + 4) { border-top: 1px solid #ddd; }
.player-season-stats small {
    margin-top: 2px;
    display: block;
    color: var(--muted);
    font-size: 8px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.player-stats-message {
    margin: 0;
    padding: 16px;
    background: #f3f4f5;
    color: var(--muted);
}
.player-stats-summary {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 12px;
}
.player-discipline {
    margin: 7px 0 0;
    padding: 7px 9px;
    border-left: 3px solid #e2b600;
    background: #fff8d9;
    color: #575027;
    font-size: 11px;
    font-weight: 700;
}

.history-page {
    max-width: 1180px;
    margin: 0 auto;
    padding: 14px clamp(18px, 4vw, 54px) clamp(36px, 6vw, 76px);
}
.history-page-head {
    margin-bottom: 40px;
    display: grid;
    grid-template-columns: 1fr minmax(330px, 430px);
    gap: 56px;
    align-items: end;
}
.history-back {
    margin-bottom: 34px;
    display: inline-block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
}
.history-back:hover, .history-back:focus-visible { color: var(--home); }
.history-page h1 {
    margin: 0;
    font-size: clamp(38px, 5vw, 64px);
    letter-spacing: -.045em;
    line-height: 1;
}
.history-page-head > div > p { margin: 14px 0 0; color: var(--muted); }
.history-search {
    padding: 24px;
    border-top: 4px solid var(--home);
    background: #fff;
    box-shadow: 0 16px 46px rgba(20, 24, 30, .09);
}
.history-search label {
    margin-bottom: 10px;
    display: block;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
}
.history-search > div { display: grid; grid-template-columns: 1fr auto; }
.history-search input {
    min-width: 0;
    padding: 13px 14px;
    border: 1px solid #c9ccd0;
    outline: 0;
    background: #fafafa;
}
.history-search input:focus { border-color: var(--ink); }
.history-search button {
    padding: 0 20px;
    border: 0;
    background: #161616;
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}
.history-search > a {
    margin-top: 9px;
    display: inline-block;
    color: var(--muted);
    font-size: 11px;
}
.history-results-meta { margin-bottom: 12px; color: var(--muted); font-size: 12px; }
.history-results-meta strong { color: var(--ink); }
.history-card {
    min-height: 126px;
    margin-bottom: 10px;
    display: grid;
    grid-template-columns: 118px 1fr 140px;
    align-items: stretch;
    border: 1px solid #c8cbd0;
    background: #fff;
}
.history-card-date {
    padding: 18px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-right: 1px solid #d7dade;
    color: var(--muted);
}
.history-card-date span {
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.history-card-date strong { margin-top: 5px; color: var(--ink); font-size: 15px; }
.history-card-date small { margin-top: 2px; }
.history-card-content {
    min-width: 0;
    padding: 20px 24px;
    align-self: center;
}
.history-card-content > span {
    color: var(--home);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.history-card-content h2 {
    margin: 7px 0 6px;
    overflow: hidden;
    font-size: 23px;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.history-card-content h2 i {
    padding: 0 5px;
    color: var(--muted);
    font-style: normal;
    font-weight: 400;
}
.history-card-content p {
    margin: 0;
    overflow: hidden;
    color: var(--muted);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.history-open {
    display: grid;
    place-items: center;
    border-left: 1px solid #d7dade;
    color: var(--ink);
    font-size: 12px;
    font-weight: 800;
    text-decoration: none;
}
.history-open:hover, .history-open:focus-visible { background: var(--home); color: #fff; }
.history-empty {
    padding: 54px 24px;
    border: 1px dashed #b8bcc2;
    background: rgba(255, 255, 255, .55);
    text-align: center;
}
.history-empty p { margin: 8px 0 0; color: var(--muted); }
.history-pagination {
    margin-top: 28px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    color: var(--muted);
    font-size: 12px;
}
.history-pagination a { color: var(--ink); font-weight: 800; text-decoration: none; }
.history-pagination a:last-child, .history-pagination span:last-child { text-align: right; }
.history-pagination [aria-disabled="true"] { opacity: .4; }

@media (max-width: 900px) {
    .app-header p { display: none; }
    .app-main { padding: 8px 18px 24px; }
    .search-stage { grid-template-columns: 1fr; align-content: start; gap: 42px; }
    .search-copy h1 { font-size: clamp(42px, 13vw, 68px); }
    .matches-list { grid-template-columns: 1fr; }
    .sheet-scroll { margin-inline: -18px; padding: 0 18px 20px; overflow-x: auto; }
    .sheet-actions { margin-inline: 0; }
    .sheet-action-group { flex-wrap: wrap; justify-content: flex-end; }
    .sheet-save-status { width: 100%; max-width: none; }
    .history-page-head { grid-template-columns: 1fr; gap: 28px; }
    .history-card { grid-template-columns: 92px 1fr; }
    .history-open {
        grid-column: 1 / -1;
        min-height: 46px;
        border-top: 1px solid #d7dade;
        border-left: 0;
    }
}

@page { size: A4 landscape; margin: 5mm; }

@media print {
    body { background: #fff; }
    .app-header, .sheet-actions, .formation-toolbar, .modal-backdrop, .action-modal-backdrop, .app-loading, .player-detail { display: none !important; }
    .app-main { padding: 0; }
    .sheet-scroll { display: block; }
    .match-sheet {
        width: 287mm;
        height: 200mm;
        min-height: 0;
        margin: 0;
        padding: 2mm;
        box-shadow: none;
        break-after: page;
        page-break-after: always;
        transform-origin: top left;
    }
    .match-sheet:last-child { break-after: auto; page-break-after: auto; }
    .sheet-match-header { min-height: 14mm; }
    .match-layout { grid-template-rows: repeat(2, 80mm); gap: 1.5mm 2mm; }
    .coach-row { height: 13mm; margin-top: 1.5mm; gap: 2mm; }
    .match-sheet-secondary { grid-template-rows: 29mm 1fr; gap: 2mm; }
    .match-sheet-secondary.has-dense-curiosities { grid-template-rows: 26mm 1fr; }
    .curiosities-dense.info-section { grid-template-rows: 9mm 1fr; }
    .curiosities-dense .info-content { padding: 1.2mm; }
    .curiosities-dense .team-reports { gap: 1mm; }
    .curiosities-dense .team-report header { padding: .8mm 1.2mm; }
    .curiosities-dense .team-report-group { padding: .7mm 1mm; }
    .curiosities-dense .team-report-group li { padding: .2mm 0; font-size: 7px; }
    .editorial-grid { gap: 2mm; }
}
