/*
 * みんなの巨木｜口コミ詳細ビュー v1.4.2
 * 対象: review-slider-fix v2.7 の #mkrf-detail-modal
 * 方針: PCは「写真を大きく見る」＋「口コミを同時に読む」の2カラム。
 *       スマホは1カラムで写真→口コミの順に自然に読む。
 */
html body #mkrf-detail-modal[hidden] { display:none !important; }

html body #mkrf-detail-modal:not([hidden]) {
  box-sizing:border-box !important;
  position:fixed !important;
  inset:auto !important;
  top:var(--mkfit-top,0px) !important;
  left:var(--mkfit-left,0px) !important;
  width:var(--mkfit-vw,100vw) !important;
  height:var(--mkfit-vh,100vh) !important;
  display:flex !important;
  align-items:center !important;
  justify-content:center !important;
  padding:max(10px,env(safe-area-inset-top)) max(10px,env(safe-area-inset-right)) max(10px,env(safe-area-inset-bottom)) max(10px,env(safe-area-inset-left)) !important;
  overflow:hidden !important;
  z-index:2147483646 !important;
  touch-action:pan-y pinch-zoom !important;
}

/* PCでは「小窓」ではなく口コミ閲覧ビューとして使う。 */
html body #mkrf-detail-modal .mkrf-detail-dialog {
  box-sizing:border-box !important;
  position:relative !important;
  width:min(1680px,calc(100vw - 12px)) !important;
  max-width:calc(100vw - 12px) !important;
  min-width:0 !important;
  height:var(--mkfit-dialog-height,97vh) !important;
  min-height:560px !important;
  max-height:calc(var(--mkfit-vh,100vh) - 6px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) !important;
  overflow:hidden !important;
  border-radius:18px !important;
  background:#fff !important;
  box-shadow:0 22px 70px rgba(22,50,31,.24) !important;
}

html body #mkrf-detail-modal .mkrf-detail-inner {
  box-sizing:border-box !important;
  display:block !important;
  width:100% !important;
  height:100% !important;
  min-height:0 !important;
  overflow:hidden !important;
}

/* JSで既存DOMを左右に分ける。イベントはDOM移動なので維持される。 */
html body #mkrf-detail-modal .mkfit-layout {
  box-sizing:border-box !important;
  display:grid !important;
  grid-template-columns:minmax(0,1fr) clamp(350px,25vw,400px) !important;
  width:100% !important;
  height:100% !important;
  min-height:0 !important;
  overflow:hidden !important;
  background:#fff !important;
}

html body #mkrf-detail-modal .mkfit-media-pane {
  box-sizing:border-box !important;
  display:flex !important;
  flex-direction:column !important;
  min-width:0 !important;
  min-height:0 !important;
  height:100% !important;
  padding:6px 6px 8px !important;
  overflow:hidden !important;
  background:#edf3eb !important;
}

html body #mkrf-detail-modal .mkfit-review-pane {
  box-sizing:border-box !important;
  min-width:0 !important;
  min-height:0 !important;
  height:100% !important;
  padding:20px 20px 28px !important;
  overflow-x:hidden !important;
  overflow-y:auto !important;
  overscroll-behavior:contain !important;
  -webkit-overflow-scrolling:touch !important;
  scrollbar-gutter:auto !important;
  background:#fff !important;
  border-left:1px solid #e4ebe2 !important;
}

/* 右ペインの先頭が窮屈にならないよう既存余白を少し整える。 */
html body #mkrf-detail-modal .mkfit-review-pane > :first-child {
  margin-top:0 !important;
}
html body #mkrf-detail-modal .mkfit-review-pane > :last-child {
  margin-bottom:0 !important;
}

/* =========================================================
 * 投稿者プロフィール／評価
 * 狭い横1列に押し込まず、名前と評価を上下に分ける。
 * ========================================================= */
html body #mkrf-detail-modal .mkfit-review-pane .mkrf-detail-head {
  box-sizing:border-box !important;
  display:flex !important;
  flex-direction:column !important;
  align-items:stretch !important;
  justify-content:flex-start !important;
  gap:8px !important;
  width:100% !important;
  min-width:0 !important;
  margin:0 0 18px !important;
  padding:0 0 16px !important;
  border-bottom:1px solid #edf1eb !important;
}

