/* ── 全站外框（2026-10-27 改版）：無色液態玻璃＋星空照片背景＋左側圖示列 ──
   標記在 _shell_v2.html，首頁在 _home_v2.html。固定深色主題。
   玻璃顏色／透明度／模糊在 theme.css（--color-surface／--glass-blur）；使用者在設定頁改的背景、強調色、玻璃、遮罩
   由 js/ui_prefs.js 寫到 <html> 的 CSS 變數（--ui-bg、--ui-mask、--color-accent…）。
   body.ui-v2-imm＝沉浸式全畫面頁（天球、望遠鏡模擬、器材箱 3D、像素編輯器）：外框位置跟一般頁一模一樣，
   內容區變成填滿剩下空間的圓角框；頁面自己的 calc(100dvh - var(--navbar-height)) 會剛好等於框的高度。 */

body.ui-v2 {
    --v2-gap: 12px;
    --v2-rail-w: 68px;
    --v2-left: calc(var(--v2-gap) * 2 + var(--v2-rail-w));
    --v2-safe-t: env(safe-area-inset-top, 0px);                          /* 狀態列（加到主畫面的 App 模式網頁會畫到最上緣） */
    --v2-safe-b: max(0px, calc(env(safe-area-inset-bottom, 0px) - 16px)); /* Home 條：底部分頁只多留這麼多 */
    --v2-bar-h: 56px;                 /* 頂列高度（手機有群組膠囊時變兩行） */
    --v2-views-h: 0px;                /* 視圖切換列＋上方間距 */
    --v2-bottom: var(--v2-gap);       /* 內容框下緣留白（手機要再讓出底部分頁） */
    --v2-glass: var(--color-surface);
    --v2-glass-strong: var(--color-surface-elevated);
    --v2-blur: var(--glass-blur);
    --v2-line: var(--color-border);
    --v2-line-soft: var(--color-border-subtle);
    --v2-mut: var(--color-text-secondary);
    --v2-amber: var(--color-accent);
    --v2-hover: rgba(255, 255, 255, 0.08);
    --v2-on: rgba(255, 255, 255, 0.15);
    --v2-page-x: clamp(20px, 2vw, 32px);   /* 內容左右留白（從頂列左右緣往內）：全站一致 */
    /* 圓角跟外框同一套（各頁卡片、按鈕、輸入框都吃這組 token）：小 6／中 10／大 14／特大 18 */
    --radius-sm: 6px; --radius-md: 10px; --radius-lg: 14px; --radius-xl: 18px;

    background: var(--ui-bg-color, #07061a);   /* 照片畫在下面的 ::before（固定在視窗上），這裡只放底色 */
    padding-left: var(--v2-left);
}
body.ui-v2.has-views { --v2-views-h: 56px; }
/* 背景照片＋遮罩（設定頁可調，預設 60%；照片下半部再往下壓更暗）。
   照片畫在固定在視窗上的這一層，大小＝視窗：手機上不會因為 iOS 不支援 background-attachment: fixed
   而被撐成整頁高度放大，只會照比例裁掉多出來的邊（cover＝裁切，不是拉伸） */
body.ui-v2::before {
    content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
    background-image:
        linear-gradient(180deg, transparent 0%, transparent 50%, rgba(0, 0, 0, 0.55) 100%),
        linear-gradient(rgba(0, 0, 0, var(--ui-mask, 0.6)), rgba(0, 0, 0, var(--ui-mask, 0.6))),
        var(--ui-bg, url('../photo/background.jpg'));
    background-size: auto, auto, cover;
    background-position: center, center, center 30%;
    background-repeat: no-repeat;
}
body.ui-v2 .site-sky { display: none; }
html.ui-bg-solid body.ui-v2::before { display: none; }   /* 純色背景沒有遮罩（設定頁） */

/* 共用玻璃 */
body.ui-v2 :is(.v2-rail, .v2-tile, .site-navbar) {
    background: var(--v2-glass);
    -webkit-backdrop-filter: var(--v2-blur); backdrop-filter: var(--v2-blur);
    border: 1px solid var(--v2-line);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 10px 40px rgba(0, 0, 0, 0.22);
}

/* ── 左側圖示列 ── */
.v2-rail {
    position: fixed; z-index: 120; left: var(--v2-gap); top: var(--v2-gap); bottom: var(--v2-gap);
    width: var(--v2-rail-w); border-radius: 18px;
    display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 0;
}
.v2-rail-item { position: relative; }
.v2-rail-btn {
    width: 56px; padding: 8px 0 8px; border-radius: 12px;
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    color: var(--v2-mut); font-size: 0.72rem; line-height: 1.1;   /* 不低於 11px（2026-11-16 UI 檢查） */
    transition: background-color 0.15s, color 0.15s;
}
.v2-rail-btn i { font-size: 22px; }
.v2-rail-btn:hover, .v2-rail-item:hover .v2-rail-btn { background: var(--v2-hover); color: var(--color-text); }
.v2-rail-btn:active { transform: translateY(1px) scale(0.98); }
.v2-rail-btn.is-on { background: var(--color-accent-soft); color: var(--v2-amber); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--v2-amber) 40%, transparent); }
.v2-rail-sp { flex: 1; }

