/* Shared interface colors for the app shell and standalone Komi pages. */
:root {
  color-scheme: dark;
  --komi-bg: #0b0b0b;
  --komi-card: rgb(255 255 255 / .035);
  --komi-panel: rgb(255 255 255 / .065);
  --komi-hover: rgb(255 255 255 / .115);
  --komi-ink: #f5f5f5;
  --komi-muted: #b8b8b8;
  --komi-divider: rgb(255 255 255 / .13);
  --komi-line: rgb(255 255 255 / .28);
  --komi-accent: #f5f5f5;
  --komi-accent-hover: color-mix(in srgb, var(--komi-accent), white 14%);
  --komi-accent-ink: var(--komi-bg);
  --komi-floating: rgb(17 17 17 / .9);
  --komi-scrim: rgb(0 0 0 / .58);
  background: var(--komi-bg);
}

@layer komi-glass {
  /* Use the neutral palette for interface elements, not a compositing filter
     on page, dialog or artwork containers. Posters keep their source colors. */
  :where(.komi-icon-rail .komi-side-account) {
    display: none !important;
  }

  :where(body, .app-layout, #mainContainer, .komi-catalog-v6, .komi-journey-library,
    .komi-home-storefront, .komi-home-shelf, .komi-home-genres-section,
    .komi-hub-overlay, .info-header, .topbar, .komi-journey-detail > header,
    .komi-public-footer, .komi-info-page, .komi-watch-quick-actions,
    .komi-cinema-v7 > .komi-player-support, .komi-cinema-topbar) {
    background: transparent !important;
  }

  :where(.komi-discovery-card, .komi-catalog-card, .komi-home-release-card,
    .komi-journey-active-filters button, .komi-hub-tools-panel .komi-tools-row,
    .komi-catalog-search, .catalog-filters-box, .komi-catalog-v6 select,
    .komi-catalog-quick-chips button:not([aria-pressed="true"]), .komi-profile-panel,
    .komi-profile-section, .komi-shop-static-card, .komi-shop-extra-card,
    .komi-shop-gifts-panel, .info-contact-card, .info-project-note,
    .komi-comments, .komi-comment:not([class*="komi-store-"]),
    .komi-watch-sidebar, .komi-watch-source-field, .watch-source-note,
    .komi-watch-rail-logo, .komi-side-logo, .komi-public-footer-logo, .brand-mark) {
    background-color: var(--komi-card) !important;
    border-color: var(--komi-divider) !important;
  }

  :where(.komi-watch-rail-logo, .komi-side-logo, .komi-public-footer-logo, .brand-mark) {
    color: var(--komi-ink) !important;
    background-image: none !important;
  }

  :where(.komi-quick-dialog[open], .komi-journey-list-dialog[open], #searchDropdown.active,
    .modal-content, .komi-friends-drawer, #notifDropdown.active,
    .komi-mobile-sheet-panel, .komi-deck-menu, .komi-compact-list > div, .komi-checkout-dialog,
    #komiPlayerRecovery:not([hidden])), dialog:modal {
    background: var(--komi-floating) !important;
    border-color: var(--komi-divider) !important;
    backdrop-filter: blur(12px);
  }

  :where(#watchModalContent, #watchPartyModalContent) {
    background: transparent !important;
    backdrop-filter: none;
  }

  :where(#watchModal.active, #watchPartyModal.active) {
    background: rgb(0 0 0 / .88) !important;
  }

  dialog::backdrop {
    background: var(--komi-scrim) !important;
    backdrop-filter: blur(4px);
  }

  :where(.komi-hub-overlay, .info-header, .komi-journey-detail > header) {
    border-color: var(--komi-divider) !important;
    box-shadow: none !important;
  }

  :where(.komi-hub-overlay) :is(.search-bar, .komi-journey-account, .komi-journey-close,
    .komi-hub-tools-menu > summary, .komi-winter-jump) {
    color: var(--komi-ink) !important;
    background: var(--komi-panel) !important;
    border-color: var(--komi-divider) !important;
  }

  :where(.komi-hub-overlay, .komi-catalog-v6) :is(.search-bar, .komi-catalog-search):focus-within {
    border-color: var(--komi-accent) !important;
  }

  :where(.komi-hub-overlay) :is(.komi-journey-account, .komi-hub-tools-menu > summary, .komi-winter-jump):hover {
    background: var(--komi-hover) !important;
  }

  :where(#watchModal, #watchPartyModal) :is(.komi-cinema-topbar, .komi-player-heading,
    .komi-player-support, .komi-watch-quick-actions,
    .komi-watch-rail, #komiPlayerRecovery, .komi-native-hud, .komi-playback-settings,
    .komi-v4-pending, .komi-cinema-source-gate, #komiAnimeComments,
    .komi-party-lobby-grid, .komi-party-lobby-head, .komi-party-room-header,
    .komi-party-social-panel, .komi-party-source-panel) {
    filter: grayscale(1);
  }

  @media (max-width: 767px) {
    :where(body.komi-media-hub) .komi-icon-rail {
      background: rgb(12 12 12 / .86) !important;
      border-color: var(--komi-divider) !important;
    }
  }
}
