/* Mobile layout for the membership dialogs (open / upgrade).
   Plan name, duration, strike-through price and benefit note get their own
   rows so long Chinese copy can wrap instead of squeezing the price column. */
/* Deliberately no html/body overflow lock here: the dialog component stays
   mounted in the DOM after it closes, so a :has() page lock would freeze
   scrolling on phones. Only the dialog body scrolls. */
/* Some sites ship an inline "only keep the plan name and price" override that
   hides the membership summary, duration, badge, original price and note.
   Bring those rows back; the layout below is built for the full information. */
.base-dialog:has(.membership-plan-dialog) .membership-plan-dialog__summary {
  display: grid !important;
}

.base-dialog:has(.membership-plan-dialog) .membership-plan-dialog__promotion-guide {
  display: flex !important;
}

.base-dialog:has(.membership-plan-dialog) .membership-plan-dialog__ticket {
  display: inline-flex !important;
}

.base-dialog:has(.membership-plan-dialog) .membership-plan-dialog__duration,
.base-dialog:has(.membership-plan-dialog) .membership-plan-dialog__badge,
.base-dialog:has(.membership-plan-dialog) .membership-plan-dialog__origin,
.base-dialog:has(.membership-plan-dialog) .membership-plan-dialog__note {
  display: revert !important;
}

.base-dialog:has(.membership-upgrade-dialog) .membership-upgrade-dialog__summary {
  display: grid !important;
}

.base-dialog:has(.membership-upgrade-dialog) .membership-upgrade-dialog__daily,
.base-dialog:has(.membership-upgrade-dialog) .membership-upgrade-dialog__badge,
.base-dialog:has(.membership-upgrade-dialog) .membership-upgrade-dialog__note {
  display: revert !important;
}

