﻿/* ==========================================================
   首頁活動列表（Views/Home/Index.cshtml、Ended.cshtml 與其 partial）
   視覺基準：日程清單＋日期列＋狀態色條
   斷點：>= 992px 桌機列式；< 992px 手機堆疊卡片
   所有類別一律 ya- 前綴，避免與 Bootstrap 及 newStyle2022.css 衝突
   ========================================================== */

/* ---------- 1. 變數（以 .ya-page 為作用域） ---------- */
/* 注意：--ya-strip-h（sticky 日期列的實際高度，不 sticky 時 0）與 --ya-head-h（sticky 組標題的實際高度，不 sticky 時 0）
   由 activity-list.js 寫入，此處不宣告；使用處一律寫成 var(--ya-strip-h, var(--ya-strip-fallback)) 等形式。
   fallback 為無 JS 時的約略高度：--ya-strip-fallback 一律 0（sticky 的小日期列只在 JS 加上 is-stuck 後才顯示，
   無 JS 時不佔頂端空間）；--ya-head-fallback 桌機 44px（組標題 sticky）、手機 0 */
.ya-page {
    --ya-strip-fallback: 0px;
    --ya-head-fallback: 0px;
    --ya-primary: #03857D;
    --ya-gold: #F2B33D;
    --ya-bg: #F6F9F9;
    --ya-text: #1F2933;
    --ya-muted: #5B6770;
    --ya-dark: #0A5652;
    --ya-tint: #E6F2F1;
    --ya-sub: #3E5B58;
    --ya-line: #DCE5E4;
    --ya-divider: #EDF1F1;
    --ya-field: #C9D3D2;
    --ya-focus: #0B6E79;
    --ya-ok: #1E8E3E;
    --ya-ok-bg: #E7F4EA;
    --ya-ok-text: #17722F;
    --ya-warn: #E0A030;
    --ya-warn-bg: #FFF4E0;
    --ya-warn-text: #8F5400;
    --ya-urgent: #9A5B00;
    --ya-off: #D5DBDF;
    --ya-grey: #6B7280;
    --ya-grey-bg: #EEF0F2;
    --ya-grey-text: #5B6470;
}

/* ---------- 2. 頁面骨架 ---------- */
/* 只有列表頁改用平面淺底；不支援 :has() 的瀏覽器維持原本漸層底 */
body:has(.ya-page) {
    background: #F6F9F9;
}

body:has(.ya-page) #main {
    width: 100%;
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
}

.ya-page {
    max-width: 1280px;
    margin: 0 auto;
    padding: 20px 32px 40px;
    color: var(--ya-text);
}

.ya-page .sr-only-focusable:focus {
    display: inline-block;
    margin-bottom: 8px;
    padding: 6px 12px;
    border-radius: 6px;
    background: #fff;
    color: var(--ya-dark);
}

.ya-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px 24px;
    margin-bottom: 18px;
}

.ya-head-text {
    min-width: 0;
}

.ya-title {
    margin: 0;
    font-size: 32px;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: .02em;
    color: var(--ya-text);
}

.ya-summary {
    margin: 8px 0 0;
    font-size: 14px;
    color: var(--ya-muted);
}

/* ---------- 3. 分頁列（分頁標籤＋工具列） ---------- */
/* 底線畫在整列上；分頁標籤永遠在最後一行並靠下對齊，使用中分頁的主色短線（bottom:-1px）疊在底線上。
   >= 1200px 分頁標籤與工具列同一列、工具列靠右；1199px 以下工具列獨立一列排到分頁標籤上方（見本節最後） */
.ya-tabsrow {
    display: flex;
    align-items: flex-end;
    gap: 10px 16px;
    border-bottom: 1px solid var(--ya-line);
}

.ya-tabs {
    display: flex;
    flex: none;
    gap: 4px;
}

.ya-tab {
    position: relative;
    padding: 10px 18px;
    font-size: 15px;
    font-weight: 500;
    color: var(--ya-muted);
    text-decoration: none;
}

.ya-tab:hover {
    color: var(--ya-dark);
    text-decoration: none;
}

.ya-tab.is-active {
    font-weight: 700;
    color: var(--ya-dark);
}

.ya-tab.is-active::after {
    content: "";
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: -1px;
    height: 3px;
    border-radius: 2px;
    background: var(--ya-primary);
}

.ya-tab em {
    margin-left: 6px;
    padding: 1px 7px;
    border-radius: 10px;
    background: var(--ya-tint);
    font-size: 12px;
    font-style: normal;
    color: var(--ya-dark);
}

/* ---------- 4. 工具列（搜尋與篩選） ---------- */
/* 增強成功才由 activity-list.js 加上 ya-js；無 JS 或載入失敗仍可瀏覽列表 */
html:not(.ya-js) .ya-enhance {
    display: none;
}

/* 欄位標題為 sr-only（絕對定位，不佔 flex 空間）；搜尋框、下拉與按鈕同高 40px */
.ya-tools {
    display: flex;
    flex: 0 1 auto;
    align-items: center;
    gap: 10px;
    min-width: 0;
    margin-left: auto;
    padding-bottom: 8px;
}

/* 寬度寫在 width（不只寫 flex-basis）：工具列以子項的內容寬度計算自身寬度，否則會依輸入框的預設寬度縮小 */
.ya-search {
    display: flex;
    flex: 0 1 auto;
    align-items: center;
    width: 280px;
    gap: 8px;
    min-width: 0;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--ya-field);
    border-radius: 8px;
    background: #fff;
    color: var(--ya-muted);
}

.ya-search svg {
    flex: none;
}

.ya-search input {
    flex: 1;
    min-width: 0;
    height: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    font: inherit;
    font-size: 14px;
    color: var(--ya-text);
}

.ya-search input::placeholder {
    color: var(--ya-muted);
    opacity: 1;
}

.ya-search input:focus,
.ya-search input:focus-visible {
    outline: none;
}

/* 焦點框畫在外框上，避免被輸入框高度裁切 */
.ya-search:focus-within {
    border-color: var(--ya-primary);
    outline: 2px solid var(--ya-focus);
    outline-offset: 2px;
}

/* 下拉最寬約 170px；選項文字過長時由瀏覽器原生截斷 */
.ya-select {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 170px;
    height: 40px;
    padding: 0 34px 0 12px;
    border: 1px solid var(--ya-field);
    border-radius: 8px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%235B6770' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center;
    font: inherit;
    font-size: 14px;
    color: var(--ya-text);
    text-overflow: ellipsis;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.ya-select:hover {
    border-color: var(--ya-primary);
}

.ya-switch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    margin: 0;
    font-size: 14px;
    color: var(--ya-text);
    cursor: pointer;
}

