/* ==========================================================
   Oscan 網站樣式
   ----------------------------------------------------------
   由「展示資料/oscan-design.css」的設計稿演進而來，兩者的
   token 名稱刻意保持一致，對照設計稿時不會混淆。

   結構：
     1. 設計 Token — 淺色
     2. 設計 Token — 深色
     3. 基礎與版面
     4. 導覽列與頁尾
     5. 按鈕
     6. 元件（卡片、風險標籤、上傳區、橫幅…）
     7. Demo 流程專用
     8. 響應式

   改配色只要動第 1、2 節的變數，其他地方都不寫死顏色。
   深色模式：<html data-theme="dark">，由 theme.js 設定。
   ========================================================== */


/* ----------------------------------------------------------
   1. 設計 Token — 淺色（主要版本）
   ---------------------------------------------------------- */

:root {
    --bg:              #F7F7F6;
    --surface:         #FFFFFF;
    --surface-alt:     #F1F1EE;

    --border:          #D6D6D1;
    --border-strong:   #8A8A84;
    --divider:         #EDEDEA;

    --text:            #2C2C2A;
    --text-secondary:  #5F5E5A;
    --text-muted:      #8A8A84;

    --btn-bg:          #FFFFFF;
    --btn-text:        #2C2C2A;
    --btn-border:      #8A8A84;
    --btn-shadow:      0 1px 2px rgba(0,0,0,.06), 0 2px 6px rgba(0,0,0,.04);
    --btn-shadow-up:   0 3px 6px rgba(0,0,0,.08), 0 8px 18px rgba(0,0,0,.07);
    --btn-shadow-in:   inset 0 2px 5px rgba(0,0,0,.11);

    /* 風險等級 — 刻意去飽和：能分辨嚴重度，但不造成警報感 */
    --risk-critical-bg:     #F6EDEB;
    --risk-critical-border: #D9C4BF;
    --risk-critical-text:   #4A1B0C;
    --risk-critical-accent: #993C1D;

    --risk-high-bg:     #F7F1E6;
    --risk-high-border: #DDD0B8;
    --risk-high-text:   #412402;
    --risk-high-accent: #854F0B;

    --risk-medium-bg:     #EFF1F3;
    --risk-medium-border: #CBD2D8;
    --risk-medium-text:   #042C53;
    --risk-medium-accent: #185FA5;

    --risk-low-bg:     #F7F7F6;
    --risk-low-border: #D6D6D1;
    --risk-low-text:   #2C2C2A;
    --risk-low-accent: #5F5E5A;

    --radius:       8px;
    --radius-card: 10px;
    --content-max: 940px;
}


/* ----------------------------------------------------------
   2. 設計 Token — 深色
   ----------------------------------------------------------
   底色用暖灰不用純黑：純黑會讓白灰設計顯得廉價，
   在 OLED 上文字邊緣也容易有光暈。

   主按鈕改為淺底深字：陰影在深色底幾乎看不見，
   改用高對比填色來建立同樣的視覺份量。
   因此「立體按壓」在深色模式靠亮度變化，而非陰影變化。
   ---------------------------------------------------------- */

[data-theme="dark"] {
    --bg:              #151514;
    --surface:         #232322;
    --surface-alt:     #2A2A28;

    --border:          #3A3A37;
    --border-strong:   #5F5E5A;
    --divider:         #2E2E2B;

    --text:            #EDEDEA;
    --text-secondary:  #9A9A94;
    --text-muted:      #8A8A84;

    --btn-bg:          #EDEDEA;
    --btn-text:        #1B1B1A;
    --btn-border:      #EDEDEA;
    --btn-shadow:      none;
    --btn-shadow-up:   none;
    --btn-shadow-in:   none;

    --risk-critical-bg:     #3A1E14;
    --risk-critical-border: #6B3A2C;
    --risk-critical-text:   #F5C4B3;
    --risk-critical-accent: #F0997B;

    --risk-high-bg:     #33260F;
    --risk-high-border: #6B5424;
    --risk-high-text:   #FAC775;
    --risk-high-accent: #EF9F27;

    --risk-medium-bg:     #14293D;
    --risk-medium-border: #24486B;
    --risk-medium-text:   #B5D4F4;
    --risk-medium-accent: #85B7EB;

    --risk-low-bg:     #232322;
    --risk-low-border: #3A3A37;
    --risk-low-text:   #EDEDEA;
    --risk-low-accent: #9A9A94;
}


