/* Members profile popup patch only. Other page styles remain in /styles.css. */

html.member-modal-open,
body.member-modal-open {
  overflow: hidden !important;
  overscroll-behavior: none;
}

.member-modal-stage.profile-stage,
.member-modal-stage.profile-stage.is-open {
  position: fixed !important;
  inset: 0 !important;
  z-index: 1000 !important;
  width: 100% !important;
  max-width: none !important;
  max-height: none !important;
  height: 100dvh !important;
  margin: 0 !important;
  padding: max(18px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left)) !important;
  overflow: hidden !important;
  opacity: 0;
  visibility: hidden;
  display: grid !important;
  place-items: center;
  transition: opacity .24s ease, visibility .24s ease !important;
}

.member-modal-stage.profile-stage.is-open {
  opacity: 1;
  visibility: visible;
}

.member-modal-stage[hidden] {
  display: none !important;
}

.member-modal-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 42%, rgba(97, 18, 31, .24), transparent 38%),
    rgba(8, 7, 9, .72);
  -webkit-backdrop-filter: blur(10px) saturate(.82);
  backdrop-filter: blur(10px) saturate(.82);
  cursor: zoom-out;
}

.member-modal-shell {
  position: relative;
  z-index: 1;
  width: min(1120px, calc(100vw - 32px));
  height: min(720px, calc(100dvh - 42px));
  display: grid;
  grid-template-columns: 82px minmax(0, 900px) 82px;
  align-items: center;
  justify-content: center;
  gap: 16px;
  pointer-events: none;
}

.member-modal-card-slot {
  min-width: 0;
  max-height: 100%;
  display: grid;
  place-items: center;
  pointer-events: auto;
  touch-action: pan-y;
  perspective: 1200px;
}

.member-modal-card.profile-card {
  width: min(860px, 100%) !important;
  max-height: min(650px, calc(100dvh - 64px));
  margin: 0 !important;
  overflow: hidden;
  box-shadow:
    0 42px 120px rgba(0, 0, 0, .56),
    0 0 0 1px rgba(244, 221, 165, .22),
    0 0 70px rgba(170, 18, 40, .13) !important;
  transform: translate3d(0, 0, 0) scale(1);
  opacity: 1;
  transition: transform .3s cubic-bezier(.2,.75,.2,1), opacity .23s ease !important;
}

.member-modal-stage:not(.is-open) .member-modal-card {
  transform: translateY(16px) scale(.965);
  opacity: 0;
}

.member-modal-card.member-card-enter-right {
  transform: translate3d(46px, 0, -30px) rotateY(-4deg) !important;
  opacity: 0 !important;
}

.member-modal-card.member-card-enter-left {
  transform: translate3d(-46px, 0, -30px) rotateY(4deg) !important;
  opacity: 0 !important;
}

.member-modal-close.profile-close {
  top: 14px !important;
  right: 14px !important;
  width: 40px !important;
  height: 40px !important;
  border: 1px solid rgba(233, 209, 152, .55) !important;
  background:
    radial-gradient(circle at 35% 30%, rgba(255,255,255,.15), transparent 30%),
    linear-gradient(145deg, rgba(45,36,28,.94), rgba(9,8,10,.94)) !important;
  box-shadow: 0 8px 24px rgba(0,0,0,.3), inset 0 0 0 1px rgba(255,255,255,.06);
  color: #ead8a9 !important;
  font-family: Georgia, 'Times New Roman', serif;
  transition: transform .18s ease, border-color .18s ease, color .18s ease;
}

.member-modal-close:hover,
.member-modal-close:focus-visible {
  transform: rotate(8deg) scale(1.06);
  border-color: #e4c77e !important;
  color: #fff0c1 !important;
  outline: none;
}

/* プロフィール内の実績切り替え */
.profile-results-tabs {
  min-width: 0;
  margin-top: 20px;
}

.profile-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(226, 207, 161, .28);
  border-radius: 12px;
  background: rgba(255, 255, 255, .045);
}

.profile-tab {
  min-height: 42px;
  padding: 8px 12px;
  border: 0;
  border-radius: 8px;
  color: rgba(255, 255, 255, .58);
  background: transparent;
  font: inherit;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .03em;
  cursor: pointer;
  transition: color .18s ease, background .18s ease, box-shadow .18s ease;
}

.profile-tab:hover {
  color: rgba(255, 255, 255, .88);
}

.profile-tab.is-active {
  color: #fff5dc;
  background: linear-gradient(135deg, rgba(121, 18, 31, .96), rgba(184, 27, 45, .9));
  box-shadow:
    inset 0 0 0 1px rgba(240, 214, 149, .38),
    0 5px 14px rgba(80, 5, 17, .28);
}

.profile-tab:focus-visible {
  outline: 2px solid #e8cb82;
  outline-offset: 2px;
}

