body.titan-purchase-open { overflow: hidden !important; }
/* Purchase dialogs are shared by desktop and mobile; they must not depend on
   the desktop-only replica-home sheet. */
#contents[data-replica-page="shop"] { --purchase-accent: #f64b87; }

/* Shop cards use the legacy replica sheet for their base appearance. That
   sheet reserves a fixed height and positions the purchase link at the bottom,
   which lets a wrapped product name or VAT label sit underneath the link on a
   narrow screen. Keep the two/three-column grid, but make every card a normal
   column flow so its height follows its content and the action stays below the
   price. */
#contents[data-replica-page="shop"] .flex-con > ul {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 20px !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  list-style: none;
}

/* Keep product copy and the purchase action in normal document flow. The
   legacy card rules used fixed heights and absolute actions, which caused
   wrapped Korean names and VAT labels to sit underneath the button. */
#contents[data-replica-page="shop"] .flex-con > ul > li.replica-product-card {
  float: none !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  justify-content: flex-start !important;
  width: auto !important;
  height: auto !important;
  min-height: 305px;
  min-width: 0;
  margin: 0 !important;
  padding: 18px !important;
  box-sizing: border-box;
  overflow: visible !important;
}
#contents[data-replica-page="shop"] .replica-product-card > p {
  flex: 0 0 auto;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}
