/* ═════════════════════════════════════════════
 *  weather-panel.css — 天氣頁的面板（2026-11-15 整體優化第 4 班；取代 weather-mobile-panel.css）
 *
 *  一份內容、兩種擺法：
 *    手機  #mobile-sheet.msh-on   底部面板（三段高度；weather-panel-sheet.js 建好才加 msh-on）
 *    桌機  #weather-panel.wdp-on  左邊那一欄（weather-panel-rail.js 建好才加 wdp-on）
 *  「內容」那一段的選擇器一律以 :is(#mobile-sheet.msh-on, #weather-panel.wdp-on) 開頭——權重跟原本的
 *  #mobile-sheet.msh-on 一樣（頁內 <style> 排在前面、同權重它贏，所以要帶 id）。兩個 class 都是模組建好才加的，
 *  模組沒跑起來時整份不生效。擺法專用的規則各自包在自己的 media 裡。
 *
 *  為什麼換檔名：/public/css 有一小時快取，沒有 SW 的瀏覽器部署後一小時內可能拿新頁面配快取裡的舊樣式；
 *  新面板的 DOM 是 JS 建的，配舊樣式會變成沒排版的一團。新檔名沒有舊快取（舊檔留在站上給還沒換版的分頁）。
 *
 *  面板的狀態只放在根節點的屬性（不用 hidden 屬性、不用 .hidden class）：
 *    data-mscreen land（開場）｜result（查完）｜setup（路線設定）｜reports（AI 報告清單）
 *    data-mtab    wx｜met｜ai（查完之後的分頁；桌機沒有 met，時間軸一直在右邊）
 *    data-state   peek｜half｜full（只有手機：三段高度；高度本身由 JS 寫進 --msh-h）
 *  🔴 `.meteogram-bar.hidden` 是「時間軸還沒載入」的語意（分享兩道守衛、computeTaskStage 讀它）——這裡只用
 *     自己的屬性選擇器藏它，從不碰那個 class。
 * ═════════════════════════════════════════════ */

/* ══════════ 內容：兩種擺法共用 ══════════ */

/* ── 面板的顏色與字體（兩種擺法的根節點都定義；天氣分頁 weather-panel-wx.css 也讀這幾個） ── */
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) {
  --msh-card: #2B3142;
  --msh-card-2: #323A4E;
  --msh-line: rgba(174, 189, 212, 0.16);
  --msh-ink: var(--pk-text-on-dark, #F5F1E8);
  --msh-ink-m: var(--pk-text-on-dark-mute, #AEBDD4);
  --msh-ink-d: #A7B2C7;
  --msh-sel: var(--pk-amber-soft, #E6B38A);
  font-family: var(--pk-font-family);
}
/* 「想更懂這份圖？」那張卡在路線設定裡說不通（圖在結果的分頁裡），第二班在天氣分頁放 AI 卡 */
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on)[data-mscreen="setup"] #ai-invite-card { display: none !important; }

/* AI 報告清單那一頁：只留清單，AI 的其他狀態藏起來；打開了一份（data-mrep）才放出報告本身。
   2026-11-14 第 3 班：AI 分頁重排之後這條規則住在 weather-ai-brief.css（那一份認得新的排法）；
   繼續問的抽屜與遮罩不在 .wab 裡面，這一頁用不到，在這裡藏。
   #ai-history-bar 也不藏：舊頁面（清單那一條是 #tab-main-ai-analysis 的直接子元素）配到這一份樣式時，清單還在。 */
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on)[data-mscreen="reports"]:not([data-mrep="1"]) #tab-main-ai-analysis > :not(#wab):not(#ai-history-bar) { display: none !important; }

/* ── 新元件共用 ── */
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-head,
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-tabs,
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-bar { box-sizing: border-box; }
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-head *,
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-tabs *,
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-bar * { box-sizing: border-box; }
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-head[hidden],
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-tabs[hidden],
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-bar[hidden],
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-route[hidden],
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-land[hidden],
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-cond[hidden] { display: none !important; }
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-head button,
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-tabs button,
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-bar button {
  font-family: var(--pk-font-family);
  -webkit-tap-highlight-color: transparent;
}
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-head button:focus-visible,
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-tabs button:focus-visible,
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-bar button:focus-visible {
  outline: 2px solid var(--msh-sel);
  outline-offset: 2px;
}

:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-head {
  flex: none;
  padding: 0 16px;
  color: var(--msh-ink);
}
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-sp { flex: 1; }

/* ── 開場：查山上的天氣 ── */
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-land { padding-bottom: 8px; }
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-land h2 {
  margin: 0 0 2px;
  font-size: 16px;
  font-weight: 700;
  color: var(--msh-ink);
}
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-land > p {
  margin: 0 0 10px;
  color: var(--msh-ink-m);
  font-size: 13px;
  line-height: 1.6;
}
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-rlabel {
  margin: 2px 0 6px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--msh-ink-m);
  letter-spacing: 0.04em;
}
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-rlist { display: grid; gap: 6px; margin-bottom: 10px; }
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-rcard {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  align-items: center;
  border-radius: 14px;
  background: var(--msh-card);
  border: 1px solid var(--msh-line);
}
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-rbody {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 60px;
  padding: 8px 0 8px 8px;
  border: 0;
  border-radius: 14px 0 0 14px;
  background: none;
  color: var(--msh-ink);
  text-align: left;
  cursor: pointer;
}
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-rbody > .pk-i { color: var(--msh-ink-d); font-size: 18px; }
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-rthumb {
  display: block;
  width: 44px;
  height: 44px;
  border-radius: 9px;
  background: #1A1E29;
}
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-rtx { min-width: 0; }
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-rtx b {
  display: block;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-rtx small {
  display: block;
  font-size: 13px;
  color: var(--msh-ink-m);
  font-variant-numeric: tabular-nums;
}
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-rtx em { font-style: normal; color: var(--msh-ink); font-weight: 700; }
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-rcard.is-off .msh-rthumb { opacity: 0.45; }
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-rcard.is-off .msh-rtx b { color: var(--msh-ink-m); }
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-rcard.is-off .msh-rtx em { color: var(--msh-ink-m); font-weight: 500; }
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-x {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--msh-ink-m);
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 18px;
}
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-rowlink {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  margin: 0 0 10px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--msh-line);
  background: var(--msh-card);
  color: var(--msh-ink);
  font-size: 14px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-rowlink small { font-size: 12.5px; font-weight: 500; color: var(--msh-ink-m); }
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-rowlink .pk-i { color: var(--msh-ink-m); flex: none; }
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-rowlink .msh-fresh {
  font-size: 12px;
  font-weight: 700;
  color: var(--msh-sel);
}
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  padding: 0 12px;
  border: 0;
  border-radius: 12px;
  background: var(--pk-amber-btn, #A16743);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-qlabel { margin-top: 12px; font-size: 12.5px; color: var(--msh-ink-d); }
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-quick {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-quick::-webkit-scrollbar { display: none; }
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-quick button {
  flex: none;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 22px;
  border: 1px solid var(--msh-line);
  background: var(--msh-card);
  color: var(--msh-ink);
  font-size: 13.5px;
  cursor: pointer;
}

/* ── 結果頂端：路線｜出發日 永遠在；每個點的時間｜保存 只在半開以上；三天卡只在收合 ── */
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-rrow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
}
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-rrow2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 6px;
  margin-top: 6px;
  padding-bottom: 10px;
}
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 44px;
  padding: 0 10px;
  border-radius: 12px;
  border: 1px solid var(--msh-line);
  background: var(--msh-card);
  color: var(--msh-ink);
  text-align: left;
  cursor: pointer;
}
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-chip b,
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-chip .msh-lbl {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-chip b { font-size: 15.5px; }
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-chip .msh-lbl { font-size: 13.5px; font-weight: 700; }
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-chip .pk-i { flex: none; color: var(--msh-ink-m); }
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-chip--date .msh-lbl { font-variant-numeric: tabular-nums; }
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-ibtn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--msh-line);
  background: var(--msh-card);
  color: var(--msh-ink);
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 18px;
}
/* 已保存：實心（不是開關，所以看 class 不看 aria-pressed） */
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-ibtn.is-saved { background: var(--msh-ink); color: var(--pk-night, #1E2330); }

/* 查詢進行中：會改路線的鈕看得出來暫時不能按（按了講「正在查，查完再改」） */
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on)[data-mbusy="1"] .msh-chip,
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on)[data-mbusy="1"] .msh-rbody,
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on)[data-mbusy="1"] .msh-cta,
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on)[data-mbusy="1"] .msh-quick button { opacity: 0.55; }