.profile-tab-panels {
  min-height: 154px;
}

.profile-tab-panel {
  max-height: 235px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(213, 179, 101, .5) transparent;
}

.profile-tab-panel[hidden] {
  display: none !important;
}

.profile-tab-panel .profile-results {
  margin-top: 10px;
}

.profile-tab-panel .profile-results li:last-child {
  border-bottom: 0;
}

.member-modal-arrow {
  position: relative;
  width: 74px;
  height: 112px;
  padding: 0;
  border: 0;
  display: grid;
  place-items: center;
  pointer-events: auto;
  cursor: pointer;
  background: transparent;
  filter: drop-shadow(0 9px 15px rgba(0,0,0,.5));
  transition: transform .2s ease, filter .2s ease;
}

/* SVG/文字矢印は使わず、アンティーク調の二重三角で表示 */
.member-modal-arrow svg { display: none !important; }
.member-modal-arrow::before,
.member-modal-arrow::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 0;
  height: 0;
  transform: translateY(-50%);
  transition: filter .18s ease, transform .18s ease;
}
.member-modal-arrow::before {
  border-top: 18px solid transparent;
  border-bottom: 18px solid transparent;
}
.member-modal-arrow::after {
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
}
.member-modal-arrow-prev::before { border-right: 25px solid #b58e42; }
.member-modal-arrow-prev::after  { border-right: 14px solid #f0d695; transform: translate(4px,-50%); }
.member-modal-arrow-next::before { border-left: 25px solid #b58e42; }
.member-modal-arrow-next::after  { border-left: 14px solid #f0d695; transform: translate(-4px,-50%); }
.member-modal-arrow:hover,
.member-modal-arrow:focus-visible {
  transform: scale(1.10);
  filter: drop-shadow(0 9px 17px rgba(0,0,0,.55)) drop-shadow(0 0 12px rgba(213,176,90,.25));
  outline: none;
}
.member-modal-arrow:active { transform: scale(.94); }

/* スマホのSWIPE文字を三角インジケータへ */
.member-modal-swipe-hint {
  display: none;
  font-size: 0 !important;
  width: 52px;
  height: 14px;
  pointer-events: none;
}
.member-modal-swipe-hint::before,
.member-modal-swipe-hint::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 0;
  height: 0;
  transform: translateY(-50%);
  opacity: .62;
}
.member-modal-swipe-hint::before {
  left: 2px;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-right: 8px solid #d8bd7a;
}
.member-modal-swipe-hint::after {
  right: 2px;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 8px solid #d8bd7a;
}

@media (max-width: 760px) {
  .member-modal-stage.profile-stage,
  .member-modal-stage.profile-stage.is-open {
    padding: max(12px, env(safe-area-inset-top)) 10px max(12px, env(safe-area-inset-bottom)) !important;
  }

  .member-modal-shell {
    width: 100%;
    height: 100%;
    grid-template-columns: 1fr;
    place-items: center;
  }

  .member-modal-card-slot {
    width: 100%;
    max-height: calc(100dvh - 38px);
  }

  .member-modal-card.profile-card {
    width: min(92vw, 430px) !important;
    max-height: calc(100dvh - 42px) !important;
    min-height: 0 !important;
    overflow: auto !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .member-modal-card .profile-visual {
    min-height: 230px !important;
  }

  .member-modal-card .profile-avatar {
    width: min(48vw, 190px) !important;
  }

  .member-modal-card .profile-body {
    padding-bottom: 26px !important;
  }

  .profile-results-tabs {
    margin-top: 16px;
  }

  .profile-tab {
    min-height: 44px;
    padding-inline: 8px;
    font-size: 11px;
  }

  .profile-tab-panel {
    max-height: none;
    overflow: visible;
  }

  .member-modal-arrow {
    position: absolute;
    top: 50%;
    z-index: 5;
    width: 48px;
    height: 82px;
    transform: translateY(-50%);
  }

  .member-modal-arrow-prev { left: -2px; }
  .member-modal-arrow-next { right: -2px; }

  .member-modal-arrow:hover,
  .member-modal-arrow:focus-visible {
    transform: translateY(-50%) scale(1.06);
  }


  .member-modal-swipe-hint {
    position: absolute;
    left: 50%;
    bottom: max(5px, env(safe-area-inset-bottom));
    display: block;
    transform: translateX(-50%);
    pointer-events: none;
  }
}

@media (max-width: 390px) {
  .member-modal-card.profile-card {
    width: calc(100vw - 28px) !important;
  }

  .member-modal-arrow-prev { left: -8px; }
  .member-modal-arrow-next { right: -8px; }
}

@media (prefers-reduced-motion: reduce) {
  .member-modal-stage,
  .member-modal-card,
  .member-modal-arrow,
  .member-modal-close {
    transition: none !important;
  }
}