html body #mkrf-detail-modal .mkfit-review-pane .mkrf-detail-head > * {
  box-sizing:border-box !important;
  min-width:0 !important;
  max-width:100% !important;
}

/* 投稿者ブロックは横幅を100%使う。 */
html body #mkrf-detail-modal .mkfit-review-pane .mkrf-detail-head > :first-child {
  width:100% !important;
  flex:0 0 auto !important;
}

/* 評価は名前の右に無理に詰めず、独立した1行にする。 */
html body #mkrf-detail-modal .mkfit-review-pane .mkrf-detail-head > :last-child:not(:first-child) {
  align-self:flex-start !important;
  width:auto !important;
  max-width:100% !important;
  white-space:nowrap !important;
}

/* 英数字のユーザー名を g / on / da のように細切れ改行させない。 */
html body #mkrf-detail-modal .mkfit-review-pane .mkrf-detail-head strong,
html body #mkrf-detail-modal .mkfit-review-pane .mkrf-detail-head b,
html body #mkrf-detail-modal .mkfit-review-pane .mkrf-detail-head a {
  word-break:normal !important;
  overflow-wrap:normal !important;
  white-space:nowrap !important;
}

html body #mkrf-detail-modal .mkfit-review-pane .mkrf-detail-head img {
  flex:0 0 auto !important;
}

/*
 * プロフィール写真は必ず正円。
 * 元UI側の width:100% / 高さ固定などが残っても横長楕円にさせない。
 */
html body #mkrf-detail-modal .mkfit-review-pane .mkfit-author-block {
  box-sizing:border-box !important;
  display:flex !important;
  align-items:center !important;
  justify-content:flex-start !important;
  gap:12px !important;
  width:100% !important;
  min-width:0 !important;
  max-width:100% !important;
}
html body #mkrf-detail-modal .mkfit-review-pane .mkfit-avatar-wrap {
  box-sizing:border-box !important;
  display:block !important;
  flex:0 0 48px !important;
  width:48px !important;
  height:48px !important;
  min-width:48px !important;
  min-height:48px !important;
  max-width:48px !important;
  max-height:48px !important;
  margin:0 !important;
  padding:0 !important;
  overflow:hidden !important;
  border-radius:50% !important;
  line-height:0 !important;
}
html body #mkrf-detail-modal .mkfit-review-pane .mkfit-avatar {
  box-sizing:border-box !important;
  display:block !important;
  width:48px !important;
  height:48px !important;
  min-width:48px !important;
  min-height:48px !important;
  max-width:48px !important;
  max-height:48px !important;
  aspect-ratio:1 / 1 !important;
  object-fit:cover !important;
  object-position:center center !important;
  border-radius:50% !important;
  margin:0 !important;
  padding:0 !important;
  border:0 !important;
  transform:none !important;
}
html body #mkrf-detail-modal .mkfit-review-pane .mkfit-author-text {
  box-sizing:border-box !important;
  flex:1 1 auto !important;
  min-width:0 !important;
  max-width:100% !important;
}

/*
 * v1.4.2: モーダル内容が再描画されて補正クラスが消えても、
 * ヘッダー内のプロフィール画像自体を直接正円に固定する。
 */
html body #mkrf-detail-modal .mkfit-review-pane .mkrf-detail-head img {
  box-sizing:border-box !important;
  display:block !important;
  flex:0 0 48px !important;
  width:48px !important;
  height:48px !important;
  min-width:48px !important;
  min-height:48px !important;
  max-width:48px !important;
  max-height:48px !important;
  aspect-ratio:1 / 1 !important;
  object-fit:cover !important;
  object-position:center center !important;
  border-radius:999px !important;
  margin:0 !important;
  padding:0 !important;
  border:0 !important;
  transform:none !important;
  clip-path:none !important;
}

