/* Match editing and the nested sport-score dialog. */
#modal .match-entry-dialog,#legacyMatchDialog.match-entry-dialog{width:min(760px,100%);max-width:calc(100vw - 24px)}
.match-entry-dialog .modal-body{padding:24px;overflow-y:auto}
.match-entry-dialog .match-scoreboard{display:grid;grid-template-columns:minmax(0,1fr) 36px minmax(0,1fr);align-items:end;gap:12px;padding:20px;margin:20px 0 12px;border:1px solid #d5e3e8;border-radius:12px;background:#f4f8fa}
.match-entry-dialog .match-score-side{display:grid;justify-items:center;gap:8px;min-width:0;text-align:center}
.match-entry-dialog .match-score-team{font-size:17px;font-weight:700;color:#173b50;overflow-wrap:anywhere}
.match-entry-dialog .match-field-hint{font-size:12px;color:#526b7b}
.match-entry-dialog .match-score-side input{width:112px;max-width:100%;height:66px;padding:6px;text-align:center;font-size:30px;font-weight:750;line-height:1.2;background:#fff;border:1px solid #8baab9;border-radius:10px;font-variant-numeric:tabular-nums}
.match-entry-dialog .match-score-divider{height:66px;display:grid;place-items:center;font-size:28px;color:#647e8c}
.match-entry-dialog .detail,.match-entry-dialog .match-meta-fields{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:16px;margin:20px 0}
.match-entry-dialog label{min-width:0}
.match-entry-dialog .detail label,.match-entry-dialog .match-meta-fields label{display:grid;gap:7px;font-size:14px;font-weight:650}
.match-entry-dialog .form-control{min-width:0;width:100%;box-sizing:border-box}
.match-entry-dialog input[type=checkbox],.match-entry-dialog input[type=radio]{width:20px;height:20px;accent-color:#087f90}
.match-entry-dialog :is(input,select,button):focus-visible{outline:3px solid #218578;outline-offset:2px}
.match-entry-dialog #legacyMatchCard{display:none}
.match-entry-dialog #legacyMatchPublic{display:inline-block;margin-top:12px;font-size:13px}
.match-entry-dialog .actions{gap:12px;margin-top:24px}
.match-entry-dialog .match-extra-score{display:grid;justify-items:center;gap:6px;padding-top:12px;width:100%;border-top:1px solid #d5e3e8;text-align:center;font-size:12px;color:#526b7b;overflow-wrap:anywhere}
.match-entry-dialog .match-extra-score input{width:88px;max-width:100%;height:44px;text-align:center;font-size:18px;background:#fff}
.match-entry-dialog .match-extra-score[hidden]{display:none}
.match-entry-dialog .score-stepper{display:flex;align-items:center;justify-content:center;gap:4px;max-width:100%}
.match-entry-dialog .score-stepper button{flex:0 0 36px;width:36px;min-height:44px;padding:0;border:1px solid #b9ced8;border-radius:6px;background:#fff;color:#087d95;font-size:23px;cursor:pointer}
.match-entry-dialog .score-stepper input{width:80px;min-width:0;appearance:textfield}
.match-entry-dialog .score-stepper input::-webkit-inner-spin-button{appearance:none}
.match-entry-dialog .match-extra-score .score-stepper input{width:60px}
.match-entry-dialog .match-result-board{padding:10px;gap:8px;align-items:stretch;background:#fff}
.match-entry-dialog .match-team-panel{min-width:0;padding:16px 8px;border:1px solid #d5e3e8;border-radius:10px;background:#f4f8fa}
.match-entry-dialog .match-team-panel[data-state=win]{background:#dff3e7;border-color:#87b99b}
.match-entry-dialog .match-team-panel[data-state=lose]{background:#e7edf4;border-color:#aab9cb}
.match-entry-dialog .match-team-panel[data-state=draw]{background:#fff3d6;border-color:#d8c28c}
.match-entry-dialog .match-team-result{display:flex;align-items:center;justify-content:center;flex-direction:column-reverse;gap:0;margin-top:12px}
.match-entry-dialog .match-team-result label{display:inline-flex;align-items:center;gap:6px;min-height:44px;cursor:pointer;font-size:14px}
.match-entry-dialog [data-team-result],.match-entry-dialog [data-basic-result]{font-size:18px;color:#526b7b}
.match-entry-dialog [data-state=win] > .match-team-result > strong{color:#176545}
.match-entry-dialog [data-state=lose] > .match-team-result > strong{color:#3f536c}
.match-entry-dialog .match-team-panel .match-extra-score{margin-top:10px}
.match-entry-dialog .match-score-heading{grid-column:1 / -1;display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:8px 12px;padding:4px 4px 12px;border-bottom:1px solid #d5e3e8;margin-bottom:4px;color:#173b50}
.match-entry-dialog .match-score-heading > strong{font-size:15px}
.match-entry-dialog .match-score-detail-action{grid-column:1 / -1;display:flex;justify-content:center;padding-top:8px}
.match-entry-dialog #leagueSportDetails{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:44px;margin:0;white-space:normal}
.match-entry-dialog #leagueSportDetails[hidden]{display:none}
.match-entry-dialog .special-result-toggle{display:inline-flex;align-items:center;gap:8px;min-height:44px;padding:6px 12px;box-sizing:border-box;border:1px solid #b9ced8;border-radius:8px;background:#fff;font-size:13px;cursor:pointer}
.match-entry-dialog .special-result-toggle:has(input:checked){background:#dff1f5;border-color:#087d95;color:#075f73}
.match-entry-dialog .toggle-state::after{content:'OFF';font-size:11px;font-weight:700;color:#627b89}
.match-entry-dialog .special-result-toggle:has(input:checked) .toggle-state::after{content:'ON';color:#087d95}
.match-entry-dialog .match-result-board:has(.match-middle-controls){grid-template-columns:minmax(0,1fr) 96px minmax(0,1fr)}
.match-entry-dialog .match-middle-controls{display:flex;flex-direction:column;justify-content:center;align-items:center;gap:12px;min-width:0}
.match-entry-dialog .match-draw-choice{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;width:100%;box-sizing:border-box;padding:10px 6px;border:1px solid #bdcfd8;border-radius:8px;background:#fff;font-size:12px;text-align:center;cursor:pointer}
.match-entry-dialog .match-draw-choice:has(input:checked){background:#fff3d6;border-color:#c5a553}
.match-entry-dialog form:not([data-special-result=on]) .match-team-result > label,.match-entry-dialog form:not([data-special-result=on]) .match-middle-controls > :not(.match-score-divider){display:none}
.match-entry-dialog form:not([data-special-result=on]) .match-result-board:has(.match-middle-controls){grid-template-columns:minmax(0,1fr) 24px minmax(0,1fr)}
.match-entry-dialog .match-hover-help{position:relative;display:inline-flex}
.match-entry-dialog .match-hover-help > button{border:0;background:transparent;border-radius:4px;width:28px;height:28px;padding:0;color:#5e7b8b;font-size:19px;cursor:help}
.match-entry-dialog .match-hover-help > [role=tooltip]{position:fixed;inset:auto;margin:0;box-sizing:border-box;max-width:calc(100vw - 24px);padding:12px;border:1px solid #bfd4de;border-radius:8px;background:#fff;color:#304f60;font-size:13px;line-height:1.7;box-shadow:0 4px 16px #173b5024;z-index:2000;opacity:0;visibility:hidden;transform:translateY(5px);transition:opacity .15s ease,transform .15s ease;pointer-events:none}
.match-entry-dialog .match-hover-help > [role=tooltip].help-visible{opacity:1;visibility:visible;transform:none}
#legacyMatchScoreGrid .score-grid{width:100%;table-layout:fixed;border-collapse:collapse}
#legacyMatchScoreGrid .score-grid :is(th,td){padding:4px 3px;min-width:0;text-align:center;font-size:12px}
#legacyMatchScoreGrid .score-grid tr > :first-child{width:104px;text-align:left;padding-inline:8px;overflow-wrap:anywhere;box-sizing:border-box}
#legacyMatchScoreGrid .score-grid input{width:100%;min-width:0;max-width:100%;height:40px;min-height:40px;padding:2px;box-sizing:border-box;text-align:center;font-size:16px;border-radius:5px}
#legacyMatchScoreGrid .score-grid th{height:30px}
#legacyMatchScoreGrid .score-grid .score-total{font-size:15px;font-weight:700}
.match-entry-dialog .score-grid-actions{display:flex;align-items:center;justify-content:flex-end;flex-wrap:wrap;gap:8px 16px;margin:8px 0 16px}
.match-entry-dialog .score-grid-actions[hidden]{display:none}
.match-entry-dialog .score-grid-actions small{font-size:12px;color:#526b7b}
#legacyScoreDialog{width:min(900px,calc(100vw - 24px))}
#legacyScoreDialog #legacyMatchExtraFields > label{display:inline-grid;vertical-align:top;gap:6px;margin:8px 16px 8px 0;font-size:13px}
#legacyScoreDialog #legacyMatchExtraFields > label:has(textarea){display:grid !important;margin-right:0}
#legacyScoreDialog [data-score-content][hidden]{display:none}
.match-entry-dialog .score-entry-help.score-visibility-option{display:flex;justify-content:flex-end;margin:12px 0 0;padding:0;border:0;background:transparent}
.match-entry-dialog .score-visibility-option label{display:inline-flex;align-items:center;gap:6px;min-height:32px;color:#607a89;font-size:12px;font-weight:400;cursor:pointer}
.match-entry-dialog .score-visibility-option input[type=checkbox]{width:16px;height:16px}
.match-entry-dialog .score-visibility-option input[hidden]{display:none}
@media(max-width:540px){
.match-entry-dialog .modal-body{padding:16px}
.match-entry-dialog .match-score-team{font-size:14px}
.match-entry-dialog .match-score-side input{height:60px;font-size:28px}
.match-entry-dialog .match-score-divider{height:60px}
.match-entry-dialog .detail,.match-entry-dialog .match-meta-fields{grid-template-columns:minmax(0,1fr)}
.match-entry-dialog .score-stepper{gap:2px}
.match-entry-dialog .score-stepper button{flex-basis:24px;width:24px}
.match-entry-dialog .score-stepper input,.match-entry-dialog .match-extra-score .score-stepper input{width:38px}
.match-entry-dialog .match-result-board{gap:4px;padding:6px}
.match-entry-dialog .match-team-panel{padding:12px 4px}
.match-entry-dialog .match-result-board:has(.match-middle-controls){grid-template-columns:minmax(0,1fr) 60px minmax(0,1fr)}
.match-entry-dialog .score-stepper{flex-wrap:wrap}
}
@media(prefers-reduced-motion:reduce){.match-entry-dialog .match-hover-help > [role=tooltip]{transition:none}}

/* Tournament and league use the same score entry component. */
#matchModal .match-entry-dialog{width:min(760px,100%);border-radius:16px}
#matchModal .match-modal-header{background:#1c4054;padding:20px 24px}
#matchModal .match-modal-body{padding:24px}
#matchModal .modal-actions{align-items:center;flex-wrap:wrap;gap:12px}
#matchModal .modal-actions>span{display:flex;gap:12px;margin-left:auto}
#matchModal .score-stepper button:disabled{opacity:.45;cursor:not-allowed}
@media(max-width:600px){#matchModal{padding:12px}#matchModal .match-modal-body{padding:16px}#matchModal .match-modal-header{padding:16px}}

.match-entry-dialog .score-order-option{margin:8px 0 12px}
.match-entry-dialog .score-order-option label{display:inline-flex;align-items:center;gap:10px;margin:0;padding:10px 12px;border:1px solid #d5e3e8;border-radius:8px;background:#f4f8fa;font-size:14px;line-height:1.5;cursor:pointer}
.match-entry-dialog .score-order-option input[type=checkbox]{flex:0 0 18px;width:18px;height:18px;margin:0;cursor:pointer}
.match-entry-dialog .score-order-option label:has(input:checked){background:#e8f5f5;border-color:#81b9bf}
.match-entry-dialog .score-order-option label:focus-within{outline:2px solid #0085a5;outline-offset:2px}

.match-entry-dialog .match-forfeit-hint{display:none;grid-column:1 / -1;margin:0;text-align:center;color:#526b7b;font-size:13px;font-weight:400;line-height:1.6}
.match-entry-dialog .match-scoreboard:has(.special-result-toggle input:checked) .match-forfeit-hint{display:block}

.match-entry-dialog .detail,.match-entry-dialog .match-meta-fields{align-items:start}
.match-entry-dialog .detail label,.match-entry-dialog .match-meta-fields label{align-content:start}
.actual-match-time{grid-column:1 / -1;min-width:0}
.actual-match-time summary{cursor:pointer;color:#087f90;font-weight:650;padding:8px 0}
.actual-match-time summary:focus-visible{outline:3px solid #218578;outline-offset:2px}
.actual-match-time-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;margin-top:12px}
.actual-match-time-fields label{display:grid;gap:7px;min-width:0}
.actual-match-time-help{font-size:12px;color:#526b7b;margin:8px 0 0}
@media(max-width:600px){.actual-match-time-fields{grid-template-columns:minmax(0,1fr)}}
