/*
 * EducTools Game Studio Accessibility Contrast Layer v1.14.3
 * Final cascade layer for buttons, active navigation and saturated surfaces.
 */
:root{
  --egs-on-dark:#ffffff;
  --egs-on-dark-soft:#f3efff;
  --egs-active-purple:#6940db;
  --egs-active-purple-dark:#5129bd;
  --egs-focus-ring:#ffd75f;
}

/* Primary buttons must stay white even when another theme rule changes the
   inherited link color. */
body.egs-kids-theme :is(.btn-primary,.kids-use-template,.chip.active,.admin-pagination a.active,.factory-filter-pills a.active,.mass-tabs a.active){
  color:var(--egs-on-dark)!important;
  -webkit-text-fill-color:var(--egs-on-dark)!important;
}
body.egs-kids-theme :is(.btn-primary,.kids-use-template,.chip.active,.admin-pagination a.active,.factory-filter-pills a.active,.mass-tabs a.active) :is(span,strong,small,i,svg){
  color:inherit!important;
  -webkit-text-fill-color:currentColor!important;
}

/* Dashboard active item: replace purple-on-purple with a clear selected state. */
body.egs-kids-theme .dash-nav a.active,
body.egs-kids-theme .dash-nav a.active:hover{
  border:1px solid rgba(70,35,161,.22)!important;
  background:linear-gradient(135deg,var(--egs-active-purple),var(--egs-active-purple-dark))!important;
  color:#fff!important;
  -webkit-text-fill-color:#fff!important;
  box-shadow:0 9px 20px rgba(81,41,189,.23)!important;
}
body.egs-kids-theme .dash-nav a.active span{
  color:#fff!important;
  -webkit-text-fill-color:#fff!important;
}
body.egs-kids-theme .dash-nav a:not(.active):hover{
  background:#eee7ff!important;
  color:#4d2aa9!important;
  -webkit-text-fill-color:#4d2aa9!important;
}
body.egs-kids-theme .dash-nav a:focus-visible{
  outline:3px solid rgba(105,64,219,.28)!important;
  outline-offset:2px;
}
body.egs-kids-theme .dash-nav a.active:focus-visible{
  outline-color:var(--egs-focus-ring)!important;
}

/* Common saturated controls and labels. */
body.egs-kids-theme :is(.theme,.popular,.locked,.item-number,.builder-step.active b,.mass-equation .total,.game-access-ribbon,.kids-popular-ribbon){
  color:#fff!important;
  -webkit-text-fill-color:#fff!important;
}
body.egs-kids-theme .mass-equation .total :is(strong,span){
  color:#fff!important;
  -webkit-text-fill-color:#fff!important;
}

/* Game previews and explicitly dark player areas use light text. The current
   game intro is a white card, so it must not inherit this dark-surface rule. */
body.egs-kids-theme :is(.preview-game,.result-screen.is-dark,[data-et-contrast="dark"]) :is(h1,h2,h3,h4,strong,b){
  color:#fff!important;
  -webkit-text-fill-color:#fff!important;
}
body.egs-kids-theme [data-et-contrast="dark"] :is(p,small,.muted){
  color:var(--egs-on-dark-soft)!important;
  -webkit-text-fill-color:var(--egs-on-dark-soft)!important;
}

/* Preserve readable alternative button variants. */
body.egs-kids-theme :is(.btn-outline,.btn-muted,.btn-warning,.btn-success){
  -webkit-text-fill-color:currentColor!important;
}

@media(max-width:760px){
  body.egs-kids-theme .dash-nav a.active{
    box-shadow:0 6px 15px rgba(81,41,189,.2)!important;
  }
}