html body #mkrf-detail-modal .mkfit-review-pane .mkrf-detail-head .mkfit-avatar-wrap {
  box-sizing:border-box !important;
  display:block !important;
  flex:0 0 48px !important;
  width:48px !important;
  height:48px !important;
  min-width:48px !important;
  min-height:48px !important;
  max-width:48px !important;
  max-height:48px !important;
  overflow:hidden !important;
  border-radius:999px !important;
  margin:0 !important;
  padding:0 !important;
  line-height:0 !important;
}

/* 口コミ本文は狭すぎず広すぎない文字密度に統一。 */
html body #mkrf-detail-modal .mkfit-review-pane p,
html body #mkrf-detail-modal .mkfit-review-pane li {
  font-size:15px !important;
  line-height:1.9 !important;
  word-break:normal !important;
  overflow-wrap:anywhere !important;
}

html body #mkrf-detail-modal .mkrf-gallery[hidden],
html body #mkrf-detail-modal .mkrf-gallery-thumbs[hidden],
html body #mkrf-detail-modal .mkrf-gallery-arrow[hidden] { display:none !important; }

/* 左側は写真を主役に。縦写真でも左右余白が過剰に見えない大きさまで確保。 */
html body #mkrf-detail-modal .mkfit-media-pane .mkrf-gallery,
html body #mkrf-detail-modal .mkfit-media-pane > :first-child {
  box-sizing:border-box !important;
  display:flex !important;
  flex-direction:column !important;
  flex:1 1 auto !important;
  min-height:0 !important;
  width:100% !important;
}

html body #mkrf-detail-modal .mkrf-gallery-main {
  box-sizing:border-box !important;
  position:relative !important;
  display:flex !important;
  align-items:center !important;
  justify-content:center !important;
  flex:1 1 auto !important;
  width:100% !important;
  max-width:100% !important;
  height:var(--mkfit-photo-height,680px) !important;
  min-height:0 !important;
  max-height:var(--mkfit-photo-height,680px) !important;
  aspect-ratio:auto !important;
  padding:0 !important;
  overflow:hidden !important;
  background:#edf3eb !important;
  border-radius:14px !important;
}

html body #mkrf-detail-modal .mkrf-gallery-main::before {
  content:none !important;
  display:none !important;
}

html body #mkrf-detail-modal .mkrf-gallery-main > img {
  box-sizing:border-box !important;
  position:relative !important;
  inset:auto !important;
  display:block !important;
  flex:0 1 auto !important;
  width:100% !important;
  height:100% !important;
  min-width:0 !important;
  min-height:0 !important;
  max-width:100% !important;
  max-height:100% !important;
  aspect-ratio:auto !important;
  object-fit:contain !important;
  object-position:center center !important;
  margin:0 !important;
  padding:0 !important;
  border:0 !important;
  transform:none !important;
  clip-path:none !important;
}

/* サムネイルは写真の下で明確に3枚を認識できるサイズ。 */
html body #mkrf-detail-modal .mkrf-gallery-thumbs {
  flex:0 0 auto !important;
  display:flex !important;
  align-items:center !important;
  gap:8px !important;
  margin-top:8px !important;
  min-height:56px !important;
}
html body #mkrf-detail-modal .mkrf-gallery-thumbs button,
html body #mkrf-detail-modal .mkrf-gallery-thumbs a {
  flex:0 0 auto !important;
  min-width:66px !important;
  min-height:52px !important;
}
html body #mkrf-detail-modal .mkrf-gallery-thumbs img {
  display:block !important;
  width:66px !important;
  height:52px !important;
  object-fit:cover !important;
  border-radius:9px !important;
}

html body #mkrf-detail-modal .mkrf-gallery-arrow {
  width:46px !important;
  height:46px !important;
  min-width:46px !important;
  min-height:46px !important;
}

/* 閉じるはスクロールに巻き込まない。 */
html body #mkrf-detail-modal .mkc-review-modal-safe-close { display:none !important; }
html body #mkrf-detail-modal .mkrf-detail-close {
  box-sizing:border-box !important;
  position:fixed !important;
  display:flex !important;
  align-items:center !important;
  justify-content:center !important;
  top:var(--mkfit-close-top,18px) !important;
  left:var(--mkfit-close-left,calc(100vw - 62px)) !important;
  right:auto !important;
  bottom:auto !important;
  float:none !important;
  margin:0 !important;
  width:44px !important;
  height:44px !important;
  min-width:44px !important;
  min-height:44px !important;
  transform:none !important;
  z-index:2147483647 !important;
}
html body #mkrf-detail-modal .mkrf-detail-close:focus-visible {
  outline:3px solid #3d8050 !important;
  outline-offset:2px !important;
}

