@charset "UTF-8";
/* ==========================================================================
   w7.css — 不專業工具人 去浮水印
   設計方向：沖印店取件檯（photo-finishing counter）
     相紙米白的檯面、暗房墨的字、沖印紅當唯一重點色；
     資料以「收據式事實列」呈現，進度用齒孔軌道表現。
   同時支援淺色（沖印店燈下）與深色（暗房紅光）兩種情境。
   本檔僅使用系統字，不連外取得字型（主要市場載入 Google Fonts 不穩定）。
   ========================================================================== */

/* ---- 1. 設計權杖 -------------------------------------------------------- */
:root {
    --paper:      #F7F4EE;   /* 檯面：相紙米白 */
    --paper-2:    #FFFDF9;   /* 浮起的紙面 */
    --paper-3:    #EFEAE1;   /* 內凹區塊 */
    --ink:        #171512;   /* 暗房墨 */
    --ink-2:      #4A443C;   /* 次要文字 */
    --ink-3:      #6E675D;   /* 說明文字（仍維持 4.5:1 以上） */
    --line:       #E2DCD1;   /* 分隔線 */
    --line-2:     #CFC7B9;   /* 較重邊框 */
    --accent:     #C22F22;   /* 沖印紅：主要動作 */
    --accent-ink: #FFFFFF;   /* 紅底上的字 */
    --ok:         #1F6B44;
    --warn:       #8A5008;
    --focus:      #1B4DD8;
    /* 螢幕外與列印用的中性色：影片黑邊、紙白、列印墨黑 */
    --film-black:  #000;
    --print-paper: #fff;
    --print-ink:   #000;
    --shadow-sm:  0 1px 0 rgba(23, 21, 18, .04), 0 6px 14px -10px rgba(23, 21, 18, .35);
    --shadow-md:  0 22px 48px -34px rgba(23, 21, 18, .55), 0 2px 0 rgba(23, 21, 18, .03);
    --radius:     14px;
    --radius-sm:  10px;
    --radius-md:  12px;
    --radius-xs:  8px;
    --radius-2xs: 4px;
    --shell:      1080px;
    --tap:        44px;      /* 最小點擊區 */
    --font-cjk:   "PingFang TC", "Hiragino Sans CNS", "Noto Sans TC",
                  "Microsoft JhengHei", "Heiti TC", sans-serif;
    --font-data:  ui-monospace, "SFMono-Regular", "Cascadia Mono",
                  "Roboto Mono", Menlo, Consolas, monospace;
}

/* 深色＝暗房：紅色安全燈下的相紙 */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --paper:      #14120F;
        --paper-2:    #1C1916;
        --paper-3:    #221E1A;
        --ink:        #F3EEE5;
        --ink-2:      #C4BAAB;
        --ink-3:      #A69C8D;
        --line:       #302B25;
        --line-2:     #443D34;
        --accent:     #FF6A5A;
        --accent-ink: #1A0F0B;
        --ok:         #6FD39B;
        --warn:       #E5AC5E;
        --focus:      #8FB3FF;
        --shadow-sm:  0 1px 0 rgba(0, 0, 0, .35), 0 6px 16px -12px #000;
        --shadow-md:  0 26px 56px -36px #000, 0 2px 0 rgba(0, 0, 0, .3);
    }
}

:root[data-theme="dark"] {
    --paper:      #14120F;
    --paper-2:    #1C1916;
    --paper-3:    #221E1A;
    --ink:        #F3EEE5;
    --ink-2:      #C4BAAB;
    --ink-3:      #A69C8D;
    --line:       #302B25;
    --line-2:     #443D34;
    --accent:     #FF6A5A;
    --accent-ink: #1A0F0B;
    --ok:         #6FD39B;
    --warn:       #E5AC5E;
    --focus:      #8FB3FF;
    --shadow-sm:  0 1px 0 rgba(0, 0, 0, .35), 0 6px 16px -12px #000;
    --shadow-md:  0 26px 56px -36px #000, 0 2px 0 rgba(0, 0, 0, .3);
}

