:root {
    --page-padding: 16px;
    --card-w: 320px;
    --card-h: 520px;
    --card-r: 22px;
    --gap: 18px;
    --grey: #E6E6E6;
    --shadow: 0 6px 20px rgba(0, 0, 0, .08);
    --bottom-bar-h: 86px;
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    font-family: "Noto Serif TC", ui-serif, Georgia, "Times New Roman", serif;
    color: #111;
    background: #F4EBC6;

    width: 100%;
    max-width: 480px;
    margin-inline: auto;
    position: relative;
    min-height: 100dvh;
}

.page-wrap {
    padding: 20px var(--page-padding) calc(var(--bottom-bar-h) + 20px);
}

.page-wrap-for-fixed-header {
    padding: calc(20px + 64px) var(--page-padding) calc(var(--bottom-bar-h) + 20px);
}

.page-title {
    font-size: 30px;
    line-height: 1.2;
    font-weight: 900;
    letter-spacing: 2px;
    margin: 6px 0 16px;
}

/* 橫向輪播（scroll-snap + 拖曳） */
.snap-scroller {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(var(--card-w), 1fr);
    gap: var(--gap);
    overflow-x: auto;
    padding-bottom: 6px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    cursor: grab;
    scroll-behavior: smooth;

    /*
       修改這裡：
       pan-y 代表只允許垂直滑動，這會導致 Android 忽略橫向手勢。
       改成 pan-x pan-y (或 auto) 允許所有方向，讓 overflow-x: auto 自己處理
    */
    touch-action: pan-x pan-y;
}

.snap-scroller:active {
    cursor: grabbing;
}

.snap-scroller::-webkit-scrollbar {
    display: none;
}

.snap-card {
    scroll-snap-align: start;
    border-radius: var(--card-r);
    height: var(--card-h);
    position: relative;
    overflow: hidden;
}

.snap-card .corner-icon {
    position: absolute;
    top: 12px;
    left: 14px;
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: rgba(255, 255, 255, .85);
    display: grid;
    place-items: center;
    font-weight: 700;
    color: #8a8a8a;
}

.snap-card .card-title-bottom {
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: 18px;
    font-size: 28px;
    font-weight: 900;
    letter-spacing: 2px;
}

/* 左右淡出提示 */
.fade-edges {
    pointer-events: none;
    position: sticky;
    top: 0;
    height: 0;
}

.fade-left,
.fade-right {
    position: absolute;
    top: -36px;
    bottom: -36px;
    width: 30px;
    pointer-events: none;
}

.fade-left {
    left: 0;
    background: linear-gradient(90deg, #fff, rgba(255, 255, 255, 0));
}

.fade-right {
    right: 0;
    background: linear-gradient(270deg, #fff, rgba(255, 255, 255, 0));
}

/* 底部圓形導覽列（固定） */
.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: var(--bottom-bar-h);
    background: #22351A;
    display: flex;
    /* 添加這行 */
    align-items: center;
    /* 添加這行，讓內容垂直置中 */
}

/* 限制底部列也不超過 480 並置中 */
.bottom-nav-inner {
    width: 100%;
    max-width: 480px;
    margin-inline: auto;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    align-items: center;
    padding: 8px 10px;
    /* 移除不對稱的 padding */
}

.nav-circle {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    text-decoration: none;
    color: #111;
}

.nav-circle .icon {
    width: 54px;
    height: 54px;
    margin: 0;
    padding: 0;
    border-radius: 50%;
    background: #ACBD8A;
    display: grid;
    place-items: center;
    font-weight: 700;
    color: #8a8a8a;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .06) inset;
    line-height: 1;
    /* 添加這行 */
    font-size: 16px;
    /* 明確指定字體大小 */
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    gap: 6px;
}

.nav-text {
    font-size: 12px;
    color: #dedede;
    text-align: center;
    white-space: nowrap;
}

.news-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 16px;
}

.news-card {
    display: grid;
    grid-template-columns: 56px 1fr;
    align-items: center;
    column-gap: 12px;
    padding: 12px 16px;
    background: #ACBD8A;
    border-radius: 20px;
    box-shadow: var(--shadow);
}