/* 只在要緊時多一行：斷網、正在重查、這次沒查到、從分享連結打開 */
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-cond {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  margin-top: 6px;
  padding: 4px 4px 4px 10px;
  border-radius: 10px;
  background: rgba(242, 195, 143, 0.13);
  border: 1px solid rgba(242, 195, 143, 0.45);
  color: #F7D9B5;
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.45;
}
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-cond > .pk-i { flex: none; }
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-cond > span { min-width: 0; }
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-cond.is-busy {
  background: rgba(174, 189, 212, 0.1);
  border-color: var(--msh-line);
  color: var(--msh-ink);
}
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-cbtn {
  position: relative;
  flex: none;
  min-height: 36px;
  margin-left: auto;
  padding: 0 10px;
  border-radius: 9px;
  border: 1px solid rgba(242, 195, 143, 0.6);
  background: none;
  color: #F7D9B5;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
/* 看得到 36，按得到 44（往上下各 4，不碰到別的鈕：這一行上下各有 6 的間距） */
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-cbtn::before { content: ''; position: absolute; inset: -4px 0; }

/* ── 三個分頁 ── */
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-tabs {
  display: flex;
  gap: 4px;
  flex: none;
  padding: 0 16px 8px;
  border-bottom: 1px solid var(--msh-line);
}
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-tab {
  position: relative;
  flex: 1;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--msh-ink-m);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-tab[aria-selected="true"] {
  background: var(--msh-card);
  color: var(--msh-ink);
  box-shadow: inset 0 -3px 0 var(--msh-sel);
}
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-tab .msh-new { width: 8px; height: 8px; border-radius: 50%; background: var(--msh-sel); }

/* ── 路線設定、AI 報告清單、加點：頂端一條 ── */
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 56px;
  padding: 6px 8px 6px 16px;
  border-bottom: 1px solid var(--msh-line);
  color: var(--msh-ink);
}
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-bar h2 { margin: 0; font-size: 16px; font-weight: 700; }
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-bar p { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--msh-ink); }
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-bar .msh-obtn {
  flex: none;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--msh-line);
  background: var(--msh-card);
  color: var(--msh-ink);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
