/* Code Homemade LINE Mini App — 設計系統
   色票源自 codehomemade.com，對比度調整至 WCAG AA，另備深色模式。 */

/* 兩支字型都自架、都只含站內用字的子集（見 scripts/optimize_assets.py）。
   改過 static 下的文案後要重跑該腳本並升 ?v= 版號，否則新字會掉回系統字型。 */

/* 內文：Noto Sans TC 可變字型，一個檔涵蓋 400–700 */
@font-face {
  font-family: "Noto Sans TC";
  src: url(/static/fonts/NotoSansTC-subset.woff2?v=7) format("woff2-variations");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

/* 標題：手寫體 */
@font-face {
  font-family: ChenYuluoyan;
  src: url(/static/fonts/ChenYuluoyan-subset.woff2?v=7) format("woff2");
  font-weight: 300;
  font-display: swap;
  /* fallback 與手寫體字寬對齊，避免換字時跳版 */
  size-adjust: 104%;
  ascent-override: 88%;
  descent-override: 18%;
}

/* ------------------------------------------------------------------ tokens */

:root {
  /* 間距尺標 —— 全站只用這 7 階 */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 36px;
  --sp-7: 56px;

  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 22px;

  --gutter: 16px;
  --maxw: 520px;

  --bg: #F5F0EB;
  --paper: #FBF8F4;
  --card: #EDE7E0;
  --card2: #E8E3D8;
  --fg: #2C2421;
  --muted: #6E6259;       /* 5.2:1 on --bg */
  --line: #B5A898;
  --hairline: rgba(181, 168, 152, 0.32);
  --green: #A8AD96;       /* 裝飾用（扇貝紋、線條） */
  --green-d: #6B7156;     /* 承載白字用，5.1:1 */
  --green-l: #C5CABC;
  --green-xl: #D9D7C2;
  --shadow-s: 0 1px 3px rgba(44, 36, 33, 0.06);
  --shadow-m: 0 4px 16px rgba(44, 36, 33, 0.10);
  --shadow-l: 0 10px 34px rgba(44, 36, 33, 0.16);
  --scrim: rgba(28, 22, 18, 0.55);
  --skeleton: rgba(181, 168, 152, 0.16);
  --skeleton-hi: rgba(251, 248, 244, 0.7);

  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17120F;
    --paper: #201A16;
    --card: #282119;
    --card2: #322A22;
    --fg: #EFE7DE;
    --muted: #AC9F93;     /* 7.0:1 on --bg */
    --line: #4E4239;
    --hairline: rgba(172, 159, 147, 0.2);
    --green: #9BA189;
    --green-d: #B4BA9F;
    --green-l: #6E7560;
    --green-xl: #3A3527;
    --shadow-s: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-m: 0 4px 16px rgba(0, 0, 0, 0.5);
    --shadow-l: 0 10px 34px rgba(0, 0, 0, 0.6);
    --scrim: rgba(0, 0, 0, 0.7);
    --skeleton: rgba(172, 159, 147, 0.1);
    --skeleton-hi: rgba(172, 159, 147, 0.22);
  }
}

/* ------------------------------------------------------------------ reset */

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: "Noto Sans TC", system-ui, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.75;
  font-size: 15px;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
.hidden { display: none !important; }

.display {
  font-family: "ChenYuluoyan", "Noto Sans TC", system-ui, sans-serif;
  font-weight: 300;
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

/* ------------------------------------------------------------ 共用排版元素 */

/* 法式甜點眉標 —— mono 小字 */
.eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}

/* 簽名元素：酥餅壓邊扇貝紋分隔 */
.ridge {
  height: 10px;
  margin: var(--sp-6) 0 var(--sp-5);
  background-image: radial-gradient(circle at 5px 11px, var(--green-l) 5.5px, transparent 6px);
  background-size: 10px 10px;
  background-repeat: repeat-x;
  opacity: 0.85;
}

#view {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gutter) calc(var(--sp-7) + 48px + env(safe-area-inset-bottom));
}

.section { margin-top: var(--sp-6); }
.section + .section { margin-top: var(--sp-5); }

.section-title { font-size: 26px; line-height: 1.3; margin-bottom: var(--sp-1); letter-spacing: 0.06em; }
.section-sub { color: var(--muted); font-size: 13px; margin-bottom: var(--sp-4); }
.home-section-title { font-size: 24px; letter-spacing: 0.06em; margin-bottom: var(--sp-3); }

