/**
 * GAMESPSN — Storewide dark popup finish, limited to .glpm.
 * Materials and state colors come from the shared semantic token layer.
 * Preserves the existing cart layout, WooCommerce business logic and interactions.
 */
@layer gamespsn-brand {
  body.gl-brand-2026 .glpm {
    --pm-border: var(--gs-x-popup-border,var(--gs-color-border)) !important;
    --pm-muted: var(--gs-color-text-secondary) !important;
    
    color: var(--gs-x-popup-text,var(--gs-color-text-body)) !important;
  }
  body.gl-brand-2026 .glpm-backdrop {
    background: var(--gs-x-popup-overlay,var(--gs-color-overlay)) !important;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
  }
  body.gl-brand-2026 .glpm-dialog {
    background: var(--gs-x-popup-bg,var(--gs-color-surface-raised)) !important;
    border-color: var(--gs-x-popup-border,var(--gs-color-border)) !important;
    box-shadow: var(--gs-x-popup-shadow,var(--gs-shadow-dialog)) !important;
    color: var(--gs-x-popup-text,var(--gs-color-text-body)) !important;
  }
  body.gl-brand-2026 .glpm :is(.glpm-head,.glpm-footer) {
    background: var(--gs-x-popup-bg,var(--gs-color-surface)) !important;
    border-color: var(--gs-x-popup-border,var(--gs-color-border)) !important;
  }
  body.gl-brand-2026 .glpm .glpm-scroll {
    background: var(--gs-x-popup-bg,var(--gs-color-surface)) !important;
    scrollbar-color: var(--gs-color-control-border) transparent !important;
  }
  body.gl-brand-2026 .glpm .glpm-option {
    background: var(--gs-x-card-bg,var(--gs-color-input)) !important;
    border-color: var(--gs-x-card-border,var(--gs-color-control-border)) !important;
    color: var(--gs-x-card-text,var(--gs-color-text-primary)) !important;
  }
  body.gl-brand-2026 .glpm .glpm-smart-option,
body.gl-brand-2026 .glpm .glpm-selected,
body.gl-brand-2026 .glpm .glpm-qty,
body.gl-brand-2026 .glpm .glpm-smart-tabs {
    background: var(--gs-x-popup-bg,var(--gs-color-input)) !important;
    border-color: var(--gs-x-popup-border,var(--gs-color-control-border)) !important;
    color: var(--gs-x-popup-text,var(--gs-color-text-primary)) !important;
  }
  body.gl-brand-2026 .glpm .glpm-head-image,
body.gl-brand-2026 .glpm .glpm-line-art,
body.gl-brand-2026 .glpm .glpm-selected-image {
    background: var(--gs-color-input) !important;
    border-color: var(--gs-x-popup-border,var(--gs-color-control-border)) !important;
    color: var(--gs-x-popup-text,var(--gs-color-text-primary)) !important;
  }
  body.gl-brand-2026 .glpm :is(.glpm-line,.glpm-promo) {
    background: var(--gs-x-popup-bg,transparent) !important;
    border-color: var(--gs-x-popup-border,var(--gs-color-border)) !important;
    color: var(--gs-x-popup-text,var(--gs-color-text-body)) !important;
  }
  body.gl-brand-2026 .glpm .glpm-option-image {
    background: var(--gs-color-surface) !important;
    border-color: var(--gs-x-card-border,var(--gs-color-border)) !important;
  }
  body.gl-brand-2026 .glpm .glpm-spark {
    background: var(--gs-x-popup-bg,var(--gs-color-surface)) !important;
    border-color: var(--gs-x-popup-border,var(--gs-color-border)) !important;
  }
  body.gl-brand-2026 .glpm .glpm-gift-mark {
    background: var(--gs-x-popup-icon_bg,var(--gs-color-surface)) !important;
    border-color: var(--gs-x-popup-border,var(--gs-color-border)) !important;
  }
  /* Product names and totals lead; supporting information stays quieter. */
  /* Level 1: titles and product names. */
  body.gl-brand-2026 .glpm h2,
body.gl-brand-2026 .glpm h3 {
    color: var(--gs-x-popup-title,var(--gs-color-text-primary)) !important;
  }
  body.gl-brand-2026 .glpm .glpm-line-name,
body.gl-brand-2026 .glpm .glpm-reward-intro,
body.gl-brand-2026 .glpm .glpm-selected-copy strong {
    color: var(--gs-x-popup-text,var(--gs-color-text-primary)) !important;
  }
  body.gl-brand-2026 .glpm .glpm-option-text a {
    color: var(--gs-x-card-link,var(--gs-color-text-primary)) !important;
  }
  /* Level 2: important prices and monetary totals. */
  body.gl-brand-2026 .glpm .glpm-line-end>strong,
body.gl-brand-2026 .glpm .glpm-summary strong {
    color: var(--gs-x-popup-price,var(--gs-color-text-primary)) !important;
  }
  body.gl-brand-2026 .glpm .glpm-option-text span {
    color: var(--gs-x-card-price,var(--gs-color-text-primary)) !important;
  }
  body.gl-brand-2026 .glpm .glpm-qty strong,
body.gl-brand-2026 .glpm .glpm-selected-copy span {
    color: var(--gs-x-popup-text,var(--gs-color-text-primary)) !important;
  }
  /* Level 3: readable supporting metadata. */
  body.gl-brand-2026 .glpm .glpm-summary,
body.gl-brand-2026 .glpm .glpm-row-heading h3 small {
    color: var(--gs-x-popup-title,var(--gs-color-text-secondary)) !important;
  }
  body.gl-brand-2026 .glpm .glpm-promo-head p,
body.gl-brand-2026 .glpm .glpm-line-info small,
body.gl-brand-2026 .glpm .glpm-selected-copy small,
body.gl-brand-2026 .glpm .glpm-selected-copy del,
body.gl-brand-2026 .glpm .glpm-footer>small,
body.gl-brand-2026 .glpm .glpm-step-text,
body.gl-brand-2026 .glpm .glpm-quiet,
body.gl-brand-2026 .glpm .glpm-empty,
body.gl-brand-2026 .glpm .glpm-milestone {
    color: var(--gs-x-popup-muted,var(--gs-color-text-secondary)) !important;
  }
  body.gl-brand-2026 .glpm .glpm-option-text small {
    color: var(--gs-x-card-muted,var(--gs-color-text-secondary)) !important;
  }
  body.gl-brand-2026 .glpm .glpm-option-text del {
    color: var(--gs-x-card-old_price,var(--gs-color-text-secondary)) !important;
  }
  body.gl-brand-2026 .glpm .glpm-reward-mark {
    color: var(--gs-x-popup-icon,var(--gs-color-text-secondary)) !important;
  }
  body.gl-brand-2026 .glpm :is(.glpm-summary,.glpm-promo-head p,.glpm-line-info small,.glpm-option-text small,.glpm-option-text del,.glpm-selected-copy small,.glpm-selected-copy del,.glpm-footer>small,.glpm-step-text,.glpm-quiet,.glpm-empty,.glpm-row-heading h3 small,.glpm-reward-mark,.glpm-milestone) {
    opacity: 1 !important;
  }
  /* Quiet controls retain visible contrast. */
  body.gl-brand-2026 .glpm :is(.glpm-qty,.glpm-qty button,.glpm-clear,.glpm-x,.glpm-trash) {
    color: var(--gs-x-popup-button_text,var(--gs-color-text-primary)) !important;
  }
  /* Success, savings and actual FREE values use the existing official status green. */
  body.gl-brand-2026 .glpm :is(.glpm-success,.glpm-free,.glpm-green,.glpm-savings,.glpm-selected-copy b) {
    color: var(--gs-x-popup-success,var(--gs-color-savings)) !important;
  }
  
  body.gl-brand-2026 .glpm .glpm-message[data-kind=error] {color:var(--gs-x-popup-error,var(--gs-color-error)) !important;
  background:var(--gs-x-popup-error_bg,var(--gs-color-error-bg)) !important;
  border-color:var(--gs-x-popup-error,var(--gs-color-error)) !important;}
  /* Violet supports gift progress; mint is reserved for an earned reward. */
  body.gl-brand-2026 .glpm :is(.glpm-spark,.glpm-gift-mark) {
    color:var(--gs-x-popup-icon,var(--gs-color-focus)) !important;
    background:var(--gs-x-popup-icon_bg,var(--gs-color-selected-bg)) !important;
    border-color:var(--gs-x-popup-border,var(--gs-color-border)) !important;
    box-shadow: none !important;
  }
  body.gl-brand-2026 .glpm .glpm-progress {
    background: var(--gs-x-popup-bg,var(--gs-color-border)) !important;
  }
  body.gl-brand-2026 .glpm .glpm-progress > span {
    background: var(--gs-x-popup-bg,var(--gs-color-focus)) !important;
  }
  body.gl-brand-2026 .glpm .glpm-milestone b {
    background: var(--gs-x-popup-bg,var(--gs-color-surface)) !important;
    color: var(--gs-x-popup-muted,var(--gs-color-text-secondary)) !important;
    border-color: var(--gs-x-popup-border,var(--gs-color-border)) !important;
  }
  body.gl-brand-2026 .glpm .glpm-gift-mark.is-earned,
body.gl-brand-2026 .glpm .glpm-milestone.is-done b {
    background:var(--gs-x-popup-success_bg,var(--gs-color-savings-bg)) !important;
    background-image: none !important;
    border-color:var(--gs-x-popup-success,var(--gs-color-savings)) !important;
    color:var(--gs-x-popup-success,var(--gs-color-savings)) !important;
  }
  body.gl-brand-2026 .glpm .glpm-just {
    background: var(--gs-x-popup-bg,var(--gs-color-selected-bg)) !important;
    color: var(--gs-x-popup-text,var(--gs-color-text-body)) !important;
  }
  body.gl-brand-2026 .glpm .glpm-selected {
    border: 2px solid var(--gs-x-popup-border,var(--gs-color-border)) !important;
    background:var(--gs-x-popup-success_bg,var(--gs-color-savings-bg)) !important;
    box-shadow:var(--gs-x-popup-shadow,none) !important;
  
  border-color:var(--gs-x-popup-success,var(--gs-color-savings)) !important;}
  body.gl-brand-2026 .glpm .glpm-selected-check {
    background: var(--gs-x-popup-success_bg,var(--gs-color-savings-bg)) !important;
    color: var(--gs-x-popup-success,var(--gs-color-savings)) !important;
  }
  body.gl-brand-2026 .glpm .glpm-selected-copy strong {
    color: var(--gs-x-popup-text,var(--gs-color-text-primary)) !important;
  }
  body.gl-brand-2026 .glpm .glpm-selected-copy small {
    color: var(--gs-x-popup-muted,var(--gs-color-text-secondary)) !important;
    opacity: 1 !important;
  }
  body.gl-brand-2026 .glpm .glpm-selected-copy span {
    color: var(--gs-x-popup-text,var(--gs-color-text-body)) !important;
  }
  body.gl-brand-2026 .glpm .glpm-selected-copy b {
    color:var(--gs-x-popup-success,var(--gs-color-savings)) !important;
  }
  body.gl-brand-2026 .glpm .glpm-smart-tabs button,
body.gl-brand-2026 .glpm .glpm-gift-tabs button {
    background: var(--gs-x-popup-button_bg,var(--gs-color-surface-raised)) !important;
    color: var(--gs-x-popup-button_text,var(--gs-color-text-primary)) !important;
    border-color: var(--gs-x-popup-button_border,var(--gs-color-action-primary-border,var(--gs-color-control-border))) !important;
  }
  body.gl-brand-2026 .glpm .glpm-smart-tabs button[aria-selected=true],
body.gl-brand-2026 .glpm .glpm-gift-tabs button[aria-pressed=true] {
    background: var(--gs-x-popup-button_bg,var(--gs-color-selected-bg)) !important;
    color: var(--gs-x-popup-button_text,var(--gs-color-text-primary)) !important;
    border-color: var(--gs-x-popup-button_border,var(--gs-color-action-primary-border,var(--gs-color-focus))) !important;
    box-shadow: none !important;
  }
  body.gl-brand-2026 .glpm .glpm-smart-tabs button:hover:not(:disabled) {
    background: var(--gs-x-popup-button_hover_bg,var(--gs-color-surface-raised)) !important;
    color: var(--gs-x-popup-button_text,var(--gs-color-text-primary)) !important;
  }
  body.gl-brand-2026 .glpm .glpm-option button[data-glpm-action=choose],
body.gl-brand-2026 .glpm .glpm-option button[data-glpm-action=add] {
    background: var(--gs-x-card-secondary_bg,var(--gl-secondary-button-bg,var(--gs-color-action-secondary-bg))) !important;
    border: 1px solid var(--gs-x-card-secondary_border,var(--gs-color-action-secondary-border)) !important;
    color: var(--gs-x-card-secondary_text,var(--gs-color-on-action-secondary)) !important;
    box-shadow: none !important;
  }
  body.gl-brand-2026 .glpm :is(.glpm-option button[data-glpm-action=choose],.glpm-option button[data-glpm-action=add]):hover:not(:disabled) {
    --gl-secondary-button-bg: var(--gs-color-action-secondary-hover);
    filter: none;
  }
  /* Full image slot, centered, no distortion. Only the free-game alternatives. */
  body.gl-brand-2026 .glpm .glpm-reward-option .glpm-option-image {
    display: block;
    overflow: hidden;
  }
  body.gl-brand-2026 .glpm .glpm-reward-option .glpm-option-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover !important;
    object-position: center center !important;
    border: 0 !important;
  }
  body.gl-brand-2026 .glpm .glpm-primary {
    background: var(--gs-x-popup-button_bg,var(--gs-gradient-action-primary)) !important;
    border-color: var(--gs-x-popup-button_border,var(--gs-color-action-primary-border,transparent)) !important;
    color: var(--gs-x-popup-button_text,var(--gs-color-on-action)) !important;
    box-shadow: var(--gs-shadow-action) !important;
  }
  body.gl-brand-2026 .glpm .glpm-primary:hover:not(.glpm-disabled) {
    background:var(--gs-x-popup-button_hover_bg,var(--gs-gradient-action-primary-hover)) !important;
    box-shadow:var(--gs-shadow-action-hover) !important;
  }
  body.gl-brand-2026 .glpm .glpm-primary span {
    color: var(--gs-x-popup-button_text,var(--gs-color-on-action)) !important;
  }
  body.gl-brand-2026 .glpm .glpm-message {
    background:var(--gs-x-popup-bg,var(--gs-color-surface)) !important;
    border-color: var(--gs-x-popup-border,var(--gs-color-border)) !important;
    color:var(--gs-x-popup-text,var(--gs-color-text-body)) !important;
  }
  body.gl-brand-2026 .glpm .glpm-message[data-kind=success] {
    border-color:var(--gs-x-popup-success,var(--gs-color-success)) !important;
  
  color:var(--gs-x-popup-success,var(--gs-color-success)) !important;
  background:var(--gs-x-popup-success_bg,var(--gs-color-success-bg)) !important;}
  body.gl-brand-2026 .glpm .glpm-message a {
    color: var(--gs-x-popup-link,var(--gs-color-text-body)) !important;
  }
  body.gl-brand-2026 .glpm :is(button,a):focus-visible {
    outline: 2px solid var(--gs-x-popup-focus,var(--gs-color-focus)) !important;
    outline-offset: 2px;
  }
}
/* Match the existing checkout ID so the action label stays high contrast. */
@layer gamespsn-brand {
  body.gl-brand-2026 .glpm a#glpm-checkout.glpm-primary,
body.gl-brand-2026 .glpm a#glpm-checkout.glpm-primary span {
    color: var(--gs-x-popup-button_text,var(--gs-color-on-action)) !important;
  }
}
/* One secondary action authority: browse, continue, view cart and gift alternatives. */
@layer gamespsn-brand {
  body.gl-brand-2026 .glpm .glpm-footer .glpm-actions a.glpm-secondary,
body.gl-brand-2026 .glpm .glpm-footer .glpm-actions button.glpm-secondary,
body.gl-brand-2026 .glpm .glpm-promo button.glpm-more,
body.gl-brand-2026 .glpm .glpm-promo button.glpm-first {
    background: var(--gs-x-popup-secondary_bg,var(--gl-secondary-button-bg,var(--gs-color-action-secondary-bg))) !important;
    color: var(--gs-x-popup-secondary_text,var(--gs-color-on-action-secondary)) !important;
    border: 1px solid var(--gs-x-popup-secondary_border,var(--gs-color-action-secondary-border)) !important;
    box-shadow: none !important;
    text-decoration: none !important;
  }
  body.gl-brand-2026 .glpm :is(.glpm-more,.glpm-first,.glpm-secondary):hover:not(:disabled) {
    --gl-secondary-button-bg: var(--gs-color-action-secondary-hover);
  }
  body.gl-brand-2026 .glpm :is(.glpm-more,.glpm-first,.glpm-secondary,.glpm-option button[data-glpm-action=choose],.glpm-option button[data-glpm-action=add]):active:not(:disabled) {
    --gl-secondary-button-bg: var(--gs-color-action-secondary-pressed);
  }
}