:is(#mobile-sheet.msh-on, #weather-panel.wdp-on) .msh-bar--add { border-bottom: 0; padding-top: 4px; }

/* 「已從最近查過拿掉」那一則：要給「復原」鈕，現有的 weather-toast 不收按鈕 ⇒ 另一個，位置一樣 */
body.weather-page .msh-toast {
  position: fixed;
  top: calc(var(--pk-header-h, 52px) + 12px);
  left: 50%;
  z-index: 10001;
  display: flex;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: calc(100vw - 32px);
  box-sizing: border-box;
  padding: 4px 4px 4px 14px;
  border-radius: 12px;
  border-left: 3px solid var(--pk-amber, #C4845A);
  background: rgba(30, 35, 48, 0.96);
  color: var(--pk-text-on-dark, #F5F1E8);
  font-family: var(--pk-font-family);
  font-size: 13.5px;
  line-height: 1.45;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  transform: translateX(-50%);
}
body.weather-page .msh-toast button {
  flex: none;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--pk-amber-soft, #E6B38A);
  font-family: var(--pk-font-family);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

/* ══════════ 手機擺法：底部面板（只在 max-width:768px）══════════ */
@media (max-width: 768px) {

  /* ── 面板本體：貼底、用高度表示三段（原本是 top 三個定值）；顏色變數在上面「內容」那一段 ── */
  #mobile-sheet.msh-on {
    box-sizing: border-box;
    top: auto !important;
    height: var(--msh-h, 122px);
    transition: height 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
  }
  #mobile-sheet.msh-on.msh-drag { transition: none; }

  /* 把手：看得到的條 44×5，整條 44 高（第 1 期留下的「把手只有 23 高」）。
     不用 ::before 往上外擴：#mobile-sheet 是 overflow:hidden，外擴的那一截會被裁掉、按不到（審查實測）。
     🔗 跟 weather-mobile-panel.js 的 GRAB 成對 */
  #mobile-sheet.msh-on .mobile-sheet__handle {
    box-sizing: border-box;
    height: 44px;
    padding: 0;
    flex: none;
  }
  #mobile-sheet.msh-on .mobile-sheet__handle:focus-visible {
    outline: 2px solid var(--msh-sel);
    outline-offset: -4px;
    border-radius: 12px;
  }
  /* 路線設定、加點時不給拖（那兩種畫面的高度是固定的） */
  #mobile-sheet.msh-on[data-mscreen="setup"] .mobile-sheet__handle,
  #mobile-sheet.msh-on[data-mscreen="reports"] .mobile-sheet__handle { display: none; }

  /* ── 舊的收合首屏與面板內的舊導覽：由新的頂端與分頁接手 ── */
  #mobile-sheet.msh-on .mobile-sheet__chip,
  #mobile-sheet.msh-on .mobile-sheet__ai-cta,
  #mobile-sheet.msh-on .weather-panel .panel-header,
  #mobile-sheet.msh-on .weather-panel .task-stepper,
  #mobile-sheet.msh-on .weather-panel .ai-mobile-back,
  #mobile-sheet.msh-on .weather-panel .panel-main-tabs,
  #mobile-sheet.msh-on #panel-footbar,
  #mobile-sheet.msh-on .meteogram-collapse-m,
  #mobile-sheet.msh-on #btn-refetch { display: none !important; }

  /* ── 內容區：開場、收合時不出現 ── */
  #mobile-sheet.msh-on .mobile-sheet__body { position: relative; }
  #mobile-sheet.msh-on[data-mscreen="land"] .mobile-sheet__body,
  #mobile-sheet.msh-on[data-state="peek"] .mobile-sheet__body { display: none !important; }
  #mobile-sheet.msh-on[data-mscreen="result"] .mobile-sheet__body { padding-top: 12px; }

  /* 分頁：不在時間軸那一頁就把時間軸藏起來，在時間軸那一頁就把面板藏起來 */
  #mobile-sheet.msh-on[data-mscreen="result"][data-mtab="met"] .mobile-sheet__body .weather-panel,
  #mobile-sheet.msh-on[data-mscreen="result"]:not([data-mtab="met"]) .mobile-sheet__body .meteogram-bar,
  #mobile-sheet.msh-on[data-mscreen="setup"] .mobile-sheet__body .meteogram-bar,
  #mobile-sheet.msh-on[data-mscreen="reports"] .mobile-sheet__body .meteogram-bar { display: none !important; }
  #mobile-sheet.msh-on[data-state="peek"] .msh-rrow2 { display: none; }
  #mobile-sheet.msh-on:not([data-state="peek"]) .msh-days { display: none; }

  /* 結果頂端也拖得動：瀏覽器不可以先把手勢拿去平移（否則送 pointercancel、拖到一半斷掉——審查 R3） */
  #mobile-sheet.msh-on[data-mscreen="result"] .msh-head { touch-action: none; }

  /* 雲圖開著、收合：面板只剩把手那一條（JS 給 44＋安全區），頂端整個藏起來 */
  #mobile-sheet.msh-on[data-strip="1"] .msh-head { visibility: hidden; }

  /* 收合時的三天卡（點一張＝半開、天氣分頁、那一天） */
  #mobile-sheet.msh-on .msh-days {
    display: grid;
    grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr));
    gap: 6px;
    margin: 6px 0 10px;
  }
  #mobile-sheet.msh-on .msh-day {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    column-gap: 4px;
    align-items: center;
    min-height: 66px;
    padding: 6px 4px 6px 6px;
    border: 2px solid transparent;
    outline: 1px solid var(--msh-line);
    outline-offset: -2px;
    border-radius: 12px;
    background: var(--msh-card);
    color: var(--msh-ink);
    text-align: left;
    cursor: pointer;
  }
  /* 圖示 20px（當初是為了讓同一列的「D2 · 11/12」放得下；2026-11-18 起日期那一行橫跨整張卡、不跟圖示同列，這個大小沒跟著改；
     389 寬以下的三張卡改 16px，見檔尾那一段） */
  #mobile-sheet.msh-on .msh-day .msh-wx { grid-row: 1 / 4; display: grid; place-items: center; font-size: 20px; line-height: 1; color: var(--msh-ink); }
  #mobile-sheet.msh-on .msh-day .msh-wx svg { display: block; }
  /* halt（2026-11-18）：「D1 · 今天」的「·」在中文字型（Windows 的 Noto Sans TC、紅米 14C 的 Noto Sans CJK）是全形的 12px，
     換成半形（6px）。紅米改版前「D3 · 11/20」在 62px 被截、同一格的「雨 5.6 mm」沒截——模擬用 Roboto 時兩者都 55px，
     只有全形的點解釋得了（中文字型量得 64）。拉丁字型（Roboto、SF、Segoe）沒有這個功能，照舊。 */
  #mobile-sheet.msh-on .msh-day .msh-dl {
    font-size: 12.5px;
    color: var(--msh-ink-m);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-feature-settings: "halt";
  }
  #mobile-sheet.msh-on .msh-day .msh-dl b { color: var(--msh-ink); font-weight: 700; }
  #mobile-sheet.msh-on .msh-day .msh-tp {
    font-size: 13.5px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  #mobile-sheet.msh-on .msh-day .msh-tp em { font-style: normal; color: var(--msh-ink-m); font-weight: 500; }
  #mobile-sheet.msh-on .msh-day .msh-key {
    font-size: 12px;
    color: var(--msh-ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  /* 日期那一行橫跨整張卡、圖示排到下面兩行的左邊（2026-11-18，device-tests H309）：原本圖示佔滿三行的左欄，
     「D3 · 11/20」只剩 62px 上下，紅米 14C 真機（360 寬）截成「D3 · 11…」。量測台換上紅米的字型量得 55px、照理放得下，
     真機卻還寬一截（差在哪沒追到）⇒ 改成整張卡的寬（約 90px），不必再猜那幾 px。4 張卡照下面那一套。 */
  #mobile-sheet.msh-on .msh-days:not(.is-n4) .msh-day .msh-dl { grid-column: 1 / -1; grid-row: 1; }
  #mobile-sheet.msh-on .msh-days:not(.is-n4) .msh-day .msh-wx { grid-row: 2 / 4; }
  #mobile-sheet.msh-on .msh-days:not(.is-n4) .msh-day .msh-tp { grid-column: 2; grid-row: 2; }
  #mobile-sheet.msh-on .msh-days:not(.is-n4) .msh-day .msh-key { grid-column: 2; grid-row: 3; }
  #mobile-sheet.msh-on .msh-days.is-n4 .msh-day {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto;
    justify-items: center;
    row-gap: 1px;
    padding: 5px 3px;
    text-align: center;
  }
  #mobile-sheet.msh-on .msh-days.is-n4 .msh-day .msh-wx { grid-row: auto; font-size: 18px; }
  #mobile-sheet.msh-on .msh-days.is-n4 .msh-day .msh-tp { font-size: 12.5px; }
  #mobile-sheet.msh-on[data-mscreen="result"][data-state="peek"] .msh-tabs,
  #mobile-sheet.msh-on:not([data-mscreen="result"]) .msh-tabs { display: none !important; }
}

