/* Appearance mode is independent of the saved light accent palette. Keep every
   dark override scoped so disabling the switch restores the existing styles. */
html[data-color-mode="dark"],
html[data-color-mode="dark"] .games-platform {
  color-scheme: dark;
  --bg-surface: #1e2023;
  --surface: #272a2f;
  --surface-solid: #272a2f;
  --surface-alt: #24272b;
  --content-surface: #1e2023;
  --glass-surface: #272a2f;
  --chrome-surface: #272a2f;
  --popover-surface: #272a2f;
  --control-surface: #272a2f;
  --control-hover: #32363d;
  --control-bg: #24272b;
  --border: #3a3e45;
  --border-light: #3a3e45;
  --theme-text: #e0e0e0;
  --text-main: var(--theme-text);
  --text-secondary: var(--theme-text);
  --text-muted: var(--theme-text);
  --primary: #8ab4f8;
  --primary-hover: #a8c7fa;
  --primary-light: #29374b;
  --danger: #f28b82;
  --danger-hover: #f6aaa3;
  --danger-light: #422e30;
  --success: #81c995;
  --success-light: #293b31;
  --warning: #e8c878;
  --warning-light: #3d3627;
  --action-delete: #f28b82;
  --action-delete-surface: #422e30;
  --action-delete-hover: #513437;
  --action-edit: #e8c878;
  --action-edit-surface: #3d3627;
  --action-edit-hover: #4b412c;
  --action-primary-surface: #29374b;
  --action-primary-hover: #32445e;
  --accent-band: #29374b;
  --accent-border: #526887;
  --accent-text: #8ab4f8;
  --accent-surface: #29374b;
  --neu-shadow: 0 12px 32px rgb(0 0 0 / 18%);
  --neu-shadow-sm: 0 3px 12px rgb(0 0 0 / 14%);
  --neu-inset: inset 0 1px 4px rgb(0 0 0 / 16%);
  --neu-inset-sm: inset 0 1px 3px rgb(0 0 0 / 12%);
  --glass-shadow: 0 4px 16px rgb(0 0 0 / 14%);
  --popover-shadow: 0 12px 32px rgb(0 0 0 / 28%);
  --focus-ring: 0 0 0 3px rgb(138 180 248 / 30%);
  --shadow-lg: var(--neu-shadow);
  --shadow-md: var(--neu-shadow-sm);
  --shadow-sm: var(--neu-shadow-sm);
  --g-cyan: #8ab4f8;
  --g-gold: #e8c878;
  --g-violet: #b8a4e8;
}

html[data-color-mode="dark"] body {
  background-image: none;
}

/* This explicit dark-mode text policy takes precedence over module-specific
   status/link colors and inline rich text. SVG artwork keeps its own paints;
   action meaning remains in borders, fills, and symbols rather than label color. */
html[data-color-mode="dark"] :where(body, body *):not(svg, svg *) {
  color: var(--theme-text) !important;
}

html[data-color-mode="dark"] ::selection {
  background: var(--action-primary-hover);
  color: var(--theme-text);
}

/* Keep placeholders small and dark gray across modules and appearance modes. */
:root :is(input, textarea)::placeholder {
  color: #666;
  -webkit-text-fill-color: #666;
  font-size: clamp(0.75rem, 0.72rem + 0.2vw, 0.85rem);
  opacity: 1;
}

html[data-color-mode="dark"] :is(input, textarea, select) {
  -webkit-text-fill-color: var(--theme-text);
}

html[data-color-mode="dark"] input::file-selector-button {
  color: var(--theme-text);
}

html[data-color-mode="dark"] :is(svg text, svg tspan, svg textPath) {
  fill: var(--theme-text);
  color: var(--theme-text);
}

html[data-color-mode="dark"] .games-platform .g-player-stats .g-stat::after {
  color: var(--theme-text);
}

html[data-color-mode="dark"] :is(.skeleton-line, .skeleton-tile, .skeleton-avatar) {
  background: var(--control-hover);
}

