/* Question pages share the saved Insights palette with profile and home cards.
   The background/text pair is contrast checked; accent is readable on white. */
.question-palette {
    --question-palette-background: var(--card-background, #192b43);
    --question-palette-text: var(--card-text, #fff);
    --question-palette-accent: var(--card-accent, #192b43);
    --question-palette-edge: var(--card-edge, #192b43);
    --question-palette-tint: color-mix(in srgb, var(--question-palette-accent) 7%, white);
}

/* Override legacy inline tokens, including tables and summaries rendered later.
   Keep the data, sorting, filtering and pagination handlers independent. */
.question-palette,
.question-palette :is(.team-themed, .stats-table-blueprint, .profile-pagination-container) {
    --team-primary: var(--question-palette-accent) !important;
    --primary-color: var(--question-palette-accent) !important;
    --primary-accent: var(--question-palette-tint) !important;
    --highlight-accent: var(--question-palette-tint) !important;
    --highlight-hover: var(--question-palette-tint) !important;
}

.query-bubble-section.question-palette .top-bubble {
    background: var(--question-palette-background) !important;
    color: var(--question-palette-text);
}
.query-bubble-section.question-palette :is(.question-text, .question-heading, .question-answer, .question-entity-link) {
    color: var(--question-palette-text) !important;
}
.query-bubble-section.question-palette :is(.top-player-image, .top-team-logo, .banner-bg) {
    background: transparent !important;
}
.query-bubble-section.question-palette :is(.share-btn, .bookmark-btn, .bookmark-btn i, .fs-bookmark-button, .fs-bookmark-button i, .export-image-btn) {
    color: var(--question-palette-text) !important;
}
.query-bubble-section.question-palette .share-icon {
    background: currentColor;
    -webkit-mask: var(--share-icon-url) center / contain no-repeat;
    mask: var(--share-icon-url) center / contain no-repeat;
    filter: none;
}
.query-bubble-section.question-palette :is(.bookmark-btn, .fs-bookmark-button) i.fa-bookmark {
    background: currentColor;
    -webkit-mask: var(--bookmark-icon-outline-url) center / contain no-repeat;
    mask: var(--bookmark-icon-outline-url) center / contain no-repeat;
    filter: none;
}
.query-bubble-section.question-palette :is(.bookmark-btn, .fs-bookmark-button) i.fas.fa-bookmark {
    -webkit-mask-image: var(--bookmark-icon-filled-url);
    mask-image: var(--bookmark-icon-filled-url);
}
.query-bubble-section.question-palette .question-publish-btn:not([aria-pressed="true"]) {
    background: color-mix(in srgb, var(--question-palette-text) 8%, var(--question-palette-background));
    color: var(--question-palette-text);
    border-color: color-mix(in srgb, var(--question-palette-text) 35%, transparent);
}
.query-bubble-section.question-palette .banner-actions :is(button, a):focus-visible {
    outline-color: var(--question-palette-text) !important;
}

/* Use the saved pair in filtered columns, including sticky cells, hover and
   secondary game logs. Ordinary cells retain their white background. */
.question-palette :is(#gameLogTable, .stats-table-blueprint) :is(
    th.profile-filtered, th.profile-stat-filtered, th.highlighted-header, th.stat-highlight-header,
    td.profile-stat-filtered, td.stat-highlight, td.highlighted-cell
) {
    background: var(--question-palette-background) !important;
    color: var(--question-palette-text) !important;
}
.question-palette :is(#gameLogTable, .stats-table-blueprint) :is(
    th.profile-filtered, th.profile-stat-filtered, th.highlighted-header, th.stat-highlight-header,
    td.profile-stat-filtered, td.stat-highlight, td.highlighted-cell
) :is(a, i, strong, span) { color: inherit !important; }
.question-palette :is(#gameLogTable, .stats-table-blueprint) td.profile-filtered:not(.profile-stat-filtered):not(.stat-highlight):not(.sorted-col)::before,
.question-palette :is(#gameLogTable, .stats-table-blueprint) .sorted-col::after {
    background: var(--question-palette-edge) !important;
}
.question-palette .profile-pagination-container :is(.profile-pagination-btn.active, .profile-pagination-btn[aria-current="page"]),
.question-palette :is(.profile-filter-apply, .stat-filter-apply, .profile-filter-badge, .stat-filter-badge) {
    background: var(--question-palette-background) !important;
    color: var(--question-palette-text) !important;
    border-color: var(--question-palette-edge) !important;
}
.question-palette .profile-pagination-btn:not(.active):not([aria-current="page"]):is(:hover, :focus-visible) {
    background: var(--question-palette-tint);
    color: var(--question-palette-accent);
    border-color: var(--question-palette-accent);
}
.question-palette :is(
    .event-mode-chip, .quarter-summary-chip, .streak-summary-chip,
    .streak-summary-team, .position-answer-chip, .team-concede-rankings-chip
) {
    background: var(--question-palette-background);
    color: var(--question-palette-text);
}
.question-palette :is(button, a, input, select, summary):focus-visible {
    outline-color: var(--question-palette-accent);
}
.question-palette input:is([type="checkbox"], [type="radio"]) { accent-color: var(--question-palette-accent); }
