/* Shared action language. Explicit selectors leave cards, navigation, tabs,
   checkboxes, game controls, and photo/binder hit areas to their components. */
:root {
  --action-neutral: color-mix(in srgb, var(--ink) 7%, var(--paper));
  --action-neutral-hover: color-mix(in srgb, var(--ink) 12%, var(--paper));
  --action-fill: var(--action-neutral);
  --action-hover-fill: var(--action-neutral-hover);
  --action-text: var(--ink);
}

:root :is(
  .collection-control[data-collection-control="set"] :is(.collection-button, button),
  .set-collection-actions > a,
  .set-section-tools .subset-jumps > a,
  .guide-links a,
  .checklist-download,
  .collection-control [data-open-entry-lists],
  .collection-page :is([data-binder-add-set], [data-new-list], [data-new-section], .collection-show-all),
  .collection-account-tools button,
  .collection-name-form button,
  .collection-dialog-actions button,
  .collection-editor [data-more],
  .private-form-actions button,
  .profile-page form > button,
  .profile-actions > button,
  .profile-photo-row > button,
  .profile-file,
  .profile-owned + nav button,
  .photo-editor-actions button,
  .social-actions > :is(button, a),
  button[data-friend-action],
  .bounty-market-actions > a,
  .bounty-market-more,
  .card-watch-controls button,
  .bounty-offers > [data-next],
  .card-bounties > button,
  .messages-page [data-retry],
  .message-compose [data-add-photos],
  .community-compose :is([type="submit"], [data-remove-photo]),
  .community-page [data-sign-out],
  .community-login,
  .team-builder-actions .roster-action,
  .roster-save-pdf,
  .roster-pages button,
  .team-builder-dialog :is([data-replace-player], [data-remove-player]),
  .catalog-batch-controls button,
  .search-preview-all,
  .wallpaper-download,
  .detail-compare-action,
  .notifications-heading-actions button,
  .notifications-more,
  .notifications-retry,
  .notification-history-refresh,
  .notification-history-more,
  .notification-history-state button
):where(:not([hidden])) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px 13px;
  font: 550 13px/1.35 var(--sans);
  letter-spacing: 0;
  vertical-align: middle;
}

:root :is(
  .collection-control[data-collection-control="set"] :is(.collection-button, button),
  .set-collection-actions > a,
  .set-section-tools .subset-jumps > a,
  .guide-links a,
  .checklist-download,
  .collection-control [data-open-entry-lists],
  .collection-page :is([data-binder-add-set], [data-new-list], [data-new-section], .collection-show-all),
  .collection-account-tools button,
  .collection-name-form button,
  .collection-dialog-actions button,
  .collection-editor [data-more],
  .private-form-actions button,
  .profile-page form > button,
  .profile-actions > button,
  .profile-photo-row > button,
  .profile-file,
  .profile-owned + nav button,
  .photo-editor-actions button,
  .social-actions > :is(button, a),
  button[data-friend-action],
  .bounty-market-actions > a,
  .bounty-market-more,
  .card-watch-controls button,
  .bounty-offers > [data-next],
  .card-bounties > button,
  .messages-page [data-retry],
  .message-compose [data-add-photos],
  .community-compose :is([type="submit"], [data-remove-photo]),
  .community-page [data-sign-out],
  .community-login,
  .team-builder-actions .roster-action,
  .roster-save-pdf,
  .roster-pages button,
  .team-builder-dialog :is([data-replace-player], [data-remove-player]),
  .catalog-batch-controls button,
  .search-preview-all,
  .wallpaper-download,
  .detail-compare-action,
  .notifications-heading-actions button,
  .notifications-more,
  .notifications-retry,
  .notification-history-refresh,
  .notification-history-more,
  .notification-history-state button,
  .compare-mode .compare-shuffle,
  .compare-picker-controls :is(.compare-change, .compare-clear),
  .detail-zoom-trigger,
  .detail-zoom-close,
  .detail-side-controls button,
  button.collection-visibility
) {
  border: 1px solid transparent;
  border-radius: 7px;
  background: var(--action-fill);
  color: var(--action-text);
  box-shadow: var(--action-shadow, none);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  text-decoration: none;
  text-shadow: none;
  cursor: pointer;
}