.ya-switch input {
    position: relative;
    flex: none;
    width: 36px;
    height: 20px;
    margin: 0;
    border-radius: 10px;
    background: #7B868D;
    cursor: pointer;
    transition: background-color .15s;
    -webkit-appearance: none;
    appearance: none;
}

.ya-switch input::before {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 40, 40, .25);
    transition: transform .15s;
}

.ya-switch input:checked {
    background: var(--ya-primary);
}

.ya-switch input:checked::before {
    transform: translateX(16px);
}

.ya-clear {
    display: inline-flex;
    align-items: center;
    height: 44px;
    padding: 0 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    color: var(--ya-dark);
    cursor: pointer;
}

.ya-clear:hover {
    background: var(--ya-tint);
    color: var(--ya-dark);
    text-decoration: none;
}

.ya-submit {
    height: 44px;
    padding: 0 18px;
    border: 1px solid var(--ya-primary);
    border-radius: 8px;
    background: var(--ya-primary);
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
}

.ya-submit:hover {
    border-color: var(--ya-dark);
    background: var(--ya-dark);
}

/* 工具列內的開關、按鈕與清除連結與搜尋框同高，不換行 */
.ya-tools .ya-switch,
.ya-tools .ya-submit,
.ya-tools .ya-clear {
    flex: none;
    white-space: nowrap;
}

.ya-tools .ya-switch {
    min-height: 40px;
}

.ya-tools .ya-submit,
.ya-tools .ya-clear {
    height: 40px;
}

/* 576–1199px：工具列獨立一列、排到分頁標籤上方，搜尋框佔剩餘寬度 */
@media (max-width: 1199.98px) {
    .ya-tabsrow {
        flex-wrap: wrap;
    }

    .ya-tools {
        order: -1;
        flex: 1 1 100%;
        margin-left: 0;
        padding-bottom: 0;
    }

    .ya-search {
        flex: 1 1 200px;
    }
}

/* < 576px：搜尋框一整列；下拉（各佔一半）與開關（已結束頁為搜尋鈕、清除連結）在下一列 */
@media (max-width: 575.98px) {
    .ya-tools {
        flex-wrap: wrap;
        gap: 8px;
    }

    .ya-search {
        flex: 1 1 100%;
    }

    /* 縮小右側留白，窄下拉能多顯示幾個字 */
    .ya-select {
        flex: 1 1 0;
        max-width: none;
        padding: 0 26px 0 10px;
        background-position: right 8px center;
    }

    /* 已結束頁：兩個下拉各佔一半，搜尋鈕與清除連結換到下一列 */
    .ya-tools--server .ya-select {
        flex-basis: calc(50% - 4px);
    }
}

.ya-active-filters,
.ya-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
    min-width: 0;
}

.ya-active-filters {
    margin-top: 10px;
    font-size: 13px;
}

.ya-active-label {
    flex: none;
    color: var(--ya-muted);
}

.ya-chips {
    flex: 1;
}

/* 篩選結果筆數（activity-list.js 建立，置於清除鈕前）；桌機排在條件按鈕右側 */
.ya-active-count {
    flex: none;
    white-space: nowrap;
    font-weight: 500;
    color: var(--ya-text);
}

.ya-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    max-width: 100%;
    min-height: 44px;
    padding: 6px 12px;
    border: 1px solid #C9DFDC;
    border-radius: 8px;
    background: var(--ya-tint);
    font: inherit;
    color: var(--ya-dark);
    text-align: left;
    cursor: pointer;
}

.ya-chip > span:first-child {
    overflow-wrap: anywhere;
    min-width: 0;
}

.ya-chip-close {
    flex: none;
    font-size: 20px;
    line-height: 1;
}

.ya-chip:hover {
    border-color: var(--ya-primary);
    background: #D8ECE9;
}

/* ---------- 5. 日期列（海報日曆＋小日期列） ---------- */
/* 兩條列都是獨立卡片：海報日曆（.ya-cal）在上、不 sticky；小日期列（.ya-strip）緊接在後、sticky。 */
.ya-cal,
.ya-strip {
    margin-top: 14px;
    padding: 10px 14px;
    border: 1px solid var(--ya-line);
    border-radius: 12px;
    background: #fff;
}

/* 箭頭的 offsetLeft 計算以卡片為定位基準（與 sticky 的小日期列相同） */
.ya-cal {
    position: relative;
}

/* 小日期列：所有寬度都 sticky（矮視窗除外，見 8. 之後）；z-index 高於 sticky 組標題，背景須不透明。
   上方留白（桌機 10px、手機 6px，見 8.）：黏住時日格（含 .ya-days 為焦點框預留的 4px）不貼齊視窗頂端。
   以負 margin-top（＝自身高度：桌機 60＋上下 padding 20＋框線 2＝82px，手機見 8.）疊在海報日曆底部，平時隱藏；
   海報日曆底部只剩自身高度時開始黏住，由 activity-list.js 加上 is-stuck 後淡入（spec 3.4、3.5）。
   隱藏用 visibility：同時移出 Tab 順序與無障礙樹、不攔截點擊，而 getBoundingClientRect 仍可量測。
   淡出時 visibility 延遲到透明度轉場結束才切換；淡入時立即可見 */
.ya-strip {
    position: sticky;
    top: 0;
    z-index: 10;
    margin-top: -82px;
    visibility: hidden;
    opacity: 0;
    transition: opacity .15s, visibility 0s linear .15s;
}

/* 黏在頂端時（activity-list.js 加上 is-stuck）：顯示，並只改圓角，不可改變高度，否則捲動會跳動。
   下方兩角改直角：圓角外的空隙會露出底下捲過的列與狀態色條。
   桌機不加陰影：sticky 組標題緊接在下方，陰影會壓在組標題上；手機（組標題不 sticky）沿用 8. 的常駐陰影 */
.ya-strip.is-stuck {
    border-radius: 0;
    visibility: visible;
    opacity: 1;
    transition: opacity .15s, visibility 0s;
}

