/* Theme parity: correct legacy dark-on-dark and white-on-white islands.
 * Loaded last, after all legacy style sheets and the recovery dialog.
 * Photo/brand surfaces retain their own contrast and are not flattened. */
html[data-tp-theme="light"]{
  --tp-access-ink:#071c38;
  --tp-access-muted:#52637b;
  --tp-access-bg:#ffffff;
  --tp-access-soft:#f3f7fb;
  --tp-access-line:#dce5ed;
}
html[data-tp-theme="dark"]{
  --tp-access-ink:#f5f8f6;
  --tp-access-muted:#a4b8ae;
  --tp-access-bg:#0d1813;
  --tp-access-soft:#111f18;
  --tp-access-line:#304538;
}
html[data-tp-theme] :is(.tp-pool-admin-v3,.tp-gameplay-shell,.participant-layout,.survivor-layout,#builderBody,.tp-results-view,.tp-discovery-choice,.tp-account-view) {
  color:var(--tp-access-ink);
}
/* Legacy organizer rows were always near-black even in light theme. */
html[data-tp-theme="light"] :is(.tp-admin-rank-row,.tp-admin-progression-row,.tp-admin-round-banner){
  background:#f3f7fb!important;
  color:#071c38!important;
  border:1px solid #dce5ed!important;
}
html[data-tp-theme="light"] :is(.tp-admin-rank-row,.tp-admin-progression-row,.tp-admin-round-banner) :is(h2,h3,h4,strong,b,span:not(.pill)){
  color:#071c38!important;
  -webkit-text-fill-color:#071c38!important;
  opacity:1!important;
}
html[data-tp-theme="light"] :is(.tp-admin-rank-row,.tp-admin-progression-row,.tp-admin-round-banner) :is(p,small,.muted){
  color:#52637b!important;
  -webkit-text-fill-color:#52637b!important;
  opacity:1!important;
}
html[data-tp-theme="dark"] :is(.tp-admin-rank-row,.tp-admin-progression-row,.tp-admin-round-banner){
  background:#111f18!important;
  color:#f5f8f6!important;
  border:1px solid #304538!important;
}
html[data-tp-theme="dark"] :is(.tp-admin-rank-row,.tp-admin-progression-row,.tp-admin-round-banner) :is(h2,h3,h4,strong,b){
  color:#f5f8f6!important;
}
html[data-tp-theme="dark"] :is(.tp-admin-rank-row,.tp-admin-progression-row,.tp-admin-round-banner) :is(p,small,.muted){
  color:#a4b8ae!important;
}
/* Form controls inherit native dark styles in some embedded/legacy sections. */
html[data-tp-theme] :is(#builderBody,.tp-pool-admin-v3,.tp-gameplay-shell,.tp-results-view,.tp-auth-panel)
  :is(input:not([type="checkbox"]):not([type="radio"]),select,textarea){
  background:var(--tp-access-bg,#fff)!important;
  color:var(--tp-access-ink,#071c38)!important;
  border-color:var(--tp-access-line,#dce5ed)!important;
  -webkit-text-fill-color:var(--tp-access-ink,#071c38)!important;
}
html[data-tp-theme] :is(#builderBody,.tp-pool-admin-v3,.tp-gameplay-shell,.tp-results-view,.tp-auth-panel)
  :is(input,textarea)::placeholder{color:var(--tp-access-muted,#52637b)!important;opacity:1!important}
html[data-tp-theme] :is(#builderBody,.tp-pool-admin-v3,.tp-gameplay-shell,.tp-results-view,.tp-auth-panel)
  :is(label,.tp-kicker){opacity:1}
html[data-tp-theme="light"] :is(#builderBody,.tp-pool-admin-v3,.tp-gameplay-shell,.tp-results-view)
  :is(.card,.fixture,.tp-question-row,.tp-admin-v3-metric,.tp-admin-rule,.tp-admin-tab-panel){
  color:#071c38;
}
html[data-tp-theme="light"] :is(#builderBody,.tp-pool-admin-v3,.tp-gameplay-shell,.tp-results-view)
  :is(.card,.fixture,.tp-question-row,.tp-admin-v3-metric,.tp-admin-rule,.tp-admin-tab-panel) :is(h1,h2,h3,h4,strong){
  color:#071c38!important;
  -webkit-text-fill-color:#071c38!important;
  opacity:1!important;
}
html[data-tp-theme="light"] :is(#builderBody,.tp-pool-admin-v3,.tp-gameplay-shell,.tp-results-view)
  :is(.card,.fixture,.tp-question-row,.tp-admin-v3-metric,.tp-admin-rule,.tp-admin-tab-panel) :is(.muted,small){
  color:#52637b!important;
  -webkit-text-fill-color:#52637b!important;
  opacity:1!important;
}
html[data-tp-theme="dark"] :is(#builderBody,.tp-pool-admin-v3,.tp-gameplay-shell,.tp-results-view)
  :is(.card,.fixture,.tp-question-row,.tp-admin-v3-metric,.tp-admin-rule,.tp-admin-tab-panel){
  color:#f5f8f6;
}
html[data-tp-theme="dark"] :is(#builderBody,.tp-pool-admin-v3,.tp-gameplay-shell,.tp-results-view)
  :is(.card,.fixture,.tp-question-row,.tp-admin-v3-metric,.tp-admin-rule,.tp-admin-tab-panel) :is(h1,h2,h3,h4,strong){
  color:#f5f8f6!important;
  -webkit-text-fill-color:#f5f8f6!important;
}
html[data-tp-theme="dark"] :is(#builderBody,.tp-pool-admin-v3,.tp-gameplay-shell,.tp-results-view)
  :is(.card,.fixture,.tp-question-row,.tp-admin-v3-metric,.tp-admin-rule,.tp-admin-tab-panel) :is(.muted,small){
  color:#a4b8ae!important;
  -webkit-text-fill-color:#a4b8ae!important;
}
/* Inputs and focus remain visible for keyboard users in both schemes. */
html[data-tp-theme] :is(#builderBody,.tp-pool-admin-v3,.tp-gameplay-shell,.tp-results-view,.tp-auth-panel)
  :is(button,a,input,select,textarea):focus-visible{
  outline:3px solid var(--tp-blue,#176fc1)!important;
  outline-offset:2px;
}
@media(max-width:640px){
  html[data-tp-theme] :is(.tp-admin-rank-row,.tp-admin-progression-row,.tp-admin-round-banner){
    overflow-wrap:anywhere;
    min-width:0;
  }
}