/* ----------------------------------------------------------
   3. 基礎與版面
   ---------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

/* hidden 屬性必須永遠有效。
   瀏覽器預設的 [hidden]{display:none} 只是 UA 樣式，任何作者端的
   display 宣告都會蓋掉它 —— 例如 .btn-row{display:flex} 就讓
   <div class="btn-row" hidden> 照常顯示。這在捐贈卡片上造成過真實的
   bug（送出後按鈕沒收起來，同一張照片可以重複捐），所以在這裡一次擋掉，
   而不是每個元件各自處理。 */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: "Noto Sans TC", -apple-system, BlinkMacSystemFont, "Segoe UI",
                 "Microsoft JhengHei", "PingFang TC", sans-serif;
    font-size: 15px;
    line-height: 1.75;
    background: var(--bg);
    color: var(--text);
    transition: background 260ms ease, color 260ms ease;
}

/* 使用者若在系統設定「減少動態效果」，關掉所有轉場 */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}

.wrap {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 0 24px;
}

main { padding: 40px 0 72px; min-height: 60vh; }

h1 { font-size: 27px; font-weight: 500; line-height: 1.4; margin: 0 0 12px; }
h2 { font-size: 19px; font-weight: 500; line-height: 1.5; margin: 0 0 12px; }
h3 { font-size: 15.5px; font-weight: 500; margin: 0 0 6px; }
p  { margin: 0 0 14px; }

a { color: inherit; }

.lead {
    font-size: 15.5px;
    color: var(--text-secondary);
    max-width: 620px;
    margin: 0 0 28px;
}

.muted { color: var(--text-muted); }
.small { font-size: 13px; }

.section { margin-bottom: 44px; }
.section-label { font-size: 12px; color: var(--text-muted); margin: 0 0 10px; }

.divider { height: 1px; background: var(--divider); margin: 16px 0; border: 0; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }

/* 只給螢幕閱讀器看的文字 */
.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;
}

/* 鍵盤操作時的焦點外框，滑鼠點擊時不顯示 */
:focus-visible {
    outline: 2px solid var(--text);
    outline-offset: 2px;
    border-radius: 3px;
}


/* ----------------------------------------------------------
   4. 導覽列與頁尾
   ---------------------------------------------------------- */

/* 原型警語。用琥珀色（與「需要注意」的風險等級同一組色）而非紅色 ——
   要讓人讀到、但不是要嚇人。不提供關閉按鈕：這個訊息在整個原型階段
   都必須持續可見。 */
.prototype-notice {
    background: var(--risk-high-bg);
    border-bottom: 0.5px solid var(--risk-high-border);
    color: var(--risk-high-text);
    transition: background 260ms ease, border-color 260ms ease, color 260ms ease;
}
.prototype-notice .wrap {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding-top: 10px;
    padding-bottom: 10px;
    font-size: 12.5px;
    line-height: 1.65;
}
.prototype-mark { flex: none; font-weight: 500; }

.site-header {
    background: var(--surface);
    border-bottom: 0.5px solid var(--divider);
    transition: background 260ms ease, border-color 260ms ease;
}

.site-header .wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-top: 14px;
    padding-bottom: 14px;
}

.brand {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex: none;
}

.logo {
    font-size: 17px;
    font-weight: 500;
    letter-spacing: .02em;
    text-decoration: none;
    flex: none;
}