.ya-strip-w {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ya-arrow {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 60px;
    padding: 0;
    border: 1px solid var(--ya-line);
    border-radius: 10px;
    background: #fff;
    color: var(--ya-muted);
    cursor: pointer;
}

.ya-arrow:hover:not(:disabled) {
    border-color: var(--ya-primary);
    color: var(--ya-primary);
}

.ya-arrow:disabled {
    opacity: .4;
    cursor: default;
}

/* overflow 會裁切焦點框與陰影：以 padding 預留空間、負 margin 抵銷佔位；無 JS 時（無箭頭）仍可橫向捲動 */
.ya-days {
    display: flex;
    flex: 1;
    gap: 8px;
    min-width: 0;
    margin: -4px -6px;
    padding: 4px 6px;
    overflow-x: auto;
    scrollbar-width: none;
}

.ya-days::-webkit-scrollbar {
    display: none;
}

.ya-day {
    position: relative;
    display: flex;
    flex: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    width: 76px;
    height: 60px;
    border: 1px solid var(--ya-line);
    border-radius: 10px;
    background: #fff;
    line-height: 1.2;
    color: var(--ya-text);
    text-decoration: none;
    transition: background-color .15s, border-color .15s;
}

a.ya-day:hover {
    border-color: var(--ya-primary);
    color: var(--ya-text);
    text-decoration: none;
}

.ya-day b {
    font-size: 16px;
    font-weight: 700;
}

/* 週別文字是日格內唯一不帶 class 的 span（海報日曆的圖區、細縫文字都帶 class，不套用這組週別樣式） */
.ya-day > span:not([class]) {
    font-size: 12px;
    color: var(--ya-muted);
}

.ya-day .dots {
    display: flex;
    gap: 3px;
    height: 5px;
    margin-top: 4px;
}

.ya-day .dots i {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--ya-primary);
}

/* 日格狀態（spec 6.3） */
.ya-day.is-empty {
    background: #FAFBFB;
    cursor: default;
}

/* JS 篩選後變空的 <a> 日格不顯示 hover 主色框 */
.ya-page .ya-day.is-empty:hover {
    border-color: var(--ya-line);
}

/* 無活動日格為停用狀態（aria-disabled），沿用稿中淡色 */
.ya-day.is-empty b {
    color: #9AA3AA;
}

.ya-day.is-weekend > span:not([class]) {
    color: #B45309;
}

.ya-day.is-today,
a.ya-day.is-today:hover {
    border-color: var(--ya-primary);
    background: var(--ya-primary);
    box-shadow: 0 3px 8px rgba(3, 133, 125, .3);
    color: #fff;
}

.ya-day.is-today > span:not([class]) {
    font-weight: 700;
    color: #fff;
}

.ya-day.is-today .dots i {
    background: #fff;
}

/* 捲動標記：目前看到的那一天（activity-list.js 加上 is-current）。
   淡主色底＋主色框＋底部短橫線，與「今天」的實心主色、鍵盤焦點外框（outline）區分；框寬不變、短橫線絕對定位，日格大小不變。
   短橫線壓在下框上（bottom:-1px），與上方的圓點保持距離 */
.ya-day.is-current,
a.ya-day.is-current:hover {
    border-color: var(--ya-primary);
    background: var(--ya-tint);
}

.ya-day.is-current::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -1px;
    width: 24px;
    height: 3px;
    margin-left: -12px;
    border-radius: 2px;
    background: var(--ya-primary);
}

/* 今天被標記時維持實心底，只加白色短橫線（白對主色約 4.5:1；金色對主色不足 3:1） */
.ya-day.is-today.is-current,
a.ya-day.is-today.is-current:hover {
    background: var(--ya-primary);
}

.ya-day.is-today.is-current::after {
    background: #fff;
}

/* 週末星期字在淡主色底上加深（#B45309 對 --ya-tint 僅 4.38:1，#92400E 約 6.2:1） */
.ya-day.is-current.is-weekend > span:not([class]) {
    color: #92400E;
}

/* 月份標記：每月 1 號那格之前的分隔線＋月份（aria-hidden、不可聚焦、不是日格） */
.ya-month {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 42px;
    height: 60px;
    padding-left: 2px;
    border-left: 3px solid var(--ya-primary);
    border-radius: 0 8px 8px 0;
    background: var(--ya-tint);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--ya-dark);
    white-space: nowrap;
    -webkit-user-select: none;
    user-select: none;
}

/* ---------- 5a. 海報日曆（.ya-cal，spec 3.3） ---------- */
/* 日格（.ya-cday）沿用 .ya-day 的框線、日期與週別樣式，以下覆寫尺寸並加上圖區。
   選擇器寫成 .ya-day.ya-cday，才不會被 8. 手機版的 .ya-day 尺寸蓋掉。
   桌機寬 98px＝框線 1＋padding 6＋圖區 84＋padding 6＋框線 1；今天格框線 2px，padding 少 1px，圖區大小不變 */
.ya-day.ya-cday {
    justify-content: flex-start;
    width: 98px;
    height: auto;
    padding: 6px 6px 7px;
}

/* 箭頭與月份標記和日格等高 */
.ya-cal .ya-arrow {
    align-self: stretch;
    height: auto;
}

.ya-cal .ya-month {
    height: auto;
}

/* 圖區：載入前與 PDF 等無法產生縮圖時只顯示底色 */
.ya-cal-pic {
    position: relative;
    display: block;
    flex: none;
    width: 84px;
    height: 112px;
    margin-top: 6px;
    overflow: hidden;
    border-radius: 6px;
    background: var(--ya-tint);
}

.ya-cal-pic img {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    background: inherit;
    object-fit: cover;
    object-position: top;
    transition: transform .2s;
}

/* 縮圖載入失敗（無 JS 時；有 JS 時 activity-list.js 會改用下一張海報或色塊）：Chrome 即使 alt="" 仍會在有尺寸的 img 上
   畫破圖圖示。img 的偽元素只在圖片無法顯示時才會繪製，以圖區底色蓋住，只留底色（Review Focus 1） */
.ya-cal-pic img::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: inherit;
}

a.ya-cday:hover .ya-cal-pic img {
    transform: scale(1.04);
}

/* 有海報且當天 2 場以上：右下角「N 場」（當天總場數，D3）
   白色描邊與陰影讓標記在任何底色的海報上都有清楚的外框 */
.ya-cal-count {
    position: absolute;
    right: 5px;
    bottom: 5px;
    padding: 1px 7px;
    border-radius: 9px;
    background: var(--ya-dark);
    box-shadow: 0 0 0 1.5px #fff, 0 1px 4px rgba(0, 0, 0, .35);
    font-size: 12px;
    font-style: normal;
    font-weight: 700;
    line-height: 1.5;
    color: #fff;
}

/* 沒有海報時的色塊：1 場（或今天 0 場）顯示名稱，靠左、上緣 3px 主色線；2 場以上顯示「N 場活動」，置中 */
.ya-cal-block {
    display: flex;
    flex-direction: column;
    height: 100%;
    color: var(--ya-dark);
}

/* 最多 5 行，刪節號截斷（完整名稱在 aria-label 與列表中）。
   以 overflow-wrap:anywhere 讓過長的英數字串可斷行，不用 word-break:break-all（會把一般英文單字也拆開） */
