@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@100;300;400;500;700;900&display=swap");
@import url("https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css");

/* =========================================================
   設計 Token
   ========================================================= */
:root {
    /* 配色 */
    --primary-dark: #5A2373;
    --primary: #9F6D9A;
    --accent: #B85C9E;
    --accent-bg: #F5EDF3;
    --page-bg: #f0f0f0;
    --panel-bg: #f7fafc;
    --text: #333;
    --text-sub: #666;
    --border: #e2e8f0;
    --white: #fff;
    --danger: #d32f2f;
    --success: #16a34a;
    --success-deep: #15803d; /* 白字底色用：--success 配白字對比僅 3.3:1，不足 AA */
    --warning: #ea580c;

    /* 無障礙文字專用色（背景/品牌色不動，僅文字改用足夠對比的色）
       --primary 白底文字僅 3.9:1、#94a3b8 白底僅 2.5:1，皆不足 AA 4.5:1 */
    --text-brand: var(--primary-dark);   /* 白底品牌色文字 9.6:1 */
    --text-muted: #64748b;               /* 白底次要灰字 4.8:1 */
    --text-muted-dark: #cbd5e1;          /* 深底（--primary-dark）次要灰字 6.9:1 */

    /* 三級警示色系統（僅警示模式使用；平時不沾）。值與 SiteAlert.AlertLevel 一致 */
    --alert-watch: #ea580c;
    --alert-watch-bg: #fff7ed;
    --alert-watch-text: #9a3412;
    --alert-watch-border: #fdba74;
    --alert-danger: #dc2626;
    --alert-danger-bg: #fef2f2;
    --alert-danger-text: #991b1b;
    --alert-danger-border: #fca5a5;

    /* 即時數據字體（儀表感；用系統等寬避免額外載入 web font） */
    --font-data: ui-monospace, "SF Mono", "Cascadia Mono", "Segoe UI Mono", "Consolas", "Noto Sans TC", monospace;

    /* 無障礙字級縮放（預設標準） */
    --font-scale: 1;
    --font-xs: calc(14px * var(--font-scale));
    --font-sm: calc(16px * var(--font-scale));
    --font-base: calc(18px * var(--font-scale));
    --font-lg: calc(20px * var(--font-scale));
    --font-xl: calc(24px * var(--font-scale));
    --font-2xl: calc(28px * var(--font-scale));
    --font-3xl: calc(32px * var(--font-scale));

    --line-normal: 1.7;
    --min-touch: 48px;

    box-sizing: border-box;
    font-family: "Noto Sans TC", "Microsoft JhengHei", sans-serif;
    scroll-behavior: smooth;
}

html.font-size-normal { --font-scale: 1; }
html.font-size-large { --font-scale: 1.15; }
html.font-size-xlarge { --font-scale: 1.3; }

*, ::before, ::after { box-sizing: inherit; }

body {
    margin: 0;
    font-family: "Noto Sans TC", "Microsoft JhengHei", sans-serif;
    font-size: var(--font-base);
    line-height: var(--line-normal);
    color: var(--text);
    background-color: var(--page-bg);
    /* sticky footer：header/main/footer 為 body 直接子元素（landmark 結構） */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
}

a { text-underline-offset: 3px; }

::-webkit-scrollbar { height: 8px; width: 8px; }
::-webkit-scrollbar-thumb { background-color: rgba(0,0,0,.3); border-radius: 4px; }

/* =========================================================
   Header
   ========================================================= */
.header {
    background: var(--primary);
    color: var(--white);
    padding: 12px 0;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: var(--white);
}

.logo-img {
    width: 58px;
    height: 58px;
    object-fit: contain;
}

.site-title {
    display: flex;
    flex-direction: column;
}

.site-chinese-name {
    font-size: var(--font-2xl);
    font-weight: bold;
    margin-bottom: 2px;
}

.subtitle {
    font-size: var(--font-xs);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.font-size-row {
    display: flex;
    align-items: center;
    gap: 8px;
    /* 深色底讓白色小字達 AA 對比（原 --primary 底白字僅 4.1:1） */
    background: rgba(0,0,0,.25);
    padding: 4px 4px 4px 12px;
    border-radius: 6px;
}

.font-size-label {
    font-size: var(--font-xs);
    white-space: nowrap;
    display: none;
}

.font-size-controls {
    display: flex;
    gap: 4px;
    align-items: center;
}

.font-size-btn {
    background: transparent;
    border: none;
    color: var(--white);
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: all .2s ease;
    min-width: 36px;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.font-size-btn[data-size="normal"] { font-size: 13px; }
.font-size-btn[data-size="large"] { font-size: 16px; }
.font-size-btn[data-size="xlarge"] { font-size: 19px; }

.font-size-btn:hover { background: rgba(255,255,255,.2); }
.font-size-btn.active { background: var(--white); color: var(--primary-dark); }

.login-button {
    background: var(--primary-dark);
    color: var(--white);
    padding: 9px 18px;
    border: 1px solid rgba(255,255,255,.85);
    border-radius: 4px;
    text-decoration: none;
    font-size: var(--font-sm);
    transition: background .3s;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.login-button:hover { background: var(--primary); }

/* =========================================================
   主導覽列
   ========================================================= */
.main-nav {
    background: var(--primary-dark);
    border-top: 1px solid rgba(255,255,255,.3);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    position: relative;
}

/* 最後一個可見選單項不留尾端分隔線（nav-item-mobile-login 桌機隱藏，故取倒數第 2 個） */
.nav-list > .nav-item:nth-last-child(2) .nav-link { border-right: none; }

.nav-item { position: relative; flex: 1 1 0; }

.nav-link {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    padding: 14px 20px;
    text-decoration: none;
    font-size: var(--font-base);
    transition: background .3s;
    border-right: 1px solid rgba(255,255,255,.2);
    min-height: var(--min-touch);
    white-space: nowrap;
}

.nav-link:hover { background: rgba(255,255,255,.15); }

.dropdown-content {
    display: none;
    position: absolute;
    background: var(--white);
    min-width: 220px;
    box-shadow: 0 2px 8px rgba(0,0,0,.2);
    z-index: 1000;
}

.dropdown-content a {
    color: var(--text);
    padding: 13px 18px;
    text-decoration: none;
    display: flex;
    align-items: center;
    font-size: var(--font-sm);
    border-bottom: 1px solid #eee;
    min-height: var(--min-touch);
}

.dropdown-content li:last-child a { border-bottom: none; }
.dropdown-content a:hover { background: var(--accent-bg); color: var(--text-brand); }

.nav-item.has-dropdown:hover .dropdown-content,
.nav-item.has-dropdown.open .dropdown-content { display: block; }

/* 漢堡按鈕 */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 1001;
}

.menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--white);
    transition: all .3s ease;
    border-radius: 1px;
    position: relative;
}

.menu-toggle span:nth-child(2) { margin: 6px 0; }
.menu-toggle.active span:nth-child(1) { transform: rotate(45deg); top: 8px; }
.menu-toggle.active span:nth-child(2) { opacity: 0; transform: translateX(-10px); }
.menu-toggle.active span:nth-child(3) { transform: rotate(-45deg); top: -8px; }