/* 測試版標記。刻意做得比原型警語低調 —— 它不是警語，只是版本階段的標示。
   脫離測試階段後，這段與 base.html 的 .build-badge 一併移除。 */
.build-badge {
    flex: none;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: .04em;
    white-space: nowrap;
    padding: 2px 7px;
    border-radius: 4px;
    background: var(--surface-alt);
    border: 0.5px solid var(--border);
    color: var(--text-muted);
    transition: background 260ms ease, border-color 260ms ease, color 260ms ease;
}

.nav { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }

.nav a {
    font-size: 13.5px;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 2px 0;
    border-bottom: 1px solid transparent;
    transition: color 160ms ease, border-color 160ms ease;
}
.nav a:hover { color: var(--text); }
.nav a.active { color: var(--text); border-bottom-color: var(--text); }

/* 手機版的選單開關，桌機隱藏 */
.nav-toggle {
    display: none;
    background: none;
    border: 0.5px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 13px;
    padding: 6px 12px;
    cursor: pointer;
}

.site-footer {
    border-top: 0.5px solid var(--divider);
    background: var(--surface);
    padding: 24px 0;
    transition: background 260ms ease, border-color 260ms ease;
}

.site-footer .wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

.footer-text { font-size: 12.5px; color: var(--text-muted); margin: 0; }
.footer-links { display: flex; gap: 18px; font-size: 12.5px; }
.footer-links a { color: var(--text-muted); text-decoration: none; }
.footer-links a:hover { color: var(--text); }


/* ----------------------------------------------------------
   5. 按鈕
   ----------------------------------------------------------
   主按鈕 = 立體按壓（浮起 → 下沉，陰影收成內凹）
   次按鈕 = 邊框反轉（字距微張，按下瞬間黑白反轉）
   ---------------------------------------------------------- */

.btn {
    display: inline-block;
    padding: 12px 24px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    text-align: center;
    text-decoration: none;
    border-radius: var(--radius);
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.btn-primary {
    background: var(--btn-bg);
    color: var(--btn-text);
    border: 0.5px solid var(--btn-border);
    box-shadow: var(--btn-shadow);
    transition: transform 180ms cubic-bezier(.2,.8,.3,1), box-shadow 180ms ease, filter 180ms ease;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: var(--btn-shadow-up); filter: brightness(1.02); }
.btn-primary:active {
    transform: translateY(1px) scale(.985);
    box-shadow: var(--btn-shadow-in);
    filter: brightness(.96);
    transition-duration: 70ms;
}

.btn-secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 0.5px solid var(--border);
    transition: border-color 160ms ease, background 160ms ease, color 160ms ease, letter-spacing 160ms ease;
}
.btn-secondary:hover { border-color: var(--text); background: var(--surface-alt); color: var(--text); letter-spacing: .04em; }
.btn-secondary:active { background: var(--text); color: var(--bg); border-color: var(--text); transition-duration: 60ms; }

.btn-block { display: block; width: 100%; }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* 停用狀態：分析進行中時避免重複送出 */
.btn:disabled, .btn[aria-disabled="true"] {
    opacity: .5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: var(--btn-shadow) !important;
    filter: none !important;
    letter-spacing: normal !important;
}


/* ----------------------------------------------------------
   6. 元件
   ---------------------------------------------------------- */

.card {
    background: var(--surface);
    border: 0.5px solid var(--border);
    border-radius: var(--radius-card);
    padding: 18px 20px;
    transition: background 260ms ease, border-color 260ms ease;
}

.card h3 { margin-bottom: 6px; }
.card p:last-child { margin-bottom: 0; }

.metric-label { font-size: 12px; color: var(--text-muted); margin: 0 0 4px; }
.metric-value { font-size: 24px; font-weight: 500; margin: 0; line-height: 1.2; }

