/* Baha C6 22.9.528 – inherited text and its UI surface must use the same theme.
   Targeted legacy panels only: message effects, nick colours and artwork keep
   their own colour pairs. Loaded after the common theme integrity layer. */

/* Legacy aliases must resolve on the themed body, not the light :root. */
html body{
  --surface:var(--surface-1);--surface-soft:var(--surface-2);
  --text:var(--text-primary);--card:var(--surface-raised);--soft:var(--surface-2);
  --border:var(--border-default);--border-color:var(--border-default);
}

/* Keep decorative falling figures above the page background, below all UI.
   Body isolation preserves the ordering between menus, docks and dialogs. */
html body.theme-halloween{isolation:isolate}
html body.theme-halloween .hw-fall-layer{z-index:-1}

html body .boti-profile-card{
  background:linear-gradient(135deg,var(--surface-1),var(--surface-2))!important;
  color:var(--text-primary)!important;
  border-color:var(--border-default)!important;
}
html body .boti-profile-main{min-width:0;overflow-wrap:anywhere}
html body .boti-profile-card .boti-name-row h1,
html body .boti-profile-card .boti-bio{color:var(--text-primary)!important}
html body .boti-profile-card .boti-bio{line-height:1.6}
html body .boti-profile-card .boti-badge{
  background:var(--info-bg)!important;color:var(--info-text)!important;
}
html body .boti-profile-card .boti-status{
  display:inline-block;margin-top:8px;padding:8px 12px;border:1px solid var(--success-border);
  border-radius:12px;background:var(--success-bg)!important;color:var(--success-text)!important;
}

html body :is(.b20-hero,.guest-convert,.bot-budget-estimate,.purge-stat){
  background:var(--surface-2)!important;color:var(--text-primary)!important;
  border-color:var(--border-default)!important;
}
html body :is(.b20-hero,.guest-convert,.bot-budget-estimate,.purge-stat) :is(h1,h2,h3,p,b,strong,small,span,label){
  color:inherit!important;
}
html body :is(.b20-hero,.bot-budget-estimate,.purge-stat) a:not(.btn):not([role="button"]){
  color:var(--link)!important;
}
html body .guest-convert>a{
  background:var(--accent)!important;color:var(--accent-text)!important;
  border-color:var(--button-border)!important;
}
html body :is(.bot-diag-row.bad,.purge-warning){
  background:var(--danger-bg)!important;color:var(--danger-text)!important;
  border-color:var(--danger-border)!important;
}
html body :is(.bot-diag-row.bad,.purge-warning) :is(h1,h2,h3,p,b,strong,small,span){color:inherit!important}
html body .storage-overview-head>b{
  background:var(--notice-bg)!important;color:var(--notice-text)!important;
  border-color:var(--notice-border)!important;
}
html body .storage-overview{
  background:var(--surface-2)!important;color:var(--text-primary)!important;
  border-color:var(--border-default)!important;
}
html body .au-main small{color:var(--text-secondary)!important}
html body .au-actions a{
  background:var(--button-bg)!important;color:var(--button-text)!important;
  border-color:var(--button-border)!important;
}
html body .au-actions a.danger{
  background:var(--danger-bg)!important;color:var(--danger-text)!important;
  border-color:var(--danger-border)!important;
}
html body .au-avatar{background:var(--surface-3)!important;color:var(--text-primary)!important}
html body .au-owner{background:var(--notice-bg)!important;color:var(--notice-text)!important}
html body .storage-overview-head :is(small,span){color:var(--text-secondary)!important}

html body :is(.baha-nameday-current,.baha-birthday-person,.baha-birthday-empty,.farm-module-hero){
  background:linear-gradient(135deg,var(--surface-1),var(--surface-2))!important;
  color:var(--text-primary)!important;border-color:var(--border-default)!important;
}
html body :is(.baha-nameday-current,.baha-birthday-person,.baha-birthday-empty,.farm-module-hero) :is(h1,h2,h3,p,b,strong,span){color:inherit!important}
html body :is(.baha-nameday-current,.baha-birthday-person,.baha-birthday-empty) small{color:var(--text-secondary)!important}
html body .farm4-legacy-plot{
  background:var(--warning-bg)!important;color:var(--warning-text)!important;
  border-color:var(--warning-border)!important;
}
html body .farm4-legacy-plot :is(p,b,strong,small,span){color:inherit!important}
html body :is(.farm4-ready-text,.farm4-profit-hour){
  background:var(--success-bg)!important;color:var(--success-text)!important;
  border-color:var(--success-border)!important;border-radius:8px;padding:4px 8px;
}

html body :is(.ms-kicker,.ms-person small,.ms-control span){color:var(--text-secondary)!important}
html body .ms-result b{color:var(--text-primary)!important}
html body .ms-stat.is-alive{
  background:var(--success-bg)!important;color:var(--success-text)!important;
  border-color:var(--success-border)!important;
}
html body .ms-stat.is-deceased{
  background:var(--danger-bg)!important;color:var(--danger-text)!important;
  border-color:var(--danger-border)!important;
}
html body .ms-stat.is-unknown{
  background:var(--notice-bg)!important;color:var(--notice-text)!important;
  border-color:var(--notice-border)!important;
}
html body .ms-stat :is(b,strong,small,span){color:inherit!important}