.news-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #6F8E4B;
    display: grid;
    place-items: center;
    border: 1px solid rgba(0, 0, 0, .08);
}

.news-content .news-meta {
    font-size: 12px;
    color: #555;
    letter-spacing: .4px;
}

.news-content .news-title {
    margin: 2px 0 6px;
    font-size: 15px;
    font-weight: 900;
    letter-spacing: 1px;
}

.news-row {
    margin: 0;
}

/* 覆蓋 bootstrap 預設行距 */
.excerpt-col {
    padding-right: 8px;
    font-size: 13px;
    color: #333;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    /* 單行截斷只套在左側 8 欄 */
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: normal;
}

.news-link {
    color: #1a4a8a;
    text-decoration: underline;
    white-space: nowrap;
    /* 右側連結不換行、不被擠壓 */
    font-size: 13px;
}

.detail-header {
    display: flex;
    align-items: center;
    gap: 12px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #F4EBC6;
    z-index: 1000;
    padding: 20px var(--page-padding);
    max-width: 480px;
    margin: 0 auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .1);
}

.detail-header .btn-back {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: #6F8E4B;
    color: #f0f0f0;
    font-size: 18px;
    line-height: 1;
    display: grid;
    place-items: center;
    padding: 0;
}

/* 讓標題區塊取得彈性寬度，不影響左側返回按鈕 */
.detail-header .title-wrap {
    flex: 1;
    text-align: end;
}

/* 取消舊的 flex 影響，並保留原有字級樣式 */
.detail-header .detail-title {
    flex: unset;
    margin: 0;
    font-size: 36px;
    line-height: 1.2;
    font-weight: 900;
    letter-spacing: 2px;
}

.detail-header .subtitle-en {
    margin-top: 2px;
    font-size: 12px;
    color: #666;
    letter-spacing: .6px;
}

.photo-box {
    margin-top: 10px;
    width: 100%;
    aspect-ratio: 4 / 3;
    background: #E6E6E6;
    border-radius: 24px;
    display: grid;
    place-items: center;
    color: #fff;
    font-weight: 800;
    letter-spacing: 1px;
}

.detail-social {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 8px;
    padding-right: 2px;
}

.detail-social .sbtn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-weight: 700;
    font-size: 32px;
    display: grid;
    place-items: center;
    text-decoration: none;
}

.detail-content {
    margin-top: 12px;
}

.detail-content p {
    margin: 0 0 10px;
    line-height: 1.8;
}

.font-size-controls {
    position: fixed;
    right: 10px;
    bottom: 100px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1000;
}

.btn-font-size {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: rgba(111, 142, 75, 0.6);
    color: white;
    border: none;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.btn-font-size:active {
    transform: scale(0.95);
}

.btn-font-size span {
    line-height: 1;
}

.custom-font {
    font-size: 16px;
    transition: font-size 0.3s ease;
}

.js-drag-scroll {
    /* 保留捲動功能 */
    overflow-x: auto;
    overflow-y: hidden;

    /* iOS 關鍵屬性：開啟硬體加速的慣性捲動 */
    -webkit-overflow-scrolling: touch;

    /* 隱藏捲軸 */
    scrollbar-width: none;
    -ms-overflow-style: none;

    cursor: grab;
}

.js-drag-scroll::-webkit-scrollbar {
    display: none;
}

.js-drag-scroll:active {
    cursor: grabbing;
}

/* 搜尋 Bar 樣式 */
.search-form {
    width: 100%;
}

.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: #ACBD8A;
    border-radius: 20px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.search-input {
    flex: 1;
    padding: 14px 20px;
    border: none;
    background: transparent;
    font-size: 15px;
    font-family: "Noto Serif TC", ui-serif, Georgia, "Times New Roman", serif;
    color: #fff;
    outline: none;
}

.search-input::placeholder {
    color: #fff;
    opacity: 0.7;
}

.search-button {
    width: 40px;
    height: 40px;
    border: none;
    background: #6F8E4B;
    color: #fff;
    border-radius: 50%;
    margin-right: 4px;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 18px;
}

.search-button:hover {
    background: #5d7a3f;
}

.search-button:active {
    transform: scale(0.95);
}