.section h2 { font-size: 22px; line-height: 1.3; margin-bottom: var(--sp-3); letter-spacing: 0.06em; }
.section h3 { font-size: 16px; margin: var(--sp-4) 0 var(--sp-2); }

.para { font-size: 13.5px; color: var(--fg); margin-bottom: var(--sp-3); }

/* ------------------------------------------------------------------ 圖片 */

/* .pic 撐住版位＋骨架微光，圖到位才淡入，CLS 為 0 */
.pic {
  position: relative;
  overflow: hidden;
  background: var(--skeleton);
  border-radius: inherit;
}
.pic::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, var(--skeleton-hi) 50%, transparent 80%);
  transform: translateX(-100%);
  animation: shimmer 1.4s infinite;
}
.pic.loaded::after { display: none; }
.pic picture { display: block; height: 100%; }
.pic img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .4s var(--ease);
}
.pic.loaded img { opacity: 1; }

@keyframes shimmer { to { transform: translateX(100%); } }

/* 透明去背圖不需要骨架灰塊 */
.pic.alpha { background: transparent; }
.pic.alpha::after { display: none; }

.zoomable { cursor: zoom-in; }

/* ------------------------------------------------------------------ 按鈕 */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  border: none;
  border-radius: 999px;
  padding: 13px 24px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  text-align: center;
  min-height: 46px;
  transition: transform .14s var(--ease), box-shadow .2s var(--ease), opacity .2s;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary { background: var(--fg); color: var(--bg); box-shadow: var(--shadow-m); }
.btn-secondary { background: transparent; color: var(--fg); border: 1.5px solid var(--line); }
.btn:active { transform: scale(0.97); }
.btn-full { display: flex; width: 100%; }

/* 可按元素的通用壓下回饋 */
.pressable { transition: transform .14s var(--ease), box-shadow .2s var(--ease); }
.pressable:active { transform: scale(0.985); box-shadow: var(--shadow-s); }

.chip {
  display: inline-block;
  background: var(--green-xl);
  color: var(--fg);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  margin: 0 var(--sp-2) var(--sp-2) 0;
}
.chip.ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.chip-row { margin-top: var(--sp-2); }

.badge {
  display: inline-block;
  background: var(--green-d);
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 500;
  border-radius: 999px;
  padding: 2px 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .badge { color: #1A1510; }
}

/* ----------------------------------------------------------------- topbar */

#topbar {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 14px var(--gutter);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
}

.brand { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.brand img { width: 34px; height: 34px; flex: none; }
.brand span {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.3em;
  color: var(--fg);
  font-weight: 500;
}

/* 頭像問候 —— 取自 LIFF profile */
.greet {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 12px;
  color: var(--muted);
  max-width: 46%;
  animation: fadeIn .4s var(--ease);
}
.greet img { width: 26px; height: 26px; border-radius: 50%; flex: none; object-fit: cover; }
.greet span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

body.detail #topbar { display: none; }

/* 詳情頁浮動返回鍵 —— tabbar 隱藏時唯一的出口 */
#backbar {
  position: fixed;
  top: calc(10px + env(safe-area-inset-top));
  left: max(var(--gutter), calc(50vw - var(--maxw) / 2 + var(--gutter)));
  z-index: 40;
  display: none;
}
body.detail #backbar { display: block; }
body.has-banner #backbar { top: calc(18px + env(safe-area-inset-top) + var(--banner-h, 0px)); }

.back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--hairline);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(12px) saturate(1.4);
  -webkit-backdrop-filter: blur(12px) saturate(1.4);
  color: var(--fg);
  box-shadow: var(--shadow-m);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .14s var(--ease);
}
.back-btn:active { transform: scale(0.92); }

/* ----------------------------------------------------------------- banner */

#banner {
  max-width: var(--maxw);
  margin: var(--sp-3) auto 0;
  padding: 10px 14px;
  background: var(--card2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--fg);
}

/* ----------------------------------------------------------------- tabbar */

#tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  gap: var(--sp-1);
  max-width: var(--maxw);
  margin: 0 auto;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-top: 1px solid var(--hairline);
  padding: var(--sp-2) var(--sp-3) calc(var(--sp-2) + env(safe-area-inset-bottom));
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 0;
  border-radius: var(--r-sm);
  color: var(--muted);
  font-size: 10.5px;
  transition: color .2s var(--ease), background-color .2s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.tab-icon { line-height: 1; }