/* ── 浮出選單：滑過圖示列的分類才出現（不常駐第二欄） ── */
.v2-fly {
    position: absolute; left: calc(100% + 10px); top: -6px; z-index: 130; min-width: 210px;
    padding: 8px; border-radius: 14px; display: flex; flex-direction: column; gap: 1px;
    background: var(--color-surface-elevated); -webkit-backdrop-filter: var(--v2-blur); backdrop-filter: var(--v2-blur); border: 1px solid var(--v2-line);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
    opacity: 0; visibility: hidden; transform: translateX(-4px);
    transition: opacity 0.15s, transform 0.15s, visibility 0s linear 0.15s;
}
.v2-fly::before { content: ""; position: absolute; left: -12px; top: 0; bottom: 0; width: 12px; }  /* 滑鼠移過去途中不斷 */
.v2-rail-item:hover .v2-fly, .v2-rail-item:focus-within .v2-fly {
    opacity: 1; visibility: visible; transform: none; transition: opacity 0.15s, transform 0.15s;
}
.v2-fly-h { font-size: 0.72rem; color: var(--v2-mut); padding: 4px 8px 8px; }
.v2-fly a {
    display: flex; align-items: center; gap: 8px; padding: 8px 8px; border-radius: 9px;
    font-size: 0.88rem; color: var(--color-text); white-space: nowrap; transition: background-color 0.12s;
}
.v2-fly a i { font-size: 18px; color: var(--v2-mut); }
.v2-fly a:hover { background: var(--v2-hover); }
.v2-fly a.is-on { color: var(--v2-amber); }
.v2-fly a.is-on i { color: var(--v2-amber); }

/* ── 同類頁面切換：併在最上面那條導覽列中間 ── */
.v2-tabs {
    flex: 1 1 auto; min-width: 0; display: flex; justify-content: safe center; gap: 2px;
    overflow-x: auto; scrollbar-width: none; padding: 0 8px;
}
.v2-tabs::-webkit-scrollbar { display: none; }
.v2-tabs a {
    flex: none; display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; white-space: nowrap;
    font-size: 0.85rem; color: var(--v2-mut); transition: background-color 0.15s, color 0.15s;
}
.v2-tabs a i { font-size: 17px; }
.v2-tabs a:hover { color: var(--color-text); background: var(--v2-hover); }
.v2-tabs a.is-on { color: var(--color-text); background: var(--v2-on); }
.v2-tabs a.is-on i { color: var(--v2-amber); }
.v2-tabs.is-tight a:not(.is-on) i { display: none; }
.v2-tabs.is-scroll { -webkit-mask-image: linear-gradient(90deg, transparent, #000 20px, #000 calc(100% - 20px), transparent); mask-image: linear-gradient(90deg, transparent, #000 20px, #000 calc(100% - 20px), transparent); }

/* 手機群組選單背後的遮罩 */
.v2-scrim { position: fixed; inset: 0; z-index: 115; background: rgba(0, 0, 0, 0.6); opacity: 0; visibility: hidden; transition: opacity 0.18s, visibility 0s linear 0.18s; }
body.v2-sheet-open .v2-scrim { opacity: 1; visibility: visible; transition: opacity 0.18s; }

/* ── 上方列：沿用原本的導覽列（通知、頭像、主題選單的 JS 都在），只拿掉中間的連結 ── */
body.ui-v2 .site-navbar {
    top: calc(var(--v2-gap) + var(--v2-safe-t)); margin: calc(var(--v2-gap) + var(--v2-safe-t)) var(--v2-gap) 0 0; border-radius: 16px;
    height: var(--v2-bar-h); padding: 0;
}
body.ui-v2 .site-navbar .container { max-width: none; padding: 0 12px; }
body.ui-v2 .navbar-right { margin-left: auto; flex: none; }
body.ui-v2 .navbar-brand { flex: none; }
body.ui-v2 .site-navbar:has(.v2-tabs) .navbar-brand-text { display: none; }   /* 有分頁時只留 logo，讓位置給膠囊 */
body.ui-v2 .site-navbar:not(:has(.v2-tabs)) .search-toggle-btn {
    position: absolute; left: 50%; transform: translateX(-50%);
    width: min(420px, 36vw); height: 38px; border-radius: 11px; justify-content: flex-start; gap: 8px; padding: 0 12px;
    background: var(--v2-hover); border: 1px solid var(--v2-line-soft); color: var(--v2-mut);
}
body.ui-v2 .site-navbar:not(:has(.v2-tabs)) .search-toggle-btn::after { content: "搜尋頁面、作品、成員…"; font-size: 0.85rem; }
:root[data-lang="en"] body.ui-v2 .site-navbar:not(:has(.v2-tabs)) .search-toggle-btn::after { content: "Search pages, works, members…"; }
body.ui-v2 .site-navbar .container { position: relative; }

body.ui-v2 main { min-height: calc(100vh - 80px); }
body.ui-v2 .site-footer { margin-right: var(--v2-gap); background: transparent; }

/* ── 首頁 bento ── */
.v2-home { padding: 12px var(--v2-page-x) 40px; }
.v2-hello { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 4px 4px 16px; }
.v2-hello h1 { font-size: clamp(1.6rem, 2.6vw, 2.1rem); letter-spacing: -0.02em; line-height: 1.2; text-wrap: balance; }
.v2-mut { color: var(--v2-mut); }
.v2-lab { font-size: 0.78rem; color: var(--v2-mut); }
.v2-btn {
    display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 11px;
    background: var(--v2-amber); color: var(--color-accent-text); font-weight: 600; font-size: 0.9rem;
    transition: transform 0.15s, filter 0.15s;
}
.v2-btn:hover { filter: brightness(1.06); }
.v2-btn:active { transform: translateY(1px) scale(0.98); }
.v2-more { display: inline-flex; align-items: center; justify-content: flex-end; min-height: 40px; min-width: 40px; margin-block: -8px; font-size: 0.8rem; color: var(--v2-mut); }   /* 點擊區 40px，外觀高度不變（2026-11-16 第 1 批） */
.v2-more:hover { color: var(--v2-amber); }

.v2-bento {
    display: grid; gap: var(--v2-gap);
    grid-template-columns: 1.35fr 1fr 1fr;
    grid-template-areas:
        "feat wx now"
        "feat wx ev"
        "news news works"
        "quick quick quick";
}
.v2-tile { border-radius: 18px; padding: 16px; min-width: 0; position: relative; overflow: hidden; }
.v2-tile-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }

.v2-feat { grid-area: feat; padding: 0; min-height: 380px; display: flex; align-items: flex-end; color: var(--color-text); }
.v2-feat img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s; }
.v2-feat-cap {
    position: relative; width: 100%; padding: 16px 16px;
    background: var(--v2-glass-strong); -webkit-backdrop-filter: var(--v2-blur); backdrop-filter: var(--v2-blur);
    border-top: 1px solid var(--v2-line);
}
.v2-feat-title { font-size: 1.15rem; font-weight: 600; margin: 2px 0; }
.v2-skycov { background: #070a14; }
.v2-skycov canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; transition: transform 0.6s; }

