/* 編輯感極簡：暖米白紙底、墨黑字、襯線大數字、細線、膠囊按鈕 */
:root {
  color-scheme: light;
  --bg: #f3efe8; --paper: #faf8f4; --tint: #ebe6dd; --tint2: #e3ddd2; --line: #ddd6ca;
  --ink: #1f1c18; --ink2: #4a453e; --mute: #8c857a; --faint: #b5ad9f;
  --sage: #66744f; --sage-soft: #e3e6d6; --red: #9b3d2e;
  --serif: "Instrument Serif", "Noto Serif TC", "Songti TC", serif;
  --serif-tc: "Noto Serif TC", "Songti TC", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", sans-serif;
  --tab-h: 66px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); -webkit-text-size-adjust: 100%; touch-action: manipulation; }
body { font: 14px/1.5 var(--sans); letter-spacing: .01em; -webkit-font-smoothing: antialiased; }
/* 很淡的紙張紋理 */
body::before { content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .38 0 0 0 0 .28 0 0 0 .06 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
.num { font-variant-numeric: tabular-nums; }
.serif { font-family: var(--serif); font-weight: 400; letter-spacing: -.01em; }
.lab { display: block; font-size: 10.5px; letter-spacing: .16em; color: var(--mute); text-transform: uppercase; font-weight: 500; }
#app { position: relative; z-index: 1; max-width: 560px; margin: 0 auto; min-height: 100vh; padding-bottom: calc(var(--tab-h) + 40px + env(safe-area-inset-bottom)); }
main { padding: 0 20px; }

.ms { font-family: 'Material Symbols Rounded'; font-weight: normal; font-style: normal; font-size: 20px; line-height: 1; letter-spacing: normal;
  text-transform: none; white-space: nowrap; direction: ltr; display: inline-block; vertical-align: middle; font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased; font-variation-settings: 'FILL' 0, 'wght' 300, 'opsz' 24; user-select: none; }

/* 頂部 */
.top { padding: calc(14px + env(safe-area-inset-top)) 20px 6px; }
.top-row { display: flex; align-items: flex-start; gap: 6px; }
.mkt-btn { flex: 1; min-width: 0; text-align: left; }
.mkt-btn .t { display: flex; align-items: center; gap: 2px; font-family: var(--serif-tc); font-weight: 600; font-size: 25px; line-height: 1.25; margin-top: 4px; }
.mkt-btn .t span:first-child { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mkt-btn .lab { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mkt-btn .t .ms { color: var(--mute); font-size: 22px; }
.icon-btn { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; flex: none; color: var(--ink2); }
.icon-btn .ms { font-size: 20px; }
.icon-btn.on { background: var(--ink); border-color: var(--ink); color: var(--paper); }
h1 { font-family: var(--serif-tc); font-weight: 600; font-size: 28px; line-height: 1.2; margin: 6px 0 2px; letter-spacing: .02em; }
.sub { color: var(--mute); font-size: 12.5px; margin: 0; }

/* 摘要卡（參考 daily kit） */
.card-box { background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 16px 18px; }
.hero { margin: 14px 0 10px; }
.hero .big { font-family: var(--serif); font-size: 46px; line-height: 1.05; margin: 8px 0 2px; letter-spacing: -.02em; }
.hero .big small { font-family: var(--sans); font-size: 12.5px; color: var(--mute); letter-spacing: .01em; margin-left: 6px; }
.prog { height: 4px; background: var(--tint); border-radius: 4px; margin: 12px 0 6px; overflow: hidden; }
.prog i { display: block; height: 100%; background: var(--sage); border-radius: 4px; }
.prog-l { display: flex; justify-content: space-between; font-size: 11px; color: var(--mute); }
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.duo .card-box { padding: 12px 14px; }
.duo b { display: block; font-family: var(--serif); font-weight: 400; font-size: 26px; line-height: 1.15; margin-top: 4px; }
.duo small { color: var(--mute); font-size: 11px; }
.pos { color: var(--sage); }
.neg { color: var(--red); }
.note { display: flex; gap: 10px; align-items: flex-start; background: var(--tint); border-left: 2px solid var(--ink2); border-radius: 4px 12px 12px 4px; padding: 10px 14px; margin-bottom: 18px; }
.note b { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 17px; display: block; line-height: 1.2; }
.note b.tc { font-family: var(--serif-tc); font-style: normal; font-size: 14px; font-weight: 600; }
.note small { color: var(--mute); font-size: 12px; }

/* 搜尋、篩選（參考膠囊導覽） */
.search { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); padding: 0 2px; margin: 0 0 12px; color: var(--mute); }
.search input { flex: 1; border: 0; background: none; padding: 10px 0; outline: none; color: var(--ink); }
.search input::placeholder { color: var(--faint); }
.pillbar { display: inline-flex; background: var(--tint); border-radius: 999px; padding: 3px; gap: 2px; }
.pillbar button { padding: 6px 13px; border-radius: 999px; color: var(--mute); font-size: 13px; white-space: nowrap; }
.pillbar button.on { background: var(--tint2); color: var(--ink); }
.scroll { display: flex; overflow-x: auto; scrollbar-width: none; margin: 0 -20px; padding: 0 20px; }
.scroll::-webkit-scrollbar { display: none; }
.bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 10px 0 16px; }
.count { font-size: 11px; letter-spacing: .14em; color: var(--mute); white-space: nowrap; }
.chip { flex: none; padding: 6px 13px; border-radius: 999px; background: var(--tint); font-size: 13px; color: var(--mute); white-space: nowrap; }
.chip.on { background: var(--ink); color: var(--paper); }
.chip .ms { font-size: 17px; vertical-align: -3px; }

/* 商品格 */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px 14px; }
@media (min-width: 520px) { .grid { grid-template-columns: repeat(3, 1fr); } }
.card { position: relative; text-align: left; width: 100%; display: block; }
.ph { position: relative; aspect-ratio: 4/5; border-radius: 14px; overflow: hidden; display: grid; place-items: center; background: var(--tint); }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.emo { display: grid; place-items: center; color: var(--faint); }
.emo .ms { font-size: 54px; font-variation-settings: 'wght' 200; }
.qty { position: absolute; left: 8px; top: 8px; background: rgba(250, 248, 244, .9); color: var(--ink2); font-size: 11px; padding: 2px 8px; border-radius: 999px; }
.meta-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin: 10px 2px 0; }
.nm { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.price { font-family: var(--serif); font-size: 22px; line-height: 1; white-space: nowrap; }
.card .lab { margin: 0 2px; }
.cost { margin: 2px 2px 0; font-size: 11.5px; color: var(--mute); }
.cost em { font-style: normal; color: var(--sage); }
.card.out .ph img, .card.out .ph .emo, .lrow.out .thumb img { filter: grayscale(1) opacity(.45); }
.card.out .price, .lrow.out .price { color: var(--faint); text-decoration: line-through; text-decoration-thickness: 1px; }
/* 手繪墨水圈章 */
.stamp { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.stamp svg { width: 72%; max-width: 150px; transform: rotate(-9deg); color: var(--ink); }
.stamp text { font-family: var(--serif); font-style: italic; }

/* 列表模式（參考灰色商品卡） */
.list { display: flex; flex-direction: column; gap: 10px; }
.lrow { display: flex; gap: 12px; align-items: stretch; width: 100%; text-align: left; background: var(--tint); border-radius: 16px; padding: 10px 10px 10px 16px; position: relative; }
.lrow .info { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 4px 0; }
.lrow .nm { font-size: 15px; margin-top: 3px; white-space: normal; }
.lrow .price { margin-top: auto; font-size: 22px; padding-top: 8px; }
.lrow .cost { margin: 2px 0 0; }
.lrow .thumb { width: 92px; height: 92px; border-radius: 10px; background: var(--paper); }
.lrow .thumb .ms { font-size: 34px; }
.lrow .stamp svg { width: 86%; }

.sorting .card, .sorting .lrow { animation: wiggle .35s ease-in-out infinite alternate; cursor: grab; }
.sorting > :nth-child(2n) { animation-delay: .17s; }
@keyframes wiggle { from { transform: rotate(-.8deg); } to { transform: rotate(.8deg); } }
.sortable-ghost { opacity: .3; }
.sort-note { display: flex; justify-content: space-between; align-items: center; gap: 10px; border: 1px dashed var(--faint); border-radius: 14px; padding: 10px 12px 10px 14px; font-size: 13px; color: var(--ink2); margin: 6px 0 16px; }
.sort-note button { background: var(--ink); color: var(--paper); border-radius: 999px; padding: 6px 14px; font-size: 13px; }
.empty { text-align: center; color: var(--mute); padding: 48px 12px; }
.empty .big .ms { font-size: 44px; color: var(--faint); }

/* 底部分頁＋中央新增鈕 */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: rgba(250, 248, 244, .94); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabbar nav { max-width: 560px; margin: 0 auto; display: flex; align-items: center; height: var(--tab-h); padding: 0 8px; }
.tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 9.5px; letter-spacing: .16em; color: var(--faint); }
.tabbar .ms { font-size: 22px; }
.tabbar button.on { color: var(--ink); font-weight: 600; }
.tabbar button.on .ms { font-variation-settings: 'FILL' 0, 'wght' 500; }
.tabbar .fab { flex: none; width: 54px; height: 54px; margin: -26px 8px 0; border-radius: 50%; background: var(--ink); color: var(--paper); box-shadow: 0 10px 22px -10px rgba(31, 28, 24, .7); gap: 0; }
.tabbar .fab .ms { font-size: 28px; font-variation-settings: 'wght' 300; }

/* 一般區塊 */
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 16px 18px; margin-bottom: 12px; }
.panel > .lab { margin-bottom: 8px; }
.seg { display: flex; background: var(--tint); border-radius: 999px; padding: 3px; margin: 14px 0 6px; }
.seg button { flex: 1; padding: 8px 0; border-radius: 999px; color: var(--mute); font-size: 13px; }
.seg button.on { background: var(--paper); color: var(--ink); box-shadow: 0 1px 2px rgba(31, 28, 24, .08); }
.big-num { font-family: var(--serif); font-size: 52px; line-height: 1.05; letter-spacing: -.02em; margin: 6px 0 4px; }
.rows { margin: 8px 0 0; }
.row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.row:first-child { border-top: 0; }
.row span { color: var(--mute); }
.row b { font-weight: 500; }
.row b.minus { color: var(--red); }
.row.total b { font-family: var(--serif); font-size: 20px; font-weight: 400; }
.row.total span { color: var(--ink); }
.hbar { margin: 10px 0; }
.hbar .lbl { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 5px; }
.hbar .lbl span { color: var(--mute); font-size: 12px; }
.hbar .trk { height: 4px; border-radius: 4px; background: var(--tint); overflow: hidden; }
.hbar .trk i { display: block; height: 100%; border-radius: 4px; background: var(--ink2); }
.hbar:first-of-type .trk i { background: var(--sage); }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.kpis div { background: var(--tint); border-radius: 12px; padding: 10px; }
.kpis b { display: block; font-family: var(--serif); font-weight: 400; font-size: 22px; line-height: 1.2; margin-top: 2px; }