.dropdown-arrow {
    display: none;
    margin-left: auto;
    padding: 4px 8px;
    font-size: 12px;
    transition: transform .3s ease;
}

.nav-item.open .dropdown-arrow { transform: rotate(180deg); }

.nav-item-mobile-login,
.mobile-font-size { display: none; }

/* =========================================================
   內頁標題橫幅 + 內容容器
   ========================================================= */
.main {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 24px 20px 40px;
}

.page-title-banner {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    color: var(--white);
    border-radius: 14px;
    padding: 26px 32px;
    font-size: var(--font-2xl);
    font-weight: bold;
    letter-spacing: .05em;
    box-shadow: 0 4px 16px rgba(90,35,115,.18);
    margin-bottom: 24px;
}

/* 標題橫幅改放整張 banner 圖（圖內已含文字，不再疊文字） */
.page-title-banner--image { padding: 0; background: none; overflow: hidden; }
    .page-title-banner--image img { width: 100%; display: block; }

.content {
    background: var(--white);
    border-radius: 14px;
    box-shadow: 0 2px 12px rgba(0,0,0,.06);
    padding: 28px 32px;
}

/* 通用漸層按鈕（外國人防災宣導 CTA 等沿用） */
.quick-link-btn {
    display: inline-flex;
    align-items: center;
    gap: .5em;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    text-decoration: none;
    /* 20px 粗體屬大型文字（對比門檻 3:1），漸層最淺端 4.1:1 才能達標 */
    font-size: var(--font-lg);
    font-weight: 700;
    border-radius: 30px;
    padding: .7em 1.8em;
    box-shadow: 0 2px 8px rgba(90,35,115,.18);
    transition: background .2s, transform .2s, box-shadow .2s;
    letter-spacing: .05em;
}

    .quick-link-btn:hover {
        background: linear-gradient(90deg, var(--primary-dark) 0%, var(--primary) 100%);
        color: var(--white);
        transform: translateY(-2px) scale(1.03);
        box-shadow: 0 4px 16px rgba(90,35,115,.28);
    }

    .quick-link-btn i { font-size: 1.2em; }

    .content h2 {
        font-size: var(--font-xl);
        font-weight: bold;
        margin: 0 0 .3em;
        color: var(--text);
    }

    .content h3 {
        font-size: var(--font-lg);
        font-weight: bold;
        padding: 1.2em 0 .4em;
        margin: 0;
        color: var(--text-brand);
    }

/* =========================================================
   首頁 — 輪播
   ========================================================= */
.carousel-wrapper {
    background: var(--panel-bg);
    padding: 20px 0;
}

.carousel {
    position: relative;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    aspect-ratio: 16 / 9;
    max-height: 520px;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,.15);
}

.carousel-inner {
    display: flex;
    transition: transform .5s ease-in-out;
    height: 100%;
}

.carousel-slide {
    min-width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .carousel-slide img {
        width: 100%;
        height: 100%;
        object-fit: contain;
        background: linear-gradient(180deg, #f8f9fa 0%, #e9ecef 100%);
    }

.carousel-controls {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    pointer-events: none;
}

.carousel-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary-dark);
    border: none;
    cursor: pointer;
    font-size: 24px;
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    transition: all .3s;
    box-shadow: 0 2px 10px rgba(0,0,0,.2);
}

.carousel-btn:hover { background: var(--primary); transform: scale(1.1); }

.carousel-indicators {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 15px 0;
    background: var(--panel-bg);
}

.carousel-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(90,35,115,.3);
    border: 2px solid var(--primary-dark);
    cursor: pointer;
    transition: all .3s;
}

.carousel-dot.active { background: var(--primary-dark); transform: scale(1.2); }

/* =========================================================
   首頁 — EOC 監控看板
   ========================================================= */
.eoc-section {
    background: var(--panel-bg);
    padding: 30px 0;
}

.eoc-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.eoc-panel {
    background: var(--white);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,.1);
    overflow: hidden;
}

