/* ==========================================================================
   被動投資資訊站 - 日系工藝清爽風格 (KOYO BASE Cerulean & Ivory Aesthetic)
   Palette sampled directly from KOYO BASE official design:
     - 暖陶米白 (Porcelain Ivory Base): #F8F6ED
     - 晴藍青碧 (KOYO Cerulean Blue): #1285C5 / Hover: #0D6DA5
     - 深海藍墨 (Deep Oceanic Navy): #1A2F45
     - 內文舒適灰藍: #3E5263
     - 次要靜灰: #566A7C (全站唯一的灰色文字色，對比度 5.2:1，符合 WCAG AA)
     - 和風細緻陶線 (Hairline Border): #E2DDD1 / #DFDACD
     - 輕盈淡藍標籤底: #E9F3F9
   Typography:
     - 視窗友善排版 (Viewport-First Balance)：字體清晰飽滿，且首頁第一屏完整可見不破版
   Animations:
     - 保留首頁 3D 幾何旋轉網絡球體與縱向流動光標 (pathmove) 動畫 (青藍/海墨配色)
   ========================================================================== */

/* 網頁字型 (Noto Sans TC、Plus Jakarta Sans、Shippori Mincho) 由各頁 <head> 的 <link> 並行載入，見 build_pages.ps1 */

:root {
    --bg-base: #F8F6ED;
    --bg-surface: #FFFFFF;
    --bg-subtle: #F0ECE1;
    --color-primary: #1285C5;
    --color-primary-hover: #0D6DA5;
    --color-navy: #1A2F45;
    --color-text-main: #1A2F45;
    --color-text-body: #3E5263;
    --color-text-muted: #566A7C;
    --border-line: #E2DDD1;
    --border-card: #DFDACD;

    /* 兼容舊別名 */
    --color-terracotta: #1285C5;
    --color-terracotta-hover: #0D6DA5;
    --color-forest: #1A2F45;
    --color-forest-hover: #132435;
    --color-sumi: #1A2F45;
    --color-blue: #1285C5;
    --color-cyan: #1285C5;
}

html {
    font-size: 15px; /* 平衡字體級距，兼顧清晰大字與筆電首屏完整展示 */
}

@media (min-width: 1024px) {
    html {
        font-size: 15.5px;
    }
}

body {
    background-color: var(--bg-base);
    color: var(--color-text-body);
    font-family: 'Plus Jakarta Sans', 'Noto Sans TC', sans-serif;
    letter-spacing: -0.005em;
    line-height: 1.65;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* 典雅襯線體標題 (大器沉穩、繁體中文標竿) */
.font-mincho {
    font-family: 'Noto Serif TC', 'Shippori Mincho', serif;
}

/* 經典細線分割 */
.koyo-line-top, .octa-line-top {
    border-top: 1px solid var(--border-line);
}
.koyo-line-bottom, .octa-line-bottom {
    border-bottom: 1px solid var(--border-line);
}

/* 卡片微懸浮動態 */
.koyo-card, .octa-card {
    background: #FFFFFF;
    border: 1px solid var(--border-card);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), 
                box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1), 
                border-color 0.2s ease;
}
.koyo-card:hover, .octa-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 36px -8px rgba(26, 47, 69, 0.1);
    border-color: var(--color-primary);
}

/* 雙語翻轉導航 (Flip Effect) */
.l-navi-flip {
    display: inline-block;
    position: relative;
    overflow: hidden;
    height: 1.45em;
    vertical-align: middle;
}
.l-navi-flip > span {
    display: inline-block;
    transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.l-navi-flip::after {
    content: attr(data-text);
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    text-align: center;
    transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
    color: var(--color-primary);
    font-size: 0.95em;
    font-weight: 700;
}
.nav-link:hover .l-navi-flip > span {
    transform: translateY(-100%);
}
.nav-link:hover .l-navi-flip::after {
    transform: translateY(-100%);
}

/* KOYO BASE 經典圓角膠囊按鈕 (外框風格，靈感源自官網 Reserve 按鈕) */
.koyo-btn-pill, .octa-btn-pill {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.4rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    transition: all 0.25s ease;
    border: 1.5px solid var(--color-primary);
    color: var(--color-primary);
    background-color: transparent;
    overflow: hidden;
}
.koyo-btn-pill:hover, .octa-btn-pill:hover {
    background-color: var(--color-primary);
    color: #FFFFFF;
    box-shadow: 0 4px 14px rgba(18, 133, 197, 0.25);
}

/* KOYO BASE 晴藍主色實心按鈕 */
.koyo-btn-primary, .octa-btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 1.6rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1.5px solid var(--color-primary);
    background-color: var(--color-primary);
    color: #FFFFFF;
    box-shadow: 0 3px 12px rgba(18, 133, 197, 0.25);
}
.koyo-btn-primary:hover, .octa-btn-primary:hover {
    background-color: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(18, 133, 197, 0.35);
}