.ya-cal-name {
    display: -webkit-box;
    margin: 7px 7px 0;
    overflow: hidden;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
    text-align: left;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 5;
}

/* 上緣主色線畫在名稱上（相對圖區定位）：只有顯示名稱時才出現，「N 場活動」不加 */
.ya-cal-name::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--ya-primary);
}

.ya-cal-num {
    margin: auto;
    font-size: 12px;
    line-height: 1.3;
    text-align: center;
}

.ya-cal-num strong {
    display: block;
    font-size: 22px;
    line-height: 1.1;
}

/* 今天格（D9）：不用小日期列的實心主色，改淡主色底＋2px 主色框、無陰影；「今天 一」改為主色小膠囊；色塊改白底 */
.ya-cal a.ya-day.is-today,
.ya-cal a.ya-day.is-today:hover {
    padding: 5px 5px 6px;
    border: 2px solid var(--ya-primary);
    background: var(--ya-tint);
    box-shadow: none;
    color: var(--ya-dark);
}

.ya-cal .ya-day.is-today > span:not([class]) {
    margin-top: 2px;
    padding: 0 8px;
    border-radius: 10px;
    background: var(--ya-primary);
    font-size: 12px;
    line-height: 18px;
    color: #fff;
}

.ya-cal .ya-day.is-today .ya-cal-pic {
    background: #fff;
}

/* 空白日（方案 A，D5）：縮成約 26px 的細縫，左右虛線、中間直書「無活動」；
   JS 篩選後變空的 <a> 日格同樣加上 is-empty，自動套用 */
.ya-cal-gap {
    display: none;
}

.ya-cal .ya-day.is-empty {
    justify-content: center;
    width: 26px;
    padding: 0;
    border: 0;
    border-left: 1px dashed #D3DCDB;
    border-right: 1px dashed #D3DCDB;
    border-radius: 0;
    background: transparent;
}

.ya-page .ya-cal .ya-day.is-empty:hover {
    border-color: #D3DCDB;
}

.ya-cal .ya-day.is-empty > :not(.ya-cal-gap) {
    display: none;
}

/* 文字色與小日期列無活動日格的日期同色 */
.ya-cal .ya-day.is-empty > .ya-cal-gap {
    display: block;
    font-size: 12px;
    letter-spacing: .3em;
    color: #9AA3AA;
    writing-mode: vertical-rl;
}

/* 連續空白日只顯示第一格；跨月時月份標記照常顯示，緊接在細縫之後 */
.ya-cal .ya-day.is-empty + .ya-day.is-empty,
.ya-cal .ya-day.is-empty + .ya-month + .ya-day.is-empty {
    display: none;
}

/* 圖例在日期列卡片之後（不 sticky）；左右內縮與組標題文字對齊 */
.ya-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 16px;
    margin-top: 8px;
    padding: 0 16px;
    font-size: 12px;
    color: var(--ya-muted);
}

.ya-sw {
    display: inline-block;
    width: 6px;
    height: 12px;
    margin-right: 5px;
    border-radius: 2px;
    vertical-align: -1px;
}

.ya-sw--reg {
    background: var(--ya-ok);
}

.ya-sw--review {
    background: var(--ya-warn);
}

.ya-sw--off {
    background: var(--ya-off);
}

/* ---------- 5b. 日期列提示（.ya-cal-tip，海報日曆與小日期列共用，由 activity-list.js 建立） ---------- */
/* 滑鼠停在日格上或以鍵盤聚焦日格時，列出當天目前可見的活動名稱。
   position:fixed，位置由 JS 依日格計算，不受兩條列 .ya-days 橫向捲動的裁切；z-index 高於 sticky 小日期列（10）。
   未顯示時以 visibility 隱藏（不用 hidden）：JS 才能在顯示前量測大小；pointer-events:none 讓淡出中的提示不攔截滑鼠 */
.ya-cal-tip {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1070;
    box-sizing: border-box;
    /* 實際上限由 JS 以 clientWidth 計算後寫入行內樣式（100vw 含傳統捲軸寬度）；此處為初始值 */
    max-width: min(320px, calc(100vw - 16px));
    padding: 10px 12px;
    border: 1px solid var(--ya-line);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(15, 23, 30, .16), 0 1px 4px rgba(15, 23, 30, .08);
    font-size: 13px;
    line-height: 1.45;
    color: var(--ya-text);
    text-align: left;
    /* 矮視窗上下都放不下時 JS 會限制 max-height，改為提示內捲動，捲到底不帶動頁面 */
    overflow-y: auto;
    overscroll-behavior: contain;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .12s, visibility 0s linear .12s;
}

.ya-cal-tip.is-shown {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: opacity .12s, visibility 0s;
}

/* 標題列：「10/21 三・8 場」 */
.ya-cal-tip-h {
    margin: 0 0 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--ya-divider);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.4;
    color: var(--ya-dark);
}

.ya-cal-tip-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.ya-cal-tip-list li {
    position: relative;
    padding-left: 12px;
}

.ya-cal-tip-list li + li {
    margin-top: 4px;
}

/* 主色小圓點；top 對齊第一行文字中線（13px × 1.45 行高） */
.ya-cal-tip-list li::before {
    content: "";
    position: absolute;
    top: 7px;
    left: 2px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--ya-primary);
}