/* Primary actions carry weight through solid ink, never a colored outline. */
:root :is(
  .collection-control[data-collection-control="set"] :is(.collection-button, button),
  .collection-page [data-binder-add-set],
  .collection-page :is([data-new-list], [data-new-section]),
  .collection-name-form [type="submit"],
  .private-form-actions [type="submit"],
  .profile-page form > button:not([type]),
  .profile-page form > button[type="submit"],
  .photo-editor-actions [data-save],
  .social-actions > button:not([type]),
  .social-actions > button[type="submit"],
  button[data-friend-action="request"],
  button[data-friend-action="accept"],
  .community-compose [type="submit"],
  .community-login,
  .team-builder-actions [data-play-game],
  .roster-name-form [type="submit"],
  .my-rosters .team-builder-heading .roster-save-pdf,
  .compare-mode .compare-shuffle
) {
  --action-fill: var(--ink);
  --action-hover-fill: color-mix(in srgb, var(--ink) 84%, var(--paper));
  --action-text: var(--paper);
  font-weight: 600;
}

:root :is(
  .collection-control[data-collection-control="set"] :is(.collection-button, button),
  .set-collection-actions > a,
  .set-section-tools .subset-jumps > a,
  .guide-links a,
  .checklist-download,
  .collection-control [data-open-entry-lists],
  .collection-page :is([data-binder-add-set], [data-new-list], [data-new-section], .collection-show-all),
  .collection-account-tools button,
  .collection-name-form button,
  .collection-dialog-actions button,
  .collection-editor [data-more],
  .private-form-actions button,
  .profile-page form > button,
  .profile-actions > button,
  .profile-photo-row > button,
  .profile-file,
  .profile-owned + nav button,
  .photo-editor-actions button,
  .social-actions > :is(button, a),
  button[data-friend-action],
  .bounty-market-actions > a,
  .bounty-market-more,
  .card-watch-controls button,
  .bounty-offers > [data-next],
  .card-bounties > button,
  .messages-page [data-retry],
  .message-compose [data-add-photos],
  .community-compose :is([type="submit"], [data-remove-photo]),
  .community-page [data-sign-out],
  .community-login,
  .team-builder-actions .roster-action,
  .roster-save-pdf,
  .roster-pages button,
  .team-builder-dialog :is([data-replace-player], [data-remove-player]),
  .catalog-batch-controls button,
  .search-preview-all,
  .wallpaper-download,
  .detail-compare-action,
  .notifications-heading-actions button,
  .notifications-more,
  .notifications-retry,
  .notification-history-refresh,
  .notification-history-more,
  .notification-history-state button,
  .compare-mode .compare-shuffle,
  .compare-picker-controls :is(.compare-change, .compare-clear),
  .detail-zoom-trigger,
  .detail-zoom-close,
  .detail-side-controls button,
  button.collection-visibility
):not(:disabled, [aria-disabled="true"]):hover {
  background: var(--action-hover-fill);
  color: var(--action-text);
  border-color: transparent;
  box-shadow: var(--action-shadow, none);
  text-decoration: none;
}

:root :is(
  .collection-control[data-collection-control="set"] :is(.collection-button, button),
  .set-collection-actions > a,
  .set-section-tools .subset-jumps > a,
  .guide-links a,
  .checklist-download,
  .collection-control [data-open-entry-lists],
  .collection-page :is([data-binder-add-set], [data-new-list], [data-new-section], .collection-show-all),
  .collection-account-tools button,
  .collection-name-form button,
  .collection-dialog-actions button,
  .collection-editor [data-more],
  .private-form-actions button,
  .profile-page form > button,
  .profile-actions > button,
  .profile-photo-row > button,
  .profile-file,
  .profile-owned + nav button,
  .photo-editor-actions button,
  .social-actions > :is(button, a),
  button[data-friend-action],
  .bounty-market-actions > a,
  .bounty-market-more,
  .card-watch-controls button,
  .bounty-offers > [data-next],
  .card-bounties > button,
  .messages-page [data-retry],
  .message-compose [data-add-photos],
  .community-compose :is([type="submit"], [data-remove-photo]),
  .community-page [data-sign-out],
  .community-login,
  .team-builder-actions .roster-action,
  .roster-save-pdf,
  .roster-pages button,
  .team-builder-dialog :is([data-replace-player], [data-remove-player]),
  .catalog-batch-controls button,
  .search-preview-all,
  .wallpaper-download,
  .detail-compare-action,
  .notifications-heading-actions button,
  .notifications-more,
  .notifications-retry,
  .notification-history-refresh,
  .notification-history-more,
  .notification-history-state button,
  .compare-mode .compare-shuffle,
  .compare-picker-controls :is(.compare-change, .compare-clear),
  .detail-zoom-trigger,
  .detail-zoom-close,
  .detail-side-controls button,
  button.collection-visibility
):focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}
:root .profile-file:focus-within { outline: 2px solid var(--ink); outline-offset: 3px; }