.v2-wx { grid-area: wx; display: flex; flex-direction: column; }
.v2-wx .hpn-wx-body { flex: 1; }
.v2-wx .v2-more { margin-top: 8px; }
.v2-loc { position: relative; display: flex; align-items: center; gap: 4px; color: var(--v2-mut); }
.v2-loc select { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.v2-now { grid-area: now; }
.v2-events { grid-area: ev; }
.v2-news { grid-area: news; padding-bottom: 8px; }
.v2-works { grid-area: works; }
.v2-quick { grid-area: quick; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 12px; }

.v2-ev { display: grid; grid-template-columns: 44px 1fr auto; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--v2-line-soft); font-size: 0.88rem; }
.v2-ev:first-of-type { border-top: 0; }
.v2-ev-d { font-variant-numeric: tabular-nums; font-weight: 600; }
.v2-ev-t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v2-ev.is-today .v2-ev-d, .v2-ev:hover .v2-ev-t { color: var(--v2-amber); }

.v2-row { display: flex; gap: 12px; padding: 8px 8px; margin: 0 -8px; border-top: 1px solid var(--v2-line-soft); border-radius: 10px; transition: background-color 0.15s; }
.v2-row:hover { background: var(--v2-hover); }
.v2-row.is-pin { box-shadow: inset 3px 0 var(--v2-amber); }
.v2-row-av { flex: none; width: 40px; height: 40px; border-radius: 10px; overflow: hidden; display: flex; align-items: center; justify-content: center; background: var(--v2-hover); font-size: 18px; color: var(--v2-mut); }
.v2-row-av img { width: 100%; height: 100%; object-fit: cover; }
.v2-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.v2-row-t { display: flex; justify-content: space-between; gap: 8px; }
.v2-row-t b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v2-row-t .v2-mut { font-size: 0.78rem; font-variant-numeric: tabular-nums; flex: none; }
.v2-row-s { font-size: 0.8rem; color: var(--v2-mut); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.v2-shots { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.v2-shots a { aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden; background: var(--v2-hover); }
.v2-shots img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s; }

.v2-chip {
    display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; font-size: 0.86rem;
    background: var(--v2-hover); border: 1px solid var(--v2-line-soft); transition: background-color 0.15s, border-color 0.15s;
}
.v2-chip i { font-size: 17px; color: var(--v2-amber); }
.v2-chip:hover { background: var(--v2-on); border-color: var(--v2-line); }
.v2-quick .v2-lab { margin-right: 4px; }

/* home.css 的天氣元件是為主視覺側欄寫的，放進格子裡微調 */
.v2-tile .hpn-wx-skel { min-height: 120px; }
.v2-now .hpn-now-body { margin-top: 8px; }

@media (max-width: 1180px) {
    .v2-bento { grid-template-columns: 1fr 1fr; grid-template-areas: "feat feat" "wx now" "wx ev" "news news" "works works" "quick quick"; }
    .v2-feat { min-height: 300px; }
    .v2-shots { grid-template-columns: repeat(4, 1fr); }
}

/* ── 手機：圖示列變底部分頁、分類選單變上方膠囊 ── */
@media (max-width: 860px) {
    /* 手機：上下兩條膠囊加高、往邊緣延伸（離邊 8px）；有 Home 指示條的 iPhone 底部分頁再高一點點，圖示留在指示條上面 */
    body.ui-v2 {
        --v2-gap: 8px; --v2-bar-h: 62px; --v2-rail-h: 72px; --v2-page-x: 16px;   /* Home 條只多留 --v2-safe-b（膠囊蓋過去一點），狀態列 --v2-safe-t 在上面 */
        --v2-bottom: calc(var(--v2-rail-h) + var(--v2-gap) * 2 + var(--v2-safe-b));
        padding-left: 0; padding-bottom: var(--v2-bottom);
    }
    .v2-rail {
        top: auto; left: var(--v2-gap); right: var(--v2-gap); bottom: var(--v2-gap);
        width: auto; height: calc(var(--v2-rail-h) + var(--v2-safe-b)); flex-direction: row; justify-content: space-around;
        align-items: stretch; padding: 4px 8px calc(4px + var(--v2-safe-b)); border-radius: 24px;
    }
    .v2-rail-item { flex: 1; display: flex; justify-content: center; }
    .v2-rail-btn { width: 100%; height: 100%; justify-content: center; border-radius: 16px; }
    .v2-rail-sp { display: none !important; }
    /* 群組選單變成從底部分頁上方升起的面板（js/ui_v2.js 加 .is-open）；滑過／聚焦不再自己跳出 */
    .v2-rail-item { position: static; }
    .v2-fly {
        left: 0; right: 0; top: auto; bottom: calc(100% + 10px); min-width: 0; max-height: min(64vh, 520px); overflow-y: auto;
        display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 12px; border-radius: 20px;
        transform: translateY(8px);
    }
    .v2-fly::before { content: none; }
    .v2-rail-item:hover .v2-fly, .v2-rail-item:focus-within .v2-fly { opacity: 0; visibility: hidden; transform: translateY(8px); transition: opacity 0.15s, transform 0.15s, visibility 0s linear 0.15s; }
    .v2-rail-item.is-open .v2-fly { opacity: 1; visibility: visible; transform: none; transition: opacity 0.18s, transform 0.18s; }
    .v2-fly-h { grid-column: 1 / -1; font-size: 0.8rem; padding: 2px 8px 4px; }
    .v2-fly a {
        flex-direction: column; justify-content: center; gap: 8px; min-height: 76px; padding: 8px 8px; border-radius: 14px;
        font-size: 0.8rem; text-align: center; white-space: normal; line-height: 1.25; background: rgba(255, 255, 255, 0.05);
    }
    .v2-fly a i { font-size: 22px; }
    .v2-fly a.is-on { background: var(--color-accent-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--v2-amber) 40%, transparent); }
    .v2-rail-item:hover .v2-rail-btn:not(.is-on) { background: none; color: var(--v2-mut); }
    .v2-rail-item.is-open .v2-rail-btn { background: var(--v2-on); color: var(--color-text); }
    /* 頂列：不放群組膠囊（底部分頁已經能切），只留社名 */
    body.ui-v2 .v2-tabs { display: none; }
    body.ui-v2 .site-navbar:has(.v2-tabs) .navbar-brand-text { display: flex; flex-direction: column; justify-content: center; }
    body.ui-v2 .site-navbar { margin: calc(var(--v2-gap) + var(--v2-safe-t)) var(--v2-gap) 0; border-radius: 20px; }
    /* 社名可以縮（省略號），右邊按鈕永遠留在畫面裡（工具頁多了 AI 接管／使用說明時 375px 會擠爆，2026-11-16） */
    body.ui-v2 .navbar-brand { flex: 0 1 auto; min-width: 0; }
    body.ui-v2 .navbar-brand-text { min-width: 0; }
    body.ui-v2 .navbar-right { flex: none; }
    body.ui-v2 .search-toggle-btn, body.ui-v2 .site-navbar:not(:has(.v2-tabs)) .search-toggle-btn {
        position: static; transform: none; width: 40px; height: 40px; padding: 0; justify-content: center; display: inline-flex;
        background: none; border: 0; }
    /* 手機底部分頁只留分類＋設定：管理從頭像選單進、搜尋在頂列 */
    .v2-rail-admin, .v2-rail-search { display: none !important; }
    body.ui-v2 .search-toggle-btn::after, body.ui-v2 .site-navbar:not(:has(.v2-tabs)) .search-toggle-btn::after { content: none; }
    body.ui-v2 .site-footer { margin-left: 0; margin-right: 0; }
    .v2-home { padding: 12px var(--v2-page-x) 24px; }
    .v2-bento { grid-template-columns: 1fr; grid-template-areas: "feat" "wx" "now" "ev" "news" "works" "quick"; }
    .v2-feat { min-height: 240px; }
    .v2-shots { grid-template-columns: 1fr 1fr; }
    .v2-hello .v2-btn { display: none; }
}