/* 每個名稱最多 2 行，刪節號截斷（完整名稱在列表中）；過長的英數字串可斷行 */
.ya-cal-tip-list span {
    display: -webkit-box;
    overflow: hidden;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

/* 超過 8 場時的「另 N 場」：不加圓點，文字與名稱對齊 */
.ya-cal-tip-list .ya-cal-tip-more {
    color: var(--ya-muted);
}

.ya-cal-tip-list .ya-cal-tip-more::before {
    display: none;
}

/* ---------- 6. 組標題 ---------- */
.ya-group {
    margin-top: 18px;
}

.ya-group-h {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 10px 16px;
    background: var(--ya-bg);
    font-size: 16px;
    font-weight: 700;
    line-height: 1.5;
    color: var(--ya-dark);
}

.ya-group-h .cnt {
    margin-left: auto;
    font-size: 13px;
    font-weight: 400;
    color: var(--ya-muted);
}

.ya-group.is-today .ya-group-h {
    border-left: 4px solid var(--ya-primary);
    border-radius: 0 8px 8px 0;
    background: var(--ya-tint);
}

.ya-today-pill {
    padding: 1px 9px;
    border-radius: 10px;
    background: var(--ya-primary);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.5;
    color: #fff;
}

/* 捲動偏移（WCAG 2.4.11：錨點跳轉、scrollIntoView 與鍵盤聚焦時不被 sticky 日期列／組標題遮住）。
   設在列表內的元素上，不設在 html 的 scroll-padding：日期列本身就在 sticky 區塊內，
   用 scroll-padding 會讓聚焦日格、箭頭時被判定為遮住而整頁上捲。日期列內的元素一律不設 scroll-margin。
   高度由 activity-list.js 寫入（--ya-strip-h、--ya-head-h），無 JS 與已結束頁退回 fallback。 */
/* 組與組標題（含「跳到活動列表」的 #ya-list）：貼齊日期列下方，不加組標題高度 */
.ya-group,
.ya-group-h {
    scroll-margin-top: calc(var(--ya-strip-h, var(--ya-strip-fallback)) + 8px);
}

/* 組標題下方的內容：再讓出 sticky 組標題的高度（手機組標題不 sticky，為 0） */
.ya-row,
.ya-name h3 a,
.ya-meta-poster,
.ya-act .ya-btn {
    scroll-margin-top: calc(var(--ya-strip-h, var(--ya-strip-fallback)) + var(--ya-head-h, var(--ya-head-fallback)) + 8px);
}

/* ---------- 7. 列（桌機） ---------- */
.ya-rows {
    margin-top: 8px;
    overflow: hidden;
    border: 1px solid var(--ya-line);
    border-radius: 10px;
    background: #fff;
}

/* 每列以上框線分隔；margin-top:-1px 讓第一個可見列的上框被容器裁掉（不受 hidden 列影響） */
.ya-row {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr) 160px 100px 112px;
    align-items: center;
    gap: 18px;
    min-height: 84px;
    margin-top: -1px;
    padding: 20px 22px 20px 18px;
    border-top: 1px solid var(--ya-divider);
    border-left: 6px solid var(--ya-off);
    background: #fff;
    transition: background-color .15s;
}

.ya-row:focus-within {
    background: #F0F8F6;
}

@media (hover: hover) {
    .ya-row:hover {
        background: #F5FAF9;
    }
}

/* 未登入時沒有個人報名狀態，不保留空欄，讓活動名稱有更多空間。 */
.ya-page--guest .ya-status {
    display: none;
}

@media (min-width: 992px) {
    .ya-page--guest .ya-row {
        grid-template-columns: 64px minmax(0, 1fr) 180px 112px;
    }
}

/* 狀態色條（spec 4.4；僅已登入時有 reg／review） */
.ya-row--reg {
    border-left-color: var(--ya-ok);
}

.ya-row--review {
    border-left-color: var(--ya-warn);
}

/* 日曆式日期塊（（年）月／日／週）：固定寬，與名稱上緣對齊；其餘欄位維持垂直置中 */
.ya-dateblock {
    display: block;
    align-self: start;
    box-sizing: border-box;
    width: 64px;
    min-height: 70px;
    padding: 7px 2px 8px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: var(--ya-tint);
    color: var(--ya-dark);
    text-align: center;
    white-space: nowrap;
}

.ya-db-vis {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.2;
}

.ya-db-y {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: .03em;
}

.ya-db-m,
.ya-db-w {
    font-size: 12px;
    font-weight: 700;
}

.ya-db-d {
    margin: 1px 0;
    font-size: 27px;
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: .01em;
    font-variant-numeric: tabular-nums;
}

/* 今天：主色實心（白字對比 4.51，月／週一律粗體） */
.ya-group.is-today .ya-dateblock {
    border-color: var(--ya-primary);
    background: var(--ya-primary);
    box-shadow: 0 3px 8px rgba(3, 133, 125, .25);
    color: #fff;
}

/* 進行中：白底主色外框（日期為開始日，名稱上方另有「進行中，至…」） */
.ya-row[data-group="ongoing"] .ya-dateblock {
    border: 2px solid var(--ya-primary);
    background: #fff;
    padding: 6px 1px 7px;
}

/* 已結束：中性灰底，避免與即將開始的主色混淆 */
.ya-dateblock--ended {
    background: var(--ya-grey-bg);
    color: #3F4A52;
}

/* 日期未定：虛線框 */
.ya-page .ya-dateblock--tbd {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed #A7B1B6;
    background: transparent;
    box-shadow: none;
    color: var(--ya-muted);
}

.ya-dateblock--tbd .ya-db-m,
.ya-dateblock--tbd .ya-db-tbd {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.3;
}

.ya-name {
    align-self: start;
    min-width: 0;
}

/* 名稱上方的時間文字 */
.ya-when {
    margin: 0 0 2px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.45;
    color: var(--ya-sub);
    overflow-wrap: anywhere;
}

.ya-when--live {
    font-weight: 700;
    color: var(--ya-primary);
}

.ya-when--live::before {
    content: "";
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 6px;
    border-radius: 50%;
    background: currentColor;
    vertical-align: 2px;
}

.ya-name h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.45;
}

/* 完整顯示活動名稱，觸控與鍵盤使用者也能讀到長標題。 */
.ya-name h3 a {
    display: block;
    color: var(--ya-text);
    text-decoration: none;
    overflow-wrap: anywhere;
}

.ya-name h3 a:hover {
    color: var(--ya-primary);
    text-decoration: underline;
}

.ya-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 5px 18px;
    margin-top: 8px;
    font-size: 14px;
    line-height: 1.45;
    color: var(--ya-muted);
}

.ya-meta > span,
.ya-meta > .ya-meta-poster {
    display: inline-flex;
    align-items: flex-start;
    gap: 5px;
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
}