.eoc-header {
    background: var(--primary-dark);
    padding: 18px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.eoc-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.breathing-dot {
    width: 14px;
    height: 14px;
    background: #4caf50;
    border-radius: 50%;
    animation: breathing 2s infinite ease-in-out;
}

@keyframes breathing {
    0% { box-shadow: 0 0 0 0 rgba(76,175,80,.7); }
    70% { box-shadow: 0 0 0 10px rgba(76,175,80,0); }
    100% { box-shadow: 0 0 0 0 rgba(76,175,80,0); }
}

.eoc-header h2 {
    color: var(--white);
    font-size: var(--font-xl);
    font-weight: bold;
    margin: 0;
}

.eoc-header-right {
    color: var(--text-muted-dark);
    font-size: var(--font-sm);
}

.eoc-grid {
    display: grid;
    /* 依卡片數量自動均分欄位（3 張平均佔滿、4 張維持四欄） */
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.eoc-card {
    padding: 28px 20px;
    text-align: center;
    border-right: 1px solid var(--border);
    transition: background .3s;
}

.eoc-card:last-child { border-right: none; }
.eoc-card:hover { background: #f8fafc; }

.eoc-card-label {
    color: #64748b;
    font-size: var(--font-sm);
    margin-bottom: 12px;
}

.eoc-card-value {
    font-size: var(--font-2xl);
    font-weight: bold;
    margin-bottom: 8px;
    color: #1e293b;
}

.eoc-card-value.safe { color: var(--success); }
.eoc-card-value.warning { color: var(--warning); }
.eoc-card-value.danger { color: #dc2626; }

.eoc-status-badge {
    display: inline-block;
    padding: 5px 14px;
    border-radius: 20px;
    font-size: var(--font-sm);
    font-weight: bold;
}

.eoc-status-badge.safe { background: #dcfce7; color: #166534; }
.eoc-status-badge.warning { background: #fef3c7; color: #92400e; }
.eoc-status-badge.danger { background: #fee2e2; color: #991b1b; }

.eoc-card-sub {
    color: var(--text-muted);
    font-size: var(--font-sm);
    margin-top: 4px;
}

.eoc-weather {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.eoc-weather-icon { font-size: 32px; }

.eoc-weather-temp {
    font-size: var(--font-xl);
    font-weight: bold;
    color: #1e293b;
}

.eoc-link-inline {
    display: inline-block;
    margin-top: 8px;
    font-size: var(--font-xs);
    color: var(--text-brand);
    text-decoration: underline;
}

/* =========================================================
   首頁 — 最新消息 + 側欄
   ========================================================= */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px;
    width: 100%;
}

.content-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.section-title {
    font-size: var(--font-xl);
    color: var(--primary);
    padding: 14px 18px;
    background: var(--accent-bg);
    border-left: 5px solid var(--primary);
    margin: 0 0 18px;
}

.news-section { background: var(--white); }

.news-list { list-style: none; margin: 0; padding: 0; }

.news-item {
    padding: 16px 18px;
    border-bottom: 1px dotted #ddd;
    display: flex;
    align-items: baseline;
    gap: 18px;
}

.news-item:last-child { border-bottom: none; }
.news-item:hover { background: #f9f9f9; }

.news-date {
    color: var(--text-sub);
    font-size: var(--font-sm);
    white-space: nowrap;
    min-width: 96px;
}

.news-title {
    flex: 1;
    font-size: var(--font-base);
}

    .news-title a { color: var(--text); text-decoration: none; }
    .news-title a:hover { color: var(--text-brand); text-decoration: underline; }

.news-more {
    color: var(--text-brand);
    font-size: var(--font-sm);
    white-space: nowrap;
    text-decoration: none;
    padding: 8px 12px;
    background: var(--accent-bg);
    border-radius: 4px;
    transition: background .2s;
}

.news-more:hover { background: #EBDCE7; text-decoration: underline; }

.news-footer { text-align: center; margin-top: 15px; }

.sidebar-section {
    margin-bottom: 20px;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
}

.sidebar-title {
    background: var(--primary);
    color: var(--white);
    padding: 14px 18px;
    font-size: var(--font-lg);
    font-weight: bold;
}

.sidebar-content { padding: 8px 18px; }

.quick-link {
    display: block;
    padding: 14px 4px;
    color: var(--text);
    text-decoration: none;
    border-bottom: 1px solid #eee;
    font-size: var(--font-base);
    min-height: var(--min-touch);
}

.quick-link:last-child { border-bottom: none; }
.quick-link:hover { color: var(--text-brand); }

.quick-link::before { content: "• "; color: var(--text-brand); margin-right: 5px; }

.emergency-contact { line-height: 2; padding: 14px 18px; }
.emergency-hotline { color: var(--danger); font-weight: bold; font-size: var(--font-lg); margin: 0 0 6px; }
.emergency-contact p { margin: 2px 0; font-size: var(--font-base); }

/* =========================================================
   首頁 — 相關連結
   ========================================================= */
.related-links-section {
    background: #F5EDF3;
    padding: 50px 0;
}

.related-links-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.related-links-title {
    font-size: var(--font-2xl);
    color: var(--primary-dark);
    text-align: center;
    margin: 0 0 35px;
    font-weight: bold;
}

.link-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.link-card {
    background: var(--white);
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    box-shadow: 0 2px 10px rgba(0,0,0,.1);
    transition: all .3s;
    border: 1px solid var(--border);
}

.link-card:hover { transform: translateY(-5px); box-shadow: 0 8px 25px rgba(0,0,0,.15); }

.link-card-img {
    width: 100%;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    padding: 15px;
}

    .link-card-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
    .link-card-img i { font-size: 56px; color: var(--primary); }

.link-card-title {
    padding: 15px;
    text-align: center;
    font-size: var(--font-base);
    font-weight: bold;
    color: var(--primary-dark);
    border-top: 1px solid var(--border);
}

/* =========================================================
   列表頁（即時資訊 / 各 ListPage）
   ========================================================= */
.events { list-style: none; margin: 0; padding: 0; }

.event-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
    background: var(--accent-bg);
    color: var(--text-brand);
    font-weight: bold;
    font-size: var(--font-base);
    border-radius: 8px;
    margin-bottom: 8px;
}

    .event-header .event-date { flex: 0 0 5em; text-align: center; }
    .event-header .event-infomation { flex: 1 1 5em; padding: 0; }
    .event-header .event-type { flex: 0 0 8em; text-align: center; display: flex; justify-content: center; }

.event-box {
    display: flex;
    align-items: center;
    gap: 18px;
    cursor: pointer;
    padding: 16px 18px;
    color: var(--text);
    text-decoration: none;
    border-bottom: 1px dotted #ddd;
    transition: background .2s;
}

.events > li:not(.event-header):nth-of-type(even) .event-box { background: #FBF7FA; }
.event-box:hover { background: #F5EDF3; }

.event-date {
    flex: 0 0 5em;
    text-align: center;
    color: var(--text-brand);
    line-height: 1.2;
}

.event-year { font-size: var(--font-sm); }
.event-month { font-size: var(--font-lg); font-weight: 900; }
.event-week { font-size: var(--font-xs); white-space: nowrap; }

.event-infomation {
    flex: 1 1 5em;
    display: flex;
    flex-direction: column;
    gap: .2em;
}

    .event-infomation h2 { font-size: var(--font-base); font-weight: 500; line-height: 1.4; margin: 0; }

.read-more { font-size: var(--font-xs); font-style: italic; color: var(--text-sub); margin: 0; }

.event-type {
    flex: 0 0 8em;
    display: flex;
    gap: .4em;
    justify-content: center;
    font-size: var(--font-sm);
    color: var(--text-sub);
}

.hidden { display: none; }
.tag-hidden { display: none; }

/* =========================================================
   列表頁變體 — 卡片版型（DC 活動花絮 / DE 兵棋推演 / DF 防災士專區）
   每筆為圓角外框，左標題、右發佈日期
   ========================================================= */
.events--card .event-box {
    justify-content: space-between;
    gap: 18px;
    padding: 18px 28px;
    margin-bottom: 16px;
    border: 1.5px solid var(--primary);
    border-bottom: 1.5px solid var(--primary);
    border-radius: 28px;
}

.events--card > li .event-box { background: transparent; }
.events--card .event-box:hover { background: var(--accent-bg); }

h2.event-card-title { font-size: var(--font-lg); font-weight: 700; line-height: 1.4; color: var(--primary-dark); margin: 0; }
.event-card-date { font-size: var(--font-sm); color: var(--text-sub); white-space: nowrap; }

/* =========================================================
   列表頁變體 — 平列版型（AA 即時資訊 / AB / AE / AF / AG）
   日期（左）+ 標題（右），斑馬紋平列、無外框
   ========================================================= */
.events--plain .event-box {
    align-items: center;
    gap: 24px;
    padding: 16px 18px;
    border-bottom: none;
}

.event-simple-date { flex: 0 0 auto; min-width: 110px; color: var(--text-sub); font-size: var(--font-sm); white-space: nowrap; }
.event-simple-title { flex: 1 1 auto; }
.event-simple-title h2 { font-size: var(--font-base); font-weight: 700; line-height: 1.5; color: var(--text); margin: 0; }

.pager-container { display: flex; justify-content: center; margin-top: 2.5em; }

.pager { display: flex; cursor: pointer; }

    .pager > * { border: 1px solid var(--border); padding: .5em 1em; min-width: 2.5em; text-align: center; }
    .pager > *:hover { background: var(--accent-bg); }
    .pager > * + * { border-left: none; }
    /* active 底色用深紫：--primary 配白字僅 4.1:1，不足 AA */
    .pager > *.active { cursor: default; background: var(--primary-dark); color: var(--white); border-color: var(--primary-dark); }

/* 標籤篩選（AH） */
.tag-container { display: flex; justify-content: center; margin-bottom: 2em; }
.tag { display: flex; flex-wrap: wrap; }

    .tag > * { font-size: var(--font-base); padding: .5em 1.2em; cursor: pointer; border: 1px solid var(--border); }
    .tag > * + * { border-left: none; }
    .tag > *:hover { background: var(--accent-bg); }
    .tag > *.active { background: var(--primary-dark); color: var(--white); border-color: var(--primary-dark); cursor: default; }

/* 民國年篩選（DF 防災士專區 / DE 兵棋推演）— 圓角藥丸按鈕，單選 */
.year-filter { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 24px; }

    .year-chip { font-size: var(--font-base); padding: .5em 1.4em; cursor: pointer; border: 1.5px solid var(--primary); border-radius: 999px; color: var(--primary-dark); white-space: nowrap; }
    .year-chip:hover { background: var(--accent-bg); }
    .year-chip.active { background: var(--primary-dark); color: var(--white); border-color: var(--primary-dark); cursor: default; }

/* 分類篩選（活動資訊 EA / 活動成果 EB）— 沿用年度藥丸樣式，單選 */
.category-filter { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 24px; }

    .category-chip { font-size: var(--font-base); padding: .5em 1.4em; cursor: pointer; border: 1.5px solid var(--primary); border-radius: 999px; color: var(--primary-dark); white-space: nowrap; }
    .category-chip:hover { background: var(--accent-bg); }
    .category-chip.active { background: var(--primary-dark); color: var(--white); border-color: var(--primary-dark); cursor: default; }

/* =========================================================
   防災電子圖資（AD，Views/Home/AD.cshtml）— 標題帶、類別卡片、鄉鎮市格狀、單一圖資卡
   類別卡片沿用 site.js 的 #tag 篩選；鄉鎮市搜尋在 site.js 檔尾
   ========================================================= */
.map-hero { position: relative; overflow: hidden; display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; padding: 40px 48px; margin-bottom: 24px; background: var(--primary-dark); color: var(--white); border-radius: 24px; box-shadow: 0 4px 16px rgba(90,35,115,.18); }
    .map-hero__contour { position: absolute; right: -60px; top: -40px; width: 680px; height: 320px; opacity: .16; pointer-events: none; }
    .map-hero__text { position: relative; display: flex; flex-direction: column; gap: 8px; max-width: 640px; }
    .map-hero__eyebrow { margin: 0; font-size: var(--font-xs); font-weight: 700; letter-spacing: .12em; color: var(--text-muted-dark); }
    .map-hero h1 { margin: 0; font-size: var(--font-3xl); font-weight: 900; letter-spacing: .04em; line-height: 1.2; }
    .map-hero__desc { margin: 0; font-size: var(--font-sm); line-height: 1.6; color: rgba(255,255,255,.88); }
    .map-hero__stats { position: relative; display: flex; gap: 12px; flex-shrink: 0; }
    .map-hero__stat { display: flex; flex-direction: column; align-items: center; min-width: 96px; padding: 14px 20px; border-radius: 16px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.22); }
    .map-hero__stat strong { font-size: var(--font-3xl); font-weight: 900; line-height: 1; }
    .map-hero__stat span { margin-top: 6px; font-size: var(--font-xs); color: rgba(255,255,255,.85); }

.content--map { background: #F4F1F7; }

.map-cats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 32px; }
    .map-cat { display: flex; align-items: center; gap: 14px; min-height: 76px; padding: 14px 18px; background: var(--white); border: 1.5px solid var(--border); border-radius: 16px; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
    .map-cat:hover { background: var(--accent-bg); border-color: var(--primary); }
    .map-cat.active { background: var(--primary-dark); border-color: var(--primary-dark); color: var(--white); cursor: default; }
    .map-cat__icon { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; flex-shrink: 0; border-radius: 12px; background: var(--accent-bg); color: var(--primary-dark); }
    .map-cat.active .map-cat__icon { background: rgba(255,255,255,.16); color: var(--white); }
    .map-cat__text { display: flex; flex-direction: column; min-width: 0; }
    .map-cat__name { font-size: var(--font-sm); font-weight: 700; line-height: 1.35; }
    .map-cat__sub { margin-top: 2px; font-size: var(--font-xs); color: var(--text-muted); }
    .map-cat.active .map-cat__sub { color: var(--text-muted-dark); }

.map-section__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 18px; }
    .content .map-section__head h2 { margin: 0 0 4px; font-size: var(--font-xl); font-weight: 900; letter-spacing: .02em; }
    .map-section__desc { margin: 0; font-size: var(--font-sm); color: var(--text-muted); }

.map-search { display: flex; align-items: center; gap: 10px; }
    .map-search label { font-size: var(--font-xs); font-weight: 500; color: var(--text-muted); white-space: nowrap; }
    .map-search__field { position: relative; display: block; }
    .map-search__field svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
    .map-search__input { width: 280px; max-width: 100%; min-height: var(--min-touch); padding: 8px 14px 8px 42px; font: inherit; font-size: var(--font-sm); color: var(--text); background: var(--white); border: 1.5px solid var(--border); border-radius: 12px; }
    .map-search__input:focus { border-color: var(--primary); }

.map-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
    .map-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 80px; padding: 16px 18px 16px 20px; background: var(--white); border: 1.5px solid var(--border); border-radius: 16px; color: var(--text); text-decoration: none; transition: box-shadow .12s ease, transform .12s ease; }
    .map-card:hover { border-color: var(--primary); box-shadow: 0 8px 20px rgba(90,35,115,.12); transform: translateY(-1px); color: var(--text); }
    .map-card.search-hidden { display: none; }
    .map-card__body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
    .map-card__title { font-size: var(--font-lg); font-weight: 700; letter-spacing: .02em; }
    .map-card__sub { font-size: var(--font-xs); color: var(--text-muted); }
    .map-card__arrow { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; flex-shrink: 0; border-radius: 50%; background: var(--accent-bg); color: var(--primary-dark); }
    .map-card:hover .map-card__arrow { background: var(--primary-dark); color: var(--white); }

.map-feature { display: flex; align-items: center; gap: 32px; padding: 36px; background: var(--white); border: 1.5px solid var(--border); border-radius: 24px; color: var(--text); text-decoration: none; }
    .map-feature + .map-feature { margin-top: 14px; }
    .map-feature:hover { border-color: var(--primary); box-shadow: 0 8px 20px rgba(90,35,115,.12); color: var(--text); }
    .map-feature__icon { display: flex; align-items: center; justify-content: center; width: 148px; height: 148px; flex-shrink: 0; border-radius: 24px; background: var(--accent-bg); color: var(--primary-dark); }
    .map-feature__body { display: flex; flex-direction: column; gap: 12px; flex-grow: 1; min-width: 0; }
    .map-feature__meta { font-size: var(--font-xs); color: var(--text-muted); }
    .map-feature__title { font-size: var(--font-2xl); font-weight: 900; letter-spacing: .02em; line-height: 1.25; }
    .map-feature__btn { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; min-height: 44px; padding: 10px 22px; border-radius: 12px; background: var(--primary-dark); color: var(--white); font-size: var(--font-sm); font-weight: 700; }

.map-empty { margin: 0; padding: 24px; text-align: center; color: var(--text-muted); background: var(--white); border: 1.5px dashed var(--border); border-radius: 16px; }
    .map-empty[hidden] { display: none; }

@media (max-width: 1024px) {
    .map-cats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .map-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
    .map-hero { flex-direction: column; align-items: flex-start; gap: 16px; padding: 24px 22px; border-radius: 20px; }
    .map-hero__contour { right: -180px; top: -60px; width: 520px; height: 250px; }
    .map-hero h1 { font-size: var(--font-2xl); }
    .map-hero__stats { gap: 8px; }
    .map-hero__stat { flex-direction: row; gap: 6px; min-width: 0; padding: 6px 12px; border-radius: 999px; }
    .map-hero__stat strong { font-size: var(--font-sm); }
    .map-hero__stat span { margin-top: 0; }
    .map-cat { min-height: 60px; gap: 10px; padding: 12px; border-radius: 14px; }
    .map-cat__icon { width: 36px; height: 36px; border-radius: 10px; }
    .map-section__head { flex-direction: column; align-items: stretch; gap: 12px; }
    .map-search label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .map-search__field { flex-grow: 1; }
    .map-search__input { width: 100%; }
    .map-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .map-card { min-height: 72px; padding: 14px 12px 14px 16px; border-radius: 14px; }
    .map-card__title { font-size: var(--font-base); }
    .map-feature { flex-direction: column; align-items: flex-start; gap: 20px; padding: 24px; }
    .map-feature__icon { width: 96px; height: 96px; }
    .map-feature__title { font-size: var(--font-xl); }
}

/* =========================================================
   影音專區（YouTube 網格 AH / DD）
   ========================================================= */
.youtubes {
    display: grid;
    grid-template-columns: 1fr;
    list-style: none;
    gap: 2.5em;
    margin: 0;
    padding: 0;
}

.youtube { display: flex; flex-direction: column; }

    .youtube > iframe { width: 100%; aspect-ratio: 560 / 315; border: 0; border-radius: 8px; }

.youtube__title { font-size: var(--font-base); font-weight: 500; margin-top: .4em; }
.youtube__subtitle { font-size: var(--font-sm); color: var(--text-sub); }

/* =========================================================
   詳細頁
   ========================================================= */
.article-title {
    font-size: var(--font-xl);
    font-weight: 700;
    line-height: 1.4;
    color: var(--primary-dark);
    margin: 0 0 .6em;
    padding-bottom: .6em;
    border-bottom: 2px solid var(--primary);
}

.publish-date { color: var(--text-sub); font-size: var(--font-sm); text-align: right; margin-bottom: 1em; }

.wysiwyg { overflow-x: auto; padding: 1em 0; line-height: 1.9; }
    .wysiwyg img { max-width: 100%; height: auto; }
    .wysiwyg h1, .wysiwyg h2, .wysiwyg h3, .wysiwyg h4, .wysiwyg h5 {
        border-left: 4px solid var(--primary);
        padding-left: .6em;
        line-height: 1.4;
        margin: 1.2em 0 .4em;
    }

.google-form-link { margin: 1em 0; font-size: var(--font-base); }
    .google-form-link a { color: var(--text-brand); word-break: break-all; }

.files {
    font-size: var(--font-lg);
    display: grid;
    grid-template-columns: 1fr;
    gap: 1em;
    margin: .5em 0;
}

.file { cursor: pointer; color: var(--text); text-decoration: none; display: inline-flex; align-items: center; gap: .4em; }
.file:hover { text-decoration: underline; color: var(--text-brand); }
.file i { color: var(--primary); }

.detail-back { margin-top: 2.5em; text-align: center; }

/* 圖片輪播（詳細頁 / 相關照片）— 橫式縮圖列 */
.images-container { display: flex; align-items: center; gap: 8px; margin: .5em 0 0; }

.images { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 10px; overflow-x: auto; -ms-overflow-style: none; scrollbar-width: none; padding: 4px 2px; }
    .images::-webkit-scrollbar { display: none; }

.imgages-left, .imgages-right { flex: 0 0 auto; font-size: 1.8rem; line-height: 1; cursor: pointer; color: var(--primary); }
.imgages-close { font-size: 2rem; cursor: pointer; display: none; }

.image {
    flex: 0 0 auto;
    width: 300px;
    height: 200px;
    border-radius: .6em;
    position: relative;
    cursor: pointer;
    overflow: hidden;
    border: 1px solid var(--border);
}

    .image .image-backdrop {
        position: absolute;
        inset: 0;
        display: flex;
        justify-content: center;
        align-items: center;
        overflow: hidden;
    }

        .image .image-backdrop img { width: 100%; height: 100%; object-fit: cover; }

.images-container.fullscreen { position: fixed; inset: 0; z-index: 20; background: #000; margin: 0; }
    .images-container.fullscreen .imgages-left,
    .images-container.fullscreen .imgages-right {
        position: absolute; z-index: 21; color: var(--white);
        background: rgba(255,255,255,.1);
    }
    .images-container.fullscreen .imgages-left { left: 0; }
    .images-container.fullscreen .imgages-right { right: 0; }
    .images-container.fullscreen .imgages-close { position: absolute; display: block; top: 1em; right: 1em; color: var(--white); background: rgba(255,255,255,.1); }
    .images-container.fullscreen .images { position: absolute; inset: 0; }
    .images-container.fullscreen .image { width: 100vw; min-width: 100vw; height: 100vh; border: none; border-radius: 0; }
        .images-container.fullscreen .image .image-backdrop { inset: 0; background: #000; border-radius: 0; }
            .images-container.fullscreen .image .image-backdrop img { width: auto; height: auto; max-width: 85%; max-height: 85%; object-fit: contain; }

/* =========================================================
   頁尾（網站地圖 + 聯絡資訊）
   ========================================================= */
.sitemap { background: var(--primary-dark); padding: 50px 0 24px; }

.sitemap-container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

.sitemap-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 30px;
    padding-bottom: 36px;
    border-bottom: 1px solid rgba(255,255,255,.15);
    margin-bottom: 28px;
}

.sitemap-column h4 {
    color: var(--white);
    font-size: var(--font-base);
    font-weight: bold;
    margin: 0 0 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sitemap-dot { width: 8px; height: 8px; border-radius: 50%; }
.sitemap-dot.red { background: #ef4444; }
.sitemap-dot.blue { background: #C8AFC8; }
.sitemap-dot.gray { background: #64748b; }

.sitemap-column ul { list-style: none; margin: 0; padding: 0; }
.sitemap-column li { margin-bottom: 12px; }

.sitemap-column a { color: var(--text-muted-dark); text-decoration: none; font-size: var(--font-sm); transition: color .3s; }
.sitemap-column a:hover { color: var(--white); }

.sitemap-column a.highlight { color: #C8AFC8; font-weight: bold; display: inline-flex; align-items: center; gap: 6px; }
.sitemap-column a.highlight:hover { color: #DCC9DC; }

.contact-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 30px 60px;
    padding-bottom: 24px;
    border-bottom: 1px solid rgba(255,255,255,.15);
    margin-bottom: 18px;
}

.contact-org { color: #e2e8f0; font-weight: bold; font-size: var(--font-base); margin-bottom: 6px; }
.contact-line { color: var(--text-muted-dark); font-size: var(--font-sm); line-height: 1.6; }

.footer-bottom { text-align: center; color: var(--text-muted-dark); font-size: var(--font-sm); }
    .footer-bottom p { margin: 6px 0; }
    .footer-bottom a { color: var(--text-muted-dark); text-decoration: none; }
    .footer-bottom a:hover { color: var(--white); }

/* =========================================================
   RWD — 平板（<=1024px）
   ========================================================= */
@media (max-width: 1024px) {
    .nav-link { padding: 14px 14px; font-size: var(--font-sm); }

    .content-layout { grid-template-columns: 1fr; }

    .eoc-grid { grid-template-columns: repeat(2, 1fr); }
    .eoc-card:nth-child(1), .eoc-card:nth-child(2) { border-bottom: 1px solid var(--border); }
    .eoc-card:nth-child(2) { border-right: none; }

    .link-cards { grid-template-columns: repeat(2, 1fr); }
    .sitemap-grid { grid-template-columns: repeat(3, 1fr); }
}

/* =========================================================
   RWD — 手機（<=768px）：抽屜選單
   ========================================================= */
@media (max-width: 768px) {
    .events--card .event-box { flex-wrap: wrap; gap: .4em; padding: 16px 20px; }

    .header-container { flex-direction: column; gap: 10px; position: relative; }
    .header-actions { gap: 10px; }
    .font-size-row { display: none; }
    .login-button { display: none; }

    .site-chinese-name { font-size: var(--font-xl); }

    .main-nav { position: relative; }

    .menu-toggle {
        display: flex;
        position: fixed;
        right: 15px;
        top: 15px;
        z-index: 1002;
        background: rgba(90,35,115,.92);
        border-radius: 4px;
    }

    .nav-container {
        position: fixed;
        inset: 0;
        background: var(--primary-dark);
        flex-direction: column;
        padding: 80px 0 20px;
        transform: translateX(100%);
        transition: transform .3s ease;
        overflow-y: auto;
        z-index: 1000;
    }

    .nav-container.open { transform: translateX(0); }

    .nav-item { width: 100%; flex: 0 0 auto; border-bottom: 1px solid rgba(255,255,255,.15); }

    .nav-link {
        border-right: none;
        justify-content: space-between;
        min-height: 56px;
        padding: 0 20px;
        font-size: var(--font-lg);
    }

    .dropdown-arrow { display: inline-block; }

    .dropdown-content {
        position: static;
        display: block;
        box-shadow: none;
        background: rgba(0,0,0,.15);
        min-width: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height .3s ease;
    }

    .nav-item.has-dropdown:hover .dropdown-content { max-height: 0; }
    .nav-item.has-dropdown.open .dropdown-content { max-height: 800px; }

    .dropdown-content a {
        color: var(--white);
        padding: 0 20px 0 40px;
        border-bottom: 1px solid rgba(255,255,255,.1);
        min-height: 52px;
        font-size: var(--font-sm);
    }

    .dropdown-content a:hover { background: rgba(255,255,255,.1); color: var(--white); }

    body.menu-open { overflow: hidden; }

    .nav-item-mobile-login {
        display: block;
        margin-top: auto;
        border-top: 2px solid rgba(255,255,255,.3);
    }

        .nav-item-mobile-login .nav-link { background: rgba(255,255,255,.1); justify-content: center; font-weight: bold; }

    .mobile-font-size {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 15px 20px;
        background: rgba(0,0,0,.15);
    }

    .mobile-font-label { color: rgba(255,255,255,.9); font-size: var(--font-sm); }
    .mobile-font-controls { display: flex; gap: 8px; }

    .mobile-font-btn {
        width: 44px;
        height: 44px;
        border: 1px solid rgba(255,255,255,.5);
        border-radius: 6px;
        background: rgba(255,255,255,.1);
        color: var(--white);
        font-size: 16px;
        font-weight: bold;
        cursor: pointer;
    }

    .mobile-font-btn.active { background: var(--white); color: var(--primary-dark); border-color: var(--white); }

    /* 首頁區塊 */
    .carousel { max-height: 280px; border-radius: 8px; }
    .carousel-btn { width: 34px; height: 34px; font-size: 16px; }

    .eoc-header { flex-direction: column; align-items: flex-start; padding: 15px 20px; }
    .eoc-grid { grid-template-columns: 1fr; }
    .eoc-card { border-right: none; border-bottom: 1px solid var(--border); }
    .eoc-card:last-child { border-bottom: none; }

    .link-cards { grid-template-columns: repeat(2, 1fr); gap: 15px; }
    .sitemap-grid { grid-template-columns: repeat(2, 1fr); gap: 24px; }

    .news-item { flex-direction: column; align-items: flex-start; gap: 5px; }

    /* 內頁 */
    .main { padding: 16px 14px 32px; }
    .page-title-banner { font-size: var(--font-xl); padding: 20px 22px; }
    .content { padding: 20px 18px; }
    .image { width: 76vw; height: 50vw; }
}

@media (max-width: 480px) {
    .link-cards { grid-template-columns: 1fr; }
    .sitemap-grid { grid-template-columns: 1fr; }
    .contact-bar { gap: 18px; }
}

/* =========================================================
   桌機字級標籤（顯示「字體大小：」）
   ========================================================= */
@media (min-width: 600px) {
    .font-size-label { display: block; }
}

/* 影音網格在較寬螢幕多欄 */
@media (min-width: 769px) {
    .youtubes { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 1100px) {
    .youtubes { grid-template-columns: 1fr 1fr 1fr; }
}

/* =========================================================
   避難收容處所查詢頁（.shelter-page 作用域，避免污染全站）
   ========================================================= */
.shelter-page { max-width: 1200px; margin: 30px auto; padding: 0 20px; }

.shelter-page .page-title,
.shelter-page .search-section,
.shelter-page .map-section {
    background: var(--white);
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.shelter-page .page-title { padding: 30px; margin-bottom: 30px; }
.shelter-page .page-title h1 {
    font-size: var(--font-3xl);
    color: var(--primary);
    margin-bottom: 10px;
}
.shelter-page .page-title p { font-size: var(--font-base); color: var(--text-sub); }

/* 搜尋區 */
.shelter-page .search-section { padding: 30px; margin-bottom: 30px; }
.shelter-page .search-form {
    display: grid;
    grid-template-columns: repeat(3, 1fr) auto;
    gap: 15px;
    align-items: end;
}
.shelter-page .form-group { display: flex; flex-direction: column; gap: 10px; }
.shelter-page .form-group label { font-size: var(--font-base); font-weight: bold; color: var(--text); }
.shelter-page .form-group select,
.shelter-page .form-group input {
    padding: 15px;
    font-size: var(--font-base);
    border: 2px solid var(--border);
    border-radius: 8px;
    background: var(--white);
}
.shelter-page .form-group select:focus,
.shelter-page .form-group input:focus { border-color: var(--accent); }
.shelter-page .search-button {
    padding: 15px 40px;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-size: var(--font-lg);
    font-weight: bold;
    cursor: pointer;
    min-height: var(--min-touch);
}
.shelter-page .search-button:hover { background: var(--primary-dark); }
.shelter-page .location-button {
    margin-top: 15px;
    width: 100%;
    padding: 15px 30px;
    background: var(--success-deep);
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-size: var(--font-base);
    font-weight: bold;
    cursor: pointer;
    min-height: var(--min-touch);
}
.shelter-page .location-button:hover { filter: brightness(0.92); }

/* 地圖區 */
.shelter-page .map-section { padding: 30px; margin-bottom: 30px; }
.shelter-page .map-section h2 {
    font-size: var(--font-xl);
    color: var(--primary);
    margin-bottom: 20px;
    padding: 14px 18px;
    background: var(--accent-bg);
    border-left: 5px solid var(--primary);
}
.shelter-page .map-container { width: 100%; height: 600px; border-radius: 8px; }
.shelter-page #map { width: 100%; height: 100%; border-radius: 8px; }

/* 清單卡片 */
.shelter-page .shelter-list { display: grid; gap: 20px; }
.shelter-page .shelter-card {
    background: var(--white);
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-left: 5px solid var(--accent);
}
.shelter-page .shelter-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 15px;
}
.shelter-page .shelter-name { font-size: var(--font-xl); font-weight: bold; color: var(--primary); flex: 1; }
.shelter-page .shelter-info { display: grid; gap: 12px; font-size: var(--font-base); color: var(--text-sub); margin-bottom: 15px; }
.shelter-page .info-row { display: flex; align-items: start; gap: 10px; }
.shelter-page .info-icon { font-size: var(--font-lg); min-width: 25px; }
.shelter-page .shelter-actions { display: flex; gap: 15px; margin-top: 20px; flex-wrap: wrap; }
.shelter-page .action-button {
    flex: 1;
    min-width: 150px;
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    font-size: var(--font-sm);
    font-weight: bold;
    cursor: pointer;
}
.shelter-page .action-button.primary { background: var(--primary-dark); color: var(--white); }
.shelter-page .action-button.primary:hover { filter: brightness(1.3); }
.shelter-page .action-button.secondary { background: #f5f5f5; color: var(--text); border: 2px solid var(--border); }
.shelter-page .action-button.secondary:hover { background: #e0e0e0; }

/* 重要提醒 */
.shelter-page .notes-section { background: #fff3e0; border: 2px solid var(--warning); }
.shelter-page .notes-section h2 { color: var(--warning); background: transparent; border-left-color: var(--warning); }
.shelter-page .notes-body { padding: 10px 5px; font-size: var(--font-base); line-height: 2; }
.shelter-page .notes-body p { margin-bottom: 15px; }

/* 地圖彈窗（避難收容處所）＝卡片式版型：色頭＋狀態徽章＋圖示資訊列＋導航鈕 */
.shelter-leaflet-popup .leaflet-popup-content-wrapper {
    padding: 0;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 8px 28px rgba(0, 0, 0, .18);
}
.shelter-leaflet-popup .leaflet-popup-content {
    margin: 0;
    width: 280px !important;
    line-height: 1.5;
}
.shelter-popup .sp-head {
    padding: 14px 16px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}
.shelter-popup .sp-title {
    width: 100%;
    margin: 0;
    color: var(--white);
    font-size: var(--font-lg);
    font-weight: 700;
    line-height: 1.35;
    overflow-wrap: anywhere;
    /* 過長名稱最多顯示兩行，其餘以 … 截斷（完整名稱見 title 提示與清單） */
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}

.shelter-popup .sp-body { padding: 14px 16px 6px; }
.shelter-popup .sp-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 12px;
}
.shelter-popup .sp-ico { font-size: var(--font-sm); line-height: 1.5; }
.shelter-popup .sp-field { display: flex; flex-direction: column; min-width: 0; }
.shelter-popup .sp-label {
    font-size: var(--font-xs);
    color: var(--text-muted);
    margin-bottom: 1px;
}
.shelter-popup .sp-value {
    color: #1e293b;
    font-size: var(--font-sm);
    line-height: 1.45;
    overflow-wrap: anywhere;
}
.shelter-popup .sp-phone { color: var(--text-brand); font-weight: 700; text-decoration: none; }
.shelter-popup .sp-phone:hover { text-decoration: underline; }
.shelter-popup .sp-muted { color: var(--text-muted); }

.shelter-popup .sp-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: -2px 0 8px;
}
.shelter-popup .sp-tag {
    padding: 2px 10px;
    border-radius: 999px;
    background: #f1e9f0;
    color: var(--primary-dark);
    font-size: var(--font-xs);
    font-weight: 600;
}

.shelter-popup .sp-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 2px 16px 16px;
}
.shelter-popup .sp-actions button {
    display: block;
    width: 100%;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: var(--font-sm);
    font-weight: 700;
    cursor: pointer;
    transition: background .2s, color .2s;
}
.shelter-popup .navigate-btn {
    background: var(--primary-dark);
    color: var(--white);
    border: none;
}
.shelter-popup .navigate-btn:hover { filter: brightness(1.3); }
.shelter-popup .close-btn {
    background: var(--white);
    color: var(--primary-dark);
    border: 1px solid var(--border);
}
.shelter-popup .close-btn:hover { background: #f1e9f0; }

@media (max-width: 768px) {
    .shelter-page .search-form { grid-template-columns: 1fr; }
    .shelter-page .map-container { height: 400px; }
    .shelter-page .shelter-header { flex-direction: column; }
    .shelter-page .shelter-actions { flex-direction: column; }
    .shelter-page .action-button { min-width: 100%; }
}

/* =========================================================
   警示模式（平時模式完全不使用以下樣式）
   ＝全站警示列 .alert-ribbon ＋ 首頁狀態 Hero .status-hero
   色場由等級 modifier（--watch／--danger）決定
   ========================================================= */

/* 即時數據：等寬、表格化數字，視覺上與內文區隔（儀表讀數感） */
.status-data {
    font-family: var(--font-data);
    font-variant-numeric: tabular-nums;
    letter-spacing: .01em;
}

/* ---- 全站警示列（每頁頂部） ---- */
.alert-ribbon {
    width: 100%;
    border-bottom: 3px solid;
}

.alert-ribbon--watch { background: var(--alert-watch-bg); border-bottom-color: var(--alert-watch); }
.alert-ribbon--danger { background: var(--alert-danger-bg); border-bottom-color: var(--alert-danger); }

.alert-ribbon-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.alert-ribbon-badge {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 14px;
    border-radius: 6px;
    color: var(--white);
    font-weight: 700;
    font-size: var(--font-sm);
}

.alert-ribbon--watch .alert-ribbon-badge { background: var(--alert-watch); }
.alert-ribbon--danger .alert-ribbon-badge { background: var(--alert-danger); }

.alert-ribbon-text {
    flex: 1;
    min-width: 0;
    font-weight: 700;
    font-size: var(--font-base);
}

.alert-ribbon--watch .alert-ribbon-text { color: var(--alert-watch-text); }
.alert-ribbon--danger .alert-ribbon-text { color: var(--alert-danger-text); }

.alert-ribbon-link {
    flex-shrink: 0;
    font-size: var(--font-sm);
    font-weight: 700;
    text-decoration: underline;
    white-space: nowrap;
}

.alert-ribbon--watch .alert-ribbon-link { color: var(--alert-watch-text); }
.alert-ribbon--danger .alert-ribbon-link { color: var(--alert-danger-text); }

/* ---- 首頁警示 Hero：沿用平時的 EOC 監控看板版型，僅讓它「升溫」 ----
   （.eoc-section/.eoc-panel/.eoc-header/.eoc-grid/.eoc-card 等沿用平時定義，
     此處只覆寫 header 色、呼吸燈色，並新增結論帶與避難捷徑） */

.eoc-panel--watch .eoc-header { background: var(--alert-watch); }
.eoc-panel--danger .eoc-header { background: var(--alert-danger); }
.eoc-panel--alert .eoc-header-right { color: rgba(255, 255, 255, .9); }

/* header 呼吸燈改為等級色（平時為綠） */
.breathing-dot--watch { background: var(--alert-watch); animation-name: breathingWatch; }
.breathing-dot--danger { background: var(--alert-danger); animation-name: breathingDanger; }

@keyframes breathingWatch {
    0% { box-shadow: 0 0 0 0 rgba(234, 88, 12, .7); }
    70% { box-shadow: 0 0 0 10px rgba(234, 88, 12, 0); }
    100% { box-shadow: 0 0 0 0 rgba(234, 88, 12, 0); }
}

@keyframes breathingDanger {
    0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, .7); }
    70% { box-shadow: 0 0 0 10px rgba(220, 38, 38, 0); }
    100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}

/* 結論帶：header 下方一句話結論（本頁最重要的新資訊） */
.eoc-verdict {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 30px;
    border-bottom: 1px solid var(--border);
}

.eoc-verdict--watch { background: var(--alert-watch-bg); }
.eoc-verdict--danger { background: var(--alert-danger-bg); }

.eoc-verdict-tag {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 6px;
    color: var(--white);
    font-weight: 800;
    font-size: var(--font-sm);
    white-space: nowrap;
}

.eoc-verdict--watch .eoc-verdict-tag { background: var(--alert-watch); }
.eoc-verdict--danger .eoc-verdict-tag { background: var(--alert-danger); }

.eoc-verdict-text { flex: 1; min-width: 0; }

.eoc-verdict-text strong {
    display: block;
    font-size: var(--font-lg);
    font-weight: 800;
    line-height: 1.4;
}

.eoc-verdict--watch .eoc-verdict-text strong { color: var(--alert-watch-text); }
.eoc-verdict--danger .eoc-verdict-text strong { color: var(--alert-danger-text); }

.eoc-verdict-text span {
    display: block;
    margin-top: 2px;
    font-size: var(--font-sm);
    color: var(--text-sub);
}

/* 避難收容捷徑（警示 Hero 第 4 格） */
.eoc-shelter-link {
    display: inline-block;
    margin-top: 4px;
    font-size: var(--font-base);
    font-weight: 700;
    text-decoration: none;
}

.eoc-panel--watch .eoc-shelter-link { color: var(--alert-watch-text); }
.eoc-panel--danger .eoc-shelter-link { color: var(--alert-danger-text); }
.eoc-shelter-link:hover { text-decoration: underline; }

@media (max-width: 600px) {
    .eoc-verdict { padding: 14px 18px; flex-wrap: wrap; }
}

/* 尊重使用者的減少動態偏好 */
@media (prefers-reduced-motion: reduce) {
    .breathing-dot { animation: none; }
}

/* =========================================================
   無障礙基礎（AA 標章）：sr-only / skip link / ::: 定位點 /
   焦點樣式 / 語意化選單 / div→button 改造之樣式重設
   ========================================================= */

/* 僅供螢幕報讀的隱藏文字 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* 跳到主要內容：Tab 第一下浮現於左上 */
.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 3000;
    background: var(--primary-dark);
    color: var(--white);
    padding: 10px 18px;
    font-weight: 700;
}

.skip-link:focus { left: 0; }

/* ::: 網頁區塊定位點（人工檢測需目視可見） */
.access-point {
    font-size: var(--font-xs);
    text-decoration: none;
    color: var(--text);
    align-self: flex-start;
}

.nav-container .access-point { color: var(--white); align-self: center; padding: 0 8px; }

/* 桌機版：::: 定位點脫離流內，避免擠佔第一欄，讓 7 欄完全等寬 */
@media (min-width: 769px) {
    .nav-container .access-point {
        position: absolute;
        left: 0;
        top: 50%;
        transform: translateY(-50%);
        padding: 0 4px;
    }
}
.sitemap .access-point { color: var(--white); }

/* 全站鍵盤焦點可見（深色底區改白框） */
:focus-visible { outline: 3px solid var(--primary-dark); outline-offset: 2px; }

.header :focus-visible,
.main-nav :focus-visible,
.sitemap :focus-visible,
.carousel :focus-visible,
.images-container.fullscreen :focus-visible { outline-color: var(--white); }

/* 主選單語意化結構（ul/li ＋ disclosure button） */
.nav-list {
    display: flex;
    flex: 1 1 auto;
    list-style: none;
    margin: 0;
    padding: 0;
}

ul.dropdown-content {
    list-style: none;
    margin: 0;
    padding: 0;
}

button.nav-link {
    appearance: none;
    background: transparent;
    border: none;
    border-right: 1px solid rgba(255,255,255,.2);
    font-family: inherit;
    line-height: var(--line-normal);
    text-align: left;
    cursor: pointer;
    width: 100%; /* button 預設不撐滿父容器（a 會），不加會縮成文字寬導致欄位分隔線不均 */
}

@media (max-width: 768px) {
    .nav-list { flex-direction: column; flex: 1 1 auto; width: 100%; }
    button.nav-link { width: 100%; border-right: none; }
}

/* div→button 改造的樣式重設：:where 零優先權，不干擾既有 class 樣式 */
:where(button.year-chip, button.category-chip, .tag > button, .pager > button,
       button.carousel-dot, button.imgages-left, button.imgages-right,
       button.imgages-close, button.image) {
    appearance: none;
    background-color: transparent;
    border: none;
    font: inherit;
    color: inherit;
    text-align: inherit;
    padding: 0;
    cursor: pointer;
}

/* 輪播暫停/播放鈕（與指示點同列） */
.carousel-pause {
    appearance: none;
    background: transparent;
    border: none;
    color: var(--primary-dark);
    font-size: var(--font-base);
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}

/* 頁面標題橫幅改為 h1 後蓋掉 UA 預設邊距 */
h1.page-title-banner { margin-top: 0; }