/* ---- 2. 基礎 ------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    color-scheme: light dark;
}

body {
    margin: 0;
    padding: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-cjk);
    font-size: 1.0625rem;
    line-height: 1.75;
    letter-spacing: .01em;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    overflow-wrap: break-word;
}

img, video { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-underline-offset: .22em; }
a:hover { color: var(--ink); }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.75em 0; }

:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
    border-radius: var(--radius-2xs);
}

::selection { background: var(--accent); color: var(--accent-ink); }

.shell {
    width: 100%;
    max-width: var(--shell);
    margin: 0 auto;
    padding: 0 clamp(14px, 4vw, 28px);
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--accent);
    color: var(--accent-ink);
    padding: 10px 16px;
    z-index: 60;
}
.skip-link:focus { left: 8px; top: 8px; }

.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    margin: -1px; padding: 0; border: 0;
    clip: rect(0 0 0 0); clip-path: inset(50%);
    overflow: hidden; white-space: nowrap;
}

/* ---- 3. 頁首 ------------------------------------------------------------ */
.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    background: var(--paper-2);
    border-bottom: 1px solid var(--line);
}

.topbar__inner {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 60px;
    flex-wrap: wrap;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: var(--tap);
    padding-right: 4px;
    color: var(--ink);
    font-weight: 700;
    font-size: 1.0625rem;
    text-decoration: none;
    letter-spacing: .02em;
}

.brand__mark {
    width: 26px;
    height: 26px;
    flex: 0 0 auto;
    border: 1.5px solid var(--ink);
    border-radius: var(--radius-xs);
    display: grid;
    place-items: center;
    font-size: .6875rem;
    font-weight: 700;
    font-family: var(--font-data);
    color: var(--accent);
}

.nav {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: auto;
    flex-wrap: wrap;
}

.nav a {
    display: inline-flex;
    align-items: center;
    min-height: var(--tap);
    padding: 0 11px;
    color: var(--ink-2);
    font-size: .9375rem;
    text-decoration: none;
    border-radius: var(--radius-sm);
}
.nav a:hover { background: var(--paper-3); color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); font-weight: 700; }

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--tap);
    height: var(--tap);
    padding: 0;
    background: transparent;
    border: 1px solid var(--line-2);
    border-radius: 50%;
    color: var(--ink-2);
    cursor: pointer;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--ink-2); }
.theme-toggle svg { width: 20px; height: 20px; }
.theme-toggle .ico-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .ico-moon { display: block; }
:root[data-theme="dark"] .theme-toggle .ico-sun { display: none; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle .ico-moon { display: block; }
    :root:not([data-theme="light"]) .theme-toggle .ico-sun { display: none; }
}

/* ---- 4. 檯面（主區塊） -------------------------------------------------- */
.stage { padding: clamp(22px, 5vw, 46px) 0 8px; }

.panel {
    background: var(--paper-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: clamp(20px, 4vw, 34px);
}

.panel + .panel { margin-top: clamp(16px, 3vw, 24px); }

.panel--flush { padding: 0; overflow: hidden; }

.panel__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

h1, h2, h3 { line-height: 1.35; letter-spacing: .01em; margin: 0 0 .5em; }
h1 { font-size: clamp(1.75rem, 4.4vw, 2.25rem); font-weight: 800; }
h2 { font-size: clamp(1.0625rem, 2.6vw, 1.375rem); font-weight: 700; }
h3 { font-size: 1.0625rem; font-weight: 700; }

.lede {
    margin: 0 0 1.4em;
    max-width: 68ch;
    color: var(--ink-2);
    font-size: 1.0625rem;
}

.muted { color: var(--ink-3); }
.small { font-size: .875rem; }
.data  { font-family: var(--font-data); font-variant-numeric: tabular-nums; }

/* ---- 5. 取件單：輸入表單 ------------------------------------------------ */
.paste {
    display: block;
    margin: 0 0 6px;
}

.paste__label {
    display: block;
    font-weight: 700;
    font-size: .9375rem;
    margin-bottom: 8px;
    color: var(--ink);
}

.paste__box {
    display: flex;
    align-items: stretch;
    gap: 10px;
    flex-wrap: wrap;
}

.paste__input {
    flex: 1 1 320px;
    min-height: 56px;
    min-width: 0;
    padding: 14px 16px;
    background: var(--paper);
    color: var(--ink);
    border: 1.5px solid var(--line-2);
    border-radius: var(--radius-sm);
    font-family: var(--font-cjk);
    font-size: 1rem;
    line-height: 1.6;
    resize: vertical;
}
.paste__input::placeholder { color: var(--ink-3); }
.paste__input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(194, 47, 34, .16);
}
.paste__input[aria-invalid="true"] { border-color: var(--accent); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 56px;
    padding: 0 26px;
    border: 1.5px solid transparent;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 1.0625rem;
    font-weight: 700;
    letter-spacing: .02em;
    text-decoration: none;
    cursor: pointer;
    transition: transform .14s ease, box-shadow .18s ease, background-color .18s ease;
}