/* 看海報：唯一可點的 meta 項目，用深綠色字與底線標示為連結。 */
.ya-meta > .ya-meta-poster {
    align-self: flex-start;
    color: var(--ya-dark);
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* hover 不改色（--ya-primary 在列 hover 底色上對比不足），改以加粗底線表示 */
@media (hover: hover) {
    .ya-meta > .ya-meta-poster:hover {
        text-decoration-thickness: 2px;
    }
}

.ya-meta svg {
    flex: none;
    margin-top: 2px;
}

/* 桌機：.ya-bottom 攤平，使 .ya-reg（名額＋截止日）、.ya-status、.ya-act 成為第 3、4、5 欄 */
.ya-bottom {
    display: contents;
}

.ya-reg {
    min-width: 0;
}

.ya-status {
    display: flex;
    justify-content: flex-start;
    min-width: 0;
}

.ya-act {
    display: flex;
    justify-content: flex-end;
}

.ya-dl {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    line-height: 1.4;
    color: var(--ya-muted);
}

.ya-dl-short {
    display: none;
}

.ya-dl-open {
    display: block;
}

.ya-dl--past {
    color: #6B767D;
}

.ya-dl--urgent {
    font-weight: 500;
    color: var(--ya-urgent);
}

@media (min-width: 992px) {
    /* 組標題 sticky 在日期列正下方（減 1px 疊在日期列底框下，避免高度取整後留下縫隙；沒有日期列時為 0）；
       無 JS 時組內元素的捲動偏移以約略組標題高度 44px 代替 */
    .ya-page {
        --ya-head-fallback: 44px;
    }

    .ya-group-h {
        position: sticky;
        top: max(0px, calc(var(--ya-strip-h, var(--ya-strip-fallback)) - 1px));
        z-index: 5;
    }
}

/* ---------- 8. 卡片（手機 < 992px） ---------- */
@media (max-width: 991.98px) {
    /* 抵銷 _Layout 欄位的 15px 左右內距，使卡片與畫面邊緣距離與稿一致（12px） */
    .ya-page {
        margin: 0 -15px;
        padding: 16px 12px 32px;
    }

    .ya-head {
        display: block;
        margin-bottom: 0;
    }

    .ya-title {
        font-size: 26px;
    }

    .ya-summary {
        font-size: 13px;
    }

    .ya-tabsrow {
        margin-top: 14px;
    }

    /* 「目前條件」列：第一行標籤＋右側筆數（同一格、左右對齊，不另佔欄寬），第二行條件按鈕＋清除鈕 */
    .ya-active-filters {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:
            "head head"
            "chips clear";
        align-items: center;
    }

    .ya-active-label {
        grid-area: head;
        justify-self: start;
    }

    .ya-active-count {
        grid-area: head;
        justify-self: end;
    }

    .ya-chips {
        grid-area: chips;
    }

    .ya-active-filters .ya-clear {
        grid-area: clear;
    }

    /* 16px 以上避免 iOS Safari 聚焦時自動放大 */
    .ya-search input,
    .ya-select {
        font-size: 16px;
    }

    .ya-tabs {
        padding: 0 4px;
    }

    .ya-tab {
        padding: 12px 16px;
    }

    .ya-clear {
        align-self: flex-start;
    }

    /* 日期列：日期格以負 margin 滿版（sticky 見 5.），隱藏箭頭改為橫向捲動（Header 不 sticky）。
       組標題在手機不 sticky，保留畫面高度給卡片；列的捲動偏移只需日期格高度。
       陰影以負 spread 只落在下方 */
    /* 小日期列的負 margin-top＝自身高度 71px（日格 56＋padding 6、8＋下框線 1） */
    .ya-strip {
        margin: -71px -12px 0;
        padding: 6px 12px 8px;
        border-width: 0 0 1px;
        border-radius: 0;
        box-shadow: 0 6px 8px -4px rgba(10, 86, 82, .1);
    }

    /* 海報日曆同樣滿版；日格寬 84px（框線 1＋padding 5＋圖區 72＋padding 5＋框線 1），圖區 72×96 */
    .ya-cal {
        margin: 14px -12px 0;
        padding: 8px 12px 10px;
        border-width: 1px 0;
        border-radius: 0;
    }

    .ya-day.ya-cday {
        width: 84px;
        padding: 6px 5px 7px;
    }

    .ya-cal a.ya-day.is-today,
    .ya-cal a.ya-day.is-today:hover {
        padding: 5px 4px 6px;
    }

    .ya-cal-pic {
        width: 72px;
        height: 96px;
    }

    .ya-arrow {
        display: none;
    }

    .ya-days {
        gap: 6px;
        margin: -4px -12px;
        padding: 4px 12px;
        scroll-padding-inline: 12px;
    }

    .ya-day {
        width: 58px;
        height: 56px;
    }

    .ya-day b {
        font-size: 14px;
    }

    .ya-month {
        width: 38px;
        height: 56px;
        font-size: 13px;
    }

    .ya-legend {
        gap: 2px 10px;
        margin-top: 8px;
        padding: 0;
        font-size: 11px;
    }

    .ya-group {
        margin-top: 14px;
    }

    .ya-group-h {
        margin-bottom: 8px;
        padding: 10px 14px;
        font-size: 15px;
    }

    .ya-group-h .cnt {
        font-size: 12px;
    }

    .ya-rows {
        margin-top: 0;
        overflow: visible;
        border: 0;
        border-radius: 0;
        background: transparent;
    }

    /* 上半：日期塊（固定 52px）＋時間文字、名稱與 meta */
    .ya-row {
        grid-template-columns: 52px minmax(0, 1fr);
        align-items: start;
        gap: 0 12px;
        min-height: 0;
        margin: 0 0 10px;
        padding: 14px 14px 12px;
        border: 1px solid var(--ya-line);
        border-left: 6px solid var(--ya-off);
        border-radius: 12px;
    }

    .ya-row--reg {
        border-left-color: var(--ya-ok);
    }

    .ya-row--review {
        border-left-color: var(--ya-warn);
    }

    .ya-dateblock {
        width: 52px;
        min-height: 62px;
        padding: 6px 1px 7px;
        border-radius: 9px;
    }

    .ya-row[data-group="ongoing"] .ya-dateblock {
        padding: 5px 0 6px;
    }

    .ya-db-y {
        font-size: 10px;
    }

    .ya-db-m,
    .ya-db-w {
        font-size: 11px;
    }

    .ya-db-d {
        font-size: 22px;
    }

    .ya-dateblock--tbd .ya-db-m,
    .ya-dateblock--tbd .ya-db-tbd {
        font-size: 13px;
    }

    .ya-when {
        font-size: 13px;
    }

    .ya-name h3 {
        font-size: 16px;
    }

    .ya-meta {
        flex-direction: column;
        gap: 2px;
        margin-top: 4px;
        font-size: 13px;
    }

    .ya-meta svg {
        margin-top: 1px;
    }

    /* 連結不撐滿整行；點擊高度至少 24px（WCAG 2.5.8），以負 margin 抵銷多出的高度，列高幾乎不變 */
    .ya-meta > .ya-meta-poster {
        align-items: center;
        min-height: 24px;
        margin: -2px 0;
    }

    .ya-meta > .ya-meta-poster svg {
        margin-top: 0;
    }

    /* 下半：名額條一列，截止日＋pill 一列，按鈕跨兩列 */
    .ya-bottom {
        display: grid;
        grid-column: 1 / -1;
        grid-template-columns: minmax(0, 1fr) auto auto;
        grid-template-areas:
            "meter meter act"
            "dl pill act";
        align-items: center;
        gap: 6px 10px;
        margin-top: 10px;
        padding-top: 10px;
        border-top: 1px solid var(--ya-divider);
    }

    .ya-reg {
        display: contents;
    }

    .ya-meter {
        grid-area: meter;
        min-width: 0;
    }

    .ya-dl {
        grid-area: dl;
        min-width: 0;
        margin-top: 0;
        font-size: 12px;
        line-height: 1.35;
    }

    .ya-dl-long {
        display: none;
    }

    .ya-dl-short {
        display: inline;
    }

    .ya-status {
        grid-area: pill;
        justify-content: flex-end;
    }

    .ya-act {
        grid-area: act;
    }
}

/* 矮視窗（手機橫向、放大 200%／400% 等，不分寬度）：小日期列不 sticky，避免長期佔去大半畫面；
   JS 不會加上 is-stuck，小日期列維持隱藏（只用海報日曆），高度視為 0（activity-list.js 以相同媒體查詢寫入 --ya-strip-h）。
   桌機組標題仍 sticky，改貼齊視窗頂端；組內元素的偏移仍加組標題高度 */
@media (max-height: 520px) {
    .ya-strip {
        position: static;
    }

    .ya-group-h {
        top: 0;
    }
}

/* ---------- 9. pill／按鈕／名額條／空狀態 ---------- */
.ya-pill {
    display: inline-flex;
    align-items: center;
    height: 24px;
    padding: 0 10px;
    border: 1px solid transparent;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

.ya-pill--reg {
    background: var(--ya-ok-bg);
    color: var(--ya-ok-text);
}

.ya-pill--review,
.ya-pill--wait {
    background: var(--ya-warn-bg);
    color: var(--ya-warn-text);
}

.ya-pill--rej {
    background: var(--ya-grey-bg);
    color: var(--ya-grey-text);
}

.ya-pill--none {
    border: 1px dashed #C3CACF;
    background: transparent;
    color: #5F6B73;
}

.ya-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 96px;
    height: 44px;
    padding: 0 18px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    text-decoration: none;
}

.ya-btn:hover {
    text-decoration: none;
}

.ya-btn--go {
    background: var(--ya-primary);
    color: #fff;
}

.ya-btn--go:hover {
    background: var(--ya-dark);
    color: #fff;
}

.ya-btn--view {
    border-color: var(--ya-primary);
    background: #fff;
    color: var(--ya-primary);
}

.ya-btn--view:hover {
    background: var(--ya-tint);
    color: var(--ya-dark);
}

.ya-btn--off {
    background: var(--ya-grey-bg);
    color: var(--ya-grey-text);
    cursor: default;
}

.ya-meter-t {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 6px;
    font-size: 13px;
    color: var(--ya-muted);
}

.ya-meter b {
    font-size: 15px;
    font-weight: 700;
    color: var(--ya-text);
}

.ya-meter--unlimited .ya-meter-t {
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
}

.ya-meter--full .ya-meter-t b {
    color: var(--ya-grey);
}

.ya-meter--few .ya-meter-t > span:first-child {
    font-weight: 500;
    color: var(--ya-urgent);
}

.ya-meter--text {
    font-size: 13px;
    color: var(--ya-muted);
}

.ya-bar {
    height: 5px;
    margin-top: 5px;
    overflow: hidden;
    border-radius: 3px;
    background: #E3E9E8;
}

.ya-bar i {
    display: block;
    height: 100%;
    border-radius: 3px;
    background: var(--ya-primary);
}

.ya-bar--few i {
    background: var(--ya-warn);
}

.ya-bar--full i {
    background: #9AA3AA;
}

.ya-unl {
    display: inline-flex;
    align-items: center;
    height: 20px;
    padding: 0 7px;
    border: 1px solid var(--ya-primary);
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
    color: var(--ya-primary);
    white-space: nowrap;
}

.ya-empty-row {
    margin: 0;
    padding: 16px;
    font-size: 14px;
    text-align: center;
    color: var(--ya-muted);
}

.ya-empty {
    margin-top: 18px;
    padding: 40px 16px;
    border: 1px dashed var(--ya-line);
    border-radius: 12px;
    background: #fff;
    text-align: center;
    color: var(--ya-muted);
}

.ya-empty p {
    margin: 0 0 14px;
    font-size: 16px;
    color: var(--ya-text);
}

.ya-empty-icon {
    box-sizing: content-box;
    margin-bottom: 16px;
    padding: 16px;
    border-radius: 50%;
    background: var(--ya-tint);
    color: var(--ya-dark);
}

.ya-empty-hint {
    display: block;
    margin: -4px 0 20px;
    font-size: 14px;
    line-height: 1.7;
}

.ya-empty a,
.ya-empty .ya-clear {
    display: inline-flex;
    align-items: center;
    height: 44px;
    padding: 0 18px;
    border: 1px solid var(--ya-primary);
    border-radius: 8px;
    background: #fff;
    font-size: 14px;
    font-weight: 700;
    color: var(--ya-primary);
    text-decoration: none;
}

.ya-empty a:hover,
.ya-empty .ya-clear:hover {
    background: var(--ya-tint);
    color: var(--ya-dark);
    text-decoration: none;
}

/* 手機：卡片內的名額文字靠左、按鈕觸控高度 44px（需在本節基底規則之後） */
@media (max-width: 991.98px) {
    .ya-meter-t {
        justify-content: flex-start;
    }

    .ya-bar {
        margin-top: 4px;
    }

    .ya-btn {
        height: 44px;
        padding: 0 14px;
    }

    .ya-empty-row {
        border: 1px dashed var(--ya-line);
        border-radius: 12px;
        background: #fff;
    }

    .ya-empty a,
    .ya-empty .ya-clear {
        height: 44px;
    }
}

/* 窄手機將報名資訊分行，長截止日期、名額與按鈕不互相擠壓。 */
@media (max-width: 575.98px) {
    .ya-bottom {
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas: "meter meter" "dl dl" "pill act";
        gap: 10px;
    }

    .ya-meter-t {
        flex-wrap: wrap;
    }

    .ya-status {
        justify-content: flex-start;
    }

    .ya-page--guest .ya-act {
        grid-column: 1 / -1;
    }

    .ya-page--guest .ya-act .ya-btn {
        width: 100%;
    }
}

/* ---------- 10. 已結束頁與分頁器 ---------- */
/* PagedList 輸出的 li 帶 .btn.btn-link（newStyle2022.css 以 !important 設色），顏色直接設在 a 上 */
.ya-page .pagination {
    flex-wrap: wrap;
    gap: 4px;
    margin: 0;
}

.ya-page .pagination > li {
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    font-weight: 400;
}

.ya-page .pagination > li > a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
    padding: 0 10px;
    border-radius: 18px;
    font-size: 14px;
    font-weight: 500;
    color: var(--ya-primary);
    text-decoration: none;
}