html[data-color-mode="dark"] :is(.skeleton-line, .skeleton-tile)::after {
  background: linear-gradient(90deg, transparent, rgb(161 166 174 / 12%), transparent);
}

html[data-color-mode="dark"] :is(input, textarea):-webkit-autofill {
  -webkit-text-fill-color: var(--text-main);
  caret-color: var(--text-main);
  box-shadow: inset 0 0 0 1000px var(--control-surface);
}

/* The new switch uses a real, labelled checkbox and retains keyboard focus. */
.theme-mode-option {
  position: relative;
  display: flex;
  align-items: center;
  gap: clamp(0.65rem, 1.5vw, 1rem);
  min-width: 0;
  min-height: 2.75rem;
  margin-bottom: clamp(1rem, 2vw, 1.4rem);
  padding: clamp(0.8rem, 1.7vw, 1rem);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--surface-alt);
  color: var(--text-main);
  cursor: pointer;
}

.theme-mode-copy {
  display: grid;
  flex: 1 1 auto;
  min-width: 0;
  gap: 0.2rem;
  overflow-wrap: anywhere;
}

.theme-mode-copy strong {
  font-size: clamp(0.875rem, 0.82rem + 0.25vw, 1rem);
  font-weight: 600;
}

.theme-mode-copy small {
  color: var(--text-secondary);
  font-size: clamp(0.75rem, 0.72rem + 0.12vw, 0.8125rem);
  line-height: var(--leading-body);
}

#softDarkModeToggle {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  overflow: hidden;
  clip-path: inset(50%);
}

.theme-mode-switch {
  position: relative;
  display: block;
  flex: 0 0 2.75rem;
  width: 2.75rem;
  height: 1.5rem;
  border: 1px solid var(--text-secondary);
  border-radius: var(--radius-full);
  background: var(--control-surface);
  transition: var(--transition);
}

.theme-mode-switch::before {
  position: absolute;
  top: 0.125rem;
  left: 0.125rem;
  width: 1.125rem;
  height: 1.125rem;
  border-radius: 50%;
  background: var(--text-secondary);
  content: "";
  transition: transform 180ms ease;
}

#softDarkModeToggle:checked + .theme-mode-switch {
  border-color: var(--primary);
  background: var(--primary);
}

#softDarkModeToggle:checked + .theme-mode-switch::before {
  background: var(--surface-solid);
  transform: translateX(1.25rem);
}

#softDarkModeToggle:focus-visible + .theme-mode-switch {
  outline: 2px solid var(--primary);
  outline-offset: 4px;
}

#softDarkModeToggle:disabled ~ :is(.theme-mode-switch, .theme-mode-copy) {
  opacity: 0.6;
  cursor: not-allowed;
}

#softDarkModeStatus {
  min-height: 1.25rem;
  margin-bottom: clamp(0.8rem, 1.8vw, 1.2rem);
  color: var(--text-secondary);
  font-size: clamp(0.75rem, 0.72rem + 0.12vw, 0.8125rem);
  line-height: var(--leading-body);
  overflow-wrap: anywhere;
}

/* Darker fills retain readable uniform text on primary and destructive controls. */
html[data-color-mode="dark"] :is(.btn-primary, .workspace-export-btn, .brand-badge) {
  border-color: var(--primary);
  background: var(--action-primary-surface);
}

html[data-color-mode="dark"] :is(.btn-primary, .workspace-export-btn):hover:not(:disabled) {
  background: var(--action-primary-hover);
}

html[data-color-mode="dark"] .btn-danger {
  border-color: var(--danger);
  background: var(--action-delete-surface);
}

html[data-color-mode="dark"] .btn-danger:hover:not(:disabled) {
  background: var(--action-delete-hover);
}

html[data-color-mode="dark"] #adminNotificationsToggle [data-notifications-badge] {
  border: 1px solid var(--action-delete);
  background: var(--action-delete-surface);
}