.btn--primary {
    background: var(--accent);
    color: var(--accent-ink);
    box-shadow: var(--shadow-sm);
}
.btn--primary:hover { background: var(--accent); color: var(--accent-ink); transform: translateY(-1px); }
.btn--primary:active { transform: translateY(0); }
.btn--primary[disabled], .btn[aria-busy="true"] {
    opacity: .62;
    cursor: progress;
    transform: none;
}

.btn--ghost {
    background: transparent;
    color: var(--ink);
    border-color: var(--line-2);
}
.btn--ghost:hover { background: var(--paper-3); color: var(--ink); }

.btn--link {
    min-height: var(--tap);
    padding: 0 6px;
    background: none;
    border: 0;
    color: var(--accent);
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: .22em;
    cursor: pointer;
}
.btn--link:hover { color: var(--ink); }

.btn__spin {
    width: 17px;
    height: 17px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: w7spin .8s linear infinite;
    display: none;
}
.btn[aria-busy="true"] .btn__spin { display: block; }

@keyframes w7spin { to { transform: rotate(360deg); } }

.paste__hint {
    margin: 10px 0 0;
    color: var(--ink-3);
    font-size: .875rem;
    line-height: 1.7;
}

/* ---- 6. 齒孔進度軌（本站的招牌動作） ------------------------------------ */
.rail {
    --rail-gap: 0;
    position: relative;
    margin: 22px 0 4px;
    padding: 16px 0 6px;
    /* 齒孔用原生點狀邊框畫，不再用重複漸層條紋（刻意的材質，非裝飾條紋） */
    border-top: 6px dotted var(--line-2);
    border-bottom: 6px dotted var(--line-2);
    background: var(--paper);
    list-style: none;
    margin-left: 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}
.rail[hidden] { display: none; }

.rail__step {
    position: relative;
    padding: 4px 2px 2px;
    text-align: center;
    color: var(--ink-3);
    font-size: .875rem;
    line-height: 1.4;
    transition: color .25s ease;
}

.rail__dot {
    display: block;
    width: 14px;
    height: 14px;
    margin: 0 auto 7px;
    border: 2px solid var(--line-2);
    border-radius: 50%;
    background: var(--paper-2);
    transition: background-color .25s ease, border-color .25s ease, transform .25s ease;
}

.rail__step[data-state="active"] { color: var(--ink); font-weight: 700; }
.rail__step[data-state="active"] .rail__dot {
    border-color: var(--accent);
    background: var(--accent);
    transform: scale(1.18);
}
.rail__step[data-state="done"] { color: var(--ink-2); }
.rail__step[data-state="done"] .rail__dot {
    background: var(--ok);
    border-color: var(--ok);
}
.rail__step[data-state="fail"] { color: var(--accent); font-weight: 700; }
.rail__step[data-state="fail"] .rail__dot {
    background: var(--accent);
    border-color: var(--accent);
    border-radius: var(--radius-2xs);
    transform: rotate(45deg) scale(1.05);
}

/* 進度軌的跑動：一個明確、克制的動效時刻，尊重 reduced-motion */
.rail[data-running="1"] .rail__step[data-state="active"] .rail__dot {
    animation: w7pulse 1.05s ease-in-out infinite;
}
@keyframes w7pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(194, 47, 34, .5); }
    60%      { box-shadow: 0 0 0 9px rgba(194, 47, 34, 0); }
}

