:root[data-theme]{--radius:16px;--red:var(--accent2);--red2:var(--accent);--green:var(--accent);--green-2:var(--accent2);--green-dark:var(--accent);--lime:var(--accent);--ink:var(--text);--panel-2:var(--panel2);--line-strong:var(--accent);--info:var(--accent)}
:root[data-theme=light]{color-scheme:light;--bg:#f4f9ff;--panel:#fff;--panel2:#eaf3fc;--text:#092651;--muted:#496885;--accent:#087eae;--accent2:#ae17cf;--line:#c7dfef;--danger:#ba1549;--warning:#8a6300;--field:#e5f3ed;--stripe:#d5e9e0;--field-line:#83b4a1;--success:#08744e;--shadow:0 8px 28px #163d6c0b}
:root[data-theme=dark]{color-scheme:dark;--bg:#090c20;--panel:#121a37;--panel2:#1b2446;--text:#f1f5ff;--muted:#b1bdd7;--accent:#57d7f2;--accent2:#ed74d5;--line:#33456c;--danger:#ff809e;--warning:#ffe18c;--field:#102e36;--stripe:#143d43;--field-line:#58818d;--success:#5de9b1;--shadow:0 8px 30px #0003}
html[data-theme],html[data-theme] body{background:var(--bg);color:var(--text)}
html[data-theme] body{background-image:radial-gradient(ellipse at 90% 0,color-mix(in srgb,var(--accent) 9%,transparent),transparent 40%),radial-gradient(ellipse at 0 70%,color-mix(in srgb,var(--accent2) 5%,transparent),transparent 40%)}
html[data-theme] body:before{opacity:.06}html[data-theme] :is(h1,h2,h3,h4,h5,h6){color:var(--text)}
html[data-theme] :is(.panel,.panel-card,.card,.stat-card,.metric-card,.result-card,.news-card,.team-card,.standings-card,.squad-player,.event-player-card,.protocol-section,.event-row,.modal-content,.admin-card,.round-lineup-list li,.round-status){background:var(--panel);color:var(--text);border-color:var(--line);box-shadow:var(--shadow)}
html[data-theme] :is(.panel,.stat-card,.card,.match-hero,.profile-hero,.standings-card){border-radius:16px}
html[data-theme] :is(.panel,.card,.stat-card):before{background:linear-gradient(90deg,var(--accent),var(--accent2));box-shadow:none}
html[data-theme] :is(header,.topbar,.site-header,.site-footer,.admin-nav,.admin-mobile-nav,.mobile-menu,.main-nav.open,.protocol-savebar){background:var(--panel);color:var(--text);border-color:var(--line);box-shadow:none}
html[data-theme] :is(.main-nav a,.brand small,.brand-name,.brand strong,.menu-button,.mobile-menu-button,.section-heading h2){color:var(--text)}
html[data-theme] :is(.muted,small,.note,.eyebrow,.kicker,.meta-row,.competition,.news-copy p,.card p,.news-copy time,.fact dt,.metric span,.subtitle,.hint,.form-hint,.stat-label,.brand-caption,.field-help,.formation-label,[data-player-meta]){color:var(--muted)}
html[data-theme] :is(.eyebrow,.section-heading a,.more-link,.card-tag){color:var(--accent)}
html[data-theme] :is(input,select,textarea){background:var(--panel);color:var(--text);border-color:var(--line);accent-color:var(--accent)}
html[data-theme] :is(input,select,textarea):focus-visible{outline:2px solid var(--accent);outline-offset:2px;box-shadow:0 0 0 4px color-mix(in srgb,var(--accent) 12%,transparent)}
html[data-theme] :is(input,textarea)::placeholder{color:var(--muted);opacity:.85}
html[data-theme] option{background:var(--panel);color:var(--text)}
html[data-theme] :is(button,.action,.btn,.button){background:var(--panel2);color:var(--text);border:1px solid var(--line);box-shadow:none}
html[data-theme] :is(.btn-primary,.button.primary,.protocol-savebar>button,#round-publish,#save-protocol,#approve-protocol){background:linear-gradient(110deg,#087cae,#7032d0 66%,#a519b0);border-color:transparent;color:#fff}
html[data-theme] :is(button,.action,.btn,.button):focus-visible{outline:3px solid var(--accent);outline-offset:3px}
html[data-theme] :is([aria-pressed=true],.selected,.tabs .active,.nav a.active,.admin-nav a.active,.view-switch button[aria-pressed=true],.round-history button[aria-pressed=true]){background:var(--accent);color:var(--bg);border-color:var(--accent);outline-color:var(--accent2)}
html[data-theme=light] :is([aria-pressed=true],.selected,.tabs .active,.nav a.active,.admin-nav a.active){color:#fff}
html[data-theme] :is(.metric,.stat,.summary-stat,.summary-item,.stat-box,.stat-item){background:var(--panel2);border-color:var(--line);color:var(--text)}
html[data-theme] :is(.metric strong,.stat-value,.summary-item strong){color:var(--accent)}
html[data-theme] .metric:nth-child(3n+2) strong{color:var(--accent2)}html[data-theme] .metric:nth-child(3n) strong{color:var(--success)}
html[data-theme] :is(table,th,td,tr,.fact,.match-link,.match-stat,.table-wrap th,.table-wrap td){border-color:var(--line)}
html[data-theme] :is(th,thead){background:var(--panel2);color:var(--muted)}html[data-theme] :is(tbody tr:nth-child(even)){background:color-mix(in srgb,var(--panel2) 45%,transparent)}
html[data-theme] :is(.team-logo,.club-mark,.jersey-badge,.tag,.badge,.status-badge,.version-badge){background:var(--panel2);color:var(--text);border-color:var(--line)}
html[data-theme] :is(.error,.danger,.btn-danger,[role=alert]){color:var(--danger)}
html[data-theme] :is(.event-yellow,.player-actions .event-yellow){background:#f6d755;color:#402e00;border-color:#bba239}
html[data-theme] :is(.event-red,.player-actions .event-red){background:#bc1d47;color:#fff;border-color:#bc1d47}
html[data-theme] :is(.event-badge,.player-event-badge,.match-badge){background:var(--panel2);color:var(--text);border-color:var(--line)}
html[data-theme] .match-mvp{color:var(--warning)}html[data-theme] .form .win{background:#d3f2e4;color:#07583e}html[data-theme] .form .loss{background:#ffe0e9;color:#9d1c3c}
html[data-theme] :is(.match-state.live,.live-badge){background:#bf1545;color:#fff;border-color:#ec5280}
html[data-theme] :is(.hero-copy,.hero-content){color:#fff}html[data-theme] :is(.hero-copy,.hero-content) :is(h1,p,.kicker,.eyebrow){color:#fff}
html[data-theme] .hero-shade{background:linear-gradient(90deg,#071743f0,#1729658a 50%,#34174933)}
html[data-theme] .hero-image{filter:hue-rotate(205deg) saturate(1.25)}
html[data-theme] .cta{background:linear-gradient(110deg,#087cae,#432eb2,#a519b0);color:#fff}html[data-theme] .cta h2{color:#fff}
html[data-theme] :is(.match-hero,.match-header){background:linear-gradient(120deg,var(--panel),var(--panel2));border-color:var(--line);color:var(--text)}
html[data-theme] .football-pitch{background:repeating-linear-gradient(0deg,var(--field),var(--field) 12.5%,var(--stripe) 12.5%,var(--stripe) 25%);border-color:var(--field-line);color:var(--text)}
html[data-theme] .football-pitch :is(.pitch-midline,.pitch-circle,.pitch-box,.pitch-goal){border-color:var(--field-line)}
html[data-theme] .formation-pin,html[data-theme] .formation-pitch-scroll .empty-slot{background:var(--panel);color:var(--text);border-color:var(--accent);box-shadow:0 4px 10px #0001}
html[data-theme] .pitch-player :is(a,strong,small){background:var(--panel);color:var(--text)}
html[data-theme] .pitch-player .player-avatar{background:var(--panel2);border-color:var(--line)}
html[data-theme] dialog{background:var(--panel);color:var(--text);border:1px solid var(--line);border-radius:18px;box-shadow:0 20px 90px #0006}dialog::backdrop{background:#061a3d99;backdrop-filter:blur(3px)}
.rlf-theme-toolbar{display:flex;justify-content:flex-end;align-items:center;padding:6px max(12px,calc((100% - 1280px)/2));background:var(--panel);border-bottom:1px solid var(--line);gap:10px}
.rlf-theme-toolbar [data-theme-toggle]{min-height:44px;padding:8px 16px;border-radius:24px;font:600 14px system-ui;white-space:nowrap}
.formation-player-dialog{width:min(560px,calc(100vw - 24px));max-height:calc(100dvh - 32px);padding:20px;overflow:auto;overscroll-behavior:contain}
.formation-dialog-head{display:flex;align-items:start;gap:14px;justify-content:space-between}.formation-dialog-head h3{font-size:20px;margin:8px 0;overflow-wrap:anywhere}.formation-dialog-head button{flex-shrink:0;min-width:44px;min-height:44px}
.formation-candidates{display:grid;gap:8px;margin:14px 0;max-height:46dvh;overflow:auto}.formation-candidates button{display:flex;align-items:center;gap:14px;padding:12px;text-align:left;min-height:60px}.formation-candidates button>span{min-width:0;overflow-wrap:anywhere}.formation-candidates small{display:block}.formation-candidates b{min-width:38px;color:var(--accent)}
.formation-tools{display:flex;flex-wrap:wrap;gap:10px}.formation-tools button{min-height:46px}.formation-pin{touch-action:none}.score-first input[type=number]{width:100%;font-size:32px;font-weight:800;text-align:center}.score-first .grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.round-avatar{position:relative;display:inline-grid;place-items:center;width:70px;height:76px;flex-shrink:0}.round-avatar img{width:100%;height:100%;object-fit:contain}.round-avatar b{position:absolute;left:50%;top:48%;transform:translate(-50%,-50%);font:900 22px system-ui;color:#fff;-webkit-text-stroke:1px #12214a;paint-order:stroke fill;text-shadow:0 1px 3px #00142b,0 0 5px #00142b}.round-avatar.logo b{display:none}.round-avatar.jersey{background:transparent}.round-avatar.jersey.no-kit{background:var(--panel2);border:1px dashed var(--accent);border-radius:12px}.round-avatar.jersey.no-kit b{top:50%;font-size:24px}.round-avatar.jersey.no-kit:after{content:'Нет фото формы';font-size:8px;position:absolute;bottom:2px;color:var(--muted)}
.round-pitch .pitch-player{display:flex;align-items:center;flex-direction:column;gap:3px}.round-pitch .pitch-player .round-avatar{width:64px;height:70px}.round-pitch .pitch-player>a{width:100%;padding:4px;border-radius:4px;text-align:center}.round-pitch .pitch-player small{width:100%;border-radius:4px;text-align:center}.round-public-tools .avatar-toggle-label{flex-basis:100%;color:var(--muted);font-size:13px}.round-lineup-page #round-public-view{border-radius:14px;overflow:hidden}.round-lineup-page #round-content>.panel>h2{padding-bottom:16px;border-bottom:3px solid transparent;border-image:linear-gradient(90deg,var(--accent),var(--accent2)) 1}
@media(max-width:600px){.rlf-theme-toolbar{padding:4px 12px}.rlf-theme-toolbar [data-theme-toggle]{font-size:13px}.formation-player-dialog{padding:14px}.formation-tools{display:grid;grid-template-columns:1fr}.formation-tools button{width:100%}.score-first .grid{grid-template-columns:repeat(2,minmax(0,1fr))}.round-public-tools button{flex:1 1 120px;min-height:44px}.protocol-section-nav{flex-wrap:wrap}.score-first{padding:16px!important}}
@media(prefers-reduced-motion:reduce){html[data-theme] *{scroll-behavior:auto!important;transition:none!important}}

html[data-theme] .metric-note{color:var(--muted)}html[data-theme] .status{background:var(--panel2);color:var(--accent);border-color:var(--line)}
html[data-theme] .round-history button[aria-pressed=true],html[data-theme] .squad-circles button[aria-pressed=true]{background:var(--accent);color:var(--bg);border-color:var(--accent)}
html[data-theme=light] .round-history button[aria-pressed=true],html[data-theme=light] .squad-circles button[aria-pressed=true]{color:#fff}
.player-profile-identity{display:flex;gap:24px;align-items:center}.player-profile-photo{width:180px;height:220px;object-fit:cover;border-radius:14px;background:var(--panel2)}.profile-team-logos{display:flex;gap:16px;align-items:center;flex-wrap:wrap}.profile-team-logos img{width:72px;height:80px;object-fit:contain}
@media(max-width:500px){.player-profile-identity{align-items:start;gap:14px;flex-wrap:wrap}.player-profile-photo{width:140px;height:175px}.player-profile-identity>div{flex:1 1 150px}}
/* Contrast across legacy registry, match centre and media pages. */
html[data-theme] :is(label,.form-section-title,.form-details summary,.check-line,.team-facts dd,.public-team-contact,.checkbox-field label,.tiebreaker-fieldset legend,.tiebreaker-grid label,.tournament-summary strong,.tournament-stage-list span,.public-tournament-meta strong,.stats-summary strong,.formation-pin b,.match-stat strong){color:var(--text)}
html[data-theme] :is(.match-competition,.match-facts,.event-legend,.lineup-group h4,.timeline-period,.timeline-event time,.timeline-event p,.match-stat-head,.calendar-weekday,.calendar-day small,.calendar-legend,.lead,.stage-inner p,.public-team-row,.team-kit-image,.public-team-kits figcaption){color:var(--muted)}
html[data-theme] :is(.side-link.active,.status-success,.status-info,.round-visibility.is-public,.lineup-number,.captain-mark){color:var(--accent);background:var(--panel2)}
html[data-theme] :is(.status-warn,.badge-warning,.round-visibility,.stats-warning){color:var(--warning);background:var(--panel2)}
html[data-theme] :is(.public-team-tags span,.public-tournament-stages span,.league-pill-list span,.stats-summary>span,.notice,.squad-list,.export-controls,.video-card,.protocol-card,.ref-card,.photo-preview,.calendar-day,.tabs,.code,code){background:var(--panel2);color:var(--text);border-color:var(--line)}
html[data-theme] :is(.protocol-summary,.canvas-wrap,.media-page .hero){background:linear-gradient(120deg,var(--panel),var(--panel2));color:var(--text);border-color:var(--line)}
html[data-theme] .calendar-day.empty-day{background:transparent;border-color:transparent}
html[data-theme] .calendar-day[aria-pressed=true]{background:var(--accent);color:var(--bg);border-color:var(--accent2)}html[data-theme] .calendar-day[aria-pressed=true] small{color:inherit}
html[data-theme] .calendar-day .cal-live{color:var(--danger)}
html[data-theme] .event-chip{background:var(--panel2);color:var(--text);border:1px solid var(--line)}
html[data-theme] .chip-yellow_card,html[data-theme] .chip-mvp{background:#fff0ab;color:#684a00;border-color:#dec16b}
html[data-theme] .chip-red_card,html[data-theme] .chip-second_yellow_red{background:#ffe2ea;color:#a71944;border-color:#eeafc0}
html[data-theme] .chip-penalty_goal,html[data-theme] .chip-missed_penalty,html[data-theme] .chip-penalty_awarded{background:var(--panel2);color:var(--accent);border-color:var(--line)}
html[data-theme] body:has(#export-canvas) .hero{background:linear-gradient(120deg,var(--panel),var(--panel2));color:var(--text)}html[data-theme] body:has(#export-canvas) .hero p{color:var(--muted)}
html[data-theme=dark] .event-chip{background:var(--panel);color:var(--text)}html[data-theme=dark] :is(.chip-yellow_card,.chip-mvp){color:#ffe18c;background:#453818}html[data-theme=dark] :is(.chip-red_card,.chip-second_yellow_red){color:#ffadc4;background:#4e203e}

.profile-photo-frame{position:relative;display:grid;place-items:center;width:180px;height:220px;flex-shrink:0;border-radius:14px;overflow:hidden;background:var(--panel2);color:var(--muted);text-align:center;font-size:14px}.profile-photo-frame .player-profile-photo{position:absolute;inset:0;width:100%;height:100%}
@media(max-width:500px){.profile-photo-frame{width:140px;height:175px}}