/* Operation hooks are supplied by existing components, not inferred from text. */
html[data-color-mode="dark"]
  :is(
    [data-action-intent="delete"],
    [data-g-action^="delete-"],
    [data-g-action="remove-option"],
    [data-stock-action^="delete-"],
    [data-feedback-action="delete"],
    [data-entry-action="delete"],
    [data-ticket-action="delete"],
    .ann-danger,
    #adminDeleteAccountBtn,
    #confirmDeleteGroundCheckerEntryBtn,
    #confirmDeleteRepairTicketEntryBtn
  ) {
  border-color: var(--action-delete);
  background: var(--action-delete-surface);
  box-shadow: inset 0 0 0 1px var(--action-delete);
}

html[data-color-mode="dark"]
  :is(
    [data-action-intent="delete"],
    [data-g-action^="delete-"],
    [data-g-action="remove-option"],
    [data-stock-action^="delete-"],
    [data-feedback-action="delete"],
    [data-entry-action="delete"],
    [data-ticket-action="delete"],
    .ann-danger,
    #adminDeleteAccountBtn,
    #confirmDeleteGroundCheckerEntryBtn,
    #confirmDeleteRepairTicketEntryBtn
  ):is(:hover, :focus-visible):not(:disabled) {
  background: var(--action-delete-hover);
}

html:root[data-color-mode="dark"]
  :is(
    [data-action-intent="edit"],
    [data-g-action^="edit-"],
    [data-stock-action="edit"],
    [data-feedback-action="edit"],
    [data-entry-action="modify"],
    [data-ticket-action="modify"],
    .edit-user-btn
  ) {
  border-color: var(--action-edit);
  background: var(--action-edit-surface);
  box-shadow: inset 0 0 0 1px var(--action-edit);
}

html:root[data-color-mode="dark"]
  :is(
    [data-action-intent="edit"],
    [data-g-action^="edit-"],
    [data-stock-action="edit"],
    [data-feedback-action="edit"],
    [data-entry-action="modify"],
    [data-ticket-action="modify"],
    .edit-user-btn
  ):is(:hover, :focus-visible):not(:disabled) {
  background: var(--action-edit-hover);
}

html[data-color-mode="dark"] .alert-banner.alert-error {
  border-color: var(--danger);
  color: var(--danger);
}

html[data-color-mode="dark"] .alert-banner.alert-success {
  border-color: var(--success);
  color: var(--success);
}

html[data-color-mode="dark"] :is(.modal-overlay, .page-modal-overlay) {
  background: rgb(18 20 23 / 68%);
}

html[data-color-mode="dark"] .workspace-sidebar-toggle {
  border-color: var(--border);
  background: var(--control-surface);
}

html[data-color-mode="dark"] :is(.nav-profile-btn, .overview-number, .profile-tag, .user-tag-name) {
  box-shadow: var(--neu-shadow-sm);
}

html[data-color-mode="dark"] .profile-badge-item::after {
  border-color: var(--border);
  background: var(--popover-surface);
  color: var(--text-main);
  box-shadow: var(--popover-shadow);
}

html[data-color-mode="dark"] .toast {
  border-block: 1px solid var(--border);
  border-inline-end: 1px solid var(--border);
  background: var(--popover-surface);
  color: var(--text-main);
}

html[data-color-mode="dark"] .workspace-table th {
  background: var(--surface-alt);
}

html[data-color-mode="dark"] .workspace-table tbody tr:nth-child(even) td {
  background: var(--surface-alt);
}

html[data-color-mode="dark"] .workspace-table tbody tr:hover td {
  background: var(--control-hover);
}

html[data-color-mode="dark"] .stock-workspace .workspace-table tbody .stock-unavailable td {
  background: var(--surface-alt);
}

html[data-color-mode="dark"]
  :is(.admin-status-suspended, .stock-summary-low[data-active="true"], .games-leader-tag) {
  color: var(--warning);
}