/* ---- 7. 狀態訊息與錯誤卡 ----------------------------------------------- */
.status {
    margin: 16px 0 0;
    min-height: 1.5em;
    color: var(--ink-2);
    font-size: .9375rem;
}
.status[data-tone="error"] { color: var(--accent); }
.status[data-tone="ok"] { color: var(--ok); }

.alert {
    margin-top: 18px;
    padding: 18px 20px;
    background: var(--paper-3);
    border: 1px solid var(--line-2);
    border-radius: var(--radius-sm);
}
/* 注意：不使用「彩色左邊框」裝飾，改用標題與色票呈現層級 */
.alert[hidden] { display: none; }

.alert__title {
    margin: 0 0 6px;
    font-size: 1.0625rem;
    font-weight: 800;
    color: var(--ink);
}
.alert__title .tag {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 9px;
    border-radius: 999px;
    background: var(--accent);
    color: var(--accent-ink);
    font-size: .8125rem;
    font-weight: 700;
    vertical-align: 2px;
}
.alert__body { margin: 0 0 4px; color: var(--ink-2); font-size: .9375rem; }
.alert__meta {
    margin: 10px 0 0;
    padding-top: 10px;
    border-top: 1px dashed var(--line-2);
    color: var(--ink-3);
    font-size: .875rem;
    line-height: 1.75;
}
.alert__meta summary {
    cursor: pointer;
    display: list-item;          /* 保留瀏覽器原生的展開三角，不用別的元素假裝 */
    min-height: var(--tap);      /* 手機好按：折疊標題也要有 44px 觸控高度 */
    padding: 10px 0;
}
.alert__actions { margin-top: 14px; display: flex; gap: 10px; flex-wrap: wrap; }

/* ---- 8. 平台清單 -------------------------------------------------------- */
.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 6px 0 0;
    padding: 0;
    list-style: none;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: var(--tap);
    padding: 0 13px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--ink-2);
    font-size: .875rem;
    text-decoration: none;
}
.chip:hover { border-color: var(--line-2); color: var(--ink); }
.chip img { width: 20px; height: 20px; border-radius: var(--radius-2xs); }

/* ---- 9. 取件記錄（解析紀錄） ------------------------------------------- */
.receipt {
    margin: 0;
    padding: 0;
    list-style: none;
    max-height: 340px;
    overflow: auto;
}

.receipt__row {
    display: flex;
    align-items: baseline;
    gap: 10px;
    min-height: var(--tap);
    padding: 9px 0;
    border-bottom: 1px dashed var(--line);
    font-size: .9375rem;
}
.receipt__row:last-child { border-bottom: 0; }

.receipt__no {
    flex: 0 0 auto;
    width: 30px;
    color: var(--ink-3);
    font-family: var(--font-data);
    font-size: .8125rem;
}
.receipt__link {
    flex: 1 1 auto;
    min-width: 0;
    color: var(--ink-2);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.receipt__link:hover { color: var(--accent); }
.receipt__link b { font-weight: 700; }
.receipt__time {
    flex: 0 0 auto;
    color: var(--ink-3);
    font-family: var(--font-data);
    font-size: .8125rem;
}

/* ---- 10. 頁尾 ----------------------------------------------------------- */
.footer {
    margin-top: clamp(28px, 6vw, 56px);
    border-top: 1px solid var(--line);
    background: var(--paper-2);
    padding: 24px 0 32px;
    color: var(--ink-3);
    font-size: .875rem;
}
.footer__links {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    margin: 0 0 10px;
    padding: 0;
    list-style: none;
}
.footer__links a {
    display: inline-flex;
    align-items: center;
    min-height: var(--tap);
    color: var(--ink-2);
    text-decoration: none;
}
.footer__links a:hover { color: var(--accent); }
.footer p { margin: 4px 0; max-width: 72ch; }

.ad-slot { margin: 22px 0; text-align: center; min-height: 280px;   /* 預留高度避免廣告載入造成 CLS */ }

/* ---- 11. 取件結果（user.php） ------------------------------------------ */
.result__head { margin-bottom: 18px; }
.result__title {
    margin: 0 0 6px;
    font-size: clamp(1.25rem, 3.2vw, 1.625rem);
    font-weight: 800;
    line-height: 1.4;
}
.result__sub { margin: 0; color: var(--ink-3); font-size: .875rem; }

.media {
    position: relative;
    margin: 0 0 18px;
    background: var(--paper-3);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.media video { width: 100%; background: var(--film-black); display: block; }
.media__cover { width: 100%; display: block; object-fit: cover; }

.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    margin: 0 0 18px;
    padding: 0;
    list-style: none;
}
.gallery button {
    display: block;
    width: 100%;
    padding: 0;
    background: var(--paper-3);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: zoom-in;
    aspect-ratio: 1 / 1;
}
.gallery img { width: 100%; height: 100%; object-fit: cover; }
.gallery button:hover { border-color: var(--accent); }

/* 收據式事實列：標籤／數值對齊，數值可複製 */
.facts {
    margin: 0 0 20px;
    border-top: 1px solid var(--line);
}
.fact {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 11px 0;
    border-bottom: 1px dashed var(--line);
}
.fact__key {
    flex: 0 0 96px;
    color: var(--ink-3);
    font-size: .875rem;
    padding-top: 2px;
}
.fact__val {
    flex: 1 1 auto;
    min-width: 0;
    font-size: .9375rem;
    color: var(--ink);
    overflow-wrap: anywhere;
}
.fact__val .data { color: var(--ink-2); font-size: .875rem; }

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0 0 6px;
}
.actions .btn { flex: 1 1 190px; }

