/* 暫定樣式（等店主提供參考網站再改）：手機優先，米白底、深色字、照片為主
   顏色、字型集中在 :root，改風格時先改這裡 */
:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --text: #2b2622;
  --muted: #7a716a;
  --line: #e6dfd5;
  --accent: #6e5338;
  --accent-text: #ffffff;
  --warn-bg: #fff6e0;
  --warn-line: #f0d9a0;
  --error-bg: #fdecea;
  --error-line: #f2b8b0;
  --error-text: #a3271b;
  --ok-bg: #eef6ec;
  --ok-line: #bcdcb4;
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  --font-title: "Noto Serif TC", "Songti TC", serif;
  --max: 1080px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.7 var(--font); }
img, video { max-width: 100%; display: block; }
a { color: var(--accent); }
h1, h2 { font-family: var(--font-title); font-weight: 600; line-height: 1.35; }
h1 { font-size: 1.5rem; margin: .5rem 0 .75rem; }
h2 { font-size: 1.15rem; margin: 1.5rem 0 .5rem; }
[hidden] { display: none !important; }
.container { max-width: var(--max); margin: 0 auto; padding: 0 16px 48px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.pre { white-space: pre-line; }

/* 頁首、頁尾 */
.site-header { position: sticky; top: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; background: rgba(250, 247, 242, .95); border-bottom: 1px solid var(--line); backdrop-filter: blur(6px); }
.brand { font-family: var(--font-title); font-size: 1.2rem; color: var(--text); text-decoration: none; letter-spacing: .08em; }
.cart-link { color: var(--text); text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.cart-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: var(--accent-text);
  font-size: .75rem; line-height: 20px; text-align: center; }
.site-footer { border-top: 1px solid var(--line); padding: 24px 16px; text-align: center; font-size: .875rem; }
.footer-links { display: flex; justify-content: center; gap: 16px; }

/* 按鈕、表單 */
.btn { display: inline-block; padding: 12px 20px; border: 1px solid var(--accent); border-radius: var(--radius); background: var(--accent);
  color: var(--accent-text); font: inherit; text-decoration: none; text-align: center; cursor: pointer; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--accent); }
.btn-block { display: block; width: 100%; }
.link-btn { border: 0; background: none; color: var(--muted); text-decoration: underline; font: inherit; font-size: .875rem; cursor: pointer; padding: 4px; }
.select, input:not([type=checkbox]):not([type=radio]), textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--text); font: inherit; }
.invalid { border-color: var(--error-text) !important; }
.field { display: block; margin-bottom: 14px; }
.field-label { display: block; font-size: .9rem; margin-bottom: 4px; }
.field-hint { display: block; font-size: .8rem; color: var(--muted); }
.field-error { display: block; font-size: .85rem; color: var(--error-text); min-height: 0; }
.check { display: inline-flex; align-items: flex-start; gap: 8px; cursor: pointer; }
.check input { margin-top: 6px; }
.consent { margin: 8px 0 4px; font-size: .9rem; }
#turnstile { margin: 12px 0; min-height: 0; }