/* ── 視圖切換：同一群組合併的頁面（天氣／颱風／日全食…），內容最上方置中一排分段鈕 ── */
.v2-views {
    display: flex; width: fit-content; max-width: calc(100% - var(--v2-gap) * 2); height: 44px; margin: var(--v2-gap) auto 0;
    padding: 4px; gap: 2px; border-radius: 12px; overflow-x: auto; scrollbar-width: none;
    background: var(--v2-glass); -webkit-backdrop-filter: var(--v2-blur); backdrop-filter: var(--v2-blur);
    border: 1px solid var(--v2-line);
}
.v2-views::-webkit-scrollbar { display: none; }
.v2-views a {
    flex: none; display: flex; align-items: center; padding: 0 16px; border-radius: 9px; font-size: 0.86rem; white-space: nowrap;
    color: var(--v2-mut); transition: background-color 0.15s, color 0.15s;
}
.v2-views a:hover { color: var(--color-text); background: var(--v2-hover); }
.v2-views a.is-on { color: var(--color-accent-text); background: var(--v2-amber); font-weight: 600; }
body.ui-v2 .v2-views { transform: translateX(calc(var(--v2-gap) / -2)); }

/* ── 沉浸式全畫面頁：外框不動，內容區是一個填滿剩下空間的框 ── */
body.ui-v2.ui-v2-imm {
    --navbar-height: calc(var(--v2-gap) * 2 + var(--v2-safe-t) + var(--v2-bar-h) + var(--v2-views-h) + var(--v2-bottom));
    height: 100dvh; overflow: hidden;
}
body.ui-v2-imm main {
    margin: var(--v2-gap) var(--v2-gap) 0 0; border-radius: 18px; overflow: hidden;
    border: 1px solid var(--v2-line); min-height: 0;
    height: calc(100dvh - var(--navbar-height));
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}
@media (max-width: 860px) {
    body.ui-v2-imm main { margin: var(--v2-gap) var(--v2-gap) 0; }
}