/* 風險標籤：唯一允許出現顏色的地方 */
.risk {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 7px;
    font-size: 13.5px;
    border: 0.5px solid;
    transition: background 260ms ease, border-color 260ms ease, color 260ms ease;
}
.risk-level { font-size: 12px; flex: none; }

.risk-critical { background: var(--risk-critical-bg); border-color: var(--risk-critical-border); color: var(--risk-critical-text); }
.risk-critical .risk-level { color: var(--risk-critical-accent); }
.risk-high     { background: var(--risk-high-bg);     border-color: var(--risk-high-border);     color: var(--risk-high-text); }
.risk-high .risk-level     { color: var(--risk-high-accent); }
.risk-medium   { background: var(--risk-medium-bg);   border-color: var(--risk-medium-border);   color: var(--risk-medium-text); }
.risk-medium .risk-level   { color: var(--risk-medium-accent); }
.risk-low      { background: var(--risk-low-bg);      border-color: var(--risk-low-border);      color: var(--risk-low-text); }
.risk-low .risk-level      { color: var(--risk-low-accent); }

/* 影像預覽與病灶標註框 */
.image-frame {
    position: relative;
    background: var(--surface-alt);
    border: 0.5px solid var(--border);
    border-radius: var(--radius-card);
    overflow: hidden;
    transition: background 260ms ease, border-color 260ms ease;
}
.image-frame img { display: block; width: 100%; height: auto; }

/* 標註框顏色跟著風險等級走，掃一眼影像就知道嚴重度 */
.bbox { position: absolute; border: 2px solid; border-radius: 3px; pointer-events: none; }
.bbox-critical { border-color: var(--risk-critical-accent); }
.bbox-high     { border-color: var(--risk-high-accent); }
.bbox-medium   { border-color: var(--risk-medium-accent); }
.bbox-low      { border-color: var(--risk-low-accent); }

.bbox-label {
    position: absolute;
    font-size: 11px;
    padding: 2px 7px;
    border-radius: 3px;
    color: #FFFFFF;
    white-space: nowrap;
    pointer-events: none;
    transform: translateY(-100%);
}
.bbox-label-critical { background: var(--risk-critical-accent); }
.bbox-label-high     { background: var(--risk-high-accent); }
.bbox-label-medium   { background: var(--risk-medium-accent); }
.bbox-label-low      { background: var(--risk-low-accent); }
[data-theme="dark"] .bbox-label { color: #1B1B1A; }

/* 上傳區：虛線框，拖曳時整塊微亮 */
.dropzone {
    display: block;
    width: 100%;
    border: 1.5px dashed var(--border);
    border-radius: var(--radius-card);
    background: var(--surface);
    padding: 52px 24px;
    text-align: center;
    font-family: inherit;
    color: inherit;
    cursor: pointer;
    transition: border-color 200ms ease, background 200ms ease, transform 200ms ease;
}
.dropzone:hover { border-color: var(--border-strong); background: var(--surface-alt); }
.dropzone.is-dragover {
    border-color: var(--text);
    background: var(--surface-alt);
    transform: scale(1.005);
}

.dropzone-icon { font-size: 30px; color: var(--text-muted); margin: 0 0 10px; line-height: 1; }
.dropzone-main { font-size: 14.5px; margin: 0 0 6px; }
.dropzone-hint { font-size: 12px; color: var(--text-muted); margin: 0; }

/* 隱私承諾：刻意做成可見的信任訊號 */
.privacy-note {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.7;
    margin: 16px 0 0;
}

.disclaimer { font-size: 12.5px; color: var(--text-muted); line-height: 1.75; margin: 0; }

/* 捐贈請求卡片。刻意做得安靜 —— 使用者剛拿到報告，這是一個請求，不是警語，
   不該用任何顏色去搶注意力或製造壓力。兩顆按鈕沿用一般的 .btn 樣式，
   「這次不用」不可以做成灰字（見 oscan-flow.md）。 */
.donate-card { margin-top: 12px; }
.donate-ask { font-size: 14px; line-height: 1.8; margin: 0 0 10px; }
.donate-card .btn-row { margin-top: 14px; }
.donate-status {
    font-size: 12.5px;
    color: var(--text-muted);
    line-height: 1.75;
    margin: 14px 0 0;
}

.banner {
    display: flex;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--radius);
    border: 0.5px solid;
    font-size: 13.5px;
    line-height: 1.7;
}
.banner-warn { background: var(--risk-high-bg); border-color: var(--risk-high-border); color: var(--risk-high-text); }
.banner-neutral { background: var(--surface-alt); border-color: var(--border); color: var(--text-secondary); }
.banner-mark { flex: none; font-weight: 500; }

