/* DayBite 日食記：手機優先。尺寸標準：按鈕 36／30px、標籤 22px 間距 6px、頁邊 16／20／24px。 */
:root {
  --bg: #F6F5F1;
  --card: #FFFFFF;
  --card2: #FBFAF7;
  --ink: #1C2421;
  --ink2: #56625D;
  --ink3: #8B9590;
  --line: #E8E5DD;
  --brand: #1F8A70;
  --brand-ink: #FFFFFF;
  --brand-soft: #E2F1EA;
  --sun: #EE9F2D;
  --sun-soft: #FCEFD9;
  --over: #DB7536;
  --over-soft: #FBE7D9;
  --protein: #3B78D4;
  --carbs: #E09A2C;
  --fat: #BF5F95;
  --green: #2E9E68;
  --yellow: #D9A520;
  --red: #D45A45;
  --ring-track: #ECE9E1;
  --shadow: 0 1px 2px rgba(28, 36, 33, .04), 0 4px 14px rgba(28, 36, 33, .05);
  --radius: 18px;
  --radius-sm: 12px;
  --pad: 20px;
  --tab-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111513; --card: #1A1F1D; --card2: #1F2522; --ink: #EBEFED; --ink2: #A8B2AE; --ink3: #77817D;
    --line: #2A312E; --brand: #3CB892; --brand-ink: #0D1A15; --brand-soft: #173329; --sun: #F0AE4A;
    --sun-soft: #3A2D17; --over: #EE8F55; --over-soft: #3B2519; --protein: #6C9CEB; --carbs: #EDB14F;
    --fat: #D888B6; --green: #4CC489; --yellow: #E8BE45; --red: #EC7A66; --ring-track: #2B322F;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111513; --card: #1A1F1D; --card2: #1F2522; --ink: #EBEFED; --ink2: #A8B2AE; --ink3: #77817D;
  --line: #2A312E; --brand: #3CB892; --brand-ink: #0D1A15; --brand-soft: #173329; --sun: #F0AE4A;
  --sun-soft: #3A2D17; --over: #EE8F55; --over-soft: #3B2519; --protein: #6C9CEB; --carbs: #EDB14F;
  --fat: #D888B6; --green: #4CC489; --yellow: #E8BE45; --red: #EC7A66; --ring-track: #2B322F;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3); color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
img, svg { display: block; }
h1, h2, h3 { margin: 0; line-height: 1.3; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 600; }
p { margin: 0; }
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.muted { color: var(--ink2); }
.faint { color: var(--ink3); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* 版面 */
.page { max-width: 720px; margin: 0 auto; padding: 12px var(--pad) calc(var(--tab-h) + 32px + env(safe-area-inset-bottom)); }
.page.plain { padding-bottom: 40px; }
@media (max-width: 389px) { :root { --pad: 16px; } }
@media (min-width: 820px) { :root { --pad: 24px; } .page { max-width: 760px; } }
.stack > * + * { margin-top: 12px; }
.stack-lg > * + * { margin-top: 20px; }
.row { display: flex; align-items: center; gap: 8px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (min-width: 820px) { .grid-wide { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; } .grid-wide > * + * { margin-top: 0; } }

.topbar { display: flex; align-items: center; gap: 10px; min-height: 48px; padding-top: env(safe-area-inset-top); }
.topbar h1 { flex: 1; font-size: 20px; }
.topbar .back { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: var(--ink); background: var(--card); box-shadow: var(--shadow); }

.card { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card.tight { padding: 12px 14px; }
.card.flat { box-shadow: none; border: 1px solid var(--line); }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 20px 2px 8px; }
.section-title h2 { font-size: 17px; }

/* 按鈕 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 16px;
  border-radius: 999px; border: 0; background: var(--brand); color: var(--brand-ink); font: inherit; font-weight: 600;
  font-size: 15px; cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:disabled { opacity: .5; cursor: default; }
.btn.sm { height: 30px; padding: 0 12px; font-size: 13px; }
.btn.lg { height: 44px; padding: 0 22px; font-size: 16px; }
.btn.block { display: flex; width: 100%; }
.btn.ghost { background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.btn.soft { background: var(--brand-soft); color: var(--brand); }
.btn.danger { background: transparent; color: var(--red); box-shadow: inset 0 0 0 1px var(--line); }
.btn.link { background: none; color: var(--brand); padding: 0 4px; height: 30px; font-size: 13px; }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; border: 0; display: inline-grid; place-items: center; background: var(--card); color: var(--ink); cursor: pointer; box-shadow: inset 0 0 0 1px var(--line); flex: none; }
.icon-btn.sm { width: 30px; height: 30px; }
.icon-btn.solid { background: var(--ink); color: var(--card); box-shadow: none; }
.icon-btn.brand { background: var(--brand); color: var(--brand-ink); box-shadow: none; }

/* 標籤 */
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--card2); color: var(--ink2); box-shadow: inset 0 0 0 1px var(--line); white-space: nowrap; }
.tag.brand { background: var(--brand-soft); color: var(--brand); box-shadow: none; }
.tag.sun { background: var(--sun-soft); color: #9A5F00; box-shadow: none; }
:root[data-theme="dark"] .tag.sun { color: var(--sun); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tag.sun { color: var(--sun); } }
.tag.over { background: var(--over-soft); color: var(--over); box-shadow: none; }
.tag.vip { background: linear-gradient(90deg, #8A5A2B, #D9A520); color: #fff; box-shadow: none; letter-spacing: .5px; }
.tag.pro { background: linear-gradient(90deg, #1F8A70, #EE9F2D); color: #fff; box-shadow: none; letter-spacing: .5px; }

.light-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.light-green { background: var(--green); } .light-yellow { background: var(--yellow); } .light-red { background: var(--red); }
.light-chip { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.light-chip.green { background: color-mix(in srgb, var(--green) 14%, transparent); color: var(--green); }
.light-chip.yellow { background: color-mix(in srgb, var(--yellow) 18%, transparent); color: #9C7300; }
.light-chip.red { background: color-mix(in srgb, var(--red) 14%, transparent); color: var(--red); }
:root[data-theme="dark"] .light-chip.yellow { color: var(--yellow); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .light-chip.yellow { color: var(--yellow); } }

/* 表單 */
label.field { display: block; }
.field > span { display: block; font-size: 13px; color: var(--ink2); margin-bottom: 6px; font-weight: 600; }
.input, select.input, textarea.input {
  width: 100%; height: 44px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--card); color: var(--ink); font: inherit; font-size: 16px; outline: none;
}
textarea.input { height: auto; min-height: 88px; padding: 12px 14px; resize: vertical; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.input.sm { height: 36px; font-size: 15px; padding: 0 10px; }
.hint { font-size: 12px; color: var(--ink3); margin-top: 6px; }
.seg { display: flex; background: var(--card2); border-radius: 999px; padding: 3px; gap: 2px; box-shadow: inset 0 0 0 1px var(--line); }
.seg label, .seg button { flex: 1; text-align: center; height: 30px; line-height: 30px; border-radius: 999px; font-size: 14px; cursor: pointer; color: var(--ink2); border: 0; background: none; font: inherit; padding: 0 8px; white-space: nowrap; }
.seg input { display: none; }
.seg input:checked + span, .seg .on { background: var(--card); color: var(--ink); font-weight: 700; box-shadow: var(--shadow); }
.seg label span { display: block; border-radius: 999px; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.choice { display: block; cursor: pointer; }
.choice input { display: none; }
.choice .c { display: block; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--card); }
.choice .c b { display: block; font-size: 15px; }
.choice .c small { display: block; font-size: 12px; color: var(--ink3); }
.choice input:checked + .c { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }

.flash { padding: 10px 14px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 12px; }
.flash.error { background: var(--over-soft); color: var(--over); }
.flash.ok { background: var(--brand-soft); color: var(--brand); }

/* 清單 */
.list { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.list > a, .list > .li, .list > form > button.li-btn { display: flex; align-items: center; gap: 12px; padding: 14px 16px; color: var(--ink); min-height: 52px; }
.list > * + * { border-top: 1px solid var(--line); }
.li-main { flex: 1; min-width: 0; }
.li-main b { display: block; font-weight: 600; }
.li-main small { display: block; color: var(--ink3); font-size: 13px; margin-top: 2px; }
.chev { color: var(--ink3); flex: none; }
.li-btn { width: 100%; border: 0; background: none; font: inherit; text-align: left; cursor: pointer; }

/* 開關 */
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: var(--line); transition: background .2s; cursor: pointer; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s; }
.switch input:checked + i { background: var(--brand); }
.switch input:checked + i::after { transform: translateX(20px); }
.switch input:focus-visible + i { box-shadow: 0 0 0 3px var(--brand-soft); }

/* 底部分頁列 */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: calc(var(--tab-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-top: 1px solid var(--line); display: flex; justify-content: center;
}
.tabbar nav { display: grid; grid-template-columns: repeat(5, 1fr); width: 100%; max-width: 560px; }
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--ink3); font-size: 11px; font-weight: 600; }
.tabbar a.on { color: var(--ink); }
.tabbar a.add { position: relative; }
.tabbar a.add span.plus { width: 48px; height: 48px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; box-shadow: 0 6px 16px color-mix(in srgb, var(--brand) 40%, transparent); margin-top: -18px; }

/* 首頁：週曆 */
.week { display: grid; grid-template-columns: 24px repeat(7, 1fr) 24px; align-items: center; gap: 2px; }
.week .nav { color: var(--ink3); display: grid; place-items: center; height: 36px; }
.day { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--ink2); font-size: 12px; padding: 4px 0; border-radius: 14px; }
.day .d { position: relative; width: 38px; height: 38px; display: grid; place-items: center; font-weight: 700; font-size: 15px; color: var(--ink); }
.day .d svg { position: absolute; inset: 0; }
.day.future .d { color: var(--ink3); }
.day.sel { background: var(--card); box-shadow: var(--shadow); }
.day.today .wd { color: var(--brand); font-weight: 700; }

/* 首頁：攝取總覽 */
.hero { padding: 18px 16px 16px; }
.hero-top { display: flex; align-items: center; gap: 12px; }
.hero-num { font-size: 44px; font-weight: 800; letter-spacing: -1px; line-height: 1; }
.hero-num.over { color: var(--over); }
.hero-label { font-size: 14px; color: var(--ink2); font-weight: 600; margin-top: 6px; }
.hero-sub { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.ring { position: relative; width: 124px; height: 124px; flex: none; }
.ring .c { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring .c b { font-size: 22px; font-weight: 800; line-height: 1.1; }
.ring .c small { font-size: 12px; color: var(--ink3); }
.macros { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 16px; }
.macro .lbl { font-size: 12px; color: var(--ink2); font-weight: 600; display: flex; justify-content: space-between; }
.bar { height: 8px; border-radius: 999px; background: var(--ring-track); overflow: hidden; margin: 6px 0 4px; position: relative; }
.bar i { display: block; height: 100%; border-radius: 999px; }
.bar i.over { background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.35) 0 4px, transparent 4px 8px); }
.macro .v { font-size: 14px; font-weight: 700; }
.macro .v small { font-weight: 500; color: var(--ink3); font-size: 12px; }
.tip { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); background: var(--sun-soft); }
.tip.happy { background: var(--brand-soft); }
.tip p { font-size: 14px; color: var(--ink); }
.tip .deer { flex: none; }

/* 首頁：體重、活動 */
.mini { padding: 14px; min-height: 150px; display: flex; flex-direction: column; }
.mini .t { display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 14px; }
.mini .big { font-size: 26px; font-weight: 800; margin-top: 6px; line-height: 1.1; }
.mini .big small { font-size: 13px; font-weight: 600; color: var(--ink3); margin-left: 2px; }
.mini .delta { font-size: 12px; color: var(--ink2); margin-top: 2px; }
.mini .chart { margin-top: auto; }

/* 首頁：每日紀錄 */
.meal { padding: 14px 16px; }
.meal-head { display: flex; align-items: center; gap: 10px; }
.meal-head .ico { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: var(--card2); flex: none; }
.meal-head .nm { flex: 1; }
.meal-head .nm b { display: block; font-size: 16px; }
.meal-head .nm small { color: var(--ink3); font-size: 12px; }
.entry-row { display: flex; align-items: center; gap: 10px; padding: 10px 0 0; color: var(--ink); }
.entry-row + .entry-row { border-top: 1px dashed var(--line); margin-top: 10px; }
.entry-row .thumb { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; background: var(--card2); flex: none; }
.entry-row .ph { width: 44px; height: 44px; border-radius: 10px; background: var(--card2); display: grid; place-items: center; color: var(--ink3); flex: none; }
.entry-row .tx { flex: 1; min-width: 0; }
.entry-row .tx b { display: block; font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entry-row .tx small { display: block; color: var(--ink3); font-size: 12px; }
.entry-row .k { font-weight: 700; font-size: 15px; white-space: nowrap; }
.recent { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: none; }
.recent::-webkit-scrollbar { display: none; }
.chip-btn { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: 999px; border: 0; background: var(--card); box-shadow: inset 0 0 0 1px var(--line); color: var(--ink); font: inherit; font-size: 14px; cursor: pointer; white-space: nowrap; }
.chip-btn small { color: var(--ink3); }
.banner { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--brand-soft); color: var(--ink); font-size: 14px; }
.streak { display: inline-flex; align-items: center; gap: 4px; height: 36px; padding: 0 12px; border-radius: 999px; background: var(--card); box-shadow: inset 0 0 0 1px var(--line); font-weight: 800; color: var(--ink); }

/* 記錄餐點 */
.tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: none; height: 36px; padding: 0 14px; border-radius: 999px; border: 0; background: var(--card); box-shadow: inset 0 0 0 1px var(--line); color: var(--ink2); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.tabs button.on { background: var(--ink); color: var(--card); box-shadow: none; }
.drop {
  border: 2px dashed var(--line); border-radius: var(--radius); background: var(--card); padding: 28px 16px; text-align: center;
  cursor: pointer; transition: border-color .15s, background .15s;
}
.drop.over { border-color: var(--brand); background: var(--brand-soft); }
.drop .big-ico { width: 56px; height: 56px; border-radius: 18px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; margin: 0 auto 10px; }
.drop b { display: block; font-size: 16px; }
.drop small { display: block; color: var(--ink3); margin-top: 4px; }
.preview { width: 100%; max-height: 300px; object-fit: cover; border-radius: var(--radius); }
.quota { font-size: 12px; color: var(--ink3); }
.loading { display: flex; align-items: center; gap: 12px; padding: 16px; }
.dots i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--brand); margin: 0 2px; animation: dot 1s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .dots i { animation: none; opacity: .7; } }

.result-card .sum { display: flex; align-items: baseline; gap: 6px; }
.result-card .sum b { font-size: 32px; font-weight: 800; }
.item { padding: 12px 0; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; }
.item-top { display: flex; align-items: center; gap: 8px; }
.item-top .name { flex: 1; min-width: 0; font-weight: 600; border: 0; background: none; font: inherit; font-weight: 600; color: var(--ink); padding: 4px 0; outline: none; border-bottom: 1px dashed transparent; }
.item-top .name:focus { border-bottom-color: var(--brand); }
.item-top .kc { font-weight: 800; white-space: nowrap; }
.item-ctrl { display: flex; align-items: center; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.stepper { display: inline-flex; align-items: center; background: var(--card2); border-radius: 999px; box-shadow: inset 0 0 0 1px var(--line); }
.stepper button { width: 30px; height: 30px; border: 0; background: none; color: var(--ink); font-size: 18px; cursor: pointer; border-radius: 50%; }
.stepper input { width: 46px; text-align: center; border: 0; background: none; font: inherit; font-weight: 700; color: var(--ink); outline: none; }
.stepper .u { font-size: 13px; color: var(--ink2); padding-right: 10px; }
.item-macros { font-size: 12px; color: var(--ink3); }
.conf { font-size: 11px; font-weight: 700; padding: 0 6px; height: 20px; line-height: 20px; border-radius: 999px; }
.conf.low { background: var(--sun-soft); color: #9A5F00; }
.item-detail { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 8px; }
.item-detail label { font-size: 11px; color: var(--ink3); }
.item-detail input { width: 100%; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-size: 14px; padding: 0 6px; }
.portion-row { display: flex; gap: 6px; flex-wrap: wrap; }
.food-row { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.food-row:first-child { border-top: 0; }
.food-row .tx { flex: 1; min-width: 0; }
.food-row .tx b { display: block; font-weight: 600; font-size: 14px; }
.food-row .tx small { display: block; font-size: 12px; color: var(--ink3); }

/* 鹿營養師 */
.coach-head { display: flex; align-items: center; gap: 12px; }
.coach-head b { font-size: 17px; }
.msgs { display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 86%; padding: 10px 14px; border-radius: 18px; font-size: 15px; white-space: pre-wrap; word-break: break-word; }
.msg.user { align-self: flex-end; background: var(--brand); color: var(--brand-ink); border-bottom-right-radius: 6px; }
.msg-ai { display: flex; gap: 8px; align-items: flex-end; max-width: 92%; }
.msg-ai .msg { background: var(--card); box-shadow: var(--shadow); border-bottom-left-radius: 6px; max-width: none; }
.sugg { display: flex; flex-direction: column; gap: 6px; }
.sugg button { text-align: left; border: 0; background: var(--card); box-shadow: inset 0 0 0 1px var(--line); border-radius: 14px; padding: 10px 14px; font: inherit; font-size: 14px; color: var(--ink); cursor: pointer; display: flex; align-items: center; gap: 8px; }
.sugg button::before { content: "›"; color: var(--brand); font-weight: 800; font-size: 18px; line-height: 1; }
.composer { position: fixed; left: 0; right: 0; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom)); z-index: 25; padding: 8px var(--pad); background: linear-gradient(transparent, var(--bg) 30%); }
.composer form { max-width: 720px; margin: 0 auto; display: flex; gap: 8px; background: var(--card); border-radius: 999px; padding: 6px 6px 6px 16px; box-shadow: 0 2px 12px rgba(0,0,0,.08); border: 1px solid var(--line); }
.composer input { flex: 1; border: 0; background: none; font: inherit; font-size: 16px; color: var(--ink); outline: none; min-width: 0; }
.disclaimer { font-size: 12px; color: var(--ink3); text-align: center; }
.review { display: flex; gap: 10px; align-items: flex-start; }
.review .bubble { flex: 1; background: var(--card2); border-radius: 16px; padding: 12px 14px; font-size: 14px; }

/* 設定 */
.plan-card { padding: 18px; background: linear-gradient(135deg, var(--brand-soft), var(--sun-soft)); }
.plan-card .title { font-size: 22px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.theme-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.theme-pick label { cursor: pointer; }
.theme-pick input { display: none; }
.theme-pick .sw { display: block; border-radius: 14px; padding: 10px; height: 86px; border: 2px solid var(--line); position: relative; overflow: hidden; }
.theme-pick input:checked + .sw { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.theme-pick .sw b { position: relative; z-index: 1; font-size: 14px; }
.theme-pick .sw i { display: block; height: 8px; border-radius: 4px; margin-top: 8px; position: relative; z-index: 1; width: 70%; }
.sw-light { background: #F6F5F1; color: #1C2421; } .sw-light i { background: #E3DFD6; }
.sw-dark { background: #1A1F1D; color: #EBEFED; } .sw-dark i { background: #343C39; }
.sw-sys { background: linear-gradient(90deg, #1A1F1D 50%, #F6F5F1 50%); color: #EBEFED; } .sw-sys i { background: linear-gradient(90deg, #343C39 50%, #E3DFD6 50%); }
.sw-sys b { mix-blend-mode: difference; color: #fff; }
.price { font-size: 28px; font-weight: 800; }
.price small { font-size: 14px; color: var(--ink3); font-weight: 600; }
.plans { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.plan-opt input { display: none; }
.plan-opt .c { display: block; border: 2px solid var(--line); border-radius: var(--radius); padding: 14px; background: var(--card); cursor: pointer; position: relative; }
.plan-opt input:checked + .c { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.plan-opt .badge { position: absolute; top: -10px; right: 10px; }
.compare { width: 100%; border-collapse: collapse; font-size: 14px; }
.compare th, .compare td { padding: 10px 6px; white-space: nowrap; border-top: 1px solid var(--line); text-align: center; }
.compare th:first-child, .compare td:first-child { text-align: left; white-space: normal; }
.compare td svg { margin: 0 auto; }
.compare thead th { border-top: 0; font-size: 13px; color: var(--ink2); }

/* 文件頁 */
.doc h2 { margin: 22px 0 8px; font-size: 17px; }
.doc p, .doc li { color: var(--ink2); font-size: 15px; }
.doc p + p { margin-top: 8px; }
.doc ul, .doc ol { padding-left: 20px; margin: 6px 0; }
.formula { background: var(--card2); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 14px; font-variant-numeric: tabular-nums; margin: 8px 0; border: 1px solid var(--line); overflow-x: auto; }
table.simple { width: 100%; border-collapse: collapse; font-size: 14px; }
table.simple th, table.simple td { text-align: left; padding: 8px 6px; border-top: 1px solid var(--line); vertical-align: top; }
table.simple th { color: var(--ink2); font-weight: 600; font-size: 13px; }
.note { font-size: 12px; color: var(--ink3); background: var(--card2); border-radius: 10px; padding: 8px 12px; }

/* 登入、介紹 */
.auth { max-width: 420px; margin: 0 auto; padding: 32px var(--pad) 40px; }
.auth .logo { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.logo-word { font-size: 22px; font-weight: 800; letter-spacing: -.3px; }
.logo-word small { font-size: 13px; color: var(--ink3); font-weight: 600; margin-left: 6px; letter-spacing: 1px; }
.landing-hero { padding: 28px 0 8px; display: grid; gap: 20px; align-items: center; }
@media (min-width: 820px) { .landing-hero { grid-template-columns: 1.1fr .9fr; } }
.landing-hero h1 { font-size: 30px; letter-spacing: -.5px; }
.feature { display: flex; gap: 12px; align-items: flex-start; }
.feature .fi { width: 40px; height: 40px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; flex: none; }

/* 彈出面板 */
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 520px; background: var(--card); border-radius: 22px 22px 0 0; padding: 18px var(--pad) calc(20px + env(safe-area-inset-bottom)); max-height: 88vh; overflow-y: auto; }
@media (min-width: 820px) { .sheet-bg { align-items: center; } .sheet { border-radius: 22px; } }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: -6px auto 12px; }
.toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + 24px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--card); padding: 10px 16px; border-radius: 999px; font-size: 14px; z-index: 80; max-width: 90vw; text-align: center; }
.offline-bar { position: sticky; top: 0; z-index: 40; background: var(--sun-soft); color: var(--ink); font-size: 13px; text-align: center; padding: 6px 12px; }

/* 分享 */
.share-canvas { width: 100%; max-width: 360px; margin: 0 auto; border-radius: 20px; box-shadow: var(--shadow); }

/* 小工具 */
.divider { height: 1px; background: var(--line); margin: 12px 0; }
.kv { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.kv:first-child { border-top: 0; }
.kv span:first-child { color: var(--ink2); }
.empty { text-align: center; padding: 20px 8px; color: var(--ink3); font-size: 14px; }
.msg-ai > .deer { flex: none; width: 32px; height: 32px; }
.review > .deer, .review > span > .deer, .tip > .deer, .coach-head > .deer { flex: none; }