/* 面板外面跟著面板走的東西：原本照三個定值（收合 122、半開 50dvh）算，現在讀 JS 寫在 body 上的 --msh-h。
   只在 msh-on（新面板建好）時生效；權重都比 weather.css 那幾條高一階，不靠載入順序。 */
@media (max-width: 768px) {
  body.wxh-msh-on-peek:not(#_):not(._),
  body.wxh-msh-on-half:not(#_):not(._) { --pk-map-bottom-offset: calc(var(--msh-h, 122px) + 8px); }
  /* 衛星雲圖開著：收合時面板收成一條（JS 給 44），播放列在它上面；半開時折成膠囊貼在面板上緣；全開照舊藏 */
  body.wsat-open.wxh-msh-on-peek:not(#_):not(._) { --pk-map-bottom-offset: calc(var(--msh-h, 44px) + var(--wsat-h, 110px) + 16px); }
  body.wsat-open.wxh-msh-on:not(#_) .wsat { bottom: calc(var(--msh-h, 44px) + 8px); }
  body.wxh-msh-on-half:not(#_):not(._) .wsat { bottom: calc(var(--msh-h, 50dvh) + 8px); }
}
@media (max-width: 768px) {
  /* @layout:ctrl-begin */
  /* 右邊那排地圖按鈕（.map-controls，從頂欄下面往下排）跟著面板讓位（2026-11-12）。
     小螢幕（375×667、iPhone Safari 開著網址列的 393×659）查完半開時面板頂端在 y≈260，那一排卻排到 y≈336（有颱風 388）
     ⇒ 下面幾顆疊在面板上，點「出發日」「保存」點到的是按鈕；開場畫面則疊在右下那組縮放鈕與授權上。
     做法：這一排最多排到面板上緣（收合時是右下那一疊的上緣）；一欄排不下就往左多排一欄（wrap-reverse：第一欄留在右邊）。
     CSS 沒有 if：用 clamp 把「差幾 px」夾成 0px／1px 的開關，再拿開關去乘。每個開關是 0px 時，底下用到它的那幾條都等於沒寫。
       --mc-zoomoff  收合時：留著右下的縮放鈕就排不下一欄（連分組間距都拿掉也不行）⇒ 收掉縮放鈕（觸控用兩指縮放；半開本來就收掉）
       --mc-tight    一欄要拿掉分組的 10px 間距才排得下
       --mc-over     拿掉間距也排不下 ⇒ 分欄。分欄時：說明標籤不出（它往左長，會蓋在左邊那一欄上；讀屏照舊讀 aria-label）、
                     底圖選單與「縮小地圖可顯示氣象圖層」往左讓、半開時授權與比例尺再往左讓一欄（它們本來就讓在第一欄左邊——
                     weather.css「2026-09-26」）、雲圖膠囊抬到比例尺上面（同 368px 以下那一條）、颱風動態卡收窄到按鈕左邊
                     （不然第二欄的鈕正好壓在卡片右上角的 ✕ 上：想關卡片卻按到「颱風動態」，連路徑一起關掉）
       --mc-s2       只排得下兩列 ⇒ 三欄：上面那些再多讓一欄
       --mc-s1       只排得下一列 ⇒ 橫排一列（iPhone SE 的 Safari 375×553 查完半開，地圖只剩 100px 高）：
                     授權改貼在那一列下面的右下角（展開時只給一行，不往上長到按鈕上）、比例尺收掉、底圖選單與提示改從按鈕下面出來、
                     雲圖播放列先收起來（它自己就要 100px 高；面板收合就回來）。這時颱風動態卡放不下、會疊在面板上（跟改之前一樣，
                     右上角的 ✕ 關得掉）——等第 2 班把卡片改成膠囊才真的解掉。
     一欄排得下的機型（--mc-tight 也是 0）畫面跟原本一模一樣；scripts/test-weather-layout.js 有一條專門守。
     另外不論分不分欄：颱風動態卡最高到面板上緣、內容太長在卡片裡捲（標題與 ✕ 留在上面）；授權展開時放不下就折行；
     拖面板的時候，一欄排不下就先把按鈕收起來、放手再排（不然拖的過程會一路從兩欄跳到六欄）。
     🔗 成對的常數（test-weather-layout.js 在真的頁面上量）：按鈕 44、間距 8、分組間距 10×2（weather.css .map-controls）⇒
        5 顆一欄 272、有颱風 6 顆 324，拿掉分組間距各少 20；兩列 96、三列 148；16＝頂欄下面 8＋離面板 8；52＝一欄的寬加間距；
        137＝收合時右下那一疊（授權＋縮放鈕＋邊距，從面板上緣算起 141）扣掉離面板的 8 再留 4，97＝縮放鈕那一組連邊距；
        48＝雲圖膠囊抬高的量（同下面 368px 那條的 56−8）；100＝颱風卡左 12＋自己的左右內距 28＋右邊一欄按鈕 60；
        122＝颱風卡的 top（頂欄下 106：膠囊在 56、卡片再低 50，weather.html 頁內 #typhoon-panel）＋上下內距 24＋離面板 8，再扣掉 --mc-room 已經含的 16；103＝授權右邊讓出的 57＋左邊留 10＋自己的內距 36。
     🔴 這一組收東西一律只動位置與大小（right／margin／max-height／translate），不用 clip-path、overflow、opacity：
        clip-path 會讓元素變成「背景濾鏡的根」——播放列、地圖按鈕、說明標籤都是毛玻璃（backdrop-filter），一掛上去模糊的對象就只剩它自己裡面，
        開關是 0 時畫面也跟著變（2026-11-12 截圖比對在 393×852 抓到播放列下緣不一樣）。現在開關是 0 時，每一條算出來的值都等於原本那一條。
     整組包在 @supports 裡：這些開關的算式用 dvh，不認得 dvh 的瀏覽器（有 :has() 卻沒有 dvh 的 Chromium 105～107）算不出來時，
       用到它的每一條會變成初始值而不是「沒寫」（授權跑回按鈕底下、比例尺跑出畫面）；包起來才真的回到原本的排法。
     撐到圖層列改版（整體計畫第 7 班）。 */
  @supports (height: 100dvh) {
    body.wxh-msh-on-peek:not(#_):not(._),
    body.wxh-msh-on-half:not(#_):not(._) {
      --mc-full: 272px;
      --mc-room: calc(100dvh - var(--msh-h, 122px) - var(--pk-header-h, 52px) - 16px);
      --mc-zoomoff: 0px;
      --mc-keep: 0px;
      --mc-avail: calc(var(--mc-room) - var(--mc-keep));
      --mc-tight: clamp(0px, calc((var(--mc-full) - var(--mc-avail)) * 9999), 1px);
      --mc-over: clamp(0px, calc((var(--mc-full) - 20px - var(--mc-avail)) * 9999), 1px);
      --mc-s2: clamp(0px, calc((148px - var(--mc-avail)) * 9999), 1px);
      --mc-s1: clamp(0px, calc((96px - var(--mc-avail)) * 9999), 1px);
      --mc-shift: calc(var(--mc-over) * 52 + var(--mc-s2) * 52);
    }
    body.wxh-msh-on-peek:not(#_):not(._) {
      --mc-stack: 137px;
      --mc-zoomoff: clamp(0px, calc((var(--mc-full) - 20px - (var(--mc-room) - var(--mc-stack))) * 9999), 1px);
      --mc-keep: calc(var(--mc-stack) - var(--mc-zoomoff) * 97);
    }
    body.wsat-open.wxh-msh-on-peek:not(#_):not(._) { --mc-stack: calc(145px + var(--wsat-h, 110px)); }
    body.wxh-msh-on:not(#_).wxh-typhoon-btn:not(#_) { --mc-full: 324px; }

    body.wxh-msh-on-peek:not(#_):not(._) .map-controls,
    body.wxh-msh-on-half:not(#_):not(._) .map-controls {
      max-height: max(44px, var(--mc-avail));
      flex-wrap: wrap-reverse;
      align-content: flex-start;
    }
    body.wxh-msh-on:not(#_) .map-controls .map-ctrl-btn-wrap,
    body.wxh-msh-on:not(#_) .map-controls #btn-fit-route { margin-top: calc(10px - var(--mc-tight, 0px) * 10); }
    /* 分欄時說明標籤不出：推到畫面外（原本的位置是 right: calc(100% + 10px)／calc(100% + 4px)，weather.css .map-ctrl-btn[data-label]） */
    body.wxh-msh-on:not(#_) .map-controls .map-ctrl-btn[data-label]:not(.loading)::before { right: calc(100% + 10px + var(--mc-over, 0px) * 9999); }
    body.wxh-msh-on:not(#_) .map-controls .map-ctrl-btn[data-label]:not(.loading)::after { right: calc(100% + 4px + var(--mc-over, 0px) * 9999); }
    body.wxh-msh-on:not(#_) .map-controls .layer-menu {
      top: calc(var(--mc-s1, 0px) * 52);
      right: max(0px, calc(56px + var(--mc-shift, 0px) - var(--mc-s1, 0px) * 9999));
    }
    body.wxh-msh-on:not(#_) .map-controls .zoom-hint {
      margin-top: calc(var(--mc-s1, 0px) * 52);
      right: max(0px, calc(48px + var(--mc-shift, 0px) - var(--mc-s1, 0px) * 9999));
    }
    /* 拖面板的時候：一欄排不下就先收起來（--mc-over 是跟著面板高度即時算的），放手再照新的高度排 */
    body.wxh-msh-on-drag:not(#_):not(._) .map-controls { translate: 0 calc(var(--mc-over, 0px) * -9999); }

    /* 收合時：留著縮放鈕就排不下 ⇒ 收掉那一組：每顆鈕的高度歸零、整組推到畫面右邊外面、下邊距歸零，授權落到最下面。
       （原本的邊距是 MapLibre 的 margin: 0 10px 10px 0；開關是 0 時這三條都等於沒寫） */
    body.wxh-msh-on-peek:not(#_):not(._) #map .maplibregl-ctrl-bottom-right .maplibregl-ctrl-group {
      margin-right: calc(10px - var(--mc-zoomoff, 0px) * 9999);
      margin-bottom: calc(10px - var(--mc-zoomoff, 0px) * 10);
    }
    body.wxh-msh-on-peek:not(#_):not(._) #map .maplibregl-ctrl-bottom-right .maplibregl-ctrl-group button { max-height: calc((1px - var(--mc-zoomoff, 0px)) * 9999); }

    body.wxh-msh-on-half:not(#_):not(._) #map .maplibregl-ctrl-bottom-right .maplibregl-ctrl-attrib {
      margin-right: max(calc(10px + env(safe-area-inset-right, 0px)), calc(57px + env(safe-area-inset-right, 0px) + var(--mc-shift, 0px) - var(--mc-s1, 0px) * 9999));
      margin-bottom: calc(47px - var(--mc-s1, 0px) * 37);
    }
    /* 授權展開時的那行字（剛開頁的頭幾秒，或點了 i）：最寬到畫面左邊留 10px，放不下就折成兩行（那一格往上長）。
       原本是一行、超過 70vw 的字直接裁掉（peakit-basemap.js 的 pk-attrib-transition）——393 寬已經少兩個字，再往左讓一欄會少一半。
       🔴 只能管「展開」那一態（.maplibregl-compact-show）：收合是靠那支把 max-width 過場到 0，這裡要是連收合態一起蓋掉，授權就永遠收不起來。
       🔴 折行要等展開的過場走完才開（animation 那一行）：max-width 是從 0 慢慢長出來的，一開始就能折行的話，
          Chrome 會先把字折成一個字一行——點下去的前 0.1 秒那一格拉成 24px 寬、400 多 px 高的一條白條。 */
    body.wxh-msh-on-half:not(#_):not(._) #map .maplibregl-ctrl-bottom-right .maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-inner {
      white-space: normal;
      text-wrap: balance;
      /* 橫排一列時授權在右下角、左邊整排是空的 ⇒ 給到整個畫面寬（151＝把上面扣掉的兩欄 104 加回來，再把右邊的 57 換成 10），
         而且只給一行（20＝一行的行高；再長就裁掉，不往上長到按鈕那一列上） */
      max-width: min(calc(70vw + var(--mc-s1, 0px) * 9999), calc(100vw - 103px - env(safe-area-inset-right, 0px) - var(--mc-shift, 0px) + var(--mc-s1, 0px) * 151));
      max-height: calc(20px + (1px - var(--mc-s1, 0px)) * 9999);
      animation: msh-attrib-wrap 0.42s step-end;
    }
    /* 2026-11-19（創辦人「照你建議處理」；驗收第二十二輪提的）：授權展開時 i 留在原地、貼齊下緣。原本 i 在那一格右上角，
       半開時折成三行就往上跑——手指下的 i 不見了，要去右上角找才收得回來；收合那一態本來就留在原地（下面那一條另外把它推回按鈕欄下面）。
       右內距 28 留給 i，每一行都不會壓到它。手機版每一態都一樣（照這一段的規矩掛在面板根節點底下，test-weather-mobile-panel E7）。 */
    body.wxh-msh-on:not(#_) #map .maplibregl-ctrl-bottom-right .maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-button {
      top: auto;
      bottom: 0;
    }
    /* 2026-11-18 第十九輪（device-tests H307 ④，兩支手機）：收合時點 i，授權也折行、整句看得到。
       原本這一態沿用 peakit-basemap.js 的「一行、最寬 70vw、超過裁掉」：真機只看得到中間一段，開頭「通訊點 © 林務局 | 地標 © PeaKit |」與結尾都被裁。
       折行就會往上長，而這一格正上方是按鈕欄（收合的版面照一行排；375×553、360×714 實測多出來那一行伸到最下面那顆鈕底下，
       i 在那一格右上角也跟著被壓住）⇒ 展開時那一格移到按鈕欄左邊（跟半開同一條算法：讓出 57＋分欄多出來的那幾欄），
       i 留在原地（往右推回原來的位置、貼齊下緣，自己補白底）——手指下的 i 不跑掉，再點一次就收。i 不在那一格裡了 ⇒ 右內距 28 改 8，
       寬度＝100vw − 讓出的 57 − 左邊留 10 − 內距 16。
       🔴 只管展開那一態、折行要等展開過場走完——理由同上面半開那一條。 */
    body.wxh-msh-on-peek:not(#_):not(._) #map .maplibregl-ctrl-bottom-right .maplibregl-ctrl-attrib.maplibregl-compact-show {
      margin-right: calc(57px + env(safe-area-inset-right, 0px) + var(--mc-shift, 0px));
      padding-right: 8px;
    }
    body.wxh-msh-on-peek:not(#_):not(._) #map .maplibregl-ctrl-bottom-right .maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-button {
      top: auto;
      bottom: 0;
      right: calc(-47px - env(safe-area-inset-right, 0px) - var(--mc-shift, 0px));
      background-color: #fff;
    }
    body.wxh-msh-on-peek:not(#_):not(._) #map .maplibregl-ctrl-bottom-right .maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-inner {
      white-space: normal;
      text-wrap: balance;
      max-width: calc(100vw - 83px - env(safe-area-inset-right, 0px) - var(--mc-shift, 0px));
      animation: msh-attrib-wrap 0.42s step-end;
    }
    /* 收回時直接消失、不縮（2026-11-18 外包審查 #4）：展開時那一格在按鈕欄左邊，收回就回到右下角——照預設「一行慢慢縮到 0」
       會先看到一條近 300px 的白條跳回右邊才縮。展開那一下照舊從 i 往左長（展開的過場看的是展開那一態的 transition，這條管不到）。 */
    body.wxh-msh-on-peek:not(#_):not(._) #map .maplibregl-ctrl-bottom-right .maplibregl-ctrl-attrib.maplibregl-compact:not(.maplibregl-compact-show) .maplibregl-ctrl-attrib-inner {
      transition: none;
    }
    body.wxh-msh-on-half:not(#_):not(._) #map .maplibregl-ctrl-bottom-right .maplibregl-ctrl-scale {
      /* 橫排一列時收掉：推到畫面右邊外面（地圖那一層自己會裁） */
      right: calc(47px + var(--mc-shift, 0px) - var(--mc-s1, 0px) * 9999);
    }
    body.wxh-msh-on-half:not(#_):not(._) .wsat {
      bottom: calc(var(--msh-h, 50dvh) + 8px + var(--mc-over, 0px) * 48);
      /* 地圖那一條不到 148px（按鈕排三欄或橫排一列）時整條收起來：推到畫面左邊外面。播放列自己 100px 高、分欄時又抬高 48px，
         可用高度不到 148 它的上緣就會伸到頂欄底下（2026-11-13：原本只在橫排一列時收，中間那一段會壓到頂欄 5px）。
         半開時它是 left＋width 定位、right 是 auto，原本的 margin: 0 auto 在這種情況下左邊算出來就是 0 ⇒ 開關是 0 時等於沒寫 */
      margin-left: calc(var(--mc-s2, 0px) * -9999);
    }

    /* 颱風膠囊（2026-11-13 第 2 班；基本樣式與預設位置在 weather.html 頁內）：分欄時右邊多讓一欄；
       橫排一列時（地圖只剩一條）整顆收起來——推到畫面左邊外面，面板收合就回來（右上那顆颱風鈕照樣亮著）。 */
    body.wxh-msh-on-peek:not(#_):not(._) .typhoon-cap,
    body.wxh-msh-on-half:not(#_):not(._) .typhoon-cap {
      right: calc(64px + var(--mc-shift, 0px));
      margin-left: calc(var(--mc-s1, 0px) * -9999);
    }
    body.wxh-msh-on-peek:not(#_):not(._) .typhoon-panel,
    body.wxh-msh-on-half:not(#_):not(._) .typhoon-panel {
      /* 分欄時收窄到按鈕左邊；橫排一列時按鈕在卡片上面，不必收（後面那一項把上限放回去） */
      width: min(300px, 74vw, calc(100vw - 100px - var(--mc-shift, 0px) + (1px - var(--mc-over, 0px)) * 9999 + var(--mc-s1, 0px) * 9999));
      /* 至少留 80px（標題＋兩行字）：面板很高（或手機橫放）時算出來不到這個數，不設下限整張卡會縮成一條白邊。
         2026-11-13 第 2 班：卡片改成點膠囊才開、開的時候面板先降到收合（weather.html setTyphoonCard），所以平常量到的都是收合那一態；
         卡片在膠囊下面，比原本低 50（膠囊 44＋間距 6）⇒ 扣掉的數從 72 變成 122。 */
      max-height: max(80px, calc(var(--mc-room) - 122px - var(--ty-push, 0px)));   /* --ty-push：風場圖例出來時卡片往下讓多少（weather.html 頁內），高度上限跟著扣 */
      overflow-y: auto;
      overscroll-behavior: contain;
    }
    /* 卡片裡捲的時候，標題與右上角的 ✕ 留在上面 */
    body.wxh-msh-on-peek:not(#_):not(._) .typhoon-panel .typhoon-panel__head,
    body.wxh-msh-on-half:not(#_):not(._) .typhoon-panel .typhoon-panel__head {
      position: sticky;
      top: -12px;
      z-index: 1;
      margin-top: -12px;
      padding-top: 12px;
      background: #fff;
    }
  }
  @keyframes msh-attrib-wrap { from { white-space: nowrap; } }
  /* @layout:ctrl-end */
}
/* 小手機（375 寬）日期那一行字小半號（原本是為了跟圖示同列放得下；2026-11-18 起那一行橫跨整張卡，不靠這一條了，留著是不讓小手機的字級跟著變） */
@media (max-width: 380px) {
  #mobile-sheet.msh-on .msh-day .msh-dl { font-size: 12px; }
}
/* 窄手機的收合小卡（2026-11-18，H309 的後續；量測 scripts/test-weather-layout.js「窄手機與 4 天以上」那一組）：
   389 寬以下——三張（一到三天）：圖示 20→16px、圖示旁的間距與左右內距各收 1px，右欄（溫度、數字）多約 8px。
     360 寬原本 62px：「雨 9.9 mm」中文字型要 56、字放大 15%（量測時加的餘裕）要 65；一天 100 mm 以上的「雨 123 mm」放大後要 69。
   四張（四天以上，直式）：左右內距 3→2，360 寬「雨 123 mm」放大 15% 放得下。
   359 寬以下（320 的 iPhone SE 一代、Android 把「顯示大小」調大）、三張：照四張那一套排成直式（圖示在上、字在下、置中）——
     橫式的右欄只剩 49px，「23° / 12°」就放不下。只挑剛好三張的那一排（一張、兩張放得下，照舊橫式）。
   ⚠️ 已知：320 寬的四張一張只有 67px，不加壓都放得下，字放大 15% 時日期、溫度、帶數字的雨量放不下；再擠只剩縮字或排成兩排（改版面，要先問）。 */
@media (max-width: 389px) {
  #mobile-sheet.msh-on .msh-days:not(.is-n4) .msh-day { column-gap: 3px; padding-left: 5px; padding-right: 3px; }
  #mobile-sheet.msh-on .msh-days:not(.is-n4) .msh-day .msh-wx { font-size: 16px; }
  #mobile-sheet.msh-on .msh-days.is-n4 .msh-day { padding-left: 2px; padding-right: 2px; }
}
@media (max-width: 359px) {
  #mobile-sheet.msh-on .msh-days:not(.is-n4) > .msh-day:first-child:nth-last-child(3),
  #mobile-sheet.msh-on .msh-days:not(.is-n4) > .msh-day:first-child:nth-last-child(3) ~ .msh-day {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto;
    justify-items: center;
    row-gap: 1px;
    padding: 5px 3px;
    text-align: center;
  }
  #mobile-sheet.msh-on .msh-days:not(.is-n4) > .msh-day:first-child:nth-last-child(3) .msh-wx,
  #mobile-sheet.msh-on .msh-days:not(.is-n4) > .msh-day:first-child:nth-last-child(3) ~ .msh-day .msh-wx { grid-row: auto; font-size: 18px; }
  #mobile-sheet.msh-on .msh-days:not(.is-n4) > .msh-day:first-child:nth-last-child(3) :is(.msh-dl, .msh-tp, .msh-key),
  #mobile-sheet.msh-on .msh-days:not(.is-n4) > .msh-day:first-child:nth-last-child(3) ~ .msh-day :is(.msh-dl, .msh-tp, .msh-key) { grid-column: auto; grid-row: auto; }
  #mobile-sheet.msh-on .msh-days:not(.is-n4) > .msh-day:first-child:nth-last-child(3) .msh-tp,
  #mobile-sheet.msh-on .msh-days:not(.is-n4) > .msh-day:first-child:nth-last-child(3) ~ .msh-day .msh-tp { font-size: 12.5px; }
}
/* 跟 weather.css 同一條理由：369 以下膠囊會蓋住比例尺，抬到比例尺上方（成對常數見那邊的註解） */
@media (max-width: 368px) {
  body.wxh-msh-on-half:not(#_):not(._) .wsat { bottom: calc(var(--msh-h, 50dvh) + 56px); }
}

/* ══════════ 桌機擺法：左邊那一欄（只在 min-width:769px；weather-panel-rail.js）══════════
   面板的位置、寬度、右緣的收合把手、時間軸跟著面板右緣走，都是原本的（weather.css、weather-desk.css），這裡不碰。
   這一段只做三件事：原本面板的導覽收掉、內容的元件在這一欄裡的留白、滑鼠移上去的回饋。 */
/* @rail-begin */
@media (min-width: 769px) {
  /* 記號：weather-panel-rail.js 看到它才把面板換成新的。這一份沒載到（或瀏覽器拿到不認得桌機擺法的舊版）⇒ 不換，照舊是原本的桌機面板 */
  #weather-panel { --wdp-css: 1; }

  /* 還在決定要不要換成新面板的那一下（動態載入桌機擺法，通常不到 0.2 秒）：先不畫原本的導覽與內容，免得閃一下舊的再換新的。
     class 由 weather.html 加、最慢 2.5 秒一定拿掉（載不到就照舊顯示原本的面板）。 */
  #weather-panel.wdp-pending > .panel-header,
  #weather-panel.wdp-pending > .task-stepper,
  #weather-panel.wdp-pending > .panel-main-tabs,
  #weather-panel.wdp-pending > .panel-body { visibility: hidden; }

  /* 原本面板的導覽由新的頂端與分頁接手：標題與「AI 報告」鈕（開場有那一列）、四步的步驟條、「路線設定｜天氣總結」分頁、
     底下那一條（回圖表）、「修改路線 · 重新查詢」（頂端那四顆取代它）、AI 邀請卡（天氣分頁最下面有 AI 卡） */
  #weather-panel.wdp-on > .panel-header,
  #weather-panel.wdp-on > .task-stepper,
  #weather-panel.wdp-on > .panel-main-tabs,
  #weather-panel.wdp-on #panel-footbar,
  #weather-panel.wdp-on #btn-refetch,
  #weather-panel.wdp-on #ai-invite-card { display: none !important; }
  /* 三天卡是手機收合時才有的：桌機用天氣分頁最上面那一排換天 */
  #weather-panel.wdp-on .msh-days { display: none; }
  #weather-panel.wdp-on:not([data-mscreen="result"]) .msh-tabs { display: none !important; }

  /* 頂端：手機上面有把手（44px），桌機沒有 ⇒ 自己留上邊距 */
  #weather-panel.wdp-on .msh-head { padding-top: 14px; }
  #weather-panel.wdp-on .msh-bar { border-radius: var(--pk-radius-xl, 16px) 0 0 0; }
  /* 開場：最近查過多的時候頂端自己捲，下面的路線清單至少留一半 */
  #weather-panel.wdp-on[data-mscreen="land"] .msh-head { max-height: 48%; overflow-y: auto; padding-bottom: 2px; border-bottom: 1px solid var(--msh-line); }
  /* 面板內容自己有上下留白（.panel-body），開場與路線設定照舊；查完那兩個分頁上面緊接分頁列，留 12px */
  #weather-panel.wdp-on[data-mscreen="result"] > .panel-body { padding-top: 12px; }

  /* 「AI 報告」那一頁（開場點「AI 報告」）：平常只有清單、清單一律攤開；打開了一份（data-mrep）才放出報告本身。
     手機的那幾條在 weather-ai-brief.css（只給 768px 以下）；桌機擺法的寫在這裡，同樣那幾件事——
     沒有這幾條時，這一頁在桌機擺法上清單跟「AI 解讀這一趟」那張開始卡一起出現、清單還要再點一次才攤開（2026-11-15 審查）。 */
  #weather-panel.wdp-on[data-mscreen="reports"]:not([data-mrep="1"]) #wab > :not(#wab-reports):not(.wab-dis) { display: none !important; }
  #weather-panel.wdp-on[data-mscreen="reports"]:not([data-mrep="1"]) #wab-trip-reports { display: none !important; }
  #weather-panel.wdp-on[data-mscreen="reports"]:not([data-mrep="1"]) #ai-history-list { display: grid !important; }
  #weather-panel.wdp-on[data-mscreen="reports"]:not([data-mrep="1"]) #ai-history-toggle .wab-rowlink__chev { display: none; }

  /* （三邊連動裡「換天那一排的那一天亮一下」的樣式在 weather-panel-wx.css：那一排是天氣分頁的東西，樣式跟著它那一份走） */

  /* 滑鼠：看得到的大小不變，游標移上去有回饋（觸控的裝置不套，免得點過之後停在亮的那一態） */
  @media (hover: hover) {
    #weather-panel.wdp-on .msh-chip:hover,
    #weather-panel.wdp-on .msh-ibtn:not(.is-saved):hover,
    #weather-panel.wdp-on .msh-rcard:hover,
    #weather-panel.wdp-on .msh-rowlink:hover,
    #weather-panel.wdp-on .msh-bar .msh-obtn:hover { background: var(--msh-card-2); }
    #weather-panel.wdp-on .msh-tab:not([aria-selected="true"]):hover { color: var(--msh-ink); background: rgba(174, 189, 212, 0.08); }
    #weather-panel.wdp-on .msh-x:hover { color: var(--msh-ink); background: rgba(174, 189, 212, 0.1); }
    #weather-panel.wdp-on[data-mbusy="1"] .msh-chip:hover,
    #weather-panel.wdp-on[data-mbusy="1"] .msh-rcard:hover { background: var(--msh-card); }
  }
}
/* @rail-end */