.ya-page .pagination > li > a[href]:hover {
    background: var(--ya-tint);
    color: var(--ya-dark);
}

.ya-page .pagination > li.active > a {
    background: var(--ya-primary);
    font-weight: 700;
    color: #fff;
}

.ya-page .pagination > li.disabled > a {
    color: var(--ya-muted);
}

@media (max-width: 991.98px) {
    .ya-page .pagination > li > a {
        min-width: 44px;
        height: 44px;
        border-radius: 22px;
    }
}

/* ---------- 11. 海報燈箱（僅首頁，由 activity-list.js 以 <dialog> 建立） ---------- */
/* 開啟時鎖住背景捲動；原本有捲軸時保留捲軸寬度（ya-dlg-gutter），避免背景列表左右位移 */
html.ya-dlg-open {
    overflow: hidden;
}

html.ya-dlg-open.ya-dlg-gutter {
    scrollbar-gutter: stable;
}

/* 不在 .ya-pv 上設 display，以免蓋掉瀏覽器 dialog:not([open]) 的隱藏；排版交給 .ya-pv-box。
   --ya-pv-chrome：頂部列＋底部列＋圖片區上下留白的高度預留，圖片最大高度＝可用高度減去此值 */
.ya-pv {
    --ya-pv-chrome: 144px;
    box-sizing: border-box;
    width: fit-content;
    min-width: min(360px, calc(100vw - 24px));
    max-width: min(900px, 92vw);
    max-height: calc(100vh - 32px);
    margin: auto;
    padding: 0;
    border: 1px solid var(--ya-line);
    border-radius: 12px;
    background: #fff;
    color: var(--ya-text);
    box-shadow: 0 16px 48px rgba(15, 23, 30, .2), 0 2px 8px rgba(15, 23, 30, .08);
    overflow: auto;
    overscroll-behavior: contain;
}

