* { box-sizing: border-box; margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
:root {
  --app-page-background:
    radial-gradient(circle at 50% 14%, rgba(255, 255, 255, 0.96), transparent 34%),
    radial-gradient(circle at 12% 88%, rgba(255, 174, 116, 0.2), transparent 36%),
    linear-gradient(160deg, #fff9f1 0%, #f8ead8 58%, #f3ddc5 100%);
  --ds-bg-page: #c8ad96;
  --ds-bg-shell: #f6efe6;
  --ds-surface-1: #fffaf3;
  --ds-surface-2: #eee4d8;
  --ds-border-soft: rgba(105, 83, 64, 0.18);
  --ds-divider: #ded0c1;
  --ds-progress-track: #d8c5b2;
  --ds-text-strong: #30261f;
  --ds-text-body: #4f4137;
  --ds-text-muted: #78695e;
  --ds-brand-coral: #cf7a49;
  --ds-brand-apricot: #dc8a4d;
  --ds-brand-lilac: #7b4f83;
  --ds-brand-sky: #8d7564;
  --ds-success: #667f66;
  --ds-warning: #c79233;
  --ds-danger: #b9556c;
  --ds-cta-primary: #44372c;
  --ds-cta-primary-hover: #352a22;
  --ds-cta-secondary: #725548;
  --ds-calorie-surface: #b99a7c;
  --ds-protein: #d97832;
  --ds-fat: #b94f70;
  --ds-carbs: #c79534;
  --ds-token: #f1c44f;
  --ds-token-surface: #3d3127;
  --ds-accent-berry: #744878;
  --ds-accent-grape: #5d3769;
  --ds-nav-surface: #fffaf3;
  --ds-nav-selected: #44372c;
  --ds-radius-card: 22px;
  --ds-radius-control: 16px;
  --ds-space-1: 6px;
  --ds-space-2: 10px;
  --ds-space-3: 14px;
  --ds-space-4: 20px;
  --ds-shadow-card: 0 12px 30px rgba(74, 55, 40, 0.12);
}
body { background: radial-gradient(circle at 50% 0%, #ddcbbb, var(--ds-bg-page) 62%); color: var(--ds-text-strong); display: flex; flex-direction: column; justify-content: center; align-items: center; min-height: 100vh; padding: 10px; padding-top: max(10px, env(safe-area-inset-top)); }
body.has-inapp-banner { padding-top: 0; }

/* ========== Snap Pacer 品牌啟動畫面 (Splash Screen) ==========
   極簡版：Logo → Snap Pacer → 你拍，我在！（不含副標）
   時間軸（可調參數見各區塊註解）：
   0.0s ─ 0.5s   圓圈星號 Logo 淡入（brand-splash-logo-in）
   0.5s ─ 1.52s  「Snap Pacer」逐字亮起（brand-splash-letter-in，每字 stagger 0.08s）
   2.6s          Slogan 第一行「你拍，」浮現（brand-splash-slogan-in）
   3.1s          Slogan 第二行「我在！」接續浮現（「你拍，」出現後 0.5s）
   3.55s ─ 3.8s  整體 glow 微微加強一次（brand-splash-final-glow）
   4.0s          自動關閉 Splash，淡出進首頁（見 index.html 內 setTimeout(finish, 4000)）
   iOS/Android 皆由此同一份 HTML/CSS/JS 驅動，確保兩邊動畫節奏一致；
   原生啟動瞬間顯示的靜態 Splash 圖（resources/splash.png → Assets.xcassets/Splash、
   android 各密度 drawable 資源夾內的 splash.png）已改成同樣的「Logo + Snap Pacer + 你拍，我在！」
   極簡版內容，兩者視覺層級一致，僅差在原生圖是靜態、這裡是動畫。
   Web 與原生 Splash 共用答案之書的米杏色系與圓圈星號品牌語彙。 */
#brand-splash {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--app-page-background);
  opacity: 1;
  transition: opacity 0.38s ease-in;
}
#brand-splash.brand-splash--closing { opacity: 0; pointer-events: none; }
#brand-splash.brand-splash--done { display: none; }

/* 三個元素（Logo / 品牌名 / slogan）共用這一個父容器，靠同一套機制置中：
   flex-direction:column + align-items:center，每個子元素都是「auto 寬度、
   由內容決定寬度、再由父層水平置中」。三者絕對不能有任何 width:100%、
   margin-left、transform: translateX() 之類會脫離這個機制的寫法，
   否則就會出現「各自置中」但彼此不共軸的問題。 */
.brand-splash-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0 32px;
  /* 整體最後一次微光加強：時間點與長度見上方時間軸註解 */
  animation: brand-splash-final-glow 0.25s ease-in-out 3.55s both;
}

.brand-splash-mark {
  display: grid;
  place-items: center;
  width: 116px;
  height: 116px;
  border: 1px solid rgba(149, 95, 60, 0.22);
  border-radius: 50%;
  color: #a7653e;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 14px 32px rgba(117, 73, 45, 0.12);
  font-size: 46px;
  opacity: 0;
  animation: brand-splash-logo-in 0.5s ease-out 0s forwards;
}

.brand-splash-name {
  /* Logo → 主標間距：原本 20px，依需求收緊到 6px（縮短 14px），讓 Logo/主標
     視覺上更像同一組緊密的品牌鎖定（lockup），而不是兩個各自獨立的元素。 */
  margin: 18px 0 0;
  display: flex;
  /* 字母是各自獨立的 <span>（flex item），letter-spacing 對「文字間距」
     沒有作用（那是套在同一個 inline 文字流上才有效），改用 gap 才會
     真的在字母之間加間距，且不會像 letter-spacing 在最後一個字後面
     留下看不見的尾部空白（那個尾部空白會讓文字視覺重心偏左，跟
     Logo/slogan 對不齊）。 */
  gap: 4.5px;
  font-size: 18px;
  /* 字重調整參數：原本 800（極粗）→ 640 → 現在再降到 480，更輕盈精緻。
     想更輕可調到 400；想加回一點厚重感可調到 550~600。 */
  font-weight: 800;
  color: #4c4743;
}
.brand-splash-name span {
  display: inline-block;
  opacity: 0;
  transform: translateY(6px) scale(0.82);
  animation: brand-splash-letter-in 0.3s ease-out forwards;
  /* 逐字出現節奏參數：0.08s = 每個字母間的出場間隔，可調快/調慢 */
  animation-delay: calc(0.5s + var(--i) * 0.08s);
}
.brand-splash-name-space { width: 0.32em; }

/* Slogan：「你拍，我在！」— 字級遠小於 Snap Pacer，與品牌名保留舒服間距。
   刻意「不」設定 width / justify-content，讓這個元素跟 Logo、.brand-splash-name
   用同一套機制置中：自身 auto 寬度（shrink-to-fit，寬度＝兩個 span 的實際內容
   寬度），再交給父層 .brand-splash-content 的 align-items:center 置中。
   （先前版本用 width:100% + justify-content:center 自己置中，這是另一套
   機制，在 .brand-splash-content 這種 auto 寬度的 flex column 底下，
   100% 會相對「不確定的容納區塊」解析，不同瀏覽器/webview 算出來的
   基準寬度可能跟 Logo/品牌名的置中基準不一致，導致三者看起來沒有共軸。
   拿掉 width:100%/justify-content 之後，三者的置中基準完全相同。）
   兩個 span 即使還沒淡入也佔位（opacity 過渡，不是 display:none），
   避免「我在！」出現時整行重新置中造成的左右跳動。 */
.brand-splash-slogan {
  /* 跟著 Logo→主標的收緊比例一起縮短，讓 Logo/主標/slogan 三者看起來是
     同一組緊湊的品牌鎖定，而不是鬆散排列（原本 26px）。 */
  margin: 22px 0 0;
  display: flex;
  align-items: baseline;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: #625b56;
}
.brand-splash-slogan-line {
  display: inline-block;
  opacity: 0;
  transform: translateY(8px);
  animation: brand-splash-slogan-in 0.3s ease-out forwards;
}
/* Slogan 兩行出現時間點：「你拍，」先出現，「我在！」接在其後 0.5s 出現。 */
.brand-splash-slogan-line1 { animation-delay: 2.6s; }
.brand-splash-slogan-line2 { animation-delay: 3.1s; }

@keyframes brand-splash-logo-in {
  0% { opacity: 0; transform: translateY(8px) scale(0.94); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes brand-splash-letter-in {
  0% { opacity: 0; transform: translateY(6px) scale(0.9); }
  60% { opacity: 1; transform: translateY(0) scale(1.03); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes brand-splash-slogan-in {
  0% { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}
@keyframes brand-splash-final-glow {
  0% { filter: brightness(1); }
  50% { filter: brightness(1.04); }
  100% { filter: brightness(1); }
}

/* LINE / 微信 / FB 內建瀏覽器提示條 */
.inapp-browser-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.95), rgba(180, 83, 9, 0.92));
  border-bottom: 1px solid rgba(254, 240, 138, 0.45);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.inapp-browser-banner-text { flex: 1; font-size: 14.5px; line-height: 1.55; font-weight: 700; color: #fff7ed; }
.inapp-browser-banner-close {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(15, 23, 42, 0.25);
  color: #fff;
  font-size: 15.5px;
  cursor: pointer;
}
body.has-inapp-banner .phone-container { margin-top: 72px; }

/* Build provenance badge: shown only when the explicit development/test contract is active. */
.test-build-indicator {
  position: fixed;
  top: max(8px, env(safe-area-inset-top));
  right: 8px;
  z-index: 190;
  padding: 5px 9px;
  border: 1px solid rgba(255, 247, 237, 0.72);
  border-radius: 999px;
  background: rgba(68, 55, 44, 0.94);
  color: #fff7ed;
  box-shadow: 0 4px 12px rgba(68, 55, 44, 0.22);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  pointer-events: none;
}

/* 加入主畫面導引 Modal */
.a2hs-modal-overlay { z-index: 130; padding: 16px; }
.a2hs-modal-content {
  max-width: 340px;
  width: 100%;
  padding: 22px 18px 18px;
  text-align: center;
  border: 1px solid rgba(52, 211, 153, 0.35);
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.98), rgba(15, 23, 42, 0.98));
}
.a2hs-modal-icon { font-size: 54.5px; margin-bottom: 8px; }
.a2hs-modal-title { font-size: 22px; font-weight: 900; color: #f8fafc; margin-bottom: 6px; }
.a2hs-modal-subtitle { font-size: 14.5px; color: #94a3b8; line-height: 1.5; margin-bottom: 12px; }
.a2hs-modal-steps {
  text-align: left;
  margin-bottom: 14px;
}
.a2hs-step-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
}
.a2hs-step-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 11px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid #475569;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.08);
}
.a2hs-step-badge {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: linear-gradient(135deg, #fde68a, #fbbf24);
  color: #422006;
  font-size: 17px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.a2hs-step-text {
  flex: 1;
  min-width: 0;
  font-size: 15.5px;
  line-height: 1.65;
  color: #e2e8f0;
}
.a2hs-step-text strong { color: #34d399; font-weight: 800; }
.a2hs-modal-steps strong { color: #34d399; }
.a2hs-share-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: rgba(59, 130, 246, 0.25);
  color: #93c5fd;
  font-size: 18px;
  font-weight: 800;
  vertical-align: middle;
}
.a2hs-android-actions { margin-bottom: 12px; }
.a2hs-android-ready {
  font-size: 15.5px;
  line-height: 1.65;
  color: #bbf7d0;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.35);
  border-radius: 12px;
  padding: 12px;
}
.a2hs-install-btn {
  width: 100%;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff;
  font-weight: 900;
  font-size: 18px;
  padding: 14px 12px;
  box-shadow: 0 8px 22px rgba(34, 197, 94, 0.35);
}
.a2hs-install-btn:disabled { opacity: 0.55; box-shadow: none; }
.a2hs-modal-actions { display: flex; gap: 8px; }
.a2hs-modal-actions .btn-secondary { flex: 1; font-size: 14.5px; padding: 10px 8px; }

@media (display-mode: standalone) {
  body { padding: 0; }
  .phone-container {
    max-width: none;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
    border: none;
    box-shadow: none;
  }
}

/* 手機外框 */
.phone-container { width: 100%; max-width: 390px; height: 780px; background-color: #1e293b; border-radius: 36px; border: 2px solid #334155; display: flex; flex-direction: column; overflow: hidden; position: relative; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5); }

/* 頂部狀態列 */
header { background: rgba(15, 23, 42, 0.95); padding: 14px 16px; border-bottom: 1px solid #334155; display: flex; justify-content: space-between; align-items: center; z-index: 20; }
.badge-health { font-size: 14.5px; background: rgba(52, 211, 153, 0.15); color: #34d399; border: 1px solid rgba(52, 211, 153, 0.3); padding: 4px 10px; border-radius: 20px; font-weight: bold; }

/* 首頁左上角健康連線 Badge */
.home-health-sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 62%;
  min-width: 0;
  font-size: 13px;
  font-weight: bold;
  padding: 5px 10px 5px 8px;
  border-radius: 999px;
  line-height: 1.2;
  transition: background 0.25s, border-color 0.25s, color 0.25s, box-shadow 0.25s;
}
.home-health-sync-badge--multi {
  padding: 4px 8px 4px 6px;
  gap: 4px;
  max-width: 68%;
}
.home-health-sync-badge--online {
  background: rgba(52, 211, 153, 0.12);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.35);
  box-shadow: 0 0 14px rgba(52, 211, 153, 0.18);
}
.home-health-sync-badge--offline {
  background: rgba(100, 116, 139, 0.12);
  color: #94a3b8;
  border: 1px solid rgba(100, 116, 139, 0.3);
}
.home-health-sync-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.home-health-sync-badge--online .home-health-sync-dot {
  background: #34d399;
  box-shadow: 0 0 6px rgba(52, 211, 153, 0.9);
  animation: health-sync-pulse 2s ease-in-out infinite;
}
.home-health-sync-badge--offline .home-health-sync-dot {
  background: #64748b;
  box-shadow: none;
}
.home-health-sync-items {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-width: 0;
  flex: 1;
  overflow: hidden;
}
.home-health-sync-item {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  white-space: nowrap;
}
.home-health-sync-item-icon { font-size: 13px; line-height: 1; }
.home-health-sync-item-label { font-size: 13px; line-height: 1; }
.home-health-sync-badge--multi .home-health-sync-item-icon { font-size: 11.5px; }
.home-health-sync-badge--multi .home-health-sync-item-label { font-size: 11.5px; letter-spacing: -0.2px; }
.home-health-sync-divider {
  color: rgba(52, 211, 153, 0.4);
  font-size: 10.5px;
  line-height: 1;
  padding: 0 1px;
  flex-shrink: 0;
  user-select: none;
}
.home-health-sync-badge--offline .home-health-sync-divider { color: rgba(148, 163, 184, 0.5); }
.home-health-sync-offline-label { font-size: 13px; white-space: nowrap; }
@keyframes health-sync-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(0.92); }
}
.badge-token { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); padding: 4px 10px; border-radius: 20px; font-size: 15.5px; font-weight: bold; cursor: pointer; }

/* 頂部 Header 會員登入 / 帳號徽章 */
.header-right-group { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
header > .header-right-group { margin-left: auto; }
.header-account-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: #cbd5e1;
  border-radius: 999px;
  padding: 4px 8px;
  cursor: pointer;
  max-width: 92px;
  min-width: 0;
  flex-shrink: 0;
}
.header-account-badge-icon {
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(148, 163, 184, 0.18);
  overflow: hidden;
}
.header-account-badge-label {
  font-size: 12px;
  font-weight: bold;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.header-account-badge.is-logged-in {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.4);
  color: #c7d2fe;
}
.header-account-badge.is-logged-in .header-account-badge-icon { background: rgba(99, 102, 241, 0.28); }
.header-pro-upgrade-btn {
  min-width: 38px;
  height: 26px;
  padding: 0 9px;
  border: 1px solid #b58c37;
  border-radius: 999px;
  background: linear-gradient(135deg, #f6d377, #d7a83e);
  color: #3d2d10;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .4px;
  cursor: pointer;
  flex-shrink: 0;
}
.header-pro-upgrade-btn:active { transform: translateY(1px); }
.header-account-logout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.3);
  color: #f87171;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
}

/* 返回按鈕 */
.btn-back { background: none; border: none; color: #94a3b8; cursor: pointer; font-size: 17px; font-weight: bold; display: flex; align-items: center; gap: 4px; padding: 4px 0; }
.btn-back:hover { color: #f8fafc; }

/* 主內容區 */
main { flex: 1; padding: 16px; overflow-y: auto; position: relative; padding-bottom: 70px; }
.screen { display: flex; flex-direction: column; gap: 12px; }
#screen-home { gap: 8px; padding-bottom: 0; height: 100%; min-height: 0; overflow: hidden; }
#screen-home > .home-diet-entry {
  width: 100%;
  box-sizing: border-box;
}
.hidden { display: none !important; }

/* 底部導覽列 */
nav { position: absolute; bottom: 0; left: 0; right: 0; height: 64px; background: #0f172a; border-top: 1px solid #334155; display: flex; justify-content: space-around; align-items: flex-end; z-index: 30; overflow: visible; padding-bottom: 6px; }
.nav-item { background: none; border: none; color: #64748b; font-size: 13px; display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; flex: 1; width: auto; font-weight: bold; }
.nav-item.active { color: #34d399; }
.nav-icon { font-size: 23.5px; }

.root-tab-enter-from-right { animation: root-tab-enter-from-right 180ms cubic-bezier(0.22, 1, 0.36, 1); }
.root-tab-enter-from-left { animation: root-tab-enter-from-left 180ms cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes root-tab-enter-from-right {
  from { transform: translate3d(16px, 0, 0); }
  to { transform: translate3d(0, 0, 0); }
}
@keyframes root-tab-enter-from-left {
  from { transform: translate3d(-16px, 0, 0); }
  to { transform: translate3d(0, 0, 0); }
}

.phone-container > main.root-tab-gesture-active {
  overflow-x: hidden;
  overscroll-behavior-x: none;
}

.phone-container > main.root-tab-gesture-active > .root-tab-gesture-current,
.phone-container > main.root-tab-gesture-active > .root-tab-gesture-target {
  transform: translate3d(var(--root-tab-translate-x, 0px), 0, 0);
  transition: none;
  backface-visibility: hidden;
  will-change: transform;
  pointer-events: none;
}

.phone-container > main.root-tab-gesture-active > .root-tab-gesture-current {
  position: relative;
  z-index: 2;
}

.phone-container > main.root-tab-gesture-active > .root-tab-gesture-target {
  position: absolute;
  top: var(--root-tab-target-top, 0px);
  left: 16px;
  right: 16px;
  z-index: 3;
  min-height: calc(100% - 32px);
  background: var(--app-page-background) !important;
}

.phone-container > main.root-tab-gesture-settling > .root-tab-gesture-current,
.phone-container > main.root-tab-gesture-settling > .root-tab-gesture-target {
  transition: transform var(--root-tab-settle-ms, 220ms) cubic-bezier(0.22, 1, 0.36, 1);
}

/* Showing Home as the adjacent drag target must not activate Home chrome before commit. */
.phone-container.root-tab-gesture-origin-standard:has(#screen-home:not(.hidden)) > header {
  display: flex;
}

.phone-container.root-tab-gesture-origin-standard:has(#screen-home:not(.hidden)) > main.root-tab-gesture-active {
  padding: 16px 16px 70px;
  overflow-y: auto;
}

@media (prefers-reduced-motion: reduce) {
  .phone-container > main.root-tab-gesture-settling > .root-tab-gesture-current,
  .phone-container > main.root-tab-gesture-settling > .root-tab-gesture-target {
    transition-duration: 1ms;
  }
}

/* 卡片與元件樣式 */
.card { background: #0f172a; border: 1px solid #334155; border-radius: 18px; padding: 14px; }
.card-title { font-size: 14.5px; color: #94a3b8; font-weight: bold; margin-bottom: 4px; }
.cal-highlight { font-size: 31px; font-weight: 900; color: #34d399; display: flex; align-items: center; gap: 8px; }
.tag-green { font-size: 14.5px; background: rgba(52, 211, 153, 0.2); color: #6ee7b7; padding: 2px 8px; border-radius: 6px; }

/* 進度條 */
.progress-bg { width: 100%; height: 8px; background: #334155; border-radius: 10px; overflow: hidden; margin-top: 8px; }
.progress-fill { height: 100%; background: #34d399; width: 54.5%; transition: width 0.3s; }

.home-progress-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  margin-bottom: 0;
}
.home-progress-card {
  width: 100%;
  box-sizing: border-box;
  min-width: 0;
  background: #1e293b;
  border: 1px solid #334155;
  display: flex;
  flex-direction: column;
}
.home-calorie-card {
  padding: 20px;
  gap: 10px;
  border-color: rgba(52, 211, 153, 0.25);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}
.home-progress-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.home-progress-meta {
  font-size: 14.5px;
  color: #64748b;
  line-height: 1.4;
  text-align: right;
  flex-shrink: 0;
}
.home-calorie-highlight {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
  margin-top: 8px;
  line-height: 1.1;
}
#cal-deficit-display {
  font-size: 41.5px;
  font-weight: 800;
  color: #34d399;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.home-calorie-highlight .tag-green {
  display: inline-block;
  font-size: 13px;
  padding: 3px 8px;
}
.home-progress-stats {
  margin-top: 6px;
  font-size: 15.5px;
  color: #cbd5e1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  line-height: 1.4;
  flex-wrap: wrap;
}
.home-exercise-stat { color: #38bdf8; }
.home-calorie-progress-bg {
  margin-top: 10px;
  height: 10px;
}
.home-calorie-progress-fill { background: linear-gradient(90deg, #34d399, #10b981); }
.home-protein-card {
  padding: 12px 16px;
  gap: 6px;
  border-color: rgba(249, 115, 22, 0.22);
}
.home-protein-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.home-protein-title {
  font-size: 14.5px;
  font-weight: bold;
  color: #94a3b8;
  line-height: 1.3;
  min-width: 0;
}
.home-protein-value {
  font-size: 23.5px;
  font-weight: 800;
  color: #fdba74;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  white-space: nowrap;
}
.home-protein-progress-bg {
  margin-top: 2px;
  height: 6px;
}
.home-protein-progress-fill {
  background: linear-gradient(90deg, #f97316, #ef4444);
  width: 0%;
  transition: width 0.35s ease;
}
.home-protein-hint {
  font-size: 13px;
  color: #94a3b8;
  line-height: 1.35;
  margin-top: 0;
  word-break: break-word;
}

/* 按鈕 */
.btn-main { background: linear-gradient(135deg, #10b981, #0d9488); color: #ffffff; padding: 18px; border-radius: 20px; border: none; cursor: pointer; font-size: 22px; font-weight: bold; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; box-shadow: 0 10px 20px rgba(16, 185, 129, 0.2); }
.btn-secondary { background: #0f172a; border: 1px solid #334155; color: #e2e8f0; padding: 14px; border-radius: 20px; cursor: pointer; text-align: left; font-size: 17px; font-weight: bold; display: flex; justify-content: space-between; align-items: center; }
/* 全站統一的主要行動按鈕樣式：呼應首頁「拍照算熱量 / 指定店家 / AI 陪跑員」卡片的
   實色漸層 + 白色粗體字 + 圓角風格，讓所有內部頁面（設定、健檢報告、登入、斷食、
   陪跑員對話等）的主要按鈕視覺一致，不再各頁各自為政。 */
.btn-submit { background: linear-gradient(135deg, #6366f1, #4338ca); color: #ffffff; font-size: 17px; font-weight: bold; padding: 14px; border-radius: 20px; border: none; cursor: pointer; width: 100%; text-align: center; box-shadow: 0 8px 18px rgba(99, 102, 241, 0.28); }
.btn-submit:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }
.btn-cancel {
  background-color: #334155;
  color: #ffffff;
  padding: 12px 20px;
  border-radius: 8px;
  border: none;
  font-weight: bold;
  cursor: pointer;
  font-size: 17px;
  -webkit-appearance: none;
  appearance: none;
}

/* 輸入與選擇框 */
input[type="text"], input[type="number"], input[type="datetime-local"], input[type="date"], textarea, select, input[type="password"] { width: 100%; background: #0f172a; border: 1px solid #334155; color: #fff; padding: 10px 14px; border-radius: 10px; font-size: 17px; outline: none; margin-top: 4px; }
input[type="date"], input[type="datetime-local"] { color-scheme: dark; font-variant-numeric: tabular-nums; }
.setting-date-input { display: block; width: 100%; }

/* 圖表與列表項 */
.line-chart-container { height: 155px; width: 100%; background: #172133; border-radius: 12px; padding: 8px 4px 4px 4px; position: relative; }
.item-row { background: rgba(15, 23, 42, 0.6); padding: 10px; border-radius: 10px; display: flex; justify-content: space-between; font-size: 15.5px; margin-bottom: 6px; }

/* AI 分析結果頁 — 拍攝照片預覽 */
.result-photo-container {
  width: 100%;
  border-radius: 16px;
  overflow: hidden;
  border: 2px solid #334155;
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.38),
    inset 0 0 0 1px rgba(148, 163, 184, 0.1);
}
.result-photo-sections { display: grid; gap: 10px; padding: 10px; }
.result-photo-section {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 9px;
  border-radius: 13px;
  background: rgba(255, 250, 243, .08);
}
.result-photo-section img {
  display: block;
  width: 100%;
  height: 82px;
  object-fit: cover;
  object-position: center;
  border-radius: 10px;
}
.result-photo-section-copy { min-width: 0; display: grid; gap: 4px; }
.result-photo-section-title { color: #FFF7ED; font-size: 14px; font-weight: 800; }
.result-photo-section-items { color: #FFF7ED; font-size: 13px; line-height: 1.45; }
.result-photo-section-note { color: #E6D4C5; font-size: 12px; line-height: 1.4; }
.result-photo-sections.single { display: block; padding: 0; }
.result-photo-sections.single .result-photo-section { display: block; padding: 0; background: transparent; }
.result-photo-sections.single .result-photo-section img { height: 200px; border-radius: 0; }
.result-photo-sections.single .result-photo-section-copy { display: none; }
.save-meal-image-btn-wrap {
  padding: 0 10px 10px;
  background: linear-gradient(180deg, transparent, rgba(15, 23, 42, 0.88));
}
.save-img-btn {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.42);
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(6px);
  color: #e2e8f0;
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  text-shadow: 0 0 8px rgba(148, 163, 184, 0.55);
  box-shadow:
    0 4px 14px rgba(0, 0, 0, 0.35),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}
.save-img-btn:hover,
.save-img-btn:focus-visible {
  border-color: rgba(56, 189, 248, 0.65);
  color: #f0f9ff;
  text-shadow: 0 0 10px rgba(56, 189, 248, 0.75);
  box-shadow:
    0 6px 18px rgba(14, 165, 233, 0.22),
    inset 0 0 0 1px rgba(56, 189, 248, 0.2);
}
.save-img-btn.hidden { display: none !important; }
.result-photo-container .save-meal-image-btn-wrap { margin-top: 0; padding-top: 8px; }
.meal-detail-photo-wrap .save-meal-image-btn-wrap {
  padding: 8px 10px 10px;
  background: rgba(15, 23, 42, 0.72);
}

/* 陪跑員類別頁籤 */
.coach-tab-bar { display: flex; background: #0f172a; border: 1px solid #334155; border-radius: 12px; padding: 3px; gap: 4px; }
.coach-tab { flex: 1; text-align: center; padding: 8px 0; font-size: 14.5px; font-weight: bold; color: #94a3b8; border-radius: 8px; cursor: pointer; }
.coach-tab.active { background: #1e293b; color: #c084fc; border: 1px solid rgba(192, 132, 252, 0.3); }

/* 浮動視窗 (月份分析 Modal) 樣式 */
.modal-overlay { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.85); backdrop-filter: blur(4px); z-index: 50; display: flex; justify-content: center; align-items: center; padding: 20px; opacity: 0; pointer-events: none; transition: opacity 0.3s ease; }
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal-content { background: #1e293b; border: 1px solid #334155; border-radius: 24px; width: 100%; max-width: 350px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5); transform: translateY(20px); transition: transform 0.3s ease; max-height: 85%; }
.modal-overlay.active .modal-content { transform: translateY(0); }
.modal-header { padding: 16px; border-bottom: 1px solid #334155; display: flex; justify-content: space-between; align-items: center; background: rgba(30, 41, 59, 0.95); }
.modal-body { padding: 16px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 12px; }
.modal-footer { padding: 12px 16px; border-top: 1px solid #334155; background: rgba(30, 41, 59, 0.95); display: flex; gap: 8px; align-items: center; }
.chat-msg { font-size: 15.5px; padding: 10px 14px; border-radius: 16px; line-height: 1.5; width: fit-content; max-width: 85%; }
.chat-ai { background: #0f172a; border: 1px solid #c084fc; color: #e2e8f0; border-top-left-radius: 4px; align-self: flex-start; }
.chat-user { background: #34d399; color: #022c22; border-top-right-radius: 4px; align-self: flex-end; font-weight: bold; }
.coach-followup-chat-history {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  margin-bottom: 10px;
}
.coach-followup-chat-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.coach-followup-chat-remaining {
  font-size: 12px;
  color: #94a3b8;
  font-weight: normal;
}
.coach-followup-chat-limit-hint {
  font-size: 12.5px;
  color: #94a3b8;
  text-align: center;
  line-height: 1.5;
  padding: 8px 0 2px;
}
.coach-chat-error {
  border-color: rgba(248, 113, 113, 0.55) !important;
  color: #fecaca !important;
  background: rgba(127, 29, 29, 0.35) !important;
  max-width: 100%;
  word-break: break-word;
}
.stat-badge { background: #0f172a; border: 1px solid #334155; padding: 8px; border-radius: 12px; text-align: center; }

/* 登入 Modal */
.login-modal-overlay { z-index: 60; padding: 16px; }
.login-modal-content { max-width: 360px; max-height: 92%; position: relative; background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%); }
.login-modal-close { position: absolute; top: 12px; right: 14px; background: none; border: none; color: #64748b; font-size: 23.5px; cursor: pointer; z-index: 2; line-height: 1; padding: 4px; }
.login-modal-close:hover { color: #f1f5f9; }
.login-modal-header { padding: 28px 20px 12px; text-align: center; }
.login-logo { font-size: 17px; font-weight: bold; color: #34d399; margin-bottom: 8px; }
.login-title { font-size: 28.5px; font-weight: 900; color: #f8fafc; margin-bottom: 6px; }
.login-slogan { font-size: 14.5px; color: #94a3b8; line-height: 1.5; }
.login-modal-body { padding: 8px 20px 12px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; min-height: 0; }
.login-prelaunch-hint { margin: 0; padding: 9px 12px; border: 1px solid rgba(52, 211, 153, 0.35); border-radius: 10px; background: rgba(52, 211, 153, 0.08); color: #a7f3d0; font-size: 14px; font-weight: 700; text-align: center; }
.auth-btn-group { display: flex; flex-direction: column; gap: 10px; }
.auth-btn { width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 13px 16px; border-radius: 14px; font-size: 17px; font-weight: bold; cursor: pointer; border: none; transition: opacity 0.2s; }
.auth-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.auth-btn:active:not(:disabled) { opacity: 0.85; }
.auth-btn-apple { background: #000; color: #fff; border: 1px solid #333; }
.auth-btn-google { background: #fff; color: #1f2937; border: 1px solid #e2e8f0; }
.auth-btn-facebook, #fb-login-btn { background: #1877F2; color: #fff; border: 1px solid #166fe0; }
.auth-btn-facebook:hover:not(:disabled), #fb-login-btn:hover:not(:disabled) { background: #166fe0; }
.auth-btn-icon { font-size: 21px; line-height: 1; flex-shrink: 0; }
.auth-btn-icon-fb { width: 18px; height: 18px; display: block; }
.login-divider { display: flex; align-items: center; gap: 10px; margin: 4px 0; }
.login-divider::before, .login-divider::after { content: ''; flex: 1; height: 1px; background: #334155; }
.login-divider span { font-size: 13px; color: #64748b; white-space: nowrap; }
.login-tab-bar { display: flex; background: #0f172a; border: 1px solid #334155; border-radius: 10px; padding: 3px; gap: 4px; }
.login-tab { flex: 1; text-align: center; padding: 8px 0; font-size: 15.5px; font-weight: bold; color: #64748b; background: none; border: none; border-radius: 8px; cursor: pointer; }
.login-tab.active { background: #1e293b; color: #34d399; border: 1px solid rgba(52, 211, 153, 0.3); }
.login-register-back { align-self: flex-start; background: none; border: none; color: #94a3b8; padding: 4px 0; font-size: 15.5px; font-weight: bold; cursor: pointer; }
.login-register-back:hover { color: #f8fafc; }
.login-form { display: flex; flex-direction: column; gap: 8px; }
.login-form input { margin-top: 0; }
.login-auth-input { width: 100%; min-height: 44px; padding: 10px 14px; background: #0f172a; border: 1px solid #334155; border-radius: 10px; color: #fff; font-size: 17px; outline: none; }
.password-field { position: relative; width: 100%; }
.password-field .login-auth-input,
.password-field .delete-account-confirm-input { padding-right: 48px; }
.password-toggle { position: absolute; top: 50%; right: 8px; transform: translateY(-50%); width: 36px; height: 36px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 8px; background: transparent; color: #94a3b8; font-size: 18px; cursor: pointer; }
.password-toggle:hover { color: #f8fafc; background: rgba(148, 163, 184, 0.12); }
.password-toggle:focus-visible { outline: 2px solid #34d399; outline-offset: 1px; }
.login-forgot-password { align-self: flex-end; margin: -2px 0 2px; padding: 4px 0; border: 0; background: transparent; color: #94a3b8; font-size: 14px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.login-forgot-password:hover { color: #f8fafc; }
.login-forgot-password:disabled { opacity: 0.55; cursor: wait; }
.login-submit-btn { margin-top: 4px; font-size: 17px; }
.login-modal-footer { padding: 12px 20px 20px; border-top: 1px solid #334155; background: transparent; }
.login-guest-btn { width: 100%; background: none; border: none; color: #94a3b8; font-size: 15.5px; cursor: pointer; padding: 10px; text-decoration: underline; text-underline-offset: 3px; }
.login-guest-btn:hover { color: #cbd5e1; }

/* 設定頁帳號卡片 */
.account-card { border-color: rgba(52, 211, 153, 0.35); background: linear-gradient(135deg, rgba(52, 211, 153, 0.08), #0f172a); }
.account-card-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.account-avatar { width: 48px; height: 48px; border-radius: 50%; background: #1e293b; border: 2px solid #334155; display: flex; align-items: center; justify-content: center; font-size: 28.5px; flex-shrink: 0; overflow: hidden; }
.account-avatar-guest { background: #334155; font-size: 26px; }
.account-info { flex: 1; min-width: 0; }
.account-label { font-size: 17px; font-weight: bold; color: #f1f5f9; }
.account-status { font-size: 15.5px; color: #cbd5e1; margin-top: 2px; }
.account-guest-tag { color: #fbbf24; font-weight: bold; }
.account-hint { font-size: 13px; color: #64748b; margin-top: 4px; }
.account-email { font-size: 14.5px; color: #94a3b8; margin-top: 2px; word-break: break-all; }
.account-sync-badge { font-size: 13px; color: #34d399; margin-top: 6px; font-weight: bold; }
.account-login-btn { font-size: 17px; padding: 12px; }
.account-actions { display: flex; flex-direction: column; gap: 8px; }
.account-logout-btn { width: 100%; justify-content: center; font-size: 15.5px; padding: 10px; color: #f87171; border-color: rgba(248, 113, 113, 0.35); background: rgba(248, 113, 113, 0.08); }
.account-delete-btn { width: 100%; padding: 8px; border: 0; background: transparent; color: #f87171; font-size: 14.5px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.account-delete-btn:hover { color: #fca5a5; }

/* 外部健康平台串聯 */
.health-sync-card { border-color: rgba(56, 189, 248, 0.35); background: linear-gradient(135deg, rgba(56, 189, 248, 0.06), #0f172a); }
.health-sync-intro { font-size: 13px; color: #64748b; line-height: 1.5; margin: -4px 0 10px; }
.health-sync-list { display: flex; flex-direction: column; gap: 10px; }
.health-sync-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px; background: rgba(15, 23, 42, 0.65); border: 1px solid #334155; border-radius: 14px; }
.health-sync-item-main { display: flex; align-items: flex-start; gap: 10px; flex: 1; min-width: 0; }
.health-sync-icon { width: 36px; height: 36px; border-radius: 10px; background: #1e293b; border: 1px solid #334155; display: flex; align-items: center; justify-content: center; font-size: 23.5px; flex-shrink: 0; }
.health-sync-info { flex: 1; min-width: 0; }
.health-sync-name-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.health-sync-name { font-size: 15.5px; font-weight: bold; color: #f1f5f9; }
.health-sync-subtitle { font-size: 13px; color: #64748b; margin-top: 2px; }
.health-sync-desc { font-size: 13px; color: #94a3b8; margin-top: 4px; line-height: 1.4; }
.health-sync-status { font-size: 11.5px; font-weight: bold; padding: 2px 7px; border-radius: 999px; white-space: nowrap; flex-shrink: 0; }
.health-sync-status-on { background: rgba(52, 211, 153, 0.15); color: #34d399; border: 1px solid rgba(52, 211, 153, 0.35); }
.health-sync-status-off { background: rgba(100, 116, 139, 0.15); color: #94a3b8; border: 1px solid rgba(100, 116, 139, 0.35); }
.health-sync-status-soon { background: rgba(251, 191, 36, 0.12); color: #fbbf24; border: 1px solid rgba(251, 191, 36, 0.35); }
.health-sync-item--coming-soon { opacity: 0.6; }
.health-sync-toggle { position: relative; display: inline-block; width: 44px; height: 26px; flex-shrink: 0; cursor: pointer; }
.health-sync-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.health-sync-toggle input:disabled { cursor: not-allowed; }
.health-sync-toggle:has(input:disabled) { cursor: not-allowed; }
.toggle-slider { position: absolute; inset: 0; background: #334155; border-radius: 999px; transition: background 0.2s; border: 1px solid #475569; }
.toggle-slider::before { content: ''; position: absolute; width: 20px; height: 20px; left: 2px; top: 2px; background: #f1f5f9; border-radius: 50%; transition: transform 0.2s; }
.health-sync-toggle input:checked + .toggle-slider { background: #34d399; border-color: #10b981; }
.health-sync-toggle input:checked + .toggle-slider::before { transform: translateX(18px); }
.health-sync-toggle input:focus-visible + .toggle-slider { outline: 2px solid rgba(52, 211, 153, 0.5); outline-offset: 2px; }

/* 日常活動程度設定 */
.activity-level-card { border-color: rgba(251, 191, 36, 0.35); background: linear-gradient(135deg, rgba(251, 191, 36, 0.06), #0f172a); }
.activity-level-hint { font-size: 13px; color: #94a3b8; line-height: 1.5; margin: -2px 0 8px; }
.activity-level-select { width: 100%; margin-top: 4px; font-size: 14.5px; }
.activity-level-preview { font-size: 14.5px; color: #e2e8f0; margin-top: 10px; padding: 8px 10px; background: rgba(15, 23, 42, 0.65); border: 1px solid #334155; border-radius: 10px; }
.protein-target-preview { font-size: 14.5px; color: #fdba74; margin-top: 10px; padding: 8px 10px; background: rgba(249, 115, 22, 0.08); border: 1px solid rgba(249, 115, 22, 0.25); border-radius: 10px; line-height: 1.45; }
.activity-level-preview strong { color: #fbbf24; font-size: 17px; }
.activity-level-disabled-notice { border-color: rgba(56, 189, 248, 0.35); background: linear-gradient(135deg, rgba(56, 189, 248, 0.06), #0f172a); }
.activity-level-disabled-text { font-size: 14.5px; color: #cbd5e1; line-height: 1.55; margin: 0; }

.api-key-hint { font-size: 13px; color: #64748b; margin-top: 6px; line-height: 1.4; }

/* Toast 通知 */
.toast-container {
  position: fixed;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: min(92%, 340px);
}
.toast {
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 15.5px;
  font-weight: bold;
  text-align: center;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { background: rgba(52, 211, 153, 0.95); color: #022c22; border: 1px solid rgba(52, 211, 153, 0.5); }
.toast-error { background: rgba(248, 113, 113, 0.95); color: #450a0a; border: 1px solid rgba(248, 113, 113, 0.5); }
.toast-info { background: rgba(56, 189, 248, 0.95); color: #082f49; border: 1px solid rgba(56, 189, 248, 0.5); }

/* 登出按鈕與確認 Modal */
.btn-logout {
  width: 100%;
  margin-top: 10px;
  padding: 13px;
  border-radius: 16px;
  border: 1px solid rgba(248, 113, 113, 0.45);
  background: rgba(248, 113, 113, 0.12);
  color: #f87171;
  font-size: 17px;
  font-weight: bold;
  cursor: pointer;
}
.btn-logout:active { opacity: 0.85; }
.confirm-modal-overlay { z-index: 70; }
.confirm-modal-content { max-width: 320px; padding: 20px; text-align: center; }
.confirm-modal-title { font-size: 21px; font-weight: bold; color: #f1f5f9; margin-bottom: 10px; }
.confirm-modal-text { font-size: 15.5px; color: #94a3b8; line-height: 1.5; margin-bottom: 16px; }
.confirm-modal-actions { display: flex; gap: 8px; }
.delete-account-modal-content { max-width: 360px; }
.delete-account-icon { font-size: 34px; line-height: 1; margin-bottom: 10px; }
.delete-account-warning { color: #cbd5e1; margin-bottom: 10px; }
.delete-account-subscription-note { margin: 0 0 16px; padding: 9px 10px; border: 1px solid rgba(251, 191, 36, 0.32); border-radius: 10px; background: rgba(251, 191, 36, 0.08); color: #fbbf24; font-size: 13px; line-height: 1.45; text-align: left; }
.delete-account-modal-content #delete-account-manage-subscription { display: inline-block; margin: -6px 0 14px; color: #93c5fd; font-size: 14px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.delete-account-label { display: block; margin-bottom: 7px; color: #e2e8f0; font-size: 14px; font-weight: bold; text-align: left; }
.delete-account-confirm-input { width: 100%; box-sizing: border-box; margin: 0 0 10px; text-align: center; }
.delete-account-password-field { margin-bottom: 10px; }
.delete-account-password-field .delete-account-confirm-input { margin-bottom: 0; }
.delete-account-error { margin-bottom: 10px; color: #fca5a5; font-size: 13px; line-height: 1.4; text-align: left; }
.delete-account-actions { margin-top: 4px; }
.btn-confirm-danger:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-confirm-cancel, .btn-confirm-danger {
  flex: 1;
  padding: 11px;
  border-radius: 12px;
  font-size: 15.5px;
  font-weight: bold;
  cursor: pointer;
  border: 1px solid #334155;
}
.btn-confirm-cancel { background: #1e293b; color: #cbd5e1; }
.btn-confirm-danger { background: rgba(248, 113, 113, 0.15); color: #f87171; border-color: rgba(248, 113, 113, 0.45); }

/* 封測問題回報 */
.feedback-card {
  border-color: rgba(129, 140, 248, 0.35);
  background: linear-gradient(135deg, rgba(129, 140, 248, 0.08), #0f172a);
  padding: 0;
  overflow: hidden;
}
.feedback-card-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  color: inherit;
}
.feedback-card-btn:active { opacity: 0.88; }
.feedback-card-icon { font-size: 28.5px; line-height: 1; flex-shrink: 0; }
.feedback-card-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.feedback-card-title { font-size: 17px; font-weight: bold; color: #e2e8f0; }
.feedback-card-desc { font-size: 13px; color: #94a3b8; line-height: 1.4; }
.feedback-card-arrow { font-size: 26px; color: #818cf8; line-height: 1; flex-shrink: 0; }

.feedback-modal-overlay { z-index: 75; padding: 16px; }
.feedback-modal-content {
  max-width: 360px;
  width: 100%;
  max-height: 90%;
  display: flex;
  flex-direction: column;
  padding: 0;
}
.feedback-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 10px;
  border-bottom: 1px solid #334155;
  flex-shrink: 0;
}
.feedback-modal-title { font-size: 19.5px; font-weight: bold; color: #f1f5f9; }
.feedback-modal-close {
  background: none;
  border: none;
  color: #64748b;
  font-size: 23.5px;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}
.feedback-modal-close:hover { color: #f1f5f9; }
.feedback-modal-body {
  padding: 14px 18px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  overscroll-behavior: contain;
}
.feedback-label {
  font-size: 14.5px;
  font-weight: bold;
  color: #94a3b8;
  margin-top: 4px;
}
.feedback-required { color: #f87171; }
.feedback-modal-body textarea { min-height: 96px; resize: vertical; }
.feedback-recovery {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid #c48350;
  border-radius: 12px;
  background: #fff2df;
  color: #4a2d20;
  overflow-wrap: anywhere;
}
.feedback-recovery.hidden { display: none; }
.feedback-recovery p { margin: 0; line-height: 1.5; }
.phone-container .modal-content .feedback-recovery p { color: #4a2d20; }
.feedback-recovery button { min-height: 44px; margin: 0; }
.feedback-storage-note { color: #6d5b50; font-size: 0.86rem; line-height: 1.5; }
.feedback-receipt { display: grid; gap: 8px; padding: 14px; border: 1px solid #b8d8c8; border-radius: 12px; background: #f3faf5; color: #234631; }
.feedback-receipt.hidden { display: none; }
.feedback-receipt p { margin: 0; line-height: 1.5; }
.feedback-receipt strong { font-size: 1.05rem; overflow-wrap: anywhere; user-select: all; -webkit-user-select: all; }
.feedback-receipt button { min-height: 44px; justify-self: start; }
#feedback-email-address { -webkit-user-select: text; user-select: text; }
.feedback-modal-actions {
  display: flex;
  gap: 8px;
  padding: 12px 18px 18px;
  border-top: 1px solid #334155;
  flex-shrink: 0;
}
.feedback-modal-actions .btn-confirm-cancel,
.feedback-submit-btn { flex: 1; margin: 0; }
.feedback-submit-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

/* 個人健康檔案與健檢報告 */
.health-profile-card {
  border-color: rgba(244, 114, 182, 0.35);
  background: linear-gradient(135deg, rgba(244, 114, 182, 0.08), #0f172a);
}
.health-profile-intro {
  font-size: 13px;
  color: #94a3b8;
  line-height: 1.5;
  margin: -2px 0 10px;
}
.health-metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}
.health-metrics-empty {
  grid-column: span 2;
  font-size: 14.5px;
  color: #64748b;
  text-align: center;
  padding: 14px 10px;
  border: 1px dashed #334155;
  border-radius: 12px;
  line-height: 1.5;
}
.health-metric-card {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 10px;
}
.health-metric-card--alert {
  border-color: rgba(248, 113, 113, 0.45);
  background: rgba(248, 113, 113, 0.08);
}
.health-metric-label {
  font-size: 13px;
  color: #94a3b8;
  margin-bottom: 4px;
}
.health-metric-value {
  font-size: 21px;
  font-weight: 900;
  color: #f1f5f9;
}
.health-metric-value--unset {
  color: #64748b;
  font-weight: 700;
}
.health-metric-card--alert .health-metric-value { color: #fca5a5; }
.health-metric-card--clickable {
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}
.health-metric-card--clickable:hover {
  border-color: rgba(56, 189, 248, 0.45);
  background: rgba(56, 189, 248, 0.06);
}
.health-metric-card--clickable:focus-visible {
  outline: 2px solid rgba(56, 189, 248, 0.55);
  outline-offset: 2px;
}
.health-metric-edit-hint {
  font-size: 11.5px;
  color: #64748b;
  margin-top: 4px;
}
.health-bp-value {
  font-variant-numeric: tabular-nums;
}
.blood-pressure-modal-content {
  max-width: 420px;
}
.blood-pressure-modal-intro {
  font-size: 14.5px;
  color: #94a3b8;
  line-height: 1.5;
  margin: 0 0 12px;
}
.health-confirm-modal-content {
  max-width: 460px;
}
.health-confirm-intro {
  font-size: 14.5px;
  color: #cbd5e1;
  line-height: 1.55;
  margin: 0 0 12px;
  padding: 10px 12px;
  background: rgba(52, 211, 153, 0.08);
  border: 1px solid rgba(52, 211, 153, 0.25);
  border-radius: 10px;
}
.health-confirm-intro strong {
  color: #6ee7b7;
}
.health-confirm-summary {
  font-size: 13px;
  color: #94a3b8;
  line-height: 1.45;
  margin: -4px 0 10px;
  padding: 0 2px;
}
.health-confirm-sanity-warn {
  font-size: 13px;
  color: #fbbf24;
  line-height: 1.4;
  margin-top: 4px;
}
.health-confirm-input--warn {
  border-color: rgba(251, 191, 36, 0.65) !important;
  box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.2);
}
.health-confirm-modal-body input,
.health-confirm-modal-body textarea {
  width: 100%;
  box-sizing: border-box;
}
.health-metric-unit {
  font-size: 13px;
  font-weight: normal;
  color: #64748b;
  margin-left: 3px;
}
.health-abnormal-tags-wrap { margin-bottom: 10px; }
.health-abnormal-label {
  font-size: 13px;
  color: #94a3b8;
  margin-bottom: 6px;
}
.health-abnormal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.health-abnormal-tag {
  font-size: 13px;
  font-weight: bold;
  color: #fca5a5;
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.35);
  border-radius: 999px;
  padding: 4px 10px;
}
.health-upload-btn {
  background: linear-gradient(135deg, #ec4899, #db2777);
  color: #fff;
}

.health-report-modal-overlay {
  z-index: 76;
  padding: 16px;
  align-items: center;
}
.health-report-modal-content {
  max-width: 360px;
  width: 100%;
  max-height: 85vh;
  box-sizing: border-box;
  padding: 24px;
  border-radius: 12px;
  background: #1e293b !important;
  color: #f8fafc;
  border: 1px solid #334155;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.55);
}
.health-report-modal-header {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 0;
  border: none;
  background: transparent;
}
.health-report-modal-title {
  flex: 1;
  min-width: 0;
  font-size: 21px;
  font-weight: bold;
  color: #f8fafc;
  line-height: 1.35;
}
.health-report-modal-close {
  flex-shrink: 0;
  background: #0f172a;
  border: 1px solid #475569;
  border-radius: 8px;
  color: #cbd5e1;
  font-size: 21px;
  cursor: pointer;
  line-height: 1;
  padding: 8px 10px;
  -webkit-appearance: none;
  appearance: none;
}
.health-report-modal-close:hover {
  color: #f8fafc;
  background: #334155;
}
.health-report-modal-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: transparent;
  color: #f8fafc;
  -webkit-overflow-scrolling: touch;
}
.health-report-modal-content button {
  -webkit-appearance: none;
  appearance: none;
  font-family: inherit;
  box-shadow: none;
}
.health-report-upload-zone {
  width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 90px;
  padding: 16px;
  background-color: #0f172a;
  border: 2px dashed #475569;
  border-radius: 8px;
  cursor: pointer;
  overflow: hidden;
  color: #cbd5e1;
  text-align: center;
}
.health-report-upload-zone:hover {
  border-color: #64748b;
  background-color: #0f172a;
}
.health-report-upload-placeholder,
.health-report-upload-placeholder * {
  background: transparent !important;
  background-color: transparent !important;
}
.health-report-upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 0;
  color: #cbd5e1;
  text-align: center;
}
.health-report-upload-icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
  font-size: 36.5px;
  line-height: 32px;
  text-align: center;
  flex-shrink: 0;
}
.health-report-upload-label {
  font-size: 17px;
  font-weight: normal;
  color: #94a3b8;
  line-height: 1.45;
}
.health-report-upload-hint {
  font-size: 14.5px;
  color: #94a3b8;
  line-height: 1.45;
}
.health-report-preview {
  display: block;
  width: 100%;
  max-height: 180px;
  height: auto;
  object-fit: contain;
  background: #0f172a;
  border-radius: 6px;
  margin: 0 auto;
}
.health-report-parse-btn {
  width: 100%;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: #334155 !important;
  background-color: #334155 !important;
  border: 1px solid #475569;
  color: #f8fafc;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 17px;
  font-weight: bold;
  cursor: pointer;
  min-height: 44px;
  line-height: 1.3;
  transition: background 0.2s;
}
.health-report-parse-btn:hover:not(:disabled) {
  background: #475569 !important;
  background-color: #475569 !important;
}
.health-report-parse-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}
.health-report-divider {
  margin-top: 20px;
  padding-top: 0;
  border-top: none;
  font-size: 15.5px;
  color: #94a3b8;
  text-align: center;
  line-height: 1.5;
}
.health-report-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 12px;
}
.health-report-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.health-report-field--full {
  grid-column: span 2;
}
.health-report-label {
  margin: 0;
  color: #cbd5e1;
}
.health-report-modal-body input,
.health-report-modal-body select,
.health-report-modal-body textarea {
  width: 100%;
  margin-top: 0;
  background: #0f172a;
  border: 1px solid #475569;
  color: #f8fafc;
  padding: 10px 12px;
  border-radius: 8px;
  box-sizing: border-box;
}
.health-report-modal-body input:-webkit-autofill,
.health-report-modal-body input:-webkit-autofill:hover,
.health-report-modal-body input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px #0f172a inset;
  -webkit-text-fill-color: #f8fafc;
  caret-color: #f8fafc;
}
.health-report-modal-footer.modal-footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px !important;
  margin-top: 24px;
  padding: 0 !important;
  width: 100%;
  border: none !important;
  background: transparent !important;
  box-sizing: border-box;
}
.health-report-modal-footer .health-report-cancel-btn {
  flex: 1;
  width: auto;
  min-height: 44px;
  margin: 0;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: #475569 !important;
  background-color: #475569 !important;
  color: #ffffff !important;
  padding: 12px 20px;
  border-radius: 8px;
  border: none !important;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s;
  font-size: 17px;
  box-sizing: border-box;
}
.health-report-modal-footer .health-report-cancel-btn:hover {
  background: #64748b !important;
  background-color: #64748b !important;
}
.health-report-modal-footer .health-report-save-btn {
  flex: 1;
  width: auto;
  min-height: 44px;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #34d399;
  color: #022c22;
  padding: 12px 20px;
  border-radius: 8px;
  border: none;
  font-weight: bold;
  font-size: 17px;
  cursor: pointer;
  box-sizing: border-box;
  transition: background 0.2s;
}
.health-report-modal-footer .health-report-save-btn:hover {
  background: #2dd4aa;
}

/* 圖表長條 */
.chart-bars { display: flex; align-items: flex-end; justify-content: space-between; height: 120px; padding: 0 8px; gap: 4px; }
.chart-bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.chart-bar { width: 100%; max-width: 28px; border-radius: 4px 4px 0 0; background: #334155; transition: height 0.3s, background 0.3s; min-height: 4px; }
.chart-bar.today { background: #fbbf24; }
.chart-bar.unavailable { background: transparent; border: 1px dashed #64748b; opacity: 0.72; }
.chart-label { font-size: 11.5px; color: #64748b; }
.chart-summary-text { font-size: 13px; color: #64748b; text-align: center; margin-top: 6px; line-height: 1.4; }
.chart-empty-state { height: 100%; display: flex; align-items: center; justify-content: center; padding: 16px; color: #64748b; font-size: 14px; text-align: center; }

.analytics-chart-card { margin-top: 8px; }
.statistics-selector-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; margin-bottom: 10px; }
.statistics-selector-grid label,
.daily-history-date-label { display: flex; flex-direction: column; gap: 5px; color: #64748b; font-size: 12px; font-weight: 700; }
.statistics-selector-grid select,
.daily-history-date-label input { width: 100%; min-width: 0; margin: 0; }

/* 遮罩 */
.loading-overlay { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.95); z-index: 40; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 24px; text-align: center; gap: 16px; }
.spinner { width: 36px; height: 36px; border: 4px solid #334155; border-top-color: #34d399; border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 每日詳細紀錄 */
.history-section { margin-top: 8px; }
.history-section-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.history-section-header .card-title { margin: 0; }
.daily-history-date-label { width: min(150px, 48%); }
.history-date-group { margin-bottom: 14px; }
.history-date-group:last-child { margin-bottom: 0; }
.history-date-header { font-size: 15.5px; font-weight: bold; color: #cbd5e1; margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid #334155; }
.history-date-total { color: #e2e8f0; font-weight: normal; }
.history-item { display: flex; align-items: center; gap: 10px; padding: 10px; background: rgba(15, 23, 42, 0.6); border: 1px solid #334155; border-radius: 12px; margin-bottom: 6px; }
.history-item-clickable { cursor: pointer; transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease; }
.history-item-clickable:hover { background: rgba(30, 41, 59, 0.92); border-color: rgba(52, 211, 153, 0.45); transform: translateY(-1px); box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22); }
.history-item-clickable:active { transform: translateY(0); box-shadow: none; }
.history-item-clickable:focus-visible { outline: 2px solid rgba(52, 211, 153, 0.55); outline-offset: 2px; }
.history-item:last-child { margin-bottom: 0; }
.history-thumb-wrap {
  position: relative;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
}
.history-thumb {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  display: block;
  background-color: #334155;
}
.history-thumb.hidden { display: none; }
.history-thumb-placeholder {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: #334155;
  border: 1px solid #475569;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28.5px;
  flex-shrink: 0;
}
.history-thumb-fallback.hidden { display: none; }
.history-clear-btn {
  width: 100%;
  margin-top: 8px;
  margin-bottom: 4px;
}
.history-item-info { flex: 1; min-width: 0; }
.history-item-name { font-size: 15.5px; font-weight: bold; color: #ffffff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-item-time { font-size: 13px; color: #e2e8f0; margin-top: 3px; font-weight: 500; }
.history-item-macros { font-size: 13px; color: #ffffff; margin-top: 4px; line-height: 1.45; font-weight: 500; }
.history-item-cal { font-size: 15.5px; font-weight: bold; flex-shrink: 0; white-space: nowrap; }
.history-item-cal.intake { color: #34d399; }
.history-item-cal.exercise { color: #38bdf8; }
.history-empty-card { text-align: center; padding: 24px 16px; background: rgba(15, 23, 42, 0.6); border: 1px dashed #334155; border-radius: 14px; }
.history-empty-card .empty-icon { font-size: 41.5px; margin-bottom: 8px; }
.history-empty-card .empty-text { font-size: 15.5px; color: #e2e8f0; line-height: 1.5; }

/* 餐點詳情 Modal */
.meal-detail-modal-overlay { z-index: 80; padding: 16px; }
.meal-detail-modal-content {
  position: relative;
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid #334155;
  border-radius: 20px;
  width: 100%;
  max-width: 360px;
  max-height: 88%;
  overflow-y: auto;
  padding: 18px 16px 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.55);
}
.meal-detail-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid #334155;
  color: #e2e8f0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 21px;
  line-height: 1;
  z-index: 2;
}
.meal-detail-close:hover { color: #ffffff; border-color: #64748b; }
.meal-detail-photo-wrap { margin-bottom: 12px; border-radius: 16px; overflow: hidden; border: 1px solid #334155; }
.meal-detail-photo { width: 100%; max-height: 240px; object-fit: cover; display: block; }
.meal-detail-photo-placeholder {
  width: 100%;
  height: 160px;
  border-radius: 16px;
  background: #1e293b;
  border: 1px solid #334155;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 62.5px;
  margin-bottom: 12px;
}
.meal-detail-name { font-size: 21px; font-weight: 900; color: #ffffff; margin: 0 28px 6px 0; line-height: 1.35; }
.meal-detail-meta { font-size: 14.5px; color: #e2e8f0; margin-bottom: 10px; }
.meal-detail-calories { font-size: 36.5px; font-weight: 900; color: #34d399; margin-bottom: 12px; }
.meal-detail-macros {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.meal-detail-macro-item {
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 10px 8px;
  text-align: center;
}
.meal-detail-macro-label { display: block; font-size: 13px; color: #e2e8f0; margin-bottom: 4px; }
.meal-detail-macro-value { display: block; font-size: 17px; font-weight: bold; color: #ffffff; }
.meal-detail-macro-value.protein { color: #f43f5e; }
.meal-detail-macro-value.carbs { color: #fbbf24; }
.meal-detail-macro-value.fat { color: #34d399; }
.meal-detail-section { border-top: 1px solid #334155; padding-top: 12px; }
.meal-detail-section-title { font-size: 15.5px; font-weight: bold; color: #c084fc; margin-bottom: 8px; }
.meal-detail-analysis { font-size: 15.5px; color: #ffffff; line-height: 1.7; margin: 0; white-space: pre-wrap; word-break: break-word; }

.item-nutrition-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,.08); }
.item-nutrition-name { min-width: 0; color: #fff; line-height: 1.45; }
.item-nutrition-values { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 9px; color: #cbd5e1; font-size: 12.5px; text-align: right; }
.item-nutrition-values b { width: 100%; color: #f1f5f9; }
.meal-detail-items { margin-top: 4px; }
.meal-detail-delete-btn {
  width: 100%;
  margin-top: 14px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(248, 113, 113, 0.45);
  background: rgba(248, 113, 113, 0.12);
  color: #f87171;
  font-size: 15.5px;
  font-weight: bold;
  cursor: pointer;
}
.meal-detail-delete-btn:hover { background: rgba(248, 113, 113, 0.2); }

/* Statistics meal detail only: match the warm Home palette without changing records. */
#meal-detail-modal {
  --meal-detail-surface: #FFFCF8;
  --meal-detail-soft: #F8EEE5;
  --meal-detail-text: #3F3732;
  --meal-detail-muted: #6B635F;
  --meal-detail-kcal: #6C5547;
  --meal-detail-protein: #8F514C;
  --meal-detail-carbs: #7F5D2E;
  --meal-detail-fat: #43665F;
  --meal-detail-accent: #68406C;
  --meal-detail-danger: #974343;
  --meal-detail-border: #DEC8B5;
  background: rgba(75, 56, 43, 0.38);
}
#meal-detail-modal .meal-detail-modal-content {
  background: var(--meal-detail-surface);
  border-color: var(--meal-detail-border);
  color: var(--meal-detail-text);
  box-shadow: 0 18px 46px rgba(74, 55, 40, 0.22);
}
#meal-detail-modal .meal-detail-close {
  width: 40px;
  height: 40px;
  background: var(--meal-detail-surface);
  border-color: var(--meal-detail-border);
  color: var(--meal-detail-text);
}
#meal-detail-modal .meal-detail-close:hover {
  background: var(--meal-detail-soft);
}
#meal-detail-modal .meal-detail-photo-wrap,
#meal-detail-modal .meal-detail-photo-placeholder {
  background: var(--meal-detail-soft);
  border-color: var(--meal-detail-border);
}
#meal-detail-modal .save-meal-image-btn-wrap {
  background: var(--meal-detail-soft);
}
#meal-detail-modal .save-img-btn {
  max-width: 100%;
  background: var(--meal-detail-surface);
  border-color: var(--meal-detail-border);
  color: var(--meal-detail-kcal);
  text-shadow: none;
  box-shadow: 0 2px 6px rgba(74, 55, 40, 0.08);
  white-space: normal;
}
#meal-detail-modal .meal-detail-name {
  color: var(--meal-detail-text);
  margin-right: 36px;
  overflow-wrap: anywhere;
}
#meal-detail-modal .meal-detail-meta,
#meal-detail-modal .meal-detail-macro-label {
  color: var(--meal-detail-muted);
}
#meal-detail-modal .meal-detail-calories { color: var(--meal-detail-kcal); }
#meal-detail-modal .meal-detail-macro-item {
  min-width: 0;
  background: var(--meal-detail-soft);
  border-color: var(--meal-detail-border);
}
#meal-detail-modal .meal-detail-macro-value { color: var(--meal-detail-text); }
#meal-detail-modal .meal-detail-macro-value.protein,
#meal-detail-modal .item-nutrition-macro--protein { color: var(--meal-detail-protein); }
#meal-detail-modal .meal-detail-macro-value.carbs,
#meal-detail-modal .item-nutrition-macro--carbs { color: var(--meal-detail-carbs); }
#meal-detail-modal .meal-detail-macro-value.fat,
#meal-detail-modal .item-nutrition-macro--fat { color: var(--meal-detail-fat); }
#meal-detail-modal .meal-detail-section { border-color: var(--meal-detail-border); }
#meal-detail-modal .meal-detail-section-title { color: var(--meal-detail-accent); }
#meal-detail-modal .meal-detail-analysis { color: var(--meal-detail-text); }
#meal-detail-modal .item-nutrition-row {
  display: grid;
  gap: 8px;
  padding: 14px 0;
  border-color: var(--meal-detail-border);
}
#meal-detail-modal .item-nutrition-main {
  display: grid;
  min-width: 0;
  gap: 3px;
}
#meal-detail-modal .item-nutrition-name {
  color: var(--meal-detail-text);
  font-weight: 700;
  overflow-wrap: anywhere;
}
#meal-detail-modal .item-nutrition-kcal {
  display: block;
  color: var(--meal-detail-kcal);
  font-size: 15px;
  line-height: 1.5;
}
#meal-detail-modal .item-nutrition-values {
  justify-content: flex-start;
  gap: 6px 16px;
  color: var(--meal-detail-muted);
  font-size: 14px;
  line-height: 1.5;
  text-align: left;
}
#meal-detail-modal .item-nutrition-macro { white-space: nowrap; }
#meal-detail-modal .meal-detail-delete-btn {
  color: var(--meal-detail-danger);
  background: var(--meal-detail-soft);
  border-color: var(--meal-detail-border);
}
#meal-detail-modal .meal-detail-delete-btn:hover { background: #F6E2DA; }
#meal-detail-modal button:focus-visible {
  outline: 2px solid var(--meal-detail-accent);
  outline-offset: 2px;
}

/* 陪跑員隨餐提醒 */
.meal-tip-card { background: linear-gradient(135deg, rgba(192, 132, 252, 0.12), #0f172a); border-color: rgba(192, 132, 252, 0.35); }
.packaged-photo-tip {
  font-size: 14.5px;
  line-height: 1.6;
  color: #725021;
  background: rgba(251, 191, 36, 0.12);
  border: 1px dashed rgba(251, 191, 36, 0.45);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 10px;
}
.meal-tip-title { font-size: 15.5px; font-weight: bold; color: #7B5A78; margin-bottom: 6px; }
.meal-tip-content { font-size: 14.5px; color: #5A4B43; line-height: 1.6; }
.meal-tip-content small,
.meal-tip-content .meal-tip-secondary { color: #7A6A60; }
.meal-tip-badge { font-size: 11.5px; color: #77665C; margin-top: 8px; text-align: center; }

/* 陪跑員進階諮詢選項 */
.coach-options-grid { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.coach-option-btn { padding: 12px 14px; font-size: 15.5px; justify-content: space-between; background: #1e293b; }
.coach-option-highlight { background: linear-gradient(135deg, rgba(192, 132, 252, 0.15), rgba(192, 132, 252, 0.05)); border-color: rgba(192, 132, 252, 0.4); color: #c084fc; }
.coach-token-tag { font-size: 13px; color: #94a3b8; font-weight: normal; }
.coach-option-highlight .coach-token-tag { color: #c084fc; opacity: 0.8; }

/* 斷食陪跑員 */
.btn-fasting-entry { border-color: rgba(251, 191, 36, 0.4); background: linear-gradient(135deg, rgba(251, 191, 36, 0.12), #0f172a); }
.fasting-intro-card { background: linear-gradient(135deg, rgba(251, 191, 36, 0.15), #0f172a); border-color: rgba(251, 191, 36, 0.3); }
.fasting-status-card { border-color: rgba(251, 191, 36, 0.25); }
.fasting-status-row { display: flex; align-items: center; gap: 14px; margin: 10px 0; }
.fasting-status-ring { width: 78px; height: 78px; border-radius: 50%; border: 4px solid #334155; border-top-color: #fbbf24; display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 900; color: #fbbf24; flex-shrink: 0; transition: border-color 0.3s; text-align: center; line-height: 1.1; }
.fasting-ring-countdown { font-variant-numeric: tabular-nums; }
.fasting-status-ring.active { border-color: #fbbf24; animation: spin 3s linear infinite; }
.fasting-status-info { flex: 1; }
.fasting-action-btn { background: #fbbf24; color: #422006; margin-top: 4px; font-size: 17px; }
.water-progress-bg { width: 100%; height: 10px; background: #334155; border-radius: 10px; overflow: hidden; margin-top: 6px; }
.water-progress-fill { height: 100%; background: linear-gradient(90deg, #38bdf8, #0ea5e9); width: 0%; transition: width 0.3s; border-radius: 10px; }
.fasting-options-grid { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.fasting-option-btn { padding: 12px 14px; font-size: 15.5px; justify-content: space-between; background: #1e293b; }
.fasting-option-highlight { background: linear-gradient(135deg, rgba(251, 191, 36, 0.15), rgba(251, 191, 36, 0.05)); border-color: rgba(251, 191, 36, 0.4); color: #fbbf24; }
.fasting-token-tag { font-size: 13px; color: #94a3b8; font-weight: normal; }
.fasting-option-highlight .fasting-token-tag { color: #fbbf24; opacity: 0.8; }
.fasting-timeline { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; max-height: 120px; overflow-y: auto; }
.fasting-timeline-item { font-size: 13px; color: #cbd5e1; padding: 8px; background: rgba(15, 23, 42, 0.6); border: 1px solid #334155; border-radius: 10px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.fasting-timeline-item .tl-icon { font-size: 18px; flex-shrink: 0; }
.fasting-timeline-item .tl-text { flex: 1; line-height: 1.4; }
.fasting-timeline-item .tl-time { color: #64748b; font-size: 11.5px; flex-shrink: 0; }
.fasting-timeline-empty { font-size: 14.5px; color: #64748b; text-align: center; padding: 12px; }

/* 首頁斷食計時看板 */
.home-fasting-board { border-color: rgba(251, 191, 36, 0.45); background: linear-gradient(135deg, rgba(251, 191, 36, 0.12), #0f172a); text-align: center; }
.home-fasting-header { font-size: 14.5px; font-weight: bold; color: #fbbf24; margin-bottom: 8px; text-align: center; }
.home-fasting-mode { font-size: 18px; font-weight: 900; color: #fde68a; margin-bottom: 6px; text-align: center; }
.home-fasting-elapsed { font-size: 26px; font-weight: 900; color: #fff; letter-spacing: 0.5px; margin-bottom: 10px; font-variant-numeric: tabular-nums; text-align: center; }
.home-fasting-progress-wrap { margin-bottom: 10px; }
.home-fasting-progress-bg { height: 10px; background: #334155; }
.home-fasting-progress-fill { background: linear-gradient(90deg, #fbbf24, #f59e0b); transition: width 0.5s ease; }
.home-fasting-progress-text { font-size: 13px; color: #94a3b8; text-align: center; margin-top: 4px; }
.home-fasting-end-btn { background: #334155; color: #f1f5f9; font-size: 15.5px; padding: 10px; margin-top: 4px; }
.home-fasting-idle-text { font-size: 15.5px; color: #94a3b8; line-height: 1.5; padding: 8px 0; text-align: center; }
.home-fasting-next-fast { font-size: 15.5px; color: #86efac; font-weight: bold; margin-bottom: 10px; line-height: 1.5; text-align: center; }
.home-fasting-board.is-eating .home-fasting-mode { color: #86efac; }
.home-fasting-board.is-eating .home-fasting-elapsed { font-size: 19.5px; color: #bbf7d0; }
.home-fasting-board.is-eating .home-fasting-progress-fill { background: linear-gradient(90deg, #34d399, #22c55e); }
.home-fasting-board.is-eating .home-fasting-progress-text { color: #86efac; }

/* 首頁 / 彈窗 — 贊助商廣告預留區（Google AdSense / IMA） */
.ad-banner-container {
  margin: 12px 0 4px;
  padding: 10px 12px 12px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.72), rgba(30, 41, 59, 0.55));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    0 8px 22px rgba(0, 0, 0, 0.22);
}
.ad-banner-container--modal { margin: 0 0 12px; }
.ad-banner-label {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 8px;
}
.ad-banner-slot { min-height: 72px; }
.ad-banner-placeholder,
.reward-ad-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 72px;
  border-radius: 10px;
  border: 1px dashed rgba(100, 116, 139, 0.45);
  background: rgba(15, 23, 42, 0.55);
  padding: 10px;
  text-align: center;
}
.ad-banner-placeholder-icon { font-size: 23.5px; opacity: 0.85; }
.ad-banner-placeholder-text {
  font-size: 13px;
  color: #94a3b8;
  line-height: 1.4;
}
.ad-banner-container.is-playing .ad-banner-placeholder {
  border-color: rgba(99, 102, 241, 0.55);
  background: rgba(49, 46, 129, 0.25);
}

/* Token 耗盡提醒 Modal — 掛在 phone-container 層，覆蓋全畫面含導覽列 */
.phone-container > .token-exhausted-modal-overlay {
  position: absolute;
  inset: 0;
  z-index: 125;
}
.token-exhausted-modal-overlay {
  z-index: 125;
  background: rgba(2, 6, 23, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.token-exhausted-modal-content {
  width: min(100%, 340px);
  text-align: center;
  padding: 22px 18px 18px;
  border-radius: 18px;
  border: 1px solid rgba(251, 191, 36, 0.35);
  background: linear-gradient(160deg, rgba(15, 23, 42, 0.96), rgba(30, 41, 59, 0.88));
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}
.token-exhausted-icon {
  font-size: 47px;
  line-height: 1;
  margin-bottom: 10px;
}
.token-exhausted-title {
  margin: 0 0 10px;
  font-size: 22px;
  font-weight: 800;
  color: #fbbf24;
}
.token-exhausted-text {
  margin: 0 0 16px;
  font-size: 17px;
  line-height: 1.55;
  color: #cbd5e1;
}
.token-exhausted-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.token-exhausted-ad-btn {
  width: 100%;
  margin: 0;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-size: 17px;
}
.token-exhausted-dismiss-btn {
  width: 100%;
}

/* 獎勵廣告 Modal — Google AdSense / IMA 預留 */
.ad-modal-overlay {
  z-index: 90;
  background: rgba(2, 6, 23, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.ad-modal-content {
  position: relative;
  width: min(100%, 360px);
  padding: 18px 16px 16px;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: linear-gradient(160deg, rgba(15, 23, 42, 0.92), rgba(30, 41, 59, 0.78));
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.45),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}
.ad-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.75);
  color: #cbd5e1;
  font-size: 18px;
  cursor: pointer;
}
.ad-modal-title {
  margin: 0 28px 14px 0;
  font-size: 18px;
  line-height: 1.45;
  color: #f8fafc;
  font-weight: 800;
}
.ad-player-box {
  position: relative;
  min-height: 168px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(100, 116, 139, 0.45);
  background:
    radial-gradient(circle at 20% 20%, rgba(99, 102, 241, 0.18), transparent 55%),
    linear-gradient(180deg, rgba(15, 23, 42, 0.95), rgba(2, 6, 23, 0.92));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}
.ad-player-box.is-playing .ad-player-loader { opacity: 1; }
.ad-player-countdown {
  position: absolute;
  top: 10px;
  left: 12px;
  z-index: 3;
  min-width: 34px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.82);
  border: 1px solid rgba(251, 191, 36, 0.45);
  color: #fde68a;
  font-size: 15.5px;
  font-weight: 800;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.ad-player-loader {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.55;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.ad-player-spinner {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 3px solid rgba(148, 163, 184, 0.25);
  border-top-color: #fbbf24;
  animation: ad-spin 1s linear infinite;
}
@keyframes ad-spin { to { transform: rotate(360deg); } }
.ad-player-slot {
  position: relative;
  z-index: 2;
  min-height: 168px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.ad-player-placeholder-text {
  font-size: 13px;
  color: #94a3b8;
  text-align: center;
  line-height: 1.5;
}
.ad-progress-track {
  height: 6px;
  margin: 12px 0;
  border-radius: 999px;
  background: rgba(51, 65, 85, 0.85);
  overflow: hidden;
}
.ad-progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #fbbf24, #34d399);
  transition: width 0.95s linear;
}
.ad-claim-btn {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(99, 102, 241, 0.45);
  background: linear-gradient(135deg, rgba(51, 65, 85, 0.95), rgba(30, 41, 59, 0.95));
  color: #cbd5e1;
  font-size: 15.5px;
  font-weight: 800;
  cursor: not-allowed;
  opacity: 0.78;
}
.ad-claim-btn.is-ready {
  cursor: pointer;
  opacity: 1;
  border-color: rgba(52, 211, 153, 0.65);
  background: linear-gradient(135deg, #059669, #10b981);
  color: #ecfdf5;
  box-shadow: 0 10px 24px rgba(16, 185, 129, 0.28);
}
.ad-modal-overlay.is-ready .ad-progress-fill {
  box-shadow: 0 0 12px rgba(52, 211, 153, 0.45);
}

/* 首頁斷食關懷浮動卡片 */
#screen-home { position: relative; }
.fasting-care-card {
  position: sticky;
  bottom: 8px;
  z-index: 25;
  margin-top: 4px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(251, 191, 36, 0.45);
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.18), rgba(15, 23, 42, 0.96));
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  animation: fasting-care-slide-in 0.35s ease;
}
@keyframes fasting-care-slide-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.fasting-care-card-header { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.fasting-care-card-avatar { font-size: 36.5px; line-height: 1; flex-shrink: 0; }
.fasting-care-card-meta { flex: 1; min-width: 0; }
.fasting-care-card-title { font-size: 17px; font-weight: 900; color: #fde68a; }
.fasting-care-card-hour { font-size: 13px; color: #fbbf24; margin-top: 2px; font-variant-numeric: tabular-nums; }
.fasting-care-card-close {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid #475569;
  color: #94a3b8;
  border-radius: 8px;
  width: 28px;
  height: 28px;
  font-size: 15.5px;
  cursor: pointer;
  flex-shrink: 0;
}
.fasting-care-card-body { font-size: 15.5px; color: #e2e8f0; line-height: 1.65; margin: 0 0 10px; }
.fasting-care-safety {
  font-size: 13px;
  line-height: 1.55;
  font-weight: 700;
  color: #fecaca;
  margin: 0 0 12px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(248, 113, 113, 0.5);
  background: linear-gradient(135deg, rgba(254, 243, 199, 0.28), rgba(239, 68, 68, 0.14));
  box-shadow: 0 0 14px rgba(251, 191, 36, 0.18), inset 0 0 0 1px rgba(254, 240, 138, 0.12);
}
.fasting-care-card-btn { background: #fbbf24; color: #422006; font-size: 15.5px; padding: 10px; width: 100%; }

.fasting-status-ring.eating { border-color: #34d399; border-top-color: #86efac; animation: none; }
.fasting-status-ring.eating #fasting-elapsed-hours { color: #86efac; font-size: 28.5px; }
.fasting-complete-modal-overlay { z-index: 120; }
.fasting-complete-modal-content { max-width: 320px; padding: 24px 20px; text-align: center; align-items: center; }
.fasting-complete-modal-icon { font-size: 54.5px; margin-bottom: 8px; }
.fasting-complete-modal-title { font-size: 23.5px; font-weight: 900; color: #fde68a; margin-bottom: 8px; }
.fasting-complete-modal-text { font-size: 17px; color: #cbd5e1; line-height: 1.6; margin: 0 0 16px; }
.fasting-complete-modal-btn { background: #fbbf24; color: #422006; font-size: 17px; width: 100%; }

/* 斷食天數設定 */
.fasting-start-setup-panel {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed rgba(251, 191, 36, 0.25);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.fasting-start-mode-field { display: flex; flex-direction: column; gap: 6px; }
.fasting-start-mode-options { display: flex; flex-direction: column; gap: 8px; }
.fasting-start-mode-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14.5px;
  color: #e2e8f0;
  cursor: pointer;
}
.fasting-start-mode-option input { accent-color: #fbbf24; }
.fasting-start-datetime-field,
.fasting-custom-datetime-panel { display: flex; flex-direction: column; gap: 6px; }
.fasting-datetime-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.fasting-datetime-part {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(251, 191, 36, 0.35);
  background: rgba(15, 23, 42, 0.85);
}
.fasting-datetime-part--date { border-color: rgba(56, 189, 248, 0.45); }
.fasting-datetime-part--time { border-color: rgba(251, 191, 36, 0.45); }
.fasting-datetime-part-label {
  font-size: 14.5px;
  color: #e2e8f0;
  font-weight: bold;
  letter-spacing: 0.02em;
}
.fasting-datetime-part input[type="date"],
.fasting-datetime-part input[type="time"],
.fasting-start-datetime-field input[type="datetime-local"],
.fasting-custom-datetime-panel input[type="datetime-local"] {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #475569;
  background: #0f172a;
  color: #f8fafc;
  font-size: 15.5px;
  color-scheme: dark;
  font-variant-numeric: tabular-nums;
}
.fasting-start-preview {
  font-size: 13px;
  line-height: 1.5;
  color: #94a3b8;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(100, 116, 139, 0.25);
}
.fasting-analysis-highlight {
  animation: fastingAnalysisPulse 1.2s ease-in-out 3;
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.45);
}
@keyframes fastingAnalysisPulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.2); }
  50% { box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.55); }
}
.fasting-days-panel { margin-top: 4px; padding-top: 4px; border-top: 1px dashed rgba(251, 191, 36, 0.25); }
.fasting-days-slider { width: 100%; margin-top: 10px; accent-color: #fbbf24; }
.fasting-days-slider-label { font-size: 14.5px; color: #fbbf24; font-weight: bold; text-align: center; margin-top: 6px; }
.fasting-eating-window-panel {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed rgba(251, 191, 36, 0.25);
}
.fasting-eating-window-field { display: flex; flex-direction: column; gap: 4px; }
.fasting-eating-window-field--full { width: 100%; }
.fasting-eating-window-label { font-size: 13px; color: #94a3b8; font-weight: bold; }
.fasting-eating-window-panel input[type="time"],
.fasting-datetime-part input[type="date"],
.fasting-datetime-part input[type="time"] {
  width: 100%;
  box-sizing: border-box;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 10px;
  color: #f8fafc;
  padding: 8px 10px;
  font-size: 15.5px;
  color-scheme: dark;
}
.fasting-eating-window-panel input[type="time"],
.fasting-days-panel select {
  width: 100%;
  box-sizing: border-box;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 10px;
  color: #f8fafc;
  padding: 8px 10px;
  font-size: 15.5px;
  color-scheme: dark;
  margin-top: 4px;
}

/* 補記日期時間選擇器 */
.meal-reuse-panel { padding: 12px; border: 1px solid #334155; border-radius: 14px; background: rgba(15, 23, 42, 0.55); }
.meal-reuse-search-row { display: flex; gap: 8px; }
.meal-reuse-search-row input { flex: 1; min-width: 0; }
.meal-reuse-resolve-btn { border: 0; border-radius: 10px; padding: 0 15px; background: #4f46e5; color: white; font-weight: 700; }
.meal-reuse-status, .meal-reuse-source-note { margin-top: 8px; color: #94a3b8; font-size: 12.5px; line-height: 1.5; }
.meal-reuse-group { margin-top: 10px; color: #cbd5e1; font-size: 13px; }
.meal-reuse-chips, .meal-reuse-confirm { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 6px; }
.meal-reuse-chip { border: 1px solid #475569; border-radius: 999px; padding: 7px 10px; background: #1e293b; color: #f8fafc; font-size: 13px; cursor: pointer; }
.meal-reuse-chip:hover { border-color: #818cf8; }
.store-datetime-input { color-scheme: dark; margin-top: 6px; }
.store-datetime-hint { font-size: 13px; color: #64748b; margin-top: 6px; line-height: 1.4; }
.history-date-total { font-size: 13px; color: #fbbf24; font-weight: normal; margin-left: 6px; }

/* 好友推薦碼兌換 */
.referral-redeem-field {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed rgba(148, 163, 184, 0.25);
}
.referral-redeem-field input {
  flex: 1;
  min-width: 0;
  margin-top: 0;
  text-transform: uppercase;
}
.referral-redeem-btn {
  width: auto;
  flex-shrink: 0;
  padding: 8px 12px;
  font-size: 14.5px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  border-radius: 20px;
  white-space: nowrap;
}
.referral-redeem-hint {
  font-size: 11.5px;
  color: #64748b;
  margin-top: 6px;
  line-height: 1.4;
}
.referral-redeem-hint.is-error { color: #f87171; }
.referral-redeem-hint.is-success { color: #34d399; }

/* 補記照片附件 */
.store-photo-attach { position: relative; width: 120px; height: 120px; border: 2px dashed #475569; border-radius: 16px; cursor: pointer; overflow: hidden; background: #0f172a; margin-top: 6px; transition: border-color 0.2s; }
.store-photo-attach:hover { border-color: #818cf8; }
.store-photo-attach.has-photo { border-style: solid; border-color: #6366f1; }
.store-photo-placeholder { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 8px; text-align: center; }

.camera-gallery-picker-btn {
  position: absolute;
  left: 10px;
  bottom: 10px;
  width: 40px;
  height: 40px;
  border-radius: 9px;
  background: rgba(15, 23, 42, 0.85);
  border: 2px solid rgba(226, 232, 240, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  cursor: pointer;
  z-index: 2;
  padding: 0;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.camera-gallery-picker-btn:active { transform: scale(0.92); border-color: #34d399; }
.camera-gallery-picker-hint { font-size: 11.5px; color: #64748b; text-align: center; margin-top: -6px; }
.store-photo-icon { font-size: 36.5px; line-height: 1; }
.store-photo-label { font-size: 14.5px; font-weight: bold; color: #818cf8; }
.store-photo-hint { font-size: 11.5px; color: #64748b; line-height: 1.3; }
.store-photo-preview { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 14px; }
.store-photo-remove { position: absolute; top: 6px; right: 6px; z-index: 2; background: rgba(15, 23, 42, 0.85); border: 1px solid #475569; color: #f87171; font-size: 13px; font-weight: bold; padding: 4px 8px; border-radius: 8px; cursor: pointer; line-height: 1; }

/* Tasks · server-owned 三王官方排行入口 */
.home-navigation-card { cursor: pointer; }
.home-navigation-card:focus-visible {
  outline: 2px solid var(--b-accent, #ff5a16);
  outline-offset: 2px;
}

.competition-entry-section {
  padding: 14px;
  border: 1px solid var(--b-border, var(--ds-border-soft));
  border-radius: 18px;
  background: var(--b-surface, var(--ds-surface-1));
  box-shadow: var(--b-shadow-card, 0 8px 22px rgba(104, 70, 49, 0.08));
}
.competition-entry-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.competition-entry-heading h2,
.competition-entry-heading p { margin: 0; }
.competition-entry-heading h2 {
  color: var(--b-text-primary, var(--ds-text-strong));
  font-size: 17px;
  line-height: 1.2;
}
.competition-entry-heading p {
  margin-top: 3px;
  color: var(--b-text-secondary, var(--ds-text-muted));
  font-size: 12px;
  line-height: 1.4;
}
.competition-entry-heading > span {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(80, 187, 185, 0.14);
  color: #327a78;
  font-size: 11px;
  font-weight: 800;
}
.competition-entry-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}
.competition-entry-card {
  min-width: 0;
  min-height: 132px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid var(--b-border, var(--ds-border-soft));
  border-radius: 15px;
  background: var(--b-surface-soft, var(--ds-surface-2));
}
.competition-entry-card[data-competition-route] { cursor: pointer; }
.competition-entry-card[data-competition-route]:focus-visible {
  outline: 2px solid var(--b-accent, #ff5a16);
  outline-offset: 2px;
}
.competition-entry-card h3,
.competition-entry-card p { margin: 0; }
.competition-entry-card h3 {
  margin-top: 6px;
  color: var(--b-text-primary, var(--ds-text-strong));
  font-size: 15px;
}
.competition-entry-card p {
  margin-top: 2px;
  color: var(--b-text-secondary, var(--ds-text-muted));
  font-size: 11.5px;
  line-height: 1.35;
}
.competition-entry-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 171, 114, 0.2);
  font-size: 16px;
}
.competition-entry-button {
  display: block;
  width: 100%;
  margin-top: auto;
  padding: 7px 9px;
  border: 1px solid rgba(255, 90, 22, 0.25);
  border-radius: 10px;
  background: rgba(255, 171, 114, 0.2);
  color: #a74627;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
  cursor: pointer;
}
.competition-entry-button:focus-visible {
  outline: 2px solid var(--b-accent, #ff5a16);
  outline-offset: 2px;
}
.competition-entry-card--disabled { opacity: 0.72; }
.competition-entry-card--disabled .competition-entry-button { opacity: 1; }

.competition-leaderboard-modal-content { max-width: 380px; }
.competition-leaderboard-modal-content .modal-header > button {
  border: 0;
  background: transparent;
  color: var(--b-text-secondary, var(--ds-text-muted));
  font-size: 24px;
  cursor: pointer;
}
.competition-leaderboard-period {
  margin: 0 0 10px;
  color: var(--b-text-secondary, var(--ds-text-muted));
  font-size: 12px;
  font-weight: 700;
}
.competition-leaderboard-content {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.competition-leaderboard-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 10px;
  border: 1px solid var(--b-border, var(--ds-border-soft));
  border-radius: 12px;
  background: var(--b-surface-soft, var(--ds-surface-2));
}
.competition-leaderboard-rank {
  color: #9a6120;
  font-size: 12px;
  font-weight: 850;
}
.competition-leaderboard-person {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.competition-leaderboard-person strong {
  overflow: hidden;
  color: var(--b-text-primary, var(--ds-text-strong));
  font-size: 13.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.competition-leaderboard-person small {
  overflow: hidden;
  color: var(--b-text-secondary, var(--ds-text-muted));
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.competition-leaderboard-score {
  color: #a74627;
  font-size: 13px;
  font-weight: 850;
  white-space: nowrap;
}
.competition-leaderboard-empty {
  min-height: 112px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 5px;
  padding: 16px;
  border: 1px dashed var(--b-border, var(--ds-border-soft));
  border-radius: 14px;
  color: var(--b-text-secondary, var(--ds-text-muted));
  text-align: center;
}
.competition-leaderboard-empty strong {
  color: var(--b-text-primary, var(--ds-text-strong));
  font-size: 16px;
}
.competition-leaderboard-empty span { font-size: 12px; }

/* Tasks · 三王共用詳情頁（只讀 Competition projection） */
#screen-competition-detail {
  gap: 12px;
  padding-bottom: 8px;
  color: var(--b-text-primary, var(--ds-text-strong));
}
.competition-detail-header {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 72px;
  align-items: center;
  gap: 8px;
}
.competition-detail-header h1 {
  margin: 0;
  color: var(--b-text-primary, var(--ds-text-strong));
  font-size: 20px;
  line-height: 1.25;
  text-align: center;
}
.competition-detail-back {
  min-height: 40px;
  padding: 7px 8px;
  border: 0;
  background: transparent;
  color: var(--b-text-secondary, var(--ds-text-muted));
  font-size: 14px;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}
.competition-detail-back:focus-visible {
  outline: 2px solid var(--b-accent, #ff5a16);
  outline-offset: 2px;
  border-radius: 9px;
}
.competition-detail-hero,
.competition-detail-period,
.competition-detail-ranking {
  padding: 15px;
  border: 1px solid var(--b-border, var(--ds-border-soft));
  border-radius: 18px;
  background: var(--b-surface, var(--ds-surface-1));
  box-shadow: var(--b-shadow-card, 0 8px 22px rgba(104, 70, 49, 0.08));
}
.competition-detail-hero {
  min-height: 108px;
  display: grid;
  place-content: center;
  gap: 5px;
  text-align: center;
}
.competition-detail-hero p,
.competition-detail-period h2,
.competition-detail-ranking h2,
.competition-detail-ranking p { margin: 0; }
.competition-detail-hero p {
  color: var(--b-text-secondary, var(--ds-text-muted));
  font-size: 13px;
  font-weight: 800;
}
.competition-detail-hero strong {
  color: var(--b-accent, #ff5a16);
  font-size: clamp(30px, 9vw, 44px);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.competition-detail-period h2,
.competition-detail-ranking h2 {
  color: var(--b-text-primary, var(--ds-text-strong));
  font-size: 16px;
}
.competition-detail-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-top: 10px;
}
.competition-detail-summary-grid article {
  min-height: 76px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 11px;
  border-radius: 13px;
  background: var(--b-surface-soft, var(--ds-surface-2));
}
.competition-detail-summary-grid span {
  color: var(--b-text-secondary, var(--ds-text-muted));
  font-size: 11.5px;
  font-weight: 700;
}
.competition-detail-summary-grid strong {
  overflow-wrap: anywhere;
  color: var(--b-text-primary, var(--ds-text-strong));
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}
.competition-detail-ranking-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 11px;
}
.competition-detail-ranking-heading p {
  margin-top: 3px;
  color: var(--b-text-secondary, var(--ds-text-muted));
  font-size: 11.5px;
}
.competition-detail-ranking-heading > span {
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(80, 187, 185, 0.14);
  color: #327a78;
  font-size: 11px;
  font-weight: 800;
}

/* Legacy client-write Challenge Engine remains isolated and is not used by the Tasks entries. */
.challenge-entry-btn--soon {
  background: rgba(148, 163, 184, 0.18) !important;
  color: #94a3b8 !important;
  cursor: not-allowed;
  opacity: 0.85;
}
.challenge-modal-content { max-width: 380px; }
.challenge-type-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.challenge-type-tab {
  flex: 1;
  min-width: 90px;
  padding: 9px 8px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(15, 23, 42, 0.6);
  color: #94a3b8;
  font-size: 13.5px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.challenge-type-tab.active { border-color: #34d399; color: #34d399; background: rgba(52, 211, 153, 0.12); }
.challenge-type-tab-soon-badge { font-size: 10px; font-weight: normal; color: #fbbf24; }
.challenge-loading-hint, .challenge-empty-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 22px 10px;
  font-size: 13.5px;
  color: #94a3b8;
  text-align: center;
  line-height: 1.5;
}
.challenge-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 16px;
  padding: 12px;
  margin-bottom: 12px;
}
.challenge-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 10px; }
.challenge-card-title { font-size: 15.5px; font-weight: bold; color: #fff; }
.challenge-card-dates { font-size: 12px; color: #64748b; margin-top: 2px; }
.challenge-copy-code-btn {
  flex-shrink: 0;
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.4);
  color: #34d399;
  font-size: 12.5px;
  font-weight: bold;
  padding: 6px 10px;
  border-radius: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.challenge-leaderboard { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.challenge-leaderboard-row {
  display: grid;
  grid-template-columns: 24px 28px 1fr auto;
  grid-template-areas: "rank avatar name score" ". . name today";
  align-items: center;
  gap: 4px 8px;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(30, 41, 59, 0.5);
  font-size: 13px;
  color: #cbd5e1;
}
.challenge-leaderboard-row--me { background: rgba(52, 211, 153, 0.1); border: 1px solid rgba(52, 211, 153, 0.35); }
.challenge-rank { grid-area: rank; text-align: center; font-size: 13px; }
.challenge-member-avatar {
  grid-area: avatar;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  overflow: hidden;
  background: rgba(148, 163, 184, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}
.challenge-member-name { grid-area: name; font-weight: bold; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.challenge-member-score { grid-area: score; font-weight: bold; color: #34d399; white-space: nowrap; }
.challenge-member-today { grid-area: today; font-size: 11.5px; color: #64748b; white-space: nowrap; }
.challenge-sync-row { display: flex; gap: 8px; flex-wrap: wrap; }
.challenge-manual-input {
  flex: 1;
  min-width: 120px;
  margin-top: 0;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 20px;
  padding: 8px 12px;
  color: #fff;
  font-size: 13.5px;
}
.challenge-sync-btn { flex-shrink: 0; background: linear-gradient(135deg, #10b981, #059669); }
.challenge-create-join-panel {
  border-top: 1px dashed rgba(148, 163, 184, 0.25);
  padding-top: 14px;
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.challenge-create-join-title { font-size: 13px; color: #94a3b8; text-align: center; margin-bottom: 4px; line-height: 1.4; }
.challenge-create-row { display: flex; gap: 8px; }
.challenge-create-row input { flex: 1; min-width: 0; margin-top: 0; }
.challenge-create-row select {
  flex-shrink: 0;
  width: 78px;
  margin-top: 0;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 12px;
  color: #fff;
  padding: 0 6px;
  font-size: 13.5px;
}
.challenge-join-row { display: flex; gap: 8px; }
.challenge-join-row input { flex: 1; min-width: 0; margin-top: 0; text-transform: uppercase; }
.challenge-join-row button { flex-shrink: 0; }
.store-photo-remove:hover { background: rgba(127, 29, 29, 0.9); border-color: #f87171; }
.store-description-row { display: flex; gap: 8px; align-items: stretch; }
.store-description-row textarea { flex: 1; }
.store-voice-input { border: 1px solid #6366f1; border-radius: 12px; background: #1e1b4b; color: #c7d2fe; padding: 0 12px; font-weight: 700; }
.store-voice-status { color: #94a3b8; font-size: 12px; margin-top: 6px; }
.store-photo-add-btn { width: 100%; min-height: 70px; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 2px dashed #6366f1; border-radius: 16px; background: #171f35; color: #eef2ff; text-align: left; cursor: pointer; }
.store-photo-add-btn:disabled { opacity: .55; cursor: not-allowed; }
.store-photo-add-btn > span:last-child { display: flex; flex-direction: column; gap: 3px; }
.store-photo-add-btn strong { font-size: 15px; }
.store-photo-add-btn small { color: #a5b4fc; font-size: 12px; font-weight: 500; }
.store-photo-evidence-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.store-photo-evidence { min-width: 0; display: grid; grid-template-columns: 42px 1fr 26px; align-items: center; gap: 7px; border-radius: 13px; background: #143c35; color: #d1fae5; padding: 6px; font-size: 12px; }
.store-photo-evidence.unavailable { background: #451a03; color: #fcd34d; }
.store-photo-evidence img, .store-photo-unavailable { width: 42px; height: 42px; object-fit: cover; border-radius: 9px; }
.store-photo-unavailable { display: grid; place-items: center; background: #78350f; font-weight: 900; }
.store-photo-evidence > span:nth-child(2) { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.store-photo-evidence small { opacity: .76; }
.store-photo-evidence button { width: 26px; height: 26px; border: 0; border-radius: 999px; background: rgba(15,23,42,.5); color: #fecaca; cursor: pointer; }

/* Batch F design-system primitives. Scope is intentionally limited to onboarding,
   home, result, and the Health Data editor in this batch. */
.ds-button {
  min-height: 50px;
  border: 0;
  border-radius: var(--ds-radius-control);
  padding: 13px 18px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}
.ds-button--primary {
  color: #2f1b22;
  background: linear-gradient(135deg, var(--ds-brand-apricot), var(--ds-brand-coral));
  box-shadow: 0 10px 24px rgba(255, 133, 111, 0.25);
}
.ds-button--quiet { color: var(--ds-text-body); background: rgba(255,255,255,0.07); border: 1px solid var(--ds-border-soft); }
.ds-card { border-radius: var(--ds-radius-card); border: 1px solid var(--ds-border-soft); box-shadow: var(--ds-shadow-card); }
.ds-card--calorie { background: linear-gradient(145deg, rgba(255,133,111,.2), var(--ds-surface-1) 48%); border-color: rgba(255,133,111,.32); }
.ds-card--protein { background: linear-gradient(145deg, rgba(169,155,243,.18), var(--ds-surface-1) 52%); border-color: rgba(169,155,243,.3); }
.ds-button--camera { background: linear-gradient(135deg, var(--ds-brand-apricot), var(--ds-brand-coral)); box-shadow: 0 12px 26px rgba(242,112,119,.28); }

.phone-container { background: var(--ds-bg-shell); }
.phone-container.onboarding-active > header,
.phone-container.onboarding-active > main,
.phone-container.onboarding-active > nav { visibility: hidden; }
.onboarding {
  /* Batch F onboarding visuals are frozen in this round; keep its existing palette
     while the shared/home tokens move to the warm almond theme. */
  --ds-bg-shell: #202b41;
  --ds-surface-1: #26334a;
  --ds-border-soft: rgba(203, 213, 225, 0.14);
  --ds-text-strong: #fffaf2;
  --ds-text-body: #e4e9f2;
  --ds-text-muted: #a9b4c8;
  --ds-brand-coral: #ff856f;
  --ds-brand-apricot: #ffb86b;
  --ds-brand-lilac: #a99bf3;
  --ds-brand-sky: #71c9dd;
  position: absolute;
  inset: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  padding: 34px 24px 26px;
  overflow-y: auto;
  background:
    radial-gradient(circle at 88% 10%, rgba(169, 155, 243, 0.23), transparent 34%),
    radial-gradient(circle at 8% 92%, rgba(255, 184, 107, 0.16), transparent 32%),
    var(--ds-bg-shell);
}
.onboarding-brand { display: flex; align-items: center; gap: 8px; color: var(--ds-brand-apricot); font-size: 15px; font-weight: 850; letter-spacing: .02em; }
.onboarding-brand-mark { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 10px; color: #2f1b22; background: var(--ds-brand-apricot); }
.onboarding-progress { display: flex; gap: 7px; margin: 28px 0 22px; }
.onboarding-progress-dot { height: 5px; flex: 1; border-radius: 999px; background: rgba(255,255,255,.1); transition: background .2s; }
.onboarding-progress-dot.is-active { background: linear-gradient(90deg, var(--ds-brand-apricot), var(--ds-brand-coral)); }
.onboarding-copy { min-height: 178px; }
.onboarding-eyebrow { color: var(--ds-brand-sky); font-size: 13px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.onboarding-copy h1 { margin: 9px 0 10px; color: var(--ds-text-strong); font-size: 29px; line-height: 1.2; letter-spacing: -.025em; }
.onboarding-copy > p:last-child { color: var(--ds-text-muted); font-size: 15px; line-height: 1.65; }
.onboarding-step { min-height: 168px; border: 0; }
.onboarding-field-label { display: block; margin-bottom: 9px; color: var(--ds-text-body); font-size: 14px; font-weight: 800; }
.onboarding .onboarding-picker,
.health-data-picker {
  width: 100%;
  min-height: 56px;
  margin: 0;
  padding: 12px 16px;
  border: 1px solid rgba(169, 155, 243, .3);
  border-radius: var(--ds-radius-control);
  background: var(--ds-surface-1);
  color: var(--ds-text-strong);
  font-size: 20px;
  color-scheme: dark;
}
.onboarding-unit-picker { position: relative; display: flex; align-items: center; }
.onboarding-unit-picker > span { position: absolute; right: 17px; color: var(--ds-text-muted); pointer-events: none; }
.onboarding-field-hint { margin-top: 9px; color: var(--ds-text-muted); font-size: 13px; line-height: 1.5; }
.onboarding-activity-option { display: flex; align-items: center; gap: 11px; margin-bottom: 9px; padding: 12px; border: 1px solid var(--ds-border-soft); border-radius: 15px; background: rgba(255,255,255,.035); cursor: pointer; }
.onboarding-activity-option:has(input:checked) { border-color: rgba(255, 184, 107, .7); background: rgba(255, 184, 107, .1); }
.onboarding-activity-option input { accent-color: var(--ds-brand-coral); }
.onboarding-activity-option span { display: flex; flex-direction: column; gap: 3px; }
.onboarding-activity-option strong { color: var(--ds-text-strong); font-size: 14px; }
.onboarding-activity-option small { color: var(--ds-text-muted); font-size: 12px; line-height: 1.4; }
.onboarding-error { min-height: 20px; color: var(--ds-danger); font-size: 13px; }
.onboarding-actions { display: grid; grid-template-columns: auto 1fr; gap: 10px; margin-top: auto; }
.onboarding-actions .ds-button--primary:only-child { grid-column: 1 / -1; }
.onboarding-companion { margin-top: 16px; text-align: center; color: var(--ds-text-muted); font-size: 12px; line-height: 1.5; }

#screen-home .card,
#screen-result .card,
.health-data-settings-card,
#activity-level-card { border-color: var(--ds-border-soft); border-radius: var(--ds-radius-card); box-shadow: var(--ds-shadow-card); }
#screen-home .home-calorie-card { background: linear-gradient(145deg, rgba(255,133,111,.2), var(--ds-surface-1) 48%); border-color: rgba(255,133,111,.32); }
#screen-home .home-protein-card { background: linear-gradient(145deg, rgba(169,155,243,.18), var(--ds-surface-1) 52%); border-color: rgba(169,155,243,.3); }
#screen-home #cal-deficit-display { color: var(--ds-brand-apricot); }
#screen-home .tag-green { color: #bcebdc; background: rgba(98,199,165,.14); }
#screen-home .home-calorie-progress-fill { background: linear-gradient(90deg, var(--ds-brand-coral), var(--ds-brand-apricot)); }
#screen-home .btn-main { background: linear-gradient(135deg, #ff9b74, #f27077); box-shadow: 0 12px 26px rgba(242,112,119,.22); }
#screen-home .card-title,
#screen-result .card-title { color: var(--ds-text-muted); }
.health-data-settings-intro { margin: 6px 0 13px; color: var(--ds-text-muted); font-size: 13px; line-height: 1.55; }
.health-data-settings-card .health-data-picker { min-height: 46px; margin-top: 5px; padding: 8px 10px; font-size: 16px; }
.result-summary-card { text-align: left; padding: 20px; background: linear-gradient(145deg, rgba(113,201,221,.12), var(--ds-surface-1) 54%); }
.result-calorie-value { margin-top: 5px; color: var(--ds-brand-apricot); font-size: 42px; font-weight: 900; letter-spacing: -.03em; }
.result-calorie-value span:last-child { color: var(--ds-text-muted); font-size: 16px; font-weight: 500; }
.result-macro-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; color: var(--ds-text-muted); font-size: 13px; }
.result-macro-grid > div { padding: 10px 8px; border-radius: 13px; background: rgba(255,255,255,.045); }
.result-macro-grid strong { display: block; margin-top: 4px; font-size: 15px; }
.result-macro-protein { color: #ff9ea5; }
.result-macro-carbs { color: #f2c167; }
.result-macro-fat { color: #79d4bd; }
#screen-result .meal-tip-card { background: linear-gradient(145deg, rgba(169,155,243,.13), var(--ds-surface-1)); border-color: rgba(169,155,243,.22); }
#screen-result #res-items-list .item-row { background: #8A7768; color: #FFF7ED; }
#screen-result #res-items-list .item-row > span { color: #FFF7ED !important; }
#screen-result #save-record-btn { background: #655F45; color: #FFF9F1; }

/* Warm almond home theme. Color-only overrides: layout and sizing remain unchanged. */
.phone-container { background: var(--ds-bg-shell); border-color: var(--ds-border-soft); }
header {
  background: rgba(255, 250, 243, 0.96);
  border-bottom-color: var(--ds-divider);
  color: var(--ds-text-strong);
}
.home-health-sync-badge--offline { background: var(--ds-surface-2); color: var(--ds-text-muted); border-color: var(--ds-border-soft); }
.home-health-sync-badge--offline .home-health-sync-dot { background: #8f7967; }
.header-account-badge { background: var(--ds-cta-primary); border-color: var(--ds-cta-primary); color: #fffaf3; }
.header-account-badge-icon { background: rgba(255, 250, 243, .16); }
.header-account-badge.is-logged-in { background: var(--ds-accent-berry); border-color: var(--ds-accent-grape); color: #fffaf3; }
.badge-token { background: var(--ds-token-surface); color: var(--ds-token); border-color: rgba(241, 196, 79, .42); }

#screen-home { color: var(--ds-text-strong); }
#screen-home .card { background: var(--ds-surface-1); color: var(--ds-text-strong); }
#screen-home .home-calorie-card,
#screen-home .ds-card--calorie {
  background: linear-gradient(145deg, #c5aa8e, var(--ds-calorie-surface));
  border-color: rgba(91, 67, 48, .2);
}
#screen-home .home-calorie-card .card-title,
#screen-home .home-calorie-card .home-progress-meta,
#screen-home .home-calorie-card .home-progress-stats { color: #3d3026; }
#screen-home #cal-deficit-display { color: #2f251e; }
#screen-home .tag-green { color: #3e342b; background: rgba(255, 250, 243, .48); }
#screen-home .home-exercise-stat { color: #5f4938; }
#screen-home .home-calorie-progress-bg,
#screen-home .home-protein-progress-bg,
#screen-home .home-fasting-progress-bg { background: var(--ds-progress-track); }
#screen-home .home-calorie-progress-fill { background: linear-gradient(90deg, #6c5140, #927158); }
#screen-home .home-protein-card,
#screen-home .ds-card--protein { background: var(--ds-surface-1); border-color: rgba(217, 120, 50, .25); }
#screen-home .home-protein-title,
#screen-home .home-protein-hint { color: var(--ds-text-muted); }
#screen-home .home-protein-value { color: var(--ds-protein); }
#screen-home .home-protein-progress-fill { background: linear-gradient(90deg, var(--ds-protein), #e39a65); }
#screen-home .btn-main,
#screen-home .ds-button--camera {
  background: linear-gradient(135deg, var(--ds-cta-primary), #5b493a);
  color: #fffaf3;
  box-shadow: 0 12px 26px rgba(68, 55, 44, .2);
}
#screen-home .home-secondary-cta { border: 0; color: #fffaf3; }
#screen-home .home-store-cta { background: linear-gradient(135deg, var(--ds-cta-secondary), #5d453b); }
#screen-home .home-coach-cta { background: linear-gradient(135deg, var(--ds-accent-berry), var(--ds-accent-grape)); }
#screen-home .home-fasting-board { background: var(--ds-surface-1); }

nav { background: var(--ds-nav-surface); border-top-color: var(--ds-divider); }
.nav-item { color: var(--ds-text-muted); }
.nav-item.active { color: var(--ds-nav-selected); }
.progress-bg { background: var(--ds-progress-track); }
.login-submit-btn { background: linear-gradient(135deg, var(--ds-cta-primary), #5b493a); box-shadow: 0 8px 18px rgba(68, 55, 44, .2); }
.login-guest-btn { color: var(--ds-text-body); border-color: var(--ds-border-soft); }

/* Camera and backfill use the approved warm almond design-system palette.
   These selectors intentionally change only color/readability, not layout. */
#screen-camera,
#screen-store { color: var(--ds-text-strong); }
#screen-camera .subflow-header,
#screen-store .subflow-header { border-bottom: 1px solid var(--ds-divider); }
#screen-camera .subflow-page-title,
#screen-store .subflow-page-title { color: var(--ds-text-strong); }
#screen-camera .btn-back,
#screen-store .btn-back { color: var(--ds-text-body); }
#screen-camera .btn-back:hover,
#screen-store .btn-back:hover { color: var(--ds-text-strong); }
#screen-camera .card-title,
#screen-store .card-title { color: var(--ds-text-body); }
#screen-camera input[type="text"],
#screen-store input[type="text"],
#screen-store input[type="search"],
#screen-store input[type="datetime-local"],
#screen-store textarea {
  background: var(--ds-surface-1);
  border-color: var(--ds-border-soft);
  color: var(--ds-text-strong);
  color-scheme: light;
}
#screen-camera input::placeholder,
#screen-store input::placeholder,
#screen-store textarea::placeholder { color: var(--ds-text-muted); opacity: 1; }
#screen-camera #camera-preview-area {
  background: var(--ds-surface-2) !important;
  border-color: #a98f78 !important;
  color: var(--ds-text-strong);
}
#screen-camera #photo-placeholder > div:last-child,
#screen-camera .camera-gallery-picker-hint { color: var(--ds-text-muted) !important; }
#screen-camera .camera-gallery-picker-btn {
  background: var(--ds-cta-primary);
  border-color: #fffaf3;
  color: #fffaf3;
}
#screen-camera .camera-gallery-picker-btn:active { border-color: var(--ds-token); }
#screen-camera .btn-submit,
#screen-store .btn-submit {
  background: linear-gradient(135deg, var(--ds-cta-primary), #5b493a);
  color: #fffaf3;
  box-shadow: 0 8px 18px rgba(68, 55, 44, .2);
}
#screen-store .store-datetime-hint,
#screen-store .store-voice-status { color: var(--ds-text-muted); }
#screen-store .store-voice-input {
  background: var(--ds-surface-2);
  border-color: var(--ds-border-soft);
  color: var(--ds-text-strong);
}
#screen-store .store-photo-add-btn {
  background: var(--ds-surface-1);
  border-color: #9c7f67;
  color: var(--ds-text-strong);
}
#screen-store .store-photo-add-btn small { color: var(--ds-text-muted); }
#screen-store .store-photo-session-hint {
  color: #7A6A60;
  font-size: 13px;
  line-height: 1.45;
  margin-top: 6px;
  opacity: .82;
}
#screen-store .store-photo-session-hint.is-multi-photo { opacity: 1; font-weight: 600; }
#screen-store .store-photo-evidence {
  background: #e6ede3;
  border: 1px solid #a7b6a2;
  color: #344533;
  font-size: 13.5px;
}
#screen-store .store-photo-evidence.unavailable {
  background: #f4e6cf;
  border-color: #d4ad6a;
  color: #6b491e;
}
#screen-store .store-photo-unavailable { background: #d7ad69; color: #3f2b13; }
#screen-store .store-photo-evidence small { opacity: 1; color: inherit; font-size: 13px; }
#screen-store .store-photo-evidence button {
  background: #6e403c;
  color: #fff7f0;
  border: 1px solid rgba(76, 34, 31, .28);
}

/* Quick reuse is a primary backfill feature, never footnote-sized. */
#screen-store .meal-reuse-panel {
  background: var(--ds-surface-1);
  border-color: var(--ds-border-soft);
}
#screen-store #meal-reuse-title { color: var(--ds-text-strong); font-size: 17px; }
#screen-store .meal-reuse-search-row input { font-size: 16px; }
#screen-store .meal-reuse-resolve-btn {
  background: var(--ds-cta-secondary);
  color: #fffaf3;
  font-size: 15.5px;
}
#screen-store .meal-reuse-status,
#screen-store .meal-reuse-source-note {
  color: var(--ds-text-muted);
  font-size: 14.5px;
  line-height: 1.55;
}
#screen-store .meal-reuse-group { color: var(--ds-text-body); font-size: 16px; font-weight: 750; }
#screen-store .meal-reuse-chips,
#screen-store .meal-reuse-confirm { color: var(--ds-text-muted); font-size: 14.5px; font-weight: 500; }
#screen-store .meal-reuse-chip {
  background: var(--ds-surface-2);
  border-color: #bba48f;
  color: var(--ds-text-strong);
  font-size: 15.5px;
}
#screen-store .meal-reuse-chip:hover { border-color: var(--ds-cta-secondary); }

/* Final warm-palette presentation cleanup. Keep this block after legacy page
   rules and inline-color-era selectors so the rendered cascade is explicit. */
#screen-store .meal-reuse-source-note { font-size: 17px; }

/* Coach: warm surfaces with grape used only as a restrained accent. */
#screen-coach { color: var(--ds-text-strong); }
#screen-coach > div:first-child > span:nth-child(2) { color: var(--ds-accent-berry) !important; }
#screen-coach .btn-back { color: var(--ds-text-body); }
#screen-coach > .card {
  background: var(--ds-surface-1) !important;
  border-color: var(--ds-border-soft) !important;
  color: var(--ds-text-body) !important;
}
#screen-coach > .card:nth-child(2) { background: linear-gradient(145deg, #f2e7da, var(--ds-surface-1)) !important; }
#screen-coach > .card > div { color: var(--ds-text-body) !important; }
#screen-coach > .card b,
#screen-coach #coach-reply-title,
#screen-coach #coach-followup-chat-box > div:first-child > span:first-child { color: var(--ds-accent-berry) !important; }
#screen-coach > .card span[style*="#94a3b8"] { color: var(--ds-text-muted) !important; }
#screen-coach .card-title { color: var(--ds-text-strong) !important; }
#screen-coach .coach-option-btn {
  background: var(--ds-surface-2);
  border-color: #c6b3a1;
  color: var(--ds-text-strong);
}
#screen-coach .coach-option-highlight {
  background: #eee2ec;
  border-color: #b99abb;
  color: #5d3769;
}
#screen-coach .coach-token-tag { color: var(--ds-text-muted); }
#screen-coach .coach-option-highlight .coach-token-tag { color: #69436f; opacity: 1; }
#screen-coach #coach-reply-content { color: var(--ds-text-body) !important; }
#screen-coach .coach-followup-chat-remaining,
#screen-coach .coach-followup-chat-limit-hint { color: var(--ds-text-muted); }
#screen-coach .chat-ai { background: #f1e6da; border-color: #b99abb; color: var(--ds-text-body); }
#screen-coach .chat-user { background: #d9c2a9; color: #382c23; }
#screen-coach input[type="text"] {
  background: var(--ds-surface-1);
  border-color: #c6b3a1;
  color: var(--ds-text-strong);
}
#screen-coach input[type="text"]::placeholder { color: var(--ds-text-muted); opacity: 1; }
#screen-coach .btn-submit {
  background: linear-gradient(135deg, var(--ds-cta-primary), #5b493a);
  color: #fffaf3;
  box-shadow: 0 8px 18px rgba(68, 55, 44, .2);
}

/* Settings: the page and all nested cards/controls share the home palette. */
#screen-settings { color: var(--ds-text-strong); }
#screen-settings > div:first-child > span:nth-child(2) { color: var(--ds-text-strong); }
#screen-settings .btn-back { color: var(--ds-text-body); }
#screen-settings > .card {
  background: var(--ds-surface-1) !important;
  border-color: var(--ds-border-soft) !important;
  color: var(--ds-text-body);
}
#screen-settings .card-title,
#screen-settings .account-label,
#screen-settings .feedback-card-title,
#screen-settings .health-sync-name { color: var(--ds-text-strong) !important; }
#screen-settings .account-status,
#screen-settings .account-email,
#screen-settings .account-hint,
#screen-settings .health-data-settings-intro,
#screen-settings .activity-level-hint,
#screen-settings .activity-level-disabled-text,
#screen-settings .health-profile-intro,
#screen-settings .health-sync-intro,
#screen-settings .health-sync-subtitle,
#screen-settings .health-sync-desc,
#screen-settings .feedback-card-desc,
#screen-settings .api-key-hint { color: var(--ds-text-muted); }
#screen-settings .account-guest-tag { color: #a8761e; }
#screen-settings .account-sync-badge { color: var(--ds-success); }
#screen-settings .account-avatar,
#screen-settings .account-avatar-guest,
#screen-settings .health-sync-icon {
  background: var(--ds-surface-2);
  border-color: #c6b3a1;
}
#screen-settings input[type="text"],
#screen-settings input[type="password"],
#screen-settings input[type="date"],
#screen-settings select {
  background: #fffaf3;
  border-color: #c6b3a1;
  color: var(--ds-text-strong);
  color-scheme: light;
}
#screen-settings .activity-level-preview,
#screen-settings .protein-target-preview,
#screen-settings .health-sync-item,
#screen-settings .health-metric-card {
  background: var(--ds-surface-2);
  border-color: #c6b3a1;
  color: var(--ds-text-body);
}
#screen-settings .activity-level-preview { color: var(--ds-text-body); }
#screen-settings .activity-level-preview strong,
#screen-settings .protein-target-preview { color: #9a6b20; }
#screen-settings .health-metric-label,
#screen-settings .health-metric-edit-hint,
#screen-settings .health-metric-unit { color: var(--ds-text-muted); }
#screen-settings .health-metric-value { color: var(--ds-text-strong); }
#screen-settings .health-metric-value--unset { color: #806f62; }
#screen-settings .feedback-card-arrow { color: var(--ds-accent-berry); }
#screen-settings .toggle-slider { background: #c9b9aa; border-color: #ad9783; }
#screen-settings .health-sync-toggle input:checked + .toggle-slider { background: #768b70; border-color: #647a60; }
#screen-settings .account-login-btn,
#screen-settings #btn-save-settings,
#screen-settings .health-upload-btn {
  background: linear-gradient(135deg, var(--ds-cta-primary), #6f523e);
  color: #fffaf3;
  box-shadow: 0 8px 18px rgba(68, 55, 44, .2);
}
#screen-settings .account-logout-btn {
  background: #f1e2dd;
  border-color: #c79c91;
  color: #874c43;
}

/* Minimal App Store subscription page. */
#screen-subscription { color: var(--ds-text-strong); }
.subscription-page-header { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 6px 0 2px; }
.subscription-page-title { font-size: 20px; font-weight: 900; }
.subscription-page-badge { padding: 3px 7px; border-radius: 999px; background: #d7a83e; color: #3d2d10; font-size: 10px; font-weight: 900; letter-spacing: .5px; }
.subscription-card { text-align: center; background: var(--ds-surface-1) !important; border-color: var(--ds-border-soft) !important; }
.subscription-hero-icon { width: 48px; height: 48px; display: grid; place-items: center; margin: 0 auto 10px; border-radius: 50%; background: #f4dfad; color: #8b641c; font-size: 26px; }
.subscription-card h1 { font-size: 23px; margin-bottom: 7px; }
.subscription-card p { color: var(--ds-text-muted); font-size: 14px; line-height: 1.5; }
.subscription-plan-list { display: grid; gap: 10px; }
.subscription-plan-btn,
.subscription-back-btn { width: 100%; min-height: 58px; border-radius: 16px; font-weight: 800; cursor: pointer; }
.subscription-plan-btn { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border: 1px solid #9b7a60; background: #fffaf3; color: var(--ds-text-strong); }
.subscription-plan-btn--featured { border-color: #8c6326; background: #f4dfad; }
.subscription-plan-name { font-size: 17px; }
.subscription-plan-price { font-size: 16px; color: #7c571b; }
.subscription-plan-btn:disabled { cursor: not-allowed; opacity: .55; }
.subscription-back-btn { border: 1px solid #b9a99b; background: var(--ds-surface-2); color: var(--ds-text-body); font-size: 16px; }
.subscription-status { min-height: 22px; margin: 2px 4px 0; color: var(--ds-text-muted); font-size: 13px; line-height: 1.45; text-align: center; }
.subscription-status[data-state="purchased"],
.subscription-status[data-state="restored"] { color: var(--ds-success); font-weight: 800; }
.subscription-status[data-state="error"],
.subscription-status[data-state="unavailable"] { color: var(--ds-danger); }
.subscription-restore-btn { align-self: center; border: 0; background: transparent; color: var(--ds-accent-berry); font-size: 14px; font-weight: 800; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.subscription-restore-btn:disabled { opacity: .5; cursor: wait; }
.subscription-renewal-note { color: var(--ds-text-muted); font-size: 11px; line-height: 1.45; text-align: center; padding: 0 8px; }

/* Token/tasks/social league: three warm surface levels, muted functional CTA. */
#screen-tasks { color: var(--ds-text-strong); }
#screen-tasks > div:first-child > span:nth-child(2) { color: var(--ds-text-strong) !important; }
#screen-tasks .btn-back { color: var(--ds-text-body); }
#screen-tasks > .card {
  border-color: var(--ds-border-soft) !important;
  color: var(--ds-text-body);
  box-shadow: var(--ds-shadow-card);
}
#screen-tasks > .card:nth-child(2) { background: #eadac9 !important; }
#screen-tasks > .card:nth-child(3) { background: var(--ds-surface-1) !important; }
#screen-tasks > .card:nth-child(4) { background: #f0e6da !important; }
#screen-tasks [style*="color: #fff"] { color: var(--ds-text-strong) !important; }
#screen-tasks [style*="color: #94a3b8"] { color: #6d5e53 !important; }
#screen-tasks [style*="color: #34d399"],
#screen-tasks [style*="color: #facc15"],
#screen-tasks [style*="color: #fbbf24"] { color: #94671f !important; }
#screen-tasks input[type="text"] {
  background: #fffaf3;
  border-color: #c6b3a1;
  color: var(--ds-text-strong);
}
#screen-tasks input[type="text"]::placeholder { color: var(--ds-text-muted); opacity: 1; }
#screen-tasks #btn-watch-ad {
  background: #765b48 !important;
  color: #fffaf3 !important;
  box-shadow: none;
}
#screen-tasks #btn-copy-referral {
  background: linear-gradient(135deg, #b98636, #956527) !important;
  color: #fffaf3 !important;
  box-shadow: none;
}
#screen-tasks .referral-redeem-btn {
  background: #6f7960;
  border-color: #626c55;
  color: #fffaf3;
  box-shadow: none;
}
#screen-tasks .referral-redeem-field { border-top-color: #d4c3b2; }
#screen-tasks .referral-redeem-hint { color: var(--ds-text-muted); }
#screen-tasks .challenge-entry-btn--soon,
#screen-tasks .challenge-entry-btn--soon:disabled {
  background: #d1c4b7 !important;
  border-color: #b9a99a !important;
  color: #594e46 !important;
  opacity: 1;
  box-shadow: none;
}

/* Analytics: warm surfaces only; chart and history geometry stay unchanged. */
#screen-analytics { color: var(--ds-text-strong); }
#screen-analytics > div:first-child > span:nth-child(2) { color: var(--ds-text-strong); }
#screen-analytics .btn-back { color: var(--ds-text-body); }
#screen-analytics .card {
  background: var(--ds-surface-1);
  border-color: var(--ds-border-soft);
  color: var(--ds-text-body);
}
#screen-analytics > .history-section { background: #eee2d5; }
#screen-analytics .card-title { color: var(--ds-text-strong); }
#screen-analytics select {
  background: #fffaf3;
  border-color: #c6b3a1;
  color: var(--ds-text-strong);
  color-scheme: light;
}
#screen-analytics .line-chart-container {
  background: #f0e4d7;
  border: 1px solid #d4c3b2;
}
#screen-analytics .chart-bar { background: #9c816b; }
#screen-analytics .chart-bar.today { background: #b98227; }
#screen-analytics .chart-label,
#screen-analytics .chart-summary-text { color: #6d5e53; }
#screen-analytics .history-date-header {
  color: var(--ds-text-strong);
  border-bottom-color: var(--ds-divider);
}
#screen-analytics .history-date-total { color: #8c6525; }
#screen-analytics .history-item {
  background: #f1e6da;
  border-color: #d4c3b2;
}
#screen-analytics .history-item-clickable:hover {
  background: #e8d8c8;
  border-color: #a98b70;
  box-shadow: 0 8px 20px rgba(74, 55, 40, .12);
}
#screen-analytics .history-item-clickable:focus-visible { outline-color: #9a7658; }
#screen-analytics .history-thumb,
#screen-analytics .history-thumb-placeholder {
  background: #d8c7b6;
  border-color: #bba48f;
}
#screen-analytics .history-item-name,
#screen-analytics .history-item-macros { color: var(--ds-text-strong); }
#screen-analytics .history-item-time { color: var(--ds-text-muted); }
#screen-analytics .history-item-cal.intake { color: #8f651f; }
#screen-analytics .history-item-cal.exercise { color: #5f775f; }
#screen-analytics .history-empty-card {
  background: #f0e4d7;
  border-color: #bba48f;
}
#screen-analytics .history-empty-card .empty-text { color: var(--ds-text-body); }

/* Home lower section: fasting and sponsor presentation follows the same warm system. */
#screen-home .home-fasting-board {
  background: #f0e2d2;
  border-color: #c9a76b;
  color: var(--ds-text-strong);
}
#screen-home .home-fasting-header { color: #805712; }
#screen-home .home-fasting-mode,
#screen-home .home-fasting-elapsed { color: var(--ds-text-strong); }
#screen-home .home-fasting-progress-text,
#screen-home .home-fasting-idle-text { color: #6d5e53; }
#screen-home .home-fasting-next-fast,
#screen-home .home-fasting-board.is-eating .home-fasting-mode,
#screen-home .home-fasting-board.is-eating .home-fasting-elapsed { color: #4f684f; }
#screen-home .home-fasting-progress-bg { background: #d5c1ae; }
#screen-home .home-fasting-progress-fill { background: linear-gradient(90deg, #b98227, #d4a13f); }
#screen-home .home-fasting-board.is-eating .home-fasting-progress-fill { background: linear-gradient(90deg, #687f65, #8da087); }
#screen-home .home-fasting-end-btn {
  background: #d5c6b8;
  color: #4f4137;
  box-shadow: none;
}
#screen-home .btn-fasting-entry {
  background: linear-gradient(135deg, #795d48, #554236);
  border-color: #8f7159;
  color: #fffaf3;
}
#screen-home .btn-fasting-entry > div > div:first-child,
#screen-home .btn-fasting-entry > span { color: #f1c44f !important; }
#screen-home .btn-fasting-entry > div > div:last-child { color: #eadfd4 !important; }
#screen-home .fasting-care-card {
  background: linear-gradient(145deg, #ead7bf, #fff7ed);
  border-color: #c9a76b;
  box-shadow: 0 12px 28px rgba(74, 55, 40, .16);
}
#screen-home .fasting-care-card-title,
#screen-home .fasting-care-card-hour { color: #805712; }
#screen-home .fasting-care-card-body { color: var(--ds-text-body); }
#screen-home .fasting-care-card-close {
  background: #ded0c1;
  border-color: #bba48f;
  color: #5f5147;
}
#screen-home .fasting-care-safety {
  background: #f2dfd8;
  border-color: #c99b8f;
  color: #75463f;
  box-shadow: none;
}
#screen-home .fasting-care-card-btn { background: #b98227; color: #fffaf3; box-shadow: none; }
#screen-home .ad-banner-container {
  background: #e8d8c8;
  border-color: #c6b3a1;
  box-shadow: 0 8px 20px rgba(74, 55, 40, .1);
}
#screen-home .ad-banner-label { color: #6d5e53; }
#screen-home .ad-banner-placeholder {
  background: #f4eadf;
  border-color: #bba48f;
}
#screen-home .ad-banner-placeholder-text { color: #6d5e53; }
#screen-home .ad-banner-container.is-playing .ad-banner-placeholder {
  background: #ead8b9;
  border-color: #b98a37;
}

/* Fasting coach interior: full warm presentation without changing any controls. */
#screen-fasting {
  background: var(--ds-bg-shell);
  color: var(--ds-text-strong);
}
#screen-fasting > div:first-child > span:nth-child(2) { color: #805712 !important; }
#screen-fasting .btn-back { color: var(--ds-text-body); }
#screen-fasting > .card {
  background: var(--ds-surface-1) !important;
  border-color: var(--ds-border-soft) !important;
  color: var(--ds-text-body);
}
#screen-fasting > .fasting-intro-card { background: linear-gradient(145deg, #ead7bf, #fffaf3) !important; }
#screen-fasting .fasting-intro-card > div { color: var(--ds-text-body) !important; }
#screen-fasting .fasting-intro-card b { color: #805712 !important; }
#screen-fasting .card-title { color: var(--ds-text-strong) !important; }
#screen-fasting .fasting-status-card { background: #f0e4d7 !important; border-color: #c9a76b !important; }
#screen-fasting #fasting-status-label { color: #805712 !important; }
#screen-fasting #fasting-phase-label,
#screen-fasting #fasting-window-label,
#screen-fasting #fasting-plan-detail { color: #6d5e53 !important; }
#screen-fasting .fasting-status-ring {
  background: #fffaf3;
  border-color: #bba48f;
  border-top-color: #b98227;
  color: #805712;
}
#screen-fasting .fasting-status-ring.active { border-color: #b98227; }
#screen-fasting .fasting-status-ring.eating { border-color: #6f866c; border-top-color: #91a58d; }
#screen-fasting .fasting-status-ring.eating #fasting-elapsed-hours { color: #4f684f; }
#screen-fasting .fasting-action-btn {
  background: linear-gradient(135deg, var(--ds-cta-primary), #6f523e);
  color: #fffaf3;
  box-shadow: 0 8px 18px rgba(68, 55, 44, .2);
}
#screen-fasting select,
#screen-fasting input[type="date"],
#screen-fasting input[type="time"],
#screen-fasting input[type="datetime-local"] {
  background: #fffaf3;
  border-color: #bba48f;
  color: var(--ds-text-strong);
  color-scheme: light;
}
#screen-fasting .fasting-start-setup-panel,
#screen-fasting .fasting-days-panel,
#screen-fasting .fasting-eating-window-panel { border-color: #cdb9a6; }
#screen-fasting .fasting-datetime-part,
#screen-fasting .fasting-datetime-part--date,
#screen-fasting .fasting-datetime-part--time {
  background: #eee2d5;
  border-color: #c6aa8f;
}
#screen-fasting .fasting-datetime-part-label,
#screen-fasting .fasting-eating-window-label { color: var(--ds-text-body); }
#screen-fasting .fasting-start-mode-option { color: var(--ds-text-body); }
#screen-fasting .fasting-start-mode-option input { accent-color: #a87320; }
#screen-fasting .fasting-start-preview {
  background: #f0e4d7;
  border-color: #d0bdab;
  color: #6d5e53;
}
#screen-fasting .fasting-days-slider { accent-color: #a87320; }
#screen-fasting .fasting-days-slider-label { color: #805712; }
#screen-fasting .fasting-option-btn {
  background: #eee2d5;
  border-color: #c6b3a1;
  color: var(--ds-text-strong);
}
#screen-fasting .fasting-option-highlight {
  background: #ead8b9;
  border-color: #c69b50;
  color: #805712;
}
#screen-fasting .fasting-token-tag { color: #6d5e53; }
#screen-fasting .fasting-option-highlight .fasting-token-tag { color: #805712; opacity: 1; }
#screen-fasting .fasting-timeline-item {
  background: #f0e4d7;
  border-color: #d0bdab;
  color: var(--ds-text-body);
}
#screen-fasting .fasting-timeline-item .tl-time,
#screen-fasting .fasting-timeline-empty { color: #6d5e53; }
#screen-fasting #fasting-reply-box {
  background: #fffaf3 !important;
  border-color: #c9a76b !important;
}
#screen-fasting #fasting-reply-title { color: #805712 !important; }
#screen-fasting #fasting-reply-content { color: var(--ds-text-body) !important; }

@media (max-height: 700px) {
  .onboarding { padding-top: 22px; }
  .onboarding-progress { margin: 18px 0 15px; }
  .onboarding-copy { min-height: 140px; }
  .onboarding-step { min-height: 145px; }
}

/* ========== Home 2.0 B visual calibration · 母圖對齊 ==========
   母圖量測基準（606x1024 原圖 × 0.644 換算成 390 寬設計稿）：
     內容寬 366 / 卡片圓角 ~20
     核心卡 157（母圖另有提醒條 30，本專案無）
     圓環 138 = 卡寬 37.7%；右側營養區 167 = 卡寬 45.8%
     主數字 ~33px；macro label 12px 單行；進度條 高 5-6 長 ~104
     三小卡 95 / 入口卡 73 / 榮譽卡 72 / nav 64 / 中央相機 50
     頁底 #f0d8c0、卡片 #fbefe1、accent #fd7d22、nav #ebd3b9
     bar 軌 #efddcf、macro 副色 橘 / 橘 / 青綠 #5aa5a1
   本輪只做視覺校正：不動 app.js、不動資訊架構、不重構歷史 CSS。
   所有規則限定在 #screen-home 與 nav。 */
.home-v2-parked { display: none; }
.home-v2-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;
}

body:has(#screen-home:not(.hidden)) {
  background:
    radial-gradient(circle at 50% 6%, #fdeedd 0%, #f4ddc6 46%, #ecd0b3 100%);
}
.phone-container:has(#screen-home:not(.hidden)) {
  /* 母圖取樣的暖奶茶關係：頁底比卡片暗一階，卡片是奶油白而非純白 */
  --hb-page: #f2dac2;
  --hb-card: #fdf4e9;
  --hb-line: rgba(212, 165, 126, 0.34);
  --hb-shadow: 0 14px 30px rgba(186, 124, 82, 0.13);
  --hb-ink: #33241a;
  --hb-ink-2: #6d5342;
  --hb-ink-3: #a58872;
  --hb-ink-4: #c2a68f;
  --hb-accent: #f5822c;
  --hb-accent-deep: #e8701c;
  --hb-track: #efddcf;
  background:
    radial-gradient(ellipse at 50% 16%, rgba(253, 155, 84, 0.16), transparent 46%),
    var(--hb-page);
  border-color: rgba(212, 165, 126, 0.42);
  box-shadow: 0 24px 48px rgba(176, 116, 74, 0.18);
}
.phone-container:has(#screen-home:not(.hidden)) header {
  padding: 11px 16px;
  background: rgba(250, 236, 220, 0.9);
  border-bottom-color: rgba(212, 165, 126, 0.3);
}
.phone-container:has(#screen-home:not(.hidden)) main {
  overflow: hidden;
  padding: 10px 12px 70px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.phone-container:has(#screen-home:not(.hidden)) nav {
  height: 70px;
  background: rgba(240, 219, 196, 0.94);
  border-top: 1px solid rgba(212, 165, 126, 0.4);
  box-shadow: 0 -10px 26px rgba(176, 116, 74, 0.09);
  backdrop-filter: blur(16px);
}
.phone-container:has(#screen-home:not(.hidden)) .nav-item {
  color: #ab8b72;
  font-size: 11px;
  font-weight: 650;
  gap: 4px;
  padding-bottom: 2px;
}
.phone-container:has(#screen-home:not(.hidden)) .nav-item.active {
  color: var(--hb-accent);
}
.phone-container:has(#screen-home:not(.hidden)) .nav-icon {
  width: 21px;
  height: 21px;
  display: grid;
  place-items: center;
}
.phone-container:has(#screen-home:not(.hidden)) .nav-icon svg {
  width: 21px;
  height: 21px;
  display: block;
}

#screen-home {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
  overflow: hidden;
  color: var(--hb-ink);
}

#screen-home .home-companion-card {
  flex: 0 0 auto;
  padding: 4px 4px 2px;
}
.home-companion-kicker,
.home-companion-title,
.home-companion-body,
.home-companion-metric {
  animation: home-companion-rise 0.55s ease both;
}
.home-companion-kicker {
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: 0.05em;
  color: #bd8462;
  animation-delay: 0.05s;
}
.home-companion-title {
  /* 母圖是「2 行 21px 粗體」的字塊；我們是單行長句，改用 30px 補回同等質量 */
  margin: 8px 0 9px;
  font-size: 30px;
  line-height: 1.14;
  letter-spacing: -0.045em;
  color: var(--hb-ink);
  animation-delay: 0.12s;
}
.home-companion-body {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--hb-ink-3);
  animation-delay: 0.2s;
}
.home-companion-metric {
  margin-top: 7px;
  font-size: 10.5px;
  letter-spacing: 0.01em;
  color: var(--hb-ink-4);
  animation-delay: 0.28s;
}
@keyframes home-companion-rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

#screen-home .home-calorie-card,
#screen-home .home-calorie-card.ds-card--calorie {
  flex: 1 1 0;
  min-height: 0;
  margin: 0;
  padding: 14px 13px;
  gap: 0;
  border-radius: 24px;
  background: var(--hb-card);
  border: 1px solid var(--hb-line);
  box-shadow: var(--hb-shadow);
}
.home-calorie-core {
  /* 母圖 圓環:營養區 = 37.7% : 45.8%；本機寬度較窄，取 47% : 41% 折衷 */
  display: grid;
  grid-template-columns: 176px minmax(0, 1fr);
  gap: 13px;
  align-items: center;
  height: 100%;
  min-height: 0;
}

.home-ring {
  position: relative;
  width: 176px;
  height: 176px;
  margin: 0 auto;
}
/* 母圖圓環外圈沒有 0/25/50/75 數字，收掉避免 debug widget 感（DOM 保留） */
.home-ring-marks { display: none; }
.home-ring-scale,
.home-ring-track,
.home-ring-hole {
  position: absolute;
  inset: 8px;
  border-radius: 50%;
}
.home-ring-scale {
  background:
    repeating-conic-gradient(from -90deg, rgba(202, 160, 124, 0.3) 0 0.55deg, transparent 0.55deg 18deg);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 8px), #000 calc(100% - 7px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 8px), #000 calc(100% - 7px));
}
.home-ring-track {
  background: conic-gradient(from -90deg, #ecd5bd 0 100%);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 14px), #000 calc(100% - 13px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 14px), #000 calc(100% - 13px));
}
.home-ring-band,
.home-ring-zone {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 14px), #000 calc(100% - 13px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 14px), #000 calc(100% - 13px));
}
.home-ring-band {
  /* 母圖光帶約覆蓋 12 點順時鐘 50%+，由淺暖橘漸深到 #fd7d22 */
  background: conic-gradient(
    from -90deg,
    #ffd6a8 0deg,
    #ffb45f 62deg,
    #fd9130 132deg,
    #f5771b 186deg,
    transparent 188deg 360deg
  );
  filter: drop-shadow(0 0 8px rgba(245, 130, 44, 0.26));
}
.home-ring-zone {
  background: conic-gradient(
    from -90deg,
    transparent 0 248deg,
    rgba(253, 155, 84, 0.16) 248deg,
    #ffab55 262deg,
    #f5822c 292deg,
    rgba(253, 155, 84, 0.16) 304deg,
    transparent 306deg 360deg
  );
  filter: drop-shadow(0 0 10px rgba(245, 130, 44, 0.4));
}
.home-ring-tick {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: #fff6ea;
  box-shadow: 0 0 7px rgba(245, 130, 44, 0.85);
}
.home-ring-tick--a { transform: rotate(258deg) translateY(-73px); }
.home-ring-tick--b { transform: rotate(300deg) translateY(-73px); }
.home-ring-hole {
  /* 母圖沒有白色內圓，中央直接是卡片底色，文字寬度因此不被內圓限制 */
  inset: 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: transparent;
  text-align: center;
}
/* 內圈文字堆疊必須壓在圓內緣的弦長內，否則最後一行會壓到光帶 */
.home-ring-label {
  font-size: 11px;
  font-weight: 650;
  line-height: 1.3;
  color: var(--hb-ink-3);
}
.home-ring-value {
  margin: 2px 0 0;
  font-size: 39px;
  font-weight: 860;
  letter-spacing: -0.05em;
  line-height: 0.94;
  color: var(--hb-ink);
}
.home-ring-unit {
  margin-top: 1px;
  font-size: 11.5px;
  font-weight: 650;
  line-height: 1.25;
  color: var(--hb-ink-3);
}
.home-ring-intake {
  margin-top: 4px;
  font-size: 9.5px;
  line-height: 1.25;
  letter-spacing: -0.01em;
  white-space: nowrap;
  color: var(--hb-ink-4);
}

.home-macros {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 24px;
  padding-right: 2px;
}
#screen-home .home-calorie-card .home-protein-card,
#screen-home .home-calorie-card .ds-card--protein {
  background: transparent;
  border: 0;
  box-shadow: none;
  border-radius: 0;
  padding: 0;
}
.home-macro-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
}
.home-macro-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 14px;
  line-height: 1;
}
/* 母圖 macro 副色是 橘 / 橘黃 / 青綠，不是粉 / 紫 / 黃 */
.home-macro-icon--protein { background: #fbe1c2; }
.home-macro-icon--carbs { background: #f9ebcd; }
.home-macro-icon--fat { background: #d8ebe8; }
.home-macro-copy { min-width: 0; }
#screen-home .home-calorie-card .home-protein-top {
  gap: 8px;
  margin-bottom: 7px;
}
#screen-home .home-calorie-card .home-protein-title {
  font-size: 12.5px;
  font-weight: 750;
  line-height: 1.25;
  white-space: nowrap;
  color: var(--hb-ink-2);
}
#screen-home .home-calorie-card .home-protein-value {
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--hb-ink-3);
}
#screen-home .home-calorie-card .home-protein-progress-bg,
.home-macro-progress-bg {
  margin-top: 0;
  height: 7px;
  background: var(--hb-track);
  border-radius: 999px;
}
#screen-home .home-calorie-card .home-protein-progress-fill {
  background: linear-gradient(90deg, #ffb156, #f5822c);
}
.home-macro-progress-fill--carbs { background: linear-gradient(90deg, #ffcd77, #f0a12b); }
.home-macro-progress-fill--fat { background: linear-gradient(90deg, #93c9c4, #5aa5a1); }

.home-health-trio {
  flex: 0 0 116px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 11px;
  min-height: 0;
}
.home-mini-stat {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: 12px 11px 11px;
  border-radius: 22px;
  background: var(--hb-card);
  border: 1px solid var(--hb-line);
  box-shadow: var(--hb-shadow);
}
.home-mini-stat-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 15px;
  line-height: 1;
}
.home-mini-stat--steps .home-mini-stat-icon { background: #ffe1c6; }
.home-mini-stat--sleep .home-mini-stat-icon { background: #e6ddf7; }
.home-mini-stat--heat .home-mini-stat-icon { background: #ffd8c2; }
.home-mini-stat-label {
  margin-top: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--hb-ink-3);
}
.home-mini-stat-value {
  margin-top: 3px;
  font-size: 25px;
  font-weight: 860;
  letter-spacing: -0.045em;
  color: var(--hb-ink);
  line-height: 1.04;
  white-space: nowrap;
}
.home-mini-stat-target {
  margin-top: 2px;
  font-size: 10.5px;
  color: var(--hb-ink-4);
}
.home-mini-stat.is-complete {
  box-shadow: inset 0 0 0 1px rgba(245, 130, 44, 0.35);
}

#screen-home .home-diet-entry {
  /* 母圖入口卡 73 高；主體是奶油白卡片，珊瑚橘只做 icon / 箭頭 accent */
  flex: 0 0 68px;
  min-height: 68px;
  justify-content: space-between;
  padding: 0 18px;
  border: 1px solid var(--hb-line);
  border-radius: 22px;
  background: var(--hb-card);
  color: var(--hb-ink);
  font-size: 16.5px;
  font-weight: 800;
  letter-spacing: 0.01em;
  box-shadow: var(--hb-shadow);
}
.home-diet-icon,
.home-diet-arrow {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: 0 0 32px;
}
.home-diet-icon {
  background: #fde3c8;
}
.home-diet-icon::before {
  content: "";
  width: 13px;
  height: 11px;
  border: 1.8px solid var(--hb-accent);
  border-radius: 3px;
  box-shadow: 0 -2px 0 0 var(--hb-accent);
}
.home-diet-label { flex: 1; text-align: center; }
.home-diet-arrow {
  background: transparent;
  color: var(--hb-accent);
}
.home-diet-arrow::before {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--hb-accent);
  border-top: 2px solid var(--hb-accent);
  transform: rotate(45deg);
  margin-left: -2px;
}

.home-kings-entry {
  flex: 0 0 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 18px;
  border-radius: 22px;
  background: var(--hb-card);
  border: 1px solid var(--hb-line);
  box-shadow: var(--hb-shadow);
}
.home-kings-slide {
  min-width: 0;
  flex: 1;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  column-gap: 12px;
  align-items: center;
}
.home-kings-kind {
  grid-column: 1;
  font-size: 12px;
  font-weight: 750;
  color: var(--hb-ink-3);
  white-space: nowrap;
}
.home-kings-name {
  grid-column: 1;
  margin-top: 2px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--hb-ink);
}
.home-kings-score {
  grid-column: 2;
  grid-row: 1 / span 2;
  font-size: 27px;
  font-weight: 860;
  letter-spacing: -0.035em;
  white-space: nowrap;
  color: var(--hb-accent);
}
.home-kings-dots {
  display: flex;
  gap: 5px;
  flex-shrink: 0;
}
.home-kings-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #e6cfb6;
}
.home-kings-dots span.is-active { background: var(--hb-accent); }

.nav-camera {
  /* 母圖中央相機 50（螢幕寬 12.8%）；本機取 58 以維持觸控面積 */
  flex: 0 0 58px;
  width: 58px;
  height: 58px;
  min-height: 58px;
  margin: 0 2px 13px;
  padding: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: linear-gradient(150deg, #ff9c46, #f5761b);
  color: #fff8ee;
  box-shadow: 0 12px 24px rgba(245, 130, 44, 0.4);
}
.nav-camera-glyph {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
}
.nav-camera-glyph svg { width: 25px; height: 25px; display: block; }
.nav-camera > span:nth-child(2),
.nav-camera > span:nth-child(3) { display: none; }

/* 矮螢幕（standalone 下 viewport == 手機高）：等比縮小圓環，避免核心卡切到光帶 */
@media (max-height: 745px) {
  #screen-home { gap: 8px; }
  #screen-home .home-companion-card { padding: 2px 4px; }
  .home-companion-title { font-size: 25px; margin: 6px 0 7px; }
  .home-companion-body { font-size: 12px; }
  #screen-home .home-calorie-card,
  #screen-home .home-calorie-card.ds-card--calorie { padding: 12px 13px; }
  .home-calorie-core { grid-template-columns: 150px minmax(0, 1fr); gap: 12px; }
  .home-ring { width: 150px; height: 150px; }
  .home-ring-hole { inset: 18px; }
  .home-ring-tick--a { transform: rotate(258deg) translateY(-60px); }
  .home-ring-tick--b { transform: rotate(300deg) translateY(-60px); }
  .home-ring-label { font-size: 10.5px; }
  .home-ring-value { font-size: 32px; }
  .home-ring-unit { font-size: 10.5px; }
  .home-ring-intake { font-size: 9px; margin-top: 3px; }
  .home-macros { gap: 18px; }
  .home-health-trio { flex-basis: 98px; }
  .home-mini-stat { padding: 9px 10px; }
  .home-mini-stat-value { font-size: 22px; }
  #screen-home .home-diet-entry { flex-basis: 56px; min-height: 56px; }
  .home-kings-entry { flex-basis: 60px; }
  .home-kings-score { font-size: 24px; }
}

/* iPhone SE 級別的矮螢幕 */
@media (max-height: 690px) {
  #screen-home { gap: 7px; }
  .home-companion-title { font-size: 23px; margin: 5px 0 6px; }
  .home-companion-metric { margin-top: 5px; font-size: 10px; }
  #screen-home .home-calorie-card,
  #screen-home .home-calorie-card.ds-card--calorie { padding: 10px 12px; }
  .home-calorie-core { grid-template-columns: 132px minmax(0, 1fr); gap: 11px; }
  .home-ring { width: 132px; height: 132px; }
  .home-ring-hole { inset: 15px; }
  .home-ring-tick--a { transform: rotate(258deg) translateY(-51px); }
  .home-ring-tick--b { transform: rotate(300deg) translateY(-51px); }
  .home-ring-label { font-size: 10px; }
  .home-ring-value { margin-top: 0; font-size: 28px; }
  .home-ring-unit { margin-top: 0; font-size: 10px; }
  .home-ring-intake { margin-top: 2px; font-size: 8.5px; }
  .home-macros { gap: 14px; }
  .home-health-trio { flex-basis: 92px; gap: 9px; }
  .home-mini-stat-value { font-size: 20px; }
  #screen-home .home-diet-entry { flex-basis: 52px; min-height: 52px; font-size: 15.5px; }
  .home-kings-entry { flex-basis: 56px; }
  .home-kings-name { font-size: 16px; }
  .home-kings-score { font-size: 22px; }
}

/* ========== Home B · approved 2026-08-24 master ========== */
.home-b-parked { display: none; }
.home-b-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;
}

body:has(#screen-home:not(.hidden)) {
  background: #f7e7d7;
}
.phone-container:has(#screen-home:not(.hidden)) {
  --home-b-page: #fff3e8;
  --home-b-card: rgba(255, 252, 248, 0.92);
  --home-b-card-soft: rgba(255, 248, 241, 0.82);
  --home-b-border: rgba(174, 128, 96, 0.16);
  --home-b-ink: #24201e;
  --home-b-muted: #746d69;
  --home-b-accent: #ff5a16;
  --home-b-accent-soft: #ffab72;
  --home-b-track: #f3e4da;
  --home-b-teal: #50bbb9;
  background:
    radial-gradient(circle at 88% 5%, rgba(255, 243, 231, 0.96), transparent 31%),
    radial-gradient(circle at 10% 13%, rgba(255, 246, 237, 0.92), transparent 42%),
    linear-gradient(180deg, #fff5eb 0%, #fff0e3 58%, #fae9da 100%);
  border-color: rgba(174, 128, 96, 0.2);
  color: var(--home-b-ink);
}
.phone-container:has(#screen-home:not(.hidden)) > header {
  display: none;
}
.phone-container:has(#screen-home:not(.hidden)) main {
  min-height: 0;
  padding: 14px 10px calc(68px + env(safe-area-inset-bottom));
  overflow: hidden;
}
.phone-container:has(#screen-home:not(.hidden)) nav {
  height: calc(60px + env(safe-area-inset-bottom));
  padding: 0 8px env(safe-area-inset-bottom);
  align-items: center;
  background: rgba(250, 229, 210, 0.96);
  border: 0;
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -7px 24px rgba(149, 104, 73, 0.1);
  backdrop-filter: blur(18px);
}
.phone-container:has(#screen-home:not(.hidden)) .nav-item {
  align-self: stretch;
  justify-content: center;
  padding: 5px 0 3px;
  gap: 2px;
  color: #1f1c1a;
  font-size: 14px;
  font-weight: 600;
}
.phone-container:has(#screen-home:not(.hidden)) .nav-item.active { color: var(--home-b-accent); }
.phone-container:has(#screen-home:not(.hidden)) .nav-icon,
.phone-container:has(#screen-home:not(.hidden)) .nav-icon svg {
  width: 23px;
  height: 23px;
}

#screen-home {
  --home-wide-title-inset: 22px;
  --home-wide-content-inset: 34px;
  height: 100%;
  min-height: 0;
  gap: 7px;
  overflow: hidden;
  color: var(--home-b-ink);
}
#screen-home h1,
#screen-home h2,
#screen-home h3,
#screen-home p { margin: 0; }

.home-b-hero {
  --home-b-companion-copy-size: 23px;
  --home-b-companion-line-gap: 0.875px;
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: var(--home-b-companion-line-gap);
  padding: 10px 10px 0;
}
.home-b-hero > :not(.home-b-step) { position: relative; top: 0; }
.home-b-greeting-row,
.home-b-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.home-b-greeting-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
}
.home-b-greeting {
  color: #716e6c;
  font-size: 20px;
  font-weight: 780;
  letter-spacing: 0.04em;
}
.home-b-notification {
  position: relative;
  width: 34px;
  height: 35px;
  display: grid;
  place-items: center;
  color: #171514;
  line-height: 1;
}
.home-b-notification svg {
  width: 30px;
  height: 32px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.home-b-notification i {
  position: absolute;
  top: 1px;
  right: -1px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f42117;
}
.home-b-title-row { margin-top: 6px; align-items: center; }
.home-b-title {
  flex: 1;
  min-width: 0;
  color: var(--home-b-ink);
  font-size: var(--home-b-companion-copy-size);
  font-weight: 800;
  line-height: 1.35;
  letter-spacing: -0.02em;
  white-space: pre-line;
}
.home-b-bridge {
  margin-top: 0 !important;
  color: var(--home-b-ink);
  font-size: var(--home-b-companion-copy-size);
  font-weight: 800;
  line-height: 1.35;
}
.home-b-bridge:empty { display: none; }
.home-b-yesterday {
  margin-top: 1em !important;
  padding-left: 2px;
  color: #77716e;
  font-size: 17px;
  font-weight: 650;
  line-height: 1.35;
}
#screen-home .home-health-sync-badge {
  flex: 0 0 auto;
  width: 34px;
  min-width: 34px;
  max-width: 34px;
  min-height: 34px;
  padding: 0;
  justify-content: center;
  gap: 7px;
  border: 0;
  border-radius: 50%;
  box-shadow: none;
  color: #bc4a2e;
  background: rgba(255, 226, 210, 0.74);
}
#screen-home .home-health-sync-device { font-size: 20px; line-height: 1; }
#screen-home .home-health-sync-badge--online { color: #2f7d5a; background: #d7eedc; }
#screen-home .home-health-sync-badge--offline { color: #b85136; background: #f6c9b7; }

.home-b-block,
.home-b-wide-card,
.home-mini-stat {
  border: 1px solid var(--home-b-border);
  background: var(--home-b-card);
  box-shadow: 0 6px 18px rgba(141, 95, 63, 0.045);
}
.home-b-goal-block {
  position: relative;
  flex: 1 1 0;
  min-height: 220px;
  border-radius: 18px;
}
.home-b-section-heading {
  height: 40px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 9px 0 25px;
}
.home-b-section-heading h2,
.home-b-wide-card h2,
.home-b-wide-heading {
  font-size: 15px;
  font-weight: 850;
  line-height: 1.2;
  color: #11100f;
}
.home-b-step {
  position: absolute;
  left: -7px;
  top: 7px;
  width: 25px;
  height: 25px;
  display: none;
  place-items: center;
  border: 5px solid rgba(255, 255, 255, 0.94);
  border-radius: 50%;
  background: linear-gradient(145deg, #ffca87, #ff8d48);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  box-sizing: content-box;
  box-shadow: 0 3px 8px rgba(255, 117, 37, 0.15);
}
html[data-snappacer-build-mode="test"] .home-b-step { display: grid; }
.home-b-edit {
  margin-left: auto;
  border: 0;
  border-radius: 18px;
  padding: 6px 11px;
  background: #fff0e6;
  color: #cd5138;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}
.home-b-goal-card {
  height: 100%;
  margin-top: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.home-b-goal-main {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(160px, 1fr);
  align-items: center;
  align-content: center;
  gap: 8px;
  padding: 5px 12px 4px;
}
.home-ring {
  --home-ring-progress: 0deg;
  position: relative;
  width: min(180px, calc(100% + 4px));
  height: auto;
  aspect-ratio: 1;
  margin: 0;
  justify-self: center;
  align-self: center;
  transform: none;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, transparent 59%, rgba(255, 255, 255, 0.42) 60% 63%, transparent 64%),
    conic-gradient(from -90deg, var(--home-b-accent) 0 var(--home-ring-progress), #f7c4a8 var(--home-ring-progress) 360deg);
  box-shadow: inset 0 0 0 1px rgba(211, 144, 102, 0.12);
}
.home-ring::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: var(--home-b-card);
}
.home-ring-hole {
  position: absolute;
  inset: 27px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--home-b-ink);
}
.home-ring-label {
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
}
.home-ring-value {
  margin-top: 5px;
  font-size: 38px;
  font-weight: 900;
  letter-spacing: -0.045em;
  line-height: 0.95;
}
.home-ring-target {
  margin-top: 4px;
  font-size: 14px;
  line-height: 1.1;
}
.home-ring-intake {
  margin-top: 7px;
  color: #655e5a;
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
}
.home-ring[data-balance-state="exceeded"] .home-ring-label,
.home-ring[data-balance-state="exceeded"] .home-ring-value { color: #8f4e3d; }

.home-macros {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  padding-right: 2px;
}
.home-macro-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}
.home-macro-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-size: 15px;
  font-weight: 900;
}
.home-macro-icon--protein { background: #ffa367; }
.home-macro-icon--carbs { background: #f7b365; }
.home-macro-icon--fat { background: #58bbb8; }
.home-macro-copy { min-width: 0; }
#screen-home .home-protein-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 5px;
  margin: 0 0 5px;
}
#screen-home .home-protein-title,
#screen-home .home-protein-value {
  color: #24201e;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}
#screen-home .home-protein-value { font-size: 13px; text-align: right; }
#screen-home .home-protein-progress-bg,
#screen-home .home-macro-progress-bg {
  height: 7px;
  margin: 0;
  border: 1px solid rgba(199, 153, 124, 0.1);
  background: var(--home-b-track);
  border-radius: 999px;
}
#screen-home .home-protein-progress-fill {
  background: linear-gradient(90deg, #ff5715, #ffb46d);
}
#screen-home .home-macro-progress-fill--carbs,
#screen-home .home-macro-progress-fill--fat { width: 0; }

.home-b-reminder {
  flex: 0 0 34px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 13px;
  border-top: 1px solid rgba(194, 148, 117, 0.12);
  border-radius: 14px;
  background: rgba(255, 249, 243, 0.88);
  color: #151311;
  font-size: 13px;
}
.home-b-reminder > span { color: var(--home-b-accent); font-size: 22px; }
.home-b-reminder strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-b-reminder[data-tone="neutral"] { color: #675c56; }

.home-health-trio {
  position: relative;
  flex: 0 0 110px;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 31fr) minmax(0, 31fr) minmax(0, 38fr);
  gap: 7px;
}
.home-health-trio > .home-b-step { top: 4px; z-index: 2; }
.home-mini-stat {
  min-width: 0;
  height: 100%;
  display: grid;
  grid-template-rows: 17px 27px 24px;
  align-content: center;
  justify-content: stretch;
  padding: 7px 6px 6px;
  border-radius: 17px;
  overflow: hidden;
}
.home-mini-stat h3 {
  display: inline-flex;
  align-items: center;
  justify-self: center;
  gap: 3px;
  max-width: 100%;
  color: #171513;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.1;
  text-align: center;
  white-space: nowrap;
}
.home-mini-stat--energy h3 { padding-left: 0; }
.home-mini-stat-reading {
  min-width: 0;
  width: 100%;
  align-self: center;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 2px;
  margin-top: 4px;
  transform: translateY(3px);
  white-space: nowrap;
}
.home-mini-stat h3 .home-mini-stat-icon {
  flex: 0 0 auto;
  width: auto;
  height: auto;
  color: var(--home-b-accent);
  background: transparent;
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
}
.home-mini-stat--sleep h3 .home-mini-stat-icon { color: var(--b-success); transform: rotate(-8deg); }
.home-mini-stat--steps h3 .home-mini-stat-icon { color: var(--hb-ink-2); }
.home-mini-stat--steps .home-mini-stat-icon svg {
  width: 28px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.home-mini-stat-reading strong {
  min-width: 0;
  max-width: 100%;
  color: #090807;
  font-size: 16px;
  font-weight: 700;
  overflow: visible;
  text-overflow: clip;
  letter-spacing: -0.04em;
  line-height: 1;
}
.home-mini-stat-reading > span:last-child { flex: 0 0 auto; font-size: 11px; font-weight: 400; }
.home-mini-stat p {
  margin-top: 5px;
  color: #645d59;
  font-size: 10px;
  font-weight: 400;
  line-height: 1.1;
  text-align: center;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
}
.home-b-wide-card {
  position: relative;
  flex: 0 0 auto;
  width: 100%;
  box-sizing: border-box;
  border-radius: 17px;
  color: var(--home-b-ink);
}
.home-b-section-shell {
  flex: 0 0 auto;
  width: 100%;
}
.home-b-task-card,
.home-b-insight-card,
.home-b-headline-card {
  padding-left: var(--home-wide-title-inset);
  padding-right: 18px;
}
.home-b-task-card > strong,
.home-b-task-card > small,
.home-b-insight-card > strong,
.home-b-insight-card > p,
.home-b-headline-row {
  margin-left: var(--home-wide-content-inset);
}
.home-b-task-card {
  height: 80px;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto 1fr auto;
  padding-top: 8px;
  padding-bottom: 8px;
  text-align: left;
  cursor: pointer;
}
.home-b-task-card .home-b-step,
.home-b-insight-card .home-b-step,
.home-b-headline-card .home-b-step { top: 5px; }
.home-b-wide-heading { align-self: start; }
.home-b-wide-link {
  color: #171513;
  font-size: 12px;
  text-align: right;
}
.home-b-task-card > strong {
  align-self: end;
  color: #050403;
  font-size: 19px;
  font-weight: 900;
  line-height: 1.1;
}
.home-b-task-card > small {
  grid-column: 1;
  color: #38322f;
  font-size: 12px;
}
.home-b-task-action {
  grid-column: 2;
  grid-row: 2 / span 2;
  align-self: center;
  color: #c7b7ac;
  font-size: 18px;
}
.home-b-insight-card {
  height: 82px;
  padding-top: 8px;
  padding-bottom: 8px;
}
.home-b-insight-card::after {
  content: "";
  position: absolute;
  right: 42px;
  bottom: 8px;
  width: 60px;
  height: 42px;
  opacity: 0.22;
  background: radial-gradient(ellipse at center, #e8d5c5 0 28%, transparent 30%) 0 0 / 17px 13px;
  transform: rotate(-18deg);
  pointer-events: none;
}
.home-b-insight-card > strong {
  position: relative;
  z-index: 1;
  display: block;
  margin-top: 5px;
  overflow: hidden;
  color: #090807;
  font-size: 18px;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.home-b-insight-card p {
  position: relative;
  z-index: 1;
  margin-top: 4px;
  overflow: hidden;
  color: #322d2a;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.home-b-headline-card {
  height: 62px;
  padding-top: 8px;
  padding-bottom: 7px;
}
.home-b-headline-card > h2 { padding-left: 0; }
.home-b-headline-row {
  display: grid;
  grid-template-columns: 1fr 1.15fr auto 8px;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
}
.home-b-headline-kind { font-size: 15px; white-space: nowrap; }
.home-b-headline-name {
  overflow: hidden;
  color: #050403;
  font-size: 25px;
  font-weight: 900;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.home-b-headline-row > span { white-space: nowrap; }
.home-b-headline-row > span strong { font-size: 23px; }
.home-b-headline-row > span small { margin-left: 3px; font-size: 12px; }

#screen-home + #screen-camera { color: inherit; }
.nav-camera {
  flex: 0 0 58px;
  width: 58px;
  height: 58px;
  min-height: 58px;
  margin: -10px 4px 2px;
  padding: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(150deg, #ff9b53, #ff7a3e);
  box-shadow: 0 9px 19px rgba(255, 103, 38, 0.3);
}
.nav-camera-glyph,
.nav-camera-glyph svg { width: 28px; height: 28px; }
.nav-camera > span:nth-child(2),
.nav-camera > span:nth-child(3) { display: none; }

@media (max-height: 860px) {
  .phone-container:has(#screen-home:not(.hidden)) main { padding-top: 16px; }
  #screen-home { gap: 2px; }
  .home-b-hero { flex: 1 1 0; padding-top: 4px; }
  .home-b-title-row { margin-top: 6px; }
  .home-b-yesterday { margin-top: 1em !important; }
  #screen-home .home-health-sync-badge { min-width: 34px; min-height: 34px; padding: 0; }
  .home-b-goal-block { min-height: 196px; }
  .home-b-section-heading { height: 36px; }
  .home-b-goal-main { grid-template-columns: minmax(140px, 1fr) minmax(160px, 1fr); gap: 6px; padding: 4px 10px; }
  .home-ring { width: min(158px, calc(100% + 4px)); transform: none; }
  .home-ring-hole { inset: 20px; }
  .home-ring-value { font-size: 33px; }
  .home-macros { gap: 8px; }
  .home-macro-icon { width: 29px; height: 29px; }
  .home-macro-row { grid-template-columns: 31px minmax(0, 1fr); gap: 7px; }
  .home-b-reminder { flex-basis: 32px; }
  .home-health-trio {
    flex-basis: 98px;
  }
  .home-mini-stat { padding: 6px 4px 5px; }
  .home-mini-stat-reading { gap: 0; margin-top: 0; }
  .home-mini-stat h3 .home-mini-stat-icon { font-size: 14px; }
  .home-mini-stat--steps .home-mini-stat-icon svg { width: 20px; height: 15px; }
  .home-mini-stat-reading strong { font-size: 16px; }
  .home-b-task-card,
  .home-b-insight-card,
  .home-b-headline-card { padding-top: 5px; padding-bottom: 5px; }
  .home-b-section-heading h2,
  .home-b-wide-card h2,
  .home-b-wide-heading { line-height: 1; }
  .home-b-task-card { height: 72px; }
  .home-b-task-card > strong { font-size: 17px; }
  .home-b-insight-card { height: 74px; }
  .home-b-insight-card > strong { margin-top: 4px; font-size: 16px; }
  .home-b-headline-card { height: 54px; }
  .home-b-headline-row { margin-top: 0; line-height: 1; }
  .home-b-headline-name { font-size: 22px; }
}

@media (max-width: 360px) {
  .home-b-hero { --home-b-companion-copy-size: 22px; }
  #screen-home .home-health-sync-badge { min-width: 34px; max-width: 34px; }
  .home-b-goal-main { grid-template-columns: minmax(130px, 1fr) minmax(154px, 1fr); gap: 4px; padding-left: 8px; padding-right: 8px; }
  .home-ring { width: min(140px, calc(100% + 2px)); }
  .home-macro-icon { width: 28px; height: 28px; }
  .home-macro-row { grid-template-columns: 29px minmax(0, 1fr); gap: 5px; }
  #screen-home .home-protein-title { font-size: 13px; }
  #screen-home .home-protein-value { font-size: 12px; }
  #screen-home .home-protein-progress-bg,
  #screen-home .home-macro-progress-bg { height: 6px; }
  .home-b-reminder { flex-basis: 32px; font-size: 12px; }
  .home-mini-stat { padding-left: 4px; padding-right: 4px; }
  .home-mini-stat-reading strong { font-size: 16px; }
}

/* Snap Pacer B shared app theme */
:root {
  /* Home B is the visual source of truth for every in-app surface. */
  --b-page-bg: #fff3e8;
  --b-surface: rgba(255, 252, 248, 0.92);
  --b-surface-soft: rgba(255, 248, 241, 0.82);
  --b-text-primary: #24201e;
  --b-text-secondary: #746d69;
  --b-text-disabled: #a8968c;
  --b-border: rgba(174, 128, 96, 0.16);
  --b-accent: #ff5a16;
  --b-accent-soft: #ffab72;
  --b-danger: #b9556c;
  --b-success: #667f66;
  --b-radius-card: 18px;
  --b-radius-control: 14px;
  --b-shadow-card: 0 6px 18px rgba(141, 95, 63, 0.045);
  --b-type-hero: 25px;
  --b-type-page-title: 20px;
  --b-type-section-title: 15px;
  --b-type-card-title: 13px;
  --b-type-primary-value: 22px;
  --b-type-body: 14px;
  --b-type-secondary: 12px;
  --b-type-caption: 10px;
}

body {
  background: var(--app-page-background);
  color: var(--b-text-primary);
}
body:has(#screen-home:not(.hidden)) {
  background: var(--app-page-background);
}
.phone-container {
  --ds-bg-shell: var(--b-page-bg);
  --ds-surface-1: var(--b-surface);
  --ds-surface-2: var(--b-surface-soft);
  --ds-border-soft: var(--b-border);
  --ds-divider: rgba(174, 128, 96, 0.18);
  --ds-progress-track: #f3e4da;
  --ds-text-strong: var(--b-text-primary);
  --ds-text-body: #514944;
  --ds-text-muted: var(--b-text-secondary);
  --ds-brand-coral: var(--b-accent);
  --ds-brand-apricot: var(--b-accent-soft);
  --ds-cta-primary: var(--b-accent);
  --ds-cta-primary-hover: #e94d10;
  --ds-nav-surface: rgba(250, 229, 210, 0.96);
  --ds-nav-selected: var(--b-accent);
  --ds-radius-card: var(--b-radius-card);
  --ds-radius-control: var(--b-radius-control);
  --ds-shadow-card: var(--b-shadow-card);
  background: var(--app-page-background);
  border-color: rgba(174, 128, 96, 0.2);
  color: var(--b-text-primary);
  box-shadow: 0 24px 48px rgba(149, 104, 73, 0.14);
}
.phone-container:has(#screen-home:not(.hidden)) {
  background: var(--app-page-background);
}
.phone-container > header {
  background: rgba(255, 246, 237, 0.94);
  border-bottom-color: rgba(174, 128, 96, 0.16);
  color: var(--b-text-primary);
}
.phone-container > main {
  overflow-y: auto;
  background: transparent;
}
.phone-container .screen { background: transparent; }
/* The hero copy is intentionally raised 12px; clip only at the outer main shell so its glyphs can use the safe-area padding. */
#screen-home { overflow: visible; }
#screen-camera,
#screen-coach,
#screen-fasting,
#screen-analytics,
#screen-tasks,
#screen-competition-detail,
#screen-settings,
#screen-subscription,
#screen-store,
#screen-result {
  color: var(--b-text-primary);
}

/* Shared bottom navigation: one visual contract for every primary tab. */
.phone-container > nav {
  height: calc(60px + env(safe-area-inset-bottom));
  padding: 0 8px env(safe-area-inset-bottom);
  align-items: center;
  background: rgba(250, 229, 210, 0.96);
  border: 0;
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -7px 24px rgba(149, 104, 73, 0.1);
  backdrop-filter: blur(18px);
}
.phone-container:has(#screen-result:not(.hidden)) nav {
  height: calc(60px + env(safe-area-inset-bottom));
}
.phone-container:has(#screen-result:not(.hidden)) main {
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}
.phone-container > nav .nav-item {
  align-self: stretch;
  justify-content: center;
  padding: 5px 0 3px;
  gap: 2px;
  color: #1f1c1a;
  font-size: 14px;
  font-weight: 600;
}
.phone-container > nav .nav-item.active { color: var(--b-accent); }
.phone-container > nav .nav-icon,
.phone-container > nav .nav-icon svg {
  width: 23px;
  height: 23px;
}
.phone-container > nav .nav-camera {
  width: 58px;
  height: 58px;
  min-height: 58px;
  margin: -10px 4px 2px;
  background: linear-gradient(150deg, #ff9b53, #ff7a3e);
  box-shadow: 0 9px 19px rgba(255, 103, 38, 0.3);
}
.phone-container > nav .nav-camera-glyph,
.phone-container > nav .nav-camera-glyph svg { width: 28px; height: 28px; }

/* Shared surfaces and typography roles; Home keeps its approved local master. */
.phone-container .screen:not(#screen-home) .card,
.phone-container .modal-content {
  background: var(--b-surface);
  border-color: var(--b-border);
  border-radius: var(--b-radius-card);
  color: var(--b-text-primary);
  box-shadow: var(--b-shadow-card);
}
.phone-container .screen:not(#screen-home) > .card,
.phone-container .screen:not(#screen-home) .card:not(.result-photo-section) {
  /* Required only to supersede legacy inline dark surfaces. */
  background: var(--b-surface) !important;
  border-color: var(--b-border) !important;
}
.phone-container .screen:not(#screen-home) > div:first-child > span:nth-child(2),
.phone-container .subflow-page-title,
.subscription-page-title {
  color: var(--b-text-primary) !important;
  font-size: var(--b-type-page-title);
  font-weight: 850;
}
.phone-container .screen:not(#screen-home) .card-title,
.phone-container .modal-header,
.phone-container .modal-content h2,
.phone-container .feedback-modal-title,
.phone-container .health-report-modal-title {
  color: var(--b-text-primary) !important;
  font-size: var(--b-type-section-title);
}
.phone-container .screen:not(#screen-home) p,
.phone-container .screen:not(#screen-home) label,
.phone-container .modal-content p,
.phone-container .modal-content label { color: var(--b-text-secondary); }
.phone-container .screen:not(#screen-home) small,
.phone-container .screen:not(#screen-home) .hint,
.phone-container .screen:not(#screen-home) [class*="hint"] { color: var(--b-text-secondary); }

/* Shared controls. Official identity-provider buttons are intentionally excluded. */
.phone-container .screen:not(#screen-home) input:not([type="file"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]),
.phone-container .screen:not(#screen-home) select,
.phone-container .screen:not(#screen-home) textarea,
.phone-container .modal-content input:not([type="file"]):not([type="checkbox"]):not([type="radio"]),
.phone-container .modal-content select,
.phone-container .modal-content textarea {
  background: var(--b-surface-soft);
  border-color: var(--b-border);
  border-radius: var(--b-radius-control);
  color: var(--b-text-primary);
  color-scheme: light;
}
.phone-container input:focus,
.phone-container select:focus,
.phone-container textarea:focus {
  border-color: var(--b-accent);
  outline: 2px solid rgba(255, 90, 22, 0.12);
  outline-offset: 1px;
}
.phone-container .btn-submit:not(.btn-confirm-danger),
.phone-container .ds-button--primary,
.phone-container .fasting-action-btn {
  background: var(--b-accent);
  color: #fffaf4;
  box-shadow: 0 8px 18px rgba(255, 90, 22, 0.2);
}
.phone-container .btn-secondary,
.phone-container .btn-confirm-cancel,
.phone-container .subscription-back-btn {
  background: var(--b-surface-soft);
  border-color: var(--b-border);
  color: var(--b-text-primary);
  box-shadow: none;
}
.phone-container button:disabled:not(.auth-btn) {
  background: #eadfd7;
  border-color: rgba(174, 128, 96, 0.12);
  color: var(--b-text-disabled);
  box-shadow: none;
}
.phone-container .btn-confirm-danger,
.phone-container .account-delete-btn {
  background: #f8e3df;
  border-color: rgba(185, 85, 108, 0.34);
  color: var(--b-danger);
}

/* Auth */
.login-modal-overlay { background: rgba(80, 58, 44, 0.42); }
.login-modal-content {
  background: var(--b-surface);
  border-color: var(--b-border);
  box-shadow: 0 22px 48px rgba(104, 70, 49, 0.2);
}
.login-logo { color: var(--b-accent); }
.phone-container .modal-content .login-title {
  color: var(--b-text-primary);
  font-size: var(--b-type-page-title);
}
.login-slogan,
.login-divider span,
.login-register-back,
.login-forgot-password { color: var(--b-text-secondary); }
.login-prelaunch-hint {
  border-color: rgba(255, 90, 22, 0.2);
  background: rgba(255, 171, 114, 0.18);
  color: #9b472c;
}
.login-tab-bar {
  background: var(--b-surface-soft);
  border-color: var(--b-border);
}
.login-tab { color: var(--b-text-secondary); }
.login-tab.active {
  background: var(--b-accent-soft);
  color: var(--b-text-primary);
  border-color: rgba(255, 90, 22, 0.24);
}
.login-auth-input,
#register-nickname {
  background: var(--b-surface-soft);
  border: 1px solid var(--b-border);
  color: var(--b-text-primary);
}
.login-auth-input::placeholder,
#register-nickname::placeholder { color: var(--b-text-disabled); }
.password-toggle { color: var(--b-text-secondary); }
.login-divider::before,
.login-divider::after { background: rgba(174, 128, 96, 0.2); }
.login-submit-btn { background: var(--b-accent); }
.login-guest-btn {
  color: var(--b-text-secondary);
  background: var(--b-surface-soft);
  border: 1px solid var(--b-border);
  border-radius: var(--b-radius-control);
  text-decoration: none;
}

/* Onboarding */
.onboarding {
  --ds-bg-shell: var(--b-page-bg);
  --ds-surface-1: var(--b-surface);
  --ds-border-soft: var(--b-border);
  --ds-text-strong: var(--b-text-primary);
  --ds-text-body: #514944;
  --ds-text-muted: var(--b-text-secondary);
  --ds-brand-coral: var(--b-accent);
  --ds-brand-apricot: var(--b-accent-soft);
  --ds-brand-sky: var(--b-text-secondary);
  background: var(--app-page-background);
}
.onboarding-brand { color: var(--b-accent); }
.onboarding-brand-mark { color: #fffaf4; background: var(--b-accent); }
.onboarding-progress-dot { background: rgba(174, 128, 96, 0.18); }
.onboarding-progress-dot.is-active { background: linear-gradient(90deg, var(--b-accent), var(--b-accent-soft)); }
.onboarding .onboarding-picker {
  background: var(--b-surface);
  border-color: var(--b-border);
  color: var(--b-text-primary);
  color-scheme: light;
}
.onboarding-activity-option { background: var(--b-surface-soft); }
.onboarding-activity-option:has(input:checked) {
  border-color: var(--b-accent);
  background: rgba(255, 171, 114, 0.2);
}
.onboarding-activity-option input { accent-color: var(--b-accent); }

/* Answer Book is a launch-only overlay. It intentionally lives outside Home. */
.answer-book-opening {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: calc(34px + env(safe-area-inset-top, 0px)) 26px calc(30px + env(safe-area-inset-bottom, 0px));
  overflow: hidden;
  color: #4c4743;
  background: var(--app-page-background);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s ease;
}
.answer-book-opening.is-armed,
.answer-book-opening.is-open {
  opacity: 1;
  pointer-events: auto;
}
.answer-book-opening.is-open { z-index: 80; }
.answer-book-opening-shell {
  width: min(100%, 330px);
  min-height: min(520px, 100%);
  min-width: 0;
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.answer-book-opening-mark {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  margin-bottom: 20px;
  border: 1px solid rgba(149, 95, 60, 0.22);
  border-radius: 50%;
  color: #a7653e;
  background: rgba(255, 255, 255, 0.58);
  box-shadow: 0 12px 28px rgba(117, 73, 45, 0.12);
  font-size: 25px;
}
.answer-book-opening-kicker {
  margin: 0 0 8px;
  color: #625b56;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-indent: 0.22em;
  text-align: center;
}
.answer-book-opening-reveal {
  width: 100%;
  min-height: 190px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 0;
}
.answer-book-opening-beat {
  width: 100%;
  min-width: 0;
  text-align: center;
  overflow-wrap: anywhere;
  margin: 0;
  color: #4c4743;
  font-family: "Songti TC", "Noto Serif TC", serif;
  font-size: 25px;
  font-weight: 700;
  line-height: 1.55;
  letter-spacing: 0;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 1.3s ease, transform 1.3s ease;
}
.answer-book-opening-beat.is-revealed {
  opacity: 1;
  transform: translateY(0);
}
.answer-book-opening-evidence {
  width: 100%;
  text-align: center;
  overflow-wrap: anywhere;
  min-height: 24px;
  margin: 12px 0 0;
  color: #625b56;
  font-size: 14px;
  font-weight: 750;
  letter-spacing: 0;
}
.answer-book-opening-evidence[data-status="loading"] { color: #77706b; }
.answer-book-opening-evidence[data-status="unavailable"] { color: #77706b; }
.answer-book-opening-skip {
  align-self: center;
  text-align: center;
  margin: 28px auto 0;
  padding: 10px 22px;
  border: 1px solid rgba(117, 73, 45, 0.2);
  border-radius: 999px;
  color: #625b56;
  background: rgba(255, 255, 255, 0.46);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.16em;
  text-indent: 0.16em;
}
.answer-book-opening-setting-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.answer-book-opening-setting-copy { min-width: 0; }
.answer-book-opening-setting-copy .card-title { margin-bottom: 5px; }
.answer-book-opening-setting-copy p {
  margin: 0;
  color: var(--b-text-secondary);
  font-size: 12px;
  line-height: 1.45;
}
.answer-book-opening-setting-card .health-sync-toggle { flex: 0 0 auto; }

@media (prefers-reduced-motion: reduce) {
  .answer-book-opening,
  .answer-book-opening-beat { transition: none; }
}

/* Primary pages */
#screen-analytics .line-chart-container,
#screen-analytics .history-item,
#screen-analytics .history-empty-card,
#screen-settings .health-sync-item,
#screen-settings .health-metric-card,
#screen-settings .activity-level-preview,
#screen-settings .protein-target-preview,
#screen-tasks .referral-redeem-field {
  background: var(--b-surface-soft);
  border-color: var(--b-border);
}
#screen-analytics .chart-bar { background: #d7b49d; }
#screen-analytics .chart-bar.today { background: var(--b-accent); }
#screen-tasks #btn-watch-ad,
#screen-tasks #btn-copy-referral,
#screen-tasks .referral-redeem-btn {
  background: var(--b-accent) !important;
  border-color: var(--b-accent) !important;
  color: #fffaf4 !important;
}
#screen-settings .account-login-btn,
#screen-settings #btn-save-settings,
#screen-settings .health-upload-btn {
  background: var(--b-accent);
  color: #fffaf4;
  box-shadow: 0 8px 18px rgba(255, 90, 22, 0.2);
}
#screen-settings .account-avatar,
#screen-settings .account-avatar-guest,
#screen-settings .health-sync-icon { background: rgba(255, 171, 114, 0.2); }
#screen-settings .health-sync-status,
#screen-settings .account-sync-badge {
  border-color: var(--b-border);
  background: var(--b-surface-soft);
}
#screen-settings .toggle-slider { background: #d9c8bc; border-color: #c2aa99; }
#screen-settings .health-sync-toggle input:checked + .toggle-slider {
  background: var(--b-accent);
  border-color: var(--b-accent);
}

/* Food capture, backfill and result */
#screen-camera #camera-preview-area,
#screen-store .store-photo-add-btn,
#screen-store .meal-reuse-panel,
#screen-result .result-summary-card,
#screen-result .meal-tip-card {
  background: var(--b-surface-soft) !important;
  border-color: var(--b-border) !important;
}
#screen-camera .btn-submit,
#screen-store .btn-submit,
#screen-result .btn-submit {
  background: var(--b-accent);
  color: #fffaf4;
}
#screen-store .store-photo-evidence { background: #e5f0e9; border-color: #aac2af; color: #344533; }
#screen-store .store-photo-evidence.unavailable { background: #fff0dc; border-color: #dfb47b; color: #6b491e; }
#screen-result .result-calorie-value { color: var(--b-accent); }
#screen-result #res-items-list .item-row {
  background: var(--b-surface-soft);
  border: 1px solid var(--b-border);
  color: var(--b-text-primary);
}
#screen-result #res-items-list .item-row > span { color: var(--b-text-primary) !important; }

/* Subscription */
.subscription-page-badge { background: var(--b-accent-soft); color: #6f321d; }
.subscription-card { background: var(--b-surface) !important; }
.subscription-hero-icon { background: rgba(255, 171, 114, 0.22); color: var(--b-accent); }
.subscription-plan-btn {
  border-color: var(--b-border);
  background: var(--b-surface);
  color: var(--b-text-primary);
}
.subscription-plan-btn--featured {
  border-color: var(--b-accent);
  background: var(--b-accent-soft);
}
.subscription-plan-price,
.subscription-restore-btn { color: #b94c29; }

/* Dialogs, loading, empty states and toasts */
.modal-overlay {
  background: rgba(80, 58, 44, 0.42);
  backdrop-filter: blur(6px);
}
.phone-container .modal-content {
  /* Required to replace several legacy modal-specific dark backgrounds. */
  background: var(--b-surface) !important;
  border-color: var(--b-border) !important;
}
.phone-container .modal-header,
.phone-container .modal-footer,
.phone-container .feedback-modal-header,
.phone-container .feedback-modal-actions,
.phone-container .health-report-modal-header,
.phone-container .health-report-modal-footer {
  background: var(--b-surface-soft);
  border-color: rgba(174, 128, 96, 0.18);
}
.phone-container .modal-header > span,
.phone-container .modal-header > button,
.phone-container .feedback-modal-close,
.phone-container .health-report-modal-close {
  color: var(--b-text-primary) !important;
}
.health-report-upload-zone {
  background: var(--b-surface-soft);
  border-color: var(--b-border);
  color: var(--b-text-primary);
}
.health-report-modal-close {
  background: transparent;
  color: var(--b-text-primary);
}
.a2hs-modal-actions .btn-secondary {
  background: var(--b-surface-soft);
  border-color: var(--b-border);
  color: var(--b-text-primary);
}
.loading-overlay {
  background: rgba(255, 243, 232, 0.96);
  color: var(--b-text-primary);
}
.toast-info {
  background: var(--b-surface);
  color: var(--b-text-primary);
  border: 1px solid var(--b-border);
}
.toast-success { background: #e4efe3; color: #354b35; border-color: #b4c9b1; }
.toast-error { background: #f8e3df; color: #74443d; border-color: #ddb2ab; }
.history-empty-card,
.fasting-timeline-empty { color: var(--b-text-secondary); }

@media (max-height: 700px) {
  .phone-container > main { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
}

/* Store backfill: compact vertical composer with one native iOS scroll axis. */
.phone-container > main {
  overflow-x: clip;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

#screen-store {
  min-width: 0;
  max-width: 100%;
  overflow-x: clip;
  touch-action: pan-y;
  gap: 10px;
  padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
}

#screen-store > * {
  min-width: 0;
  max-width: 100%;
}

#screen-store .subflow-header {
  padding-bottom: 8px;
}

#screen-store .store-utility-row {
  display: grid;
  grid-template-columns: minmax(0, 1.62fr) minmax(112px, 1fr);
  gap: 10px;
  align-items: stretch;
  min-width: 0;
}

#screen-store .store-utility-card {
  min-width: 0;
  padding: 9px 10px 10px;
  border: 1px solid var(--b-border);
  border-radius: 16px;
  background: var(--b-surface-soft);
}

#screen-store .store-utility-label {
  min-width: 0;
  min-height: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  color: var(--b-text-primary);
  font-size: 13.5px;
  font-weight: 800;
  line-height: 1.2;
}

#screen-store .store-utility-label small {
  flex: 0 0 auto;
  color: var(--b-text-secondary);
  font-size: 11px;
  font-weight: 700;
}

#screen-store .store-datetime-input {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 50px;
  margin-top: 6px;
  padding: 7px 8px;
  border-radius: 11px;
  font-size: 14px;
}

#screen-store .store-photo-card {
  display: flex;
  flex-direction: column;
}

#screen-store .store-photo-add-btn {
  width: 100%;
  min-width: 0;
  min-height: 50px;
  margin-top: 6px;
  padding: 7px 8px;
  justify-content: center;
  gap: 5px;
  border-width: 1px;
  border-style: solid;
  border-radius: 11px;
  text-align: center;
}

#screen-store .store-photo-icon {
  flex: 0 0 auto;
  font-size: 20px;
  line-height: 1;
}

#screen-store .store-photo-add-btn > span:last-child {
  min-width: 0;
  display: block;
}

#screen-store .store-photo-add-btn strong {
  display: block;
  overflow: hidden;
  color: var(--b-text-primary);
  font-size: 13.5px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#screen-store .store-photo-add-btn small {
  display: block;
  max-width: 100%;
  margin-top: 2px;
  overflow: hidden;
  color: var(--b-text-secondary);
  font-size: 10.5px;
  font-weight: 650;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#screen-store .store-photo-session-hint {
  display: none;
  margin-top: 0;
  padding: 0 2px;
  font-size: 12px;
}

#screen-store .store-photo-session-hint.is-multi-photo {
  display: block;
}

#screen-store #store-items-input {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 76px;
  resize: none;
}

#screen-store .meal-reuse-panel {
  min-width: 0;
  padding: 12px;
}

#screen-store .meal-reuse-search-row,
#screen-store .meal-reuse-search-row input {
  min-width: 0;
  max-width: 100%;
}

#screen-store .meal-reuse-status {
  margin: 7px 2px 8px;
  font-size: 13px;
  line-height: 1.4;
}

#screen-store .meal-reuse-chips {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  margin-top: 0;
  overflow: hidden;
  border: 1px solid rgba(174, 128, 96, 0.18);
  border-radius: 13px;
  background: rgba(255, 252, 248, 0.72);
}

#screen-store .meal-reuse-chips > span {
  padding: 12px;
  color: var(--b-text-secondary);
  font-size: 14px;
}

#screen-store .meal-reuse-chips .meal-reuse-chip {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 46px;
  overflow: hidden;
  padding: 11px 13px;
  border: 0;
  border-bottom: 1px solid rgba(174, 128, 96, 0.16);
  border-radius: 0;
  background: transparent;
  color: var(--b-text-primary);
  font-size: 15px;
  font-weight: 650;
  line-height: 1.4;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#screen-store .meal-reuse-chips .meal-reuse-chip:last-child {
  border-bottom: 0;
}

#screen-store .meal-reuse-chips .meal-reuse-chip:active {
  background: rgba(122, 79, 120, 0.1);
}

#screen-store #btn-submit-store {
  min-height: 52px;
  margin-top: 2px;
  margin-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  border-radius: 16px;
  background: linear-gradient(135deg, #7a4f78 0%, #5d3b67 100%);
  color: #fff9f3;
  box-shadow: 0 8px 18px rgba(93, 59, 103, 0.2);
  font-size: 16.5px;
  letter-spacing: 0.01em;
  scroll-margin-bottom: 88px;
}

/* Food Result — warm milk-tea hierarchy approved from iPhone review. */
#screen-result {
  --food-result-summary-surface: #FFFCF8;
  --food-result-calorie: #765844;
  --food-result-item-surface: #F8EEE5;
  --food-result-item-border: #DEC8B5;
  --food-result-item-name: #3F3732;
  --food-result-item-kcal: #6C5547;
  --food-result-item-meta: #6B635F;
  --food-result-protein: #8F514C;
  --food-result-carbs: #7F5D2E;
  --food-result-fat: #43665F;
}

#screen-result .result-photo-container {
  --food-result-photo-frame-start: #D7C1AC;
  --food-result-photo-frame-end: #B49378;
  --food-result-photo-border: #92745D;
  --food-result-photo-action: #A98A70;
  --food-result-photo-button: #6F5847;
  border-color: var(--food-result-photo-border);
  background: linear-gradient(
    180deg,
    var(--food-result-photo-frame-start) 0%,
    var(--food-result-photo-frame-end) 100%
  );
  box-shadow:
    0 10px 24px rgba(105, 78, 57, 0.18),
    inset 0 0 0 1px rgba(255, 252, 248, 0.3);
}

#screen-result .result-photo-section {
  background: rgba(255, 252, 248, 0.42);
}

#screen-result .result-photo-section-title,
#screen-result .result-photo-section-items {
  color: var(--food-result-item-name);
}

#screen-result .result-photo-section-note {
  color: var(--food-result-item-meta);
}

#screen-result .result-photo-container .save-meal-image-btn-wrap {
  padding: 10px 12px 12px;
  background: var(--food-result-photo-action);
}

#screen-result .result-photo-container .save-img-btn {
  border-color: rgba(255, 252, 248, 0.38);
  background: var(--food-result-photo-button);
  color: #FFFCF8;
  text-shadow: none;
  box-shadow: 0 5px 13px rgba(83, 60, 45, 0.2);
}

#screen-result .result-summary-card {
  background: var(--food-result-summary-surface) !important;
}

#screen-result .result-calorie-value {
  color: var(--food-result-calorie);
}

#screen-result .result-macro-grid {
  color: var(--food-result-item-meta);
}

#screen-result .result-macro-grid > div {
  border: 1px solid var(--food-result-item-border);
  background: var(--food-result-item-surface);
}

#screen-result .result-macro-protein { color: var(--food-result-protein); }
#screen-result .result-macro-carbs { color: var(--food-result-carbs); }
#screen-result .result-macro-fat { color: var(--food-result-fat); }

#screen-result #res-items-list {
  display: grid;
  gap: 9px;
}

#screen-result .food-item-editor { display: grid; gap: 8px; border-top: 1px solid var(--food-result-item-border); padding-top: 10px; }
#screen-result .food-item-editor label { display: grid; gap: 4px; font-size: 13px; }
#screen-result .food-item-editor input { width: 100%; min-width: 0; box-sizing: border-box; font-size: 16px; padding: 9px; border: 1px solid var(--food-result-item-border); border-radius: 9px; background: #fffaf5; color: #583f30; }
#screen-result .food-item-editor input[readonly] { background: #f5e7d8; border-style: dashed; cursor: default; }
#screen-result .food-item-quantity { display: grid; grid-template-columns: 44px minmax(55px, 1fr) 44px minmax(60px, 1fr); align-items: center; gap: 6px; }
#screen-result .food-item-editor button { min-height: 44px; border: 1px solid var(--food-result-item-border); border-radius: 9px; background: #f5e7d8; color: #583f30; font-size: 14px; }
#screen-result .food-item-editor [data-item-status] { font-size: 12px; line-height: 1.5; color: #76553f; }

#screen-result #res-items-list .item-nutrition-row {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 13px 14px 12px;
  border: 1px solid var(--food-result-item-border);
  border-radius: 15px;
  background: var(--food-result-item-surface);
  box-shadow: 0 4px 12px rgba(108, 78, 55, 0.045);
}

#screen-result #res-items-list .item-nutrition-main {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

#screen-result #res-items-list .item-nutrition-name {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--food-result-item-name);
  font-size: 15px;
  font-weight: 750;
}

#screen-result #res-items-list .item-nutrition-kcal {
  flex: 0 0 auto;
  color: var(--food-result-item-kcal);
  font-size: 14px;
  font-weight: 850;
  white-space: nowrap;
}

#screen-result #res-items-list .item-nutrition-values {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  color: var(--food-result-item-meta);
  font-size: 12px;
  line-height: 1.35;
  text-align: left;
}

#screen-result #res-items-list .item-nutrition-macro {
  min-width: 0;
  padding-top: 7px;
  border-top: 1px solid rgba(146, 116, 93, 0.18);
  font-weight: 750;
  white-space: nowrap;
}

#screen-result #res-items-list .item-nutrition-macro--protein { color: var(--food-result-protein); }
#screen-result #res-items-list .item-nutrition-macro--carbs { color: var(--food-result-carbs); }
#screen-result #res-items-list .item-nutrition-macro--fat { color: var(--food-result-fat); }

#screen-result .food-meal-review { margin: 16px 0; font-size: 14px; line-height: 1.5; }
#screen-result .food-meal-review button {
  width: 100%; min-height: 48px; padding: 12px; border: 0; border-radius: 14px;
  background: #68406c; color: #fff; font-size: 16px; font-weight: 700;
}
#screen-result .food-meal-review button:disabled { opacity: 0.55; }


/* Home slot 6: same fixed footprint, existing timer and management screen. */
.home-fasting-card { width: 100%; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 1px; }
.home-fasting-card-heading { display: flex; justify-content: space-between; font-size: 11px; font-weight: 700; line-height: 1.1; }
.home-fasting-card-heading > span { font-size: 10px; font-weight: 500; }
.home-fasting-card-row { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; font-size: 11px; line-height: 1.1; }
#home-fasting-card-value { font-variant-numeric: tabular-nums; font-size: 16px; white-space: nowrap; }
#home-fasting-card-care { display: block; width: 100%; font-size: 9px; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-fasting-card:focus-visible { outline: 2px solid #ff5a16; outline-offset: 2px; }
#fasting-start-eating[hidden] { display: none; }

.home-daily-action-card h2 { display: flex; align-items: center; justify-content: space-between; }
#daily-action-open { border: 0; background: transparent; color: inherit; font: inherit; padding: 2px 6px; cursor: pointer; }
.home-daily-action-card > strong, .home-daily-action-card > p { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.daily-action-dialog { width: min(90vw, 420px); max-height: 80vh; overflow-y: auto; border: 1px solid #dac8b7; border-radius: 22px; padding: 22px; color: #594238; background: #fff8ef; }
.daily-action-dialog::backdrop { background: rgb(0 0 0 / 40%); }
.daily-action-dialog h2 { margin-top: 0; font-size: 20px; }
.daily-action-dialog p { line-height: 1.6; white-space: pre-line; }
.daily-action-dialog button { width: 100%; margin-top: 10px; }
.daily-action-dialog button[hidden] { display: none; }
.statistics-coach-actions h3 { margin: 0 0 8px; }
.statistics-coach-actions p { color: #7b6859; font-size: 13px; }
.statistics-coach-buttons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.statistics-coach-buttons button { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.statistics-coach-buttons small { font-size: 10px; font-weight: normal; overflow-wrap: anywhere; }


/* Daily action reason and saved observation. */
.daily-action-reason { padding: 12px; border-radius: 12px; background: #f8efe4; color: #6d5143; line-height: 1.6; }
#daily-action-note-wrap { display: grid; gap: 8px; margin: 12px 0; text-align: left; }
#daily-action-note-wrap[hidden] { display: none; }
#daily-action-note { width: 100%; box-sizing: border-box; border: 1px solid #d9c7b6; border-radius: 12px; padding: 12px; font: inherit; color: #463a35; background: #fffaf5; resize: vertical; }
#daily-action-primary[hidden], #daily-action-note-save[hidden] { display: none; }

.daily-action-dialog { inset: 0; margin: auto; width: min(calc(100vw - 32px), 420px); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); box-sizing: border-box; }
.daily-action-dialog .btn-primary, .daily-action-dialog .btn-secondary { min-height: 44px; padding: 12px 16px; border-radius: 14px; font: inherit; font-weight: 700; cursor: pointer; }
.daily-action-dialog .btn-primary { border: 1px solid #69466d; background: #69466d; color: #fff; }
.daily-action-dialog .btn-secondary { border: 1px solid #dbc8b6; background: #f4e6d6; color: #594238; }
.daily-action-dialog button:focus-visible, #daily-action-note:focus-visible { outline: 3px solid #bf8738; outline-offset: 2px; }
#daily-action-note-help { font-size: 14px; color: #78685d; margin: 0; }


/* Identify the specific nutrition estimate that needs a retry. */
.food-review-guidance { margin: 12px 0; padding: 16px; border: 1px solid #c99545; border-radius: 18px; background: #fff4dd; color: #64462b; }
.food-review-guidance p { margin: 8px 0 0; line-height: 1.65; }
#screen-result #res-items-list .item-nutrition-row[data-nutrition-pending] { border: 2px solid #bd8739; }
.item-nutrition-row[data-nutrition-pending] .item-nutrition-name::after { content: ' · 營養待補'; font-size: .8em; color: #805718; }


.meal-tip-retry { display: block; width: 100%; min-height: 44px; margin-top: 12px; padding: 12px 16px; border: 1px solid #d9bfaa; border-radius: 12px; background: #f5e7d8; color: #583f30; font: inherit; font-weight: 650; }
.meal-tip-retry[hidden] { display: none; }
.meal-tip-retry:disabled { opacity: .65; }
.meal-tip-retry:focus-visible { outline: 3px solid #906798; outline-offset: 2px; }


/* Keep ordinary-food assumptions visible in results and saved meal details. */
.food-estimate-basis { margin: 10px 0 0; padding: 10px 12px; border-radius: 10px; background: #f3e5d5; color: #624c3c; font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }
.food-estimate-basis strong { color: #674365; }


/* Failed corrections are distinct from the gold pending-draft outline. */
#screen-result [data-food-correction-error="true"] {
  outline: 2px solid #b33b35;
  outline-offset: 3px;
  border-radius: 9px;
}
#screen-result #food-correction-status[data-food-correction-error="true"] {
  padding: 10px;
  color: #8d2924;
  background: #fff1ee;
}


#screen-result .food-protein-adjustment { padding: 12px; border: 1px solid #b79ab9; border-radius: 10px; background: #fff9f4; }
#screen-result .food-protein-adjustment p { margin: 6px 0; font-size: 13px; }
#screen-result .food-protein-presets { display: flex; gap: 8px; }
#screen-result .food-protein-adjustment[hidden] { display: none; }