/* 中型PCでは口コミ欄を必要十分な幅に留め、残りを写真へ渡す。 */
@media (max-width:1180px) and (min-width:821px) {
  html body #mkrf-detail-modal .mkfit-layout {
    grid-template-columns:minmax(0,1fr) 340px !important;
  }
  html body #mkrf-detail-modal .mkfit-review-pane {
    padding:18px 18px 26px !important;
  }
}

/* スマホ・小型タブレットは1カラム。写真→口コミの自然な読み順に戻す。 */
@media (max-width:820px) {
  html body #mkrf-detail-modal:not([hidden]) {
    padding:max(5px,env(safe-area-inset-top)) max(5px,env(safe-area-inset-right)) max(5px,env(safe-area-inset-bottom)) max(5px,env(safe-area-inset-left)) !important;
  }
  html body #mkrf-detail-modal .mkrf-detail-dialog {
    width:calc(100vw - 10px) !important;
    max-width:calc(100vw - 10px) !important;
    height:auto !important;
    min-height:0 !important;
    max-height:calc(var(--mkfit-vh,100vh) - 10px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) !important;
    overflow-y:auto !important;
    overscroll-behavior:contain !important;
    -webkit-overflow-scrolling:touch !important;
    border-radius:15px !important;
  }
  html body #mkrf-detail-modal .mkrf-detail-inner {
    height:auto !important;
    overflow:visible !important;
  }
  html body #mkrf-detail-modal .mkfit-layout {
    display:block !important;
    height:auto !important;
    overflow:visible !important;
  }
  html body #mkrf-detail-modal .mkfit-media-pane {
    height:auto !important;
    padding:14px 12px 10px !important;
    overflow:visible !important;
  }
  html body #mkrf-detail-modal .mkfit-review-pane {
    height:auto !important;
    padding:18px 16px 28px !important;
    overflow:visible !important;
    border-left:0 !important;
    border-top:1px solid #e4ebe2 !important;
  }
  html body #mkrf-detail-modal .mkrf-gallery-main {
    height:var(--mkfit-photo-height,54vh) !important;
    min-height:260px !important;
    max-height:var(--mkfit-photo-height,54vh) !important;
    border-radius:12px !important;
  }
  html body #mkrf-detail-modal.mkfit-photo-portrait .mkrf-gallery-main {
    min-height:360px !important;
  }
  html body #mkrf-detail-modal .mkrf-gallery-thumbs {
    min-height:56px !important;
    gap:8px !important;
    margin-top:9px !important;
  }
  html body #mkrf-detail-modal .mkrf-gallery-thumbs button,
  html body #mkrf-detail-modal .mkrf-gallery-thumbs a {
    min-width:60px !important;
    min-height:50px !important;
  }
  html body #mkrf-detail-modal .mkrf-gallery-thumbs img {
    width:60px !important;
    height:50px !important;
  }

  html body #mkrf-detail-modal .mkfit-review-pane .mkrf-detail-head img {
    flex-basis:44px !important;
    width:44px !important;
    height:44px !important;
    min-width:44px !important;
    min-height:44px !important;
    max-width:44px !important;
    max-height:44px !important;
  }

  html body #mkrf-detail-modal .mkfit-review-pane .mkfit-avatar-wrap,
  html body #mkrf-detail-modal .mkfit-review-pane .mkfit-avatar {
    width:44px !important;
    height:44px !important;
    min-width:44px !important;
    min-height:44px !important;
    max-width:44px !important;
    max-height:44px !important;
  }
  html body #mkrf-detail-modal .mkfit-review-pane .mkfit-avatar-wrap {
    flex-basis:44px !important;
  }
  html body #mkrf-detail-modal .mkrf-gallery-arrow {
    width:40px !important;
    height:40px !important;
    min-width:40px !important;
    min-height:40px !important;
  }
}