.tab-icon svg { width: 24px; height: 24px; display: block; }
.tab.active { background: var(--fg); color: var(--bg); }
.tab:active { transform: scale(0.94); }

body.detail #tabbar { display: none; }

/* ------------------------------------------------------------------- home */

.hero { margin-top: var(--sp-1); }
.hero-photo {
  margin: 0 calc(var(--gutter) * -1);
  aspect-ratio: 4 / 5;
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}

/* 奶油票券卡 —— 上疊於滿版照片 */
.hero-ticket {
  position: relative;
  z-index: 1;
  margin: -64px var(--sp-4) 0;
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: var(--sp-1) var(--r-md) var(--r-md) var(--r-md);
  padding: 18px 18px 20px;
  box-shadow: var(--shadow-l);
}
.hero-ticket .hero-text { margin: var(--sp-2) 0 var(--sp-4); font-size: 13.5px; line-height: 1.9; }
.hero-statement { font-size: 24px; line-height: 1.4; margin-top: var(--sp-2); }
.hero-ticket .btn { display: flex; }

/* 卡片 */
.card {
  background: var(--paper);
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow-s);
}

.product-card {
  display: block;
  background: var(--paper);
  border-radius: var(--r-md);
  overflow: hidden;
  margin-bottom: var(--sp-4);
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow-s);
}
.product-card .pic { aspect-ratio: 1 / 1; border-radius: 0; }
.product-card .pc-body { padding: var(--sp-4); }
.pc-name { font-size: 19px; line-height: 1.35; }
.pc-tagline { color: var(--muted); font-size: 12.5px; margin: 2px 0 var(--sp-2); }
.pc-desc { font-size: 13px; margin-bottom: var(--sp-3); }
.pc-meta { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-2); }
.pc-price { font-size: 17px; font-weight: 700; letter-spacing: 0.02em; }
.pc-note { color: var(--muted); font-size: 11.5px; text-align: right; line-height: 1.5; }

/* 橫向 snap 捲動商品列（首頁） */
.rail {
  display: flex;
  gap: var(--sp-4);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  margin: 0 calc(var(--gutter) * -1);
  padding: var(--sp-1) var(--gutter) var(--sp-3);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }
.rail .product-card { flex: 0 0 74%; margin-bottom: var(--sp-1); scroll-snap-align: start; }
.rail .product-card .pic { aspect-ratio: 4 / 3; }

/* 食材 2 欄格 */
.ing-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.ing-grid .ingredient-card { margin-bottom: 0; }
.ing-grid .ingredient-card .pic { aspect-ratio: 1 / 1; border-radius: 0; }
.ing-pad { padding: 10px var(--sp-3) var(--sp-3); }
.ing-name { font-size: 15px; line-height: 1.35; }
.ing-origin { font-size: 10.5px; font-family: var(--mono); letter-spacing: 0.04em; color: var(--muted); }

.story-img { width: 100%; aspect-ratio: 3 / 2; border-radius: var(--r-md); margin-bottom: var(--sp-3); }

.teaser-link {
  display: inline-block;
  margin-top: var(--sp-1);
  font-size: 14px;
  font-weight: 500;
  border-bottom: 1.5px solid var(--fg);
  padding-bottom: 1px;
}

/* --------------------------------------------------------------- 商品列表 */

.list-head { margin-top: var(--sp-4); }

/* --------------------------------------------------------------- 商品詳情 */

.detail-hero { aspect-ratio: 1 / 1; border-radius: 0 0 var(--r-lg) var(--r-lg); margin: 0 calc(var(--gutter) * -1); }
.detail-head { margin: var(--sp-5) 2px var(--sp-2); }
.detail-name { font-size: 30px; line-height: 1.3; }
.detail-tagline { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.detail-desc { margin: var(--sp-3) 2px 0; font-size: 14px; }

.spec-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: var(--sp-4); }
.spec-cell { background: var(--card); border-radius: var(--r-sm); padding: 10px 14px; }
.spec-label { font-size: 11.5px; color: var(--muted); }
.spec-value { font-size: 15px; font-weight: 500; }

/* 出貨提示條 —— 手作甜點顧客的第一個疑問 */
.lead-time {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-top: var(--sp-4);
  padding: 11px 14px;
  background: var(--green-xl);
  border-radius: var(--r-sm);
  font-size: 12.5px;
  line-height: 1.6;
}
.lead-time svg { flex: none; color: var(--green-d); }