.tips {
    margin: 18px 0 0;
    padding: 16px 18px;
    background: var(--paper);
    border: 1px dashed var(--line-2);
    border-radius: var(--radius-sm);
    color: var(--ink-2);
    font-size: .9375rem;
}
.tips h2, .tips h3 { margin: 0 0 8px; font-size: .9375rem; }
.tips ol, .tips ul { margin: 0; padding-left: 1.3em; }
.tips li + li { margin-top: 5px; }

.notice {
    margin: 0 0 18px;
    padding: 13px 16px;
    background: var(--paper-3);
    border: 1px solid var(--line-2);
    border-radius: var(--radius-sm);
    color: var(--ink-2);
    font-size: .875rem;
}
.notice strong { color: var(--ink); }

.download-note { margin: 10px 0 0; color: var(--ink-3); font-size: .875rem; }

/* ---- 12. 燈箱與對話框 --------------------------------------------------- */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: grid;
    place-items: center;
    padding: 4vmin;
    background: rgba(12, 10, 8, .88);
    border: 0;
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: none;
}
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 88vh; width: auto; border-radius: var(--radius-xs); }
.lightbox__open { margin: 12px 0 0; text-align: center; }
.lightbox__close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: var(--tap);
    height: var(--tap);
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .4);
    border-radius: 50%;
    color: #fff;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
}

.dialog {
    max-width: 480px;
    width: 100%;
    padding: 24px;
    background: var(--paper-2);
    color: var(--ink);
    border: 1px solid var(--line-2);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
}
.dialog::backdrop { background: rgba(12, 10, 8, .6); }
.dialog h2 { margin-top: 0; }
.dialog__actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }

/* 複製成功的短暫回饋 */
[data-copy-done="1"] { color: var(--ok) !important; }

/* ---- 13. 響應式 --------------------------------------------------------- */
@media (max-width: 720px) {
    body { font-size: 1rem; }
    .topbar__inner { min-height: 54px; }
    .brand span.brand__text { display: none; }
    .nav { width: 100%; margin-left: 0; justify-content: space-between; }
    .nav a { padding: 0 8px; font-size: .875rem; }
    .panel { padding: 18px 16px; border-radius: var(--radius-md); }
    .paste__box { flex-direction: column; }
    .paste__input { flex: 1 1 auto; }
    .btn { width: 100%; }
    .btn--link { width: auto; }
    .rail { grid-template-columns: repeat(2, 1fr); row-gap: 12px; }
    .fact { flex-direction: column; gap: 2px; }
    .fact__key { flex: 0 0 auto; }
    .actions .btn { flex: 1 1 100%; }
    .receipt__time { display: none; }
}