/* 深海藍墨副按鈕 */
.btn-sumi-dark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.4rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 700;
    background-color: var(--color-navy);
    color: #FFFFFF;
    border: 1.5px solid var(--color-navy);
    transition: all 0.25s ease;
}
.btn-sumi-dark:hover {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
}

/* 日系精緻標籤徽章 */
.koyo-badge-tag, .octa-badge-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.8rem;
    border-radius: 9999px;
    font-family: 'Plus Jakarta Sans', monospace;
    font-size: 0.725rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    background-color: #E9F3F9;
    color: var(--color-primary);
    border: 1px solid #D0E7F3;
}

/* 首頁縱向流動光標動態 (青藍配色) */
.octa-scroll-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    opacity: 0.85;
    transition: opacity 0.3s;
}
.octa-scroll-indicator:hover {
    opacity: 1;
}
.octa-scroll-line {
    width: 1.5px;
    height: 36px;
    background: rgba(26, 47, 69, 0.15);
    position: relative;
    overflow: hidden;
}
.octa-scroll-line::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, transparent, var(--color-primary), transparent);
    animation: pathmove 2.2s cubic-bezier(0.77, 0, 0.175, 1) infinite;
}

@keyframes pathmove {
    0% {
        transform: translateY(-100%);
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: translateY(100%);
        opacity: 0;
    }
}

/* Hero Canvas 容器 (保留 3D 幾何粒子球體動態) */
#octa-hero-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

/* 客製化捲動軸 */
::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}
::-webkit-scrollbar-track {
    background: var(--bg-base);
}
::-webkit-scrollbar-thumb {
    background: #D5CEC4;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary);
}

/* ==========================================================================
   手機與行動裝置體驗優化 · Mobile Responsive & Touch Ergonomics
   ========================================================================== */

/* 隱藏滾動軸但保留觸控滾動功能 */
.scrollbar-none {
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.scrollbar-none::-webkit-scrollbar {
    display: none;
}

/* 觸控點擊反饋 */
.touch-tap {
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.15s ease, opacity 0.15s ease;
}
.touch-tap:active {
    transform: scale(0.96);
    opacity: 0.85;
}

/* 底部導航欄 iOS 安全區適配 */
.mobile-safe-bottom {
    padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
}

/* 手機抽屜側滑過渡動態 */
#mobile-drawer-overlay {
    transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}
#mobile-drawer-panel {
    background-color: #F8F6ED !important;
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
   Hero 首頁首屏美學 · 左側乾草堆向右羽化溶鏡與和紙光澤襯底
   ========================================================================== */

/* Hero 左側意象圖片向右漸層羽化淡出遮罩 */
.hero-fade-mask-landscape {
    -webkit-mask-image: linear-gradient(to right, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0.9) 25%, rgba(0, 0, 0, 0.4) 55%, transparent 80%);
    mask-image: linear-gradient(to right, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0.9) 25%, rgba(0, 0, 0, 0.4) 55%, transparent 80%);
}

/* 日系和紙微透光澤襯底，確保在自然大景上具備最高文字對比與沈浸感 */
.koyo-washi-plate {
    background: rgba(248, 246, 237, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 4px 20px -2px rgba(26, 47, 69, 0.05);
}

/* ==========================================================================
   全站易讀性與無障礙基礎 · Readability & Accessibility Base
   ========================================================================== */

/* 錨點跳轉時避開吸頂導覽列，並讓跳轉平滑 */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 5rem;
}

/* 鍵盤操作時顯示清楚的焦點框；滑鼠點擊不顯示，避免干擾視覺 */
:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}
a:focus:not(:focus-visible),
button:focus:not(:focus-visible) {
    outline: none;
}