#contents[data-replica-page="shop"] .replica-product-card > p.replica-product-media {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 96px;
  margin: 0 0 12px !important;
}
#contents[data-replica-page="shop"] .replica-product-card > p.replica-product-media img,
#contents[data-replica-page="shop"] .replica-product-card > p.replica-product-media .replica-product-symbol {
  display: block;
  flex: 0 0 auto;
  width: 96px !important;
  height: 96px !important;
  max-width: 100%;
  object-fit: contain;
}
#contents[data-replica-page="shop"] .replica-product-card > p.replica-product-name {
  min-height: 3.5em;
  margin: 0 0 8px !important;
  line-height: 1.75rem !important;
  text-align: center;
}
#contents[data-replica-page="shop"] .replica-product-card > p.replica-product-price {
  display: flex;
  align-items: baseline;
  justify-content: center;
  flex-wrap: wrap;
  gap: 3px 6px;
  min-height: 1.75em;
  margin: 0 0 14px !important;
  line-height: 1.5rem !important;
  text-align: center;
}
#contents[data-replica-page="shop"] .replica-product-card > a.replica-product-action {
  position: static !important;
  inset: auto !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 100% !important;
  min-height: 40px;
  height: auto !important;
  margin: auto 0 0 !important;
  padding: 8px 10px !important;
  box-sizing: border-box;
  line-height: 1.35 !important;
  white-space: normal;
  overflow-wrap: anywhere;
}
#contents[data-replica-page="shop"] .flex-popup,
#contents[data-replica-page="shop"] .flex-popup * { box-sizing: border-box; }
#contents[data-replica-page="shop"] .flex-popup {
  position: fixed; inset: 0; z-index: 10020; width: 100%; height: 100%;
  align-items: center; justify-content: center; margin: 0;
  padding: 24px; overflow: hidden; background: rgba(0,0,0,.69) !important;
}
#contents[data-replica-page="shop"] .flex-popup-con {
  position: relative; flex: 0 1 auto; width: min(100%,500px) !important;
  max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px);
  margin: 0 !important; padding: 0 !important; overflow-x: hidden; overflow-y: auto;
  overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  border: 0; border-radius: 12px; background: #fff !important;
  color: #202124 !important; box-shadow: 0 16px 55px rgba(0,0,0,.12) !important;
}
#contents[data-replica-page="shop"] .flex-popup .f-header {
  position: relative; display: flex; align-items: center; min-height: 64px;
  margin: 0; padding: 22px 24px 16px; border: 0 !important;
  color: #151515 !important; background: #fff; font-size: 16px; font-weight: 700; line-height: 24px;
}
#contents[data-replica-page="shop"] .flex-popup .close {
  position: absolute; display: flex; align-items: center; justify-content: center;
  top: 14px; right: 16px; width: 44px; height: 44px; margin: 0; padding: 0;
  color: #a4a4a4 !important; background: transparent; border: 0;
  font: 300 34px/1 Arial,sans-serif; cursor: pointer;
}
#contents[data-replica-page="shop"] .flex-popup main { margin: 0; padding: 0; background: #fff; }
#contents[data-replica-page="shop"] .flex-popup .modal-content-padding {
  margin: 0; padding: 26px 40px 32px; background: #fff !important;
  color: #333 !important; border: 0; box-shadow: none !important;
}
#contents[data-replica-page="shop"] #purchaseTypeModal .modal-content-padding { padding-top: 30px; padding-bottom: 38px; }
#contents[data-replica-page="shop"] .flex-popup .modal-title {
  margin: 0 0 24px !important; padding: 0; text-align: center;
  color: #292929 !important; font-size: 21px; line-height: 28px; font-weight: 600; letter-spacing: -.7px;
}
#contents[data-replica-page="shop"] .flex-popup .modal-button-gradient {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 60px; margin: 0; padding: 16px 42px;
  border: 0 !important; border-radius: 12px; color: #fff !important;
  background: linear-gradient(110deg,#ff4888 0%,#ef4582 60%,#d73570 100%) !important;
  box-shadow: 0 6px 16px rgba(243,70,128,.23) !important;
  font: inherit; font-size: 19px; font-weight: 700; line-height: 26px; cursor: pointer;
}
#contents[data-replica-page="shop"] .flex-popup .modal-button-gradient svg {
  display: block; flex: 0 0 24px; width: 24px !important; height: 24px !important;
  max-width: 24px !important; max-height: 24px !important; margin: 0; fill: currentColor !important;
}
#contents[data-replica-page="shop"] .flex-popup .modal-button-gradient .arrow { position: absolute; right: 17px; color: rgba(255,255,255,.65); font-size: 30px; font-weight: 400; }
#contents[data-replica-page="shop"] .flex-popup .modal-button-gradient:disabled { opacity: .55; cursor: wait; }
#contents[data-replica-page="shop"] #purchaseTypeModal .modal-content-padding > p { margin: 20px 0 0 !important; color: #999 !important; font-size: 13px !important; font-weight: 400; line-height: 1.6 !important; text-align: center; }
#contents[data-replica-page="shop"] .flex-popup .modal-bank-card { margin: 0 0 22px; padding: 16px; border: 0; border-radius: 12px; background: linear-gradient(120deg,#f6f5fa,#e9edf7) !important; box-shadow: 0 3px 12px rgba(42,51,77,.05) !important; }
#contents[data-replica-page="shop"] .flex-popup .modal-bank-title { display: flex; align-items: center; gap: 6px; margin: 0 0 12px; padding: 0; color: var(--purchase-accent) !important; font-size: 15px; font-weight: 700; line-height: 20px; }
#contents[data-replica-page="shop"] .flex-popup .modal-bank-title svg { display: block; flex: 0 0 18px; width: 18px !important; height: 18px !important; max-width: 18px; max-height: 18px; margin: 0; fill: currentColor !important; }
#contents[data-replica-page="shop"] .flex-popup .modal-bank-info { padding: 12px; border: 0; border-radius: 8px; background: #fff !important; box-shadow: none !important; }
#contents[data-replica-page="shop"] .flex-popup .modal-bank-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin: 0 0 9px; padding: 0; border: 0; line-height: 19px; }
#contents[data-replica-page="shop"] .flex-popup .modal-bank-row:last-child { margin-bottom: 0; }
#contents[data-replica-page="shop"] .flex-popup .modal-bank-label { flex: 0 0 auto; color: #8a8a8a !important; font-size: 13px; font-weight: 400; }
#contents[data-replica-page="shop"] .flex-popup .modal-bank-value { min-width: 0; color: #333 !important; font-size: 13px; font-weight: 600; text-align: right; overflow-wrap: anywhere; }
#contents[data-replica-page="shop"] .flex-popup .modal-bank-value.primary { color: var(--purchase-accent) !important; }
#contents[data-replica-page="shop"] .flex-popup .modal-input-wrapper { margin: 0 0 20px; }
#contents[data-replica-page="shop"] .flex-popup .modal-input-group { margin: 0 0 14px; }
#contents[data-replica-page="shop"] .flex-popup .modal-input-label { display: flex; align-items: center; gap: 6px; margin: 0 0 6px; padding: 0; color: #555 !important; font-size: 13px; font-weight: 500; line-height: 20px; }
#contents[data-replica-page="shop"] .flex-popup .modal-input-label svg { display: block; flex: 0 0 14px; width: 14px !important; height: 14px !important; max-width: 14px; max-height: 14px; margin: 0; fill: var(--purchase-accent) !important; }
#contents[data-replica-page="shop"] .flex-popup .modal-input { display: block; width: 100%; height: 42px; min-height: 42px; margin: 0; padding: 8px 11px; border: 2px solid #e0e0e0 !important; border-radius: 8px; background: #fff !important; color: #333 !important; font: inherit; font-size: 16px !important; line-height: 22px; }
#contents[data-replica-page="shop"] .flex-popup .modal-input::placeholder { color: #aaa; font-size: 13px; opacity: 1; }
#contents[data-replica-page="shop"] .flex-popup .modal-input:focus { outline: none; border-color: var(--purchase-accent) !important; box-shadow: 0 0 0 2px rgba(246,75,135,.09); }
#contents[data-replica-page="shop"] .flex-popup .modal-purchase-info { margin: 0 0 16px; padding: 16px 14px; border: 0; border-radius: 12px; background: #f8f9fb !important; box-shadow: none !important; }
#contents[data-replica-page="shop"] .flex-popup .modal-purchase-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 12px; padding: 0; border: 0; line-height: 22px; }
#contents[data-replica-page="shop"] .flex-popup .modal-purchase-row:last-child { margin-bottom: 0; }
#contents[data-replica-page="shop"] .flex-popup .modal-purchase-row.bordered { padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px dashed #d8d8d8; }
#contents[data-replica-page="shop"] .flex-popup .modal-purchase-label { color: #666 !important; font-size: 13px; }
#contents[data-replica-page="shop"] .flex-popup .modal-purchase-value { min-width: 0; overflow-wrap: anywhere; color: #333 !important; font-size: 14px; font-weight: 500; }
#contents[data-replica-page="shop"] .flex-popup .modal-purchase-total { padding: 0; background: transparent !important; color: var(--purchase-accent) !important; font-size: 14px; font-weight: 700; }
#contents[data-replica-page="shop"] .flex-popup .modal-purchase-note { margin-top: 2px; color: #999 !important; font-size: 12px; line-height: 18px; }
#contents[data-replica-page="shop"] .flex-popup .modal-purchase-total-value { color: var(--purchase-accent) !important; font-size: 21px; font-weight: 700; line-height: 26px; text-align: right; white-space: nowrap; }
#contents[data-replica-page="shop"] .flex-popup .modal-warning-box { margin: 0 0 18px; padding: 12px; border: 0; border-left: 4px solid #f4c324 !important; border-radius: 8px; background: #fff9e8 !important; color: #806318 !important; font-size: 12px; line-height: 1.8; }
#contents[data-replica-page="shop"] .flex-popup .modal-warning-box p { margin: 0 0 4px; color: #806318 !important; line-height: 20px; }
#contents[data-replica-page="shop"] .flex-popup .modal-warning-box strong { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; }
#contents[data-replica-page="shop"] .flex-popup .modal-warning-box svg { display: block; flex: 0 0 13px; width: 13px !important; height: 13px !important; max-width: 13px; max-height: 13px; fill: #f4c324 !important; }
#contents[data-replica-page="shop"] .flex-popup .modal-warning-box ul { padding-left: 15px !important; color: #806318 !important; font-size: 12px !important; }
#contents[data-replica-page="shop"] .flex-popup #buyflex { min-height: 52px; padding: 12px 20px; font-size: 16px; }
#contents[data-replica-page="shop"] .flex-con > ul > li > a { border: 0 !important; border-radius: 8px; background: var(--purchase-accent) !important; color: #fff !important; }
#contents[data-replica-page="shop"] .flex-popup [role="button"]:focus-visible,
#contents[data-replica-page="shop"] .flex-popup button:focus-visible { outline: 2px solid #df3470; outline-offset: 3px; }