/* 場次列表 */
.mkt { display: block; width: 100%; text-align: left; background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 16px 18px; margin-bottom: 10px; position: relative; }
.mkt.cur { border-color: var(--ink); }
.mkt .name { font-family: var(--serif-tc); font-size: 18px; font-weight: 600; margin: 4px 0 2px; }
.mkt .where { color: var(--mute); font-size: 12.5px; }
.mkt .pill { position: absolute; right: 14px; top: 14px; font-size: 10px; letter-spacing: .14em; border: 1px solid var(--ink); padding: 2px 8px; border-radius: 999px; }
.mkt .stats { display: flex; gap: 22px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.mkt .stats b { display: block; font-family: var(--serif); font-weight: 400; font-size: 20px; line-height: 1.2; }

/* 售出紀錄 */
.sale { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.sale:first-child { border-top: 0; }
.thumb { position: relative; width: 44px; height: 44px; border-radius: 10px; overflow: hidden; display: grid; place-items: center; flex: none; background: var(--tint); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .ms { font-size: 22px; }
.sale .mid { flex: 1; min-width: 0; }
.sale .mid b { display: block; font-weight: 500; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sale .mid small { color: var(--mute); font-size: 12px; }
.sale .amt { text-align: right; font-family: var(--serif); font-size: 19px; }
.sale .amt small { display: block; font-family: var(--sans); font-size: 11px; color: var(--faint); text-decoration: line-through; }
.x { width: 30px; height: 30px; border-radius: 50%; color: var(--faint); display: grid; place-items: center; }
.x .ms { font-size: 18px; }

/* 更多 */
.menu { background: var(--paper); border: 1px solid var(--line); border-radius: 18px; margin-bottom: 12px; overflow: hidden; }
.menu button, .menu .mi { display: flex; align-items: center; gap: 14px; width: 100%; padding: 15px 18px; text-align: left; border-top: 1px solid var(--line); }
.menu > :first-child { border-top: 0; }
.menu .ms { flex: none; font-size: 21px; color: var(--ink2); }
.menu span:not(.ms) { flex: 1; }
.menu small { color: var(--mute); font-size: 12px; }
.proto { font-size: 10.5px; letter-spacing: .16em; color: var(--faint); text-align: center; margin: 24px 0; }

/* 底部彈出面板 */
#sheet { position: fixed; inset: 0; z-index: 20; pointer-events: none; }
#sheet.open { pointer-events: auto; }
.backdrop { position: absolute; inset: 0; background: rgba(31, 28, 24, .3); opacity: 0; transition: opacity .2s; }
#sheet.open .backdrop { opacity: 1; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; max-width: 560px; margin: 0 auto; max-height: 92vh; overflow-y: auto;
  background: var(--bg); border-radius: 24px 24px 0 0; padding: 8px 20px calc(20px + env(safe-area-inset-bottom));
  transform: translateY(100%); transition: transform .28s cubic-bezier(.2, .8, .2, 1); }
#sheet.open .sheet { transform: none; }
.grab { width: 36px; height: 4px; border-radius: 3px; background: var(--line); margin: 0 auto 12px; }
.sheet h2 { font-family: var(--serif-tc); font-weight: 600; font-size: 21px; margin: 4px 0 14px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.sheet h2 button { font-family: var(--sans); font-size: 13px; color: var(--mute); font-weight: 400; }
.field { margin-bottom: 14px; }
.field > label, .field > .lbl { display: block; font-size: 10.5px; letter-spacing: .14em; color: var(--mute); margin-bottom: 6px; }
.input { width: 100%; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; outline: none; }
.input:focus { border-color: var(--ink2); }
.money-in { position: relative; }
.money-in::before { content: '$'; position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--mute); font-family: var(--serif); font-size: 20px; }
.money-in .input { padding-left: 28px; font-family: var(--serif); font-size: 22px; padding-top: 7px; padding-bottom: 7px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hint { font-size: 12px; color: var(--sage); margin-top: 4px; }
.hint.neg { color: var(--red); }
.btn { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; padding: 14px; border-radius: 999px; background: var(--ink); color: var(--paper); font-weight: 500; font-size: 15px; letter-spacing: .04em; }
.btn .ms { font-size: 19px; }
.btn.brand { background: var(--ink); color: var(--paper); }
.btn.ghost { background: none; color: var(--ink); border: 1px solid var(--ink); }
.btn.danger { background: none; color: var(--red); }
.btn.red { background: var(--red); color: #fff; }
.btn + .btn { margin-top: 8px; }
.btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.btns .btn + .btn { margin-top: 0; }

/* 拍照區 */
.shot { display: grid; grid-template-columns: 112px 1fr; gap: 14px; margin-bottom: 16px; }
.shot .ph { aspect-ratio: 1; border: 1px dashed var(--faint); background: var(--paper); }
.shot .acts { display: flex; flex-direction: column; gap: 8px; justify-content: center; }
.shot label { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 11px; border-radius: 999px; border: 1px solid var(--ink); font-size: 14px; cursor: pointer; }
.shot label.main { background: var(--ink); color: var(--paper); }
.shot label .ms { font-size: 19px; }
.shot input { display: none; }
.stepper { display: flex; align-items: center; background: var(--paper); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.stepper button { width: 50px; height: 44px; display: grid; place-items: center; }
.stepper b { flex: 1; text-align: center; font-family: var(--serif); font-weight: 400; font-size: 22px; }

/* 商品詳細 */
.detail-ph { aspect-ratio: 1; border-radius: 18px; overflow: hidden; display: grid; place-items: center; margin-bottom: 16px; position: relative; background: var(--tint); }
.detail-ph img { width: 100%; height: 100%; object-fit: cover; }
.detail-ph .emo .ms { font-size: 96px; }
.detail-ph .stamp svg { width: 46%; }
.price-line { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: -4px 0 6px; }
.price-line .p { font-family: var(--serif); font-size: 40px; line-height: 1; }
.price-line .c { color: var(--mute); font-size: 13px; }
.price-line .c em { font-style: normal; color: var(--sage); }
.meta { color: var(--mute); font-size: 12.5px; margin-bottom: 16px; }

/* 售出面板 */
.quick { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.quick button { padding: 6px 12px; border-radius: 999px; background: var(--tint); font-size: 13px; color: var(--ink2); }
.pays { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.pays button { padding: 10px 2px; border-radius: 999px; border: 1px solid var(--line); font-size: 12.5px; color: var(--ink2); }
.pays button.on { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.sum-line { display: flex; justify-content: space-between; align-items: baseline; margin: 8px 0 14px; padding: 14px 16px; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; }
.sum-line b { font-family: var(--serif); font-weight: 400; font-size: 32px; line-height: 1; }
.sum-line small { color: var(--mute); font-size: 12px; }

/* 圖卡 */
canvas.poster { width: 100%; border-radius: 10px; border: 1px solid var(--line); display: block; margin-bottom: 12px; }
.opts { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }

/* 提示訊息 */
#toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + 24px + env(safe-area-inset-bottom)); transform: translate(-50%, 16px); z-index: 30;
  background: var(--ink); color: var(--paper); border-radius: 999px; padding: 10px 18px; font-size: 13px; display: flex; gap: 14px; align-items: center;
  opacity: 0; pointer-events: none; transition: .2s; white-space: nowrap; }
#toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
#toast button { color: #d9cdb4; text-decoration: underline; text-underline-offset: 3px; }

/* 對話框 */
.dlg { position: fixed; inset: 0; z-index: 40; background: rgba(31, 28, 24, .35); display: grid; place-items: center; padding: 24px; }
.dlg-box { width: 100%; max-width: 320px; background: var(--bg); border-radius: 20px; padding: 20px; }
.dlg-box > b { display: block; font-family: var(--serif-tc); font-size: 18px; font-weight: 600; margin-bottom: 6px; }
.dlg-box p { margin: 0 0 4px; color: var(--mute); font-size: 13px; }
.dlg-box .input { margin: 8px 0 4px; }
.dlg-box .btns { margin-top: 16px; }
.mkt-btn .t { text-wrap: balance; }
.panel h3 { margin: 0 0 6px; font-size: 10.5px; letter-spacing: .16em; color: var(--mute); font-weight: 500; }

/* ===== 擺攤頁 ===== */
.mkt-btn .t.sm { font-size: 21px; }
.live { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: 12px; color: var(--mute); white-space: nowrap; }
.live b { font-family: var(--serif); font-weight: 400; font-size: 22px; color: var(--ink); line-height: 1; }
.live .mini { flex: 1; min-width: 30px; height: 3px; background: var(--tint); border-radius: 3px; overflow: hidden; }
.live .mini i { display: block; height: 100%; background: var(--sage); }
.chips-row { gap: 6px; padding-top: 8px; padding-bottom: 8px; }
.chips-row.sticky { position: sticky; top: 0; z-index: 4; background: var(--bg); margin: 2px 0 6px; padding: 8px 20px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 8px; }
@media (min-width: 520px) { .grid3 { grid-template-columns: repeat(4, 1fr); } }
.tile { position: relative; display: block; width: 100%; text-align: left; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: manipulation; }
.tile .ph { aspect-ratio: 1; border-radius: 12px; transition: transform .15s; }
.tile img { pointer-events: none; -webkit-touch-callout: none; }
.tile.press .ph { transform: scale(.94); }
.tile.press .ph::after { content: ''; position: absolute; inset: 0; background: rgba(31, 28, 24, .12); animation: fill .45s linear forwards; transform-origin: bottom; }
@keyframes fill { from { clip-path: inset(100% 0 0 0); } to { clip-path: inset(0 0 0 0); } }
.no { position: absolute; left: 6px; top: 6px; background: rgba(250, 248, 244, .92); color: var(--ink); font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; z-index: 1; }
.tile .qty { left: auto; right: 6px; top: auto; bottom: 6px; font-size: 10.5px; }
.pick { position: absolute; inset: 0; border: 2.5px solid var(--ink); border-radius: 12px; display: flex; justify-content: flex-end; align-items: flex-start; padding: 5px; }
.pick .ms, .pick b { background: var(--ink); color: var(--paper); border-radius: 999px; font-size: 16px; min-width: 24px; height: 24px; display: grid; place-items: center; font-variation-settings: 'wght' 600; }
.pick b { font-family: var(--sans); font-size: 12px; margin-left: -6px; padding: 0 7px 0 9px; }
.tile.picked .ph img, .tile.picked .ph .emo { opacity: .75; }
.tile .tl { margin: 6px 2px 0; }
.tile .price { font-size: 19px; }
.tile .tn { margin: 1px 2px 0; font-size: 11.5px; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile.out .ph img, .tile.out .ph .emo { filter: grayscale(1) opacity(.45); }
.tile.out .price { color: var(--faint); text-decoration: line-through; }
.fold { display: flex; justify-content: space-between; align-items: center; width: 100%; margin: 26px 0 12px; padding: 12px 2px; border-top: 1px solid var(--line); color: var(--mute); font-size: 13px; }

/* 大拇指區：固定在分頁列上方 */
body[data-tab=sell] #app { padding-bottom: calc(var(--tab-h) + 110px + env(safe-area-inset-bottom)); }
.dock { position: fixed; z-index: 7; left: 0; right: 0; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom)); max-width: 560px; margin: 0 auto;
  display: flex; gap: 8px; padding: 14px 14px 10px; background: linear-gradient(transparent, var(--bg) 30%); }
.numbtn { flex: none; width: 66px; height: 60px; border-radius: 20px; border: 1px solid var(--ink); background: var(--paper); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; font-size: 10.5px; letter-spacing: .1em; }
.numbtn .ms { font-size: 24px; }
.cartbar { flex: 1; min-width: 0; height: 60px; border-radius: 20px; background: var(--ink); color: var(--paper); display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 18px; box-shadow: 0 12px 24px -14px rgba(31, 28, 24, .8); }
.cartbar b { font-family: var(--serif); font-weight: 400; font-size: 28px; line-height: 1; }
.cartbar .cb-l, .cartbar .cb-r { display: flex; align-items: center; gap: 4px; font-size: 13px; }
.cartbar .ms { font-size: 19px; }
.cartbar.empty { background: var(--tint); color: var(--mute); justify-content: center; box-shadow: none; }
.cartbar .hint { font-size: 12.5px; color: var(--mute); }
body[data-tab=sell] #toast { bottom: calc(var(--tab-h) + 88px + env(safe-area-inset-bottom)); }
#toast { max-width: calc(100vw - 24px); }
#toast span { overflow: hidden; text-overflow: ellipsis; }

/* 數字鍵盤 */
.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.pad button { height: 54px; border-radius: 16px; background: var(--paper); border: 1px solid var(--line); font-family: var(--serif); font-size: 28px; line-height: 1; }
.pad button:active { background: var(--tint); }
.pad button .ms { font-size: 24px; }
.pad-disp { display: flex; justify-content: center; align-items: baseline; gap: 4px; padding: 6px 0 2px; }
.pad-disp .pre { font-family: var(--serif); font-size: 32px; color: var(--mute); }
.pad-disp b { font-family: var(--serif); font-weight: 400; font-size: 60px; line-height: 1; }
.pv { min-height: 64px; display: flex; flex-direction: column; justify-content: center; }
.pv .sale { border: 1px solid var(--line); border-radius: 14px; padding: 8px 12px; background: var(--paper); }
.pv-hint { color: var(--mute); font-size: 12.5px; text-align: center; margin: 4px 0; }
.btn.big { padding: 17px; font-size: 16px; }

/* 結帳 */
.ck-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.ck-row { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 8px; border-radius: 14px; border: 1px solid transparent; cursor: pointer; }
.ck-row.on { background: var(--paper); border-color: var(--ink); }
.ck-row .mid { flex: 1; min-width: 0; }
.ck-row .mid b { display: block; font-weight: 500; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ck-row .mid small { color: var(--mute); font-size: 11.5px; }
.ck-row .amt { font-family: var(--serif); font-size: 21px; }
.ck-total { text-align: center; padding: 10px 12px 12px; border-radius: 18px; border: 1px dashed var(--faint); cursor: pointer; }
.ck-total.on { border: 1px solid var(--ink); background: var(--paper); }
.ck-total b { display: block; font-family: var(--serif); font-weight: 400; font-size: 52px; line-height: 1.1; }
.ck-total small { color: var(--mute); font-size: 12px; }
.ck-total s { color: var(--faint); }
.sheet .quick { justify-content: center; margin-top: 10px; }
.sheet .pays { margin-bottom: 12px; }
.sale .amt { background: none; text-align: right; }

/* 商品頁 */
.lrow { align-items: center; padding: 10px 16px 10px 10px; }
.lrow .info { padding: 0; }
.lrow .price { margin: 0; padding: 0; font-size: 22px; flex: none; }
.lrow .thumb { width: 64px; height: 64px; }
.lrow .stamp svg { width: 64px; }
.lrow .nm { font-size: 14.5px; margin-top: 1px; }
.card .no, .detail-ph .no { left: 8px; top: 8px; }
.fab-float { position: fixed; z-index: 7; right: max(20px, calc(50% - 260px)); bottom: calc(var(--tab-h) + 18px + env(safe-area-inset-bottom));
  width: 58px; height: 58px; border-radius: 50%; background: var(--ink); color: var(--paper); display: grid; place-items: center; box-shadow: 0 12px 24px -12px rgba(31, 28, 24, .8); }
.fab-float .ms { font-size: 26px; }
.tabbar button { font-size: 10px; }
.menu .mi .x { width: 30px; }

/* ===== 每列張數（--cols）、取消選取、數量增減 ===== */
.grid3, .grid { grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); }
@media (min-width: 520px) { .grid3, .grid { grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); } }
[data-pinch] { touch-action: pan-y; }
[data-pinch] .tile, [data-pinch] .card { touch-action: pan-y; }
.grid3.dense { gap: 10px 6px; }
.grid3.dense .tn { display: none; }
.grid3.dense .tile .price { font-size: 16px; }
.grid3.dense .no { font-size: 9.5px; padding: 0 5px; left: 4px; top: 4px; }
.grid3.dense .qty { font-size: 9.5px; padding: 1px 5px; right: 4px; bottom: 4px; }
.grid3.dense .ph, .grid3.dense .pick { border-radius: 9px; }
.grid3.xdense .tl { display: none; }
.grid3.xdense .tstep i .ms { font-size: 15px; }
.grid.dense { gap: 16px 8px; }
.grid.dense .cost, .grid.dense .nm { display: none; }
.grid.dense .price { font-size: 17px; }
.colbtn { position: relative; }
.colbtn b { position: absolute; right: -2px; bottom: -2px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--ink); color: var(--paper); font-size: 10px; display: grid; place-items: center; font-weight: 600; }
/* 選取後的數量增減 */
.tstep { position: absolute; left: 6px; right: 6px; bottom: 6px; z-index: 2; display: flex; align-items: center; justify-content: space-between; background: var(--ink); color: var(--paper); border-radius: 999px; height: 30px; padding: 0 2px; }
.tstep i { width: 30px; height: 30px; display: grid; place-items: center; font-style: normal; }
.tstep i.off { opacity: .3; }
.tstep b { font-size: 13px; font-weight: 600; }
.grid3.dense .tstep { left: 3px; right: 3px; bottom: 3px; height: 24px; }
.grid3.dense .tstep i { width: 24px; height: 24px; }
.qs { display: inline-flex; align-items: center; gap: 2px; margin-top: 4px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); }
.qs button { width: 28px; height: 26px; display: grid; place-items: center; }
.qs button.off { opacity: .3; }
.qs .ms { font-size: 17px; }
.qs b { min-width: 18px; text-align: center; font-size: 13px; font-weight: 600; }
.h2-acts { display: flex; gap: 16px; }
.h2-acts button { font-family: var(--sans); font-size: 13px; color: var(--mute); font-weight: 400; }