@media (max-width: 640px) {
  .base-dialog:has(.membership-plan-dialog),
  .base-dialog:has(.membership-upgrade-dialog) {
    overflow: hidden !important;
  }

  .base-dialog:has(.membership-plan-dialog) .base-dialog__wrapper,
  .base-dialog:has(.membership-upgrade-dialog) .base-dialog__wrapper {
    align-items: flex-start !important;
    min-height: 100% !important;
    padding: 12px !important;
  }

  .base-dialog:has(.membership-plan-dialog) .base-dialog__content,
  .base-dialog:has(.membership-upgrade-dialog) .base-dialog__content {
    width: calc(100vw - 24px) !important;
    max-width: 430px !important;
    max-height: calc(100dvh - 24px) !important;
    border-radius: 12px !important;
    overflow: hidden;
  }

  .base-dialog:has(.membership-plan-dialog) .base-dialog__header,
  .base-dialog:has(.membership-upgrade-dialog) .base-dialog__header {
    display: flex !important;
    flex: 0 0 auto;
    align-items: center !important;
    height: 52px !important;
    padding: 0 16px !important;
  }

  .base-dialog:has(.membership-plan-dialog) .base-dialog__body,
  .base-dialog:has(.membership-upgrade-dialog) .base-dialog__body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    padding: 14px 14px 10px !important;
    -webkit-overflow-scrolling: touch;
  }

  .base-dialog:has(.membership-plan-dialog) .base-dialog__footer,
  .base-dialog:has(.membership-upgrade-dialog) .base-dialog__footer {
    flex: 0 0 auto;
    gap: 8px !important;
    padding: 12px 14px !important;
  }

  .base-dialog:has(.membership-plan-dialog) .base-dialog__footer .base-button,
  .base-dialog:has(.membership-upgrade-dialog) .base-dialog__footer .base-button {
    flex: 1 1 0;
    min-width: 0;
    height: 42px;
    padding: 0 12px !important;
  }

  .membership-plan-dialog {
    gap: 10px !important;
  }

  .membership-plan-dialog__summary {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
    padding: 12px !important;
  }

  .membership-plan-dialog__summary-item {
    gap: 4px !important;
    overflow: hidden;
  }

  .membership-plan-dialog__summary-item span {
    font-size: 12px !important;
  }

  .membership-plan-dialog__summary-item strong {
    overflow: hidden;
    font-size: 14px !important;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .membership-plan-dialog__list {
    max-height: none !important;
    gap: 8px !important;
    padding-right: 2px !important;
    overflow-y: visible !important;
  }

  .membership-plan-dialog__plan {
    grid-template-columns: 20px minmax(0, 1fr) auto !important;
    grid-template-rows: auto auto;
    align-items: start !important;
    min-height: 64px !important;
    gap: 4px 8px !important;
    padding: 11px 12px !important;
  }

  .membership-plan-dialog__option-check {
    grid-column: 1;
    grid-row: 1 / span 2;
    align-self: center;
  }

  .membership-plan-dialog__plan-head {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    flex-wrap: wrap;
    gap: 5px !important;
    align-self: center;
  }

  .membership-plan-dialog__plan-name {
    min-width: 0;
    font-size: 14px !important;
  }

  .membership-plan-dialog__badge {
    max-width: none !important;
    padding: 1px 6px !important;
    font-size: 10px !important;
  }

  .membership-plan-dialog__duration {
    grid-column: 2;
    grid-row: 2;
    color: var(--theme-color-subtitle);
    font-size: 12px !important;
    line-height: 1.35 !important;
    white-space: normal !important;
  }

  .membership-plan-dialog__price {
    grid-column: 3;
    grid-row: 1 / span 2;
    align-self: center;
    justify-self: end;
    min-width: 76px;
    text-align: right;
  }

  .membership-plan-dialog__price strong {
    font-size: 18px !important;
  }

  .membership-plan-dialog__origin {
    font-size: 11px !important;
    line-height: 1.3 !important;
  }

  .membership-plan-dialog__ticket,
  .membership-plan-dialog__note {
    grid-column: 2 / -1;
    width: auto !important;
    min-width: 0;
    white-space: normal !important;
  }

  .membership-plan-dialog__ticket {
    grid-row: 3;
  }

  .membership-plan-dialog__note {
    grid-row: 3;
    font-size: 11px !important;
    line-height: 1.45 !important;
  }

  .membership-plan-dialog__ticket + .membership-plan-dialog__note {
    grid-row: 4;
  }

  .membership-plan-dialog__message {
    margin-top: 4px !important;
    font-size: 12px !important;
    line-height: 1.45 !important;
  }

  .membership-upgrade-dialog {
    gap: 10px !important;
  }

  .membership-upgrade-dialog__summary {
    gap: 8px !important;
    padding: 12px !important;
  }

  .membership-upgrade-dialog__summary-item span {
    font-size: 12px !important;
  }

  .membership-upgrade-dialog__summary-item strong {
    overflow: hidden;
    font-size: 14px !important;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .membership-upgrade-dialog__list {
    max-height: none !important;
    overflow-y: visible !important;
  }
}

/* Desktop / laptop layout: widen the dialog, give every plan row stable
   columns and let the whole list show without a nested scrollbar. */
@media (min-width: 641px) {
  .base-dialog:has(.membership-plan-dialog) .base-dialog__wrapper,
  .base-dialog:has(.membership-upgrade-dialog) .base-dialog__wrapper {
    align-items: center !important;
    padding: 24px !important;
  }

  .base-dialog:has(.membership-plan-dialog) .base-dialog__content,
  .base-dialog:has(.membership-upgrade-dialog) .base-dialog__content {
    width: min(720px, calc(100vw - 64px)) !important;
    max-width: min(720px, calc(100vw - 64px)) !important;
    max-height: calc(100vh - 96px) !important;
  }

  .base-dialog:has(.membership-plan-dialog) .base-dialog__body,
  .base-dialog:has(.membership-upgrade-dialog) .base-dialog__body {
    min-height: 0;
    overflow-y: auto !important;
    padding: 20px 24px 14px !important;
  }

  .base-dialog:has(.membership-plan-dialog) .membership-plan-dialog__summary,
  .base-dialog:has(.membership-upgrade-dialog) .membership-upgrade-dialog__summary {
    padding: 14px 16px !important;
  }

  .membership-plan-dialog__list {
    max-height: none !important;
    gap: 10px !important;
    padding-right: 0 !important;
    overflow-y: visible !important;
  }

  .membership-plan-dialog__plan {
    grid-template-columns: 24px minmax(0, 1fr) 96px 132px !important;
    grid-template-rows: auto auto;
    align-items: center !important;
    min-height: 66px !important;
    gap: 2px 16px !important;
    padding: 12px 16px !important;
  }

  .membership-plan-dialog__option-check {
    grid-column: 1;
    grid-row: 1 / span 2;
    align-self: center;
  }

  .membership-plan-dialog__plan-head {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    gap: 6px !important;
  }

  .membership-plan-dialog__plan-name {
    font-size: 15px !important;
  }

  .membership-plan-dialog__badge {
    padding: 1px 7px !important;
    font-size: 11px !important;
  }

  .membership-plan-dialog__duration {
    grid-column: 3;
    grid-row: 1;
    justify-self: center;
    font-size: 13px !important;
    white-space: nowrap !important;
  }

  .membership-plan-dialog__price {
    grid-column: 4;
    grid-row: 1 / span 2;
    align-self: center;
    justify-self: end;
    min-width: 0;
    text-align: right;
  }

  .membership-plan-dialog__price strong {
    font-size: 19px !important;
  }

  .membership-plan-dialog__origin {
    font-size: 12px !important;
  }

  .membership-plan-dialog__ticket,
  .membership-plan-dialog__note {
    grid-column: 2 / 4;
    grid-row: 2;
    min-width: 0;
    font-size: 12px !important;
    line-height: 1.45 !important;
    white-space: normal !important;
  }

  .membership-plan-dialog__ticket + .membership-plan-dialog__note {
    grid-row: 3;
  }

  .membership-plan-dialog__message {
    margin-top: 2px !important;
    font-size: 13px !important;
  }

  .membership-upgrade-dialog__list {
    max-height: none !important;
    overflow-y: visible !important;
  }

  .membership-upgrade-dialog__option {
    grid-template-columns: 24px minmax(0, 1fr) 96px 132px !important;
    grid-template-rows: auto auto;
    align-items: center !important;
    gap: 2px 16px !important;
    padding: 12px 16px !important;
  }

  .membership-upgrade-dialog__option-head {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
  }

  .membership-upgrade-dialog__daily {
    grid-column: 3;
    grid-row: 1;
    justify-self: center;
    white-space: nowrap !important;
  }

  .membership-upgrade-dialog__price {
    grid-column: 4;
    grid-row: 1 / span 2;
    align-self: center;
    justify-self: end;
    min-width: 0;
  }

  .membership-upgrade-dialog__note {
    grid-column: 2 / 4;
    grid-row: 2;
    min-width: 0;
    white-space: normal !important;
  }
}

/* Direct-confirm membership flow: no balance module (2026-10-20). */
.membership-plan-dialog__summary { grid-template-columns: 1fr !important; }
.membership-plan-dialog__summary-item:nth-child(2) { display: none !important; }

/* Hide the balance row on the VIP page (no wallet top-up). */
.vip-page__action-copy[data-v-bfbeaeb6] > .vip-page__action-item[data-v-bfbeaeb6]:nth-child(3) {
  display: none !important;
}
@media (min-width: 768px) {
  .vip-page__action-copy[data-v-bfbeaeb6] {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}