/* 條列清單 */
.list-plain { margin: 0; padding: 0; list-style: none; }
.list-plain li {
    position: relative;
    padding-left: 16px;
    margin-bottom: 6px;
    font-size: 13.5px;
    color: var(--text-secondary);
}
.list-plain li::before {
    content: "·";
    position: absolute;
    left: 4px;
    color: var(--text-muted);
}

/* 編號步驟（AI 流程介紹） */
.step-item { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 4px; }
.step-num {
    flex: none;
    width: 26px; height: 26px;
    border-radius: 50%;
    border: 0.5px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 12px;
    display: flex; align-items: center; justify-content: center;
    transition: background 260ms ease, border-color 260ms ease;
}

/* 問答（FAQ）*/
.qa { border-bottom: 0.5px solid var(--divider); padding: 18px 0; }
.qa:last-child { border-bottom: none; }
.qa-q { font-size: 15px; font-weight: 500; margin: 0 0 8px; }
.qa-a { font-size: 13.5px; color: var(--text-secondary); margin: 0; }

/* 設定頁的選項列 */
.opt-group {
    border: 0.5px solid var(--border);
    border-radius: 9px;
    overflow: hidden;
    margin-bottom: 8px;
    transition: border-color 260ms ease;
}
.opt {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 13px 15px;
    background: var(--surface);
    border: 0;
    border-bottom: 0.5px solid var(--divider);
    font-family: inherit;
    font-size: 14px;
    color: var(--text);
    text-align: left;
    cursor: pointer;
    transition: background 200ms ease;
}
.opt:last-child { border-bottom: none; }
.opt:hover { background: var(--surface-alt); }

.radio {
    flex: none;
    width: 17px; height: 17px;
    border-radius: 50%;
    border: 1.5px solid var(--text-muted);
    display: flex; align-items: center; justify-content: center;
    transition: border-color 200ms ease;
}
.radio.on { border-color: var(--text); }
.radio.on::after { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--text); }


/* ----------------------------------------------------------
   7. Demo 流程專用
   ----------------------------------------------------------
   四個階段共用一個頁面，用 .stage 的顯示切換，
   避免換頁造成的閃爍與狀態遺失。
   ---------------------------------------------------------- */

.stage { display: none; }
.stage.is-active { display: block; }

.stage-narrow { max-width: 620px; }

/* 分析中：灰階脈動，刻意不用彩色轉圈 */
.pulse-dots { display: flex; gap: 9px; justify-content: center; }
.pulse-dots span {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: oscan-pulse 1.3s ease-in-out infinite;
}
.pulse-dots span:nth-child(2) { animation-delay: .18s; }
.pulse-dots span:nth-child(3) { animation-delay: .36s; }

@keyframes oscan-pulse {
    0%, 100% { opacity: .25; transform: scale(.85); }
    50%      { opacity: 1;   transform: scale(1); }
}

.progress-step {
    display: flex; align-items: center; gap: 11px;
    font-size: 13px; padding: 7px 0;
    color: var(--text-muted);
    transition: color 300ms ease;
}
.progress-step .dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--border); flex: none;
    transition: background 300ms ease;
}
.progress-step.is-done { color: var(--text-secondary); }
.progress-step.is-done .dot { background: var(--text-secondary); }
.progress-step.is-active { color: var(--text); font-weight: 500; }
.progress-step.is-active .dot { background: var(--text); }