/* 數字等寬對齊：表格、統計數字、試算結果上下列才對得整齊，不會因字寬不同而跳動 */
.font-mono,
[data-stat],
table td,
table th,
output,
input[type="number"] {
    font-variant-numeric: tabular-nums;
}

/* 標題一律填滿每一行，不使用 balance (會把多行標題縮成等長而留下右側空白)，
   最後一行不剩一兩個字的問題由 js/ui.js 的標題孤字防護處理。內文用 pretty。 */
h1, h2, h3, h4, h5 {
    text-wrap: wrap;
}
p, li {
    text-wrap: pretty;
}

/* 使用者在系統設定「減少動態效果」時，關閉動畫與平滑捲動 */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 列印時隱藏導覽與固定元素，只留內容 */
@media print {
    header, #mobile-bottom-nav, .no-print {
        display: none !important;
    }
    body {
        background: #FFFFFF;
    }
}

/* 跳到主要內容：鍵盤使用者按 Tab 的第一個焦點，平時隱藏在畫面外 */
.skip-link {
    position: fixed;
    left: 1rem;
    top: -4rem;
    z-index: 1000;
    padding: 0.6rem 1rem;
    border-radius: 0.75rem;
    background: #1A2F45;
    color: #FFFFFF;
    font-size: 0.875rem;
    font-weight: 700;
    box-shadow: 0 8px 24px rgba(26, 47, 69, 0.25);
    transition: top 0.15s ease;
}
.skip-link:focus {
    top: 0.75rem;
    outline: 2px solid #FFFFFF;
    outline-offset: 2px;
}
/* 跳轉目標在被程式聚焦時不需要外框 */
main:focus, section:focus {
    outline: none;
}

/* 長文閱讀寬度：段落與清單項目最寬約 46 個字，超過的長行很難閱讀 (guide 頁原本最長一行達 168 字) */
main p,
main li {
    max-width: 46em;
}