@media (min-width: 721px) and (max-width: 1024px) {
    .rail { grid-template-columns: repeat(4, 1fr); }
}

/* 滑鼠指標才有的 hover 抬升，觸控不套用 */
@media (hover: none) {
    .btn--primary:hover { transform: none; }
}

/* ---- 13b. 瀏海與動態島安全區（搭配 viewport-fit=cover）------------------ */
/* 用 @supports 包住，不支援 env() 的瀏覽器維持原本留白；支援的裝置則讓
   內容不會被瀏海、動態島或底部手勢列蓋住。 */
@supports (padding: max(0px)) {
    .shell {
        padding-left: max(clamp(14px, 4vw, 28px), env(safe-area-inset-left));
        padding-right: max(clamp(14px, 4vw, 28px), env(safe-area-inset-right));
    }
    .topbar { padding-top: env(safe-area-inset-top); }
    .footer { padding-bottom: max(32px, env(safe-area-inset-bottom)); }
    .lightbox { padding-bottom: max(4vmin, env(safe-area-inset-bottom)); }
    .lightbox__close {
        top: max(14px, env(safe-area-inset-top));
        right: max(14px, env(safe-area-inset-right));
    }
}

/* ---- 14. 無障礙與偏好 --------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
    }
}

@media print {
    /* 列印一律回到紙白墨黑：深色主題的 token 不會跟著列印，必須在這裡覆寫回淺色票 */
    :root, :root[data-theme="dark"] {
        --paper: var(--print-paper);
        --paper-2: var(--print-paper);
        --paper-3: var(--print-paper);
        --ink: var(--print-ink);
        --ink-2: #4A443C;
        --ink-3: #6E675D;
        --line: #CFC7B9;
        --line-2: #4A443C;
        --accent: #C22F22;
        --accent-ink: #FFFFFF;
        --ok: #1F6B44;
        --warn: #8A5008;
        --focus: #1B4DD8;
    }
    .topbar, .footer, .ad-slot, .actions, .rail { display: none !important; }
    .panel { box-shadow: none; border-color: var(--print-ink); background: var(--print-paper); color: var(--print-ink); }
    body { background: var(--print-paper); color: var(--print-ink); }
}



/* ══════════════════════════════════════════════════════════════
   玻璃質感（glass morphism）— 2026-10-10 加入
   附加在檔案末尾，不覆寫既有規則；要回滾就刪掉這整段。
   ══════════════════════════════════════════════════════════════ */
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {

  .panel,
  .panel--flush {
    background: color-mix(in srgb, var(--paper) 72%, transparent);
    -webkit-backdrop-filter: blur(18px) saturate(1.6);
    backdrop-filter: blur(18px) saturate(1.6);
    border: 1px solid color-mix(in srgb, var(--line) 65%, transparent);
    box-shadow:
      0 1px 0 0 color-mix(in srgb, #fff 45%, transparent) inset,
      0 8px 32px -8px color-mix(in srgb, var(--ink) 14%, transparent);
  }

  .topbar {
    background: color-mix(in srgb, var(--paper) 78%, transparent);
    -webkit-backdrop-filter: blur(20px) saturate(1.7);
    backdrop-filter: blur(20px) saturate(1.7);
    border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
  }

  /* 卡片內若有半透明層，讓它疊加出層次 */
  .stage {
    background-image:
      radial-gradient(1200px 600px at 20% -10%,
        color-mix(in srgb, var(--accent) 7%, transparent), transparent 60%),
      radial-gradient(900px 500px at 90% 10%,
        color-mix(in srgb, var(--focus) 5%, transparent), transparent 55%);
  }
}

/* 深色模式：玻璃要更深的底色才看得清 */
@media (prefers-color-scheme: dark) {
  @supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .panel,
    .panel--flush {
      background: color-mix(in srgb, var(--paper) 66%, transparent);
      border-color: color-mix(in srgb, var(--line) 55%, transparent);
      box-shadow:
        0 1px 0 0 color-mix(in srgb, #fff 8%, transparent) inset,
        0 12px 40px -12px rgba(0, 0, 0, .55);
    }
    .topbar {
      background: color-mix(in srgb, var(--paper) 72%, transparent);
    }
  }
}