html[data-color-mode="dark"]
  :is(
    .feedback-entry-status[data-status="pending"],
    .workspace-export-menu-actions [data-export-cancel],
    .stock-priority-vip,
    .stock-priority-field .stock-priority-vip
  ) {
  border-color: var(--warning);
  background: var(--warning-light);
  color: var(--warning);
}

html[data-color-mode="dark"]
  .workspace-export-menu-actions
  [data-export-cancel]:hover:not(:disabled) {
  border-color: var(--warning);
  background: color-mix(in srgb, var(--warning) 14%, var(--warning-light));
}

html[data-color-mode="dark"] .feedback-entry-status[data-status="unable_to_fix"] {
  border-color: var(--border);
  background: var(--surface-alt);
  color: var(--text-secondary);
}

html[data-color-mode="dark"]
  :is(
    .ground-checker-result-passed,
    .repair-device-option.repair-coverage-iw,
    .repair-ticket-coverage-value.repair-coverage-iw,
    .repair-coverage-trigger.repair-coverage-iw
  ) {
  color: var(--success);
}

html[data-color-mode="dark"]
  :is(
    .ground-checker-result-failed,
    .ground-checker-result-escalation,
    .repair-device-option.repair-coverage-voided,
    .repair-ticket-coverage-value.repair-coverage-voided,
    .repair-coverage-trigger.repair-coverage-voided
  ) {
  color: var(--danger);
}

html[data-color-mode="dark"]
  :is(
    .repair-device-option.repair-coverage-ac,
    .repair-ticket-coverage-value.repair-coverage-ac,
    .repair-coverage-trigger.repair-coverage-ac
  ) {
  color: var(--primary);
}

html[data-color-mode="dark"]
  :is(
    .repair-device-option.repair-coverage-oow,
    .repair-ticket-coverage-value.repair-coverage-oow,
    .repair-coverage-trigger.repair-coverage-oow
  ) {
  color: var(--warning);
}

html[data-color-mode="dark"] .ground-checker-result-option.is-passed input:checked + span {
  border-color: var(--success);
}

html[data-color-mode="dark"] .ground-checker-result-option.is-failed input:checked + span {
  border-color: var(--danger);
}

/* CSS arrows inherit the palette without filtering the original image assets. */
html[data-color-mode="dark"]
  :is(
    select.form-control,
    .feedback-form select.form-control,
    .feedback-status-select,
    .repair-coverage-trigger
  ) {
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text-secondary) 50%),
    linear-gradient(135deg, var(--text-secondary) 50%, transparent 50%);
  background-position:
    calc(var(--form-control-arrow-offset, calc(100% - var(--form-control-arrow-inset))) - 0.15rem)
      center,
    calc(var(--form-control-arrow-offset, calc(100% - var(--form-control-arrow-inset))) + 0.15rem)
      center;
  background-size: 0.3rem 0.3rem;
}

/* Keep note identities in their accent edge while using readable dark cards. */
html[data-color-mode="dark"] :is(.ann-card.ann-discussion-card, .ann-note-dialog) {
  background: var(--surface-solid);
  box-shadow: var(--neu-shadow-sm);
}

html[data-color-mode="dark"] .ann-card.ann-discussion-card.ann-unread {
  background: color-mix(in srgb, var(--primary) 10%, var(--surface-solid));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 65%, transparent);
}

html[data-color-mode="dark"] .ann-card.ann-discussion-card:hover {
  background: var(--control-hover);
}

html[data-color-mode="dark"] .ann-card.ann-discussion-card.ann-unread:hover,
html[data-color-mode="dark"] .ann-card.ann-discussion-card.ann-unread:focus-within {
  background: color-mix(in srgb, var(--primary) 14%, var(--control-hover));
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--primary) 72%, transparent);
}

html[data-color-mode="dark"] .ann-discussion-card .ann-tag {
  border-color: hsl(var(--ann-tag-hue) 28% 38%);
  background: hsl(var(--ann-tag-hue) 25% 20%);
  color: hsl(var(--ann-tag-hue) 55% 82%);
}