/* 觸控裝置：篩選膠囊與組合按鈕的最小高度，避免手指點不準 */
@media (pointer: coarse) {
    .creator-filter-btn,
    .video-filter-btn,
    .category-btn,
    .pa-preset-pill,
    .pa-subtab-btn,
    .pa-growth-tf-btn {
        min-height: 40px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

/* ==========================================================================
   PIS_UI 共用介面元件 (js/ui.js)：提示、確認視窗、輸入視窗
   ========================================================================== */
.pis-toast-root {
    position: fixed;
    left: 50%;
    bottom: 1.25rem;
    transform: translateX(-50%);
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: min(92vw, 28rem);
    pointer-events: none;
}
@media (max-width: 767px) {
    /* 手機：避開底部導覽列 */
    .pis-toast-root { bottom: 5rem; }
}
.pis-toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.8rem 0.9rem 0.8rem 1rem;
    border-radius: 0.9rem;
    background: #FFFFFF;
    border: 1px solid var(--border-card);
    border-left-width: 4px;
    box-shadow: 0 12px 32px -10px rgba(26, 47, 69, 0.28);
    color: var(--color-navy);
    font-size: 0.875rem;
    line-height: 1.55;
    animation: pis-toast-in 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
.pis-toast--leaving { opacity: 0; transform: translateY(6px); transition: opacity 0.2s ease, transform 0.2s ease; }
.pis-toast > i:first-child { margin-top: 0.2rem; flex-shrink: 0; }
.pis-toast-text { flex: 1; white-space: pre-line; word-break: break-word; }
.pis-toast-close { flex-shrink: 0; width: 1.5rem; height: 1.5rem; border-radius: 9999px; color: #566A7C; display: inline-flex; align-items: center; justify-content: center; }
.pis-toast-close:hover { background: var(--bg-subtle); color: var(--color-navy); }
.pis-toast--success { border-left-color: #1F9D6B; }
.pis-toast--success > i:first-child { color: #1F9D6B; }
.pis-toast--info { border-left-color: var(--color-primary); }
.pis-toast--info > i:first-child { color: var(--color-primary); }
.pis-toast--warning { border-left-color: #C7821A; }
.pis-toast--warning > i:first-child { color: #C7821A; }
.pis-toast--error { border-left-color: #C23B3B; }
.pis-toast--error > i:first-child { color: #C23B3B; }
@keyframes pis-toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.pis-modal-open { overflow: hidden; }
.pis-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(26, 47, 69, 0.55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    animation: pis-fade-in 0.15s ease;
}
.pis-modal {
    width: min(100%, 26rem);
    border-radius: 1.25rem;
    background: #FFFFFF;
    border: 1px solid var(--border-card);
    box-shadow: 0 24px 60px -16px rgba(26, 47, 69, 0.45);
    padding: 1.4rem 1.4rem 1.1rem;
    color: var(--color-navy);
    animation: pis-toast-in 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.pis-modal-title { font-family: 'Shippori Mincho', 'Noto Serif TC', serif; font-weight: 800; font-size: 1.125rem; margin-bottom: 0.4rem; }
.pis-modal-msg { font-size: 0.9rem; line-height: 1.65; color: var(--color-text-body); white-space: pre-line; word-break: break-word; max-width: none; }
.pis-modal-input {
    width: 100%;
    margin-top: 0.85rem;
    padding: 0.6rem 0.8rem;
    border-radius: 0.75rem;
    border: 1.5px solid var(--border-card);
    background: var(--bg-base);
    font-size: 0.95rem;
    color: var(--color-navy);
}
.pis-modal-input:focus { border-color: var(--color-primary); outline: none; background: #FFFFFF; }
.pis-modal-actions { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 1.2rem; flex-wrap: wrap; }
.pis-btn {
    min-height: 2.5rem;
    padding: 0.5rem 1.15rem;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    font-weight: 700;
    border: 1.5px solid transparent;
    transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.pis-btn:active { transform: translateY(1px); }
.pis-btn--primary { background: var(--color-primary); color: #FFFFFF; }
.pis-btn--primary:hover { background: var(--color-primary-hover); }
.pis-btn--danger { background: #B93232; color: #FFFFFF; }
.pis-btn--danger:hover { background: #962727; }
.pis-btn--ghost { background: #FFFFFF; border-color: var(--border-card); color: var(--color-navy); }
.pis-btn--ghost:hover { background: var(--bg-base); border-color: #BFB8A8; }
@keyframes pis-fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ==========================================================================
   深色閱讀模式 (由 js/theme.js 切換 html.pis-dark，使用者自行開啟)
   做法：整頁色彩反轉再校正色相，圖片、影片、縮圖再轉回原色。屬於近似效果，不是逐色手調。
   ========================================================================== */
html.pis-dark {
    filter: invert(1) hue-rotate(180deg);
    background-color: #FFFFFF;
}
html.pis-dark img,
html.pis-dark video,
html.pis-dark picture,
html.pis-dark iframe,
html.pis-dark .pis-no-invert,
html.pis-dark [style*="url("] {
    filter: invert(1) hue-rotate(180deg);
}
/* 列印與匯出 PDF 時一律使用淺色 */
@media print {
    html.pis-dark,
    html.pis-dark img,
    html.pis-dark video,
    html.pis-dark picture,
    html.pis-dark iframe,
    html.pis-dark [style*="url("] {
        filter: none;
    }
}
/* 投稿視窗表單 */
.pis-modal--form { max-height: 90vh; overflow-y: auto; }
.pis-field { display: block; margin-top: 0.85rem; }
.pis-field-label { display: block; font-size: 0.8125rem; font-weight: 700; color: var(--color-text-muted); }
.pis-field .pis-modal-input { margin-top: 0.3rem; font-family: inherit; font-size: 0.875rem; }
.pis-field textarea.pis-modal-input { resize: vertical; min-height: 4.5rem; }
.pis-field-error { margin-top: 0.75rem; font-size: 0.8125rem; color: #B42318; font-weight: 600; }
/* 新手名詞小百科：正文中的名詞提示與彈出小卡 */
.glossary-term {
    display: inline;
    padding: 0;
    margin: 0;
    background: none;
    border: 0;
    font: inherit;
    color: inherit;
    cursor: help;
    text-decoration: underline dotted var(--color-primary, #1285C5);
    text-decoration-thickness: 1.5px;
    text-underline-offset: 0.2em;
}
.glossary-term:hover, .glossary-term[aria-expanded="true"] { background: #E9F3F9; border-radius: 0.2em; }
.glossary-pop {
    position: absolute;
    z-index: 9000;
    width: min(20rem, calc(100vw - 1rem));
    padding: 0.85rem 1rem;
    background: #FFFFFF;
    color: var(--color-text-main, #1A2F45);
    border: 1px solid var(--border-card, #DFDACD);
    border-radius: 1rem;
    box-shadow: 0 12px 32px rgba(26, 47, 69, 0.18);
    font-size: 0.875rem;
    line-height: 1.6;
}
.glossary-pop[hidden] { display: none; }
.glossary-pop-title { font-weight: 800; font-size: 0.95rem; margin-bottom: 0.2rem; }
.glossary-pop-body { margin: 0; max-width: none; }
.glossary-pop-foot { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-top: 0.6rem; padding-top: 0.5rem; border-top: 1px solid var(--border-card, #DFDACD); flex-wrap: wrap; }
.glossary-pop-link { font-weight: 700; font-size: 0.8125rem; color: #0D6DA5; text-decoration: underline; }
.glossary-pop-note { font-size: 0.6875rem; color: var(--color-text-muted, #566A7C); }

/* 名詞頁 */
.glossary-chip {
    padding: 0.4rem 0.9rem;
    border-radius: 9999px;
    border: 1px solid var(--border-card, #DFDACD);
    background: #FFFFFF;
    color: var(--color-text-muted, #566A7C);
    font-size: 0.8125rem;
    font-weight: 700;
    transition: background 0.15s, color 0.15s;
}
.glossary-chip:hover { color: #1A2F45; }
.glossary-chip[aria-pressed="true"] { background: #1285C5; border-color: #1285C5; color: #FFFFFF; }
.glossary-card[hidden] { display: none; }
.glossary-card--hit { box-shadow: 0 0 0 3px rgba(18, 133, 197, 0.45); transition: box-shadow 0.4s; }
/* 生活指南 (js/life-guide.js) */
.life-card[hidden], .life-chapter[hidden] { display: none; }
.life-rich a { color: #0D6DA5; text-decoration: underline; text-underline-offset: 2px; word-break: break-all; }
.life-more > summary { list-style: none; }
.life-more > summary::-webkit-details-marker { display: none; }
.life-more > summary::before { content: '▸ '; }
.life-more[open] > summary::before { content: '▾ '; }
/* 實操指南：閱讀進度 (js/guide-progress.js) */
.guide-readbar { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 60; background: transparent; pointer-events: none; }
.guide-readbar span { display: block; height: 100%; background: linear-gradient(90deg, #1285C5, #2B8A68); transform-origin: 0 50%; transform: scaleX(0); }
.guide-progress-summary { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: .75rem; font-size: .8125rem; color: var(--color-text-muted, #566A7C); }
.guide-progress-summary .gp-text { font-weight: 700; color: #1A2F45; flex: 1 1 14rem; }
.guide-progress-summary .gp-track { flex: 0 0 8rem; height: 6px; border-radius: 9999px; background: #E2DDD1; overflow: hidden; }
.guide-progress-summary .gp-track span { display: block; height: 100%; background: #2B8A68; transform-origin: 0 50%; transform: scaleX(0); transition: transform .5s ease; }
.guide-progress-summary .gp-reset { font-size: .75rem; text-decoration: underline dotted; color: var(--color-text-muted, #566A7C); }
.guide-progress-summary .gp-reset:hover { color: #1285C5; }
.guide-progress-summary .gp-reset[hidden] { display: none; }
.stepper-item.is-reading { border-color: #1285C5; box-shadow: 0 0 0 2px rgba(18, 133, 197, .18); }
.stepper-item.is-done { border-color: #9AD2B8; background: #F2FAF6; }
.stepper-item.is-done > span:first-child { background: #2B8A68 !important; color: #fff !important; }
.gp-done-btn { display: inline-flex; align-items: center; gap: .4rem; flex-shrink: 0; margin-left: .75rem; padding: .35rem .85rem; min-height: 2rem; border-radius: 9999px; border: 1px solid var(--border-card, #DFDACD); background: #fff; color: var(--color-text-muted, #566A7C); font-size: .8125rem; font-weight: 700; transition: background .15s, color .15s, border-color .15s; }
.gp-done-btn:hover { border-color: #2B8A68; color: #1E6B4F; }
.gp-done-btn[aria-pressed="true"] { background: #2B8A68; border-color: #2B8A68; color: #fff; }
@media print { .guide-readbar, .gp-done-btn, .guide-progress-summary { display: none !important; } }
.gp-head { flex-wrap: wrap; gap: .5rem; }
.gp-head > :first-child { min-width: 0; flex: 1 1 20rem; }
.gp-head .gp-actions { display: inline-flex; align-items: center; gap: .5rem; flex-shrink: 0; margin-left: auto; }
.gp-head .gp-actions .gp-done-btn { margin-left: 0; }
.gp-share-btn { display: inline-flex; align-items: center; gap: .4rem; flex-shrink: 0; padding: .35rem .85rem; min-height: 2rem; border-radius: 9999px; border: 1px solid var(--border-card, #DFDACD); background: #fff; color: var(--color-text-muted, #566A7C); font-size: .8125rem; font-weight: 700; transition: background .15s, color .15s, border-color .15s; }
.gp-share-btn:hover { border-color: #1285C5; color: #1285C5; }
@media print { .gp-share-btn { display: none !important; } }

/* 分享連結按鈕 (js/share-link.js) */
.pis-share-btn { display: inline-flex; align-items: center; gap: .375rem; padding: .375rem .75rem; border-radius: .75rem; background: #fff; color: #3E5263; font-size: .75rem; font-weight: 700; border: 1px solid var(--border-card, #DFDACD); white-space: nowrap; flex-shrink: 0; transition: background .15s, color .15s; }
.pis-share-btn:hover { background: #E9F3F9; color: #0D6DA5; }
.pis-share-btn i { color: #1285C5; }
@media print { .pis-share-btn { display: none !important; } }

/* 全站搜尋 (js/search.js) */
.pis-search-btn { display: inline-flex; align-items: center; justify-content: center; width: 2.25rem; height: 2.25rem; border-radius: 9999px; color: #1A2F45; background: transparent; border: 1px solid transparent; transition: background .15s, color .15s; flex-shrink: 0; }
.pis-search-btn:hover { background: #E9F3F9; color: #1285C5; }
.pis-search-backdrop { position: fixed; inset: 0; z-index: 9500; background: rgba(26, 47, 69, .5); backdrop-filter: blur(3px); display: flex; align-items: flex-start; justify-content: center; padding: 8vh 1rem 1rem; }
.pis-search-dialog { width: 100%; max-width: 40rem; max-height: 80vh; display: flex; flex-direction: column; background: #fff; border-radius: 1.25rem; border: 1px solid var(--border-card, #DFDACD); box-shadow: 0 24px 60px rgba(26, 47, 69, .3); overflow: hidden; }
.pis-search-bar { display: flex; align-items: center; gap: .75rem; padding: .85rem 1rem; border-bottom: 1px solid var(--border-card, #DFDACD); color: var(--color-text-muted, #566A7C); }
.pis-search-input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font-size: 1rem; color: #1A2F45; font-family: inherit; }
.pis-search-input::placeholder { color: #8A9BA8; }
.pis-search-esc { font-size: .6875rem; font-weight: 700; padding: .2rem .5rem; border-radius: .5rem; border: 1px solid var(--border-card, #DFDACD); color: var(--color-text-muted, #566A7C); background: #F8F6ED; }
.pis-search-list { overflow-y: auto; padding: .5rem; }
.pis-search-empty { padding: 1.5rem 1rem; text-align: center; font-size: .875rem; color: var(--color-text-muted, #566A7C); }
.pis-search-chips { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; margin-top: .85rem; }
.pis-search-chip { padding: .35rem .8rem; border-radius: 9999px; border: 1px solid var(--border-card, #DFDACD); background: #F8F6ED; font-size: .8125rem; font-weight: 700; color: #1A2F45; }
.pis-search-chip:hover { background: #E9F3F9; color: #0D6DA5; }
.pis-search-group { display: flex; align-items: center; gap: .5rem; padding: .6rem .6rem .25rem; font-size: .75rem; font-weight: 800; color: var(--color-text-muted, #566A7C); letter-spacing: .04em; }
.pis-search-group i { color: #1285C5; }
.pis-search-row { display: block; padding: .6rem .75rem; border-radius: .75rem; color: #1A2F45; text-decoration: none; }
.pis-search-row[aria-selected="true"], .pis-search-row:hover { background: #E9F3F9; }
.pis-search-title { font-size: .9375rem; font-weight: 700; line-height: 1.45; }
.pis-search-sub { font-size: .75rem; color: var(--color-text-muted, #566A7C); line-height: 1.5; margin-top: .1rem; }
.pis-search-mark { background: #FFE9A8; color: inherit; border-radius: .2em; padding: 0 .1em; }
.pis-search-more { padding: .25rem .75rem .5rem; font-size: .75rem; color: var(--color-text-muted, #566A7C); }
@media print { .pis-search-btn, .pis-search-backdrop { display: none !important; } }
/* 手機版：每一步標題獨占一行，完成按鈕換到下一行，避免標題被擠壓 */
@media (max-width: 639px) {
    .gp-head { align-items: flex-start; }
    .gp-head > :first-child { flex: 1 1 100%; }
    .gp-head .gp-actions { margin-left: 2.75rem; }
}

/* 手機版標題：略縮字級並放寬行高，減少擠壓與難看的斷行；標題列的搜尋鈕縮小，避免標題列超出螢幕 */
@media (max-width: 639px) {
    main h2.font-mincho { font-size: 1.125rem; line-height: 1.45; letter-spacing: 0; }
    main h3.font-mincho { font-size: 1.0625rem; line-height: 1.45; letter-spacing: 0; }
    .pis-search-btn { width: 2rem; height: 2rem; }
    #header-right-actions { gap: .25rem; }
}

/* 窄螢幕 (小於 400px)：隱藏標題列的英文副標，讓搜尋、帳號與選單按鈕都放得進螢幕 */
@media (max-width: 399px) {
    header a.group.shrink-0 > div > span:last-child { display: none; }
}

/* 模擬器標題列空間有限：手機版分享按鈕只顯示圖示 */
@media (max-width: 639px) {
    #header-right-actions .pis-share-btn span { display: none; }
    #header-right-actions .pis-share-btn { padding: .375rem .5rem; }
}

.pis-share-btn--inline { display: none; margin-bottom: .5rem; }
@media (max-width: 399px) {
    .pis-share-btn--inline { display: inline-flex; }
    #header-right-actions .pis-share-btn { display: none; }
}

/* 實操指南每一步的主題圖片 (js/step-hero.js)：電腦版左文右圖，圖片往標題方向淡出 */
.step-hero { position: relative; overflow: hidden; border-radius: 1.5rem; border: 1px solid var(--border-card, #E2DDD1); background: #F8F6ED; }
.step-hero-img { position: absolute; inset: 0 0 auto 0; height: 12rem; pointer-events: none; user-select: none; }
.step-hero-img img { width: 100%; height: 100%; object-fit: cover; object-position: 72% 50%; opacity: .95; -webkit-mask-image: linear-gradient(to bottom, #000 40%, transparent 100%); mask-image: linear-gradient(to bottom, #000 40%, transparent 100%); }
.step-hero-plate { position: relative; z-index: 1; margin: 7.5rem .75rem .75rem; padding: 1.1rem 1.1rem 1rem; border-radius: 1.25rem; }
.step-hero-plate > .step-head { border-bottom: 0 !important; padding-bottom: 0 !important; }
@media (min-width: 1024px) {
    .step-hero { min-height: 17rem; display: flex; align-items: center; }
    .step-hero-img { inset: 0 0 0 auto; width: 62%; height: auto; }
    .step-hero-img img { object-position: 70% 50%; -webkit-mask-image: linear-gradient(to left, #000 0%, rgba(0,0,0,.85) 30%, rgba(0,0,0,.4) 60%, transparent 92%); mask-image: linear-gradient(to left, #000 0%, rgba(0,0,0,.85) 30%, rgba(0,0,0,.4) 60%, transparent 92%); }
    .step-hero-plate { margin: 1.5rem auto 1.5rem 1.5rem; width: min(54%, 42rem); padding: 1.5rem 1.6rem; }
}
@media print { .step-hero-img { display: none; } .step-hero-plate { margin: 0; } }
/* 問答新回覆通知：連結旁的紅色數字 */
.pis-notify-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    margin-left: 6px;
    border-radius: 9px;
    background: #C8553D;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}
