/* 呱呱市集（2026-11-19）。手機優先；沒有任何動畫／轉場（之後要加再過 /review-animations）。
   顏色：米白底、深咖啡字、橘色主按鈕。狀態一律符號＋文字，不靠顏色分辨。 */
:root {
  --bg: #fbf7ef;
  --card: #ffffff;
  --ink: #2e241b;
  --sub: #6b5b4d;
  --line: #e4d9c8;
  --main: #b4480f;
  --main-ink: #ffffff;
  --soft: #f4ead8;
  --warn: #8c1d18;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: var(--main); }
h1 { font-size: 1.35rem; margin: 0 0 .5rem; line-height: 1.35; }
h2 { font-size: 1.1rem; margin: 1.2rem 0 .5rem; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1rem 0; }
[hidden] { display: none !important; }

.top {
  position: sticky; top: 0; z-index: 5;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  padding: .5rem .75rem;
}
.brand { min-width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.15rem; color: var(--ink); text-decoration: none; }
.nav { display: flex; gap: .25rem; overflow-x: auto; margin-top: .35rem; scrollbar-width: none; }
.nav a {
  flex: none; padding: .45rem .7rem; border-radius: 999px;
  color: var(--ink); text-decoration: none; white-space: nowrap; min-height: 44px; display: flex; align-items: center;
}
.nav a.on { background: var(--ink); color: #fff; }

.view { max-width: 760px; margin: 0 auto; padding: .75rem; min-height: 60vh; }
.foot { max-width: 760px; margin: 1rem auto; padding: .75rem; color: var(--sub); font-size: .85rem; display: flex; gap: .75rem; flex-wrap: wrap; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 1rem; margin-bottom: .75rem; }
.card.list { padding: 0; }
.center { text-align: center; }
.hint { color: var(--sub); font-size: .9rem; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: .5rem 1rem;
  border: 1px solid var(--ink); border-radius: 10px;
  background: var(--card); color: var(--ink);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn.primary { background: var(--main); border-color: var(--main); color: var(--main-ink); }
.btn.small { min-height: 44px; padding: .25rem .7rem; font-size: .9rem; }
.btn:disabled { opacity: .55; cursor: default; }
.link { background: none; border: 0; padding: .5rem .25rem; color: var(--main); font: inherit; text-decoration: underline; cursor: pointer; min-height: 44px; }
.link.danger { color: var(--warn); }
.small-link { font-size: .9rem; font-weight: 400; margin-left: .6rem; }
:focus-visible { outline: 3px solid #1d5fd1; outline-offset: 2px; }

.row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-top: .75rem; }
.row.end { justify-content: flex-end; }
.row input { flex: 1; min-width: 8rem; }

.search { display: flex; gap: .5rem; margin-bottom: .5rem; }
.search input { flex: 1; }
.tabs { display: flex; gap: .35rem; overflow-x: auto; margin: .5rem 0 .75rem; scrollbar-width: none; }
.tab {
  flex: none; min-height: 44px; padding: .3rem .85rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font: inherit; text-decoration: none; cursor: pointer; display: inline-flex; align-items: center;
}
.tab.on { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 600; }

.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; }
@media (min-width: 620px) { .grid { grid-template-columns: repeat(3, 1fr); } }
.pcard { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; color: var(--ink); text-decoration: none; display: flex; flex-direction: column; }
.pcard img, .pcard .noimg { width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--soft); }
.noimg { display: flex; align-items: center; justify-content: center; color: var(--sub); font-size: .85rem; }
.pinfo { padding: .55rem .65rem .7rem; }
.ptitle { font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.pprice { color: var(--main); font-weight: 700; }
.pprice.big { font-size: 1.4rem; }
.pshop { color: var(--sub); font-size: .82rem; overflow-wrap: anywhere; }
.sold { color: var(--warn); font-weight: 700; }

.product .big { width: 100%; max-height: 70vh; object-fit: contain; border-radius: 10px; background: var(--soft); }
.thumbs { display: flex; gap: .5rem; flex-wrap: wrap; margin: .5rem 0; }
.thumb { width: 76px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--card); overflow: hidden; text-align: center; cursor: pointer; }
.thumb img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.thumb .link { min-height: 44px; width: 100%; padding: .1rem; font-size: .9rem; }
.buy { margin-top: .75rem; }

.field { display: block; margin: .8rem 0; }
.label { display: block; font-weight: 600; margin-bottom: .25rem; }
.field .hint { display: block; margin-top: .2rem; }
input, select, textarea {
  width: 100%; min-height: 44px; padding: .5rem .65rem;
  border: 1px solid #8a7968; border-radius: 10px;
  background: #fff; color: var(--ink); font: inherit;
}
input[type="checkbox"] { width: 22px; min-height: 22px; height: 22px; flex: none; accent-color: var(--main); }
input[type="file"] { border-style: dashed; }
.check { display: flex; align-items: center; gap: .5rem; min-height: 44px; }
.checks { display: flex; gap: 1rem; flex-wrap: wrap; }
/* 取貨方式一列三格，每格上面有看得見的欄名。手機：名稱｜運費 一排，要不要地址｜拿掉 一排 */
.shiprow { display: grid; grid-template-columns: 1fr 6.5rem; gap: .4rem .5rem; align-items: end; margin-bottom: .6rem; padding-bottom: .6rem; border-bottom: 1px dashed var(--line); }
.shipcell { display: block; min-width: 0; }
.minilabel { display: block; font-size: .85rem; color: var(--sub); font-weight: 600; margin-bottom: .15rem; }
.shiprow .c-del { justify-self: end; white-space: nowrap; }
@media (min-width: 620px) { .shiprow { grid-template-columns: 1fr 6.5rem 11rem auto; } }

/* 購物車的一項：名字一整排，下面是 −／數量／＋、小計、拿掉 */
.cartline { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .6rem; padding: .55rem 0; border-bottom: 1px dashed var(--line); }
.cartname { flex: 1 0 100%; overflow-wrap: anywhere; font-weight: 600; }
.cartname .hint { font-weight: 400; }
.qtybox { display: flex; align-items: center; gap: .3rem; }
.qbtn { min-width: 44px; padding: 0; font-size: 1.25rem; line-height: 1; }
.qnum { min-width: 2.2rem; text-align: center; font-weight: 700; font-size: 1.1rem; }
.cartsum { flex: 1; text-align: right; font-weight: 600; white-space: nowrap; }

/* 頁內對話框（取代 prompt／confirm）。沒有動畫 */
.dlg { width: min(92vw, 26rem); max-height: 85vh; overflow: auto; padding: 1rem; border: 2px solid var(--ink); border-radius: 14px; background: var(--card); color: var(--ink); }
.dlg::backdrop { background: rgba(46, 36, 27, .55); }
.dlg h2 { margin: 0 0 .5rem; }
.dlg p { margin: .3rem 0 .6rem; }
.dlgerr { color: var(--warn); font-weight: 700; }
.box.warn.big { font-size: 1.05rem; border-width: 2px; }
.box ul { margin: .3rem 0; padding-left: 1.2rem; }
.vidinfo { margin: .2rem 0 .5rem; font-size: .9rem; overflow-wrap: anywhere; }

.line { display: flex; gap: .6rem; align-items: center; padding: .3rem 0; }
.line.total, .total { font-size: 1.1rem; }
.orow { display: flex; gap: .7rem; align-items: center; padding: .8rem 1rem; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; flex-wrap: wrap; }
.orow:last-child { border-bottom: 0; }
.mini { width: 52px; height: 52px; border-radius: 8px; object-fit: cover; flex: none; background: var(--soft); }
.st { font-weight: 700; }
.box { background: var(--soft); border: 1px solid var(--line); border-radius: 10px; padding: .75rem .9rem; margin: .75rem 0; }
.box p { margin: .3rem 0; }
.box.warn { border-color: var(--warn); color: var(--warn); background: #fff; font-weight: 600; }
.bank { background: #fff; border: 1px dashed #8a7968; border-radius: 8px; padding: .6rem .75rem; font-weight: 600; user-select: all; }
.events { margin: 0; padding-left: 1.1rem; color: var(--sub); font-size: .9rem; }

.toast {
  position: fixed; left: 50%; bottom: calc(1rem + env(safe-area-inset-bottom)); transform: translateX(-50%);
  max-width: min(92vw, 28rem); padding: .7rem 1rem; border-radius: 10px;
  background: var(--ink); color: #fff; z-index: 20; text-align: center;
}

/* 全站搜尋（每一頁最上面） */
.toprow { display: flex; align-items: center; gap: .5rem; }
.gsearch { flex: 1; display: flex; gap: .35rem; min-width: 0; }
.gsearch input { flex: 1; min-width: 0; min-height: 44px; border-radius: 999px; padding-left: 1rem; }
.gsearch .btn { flex: none; min-width: 48px; border-radius: 999px; }
@media (max-width: 420px) { .brandname { display: none; } .brand { font-size: 1.5rem; } }
.sh { font-size: 1.1rem; margin: .25rem 0 0; overflow-wrap: anywhere; }
a.tab { text-decoration: none; display: flex; align-items: center; }
.chips { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; margin-bottom: .5rem; }
.chip { padding: .35rem .8rem; border-radius: 999px; background: var(--soft); color: var(--ink); text-decoration: none; min-height: 44px; display: flex; align-items: center; overflow-wrap: anywhere; }
.filters { display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: center; margin-bottom: .75rem; }
.frow { display: flex; align-items: center; gap: .4rem; min-height: 44px; white-space: nowrap; }
.frow input[type="checkbox"] { width: 22px; height: 22px; }
.pricef { display: flex; align-items: center; gap: .35rem; }
.pricef input { width: 5.5rem; }
.shoprow { text-decoration: none; color: var(--ink); }
.clip { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }

/* 訂單紀錄與存證照片 */
ol.events { list-style: none; padding-left: 0; color: var(--ink); font-size: .95rem; }
ol.events li { border-left: 3px solid var(--line); padding: .15rem 0 .6rem .75rem; margin-left: .3rem; }
.proof { width: 84px; height: 84px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: var(--soft); }
.picker { margin: .4rem 0; }
.picker input[type="file"] { max-width: 100%; min-height: 44px; }

/* 拍照／從相簿選：兩顆大按鈕，真正的 input 藏起來（還是點得到、鍵盤也選得到） */
.vh { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip-path: inset(50%); }
.photobtns { display: flex; gap: .5rem; flex-wrap: wrap; margin: .4rem 0; }
.photobtns label.btn { position: relative; flex: 1; min-width: 9rem; min-height: 52px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.photobtns label.btn:focus-within { outline: 3px solid var(--main); outline-offset: 2px; }
.photobtns.busy label.btn { opacity: .5; pointer-events: none; }
.photobtns.busy::after { content: "上傳中…"; width: 100%; color: var(--sub); font-size: .9rem; }

/* 存證影片、管理員列印 */
.proofvid { display: block; width: 100%; max-width: 320px; max-height: 320px; border-radius: 8px; background: #000; margin: .4rem 0; }
@media print {
  .top, .foot, .toast, .noprint, .photobtns, .proofvid { display: none !important; } /* 影片印不出來：紙上只留 .vidinfo 那一行字 */
  body { background: #fff; }
  .card { border: 0; box-shadow: none; padding: 0; }
  .proof { width: 150px; height: 150px; object-fit: contain; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .thumbs a { display: inline-block; break-inside: avoid; }
  ol.events li { break-inside: avoid; }
  .box.warn { border: 1px solid #000; color: #000; }
}

/* 長字不撐破版面 */
.card p, .line span, .orow div, .hint { overflow-wrap: anywhere; }
.line .grow + span, .line b { flex: none; }