.ya-pv[open] {
    animation: ya-pv-in 150ms ease-out;
}

/* 舊版 Chromium 的 ::backdrop 不繼承 CSS 變數，直接寫色值 */
.ya-pv::backdrop {
    background: rgba(15, 23, 30, .6);
    animation: ya-pv-in 150ms ease-out;
}

@keyframes ya-pv-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.ya-pv-box {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* 頂部列與底部列不參與寬度計算（contain: inline-size），燈箱寬度由海報決定，長活動名稱在框內換行 */
.ya-pv-head,
.ya-pv-foot {
    contain: inline-size;
}

.ya-pv-head {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 60px;
    padding: 8px 8px 8px 20px;
    border-bottom: 1px solid var(--ya-divider);
}

/* 長活動名稱最多兩行，完整名稱仍由螢幕閱讀器與 title 提供 */
.ya-pv-title {
    display: -webkit-box;
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.4;
    color: var(--ya-text);
    overflow: hidden;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.ya-pv-close {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--ya-muted);
    cursor: pointer;
}

/* Bootstrap reboot 的 button:focus 外框在滑鼠點擊時也會出現；鍵盤焦點仍由 .ya-page :focus-visible 提供 */
.ya-pv-close:focus:not(:focus-visible) {
    outline: 0;
}

/* 滑鼠／觸控開啟時，程式移到 ✕ 的焦點不畫外框；在燈箱內按任何鍵即由 activity-list.js 移除 ya-pv--pointer */
.ya-page .ya-pv--pointer .ya-pv-close:focus-visible {
    outline: 0;
}

@media (hover: hover) {
    .ya-pv-close:hover {
        background: var(--ya-grey-bg);
        color: var(--ya-text);
    }
}

/* 淡色底襯托海報；載入前保留最小高度，減少視窗跳動 */
.ya-pv-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: min(240px, 40vh);
    padding: 16px;
    background: var(--ya-bg);
}

.ya-pv-img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: max(120px, calc(85vh - var(--ya-pv-chrome)));
    object-fit: contain;
}

.ya-pv-status {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    color: var(--ya-muted);
    text-align: center;
}

.ya-pv-foot {
    display: flex;
    justify-content: flex-end;
    padding: 10px 20px;
    border-top: 1px solid var(--ya-divider);
}

/* 與 .ya-meta-poster 相同：深綠色字＋底線 */
.ya-pv-orig {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 24px;
    font-size: 14px;
    font-weight: 500;
    color: var(--ya-dark);
    text-decoration: underline;
    text-underline-offset: 2px;
}

@media (hover: hover) {
    .ya-pv-orig:hover {
        color: var(--ya-dark);
        text-decoration: underline;
        text-decoration-thickness: 2px;
    }
}

.ya-pv-orig svg {
    flex: none;
}

/* 手機：寬度不超出視窗左右各 12px，高度以 100dvh 為準（不支援時退回 100vh） */
@media (max-width: 991.98px) {
    .ya-pv {
        max-width: min(900px, calc(100vw - 24px));
        max-height: calc(100vh - 24px);
        max-height: calc(100dvh - 24px);
    }

    .ya-pv-img {
        max-height: max(120px, calc(100vh - 24px - var(--ya-pv-chrome)));
        max-height: max(120px, calc(100dvh - 24px - var(--ya-pv-chrome)));
    }
}

@media (max-width: 575.98px) {
    .ya-pv {
        width: calc(100vw - 24px);
    }

    .ya-pv-head {
        padding-left: 16px;
    }

    .ya-pv-stage {
        padding: 12px;
    }

    .ya-pv-foot {
        padding: 10px 16px;
    }
}

/* ---------- 12. 無障礙 ---------- */
.ya-page :focus-visible {
    outline: 2px solid var(--ya-focus);
    outline-offset: 2px;
}

/* Bootstrap 4.2 reboot 的 [tabindex="-1"]:focus { outline: 0 !important } 會蓋掉上式；
   清除篩選、日期跳轉後焦點會移到這些標題（activity-list.js 設 tabindex=-1），鍵盤操作時仍需看得到焦點 */
.ya-page .ya-group-h[tabindex="-1"]:focus-visible,
.ya-page .ya-title[tabindex="-1"]:focus-visible {
    outline: 2px solid var(--ya-focus) !important;
}

/* 避免 hidden 被元件自身的 display:flex/grid/contents 覆蓋 */
.ya-page [hidden] {
    display: none !important;
}

@media (prefers-reduced-motion: reduce) {
    .ya-page *,
    .ya-page *::before,
    .ya-page *::after {
        transition: none !important;
        animation: none !important;
        scroll-behavior: auto !important;
    }

    /* 海報日曆縮圖 hover 不放大 */
    a.ya-cday:hover .ya-cal-pic img {
        transform: none;
    }

    /* ::backdrop 不在上方 * 選取範圍內 */
    .ya-pv::backdrop {
        animation: none !important;
    }
}
