/* 聖誕禮物認領 2026 — v4「聖誕賀卡／燙金信箋」（方案 B 套入實際前端）
   色票與對比（正文用色計，WCAG 2.x）：
     洲際黑 ink        #3D3935  頁面底、按鈕、相片角；暖白上 11.0:1
     加深洲際黑 deep    #34312D  頁尾、照片放大檢視底
     香檳粉 champagne  #CEB4A9  賀卡封面、詳情相片頁；上面只放洲際黑文字（5.9:1）
     暖白 paper        #FAF8F5  賀卡內頁、信箋卡、對話框；洲際黑底上當文字 10.6:1
     相紙白            #FFFDF9  照片相紙邊（暖白衍生）
     深灰 grey         #686869  信箋上次要文字；暖白上 5.3:1
     深底次要字        #CFC9C0  洲際黑上 6.5:1
     盾徽金            #B8975A / #8C6A35  只作線條（緞帶線、信箋短金線、引文線），不作文字色
     森林綠 forest     #2F4A3D  只用在按鈕 hover（白字 10:1）
   字體：標題 ITC New Baskerville（_ds 本地字型）＋ Noto Serif TC；內文 Jost ＋ Noto Sans TC */

:root {
  --ink: var(--ic-black);            /* #3D3935 */
  --ink-deep: #34312D;
  --champagne: var(--ic-champagne);  /* #CEB4A9 */
  --paper: #FAF8F5;
  --photo-paper: #FFFDF9;
  --grey: var(--ic-grey-dark);       /* #686869 */
  --gold: #B8975A;
  --gold-deep: #8C6A35;
  --forest: #2F4A3D;
  --forest-press: #283F34;
  --on-dark: #FAF8F5;
  --on-dark-muted: #CFC9C0;
  --line: rgba(61,57,53,.18);
  --line-dark: rgba(255,255,255,.22);
  --line-dashed-dark: rgba(255,255,255,.55);  /* 深底虛線框；非文字 ≥3:1 */
  --line-strong: #8A847B;                     /* 暖白上的輸入框 / 虛線框 3.3:1 */
  --scrim: rgba(36,33,31,.72);
  --focus: var(--on-dark);
  --serif-en: "ITC New Baskerville", Georgia, serif;
  --serif-zh: "Noto Serif TC", "Songti TC", serif;
  --ease: cubic-bezier(.4,0,.2,1);
  --tap: 44px;
  --topbar-h: 60px;
  --page-w: 1248px;
  --gutter: 24px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

/* ---------- 基礎（覆寫 _ds 的 p / a / h 預設） ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { background: var(--ink); color: var(--on-dark); }
body { margin: 0; overflow-x: hidden; font-family: var(--font-sans); font-size: 16px; line-height: 1.6; }
body.is-locked { overflow: hidden; }
body.has-reminder .page { padding-bottom: calc(96px + 72px + var(--safe-b)); }
button { font-family: inherit; color: inherit; }
img { display: block; max-width: 100%; height: auto; }
p { margin: 0; max-width: none; }
h1, h2, h3 { margin: 0; font-weight: 400; letter-spacing: 0; color: inherit; }
blockquote { margin: 0; }
.num { font-family: var(--serif-en); font-variant-numeric: lining-nums; }
.muted { color: var(--grey); }
.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;
}
.wrap { width: min(var(--page-w), 100% - 2 * var(--gutter)); margin-inline: auto; }

/* 焦點：深底用暖白、淺底用洲際黑，皆 >10:1 */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.inside, .entry:not(.is-claimed), .entry.is-mine, .dialog, .reminder, .toast, .login .inside { --focus: var(--ink); }
.overlay--photo .lightbox { --focus: var(--on-dark); }
[role="dialog"]:focus-visible, [tabindex="-1"]:focus-visible { outline: none; }

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100; border: 0;
  background: var(--paper); color: var(--ink); padding: 12px 16px; font-size: 14px;
}
.skip-link:focus { top: 12px; }

/* ---------- 盾徽（I_shield_only.png 畫布左右透明留白很大，用 background 裁切顯示，不改圖檔） ---------- */
.shield {
  --w: 32px; flex: none; display: inline-block;
  width: var(--w); height: calc(var(--w) * 340 / 236);
  background: url("assets/I_shield_only.png") no-repeat;
  background-size: calc(var(--w) * 1890 / 236) auto;
  background-position: calc(var(--w) * -804 / 236) 0;
}
.shield--sm { --w: 22px; }
.shield--cover { --w: 52px; position: relative; z-index: 1; }