/* Information around games follows the theme; playfield art is untouched. */
html body :is(.wheel-card,.table-card,.r-panel,.hs-panel){
  background:var(--surface-1)!important;color:var(--text-primary)!important;
  border-color:var(--border-default)!important;
}
html body :is(.wheel-card,.table-card,.r-panel,.hs-panel)>:is(h1,h2,h3,p),
html body .hs-panel .hs-muted{color:var(--text-primary)!important}
html body :is(.r-jackpot,.kpo-streak){
  background:var(--notice-bg)!important;color:var(--notice-text)!important;
  border-color:var(--notice-border)!important;
}
html body :is(.r-jackpot,.kpo-streak) :is(b,strong,small,span){color:inherit!important}
html body :is(.spin-btn,.dp-roll,.hs-buy):not(:disabled):not([aria-disabled="true"]){
  background:var(--accent)!important;color:var(--accent-text)!important;
  border-color:var(--button-border)!important;text-shadow:none!important;
}
html body .hs-ticket-row{
  background:var(--surface-2)!important;color:var(--text-primary)!important;
  border-color:var(--border-default)!important;
}
html body .hs-ticket-row small{color:var(--text-secondary)!important}
html body .hs-ticket-row .hs-net.positive{
  background:var(--success-bg)!important;color:var(--success-text)!important;
  border-radius:8px;padding:4px 8px;
}
html body .hs-ticket-row .hs-net.negative{
  background:var(--danger-bg)!important;color:var(--danger-text)!important;
  border-radius:8px;padding:4px 8px;
}
html body .hs-hero>:is(h2,p){
  width:fit-content;max-width:100%;box-sizing:border-box;padding:4px 8px;border-radius:8px;
  background:#20132f;color:#fff4cf!important;text-shadow:none!important;
}
html body .arena .fighter h3{color:#fff!important}

html body :is(.radio-hero,.radio-listener-board,.game-room-intro,.game-room-settings,
  .game-room-invite-card,.room-bot-quick-control,.room-guest-posting-control,
  .gift-hero,.pr97-hero,.pet-identity,.pet-bubble,.pet-community-challenge){
  background:var(--surface-2)!important;color:var(--text-primary)!important;
  border-color:var(--border-default)!important;
}
html body .radio-hero>div:not(.radio-display) :is(h1,h2,h3,p),
html body .radio-listener-board>:is(h2,h3,p),
html body :is(.game-room-intro,.game-room-settings,.game-room-invite-card,
  .room-bot-quick-control,.room-guest-posting-control,.gift-hero,.pr97-hero,
  .pet-identity,.pet-community-challenge) :is(h1,h2,h3,p,b,strong){color:inherit!important}
html body :is(.radio-hero>div:not(.radio-display) small,.radio-info small,
  .radio-catalog-actions small,.radio-user-rank small,.radio-listener-board>.mini,
  .game-room-intro p,.game-room-settings small,.game-room-invite-card small,
  .room-bot-quick-control small,.room-guest-posting-control small,.pet-identity span){
  color:var(--text-secondary)!important;
}
html body .game-room-setting-games label{
  background:var(--surface-1)!important;color:var(--text-primary)!important;
  border-color:var(--border-default)!important;
}
html body .game-room-invite-card.is-accepted{
  background:var(--success-bg)!important;color:var(--success-text)!important;
  border-color:var(--success-border)!important;
}
html body .game-room-invite-card:is(.is-declined,.is-expired){
  background:var(--notice-bg)!important;color:var(--notice-text)!important;
  border-color:var(--notice-border)!important;
}
html body .pet-rank-list article.me{
  background:var(--state-selected-bg)!important;color:var(--state-selected-text)!important;
  border-color:var(--border-default)!important;
}
html body .pet-rank-list article.me :is(b,strong,small){color:inherit!important}
html body :is(.pet-item,.pet-game-card,.pet-skill) small{color:var(--text-secondary)!important}

html body .petdemo97 section,html body .pet97-stats span{
  background:var(--surface-2)!important;color:var(--text-primary)!important;
  border-color:var(--border-default)!important;
}
html body .petdemo97 section :is(h1,h2,h3,p,b,strong){color:inherit!important}
html body .demo-wrap #pack.pack{
  background:var(--surface-2)!important;color:var(--text-primary)!important;
  border-color:var(--border-default)!important;
}
html body .demo-wrap #pack.pack>:is(h2,p){color:inherit!important}

html body .home-marketplace a{
  background:var(--button-bg)!important;color:var(--button-text)!important;
  border-color:var(--button-border)!important;
}
html body :is(.bot-diag-row span,.bot-usage-stat span,.bot-usage-stat small){opacity:1!important}

html body .register97-hero{
  background:var(--surface-2)!important;color:var(--text-primary)!important;
  border-color:var(--border-default)!important;
}
html body .register97-hero h2{color:var(--text-primary)!important}
html body .register97-hero :is(p,span){color:var(--text-secondary)!important}

/* Day/night label is UI placed over the illustrated Tamagochi sky. */
html body .pet-daypart{
  background:var(--surface-2)!important;color:var(--text-primary)!important;
  border:1px solid var(--border-default);border-radius:10px;padding:4px 8px;
}