/* 訊息 */
.notice { padding: 12px 16px; margin: 12px 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.notice p { margin: 0 0 8px; } .notice p:last-child { margin-bottom: 0; }
.notice-warn { background: var(--warn-bg); border-color: var(--warn-line); }
.notice-error { background: var(--error-bg); border-color: var(--error-line); color: var(--error-text); }
.notice-ok { background: var(--ok-bg); border-color: var(--ok-line); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; transition: .25s; pointer-events: none;
  background: var(--text); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: .9rem; z-index: 50; max-width: 90vw; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.empty { text-align: center; padding: 40px 0; }

/* 列表 */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 12px 0 4px; scrollbar-width: none; }
.chip { flex: none; padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font: inherit; font-size: .9rem; cursor: pointer; color: var(--text); }
.chip.active { background: var(--text); color: #fff; border-color: var(--text); }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 8px 0 16px; }
.toolbar .select { width: auto; }
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 720px) { .grid { grid-template-columns: repeat(3, 1fr); gap: 20px; } }
@media (min-width: 1000px) { .grid { grid-template-columns: repeat(4, 1fr); } }
.card { display: block; color: var(--text); text-decoration: none; }
.card-img { position: relative; aspect-ratio: 4 / 5; overflow: hidden; border-radius: var(--radius); background: var(--line); }
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.card.is-sold .card-img img { opacity: .55; }
.card-body { padding: 8px 2px; }
.card-name { font-size: .95rem; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-price { font-size: .9rem; color: var(--muted); }
.badge { position: absolute; left: 8px; top: 8px; padding: 2px 10px; border-radius: 999px; font-size: .75rem; background: var(--surface); }
.price-row .badge { position: static; }
.badge-sold { background: var(--text); color: #fff; }
.badge-held { background: var(--warn-bg); border: 1px solid var(--warn-line); }
.img-placeholder { width: 100%; aspect-ratio: 4 / 5; background: var(--line); border-radius: var(--radius); }

/* 載入中 */
.skeleton .card-img, .skeleton .gallery-main, .sk-line { background: linear-gradient(90deg, var(--line) 25%, #efe9e0 50%, var(--line) 75%); background-size: 200% 100%; animation: sk 1.2s infinite; }
.skeleton .gallery-main { aspect-ratio: 1; border-radius: var(--radius); margin: 16px 0; }
.sk-line { height: 14px; border-radius: 7px; margin: 8px 0; }
.sk-line.short { width: 50%; }
@keyframes sk { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton *, .sk-line { animation: none; } }

/* 橫向捲動（推薦、加購） */
.scroller { display: grid; grid-auto-flow: column; grid-auto-columns: 42%; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 8px; }
.scroller > * { scroll-snap-align: start; }
@media (min-width: 720px) { .scroller { grid-auto-columns: 22%; } }

/* 商品頁 */
.crumbs { font-size: .85rem; color: var(--muted); margin: 12px 0; }
.product { display: grid; gap: 20px; }
@media (min-width: 860px) { .product { grid-template-columns: 1.1fr 1fr; align-items: start; } }
.gallery-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; border-radius: var(--radius); background: var(--line); scrollbar-width: none; }
.gallery-track::-webkit-scrollbar { display: none; }
.slide { flex: 0 0 100%; scroll-snap-align: start; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; }
.slide img, .slide video { width: 100%; height: 100%; object-fit: contain; background: var(--surface); }
.gallery-thumbs { display: flex; gap: 8px; margin-top: 8px; overflow-x: auto; }
.thumb { position: relative; flex: none; width: 64px; height: 64px; padding: 0; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: none; cursor: pointer; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-play { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; text-shadow: 0 0 4px #000; }
.price-row { display: flex; align-items: center; gap: 12px; }
.price { font-size: 1.3rem; }
.variants { border: 0; padding: 0; margin: 16px 0; }
.variants legend { font-size: .9rem; margin-bottom: 6px; }
.variant { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; }
.variant:has(input:checked) { border-color: var(--accent); }
.variant.disabled { opacity: .5; cursor: not-allowed; }
.variant-name { flex: 1; }
.variant-status { font-size: .8rem; color: var(--muted); }
.buy-box { display: grid; gap: 8px; margin: 16px 0; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 16px 0; font-size: .95rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.size { padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.size p { margin: 0 0 4px; }
.block { margin-top: 28px; }
.ring-table summary { cursor: pointer; font-weight: 600; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .85rem; background: var(--surface); }
th, td { border: 1px solid var(--line); padding: 6px 8px; text-align: center; white-space: nowrap; }

/* 清單 */
.cart-line { display: grid; grid-template-columns: 72px 1fr auto; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.cart-line.has-problem { background: var(--error-bg); }
.cart-thumb img, .cart-thumb .img-placeholder { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; aspect-ratio: 1; }
.cart-line-name { line-height: 1.4; }
.tag { display: inline-block; margin-left: 6px; padding: 0 8px; border-radius: 999px; background: var(--warn-bg); border: 1px solid var(--warn-line); font-size: .75rem; }
.line-problem { color: var(--error-text); font-size: .85rem; }
.qty { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.qty-btn { width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font: inherit; cursor: pointer; color: var(--text); }
.qty-btn:disabled { opacity: .35; cursor: not-allowed; }
.qty-num { min-width: 24px; text-align: center; }
.cart-line-amount { white-space: nowrap; }
.totals { display: grid; grid-template-columns: 1fr auto; gap: 6px; margin: 16px 0 8px; }
.totals dd { margin: 0; text-align: right; }
.totals .total { font-size: 1.15rem; font-weight: 600; padding-top: 6px; border-top: 1px solid var(--line); }
.checkout { margin-top: 16px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.checkout h2:first-child { margin-top: 0; }

/* 預訂完成 */
.steps { padding-left: 1.4em; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
.resv-text { white-space: pre-wrap; font-family: var(--font); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; user-select: all; }

/* 純文字頁 */
.prose { max-width: 720px; }
.prose ul { padding-left: 1.3em; }