@media (max-width:420px) {
  html body #mkrf-detail-modal .mkrf-gallery-main {
    min-height:240px !important;
  }
  html body #mkrf-detail-modal.mkfit-photo-portrait .mkrf-gallery-main {
    min-height:330px !important;
  }
}

/* =========================================================
   v1.11.0 MOBILE RELEASE FIX
   スマホは写真→サムネイル→口コミ本文の縦1カラム。
   ========================================================= */
@media (max-width:820px) {
  html body #mkrf-detail-modal:not([hidden]){
    align-items:center !important;
    justify-content:center !important;
    padding:max(4px,env(safe-area-inset-top)) max(4px,env(safe-area-inset-right)) max(4px,env(safe-area-inset-bottom)) max(4px,env(safe-area-inset-left)) !important;
  }
  html body #mkrf-detail-modal .mkrf-detail-dialog{
    width:calc(100vw - 8px) !important;
    max-width:calc(100vw - 8px) !important;
    height:min(94dvh,900px) !important;
    max-height:min(94dvh,900px) !important;
    min-height:0 !important;
    overflow-y:auto !important;
    overflow-x:hidden !important;
    border-radius:14px !important;
    overscroll-behavior:contain !important;
    -webkit-overflow-scrolling:touch !important;
  }
  html body #mkrf-detail-modal .mkrf-detail-inner,
  html body #mkrf-detail-modal .mkfit-layout{
    display:block !important;
    width:100% !important;
    height:auto !important;
    min-height:0 !important;
    overflow:visible !important;
  }
  html body #mkrf-detail-modal .mkfit-media-pane{
    width:100% !important;
    height:auto !important;
    padding:12px 10px 8px !important;
    overflow:visible !important;
  }
  html body #mkrf-detail-modal .mkrf-gallery-main,
  html body #mkrf-detail-modal.mkfit-photo-portrait .mkrf-gallery-main,
  html body #mkrf-detail-modal.mkfit-photo-landscape .mkrf-gallery-main,
  html body #mkrf-detail-modal.mkfit-photo-square .mkrf-gallery-main{
    height:var(--mkfit-photo-height,42dvh) !important;
    min-height:220px !important;
    max-height:46dvh !important;
    border-radius:11px !important;
  }
  html body #mkrf-detail-modal .mkrf-gallery-main img{
    object-fit:contain !important;
    object-position:center !important;
  }
  html body #mkrf-detail-modal .mkrf-gallery-thumbs{
    min-height:48px !important;
    height:auto !important;
    gap:7px !important;
    margin-top:8px !important;
    padding:0 !important;
  }
  html body #mkrf-detail-modal .mkrf-gallery-thumbs button,
  html body #mkrf-detail-modal .mkrf-gallery-thumbs a{
    min-width:52px !important;
    min-height:44px !important;
  }
  html body #mkrf-detail-modal .mkrf-gallery-thumbs img{
    width:52px !important;
    height:44px !important;
    object-fit:cover !important;
  }
  html body #mkrf-detail-modal .mkfit-review-pane{
    display:block !important;
    width:100% !important;
    height:auto !important;
    min-height:0 !important;
    padding:14px 14px calc(24px + env(safe-area-inset-bottom)) !important;
    overflow:visible !important;
    border-left:0 !important;
    border-top:1px solid #e4ebe2 !important;
  }
  html body #mkrf-detail-modal .mkrf-detail-head{
    margin-bottom:12px !important;
  }
  html body #mkrf-detail-modal .mkrf-detail-close{
    position:fixed !important;
    top:calc(env(safe-area-inset-top) + 8px) !important;
    right:calc(env(safe-area-inset-right) + 8px) !important;
    left:auto !important;
    width:42px !important;
    height:42px !important;
    min-width:42px !important;
    min-height:42px !important;
    z-index:2147483647 !important;
  }
}

@media(max-width:420px){
  html body #mkrf-detail-modal .mkrf-gallery-main,
  html body #mkrf-detail-modal.mkfit-photo-portrait .mkrf-gallery-main{
    min-height:210px !important;
    max-height:44dvh !important;
  }
}