/* ── 內容間距：全站一致的左右留白、上下節奏 ── */
/* 內容左右緣對齊頂列的左右緣（頂列已經在留白裡），每頁一樣；不再置中留兩大塊空白 */
body.ui-v2 main > .container, body.ui-v2 main .container { max-width: none; padding-left: var(--v2-page-x); padding-right: var(--v2-page-x); }
/* 導覽頁（列表、工具）不再各自限寬置中：內容跟頁面列同一條左右緣；內頁（公告全文等）照舊可以窄 */
body.ui-v2.is-nav-page main .container { width: auto !important; max-width: none !important; }
body.ui-v2:not(.ui-v2-imm) main { padding-right: var(--v2-gap); }
@media (max-width: 860px) { body.ui-v2:not(.ui-v2-imm) main { padding-left: 0; padding-right: 0; } }
body.ui-v2 .page-header { padding: 28px 0 20px; }
body.ui-v2 .site-footer .container { max-width: none; padding: 0 var(--v2-page-x); }

/* ── 導覽列上就看得到的頁面：頁內大標題（例如「影像藝廊」）跟導覽重複，不留 ── */
body.is-nav-page main h1:not(.lb-title):not(.sr-only):not(.keep-title),
body.is-nav-page main h1:not(.lb-title):not(.sr-only):not(.keep-title) + p,
body.is-nav-page main :is(.wx-sub, .sci-lh-sub) { display: none; }
body.is-nav-page .page-header:not(:has(> :not(div):not(h1):not(p))):not(:has(> div > :not(h1):not(p))) { display: none; }   /* 只剩標題的整塊收掉 */
body.is-nav-page .page-header { padding-top: 20px; }
/* 影像藝廊原本的「天球藝廊」連結：上方已有作品牆／天球切換 */
body.ui-v2 .gallery-sky-link { display: none; }