/* 結果頁的兩欄：左影像、右摘要 */
.result-cols {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.result-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

/* 報告內文：由後端的 Markdown 轉換而來，只做基本排版 */
.report-body { font-size: 13.5px; line-height: 1.85; }
.report-body h1, .report-body h2, .report-body h3 { font-size: 14.5px; margin: 16px 0 6px; }
.report-body p { margin: 0 0 10px; }
.report-body ul { margin: 0 0 10px; padding-left: 20px; }


/* 問答區 */
.qa-presets { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }

/* 預設問題做成小膠囊，與一般按鈕區隔：它們是「建議」而不是主要動作 */
.qa-chip {
    padding: 7px 14px;
    font-family: inherit;
    font-size: 12.5px;
    color: var(--text-secondary);
    background: var(--surface-alt);
    border: 0.5px solid var(--border);
    border-radius: 999px;
    cursor: pointer;
    transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}
.qa-chip:hover { border-color: var(--border-strong); color: var(--text); }
.qa-chip:active { background: var(--text); color: var(--bg); border-color: var(--text); }
.qa-chip:disabled { opacity: .45; cursor: not-allowed; }

.qa-thread { display: grid; gap: 10px; }
.qa-thread:not(:empty) { margin-bottom: 14px; }

.qa-bubble {
    padding: 11px 14px;
    border-radius: var(--radius);
    font-size: 13.5px;
    line-height: 1.8;
    white-space: pre-wrap;
}
/* 使用者的話靠右、較窄，視覺上與回答分開 */
.qa-bubble-user {
    justify-self: end;
    max-width: 85%;
    background: var(--surface-alt);
    border: 0.5px solid var(--border);
    color: var(--text);
}
.qa-bubble-answer {
    background: var(--surface);
    border: 0.5px solid var(--border);
    color: var(--text);
}
/* 拒答用琥珀色，讓使用者一眼看出這是「無法回答」而非一般回覆 */
.qa-bubble-refused {
    background: var(--risk-high-bg);
    border-color: var(--risk-high-border);
    color: var(--risk-high-text);
}
.qa-bubble-pending { color: var(--text-muted); }

.qa-form { display: flex; gap: 8px; }

.qa-input {
    flex: 1;
    min-width: 0;
    padding: 11px 14px;
    font-family: inherit;
    font-size: 13.5px;
    color: var(--text);
    background: var(--surface);
    border: 0.5px solid var(--border);
    border-radius: var(--radius);
    transition: border-color 160ms ease;
}
.qa-input:focus { outline: none; border-color: var(--text); }
.qa-input::placeholder { color: var(--text-muted); }

.qa-submit { flex: none; padding-left: 20px; padding-right: 20px; }


/* ----------------------------------------------------------
   8. 響應式
   ---------------------------------------------------------- */

@media (max-width: 820px) {
    .result-cols { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
    .wrap { padding: 0 16px; }
    main { padding: 28px 0 52px; }

    h1 { font-size: 22px; }
    h2 { font-size: 17px; }
    .lead { font-size: 14.5px; }

    /* 手機版導覽收合，由 nav-toggle 控制 */
    .nav-toggle { display: block; }
    .nav {
        display: none;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding-top: 8px;
    }
    .nav.is-open { display: flex; }
    .nav a {
        padding: 11px 0;
        border-bottom: 0.5px solid var(--divider);
        font-size: 14px;
    }
    .nav a.active { border-bottom-color: var(--divider); }
    .site-header .wrap { flex-wrap: wrap; }

    .dropzone { padding: 38px 18px; }

    /* 按鈕在手機上改成整列，拇指容易按到 */
    .btn-row { flex-direction: column; }
    .btn-row .btn { width: 100%; }
}