@media (max-width:768px) {
  #contents[data-replica-page="shop"] .flex-con > ul {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }
  #contents[data-replica-page="shop"] .flex-con > ul > li.replica-product-card {
    min-height: 0;
    padding: 12px 9px !important;
  }
  #contents[data-replica-page="shop"] .replica-product-card > p.replica-product-media {
    min-height: 72px;
    margin-bottom: 9px !important;
  }
  #contents[data-replica-page="shop"] .replica-product-card > p.replica-product-media img,
  #contents[data-replica-page="shop"] .replica-product-card > p.replica-product-media .replica-product-symbol {
    width: 72px !important;
    height: 72px !important;
  }
  #contents[data-replica-page="shop"] .replica-product-card > p.replica-product-name {
    min-height: 0;
    margin-bottom: 7px !important;
    font-size: clamp(12px, 3.45vw, 15px) !important;
    line-height: 1.45 !important;
  }
  #contents[data-replica-page="shop"] .replica-product-card > p.replica-product-price {
    min-height: 0;
    margin-bottom: 10px !important;
    font-size: clamp(12px, 3.35vw, 15px) !important;
    line-height: 1.35 !important;
  }
  #contents[data-replica-page="shop"] .replica-product-card > a.replica-product-action {
    min-height: 40px;
    padding: 8px 5px !important;
    font-size: clamp(12px, 3.5vw, 15px) !important;
  }
}
@media (max-width:768px) {
  #contents[data-replica-page="shop"] .flex-popup { align-items: flex-start; padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
  #contents[data-replica-page="shop"] .flex-popup-con { width: 100% !important; max-width: 500px !important; max-height: calc(100vh - env(safe-area-inset-top) - env(safe-area-inset-bottom)); max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom)); border-radius: 10px; }
  #contents[data-replica-page="shop"] .flex-popup .f-header { padding-left: 22px; font-size: 14px; }
  #contents[data-replica-page="shop"] .flex-popup .modal-content-padding { padding-left: clamp(20px,10vw,40px); padding-right: clamp(20px,10vw,40px); }
  #contents[data-replica-page="shop"] .flex-popup .modal-title { font-size: 19px; }
  #contents[data-replica-page="shop"] .flex-popup .modal-button-gradient { font-size: 18px; }
}
@media (max-width:359px) {
  #contents[data-replica-page="shop"] .flex-popup .modal-content-padding { padding-left: 22px; padding-right: 22px; }
  #contents[data-replica-page="shop"] .flex-popup .modal-bank-card { padding: 13px; }
  #contents[data-replica-page="shop"] .flex-popup .modal-purchase-total-value { font-size: 18px; }
}