/* ── 頁面列（js/ui_v2.js 組出來）：中＝視圖切換／頁內分頁籤（固定置中）、左＝篩選與搜尋、右＝排序與動作鈕 ── */
.v2-pagebar {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px 12px;
    margin: 12px 0 20px; padding: 0 var(--v2-page-x); min-height: 44px;
}
.v2-pagebar.has-c { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
.v2-pagebar-l, .v2-pagebar-r { display: flex; align-items: center; gap: 8px; min-width: 0; }
/* 篩選太長就在自己的玻璃框裡橫向滑（左區本身不裁切，下拉選單才不會被切掉） */
.v2-pagebar-l > :is(.lb-tabs, .v2-fsel) { flex: 0 1 auto !important; min-width: 0; }
.v2-pagebar-l :is(.gallery-filters, .news-filters, .lb-tabs) { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.v2-pagebar-l :is(.gallery-filters, .news-filters, .lb-tabs)::-webkit-scrollbar { display: none; }
.v2-fsel { position: relative; display: flex; min-width: 0; }
.v2-fsel-btn { display: none; }
.v2-pagebar-r { justify-content: flex-end; flex-wrap: wrap; }
.v2-pagebar-c { display: flex; justify-content: center; }
.v2-pagebar :is(.v2-pagebar-l, .v2-pagebar-r) > * { margin: 0 !important; flex: none; }
body.ui-v2 .v2-pagebar-c > * { margin: 0; transform: none; flex: none; max-width: 100%; }
.v2-pagebar-l > .members-search { flex: 0 1 360px; }
@media (max-width: 860px) {
    .v2-pagebar, .v2-pagebar.has-c { display: flex; flex-wrap: wrap; margin-top: 12px; }
    .v2-pagebar-c { order: 0; flex: 1 1 100%; min-width: 0; }
    /* 視圖切換／頁內分頁比螢幕寬時：在膠囊裡橫向捲，不撐破整頁（2026-10-28） */
    body.ui-v2 .v2-pagebar-c > * { flex: 0 1 auto; min-width: 0; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
    body.ui-v2 .v2-pagebar-c > *::-webkit-scrollbar { display: none; }
    body.ui-v2 .v2-pagebar-c > * > * { flex: none; }
    body.ui-v2 .v2-pagebar-c .v2-views a, body.ui-v2 .v2-pagebar-c .pk-tab { padding: 0 12px; }
    .v2-pagebar-l { order: 1; flex: 1 1 auto; }
    .v2-pagebar-r { order: 2; margin-left: auto; }
    .v2-pagebar-l:empty, .v2-pagebar-r:empty { display: none; }
    /* 分類篩選：一顆「⏷ 目前分類 ▾」，點開才是選單 */
    .v2-fsel-btn {
        display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 12px; border-radius: 12px; cursor: pointer;
        border: 1px solid var(--v2-line); background: var(--v2-glass); -webkit-backdrop-filter: var(--v2-blur); backdrop-filter: var(--v2-blur);
        color: var(--color-text); font: inherit; font-size: 0.88rem; font-weight: 600; white-space: nowrap;
    }
    .v2-fsel-btn i { font-size: 17px; color: var(--v2-amber); }
    .v2-fsel-btn .v2-fsel-chev { color: var(--v2-mut); transition: transform 0.15s; }
    .v2-fsel.is-open .v2-fsel-chev { transform: rotate(180deg); }
    body.ui-v2 .v2-fsel > :is(.gallery-filters, .news-filters) {
        position: absolute; z-index: 60; top: calc(100% + 8px); left: 0; width: min(320px, calc(100vw - 24px)) !important; height: auto !important; max-width: none !important;
        display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding: 8px; overflow: visible !important; border-radius: 16px; margin: 0 !important;
        background: var(--color-surface-elevated); box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
        opacity: 0; visibility: hidden; transform: translateY(-4px); transition: opacity 0.15s, transform 0.15s, visibility 0s linear 0.15s;
    }
    body.ui-v2 .v2-fsel.is-open > :is(.gallery-filters, .news-filters) { opacity: 1; visibility: visible; transform: none; transition: opacity 0.15s, transform 0.15s; }
    body.ui-v2 .v2-fsel :is(.filter-btn) { height: 40px; justify-content: flex-start; margin: 0 !important; }
    /* 右邊的動作鈕、排序：手機只留圖示 */
    .v2-pagebar-r :is(a, button):has(> svg, > i.ti) > span { display: none; }
    .v2-pagebar-r :is(a.btn, button.btn):has(> svg, > i.ti) { width: 44px; min-width: 44px; height: 44px; padding: 0; justify-content: center; }
    body.ui-v2 .v2-pagebar-r .sort-btn:has(> svg) { width: 40px; padding: 0; justify-content: center; }
    /* 左邊沒有篩選時（例：行事曆），右邊這排自己佔一整列：置中、按鈕留文字，不要只剩一顆孤零零的方塊（2026-11-16） */
    .v2-pagebar:has(> .v2-pagebar-l:empty) > .v2-pagebar-r { flex: 1 1 100%; margin-left: 0; justify-content: center; gap: 16px; }
    .v2-pagebar:has(> .v2-pagebar-l:empty) > .v2-pagebar-r :is(a, button):has(> svg, > i.ti) > span { display: inline; }
    .v2-pagebar:has(> .v2-pagebar-l:empty) > .v2-pagebar-r :is(a.btn, button.btn):has(> svg, > i.ti) { width: auto; padding: 0 16px; gap: 8px; }
}

/* ── 篩選、排序、頁內分頁籤：跟視圖切換同一種玻璃分段鈕 ── */
body.ui-v2 :is(.gallery-filters, .news-filters, .gallery-sort, .cal-tabs, .lb-tabs, .v2-pagebar .pk-tabs, .ag-tabs) {
    display: inline-flex; align-items: center; flex-wrap: nowrap; gap: 2px; height: 44px; min-height: 0; padding: 4px; width: auto;
    border-radius: 12px; border: 1px solid var(--v2-line); box-shadow: none;
    background: var(--v2-glass); -webkit-backdrop-filter: var(--v2-blur); backdrop-filter: var(--v2-blur);
}
body.ui-v2 :is(.filter-btn, .sort-btn, .cal-tab, .lb-tab, .v2-pagebar .pk-tab, .ag-tab) {
    display: inline-flex; align-items: center; gap: 8px; height: 34px; min-height: 0; padding: 0 12px; border-radius: 9px;
    border: 0; background: none; box-shadow: none; color: var(--v2-mut); font-size: 0.86rem; white-space: nowrap;
    transition: background-color 0.15s, color 0.15s;
}
body.ui-v2 :is(.filter-btn, .sort-btn, .cal-tab, .lb-tab, .v2-pagebar .pk-tab, .ag-tab):hover { color: var(--color-text); background: var(--v2-hover); }
body.ui-v2 :is(.filter-btn.active, .sort-btn.active) { color: var(--color-text); background: var(--v2-on); font-weight: 600; }
body.ui-v2 :is(.cal-tab.is-on, .lb-tab.is-on, .v2-pagebar .pk-tab.is-active, .ag-tab.is-on) { color: var(--color-accent-text); background: var(--v2-amber); font-weight: 600; }
body.ui-v2 .lb-tabs .lb-search { margin-left: 8px; }

/* ── 真正全畫面的沉浸頁（body.imm-bleed，目前是天球）：內容鋪滿整個視窗、在外框玻璃底下；
   頁面自己的浮動元件用 --imm-t／--imm-l／--imm-r／--imm-b 避開外框（各頁 CSS 自己套）。視圖切換放進頁面的 [data-v2-views-slot] ── */
body.ui-v2.imm-bleed {
    --v2-views-h: 0px;
    --navbar-height: 0px;
    --imm-t: calc(var(--v2-gap) * 2 + var(--v2-safe-t) + var(--v2-bar-h));
    --imm-l: var(--v2-left);
    --imm-r: var(--v2-gap);
    --imm-b: var(--v2-gap);
}
body.ui-v2-imm.imm-bleed main {
    position: fixed; inset: 0; z-index: 0; margin: 0; height: auto;
    border: 0; border-radius: 0; box-shadow: none; overflow: hidden;
}
@media (max-width: 860px) {
    body.ui-v2.imm-bleed { --imm-l: var(--v2-gap); --imm-b: var(--v2-bottom); }
    body.ui-v2-imm.imm-bleed main { margin: 0; }
}
[data-v2-views-slot] { display: contents; }
body.ui-v2 [data-v2-views-slot] > .v2-views { margin: 0; transform: none; flex: none; }

/* 回主大廳／遊戲大廳的返回鈕：頂列就有大廳和每個遊戲的分頁，不重複 */
body.ui-v2 :is(a.back-link[href="/games"], a[href="/lobby"]:is(.rpg-back, .air-back, .ck-back)) { display: none !important; }
/* 頁面列裡的搜尋框：跟分段鈕同高、同一種玻璃 */
body.ui-v2 .v2-pagebar .members-search {
    height: 44px; border-radius: 12px; padding: 0 12px; border: 1px solid var(--v2-line);
    background: var(--v2-glass); -webkit-backdrop-filter: var(--v2-blur); backdrop-filter: var(--v2-blur);
}


/* 成員搜尋即時建議（js/member_suggest.js） */
.msug {
    position: absolute; z-index: 70; top: calc(100% + 6px); left: 0; right: 0; min-width: 260px; margin: 0; padding: 8px; list-style: none;
    border-radius: 14px; background: var(--color-surface-elevated); border: 1px solid var(--color-border);
    -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}
.msug-item { display: flex; align-items: center; gap: 8px; padding: 8px 8px; border-radius: 10px; color: var(--color-text); }
.msug-item:hover, .msug-item.is-on { background: rgba(255, 255, 255, 0.08); }
.msug-av { flex: none; width: 32px; height: 32px; border-radius: 50%; overflow: hidden; background: rgba(255, 255, 255, 0.08); display: grid; place-items: center; }
.msug-av img { width: 100%; height: 100%; object-fit: cover; }
.msug-av-empty { font-size: 0.8rem; color: var(--color-text-secondary); }
.msug-text { display: flex; flex-direction: column; min-width: 0; }
.msug-text b { font-size: 0.9rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msug-text small { font-size: 0.76rem; color: var(--color-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msug-none { padding: 8px 12px; font-size: 0.84rem; color: var(--color-text-muted); }

/* 換頁時內容不要從全透明慢慢淡入（theme.css 的 page-in 0.3s 會讓人覺得「導覽先到、內容後到」）：縮成幾乎察覺不到 */
body.ui-v2 main { animation-duration: 0.12s; }

/* 頂端留背景區只做在首頁（首屏，見下方 .v2-home .v2-hello）；其他頁內容直接從頂列下面開始 */
@media (max-width: 860px) {
    /* 頭像選單別蓋到底部分頁 */
    body.ui-v2 .navbar-user-dropdown { max-height: calc(100dvh - var(--v2-bar-h) - var(--v2-bottom) - 40px); }
}

/* ── 首頁首屏（2026-10-27）：打開只有背景＋問候，往下滑問候淡出（--hp 由 ui_v2.js 依捲動算 0→1）、格子一塊塊浮上來 ── */
.v2-home .v2-hello {
    position: relative; display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-start;
    min-height: calc(100dvh - var(--v2-gap) * 2 - var(--v2-safe-t) - var(--v2-bar-h) - var(--v2-bottom) - 14px);
    padding: 0 4px clamp(64px, 9vh, 88px); margin-bottom: 0;   /* 下面留給「往下看」提示；縮回後問候就在格子上方 */
}
/* 往下滑問候不淡出：大字隨捲動縮回一般標題大小（左下角為基準），停在格子上方＝回到原本的位置 */
.v2-home .v2-hello > div:first-child {
    transform-origin: left bottom; transform: scale(calc(1 - var(--hp, 0) * 0.5)); will-change: transform;
}
.v2-home .v2-hello h1 { font-size: clamp(2.4rem, 6vw, 5rem); font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; text-shadow: 0 2px 30px rgba(0, 0, 0, 0.35); }
.v2-home .v2-hello #v2-date { font-size: clamp(0.9rem, 1.3vw, 1.1rem); margin-bottom: 8px; color: rgba(255, 255, 255, 0.78); }
.v2-scrollcue {
    position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%);
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    font-size: 0.78rem; color: rgba(255, 255, 255, 0.7); opacity: calc(1 - var(--hp, 0) * 3);
}
.v2-scrollcue .ti { font-size: 22px; }   /* 2026-11-16 unslop：不再上下跳 */
@keyframes v2-bob { 50% { transform: translateY(5px); } }
/* 格子浮上來：比全站的淡入多一點位移與縮放，慢一點 */
.js-reveal .v2-home .v2-tile.reveal { opacity: 0; transform: translateY(48px) scale(0.97); transition: opacity 0.9s cubic-bezier(.2, .7, .2, 1), transform 0.9s cubic-bezier(.2, .7, .2, 1); }
.js-reveal .v2-home .v2-tile.reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
    .v2-home .v2-hello > div:first-child, .v2-scrollcue { opacity: 1; transform: none; }
    .v2-scrollcue .ti { animation: none; }
}
@media (max-width: 860px) {
    /* 首屏剛好到底部分頁上緣：扣掉頂列（含上方間距）、首頁上方 12px、底部分頁（含下方間距與 Home 指示條） */
    .v2-home .v2-hello { padding-bottom: 64px;
        min-height: calc(100dvh - var(--v2-gap) * 2 - var(--v2-safe-t) - var(--v2-bar-h) - var(--v2-rail-h) - 12px - var(--v2-safe-b)); }
}

/* 分頁／切換按鈕的圖示（2026-10-27）：跟行事曆／活動報名那組一樣，每個分頁都有一個 SVG 圖示 */
body.ui-v2 :is(.v2-views a, .filter-btn, .sort-btn, .lb-tab, .v2-pagebar .pk-tab) > .ti { font-size: 16px; flex: none; margin-right: 2px; }
body.ui-v2 .v2-views a { gap: 8px; }

/* 底圖作者（2026-10-28）：在頁尾小字列，接在資料來源後面 */
.ft-bgcredit::before { content: " · "; }
.ft-bgcredit[hidden] { display: none; }

/* 狀態列底（App 模式）：網頁捲到時間、電量後面時，鋪一層深色漸層讓字看得清楚；沒有狀態列（一般瀏覽器）高度是 0 */
body.ui-v2::after {
    content: ""; position: fixed; z-index: 130; top: 0; left: 0; right: 0; height: var(--v2-safe-t); pointer-events: none;
    background: linear-gradient(180deg, rgba(5, 5, 10, 0.85), rgba(5, 5, 10, 0.55));
}

/* ── 手機點下去要有感（2026-10-28）：導覽、分頁、篩選按住時亮底＋微縮，不用等新頁才知道有沒有按到 ── */
body.ui-v2 :is(.v2-rail-btn, .v2-fly a, .v2-tabs a, .v2-views a, .filter-btn, .sort-btn, .cal-tab, .lb-tab, .pk-tab, .ag-tab) {
    -webkit-tap-highlight-color: transparent;
}
@media (max-width: 860px) {
    body.ui-v2 :is(.v2-rail-btn, .v2-fly a, .v2-tabs a, .v2-views a, .filter-btn, .sort-btn, .cal-tab, .lb-tab, .pk-tab, .ag-tab):active {
        background: var(--v2-hover); transform: scale(0.95); transition: transform 0.06s, background-color 0.06s;
    }
}

/* 手機不放底部分頁的頁面（2026-11-17，body.v2-norail；望遠鏡模擬）：頁面自己底下就有一排分頁，兩排疊在一起太擠。
   上排的站名（回首頁）、搜尋、通知照常在；要去別的分類從站名回首頁。 */
@media (max-width: 860px) {
    body.ui-v2.v2-norail { --v2-rail-h: 0px; --v2-bottom: var(--v2-safe-b); }
    body.ui-v2.v2-norail .v2-rail { display: none; }
}
