/* BostonPlay Arena: unified ivory, diamond-white and gold surfaces.
 * Does not recolor game boards, images, or the historical photo hero.
 * Dark Mode remains user-selectable on pages using theme.js.
 */
:root{
  color-scheme:light;
  --theme-bg:#faf6ed;
  --theme-surface:#ffffff;
  --theme-surface-alt:#fffaf1;
  --theme-text:#111111;
  --theme-muted:#344054;
  --theme-border:#dccbb0;
  --bpa-deep-gold:#895d11;
  --bpa-focus:#94600b;
}
:root[data-theme-mode="dark"]{
  color-scheme:dark;
  --theme-bg:#0d1729;
  --theme-surface:#172943;
  --theme-surface-alt:#1b304c;
  --theme-text:#f3f6fc;
  --theme-muted:#d2dceb;
  --theme-border:#536681;
  --bpa-deep-gold:#f0ca77;
  --bpa-focus:#f0ca77;
}
html{background:var(--theme-bg)}
body{background:var(--theme-bg)!important;color:var(--theme-text)!important}
body :is(h1,h2,h3,h4),body :is(p,li,label,small){overflow-wrap:break-word}
body a:focus-visible,body button:focus-visible,body input:focus-visible,
body select:focus-visible,body textarea:focus-visible{outline:3px solid var(--bpa-focus);outline-offset:3px}
body :is(input,select,textarea){max-width:100%}

/* Homepage: replace legacy navy sections and cards without touching the photo hero. */
body.bpa-home-page :is(#games,.library-tools,#about){color:var(--theme-text)}
body.bpa-home-page #games .library-tools,
body.bpa-home-page #games .game-category,
body.bpa-home-page #games .game-category .cards>.card,
body.bpa-home-page #games #no-games-found{
  background:var(--theme-surface)!important;
  color:var(--theme-text)!important;
  border-color:var(--theme-border)!important;
  box-shadow:0 4px 18px rgba(55,44,29,.055);
}
body.bpa-home-page #games .library-tools,
body.bpa-home-page #games .game-category{background:var(--theme-surface-alt)!important}
body.bpa-home-page #games .game-category .cards>.card{background:var(--theme-surface)!important}
body.bpa-home-page #games :is(h2,.game-category-heading h3){color:var(--bpa-deep-gold)!important}
body.bpa-home-page #games :is(.game-category-heading p,.library-intro,.library-summary p,
.game-category .card h3,.game-category .card p,.game-category .card .tag,#no-games-found){
 color:var(--theme-text)!important
}
body.bpa-home-page #games .game-category .cards>.card p{color:var(--theme-muted)!important}
body.bpa-home-page #games .category-filters .filter-chip,
body.bpa-home-page #games .game-category-count,
body.bpa-home-page #game-search{
  background:var(--theme-surface)!important;color:var(--theme-text)!important;
  border-color:var(--theme-border)!important
}
body.bpa-home-page #games .category-filters .filter-chip[aria-pressed="true"]{
  background:var(--theme-accent)!important;color:var(--theme-on-accent)!important;
  border-color:var(--theme-accent)!important
}
body.bpa-home-page #game-search::placeholder{color:var(--theme-muted);opacity:1}
body.bpa-home-page #games :is(.search-label,#game-count,#reset-games){color:var(--bpa-deep-gold)!important}
body.bpa-home-page #about,
body.bpa-home-page #about :is(h2,h3,p,li){color:var(--theme-text)!important}
body.bpa-home-page .bpa-feature,
body.bpa-home-page .bpa-shortcut{background:var(--theme-surface);border-color:var(--theme-border)}
body.bpa-home-page .bpa-feature-media{background:var(--theme-surface-alt)}
body.bpa-home-page .mission-promo{
  background:var(--theme-surface-alt)!important;
  border-color:var(--theme-border)!important;
  color:var(--theme-text)!important
}
body.bpa-home-page .mission-promo h2{color:var(--bpa-deep-gold)!important}
body.bpa-home-page .mission-promo :is(p,.mission-promo-note){color:var(--theme-text)!important}
body.bpa-home-page .mission-promo-eyebrow{color:var(--bpa-deep-gold)!important}
body.bpa-home-page .bpa-skyline,
body.bpa-home-page .bpa-skyline::before,
body.bpa-home-page .bpa-skyline::after{ /* Preserve skyline photo and its text contrast overlay. */ }