/* Balance purchase confirmation uses the same bounded modal layout as deposits. */
#contents[data-replica-page="shop"] .replica-point-mode { margin-left: 10px; font-weight: 400; }
#contents[data-replica-page="shop"] .replica-point-mode.is-decrease { color: #a36363 !important; }
#contents[data-replica-page="shop"] .replica-point-mode.is-increase { color: #4f9076 !important; }
#contents[data-replica-page="shop"] #levelConfirmModal .modal-icon-large { display: flex; justify-content: center; margin-bottom: 14px; }
#contents[data-replica-page="shop"] #levelConfirmModal .modal-icon-large svg { width: 48px !important; height: 48px !important; fill: var(--purchase-accent); }
#contents[data-replica-page="shop"] #levelConfirmModal .modal-subtitle { margin: 10px 0 0; color: #888; font-size: 13px; line-height: 1.5; }
#contents[data-replica-page="shop"] #levelConfirmModal .modal-info-card { background: #f7f8fb; border-radius: 12px; padding: 18px; margin-bottom: 18px; }
#contents[data-replica-page="shop"] #levelConfirmModal .modal-info-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; }
#contents[data-replica-page="shop"] #levelConfirmModal .modal-info-item + .modal-info-item { border-top: 1px dashed #ddd; }
#contents[data-replica-page="shop"] #levelConfirmModal .modal-info-icon { display: flex; align-items: center; margin-right: 8px; color: var(--purchase-accent); }
#contents[data-replica-page="shop"] #levelConfirmModal .modal-info-icon svg { width: 20px !important; height: 20px !important; fill: currentColor; }
#contents[data-replica-page="shop"] #levelConfirmModal .modal-info-value-wrapper { white-space: nowrap; }
#contents[data-replica-page="shop"] #levelConfirmModal .modal-info-value { font-weight: 700; }
#contents[data-replica-page="shop"] #levelConfirmModal .modal-info-value.secondary { color: var(--purchase-accent); }