.dl { margin: var(--sp-2) 0 var(--sp-3); list-style: none; }
.dl-row { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--hairline); font-size: 13.5px; }
.dl-row:last-child { border-bottom: none; }
.dl-term { flex: 0 0 5.5em; font-weight: 500; }
.dl-desc { flex: 1; color: var(--muted); }
ol.dl { counter-reset: dl; }
ol.dl .dl-term::before { counter-increment: dl; content: counter(dl) ". "; color: var(--green-d); font-weight: 700; }

.nutrition-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.nutrition-table caption { text-align: left; color: var(--muted); font-size: 12px; padding-bottom: var(--sp-2); }
.nutrition-table th, .nutrition-table td { text-align: left; padding: 9px var(--sp-1); border-bottom: 1px solid var(--hairline); }
.nutrition-table th { font-size: 12px; color: var(--muted); font-weight: 500; }
.nutrition-table td:last-child, .nutrition-table th:last-child { text-align: right; }

.testimonial {
  background: var(--card);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  margin-bottom: var(--sp-3);
  border-left: 3px solid var(--green-d);
}
.testimonial blockquote { font-size: 13.5px; }
.testimonial .who { margin-top: var(--sp-2); font-size: 12.5px; color: var(--muted); text-align: right; }

.cross-card {
  display: flex;
  gap: var(--sp-3);
  align-items: center;
  background: var(--card);
  border-radius: var(--r-md);
  padding: var(--sp-3);
  cursor: pointer;
  width: 100%;
  border: none;
  text-align: left;
  color: inherit;
}
.cross-card .pic { width: 84px; height: 84px; border-radius: var(--r-sm); flex: none; }
.cross-name { font-size: 15px; }
.cross-price { font-size: 13px; color: var(--muted); }

/* 詳情頁固定底部動作列 */
.detail-actions {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 30;
  max-width: var(--maxw);
  margin: 0 auto;
  display: none;
  gap: 10px;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-top: 1px solid var(--hairline);
  padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom));
}
body.detail .detail-actions { display: flex; }
.detail-actions .btn { flex: 1; padding: 12px 10px; }
.detail-actions .btn-secondary { flex: 0 0 44%; }

/* ---------------------------------------------------------------- 訂購頁 */

.step-list { counter-reset: step; list-style: none; margin-top: var(--sp-4); }
.step {
  position: relative;
  counter-increment: step;
  padding: 0 0 var(--sp-5) var(--sp-6);
  border-left: 1px solid var(--hairline);
  margin-left: 14px;
}
.step:last-child { border-left-color: transparent; padding-bottom: 0; }
.step::before {
  content: counter(step);
  position: absolute;
  left: -14px;
  top: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--green-d);
  color: #FFFFFF;
  font-family: var(--mono);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .step::before { color: #1A1510; }
}
.step-title { font-size: 15px; font-weight: 500; line-height: 1.6; }
.step-desc { font-size: 13px; color: var(--muted); }

.spec-list { display: grid; gap: 10px; margin-top: var(--sp-3); }
.spec-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-3);
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  padding: var(--sp-3) var(--sp-4);
}
.spec-row-name { font-size: 15px; font-weight: 500; }
.spec-row-detail { font-size: 12px; color: var(--muted); }
.spec-row-price { font-size: 15px; font-weight: 700; white-space: nowrap; }

.note-box {
  margin-top: var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  background: var(--card);
  border-radius: var(--r-sm);
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.75;
}

/* ------------------------------------------------------------------- FAQ */

.faq-item {
  border-bottom: 1px solid var(--hairline);
}
.faq-q {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-3);
  width: 100%;
  background: none;
  border: none;
  color: inherit;
  text-align: left;
  font-size: 14.5px;
  font-weight: 500;
  line-height: 1.7;
  padding: var(--sp-4) 2px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.faq-q::after {
  content: "";
  flex: none;
  width: 10px;
  height: 10px;
  margin-top: 8px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg);
  transition: transform .26s var(--ease);
}
.faq-item.open .faq-q::after { transform: rotate(-135deg); }
.faq-a {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .3s var(--ease);
}
.faq-item.open .faq-a { grid-template-rows: 1fr; }
.faq-a > div { overflow: hidden; }
.faq-a p { font-size: 13.5px; color: var(--muted); padding: 0 2px var(--sp-4); }