html[data-color-mode="dark"] .ann-discussion-card .ann-tag:hover {
  border-color: hsl(var(--ann-tag-hue) 40% 58%);
  background: hsl(var(--ann-tag-hue) 25% 27%);
  color: hsl(var(--ann-tag-hue) 55% 88%);
}

/* Games dialogs also carry .games-platform when mounted outside the workspace. */
html[data-color-mode="dark"]
  .workspace-category-panel.games-platform[data-workspace-panel="games"] {
  background: var(--bg-surface);
}

html[data-color-mode="dark"]
  .games-platform
  :is(
    .g-arena-banner,
    .g-rank-card,
    .g-stat[data-g-stat],
    .g-featured,
    .g-prizes,
    .g-play-status,
    .g-play-question,
    .g-play-question.is-bonus,
    .g-monthly-champion,
    .g-victory
  ) {
  background: var(--surface);
}

html[data-color-mode="dark"] .games-platform .g-arena-copy p {
  color: var(--text-secondary);
}

html[data-color-mode="dark"] .games-platform .g-arena-status {
  border-color: var(--border);
  background: var(--surface-alt);
  color: var(--text-main);
}

html[data-color-mode="dark"] .games-platform .g-tab.is-active {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

html[data-color-mode="dark"] .games-platform .g-answer-choice.is-selected .g-choice-letter {
  background: var(--action-primary-surface);
}

html[data-color-mode="dark"] .games-leaderboard-row {
  background: var(--surface-alt);
}

html[data-color-mode="dark"] .games-leaderboard-self {
  background: var(--accent-surface);
}

html[data-color-mode="dark"] .games-leaderboard-leader,
html[data-color-mode="dark"] .games-history-table tr.games-history-winner td {
  border-color: var(--warning);
  background: var(--warning-light);
}

html[data-color-mode="dark"]
  .games-platform
  :is(.g-difficulty, .g-bonus-badge, .g-personal-progress) {
  border-color: var(--accent-border);
  background: var(--accent-surface);
  color: var(--accent-text);
}

html[data-color-mode="dark"] .games-platform .g-difficulty[data-difficulty="easy"] {
  border-color: var(--success);
  background: var(--success-light);
  color: var(--success);
}

html[data-color-mode="dark"] .games-platform .g-difficulty[data-difficulty="medium"] {
  border-color: var(--warning);
  background: var(--warning-light);
  color: var(--warning);
}

html[data-color-mode="dark"] .games-platform .g-difficulty[data-difficulty="hard"] {
  border-color: var(--danger);
  background: var(--danger-light);
  color: var(--danger);
}

html[data-color-mode="dark"] .games-platform .g-revealed-hints {
  color: var(--warning);
}

html[data-color-mode="dark"] .games-platform.g-dialog::backdrop {
  background: rgb(18 20 23 / 68%);
}

/* Only monochrome interface symbols use their existing SVG alpha as a mask.
   Profile photos, achievement badges, prizes and other artwork keep their colors. */
@supports (mask-image: url("/icons/close.svg")) or (-webkit-mask-image: url("/icons/close.svg")) {
  html[data-color-mode="dark"]
    .app-icon:is(
      [data-icon="bell"],
      [data-icon="chevron-left"],
      [data-icon="chevron-right"],
      [data-icon="more-vertical"],
      [data-icon="sort"],
      [data-icon="sort-ascending"],
      [data-icon="sort-descending"],
      [data-icon="sidebar-hideButton"],
      [data-icon="close-neutral"],
      [data-icon="close"],
      [data-icon="logout"],
      [data-icon="check"],
      [data-icon="appearance"],
      [data-icon="feedback-menu"],
      [data-icon="feedback-edit"],
      [data-icon="feedback-delete"],
      [data-icon="feedback-pin"],
      [data-icon="ground-checker"],
      [data-icon="repair-ticket"],
      [data-icon="stock-check"],
      [data-icon="stock-record"],
      [data-icon="unit-available"],
      [data-icon="pending-request"],
      [data-icon="games"],
      [data-icon="suggestions"],
      [data-icon="report-bug"],
      [data-icon="tools"]
    ) {
    position: relative;
    --theme-icon-content: "";
    --theme-icon-visibility: hidden;
  }

  html[data-color-mode="dark"] .app-icon::before {
    position: absolute;
    inset: 0;
    background: currentColor;
    -webkit-mask: var(--theme-icon) center / contain no-repeat;
    mask: var(--theme-icon) center / contain no-repeat;
    content: var(--theme-icon-content, none);
    pointer-events: none;
  }

  html[data-color-mode="dark"] .app-icon > img {
    visibility: var(--theme-icon-visibility, visible);
  }

  html[data-color-mode="dark"] .app-icon[data-icon="bell"] {
    --theme-icon: url("/icons/bell.svg");
  }

  html[data-color-mode="dark"] .app-icon[data-icon="chevron-left"] {
    --theme-icon: url("/icons/chevron-left.svg");
  }

  html[data-color-mode="dark"] .app-icon[data-icon="chevron-right"] {
    --theme-icon: url("/icons/chevron-right.svg");
  }

  html[data-color-mode="dark"] .app-icon[data-icon="more-vertical"] {
    --theme-icon: url("/icons/more-vertical.svg");
  }

  html[data-color-mode="dark"] .app-icon[data-icon="sort"] {
    --theme-icon: url("/icons/sort.svg");
  }

  html[data-color-mode="dark"] .app-icon[data-icon="sort-ascending"] {
    --theme-icon: url("/icons/sort-ascending.svg");
  }

  html[data-color-mode="dark"] .app-icon[data-icon="sort-descending"] {
    --theme-icon: url("/icons/sort-descending.svg");
  }

  html[data-color-mode="dark"] .app-icon[data-icon="sidebar-hideButton"] {
    --theme-icon: url("/icons/sidebar-hideButton.svg");
  }

  html[data-color-mode="dark"] .app-icon[data-icon="close-neutral"] {
    --theme-icon: url("/icons/close-neutral.svg");
  }

  html[data-color-mode="dark"] .app-icon[data-icon="close"] {
    --theme-icon: url("/icons/close.svg");
  }

  html[data-color-mode="dark"] .app-icon[data-icon="logout"] {
    --theme-icon: url("/icons/logout.svg");
  }

  html[data-color-mode="dark"] .app-icon[data-icon="check"] {
    --theme-icon: url("/icons/check.svg");
  }

  html[data-color-mode="dark"] .app-icon[data-icon="appearance"] {
    --theme-icon: url("/icons/appearance.svg");
  }

  html[data-color-mode="dark"] .app-icon[data-icon="feedback-menu"] {
    --theme-icon: url("/icons/feedback-menu.svg");
  }

  html[data-color-mode="dark"] .app-icon[data-icon="feedback-edit"] {
    --theme-icon: url("/icons/feedback-edit.svg");
  }

  html[data-color-mode="dark"] .app-icon[data-icon="feedback-delete"] {
    --theme-icon: url("/icons/feedback-delete.svg");
  }

  html[data-color-mode="dark"] .app-icon[data-icon="feedback-pin"] {
    --theme-icon: url("/icons/feedback-pin.svg");
  }

  html[data-color-mode="dark"] .app-icon[data-icon="ground-checker"] {
    --theme-icon: url("/icons/ground-checker.svg");
  }

  html[data-color-mode="dark"] .app-icon[data-icon="repair-ticket"] {
    --theme-icon: url("/icons/repair-ticket.svg");
  }

  html[data-color-mode="dark"] .app-icon[data-icon="stock-check"] {
    --theme-icon: url("/icons/stock-check.svg");
  }

  html[data-color-mode="dark"] .app-icon[data-icon="stock-record"] {
    --theme-icon: url("/icons/stock-record.svg");
  }

  html[data-color-mode="dark"] .app-icon[data-icon="unit-available"] {
    --theme-icon: url("/icons/unit-available.svg");
  }

  html[data-color-mode="dark"] .app-icon[data-icon="pending-request"] {
    --theme-icon: url("/icons/pending-request.svg");
  }

  html[data-color-mode="dark"] .app-icon[data-icon="games"] {
    --theme-icon: url("/icons/games.svg");
  }

  html[data-color-mode="dark"] .app-icon[data-icon="suggestions"] {
    --theme-icon: url("/icons/suggestions.svg");
  }

  html[data-color-mode="dark"] .app-icon[data-icon="report-bug"] {
    --theme-icon: url("/icons/report-bug.svg");
  }

  html[data-color-mode="dark"] .app-icon[data-icon="tools"] {
    --theme-icon: url("/icons/tools.svg");
  }

  html[data-color-mode="dark"] .workspace-sort-button:has(> .sort-icon) {
    --theme-icon: url("/icons/sort.svg");
  }

  html[data-color-mode="dark"]
    .workspace-sort-button:has(> .sort-icon[src$="/sort-ascending.svg"]) {
    --theme-icon: url("/icons/sort-ascending.svg");
  }

  html[data-color-mode="dark"]
    .workspace-sort-button:has(> .sort-icon[src$="/sort-descending.svg"]) {
    --theme-icon: url("/icons/sort-descending.svg");
  }

  html[data-color-mode="dark"] .workspace-sort-button > .sort-icon {
    display: none;
  }

  html[data-color-mode="dark"] .workspace-sort-button:has(> .sort-icon)::after {
    display: block;
    flex: 0 0 0.9rem;
    width: 0.9rem;
    height: 0.9rem;
    background: currentColor;
    -webkit-mask: var(--theme-icon) center / contain no-repeat;
    mask: var(--theme-icon) center / contain no-repeat;
    content: "";
    pointer-events: none;
  }

  html[data-color-mode="dark"]
    :is(
      .modal-close,
      .page-modal-close,
      [data-notifications-close],
      .ann-filter-toggle,
      .stock-calendar-trigger
    ):has(> img) {
    position: relative;
    --theme-icon: url("/icons/close-neutral.svg");
  }

  html[data-color-mode="dark"] .ann-filter-toggle:has(> img) {
    --theme-icon: url("/icons/announcement-filter-placeholder.svg");
  }

  html[data-color-mode="dark"] .stock-calendar-trigger:has(> img) {
    --theme-icon: url("/icons/stock-calendar.svg");
  }

  html[data-color-mode="dark"]
    :is(
      .modal-close,
      .page-modal-close,
      [data-notifications-close],
      .ann-filter-toggle,
      .stock-calendar-trigger
    )
    > img {
    visibility: hidden;
  }

  html[data-color-mode="dark"]
    :is(
      .modal-close,
      .page-modal-close,
      [data-notifications-close],
      .ann-filter-toggle,
      .stock-calendar-trigger
    ):has(> img)::after {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1.15rem;
    height: 1.15rem;
    background: currentColor;
    -webkit-mask: var(--theme-icon) center / contain no-repeat;
    mask: var(--theme-icon) center / contain no-repeat;
    content: "";
    transform: translate(-50%, -50%);
    pointer-events: none;
  }
}

@media (prefers-contrast: more) {
  html[data-color-mode="dark"],
  html[data-color-mode="dark"] .games-platform {
    --border: #a1a6ae;
    --border-light: #a1a6ae;
  }
}

@media (forced-colors: active) {
  .theme-mode-switch,
  #softDarkModeToggle:checked + .theme-mode-switch {
    border-color: ButtonText;
    background: Canvas;
  }

  .theme-mode-switch::before,
  #softDarkModeToggle:checked + .theme-mode-switch::before {
    background: ButtonText;
  }
}