/* ---------- 編號 No. 07 ---------- */
.no { font-family: var(--serif-en); font-variant-numeric: lining-nums; font-size: 18px; line-height: 1.2; letter-spacing: .04em; white-space: nowrap; }
.no--sm { font-size: 16px; min-width: 3.6em; padding-top: 2px; }
.no--lg { font-size: 20px; }

/* ---------- 按鈕（零圓角；hover 森林綠；press 微加深） ---------- */
.btn {
  appearance: none; min-height: 48px; padding: 0 20px; border-radius: 0; border: 1px solid var(--ink);
  background: var(--ink); color: #fff; font-size: 16px; font-weight: 400; letter-spacing: .1em; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 10px; text-align: center; line-height: 1.3; text-decoration: none;
  transition: background-color .32s var(--ease), border-color .32s var(--ease), color .32s var(--ease);
}
:lang(en) .btn { letter-spacing: .04em; }
.btn--primary:hover { background: var(--forest); border-color: var(--forest); }
.btn--primary:active { background: var(--forest-press); }
.btn:disabled { opacity: .78; cursor: progress; }
.btn--outline { background: transparent; color: var(--ink); }
.btn--outline:hover { background: var(--ink); color: #fff; }
.btn--danger { background: var(--ink); color: #fff; }
.btn--danger:hover { background: var(--forest); border-color: var(--forest); }
.btn--inline { display: inline-flex; width: auto; }
.btn--on-dark { background: transparent; color: var(--on-dark); border-color: var(--line-dashed-dark); }
.btn--on-dark:hover { background: var(--on-dark); color: var(--ink); border-color: var(--on-dark); }
.btn--light { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.btn--light:hover { background: var(--champagne); border-color: var(--champagne); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row > .btn { flex: 1 1 140px; }
.btn-row--start > .btn { flex: 0 1 auto; }
.link-btn {
  min-height: var(--tap); border: none; background: transparent; font-size: 14px; padding: 0 4px; cursor: pointer;
  color: inherit; text-decoration: underline; text-underline-offset: 4px;
}
.link-btn:hover { text-decoration-thickness: 2px; }

/* ---------- 語言切換 ---------- */
.lang { display: inline-flex; align-items: center; flex: 0 0 auto; }
.lang__btn {
  min-width: var(--tap); min-height: var(--tap); padding: 0 8px; border: none; background: transparent; cursor: pointer;
  font-size: 14px; color: var(--on-dark-muted);
  text-decoration: underline 1px transparent; text-underline-offset: 6px;
  transition: color .32s var(--ease), text-decoration-color .32s var(--ease);
}
.lang__btn:hover { color: var(--on-dark); }
.lang__btn.is-on { color: var(--on-dark); text-decoration-color: var(--champagne); }

/* ---------- Top bar（洲際黑，髮絲線） ---------- */
.topbar { position: sticky; top: 0; z-index: 10; background: var(--ink); border-bottom: 1px solid var(--line-dark); }
.topbar__inner {
  width: min(var(--page-w), 100% - 2 * var(--gutter)); margin: 0 auto; min-height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px;
}
.topbar__name { flex: 1; min-width: 0; font-size: 13px; color: var(--on-dark-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__short { display: none; }
.mine-btn {
  min-height: var(--tap); padding: 0 14px; border: 1px solid var(--line-dashed-dark); border-radius: 0;
  background: transparent; color: var(--on-dark); font-size: 14px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  transition: background-color .32s var(--ease), color .32s var(--ease), border-color .32s var(--ease);
}
.mine-btn .num { font-size: 17px; }
.mine-btn:hover, .mine-btn.is-on { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.mine-btn.is-on:hover { background: var(--champagne); border-color: var(--champagne); }

/* ---------- 頁首：攤開的精裝賀卡（5:7） ---------- */
.spread {
  display: grid; grid-template-columns: 5fr 7fr;
  margin-top: clamp(32px, 5vw, 72px);
  box-shadow: 0 24px 48px rgba(0,0,0,.18);   /* 深底上淡陰影看不見，僅此處例外 */
}
.cover {
  position: relative; overflow: hidden; background: var(--champagne); color: var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: 56px 40px 52px; min-height: 560px;
}
.ribbon { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.cover-title { position: relative; z-index: 1; text-align: center; background: var(--champagne); padding: 18px 20px; }
.cover-title .yr { font-family: var(--serif-en); font-size: clamp(64px, 6.4vw, 92px); line-height: 1; letter-spacing: .02em; }
.cover-title p { font-family: var(--serif-en); font-size: 18px; margin-top: 12px; }
.cover-title p span { display: block; font-family: var(--serif-zh); font-size: 15px; margin-top: 4px; letter-spacing: .2em; }

.inside {
  position: relative; background: var(--paper); color: var(--ink);
  padding: clamp(36px, 5vw, 64px) clamp(28px, 5vw, 72px);
}
/* 摺線：一道極淡陰影（不是裝飾漸層 blob） */
.inside::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 18px; background: linear-gradient(90deg, rgba(61,57,53,.08), rgba(61,57,53,0)); pointer-events: none; }
.inside__logo { width: 150px; }
.inside__title {
  font-family: var(--serif-zh); font-weight: 500; font-size: clamp(34px, 3.6vw, 50px); line-height: 1.2; letter-spacing: .04em;
  margin-top: clamp(28px, 3.6vw, 48px); color: var(--ink);
}
:lang(en) .inside__title { font-family: var(--serif-en); font-weight: 400; letter-spacing: 0; }
.inside__alt { font-family: var(--serif-en); font-size: 20px; margin-top: 8px; }
.inside__alt:lang(zh-Hant) { font-family: var(--serif-zh); font-size: 17px; letter-spacing: .08em; }
.inside__lede { margin-top: 24px; font-size: 17px; line-height: 1.85; max-width: 32em; text-wrap: pretty; }
:lang(en) .inside__lede { max-width: 60ch; }

.how { list-style: none; padding: 0; margin: 32px 0 0; border-top: 1px solid var(--line); }
.how li { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 16px; padding: 15px 0; border-bottom: 1px solid var(--line); }
.how__k { font-family: var(--serif-en); font-size: 16px; color: var(--grey); }
.how p { font-size: 16px; }
.how .is-key p { font-family: var(--serif-zh); font-weight: 500; font-size: 18px; }
:lang(en) .how .is-key p { font-family: var(--serif-en); font-weight: 400; }

/* ---------- 心願區 ---------- */
.page { padding: clamp(64px, 8vw, 112px) 0 clamp(72px, 8vw, 112px); }
.board-head__t { font-family: var(--serif-zh); font-weight: 500; font-size: clamp(28px, 2.6vw, 36px); letter-spacing: .06em; color: var(--on-dark); }
:lang(en) .board-head__t { font-family: var(--serif-en); font-weight: 400; letter-spacing: 0; }

.filters {
  position: sticky; top: var(--topbar-h); z-index: 5; background: var(--ink);
  margin-top: 20px; padding: 8px 0 12px; border-bottom: 1px solid var(--line-dark);
  display: flex; flex-direction: column; gap: 10px;
}
.filters__row { display: flex; gap: 24px; align-items: flex-end; flex-wrap: wrap; }
.tabs { display: flex; gap: 8px; }
.tabs__btn {
  min-height: 48px; padding: 0 14px; border: none; background: transparent; cursor: pointer;
  font-size: 16px; color: var(--on-dark-muted); display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  border-bottom: 2px solid transparent; transition: color .32s var(--ease), border-color .32s var(--ease);
}
.tabs__btn:first-child { padding-left: 0; }
.tabs__btn:hover { color: var(--on-dark); }
.tabs__btn.is-on { color: var(--on-dark); border-bottom-color: var(--champagne); }
.tabs__count { font-size: 17px; }
.search { flex: 1; min-width: 220px; }
.field {
  width: 100%; height: var(--tap); border: 1px solid var(--line-strong); border-radius: 2px;
  background: var(--paper); font-family: inherit; font-size: 16px; color: var(--ink); padding: 0 12px;
}
.field::placeholder { color: var(--grey); opacity: 1; }
.field:focus { border-color: var(--ink); outline: 2px solid var(--focus); outline-offset: 2px; }
.field--search { -webkit-appearance: none; appearance: none; }

/* 年級 chip：可橫向捲動（手機右側漸隱提示，見 RWD） */
.chips {
  display: flex; gap: 8px; overflow-x: auto; -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain; scrollbar-width: none; padding: 3px 3px 3px 0;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; min-height: var(--tap); padding: 0 16px; border-radius: 0; cursor: pointer; white-space: nowrap;
  border: 1px solid var(--line-dashed-dark); background: transparent; color: var(--on-dark); font-size: 15px;
  transition: background-color .32s var(--ease), border-color .32s var(--ease), color .32s var(--ease);
}
.chip:hover { border-color: var(--on-dark); }
.chip.is-on { border-color: var(--champagne); background: var(--champagne); color: var(--ink); }

/* ---------- 空狀態（深底） ---------- */
.empty { padding: 48px 0; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.empty[hidden] { display: none; }
.empty::before { content: ""; width: 56px; height: 1px; background: var(--gold); margin-bottom: 8px; }
.empty__t { font-family: var(--serif-zh); font-weight: 500; font-size: 22px; line-height: 1.4; color: var(--on-dark); }
:lang(en) .empty__t { font-family: var(--serif-en); font-weight: 400; }
.empty__d { font-size: 16px; line-height: 1.7; color: var(--on-dark-muted); }

/* ---------- 信箋卡片（桌機 3 欄、平板 2 欄、手機單欄） ---------- */
.cards {
  list-style: none; margin: 32px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; align-items: stretch;
}
.cards[hidden] { display: none; }
.cards:focus { outline: none; }
.entry {
  position: relative; min-width: 0;
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto 1fr auto;
  grid-template-areas: "head snap" "title snap" "quote quote" "act act";
  column-gap: 20px;
  background: var(--paper); color: var(--ink);
  padding: 44px clamp(24px, 2.6vw, 36px) 32px; min-height: 440px;
}
/* 頂端 56px 短金線（燙金細節） */
.entry::before { content: ""; position: absolute; top: 0; left: clamp(24px, 2.6vw, 36px); width: 56px; height: 1px; background: var(--gold); }
.entry__head { grid-area: head; }
.entry__who { font-size: 15px; color: var(--grey); margin-top: 6px; overflow-wrap: anywhere; }
.entry__who b { font-weight: 500; color: var(--ink); margin-right: 8px; }
.entry__gift {
  grid-area: title; margin-top: 18px; font-family: var(--serif-zh); font-weight: 500; font-size: 23px; line-height: 1.45; letter-spacing: .02em;
  overflow-wrap: anywhere; text-wrap: balance; color: inherit;
}
:lang(en) .entry__gift { font-family: var(--serif-en); font-weight: 400; letter-spacing: 0; }
.entry__reason {
  grid-area: quote; margin-top: 24px; font-family: var(--serif-zh); font-size: 18px; line-height: 1.95;
  overflow-wrap: anywhere; white-space: pre-line; text-wrap: pretty;
}
:lang(en) .entry__reason { font-family: var(--serif-en); line-height: 1.75; }
.entry__act { grid-area: act; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.entry__cta { width: 100%; }
/* 整張卡可點（語意上仍是按鈕；Tab 焦點在按鈕，卡片同步顯示焦點框） */
.entry .entry__cta::after { content: ""; position: absolute; inset: 0; }
.entry { cursor: pointer; }
.entry:has(.entry__cta:focus-visible) { outline: 2px solid var(--on-dark); outline-offset: 4px; }
.entry .entry__cta:focus-visible { outline-offset: 2px; }
.entry:hover .entry__cta { background: var(--ink); color: #fff; }

/* 狀態註記：文字＋圖示（不只靠顏色） */
.status { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 32px; font-size: 15px; text-align: center; flex-wrap: wrap; }
.status__icon { width: 20px; height: 20px; flex: none; }

/* 我的：信箋外加一道 2px 香檳實線框 */
.entry.is-mine { box-shadow: 0 0 0 2px var(--champagne); }

/* 他人已認領：信箋「從桌上被拿走」，只留白色虛線輪廓 */
.entry.is-claimed:not(.is-mine) {
  background: transparent; color: var(--on-dark); outline-offset: 0;
  border: 1px dashed var(--line-dashed-dark);
}
.entry.is-claimed:not(.is-mine)::before { display: none; }
.entry.is-claimed:not(.is-mine) .entry__who { color: var(--on-dark-muted); }
.entry.is-claimed:not(.is-mine) .entry__who b { color: var(--on-dark); }
.entry.is-claimed:not(.is-mine) .entry__act { border-top-color: var(--line-dark); }
.entry.is-claimed:not(.is-mine) .entry__cta { background: transparent; color: var(--on-dark); border-color: var(--line-dashed-dark); }
.entry.is-claimed:not(.is-mine):hover .entry__cta { background: var(--on-dark); color: var(--ink); }
.entry.is-claimed:not(.is-mine) .snap:not(.is-empty) { opacity: .9; }
.entry.is-claimed:not(.is-mine) .snap.is-empty { border-color: var(--line-dashed-dark); color: var(--on-dark-muted); }

/* 骨架 */
.entry--skeleton { min-height: 360px; display: block; cursor: default; }
.sk { width: 100%; display: flex; flex-direction: column; gap: 14px; }
.sk span { display: block; height: 14px; background: var(--ic-grey-light); opacity: .7; animation: pulse 1.4s ease-in-out infinite; }
.sk span:nth-child(1) { width: 22%; }
.sk span:nth-child(2) { width: 60%; height: 22px; }
.sk span:nth-child(3) { width: 92%; height: 96px; }
.sk span:nth-child(4) { width: 100%; height: 48px; margin-top: 24px; }
@keyframes pulse { 50% { opacity: .35; } }

/* ---------- 手寫卡照片：相紙白邊＋兩個洲際黑相片角＋微傾（≤2°） ---------- */
.snap {
  --corner: 16px; --tilt: 0deg;
  grid-area: snap; align-self: start; position: relative; display: block;
  width: 104px; aspect-ratio: 3 / 4; padding: 6px; margin: 0;
  background: var(--photo-paper); border: 1px solid rgba(61,57,53,.10);
  box-shadow: 0 1px 2px rgba(61,57,53,.08), 0 6px 16px rgba(61,57,53,.07);
  transform: rotate(var(--tilt));
}
.snap.is-landscape { width: 132px; aspect-ratio: 4 / 3; }
.snap img { width: 100%; height: 100%; object-fit: contain; }
.snap::before, .snap::after {
  content: ""; position: absolute; top: -3px; width: var(--corner); height: var(--corner);
  background: var(--ink); pointer-events: none;
}
.snap::before { left: -3px; clip-path: polygon(0 0, 100% 0, 0 100%); }
.snap::after { right: -3px; clip-path: polygon(0 0, 100% 0, 100% 100%); }
.tilt-0 { --tilt: -1.5deg; } .tilt-1 { --tilt: 1.2deg; } .tilt-2 { --tilt: -1deg; }
.tilt-3 { --tilt: 1.5deg; }  .tilt-4 { --tilt: -.8deg; } .tilt-5 { --tilt: .9deg; }
/* 尚無照片：不傾斜、無相片角的虛線空框 */
.snap.is-empty {
  transform: none; background: transparent; box-shadow: none; border: 1px dashed var(--line-strong);
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  padding: 10px; font-size: 13px; line-height: 1.55; color: var(--grey);
}
.snap.is-empty::before, .snap.is-empty::after { display: none; }

/* ---------- 遮罩與對話框 ---------- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes popIn { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes sideIn { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.overlay {
  position: fixed; inset: 0; z-index: 50; background: var(--scrim);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fadeIn .32s var(--ease);
}
.overlay[hidden] { display: none; }
.overlay--panel { z-index: 55; }
.overlay--photo { z-index: 60; background: var(--ink-deep); align-items: stretch; }

.dialog {
  width: 100%; max-height: 92vh; max-height: 92dvh; background: var(--paper); color: var(--ink);
  display: flex; flex-direction: column; box-shadow: 0 -12px 32px rgba(0,0,0,.24);
  animation: sheetUp .32s var(--ease);
}
.dialog__bar {
  flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 4px 4px 4px 20px; border-bottom: 1px solid var(--line); background: var(--paper);
}
.dialog__title { font-family: var(--serif-zh); font-weight: 500; font-size: 18px; }
:lang(en) .dialog__title { font-family: var(--serif-en); font-weight: 400; }
.x {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; flex: none;
  min-width: 48px; min-height: 48px; padding: 0 12px; border: none; background: transparent; cursor: pointer; font-size: 15px;
}
.x svg { width: 16px; height: 16px; }
.x:hover { text-decoration: underline; text-underline-offset: 4px; }
.x:focus-visible { outline-offset: -4px; }
.dialog__body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.dialog__act {
  flex: none; display: flex; flex-direction: column; gap: 8px;
  padding: 12px 16px calc(12px + var(--safe-b)); border-top: 1px solid var(--line); background: var(--paper);
}

/* 詳情：左頁（手機為上方）香檳相片頁 */
.page-photo {
  background: var(--champagne); color: var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  padding: 28px 20px 16px;
}
.snap--big { --corner: 24px; --tilt: -.6deg; padding: 10px; cursor: zoom-in; font: inherit; color: inherit; }
button.snap--big { appearance: none; border-radius: 0; }
.snap--big.is-portrait { width: auto; height: min(46vh, 420px); height: min(46dvh, 420px); max-width: 100%; }
.snap--big.is-landscape { width: min(100%, 480px); height: auto; }
.snap--big.is-empty {
  cursor: default; width: min(72%, 260px); height: auto; aspect-ratio: 3 / 4;
  border-color: rgba(61,57,53,.6); background: rgba(250,248,245,.45); color: var(--ink); font-size: 16px;
}
.snap--big:focus-visible { outline: 2px solid var(--ink); outline-offset: 6px; }
.hint { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; min-height: 24px; color: var(--ink); }
.hint svg { width: 16px; height: 16px; }

/* 詳情：右頁（手機為下方）暖白文字頁 */
.page-text { padding: 24px 20px 28px; display: flex; flex-direction: column; gap: 0; }
.page-text .entry__who { font-size: 16px; margin-top: 0; }
.sheet__gift { font-family: var(--serif-zh); font-weight: 500; font-size: 26px; line-height: 1.4; letter-spacing: .02em; margin-top: 8px; overflow-wrap: anywhere; text-wrap: balance; color: var(--ink); }
:lang(en) .sheet__gift { font-family: var(--serif-en); font-weight: 400; letter-spacing: 0; }
.said { margin-top: 20px; padding-left: 16px; border-left: 1px solid var(--gold-deep); font-family: var(--serif-zh); font-size: 19px; line-height: 1.95; white-space: pre-line; overflow-wrap: anywhere; }
:lang(en) .said { font-family: var(--serif-en); line-height: 1.75; }
.facts { margin: 24px 0 0; border-top: 1px solid var(--line); }
.facts__row { display: grid; grid-template-columns: 6em minmax(0, 1fr); gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--line); }
:lang(en) .facts__row { grid-template-columns: 7em minmax(0, 1fr); }
.facts dt { font-size: 15px; color: var(--grey); }
.facts dd { margin: 0; font-size: 16px; line-height: 1.55; display: flex; flex-direction: column; gap: 2px; }
.facts dd .num { font-size: 22px; line-height: 1.2; }
.facts__sub { font-size: 14px; color: var(--grey); }
.facts .is-key dd { font-family: var(--serif-zh); font-weight: 500; }
:lang(en) .facts .is-key dd { font-family: var(--font-sans); }
.facts .is-key .facts__sub { font-family: var(--font-sans); font-weight: 400; }
.sheet__who { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 14px; flex-wrap: wrap; margin-top: 20px; }
.note { font-size: 14px; color: var(--grey); line-height: 1.6; }
.page-text .note { margin-top: 4px; }
.page-text .note--gap { margin-top: 20px; }
.form-err {
  color: var(--ink); font-size: 15px; line-height: 1.5; font-weight: 500;
  padding: 8px 0 8px 12px; border-left: 2px solid var(--gold-deep);
}
.status--mine-lg { justify-content: flex-start; font-size: 15px; min-height: 0; margin-bottom: 10px; }
.next { margin: 20px 0 0; padding: 0; list-style: none; counter-reset: n; border-top: 1px solid var(--line); }
.next li {
  counter-increment: n; display: grid; grid-template-columns: 1.6em 1fr; gap: 8px;
  padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 16px; line-height: 1.6;
}
.next li::before { content: counter(n) "."; font-family: var(--serif-en); font-size: 17px; }
.page-text .next + .note { margin-top: 12px; }
.confirm { display: flex; flex-direction: column; gap: 12px; padding-top: 12px; border-top: 2px solid var(--ink); }
.confirm__t { font-size: 15px; line-height: 1.6; }

/* 我的認領：側邊面板（手機底部） */
.panel .dialog__body { padding: 20px var(--gutter); display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 14px; line-height: 1.6; color: var(--grey); }
.mine-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.mine-empty { padding: 32px 0; display: flex; flex-direction: column; gap: 16px; align-items: flex-start; }
.mine-empty p { font-size: 16px; }
.mine-item { padding: 16px 0; display: flex; flex-direction: column; gap: 12px; border-bottom: 1px solid var(--line); }
.mine-item__top { display: flex; gap: 12px; align-items: flex-start; }
.mine-item__info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mine-item__gift { font-size: 16px; font-weight: 500; line-height: 1.45; }
.mine-item .entry__who { margin-top: 0; font-size: 14px; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.step { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--grey); }
.step::before { content: ""; height: 2px; background: var(--ic-grey-light); }
.step.is-done { color: var(--ink); font-weight: 500; }
.step.is-done::before { background: var(--ink); }

/* ---------- 照片放大檢視（全螢幕、contain、不橫向溢出） ---------- */
.lightbox { width: 100%; display: flex; flex-direction: column; color: var(--on-dark); animation: fadeIn .32s var(--ease); }
.lb-bar {
  flex: none; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 4px 4px 4px 8px; padding-top: calc(4px + env(safe-area-inset-top, 0px)); border-bottom: 1px solid var(--line-dark);
}
.lightbox figure {
  flex: 1 1 auto; min-height: 0; min-width: 0; margin: 0; padding: 20px 16px calc(20px + var(--safe-b));
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
}
.lightbox img {
  width: auto; height: auto; max-width: 100%;
  max-height: calc(100vh - 150px); max-height: calc(100dvh - 150px);
  object-fit: contain; background: var(--photo-paper); padding: 8px;
}
.lightbox figcaption { font-size: 14px; color: var(--on-dark-muted); text-align: center; }

/* ---------- 底部送禮提醒 ---------- */
.reminder {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: var(--paper); color: var(--ink); border-top: 1px solid var(--gold);
  padding: 8px var(--gutter) calc(8px + var(--safe-b));
}
.reminder[hidden] { display: none; }
.reminder__inner { max-width: var(--page-w); margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.reminder__text { flex: 1; min-width: 0; font-size: 14px; line-height: 1.5; }
.reminder__k { font-weight: 500; }
.reminder__d { color: var(--grey); white-space: nowrap; }
.reminder .btn { min-height: var(--tap); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); z-index: 70;
  transform: translate(-50%, 8px); opacity: 0; pointer-events: none;
  background: var(--paper); color: var(--ink); border-top: 1px solid var(--gold);
  box-shadow: 0 8px 24px rgba(0,0,0,.24);
  padding: 12px 20px; font-size: 14px; max-width: min(90vw, 480px);
  transition: opacity .32s var(--ease), transform .32s var(--ease);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
body.has-reminder .toast { bottom: calc(80px + var(--safe-b)); }

/* ---------- 頁尾 ---------- */
.footer { background: var(--ink-deep); margin-top: 0; }
.footer__inner { display: flex; align-items: center; gap: 16px; padding: 32px 0 40px; font-size: 14px; color: var(--on-dark-muted); }
.footer__alt { display: block; font-size: 13px; }
body.has-reminder .footer__inner { padding-bottom: calc(40px + 72px + var(--safe-b)); }

/* ---------- 登入 ---------- */
.login { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: var(--ink); padding-bottom: 48px; }
.login[hidden], #app[hidden] { display: none; }
.login__bar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  width: min(1040px, 100% - 2 * var(--gutter)); margin: 0 auto; padding: 8px 0; border-bottom: 1px solid var(--line-dark);
}
.brandline { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--on-dark-muted); min-width: 0; }
.spread--login { width: min(1040px, 100% - 2 * var(--gutter)); margin-inline: auto; margin-top: clamp(24px, 5vw, 56px); }
.spread--login .cover { min-height: 520px; }
.login__form { display: flex; flex-direction: column; gap: 8px; max-width: 420px; margin-top: 32px; }
.login__title { font-family: var(--serif-zh); font-weight: 500; font-size: 32px; line-height: 1.3; letter-spacing: .04em; color: var(--ink); }
:lang(en) .login__title { font-family: var(--serif-en); font-weight: 400; letter-spacing: 0; }
.login__lead { margin: 4px 0 12px; font-size: 16px; line-height: 1.75; }
.field-label { font-size: 14px; font-weight: 500; margin-top: 8px; }
.login__ts { min-height: 65px; margin-top: 12px; }
.login__ts:empty { min-height: 0; }
.login__err { color: var(--ink); font-size: 15px; font-weight: 500; min-height: 22px; }
.login__err:not(:empty) { padding-left: 12px; border-left: 2px solid var(--gold-deep); }
.login__note { margin-top: 8px; font-size: 14px; color: var(--grey); line-height: 1.6; }

/* ---------- RWD ---------- */
@media (min-width: 721px) {
  .overlay--card { align-items: center; padding: 24px; }
  .card-sheet {
    width: min(640px, 100%); max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px);
    box-shadow: 0 24px 48px rgba(0,0,0,.3); animation-name: popIn;
  }
  .page-text { padding: 32px 36px; }
  .card-sheet .dialog__act { padding: 16px 36px 20px; }
}
@media (min-width: 960px) {
  /* 左右兩頁 5:7，呼應頁首賀卡 */
  .card-sheet {
    display: grid; grid-template-columns: 5fr 7fr; grid-template-rows: auto minmax(0, 1fr) auto;
    width: min(1040px, 100%); height: min(720px, calc(100vh - 48px)); max-height: none;
  }
  .card-sheet .dialog__body { display: contents; }
  .card-sheet .page-photo { grid-column: 1; grid-row: 1 / -1; padding: 48px 40px 36px; }
  .card-sheet .dialog__bar { grid-column: 2; grid-row: 1; padding-left: 40px; }
  .card-sheet .page-text { grid-column: 2; grid-row: 2; overflow-y: auto; overscroll-behavior: contain; padding: 28px 48px 32px; }
  .card-sheet .dialog__act { grid-column: 2; grid-row: 3; padding: 16px 48px 24px; }
  .snap--big.is-portrait { height: min(460px, calc(100vh - 240px)); }
}
@media (min-width: 768px) {
  .overlay--panel { justify-content: flex-end; align-items: stretch; }
  .panel { width: min(500px, 100%); max-height: none; height: 100%; animation-name: sideIn; box-shadow: -12px 0 32px rgba(0,0,0,.24); }
}
@media (max-width: 1120px) {
  .spread { grid-template-columns: 1fr; }
  .cover { min-height: 0; flex-direction: row; justify-content: flex-start; padding: 32px 40px; gap: 32px; }
  .spread--login .cover { min-height: 0; }
  .cover-title { text-align: left; padding: 0 0 0 16px; }
  .ribbon { display: none; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  :root { --gutter: 16px; --topbar-h: 56px; }
  .topbar__full { display: none; }
  .topbar__short { display: inline; }
  .brandline span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .spread { margin-top: 16px; }
  /* 手機精簡封面：一列盾徽＋2026 */
  .cover { padding: 16px 20px; gap: 16px; }
  .shield--cover { --w: 30px; }
  .cover-title { padding: 0; }
  .cover-title .yr { font-size: 40px; }
  .cover-title p { font-size: 15px; margin-top: 4px; }
  .cover-title p span { font-size: 13px; letter-spacing: .14em; margin-top: 2px; }
  .inside { padding: 22px 20px 20px; }
  .inside__logo { width: 112px; }
  .inside__title { font-size: 28px; margin-top: 18px; }
  .inside__alt { font-size: 17px; margin-top: 4px; }
  .inside__lede { margin-top: 14px; font-size: 16px; line-height: 1.8; }
  .how { margin-top: 18px; }
  .how li { grid-template-columns: 64px minmax(0, 1fr); gap: 12px; padding: 10px 0; }
  .how__k { font-size: 14px; padding-top: 2px; }
  .how p { font-size: 15px; }
  .how .is-key p { font-size: 16px; }
  .login__form { margin-top: 20px; }
  .login__title { font-size: 26px; }

  .page { padding: 48px 0 64px; }
  .filters { position: static; }
  .filters__row { flex-direction: column; align-items: stretch; gap: 8px; }
  .tabs { gap: 0; justify-content: space-between; }
  .tabs__btn, .tabs__btn:first-child { flex: 1; justify-content: center; padding: 0 8px; }
  .search { min-width: 0; }
  /* 年級列：右側漸隱＋留白，提示可往右捲；捲到底時最後一個 chip 完整落在清晰區 */
  .chips {
    padding-right: 56px;
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 48px), transparent);
            mask-image: linear-gradient(to right, #000 calc(100% - 48px), transparent);
  }
  .cards { grid-template-columns: minmax(0, 1fr); gap: 20px; margin-top: 24px; }
  .entry { min-height: 0; padding: 36px 22px 22px; column-gap: 16px; }
  .entry::before { left: 22px; }
  .entry__gift { font-size: 22px; }
  .entry__reason { font-size: 17px; margin-top: 20px; }
  .entry__act { margin-top: 20px; padding-top: 16px; }
  .reminder__d { display: block; }
}
@media (max-width: 360px) {
  .snap { width: 92px; }
  .snap.is-landscape { width: 116px; }
  .topbar__short { display: none; }
}

/* ---------- 減少動態：不滑入、不淡入 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important;
  }
  .sk span { animation: none; }
}

/* 測試版橫幅（正式上線時移除 index.html 的 .testbar） */
.testbar { background: #FAF8F5; color: #3D3935; border-bottom: 2px solid #8C6A35; text-align: center; font: 600 13px/1.4 var(--font-sans, 'Jost', 'Noto Sans TC', sans-serif); padding: 8px 12px; letter-spacing: .02em; }
