/* Memorial Channel 1.2.5 — pair foreground and surface colors.
 * The original temporary app installers persist these exact shell IDs and hex
 * colors in page HTML. Scope legacy rules to those shells; don't rewrite HTML
 * or depend on display labels, and don't change native theme/other Agent styles.
 */

/* Safe fallback in either mode: dark ink on the original pale cards. */
html body #cmai-memorial-home section:is([style*="#f5f8f8" i],[style*="#f6faf8" i]) {
    --mc-card-bg: #f5f8f8;
    --mc-card-ink: #172d3d;
    --mc-card-muted: #344b5b;
    --mc-card-border: #c6d5d5;
    --mc-card-button: #203346;
    --mc-card-button-ink: #ffffff;
}
html body #cmgm-gaming-home section[style*="#f1ebff" i] {
    --mc-card-bg: #f1ebff;
    --mc-card-ink: #262044;
    --mc-card-muted: #443c60;
    --mc-card-border: #cfc4ed;
    --mc-card-button: #262044;
    --mc-card-button-ink: #ffffff;
}
/* Native theme markers (including the CBPE switch); the fallback above remains
 * readable if a different theme uses an unrecognized marker. */
:is(html[data-cbpe-theme="dark"],html[data-theme="dark"],html.schp-dark,html.dark-mode,body.dark-mode)
#cmai-memorial-home section:is([style*="#f5f8f8" i],[style*="#f6faf8" i]) {
    --mc-card-bg: #203346;
    --mc-card-ink: #f5f9fc;
    --mc-card-muted: #e0e9f1;
    --mc-card-border: #657b8e;
    --mc-card-button: #e7d5a5;
    --mc-card-button-ink: #203346;
}
:is(html[data-cbpe-theme="dark"],html[data-theme="dark"],html.schp-dark,html.dark-mode,body.dark-mode)
#cmgm-gaming-home section[style*="#f1ebff" i] {
    --mc-card-bg: #282340;
    --mc-card-ink: #f7f4ff;
    --mc-card-muted: #e4ddf2;
    --mc-card-border: #786c9e;
    --mc-card-button: #e5dcff;
    --mc-card-button-ink: #262044;
}

html body :is(#cmai-memorial-home section:is([style*="#f5f8f8" i],[style*="#f6faf8" i]),#cmgm-gaming-home section[style*="#f1ebff" i]) {
    background-color: var(--mc-card-bg) !important;
    color: var(--mc-card-ink) !important;
    border-color: var(--mc-card-border) !important;
}
html body :is(#cmai-memorial-home section:is([style*="#f5f8f8" i],[style*="#f6faf8" i]),#cmgm-gaming-home section[style*="#f1ebff" i]) > :is(h2,h3) {
    color: var(--mc-card-ink) !important;
    opacity: 1 !important;
}
html body :is(#cmai-memorial-home section:is([style*="#f5f8f8" i],[style*="#f6faf8" i]),#cmgm-gaming-home section[style*="#f1ebff" i]) > p {
    color: var(--mc-card-muted) !important;
    opacity: 1 !important;
}
html body :is(#cmai-memorial-home section:is([style*="#f5f8f8" i],[style*="#f6faf8" i]),#cmgm-gaming-home section[style*="#f1ebff" i]) > a {
    background-color: var(--mc-card-button) !important;
    color: var(--mc-card-button-ink) !important;
    opacity: 1 !important;
}

/* Connected Agent Lines: original outlined buttons had inherited grey ink.
 * Apply a solid brand-colored pair, without touching category group buttons. */
html body #cmai-memorial-home section > div > a[style*="#cbbfa5" i] {
    background-color: #285e5c !important;
    color: #ffffff !important;
    border-color: #96b8b3 !important;
    opacity: 1 !important;
}
html body #cmgm-gaming-home section > div > a[style*="#d4c9f5" i][style*="color:inherit" i],
html body #cmgm-gaming-home section > div > a[style*="#d4c9f5" i][style*="color: inherit" i] {
    background-color: #51437c !important;
    color: #ffffff !important;
    border-color: #b1a2d7 !important;
}
/* Existing Gaming white category/resource tiles are readable in light mode;
 * explicit color pairing also prevents the inherited dark-mode ink override. */
html body #cmgm-gaming-home section > div > :is(a,span)[style*="#cbdbe1" i] {
    background-color: #ffffff !important;
    color: #262044 !important;
    border-color: #cbdbe1 !important;
}
:is(html[data-cbpe-theme="dark"],html[data-theme="dark"],html.schp-dark,html.dark-mode)
body #cmgm-gaming-home section > div > :is(a,span)[style*="#cbdbe1" i],
body.dark-mode #cmgm-gaming-home section > div > :is(a,span)[style*="#cbdbe1" i] {
    background-color: #282340 !important;
    color: #f7f4ff !important;
    border-color: #786c9e !important;
}
/* Warning badges must remain clearly identified as a fictional demo. */
html body :is(.memorial-global-wall .memorial-exp-card,.memorial-exp-directory .memorial-exp-card,.memorial-agent-profile) .mc-demo-label {
    background-color: #fff1c7 !important;
    color: #563810 !important;
    border-color: #d6ae65 !important;
    opacity: 1 !important;
}
html body .memorial-global-wall .memorial-exp-card .memorial-wall-share {
    background-color: #203346 !important;
    color: #ffffff !important;
    border-color: #96aebd !important;
    opacity: 1 !important;
}
html body :is(#cmai-memorial-home,#cmgm-gaming-home,.memorial-global-wall) :is(a,button):focus-visible {
    outline: 3px solid #b27b24;
    outline-offset: 3px;
}
