/* ==================================================================
   CHRONOLO  iOS スクロール修正  r27  —  最終上書き
   ================================================================== */

/* 横はみ出しの封鎖は body だけに留める。
   html(ルート)に掛けるとビューポートに伝播し、iOS で内側スクローラが壊れる。 */
html{overflow-x:visible !important;}
body{overflow-x:hidden !important; max-width:100% !important;}

/* --- 1) スクローラの祖先から合成レイヤ生成要因を排除 --------------- */
.popup-overlay,.popup{
  -webkit-backdrop-filter:none !important;
          backdrop-filter:none !important;
  filter:none !important;
  -webkit-transform:none !important;
          transform:none !important;
  animation:none !important;
  will-change:auto !important;
  perspective:none !important;
  contain:none !important;
}

/* --- 2) 実スクロール要素 ------------------------------------------- */
.popup-body{
  overflow-y:auto !important;
  overflow-x:hidden !important;
  overscroll-behavior:contain !important;
  max-height:none !important;
  height:auto !important;
  min-height:0 !important;
  flex:1 1 auto !important;
  -webkit-transform:none !important;
          transform:none !important;
}
.popup-header,.popup-tabs{flex:0 0 auto !important;}

/* --- 3) 背景ロック -------------------------------------------------- */
body.ios-fix-lock{
  position:fixed !important;
  left:0 !important; right:0 !important;
  width:100% !important;
  overflow:hidden !important;
}

/* --- 4) モバイル: 高さは JS 実測値(--app-vh)で与える ----------------
   iOS Safari の 100dvh は実表示領域より大きい値を返すことがあり
   (実測: dvh=681px / innerHeight=641px)、シート下端が画面外に出る。 */
@media(max-width:767px){
  .popup-overlay{
    display:block !important;
    top:0 !important;
    height:var(--app-vh, 100%) !important;
    max-height:var(--app-vh, 100%) !important;
    padding:0 !important;
  }
  .popup{
    position:absolute !important;
    left:0 !important; right:0 !important;
    top:7% !important;
    bottom:0 !important;
    width:auto !important;
    max-width:none !important;
    height:auto !important;
    max-height:none !important;
    border-radius:16px 16px 0 0 !important;
    display:flex !important;
    flex-direction:column !important;
    overflow:hidden !important;
  }
  /* 入れ子スクローラを排除（スクローラは常に1つだけにする） */
  .popup-body .popup-xml-pre{max-height:none !important;overflow-y:visible !important;}
  .popup-body div[style*="overflow-x"]{overflow-x:visible !important;}
}

/* --- 5) 気象テーブル ------------------------------------------------ */
.meteo-table-wrap{
  display:block !important;
  overflow-x:auto !important;
  overflow-y:hidden !important;
  overscroll-behavior-x:contain !important;
  -webkit-transform:none !important;
          transform:none !important;
  width:100% !important;
  max-width:100% !important;
}
#timeline-table-wrap{overflow-y:auto !important;}
#meteo-table-body{
  min-width:-webkit-max-content !important;
  min-width:max-content !important;
}
table.meteo-tbl{
  width:-webkit-max-content !important;
  width:max-content !important;
  min-width:100% !important;
  border-collapse:separate !important;
  border-spacing:0 !important;
}

/* --- 6) 横スクローラ内の sticky セルを無効化 ------------------------ */
@media(max-width:767px){
  table.meteo-tbl th, table.meteo-tbl th:first-child,
  table.meteo-tbl td, table.meteo-tbl td:first-child,
  table.early-tbl th, table.early-tbl th.area-th,
  table.early-tbl td.area-td{ position:static !important; }
}
