/* Customer controls: restrained bevels and a short, physical press.
   Layer order in index.html keeps authentication visibility above this layer.
   Existing faces, decorative borders, dimensions and layout stay in their theme. */
@layer tactile-controls {
  /* These are page grids now, not the old horizontal game shelf. Let a
     vertical swipe start on either a card or the empty space around it. */
  body[data-page="home"] #app :is(
    #games-section, #all-games-section, .royal-catalog-window,
    #v-games, #all-games-list
  ),
  body[data-page="home"] #app :is(#v-games, #all-games-list) :is(.game-card, .game-hub-open) {
    touch-action: pan-y pinch-zoom !important;
  }

  body[data-page="home"] #app :is(#v-games, #all-games-list) {
    overflow: visible !important;
    scroll-snap-type: none !important;
    scroll-padding: 0 !important;
    overscroll-behavior: auto !important;
    overscroll-behavior-inline: auto !important;
  }

  body[data-page="home"] #app :is(#v-games, #all-games-list) > .game-card {
    scroll-snap-align: none !important;
  }

  body[data-page="home"] :is(button, a, [role="button"], summary) {
    -webkit-tap-highlight-color: transparent !important;
  }

  body[data-page="home"] :is(button, a, [role="button"], summary):focus:not(:focus-visible) {
    outline: none !important;
  }

  body[data-page="home"] :is(
    .royal-button, .royal-hero-enter, .home-eligibility-button,
    .promo-eligibility-button, .landing-sign-up, .landing-userid-button,
    .game-card-main, .all-game-catalog-card, .game-hub-action,
    .score-submit, .reference-primary-button,
    .request-edit-button:not(.account-help-back), .context-guide-button,
    .account-help-action, .customer-profile-tab-button,
    .auth-provider-button:not(.google),
    .customer-utility-card, .casino-profile-tab
  ):not(:disabled):not([aria-disabled="true"]) {
    --tactile-y: 0px;
    --tactile-scale: 1;
    --tactile-depth-color: #170820;
    --tactile-light: rgba(255, 242, 255, .24);
    --tactile-rest-shadow:
      inset 0 1px 0 var(--tactile-light),
      inset 0 -2px 3px rgba(10, 0, 20, .25),
      0 4px 0 var(--tactile-depth-color),
      0 9px 15px rgba(5, 0, 12, .28);
    --tactile-pressed-shadow:
      inset 0 2px 5px rgba(10, 0, 20, .3),
      inset 0 -1px 0 rgba(255, 255, 255, .1),
      0 1px 0 var(--tactile-depth-color),
      0 3px 6px rgba(5, 0, 12, .22);
    --tactile-current-shadow: var(--tactile-rest-shadow);
    transform: translateY(var(--tactile-y)) scale(var(--tactile-scale)) !important;
    transform-origin: center !important;
    box-shadow: var(--tactile-current-shadow) !important;
    filter: none !important;
    transition: transform 150ms cubic-bezier(.2, .8, .25, 1),
      box-shadow 150ms ease !important;
    -webkit-tap-highlight-color: transparent !important;
    /* Pointer/touch feedback is depth, never an extra outline. */
    outline: none !important;
  }

  body[data-page="home"] :is(
    .royal-button, .royal-hero-enter, .home-eligibility-button,
    .promo-eligibility-button, .landing-sign-up, .landing-userid-button,
    .game-card-main, .all-game-catalog-card, .game-hub-action,
    .score-submit, .reference-primary-button,
    .request-edit-button:not(.account-help-back), .context-guide-button,
    .account-help-action, .customer-profile-tab-button,
    .auth-provider-button:not(.google),
    .customer-utility-card, .casino-profile-tab
  ):not(:disabled):not([aria-disabled="true"]):is(:active,[data-tactile-pressed]) {
    --tactile-y: 3px;
    --tactile-scale: .985;
    --tactile-current-shadow: var(--tactile-pressed-shadow);
    transition-duration: 65ms !important;
  }

  /* Gold and blue retain their existing faces, with matching edge depth. */
  body[data-page="home"] :is(
    .royal-button, .royal-hero-enter, .home-eligibility-button,
    .promo-eligibility-button, .landing-sign-up, .context-guide-button,
    .reference-primary-button, .ldr-confirm-gold, .customer-wallet-card,
    .ldr-v82-action-play, .ldr-v82-action-free
  ):not(:disabled):not([aria-disabled="true"]) {
    --tactile-depth-color: #67400e;
    --tactile-light: rgba(255, 247, 205, .45);
  }

  body[data-page="home"] :is(
    .customer-chat-card, .ldr-v82-action-download, .ldr-v82-action-logins
  ):not(:disabled):not([aria-disabled="true"]) {
    --tactile-depth-color: #082d48;
    --tactile-light: rgba(213, 245, 255, .35);
  }

  body[data-page="home"] :is(.ldr-confirm-green, .ldr-v82-action-score):not(:disabled) {
    --tactile-depth-color: #093c26;
  }

  body[data-page="home"] :is(.ldr-confirm-red, .ldr-v82-action-withdraw):not(:disabled) {
    --tactile-depth-color: #4e1425;
  }

  /* The Profile control's visible face is its circular icon, not its hit area. */
  body[data-page="home"] .casino-profile-tab:not(:disabled):not([aria-disabled="true"]) {
    box-shadow: none !important;
  }

  body[data-page="home"] .casino-profile-tab:not(:disabled):not([aria-disabled="true"]) .nav-icon {
    box-shadow: var(--tactile-current-shadow), 0 0 15px rgba(181, 63, 237, .26) !important;
    transition: box-shadow 150ms ease !important;
  }

  body[data-page="home"] .casino-profile-tab:not(:disabled):not([aria-disabled="true"]):is(:active,[data-tactile-pressed]) .nav-icon {
    transition-duration: 65ms !important;
  }

  /* Move each card once, including its shell. The transparent inner button
     must not acquire a second raised face or a second transform. */
  body[data-page="home"] #v-games > .game-card {
    transform: none !important;
    filter: none !important;
    border-color: rgba(209, 103, 255, .72) !important;
    box-shadow: inset 0 1px rgba(255, 255, 255, .18),
      inset 0 -3px 6px rgba(5, 0, 10, .56),
      0 4px 0 #0b0210, 0 8px 15px rgba(0, 0, 0, .42),
      0 0 13px rgba(199, 68, 246, .3) !important;
  }

  body[data-page="home"] #v-games > .game-card > .game-card-main {
    transform: none !important;
    box-shadow: none !important;
  }

  body[data-page="home"] #v-games > .game-card:has(> .game-card-main:not(:disabled):not([aria-disabled="true"]):is(:active,[data-tactile-pressed])) {
    transform: translateY(3px) scale(.985) !important;
    box-shadow: inset 0 2px 5px rgba(5, 0, 10, .35),
      0 1px 0 #0b0210, 0 3px 6px rgba(0, 0, 0, .3),
      0 0 13px rgba(199, 68, 246, .3) !important;
    transition-duration: 65ms !important;
  }

  body[data-page="home"] .all-game-catalog-card {
    border-color: rgba(118, 80, 137, .72) !important;
  }

  /* Keyboard users keep a visible focus marker; pointer focus has none. */
  body[data-page="home"] :is(
    .royal-button, .royal-hero-enter, .home-eligibility-button,
    .promo-eligibility-button, .landing-sign-up, .landing-userid-button,
    .game-card-main, .all-game-catalog-card, .game-hub-action,
    .score-submit, .reference-primary-button,
    .request-edit-button:not(.account-help-back), .context-guide-button,
    .account-help-action, .customer-profile-tab-button,
    .auth-provider-button:not(.google),
    .customer-utility-card, .casino-profile-tab
  ):not(:disabled):not([aria-disabled="true"]):focus-visible {
    outline: 2px solid #fff1aa !important;
    outline-offset: 3px !important;
  }

  @media (hover: hover) and (pointer: fine) {
    body[data-page="home"] :is(
      .royal-button, .royal-hero-enter, .home-eligibility-button,
      .promo-eligibility-button, .landing-sign-up, .landing-userid-button,
      .game-card-main, .all-game-catalog-card, .game-hub-action,
      .score-submit, .reference-primary-button,
      .request-edit-button:not(.account-help-back), .context-guide-button,
      .account-help-action, .customer-profile-tab-button,
      .auth-provider-button:not(.google),
      .customer-utility-card, .casino-profile-tab
    ):not(:disabled):not([aria-disabled="true"]):hover:not(:is(:active,[data-tactile-pressed])) {
      --tactile-light: rgba(255, 248, 255, .4);
    }
  }

  /* Disable inherited hover brightness on touch; a tap must release cleanly. */
  @media (hover: none) {
    body[data-page="home"] .all-game-catalog-card:not(:disabled):not([aria-disabled="true"]) {
      background: #14091b !important;
    }
  }

  @media (prefers-reduced-motion: reduce) {
    body[data-page="home"] :is(
      .royal-button, .royal-hero-enter, .home-eligibility-button,
      .promo-eligibility-button, .landing-sign-up, .landing-userid-button,
      .game-card-main, .all-game-catalog-card, .game-hub-action,
      .score-submit, .reference-primary-button,
      .request-edit-button:not(.account-help-back), .context-guide-button,
      .account-help-action, .customer-profile-tab-button,
      .auth-provider-button:not(.google),
      .customer-utility-card, .casino-profile-tab
    ):not(:disabled):not([aria-disabled="true"]) {
      transform: none !important;
      transition: none !important;
    }

    body[data-page="home"] .casino-profile-tab .nav-icon {
      transition: none !important;
    }

    body[data-page="home"] #v-games > .game-card,
    body[data-page="home"] #v-games > .game-card:has(> .game-card-main:is(:active,[data-tactile-pressed])) {
      transform: none !important;
      transition: none !important;
    }
  }
}