/* ----------------------------------------------------------------- 品牌頁 */

.brand-logo { width: 72px; margin: 10px auto var(--sp-4); }
.closing { text-align: center; font-size: 20px; line-height: 1.8; margin: var(--sp-5) 0 var(--sp-2); }
.running-cat { width: 120px; margin: 18px auto var(--sp-2); }
/* 原圖是純黑剪影，深色底會整隻消失 —— 反相成奶油色再補一點暖調 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .running-cat img { filter: invert(0.92) sepia(0.14); }
}
.brand-center { text-align: center; }
.letter-first { font-size: 21px; line-height: 1.7; margin-bottom: var(--sp-4); }

.value-card { margin-bottom: var(--sp-4); }
.value-card .pic { aspect-ratio: 3 / 2; border-radius: 0; }
.value-pad { padding: var(--sp-3) var(--sp-4) var(--sp-4); }

/* ------------------------------------------------- 加官方帳號好友 / 底部表 */

.friend-card {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-top: var(--sp-5);
  padding: var(--sp-4);
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-s);
}
.friend-card .fc-text { flex: 1; min-width: 0; }
.friend-card .fc-title { font-size: 14.5px; font-weight: 500; }
.friend-card .fc-sub { font-size: 12px; color: var(--muted); line-height: 1.6; }
.friend-card .btn { flex: none; padding: 10px 18px; min-height: 40px; font-size: 13px; }

#sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: var(--scrim);
  opacity: 0;
  transition: opacity .28s var(--ease);
}
#sheet.show { opacity: 1; }
.sheet-panel {
  width: 100%;
  max-width: var(--maxw);
  background: var(--paper);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  padding: var(--sp-5) var(--sp-5) calc(var(--sp-5) + env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform .32s var(--ease);
  text-align: center;
}
#sheet.show .sheet-panel { transform: none; }
.sheet-grip { width: 38px; height: 4px; border-radius: 2px; background: var(--line); margin: -8px auto var(--sp-4); }
.sheet-title { font-size: 19px; margin-bottom: var(--sp-2); }
.sheet-text { font-size: 13px; color: var(--muted); margin-bottom: var(--sp-4); }
.sheet-actions { display: grid; gap: var(--sp-2); }

/* -------------------------------------------------------------- lightbox */

#lightbox {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-5);
  background: rgba(20, 15, 12, 0.94);
  opacity: 0;
  transition: opacity .26s var(--ease);
  cursor: zoom-out;
}
#lightbox.show { opacity: 1; }
#lightbox img {
  max-width: 100%;
  max-height: 84vh;
  border-radius: var(--r-md);
  transform: scale(0.94);
  transition: transform .3s var(--ease);
  box-shadow: var(--shadow-l);
}
#lightbox.show img { transform: none; }
.lb-close {
  position: absolute;
  top: calc(var(--sp-4) + env(safe-area-inset-top));
  right: var(--sp-4);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.16);
  color: #FFFFFF;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

/* ------------------------------------------------------------------ toast */

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom));
  z-index: 80;
  background: var(--fg);
  color: var(--bg);
  font-size: 13px;
  padding: 11px 18px;
  border-radius: 999px;
  max-width: 86vw;
  text-align: center;
  box-shadow: var(--shadow-l);
  transform: translate(-50%, 8px);
  opacity: 0;
  transition: opacity .24s var(--ease), transform .24s var(--ease);
  pointer-events: none;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* -------------------------------------------------------------- 動態效果 */

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

@keyframes viewInFwd {
  from { opacity: 0; transform: translateX(18px); }
  to { opacity: 1; transform: none; }
}
@keyframes viewInBack {
  from { opacity: 0; transform: translateX(-18px); }
  to { opacity: 1; transform: none; }
}
#view.in-fwd { animation: viewInFwd .3s var(--ease); }
#view.in-back { animation: viewInBack .3s var(--ease); }

/* 捲動進場 —— 由 IntersectionObserver 加上 .seen */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .55s var(--ease), transform .55s var(--ease);
}
.reveal.seen { opacity: 1; transform: none; }

/* ------------------------------------------------------------ 無障礙底線 */

a:focus-visible, button:focus-visible {
  outline: 2px solid var(--green-d);
  outline-offset: 2px;
  border-radius: var(--sp-2);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}