:root :is(
  .collection-control[data-collection-control="set"] :is(.collection-button, button),
  .set-collection-actions > a,
  .set-section-tools .subset-jumps > a,
  .guide-links a,
  .checklist-download,
  .collection-control [data-open-entry-lists],
  .collection-page :is([data-binder-add-set], [data-new-list], [data-new-section], .collection-show-all),
  .collection-account-tools button,
  .collection-name-form button,
  .collection-dialog-actions button,
  .collection-editor [data-more],
  .private-form-actions button,
  .profile-page form > button,
  .profile-actions > button,
  .profile-photo-row > button,
  .profile-file,
  .profile-owned + nav button,
  .photo-editor-actions button,
  .social-actions > :is(button, a),
  button[data-friend-action],
  .bounty-market-actions > a,
  .bounty-market-more,
  .card-watch-controls button,
  .bounty-offers > [data-next],
  .card-bounties > button,
  .messages-page [data-retry],
  .message-compose [data-add-photos],
  .community-compose :is([type="submit"], [data-remove-photo]),
  .community-page [data-sign-out],
  .community-login,
  .team-builder-actions .roster-action,
  .roster-save-pdf,
  .roster-pages button,
  .team-builder-dialog :is([data-replace-player], [data-remove-player]),
  .catalog-batch-controls button,
  .search-preview-all,
  .wallpaper-download,
  .detail-compare-action,
  .notifications-heading-actions button,
  .notifications-more,
  .notifications-retry,
  .notification-history-refresh,
  .notification-history-more,
  .notification-history-state button,
  .compare-mode .compare-shuffle,
  .compare-picker-controls :is(.compare-change, .compare-clear),
  .detail-zoom-trigger,
  .detail-zoom-close,
  .detail-side-controls button,
  button.collection-visibility
):is(:disabled, [aria-disabled="true"]) {
  background: var(--action-neutral);
  color: var(--muted);
  border-color: transparent;
  box-shadow: none;
  opacity: .55;
  cursor: default;
}

/* Add whole set is a compact, square-edged primary action in either state. */
:root .collection-control[data-collection-control="set"] :is(.collection-button, button),
:root .collection-page [data-binder-add-set] {
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 6px;
  white-space: nowrap;
}

/* Keep the card viewer's existing geometry and clearly mark its active face. */
:root :is(.detail-side-controls, .compare-selected .detail-viewer-home .detail-side-controls) {
  border: 1px solid transparent;
  border-radius: 7px;
  background: var(--action-neutral);
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
:root .detail-side-controls button {
  --action-fill: transparent;
  --action-hover-fill: var(--action-neutral-hover);
  --action-text: var(--muted);
  border-radius: 5px;
}

/* Quiet utility controls retain their dimensions and emphasis. */
:root .compare-picker-controls :is(.compare-change, .compare-clear),
:root .notifications-heading-actions button {
  --action-fill: transparent;
  --action-hover-fill: var(--action-neutral);
}
:root .notifications-panel .notifications-heading .notifications-heading-actions button { min-height: 32px; padding: 5px 7px; font-size: 11px; }
:root .team-builder-actions .roster-action--quiet { --action-fill: transparent; }
:root .compare-shuffle[aria-disabled="true"] { cursor: progress; }

@media (pointer: coarse) {
  :root .collection-control[data-collection-control="set"] :is(.collection-button, button),
  :root .collection-page [data-binder-add-set] { min-height: 40px; }
}


/* Watch/privacy toggles keep their meaning while using neutral active states. */
:root :is(.card-watch-controls button, button.collection-visibility)[aria-pressed="true"] {
  --action-fill: var(--ink);
  --action-hover-fill: color-mix(in srgb, var(--ink) 84%, var(--paper));
  --action-text: var(--paper);
}

/* Grid / Checklist and Front / Back share a single selected surface. */
:root .view-switch {
  padding: 3px;
  background: color-mix(in srgb, var(--ink) 5%, transparent);
  border: 1px solid transparent;
  border-radius: 9px;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
:root .view-switch button {
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  text-decoration: none;
}
:root .view-switch button:hover { background: var(--selection-hover); color: var(--ink); }
:root :is(.view-switch, .detail-side-controls) button[aria-pressed="true"] {
  --action-text: var(--ink);
  --action-fill: var(--selection-fill);
  --action-hover-fill: var(--selection-fill);
  --action-shadow: var(--selection-shadow);
  background: var(--action-fill);
  color: var(--action-text);
  box-shadow: var(--action-shadow);
  font-weight: 600;
}
@media (forced-colors: active) {
  :root :is(.view-switch, .detail-side-controls) button[aria-pressed="true"] {
    text-decoration: underline;
    text-underline-offset: 3px;
  }
}
:root .view-switch button:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
:root .view-switch button:disabled { opacity: .55; cursor: default; }