/* Form and account pages. Keep security/validation states and Turnstile unchanged. */
body.bpa-ivory-form main,
body.bpa-ivory-error main{
  background:var(--theme-surface)!important;border:1px solid var(--theme-border)!important;
  color:var(--theme-text)!important;
  box-shadow:0 8px 30px rgba(46,31,8,.07)
}
body.bpa-ivory-form :is(h1,h2),body.bpa-ivory-error :is(h1,h2){color:var(--bpa-deep-gold)!important}
body.bpa-ivory-form :is(label,p,.muted),body.bpa-ivory-error p{color:var(--theme-text)!important}
body.bpa-ivory-form :is(input,select){
  background:var(--theme-surface-alt)!important;color:var(--theme-text)!important;
  border-color:var(--theme-border)!important
}
body.bpa-ivory-form :is(button:not(#togglePassword),.button),
body.bpa-ivory-error main a{
  background:var(--theme-accent,#d3a444)!important;color:#14213b!important;
  border-color:var(--theme-accent,#d3a444)!important
}
body.bpa-ivory-form #togglePassword{color:var(--bpa-deep-gold)!important}
body.bpa-ivory-form :is(a,.muted a),body.bpa-ivory-error a:not(main a){color:var(--bpa-deep-gold)!important}
body.bpa-ivory-form :is(.danger,.warning){color:#a12a37!important}
body.bpa-ivory-form .success{color:#0b704c!important}
body.bpa-ivory-form .profile-avatar-editor{background:var(--theme-surface-alt)!important}

/* Parent dashboard, child portal, leaderboard, and shared information cards. */
body.bpa-ivory-dashboard .card,
body.bpa-ivory-portal .card,
body.bpa-ivory-leaderboard main,
body.bpa-ivory-dashboard .profile{
  background:var(--theme-surface)!important;
  color:var(--theme-text)!important;
  border-color:var(--theme-border)!important
}
body.bpa-ivory-dashboard :is(h1,h2,h3),
body.bpa-ivory-portal :is(h1,h2,h3),
body.bpa-ivory-leaderboard :is(h1,h2,th){color:var(--bpa-deep-gold)!important}
body.bpa-ivory-dashboard :is(p,.muted,label),
body.bpa-ivory-portal :is(p,.card p,.muted,label),
body.bpa-ivory-leaderboard :is(p,.note,td){color:var(--theme-text)!important}
body.bpa-ivory-dashboard :is(input,select),
body.bpa-ivory-portal select{
  background:var(--theme-surface-alt)!important;color:var(--theme-text)!important;
  border-color:var(--theme-border)!important
}
body.bpa-ivory-dashboard button,
body.bpa-ivory-portal :is(button,.button),
body.bpa-ivory-leaderboard button{
  background:var(--theme-accent,#d3a444)!important;
  color:#14213b!important;border-color:var(--theme-accent,#d3a444)!important
}
body.bpa-ivory-dashboard a,body.bpa-ivory-portal a,
body.bpa-ivory-leaderboard a{color:var(--bpa-deep-gold)!important}
body.bpa-ivory-leaderboard tr:nth-child(even){background:var(--theme-surface-alt)!important}
body.bpa-ivory-leaderboard :is(th,td){border-color:var(--theme-border)!important}
body.bpa-ivory-dashboard .profile{border-color:var(--theme-border)!important}

/* Campaign: whiten task/information tiles, but preserve colorful mission graphics and progress fill. */
body.bpa-ivory-campaign :is(.panel,.mission,.stat,.feedback,.medal){
 background:var(--theme-surface)!important;
 color:var(--theme-text)!important;
 border-color:var(--theme-border)!important
}
body.bpa-ivory-campaign :is(p,.mission p,.tag,.muted,label){color:var(--theme-text)!important}
body.bpa-ivory-campaign :is(h1,h2,h3,.eyebrow,.stat strong){color:var(--bpa-deep-gold)!important}
body.bpa-ivory-campaign :is(input,select,.unit,.choices button,button:not(.primary)){
 background:var(--theme-surface-alt)!important;
 color:var(--theme-text)!important;border-color:var(--theme-border)!important
}
body.bpa-ivory-campaign .primary{
 background:var(--theme-accent,#d3a444)!important;color:#14213b!important;
 border-color:var(--theme-accent,#d3a444)!important
}
body.bpa-ivory-campaign .unit[aria-pressed="true"]{
 background:#ffedbd!important;border-color:var(--bpa-deep-gold)!important;color:#111!important
}
body.bpa-ivory-campaign .progress{background:var(--theme-surface-alt)!important}
body.bpa-ivory-campaign a{color:var(--bpa-deep-gold)!important}

/* Text-focused policy/contact pages retain their long-form, responsive layout. */
body.bpa-ivory-legal{color:var(--theme-text)!important}
body.bpa-ivory-legal :is(h1,h2,h3){color:var(--bpa-deep-gold)!important}
body.bpa-ivory-legal :is(header,footer){border-color:var(--theme-border)!important}
body.bpa-ivory-legal :is(p,li,footer){color:var(--theme-text)!important}
body.bpa-ivory-legal a{color:var(--bpa-deep-gold)!important}
body.bpa-ivory-legal article{
 background:var(--theme-surface)!important;color:var(--theme-text)!important;
 border-color:var(--theme-border)!important
}
body.bpa-ivory-legal #eu-consent-preferences{
 background:var(--theme-surface-alt)!important;
 color:var(--theme-text)!important;border-color:var(--theme-border)!important
}
/* Keep status text readable, and ensure app drawer never bleeds into content. */
@media(max-width:600px){
 /* The sidebar layout gives main width:100%; subtract side margins to avoid overflow. */
 body.bpa-ivory-form.app-has-sidebar > main,
 body.bpa-ivory-error.app-has-sidebar > main{
   width:calc(100% - 24px)!important;
   max-width:calc(100% - 24px)!important;
 }
 body.bpa-ivory-form main,body.bpa-ivory-error main{margin:24px 12px;padding:20px}
 body.bpa-ivory-legal{width:100%;max-width:100%;padding:18px}
}
