/*
 * 小蟹選物
 * 概念：選物店的「吊牌」。商品卡是一張吊牌（打洞、切角、橘色價格牌），其他地方保持安靜。
 * 色票（5 色）：深潮綠 ink、蟹殼橘 shell、熟蟹橘 cooked、淺潮灰 tide、白 paper。紅色只用在錯誤。
 * 字體：中文用手機內建黑體；價格、編號等英數字用 Bricolage Grotesque 800（OFL，自己網站提供）。
 * 手機優先：預設樣式就是手機，寬螢幕才在下面的 @media 加欄位。
 */

@font-face {
  font-family: "Brico";
  src: url("/public/bricolage-800.woff2") format("woff2");
  font-weight: 800;
  font-display: swap;
  unicode-range: U+0020-007E;
}

:root {
  --ink: #1B3D44;
  --shell: #E9A77E;
  --cooked: #A9502A;
  --tide: #E6EEEB;
  --paper: #FFFFFF;

  --ink-strong: color-mix(in srgb, var(--ink) 80%, black);
  --muted: color-mix(in srgb, var(--ink) 66%, var(--paper));
  --line: color-mix(in srgb, var(--ink) 16%, var(--paper));
  --shell-soft: color-mix(in srgb, var(--shell) 22%, var(--paper));
  --error: #B42318;

  --num: "Brico", "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  --gutter: 16px;
}

* { box-sizing: border-box; }

html { color-scheme: light; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--tide);
  color: var(--ink);
  font-family: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.7;
}

body.modal-open { overflow: hidden; }
[hidden] { display: none !important; }
img, svg { max-width: 100%; }

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }

:focus-visible { outline: 3px solid var(--shell); outline-offset: 2px; }

h1, h2, h3 { line-height: 1.3; letter-spacing: -0.01em; }

.skip-link {
  position: absolute; top: -100px; left: var(--gutter); z-index: 100;
  padding: 10px 16px; background: var(--ink); color: var(--paper); border-radius: 8px;
}
.skip-link:focus { top: 12px; }

/* ── 頁首：深潮綠一條；分類是可以左右滑的一排 ── */
.site-header { background: var(--ink); color: var(--paper); }

.header-inner {
  position: relative;
  width: calc(100% - 2 * var(--gutter));
  max-width: 1080px;
  margin: 0 auto;
  padding: 10px 0 0;
}

.brand {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 44px;
  font-size: 1.15rem; font-weight: 800; letter-spacing: 0.02em;
  text-decoration: none;
}
.brand img { width: 36px; height: 36px; border-radius: 50%; }

.site-nav {
  display: flex; gap: 8px;
  margin: 6px calc(-1 * var(--gutter)) 0;
  padding: 0 var(--gutter) 12px;
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.site-nav::-webkit-scrollbar { display: none; }
.site-nav .nav-chip {
  display: inline-block;
  flex: none;
  padding: 6px 14px;
  border: 1px solid color-mix(in srgb, var(--paper) 35%, transparent);
  border-radius: 999px;
  font-size: 0.9rem; text-decoration: none; white-space: nowrap;
}
.site-nav .nav-chip:hover { background: color-mix(in srgb, var(--paper) 12%, transparent); }

.header-actions { position: absolute; top: 10px; right: 0; display: flex; align-items: center; gap: 8px; }
.search-link { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; color: var(--paper); }
.search-link:hover { background: color-mix(in srgb, var(--paper) 12%, transparent); }
.cart-link {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 0 14px;
  border-radius: 999px; background: var(--paper); color: var(--ink);
  font-weight: 700; font-size: 0.92rem; text-decoration: none;
}

.cart-bubble {
  display: inline-grid; place-items: center;
  min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 999px; background: var(--shell); color: var(--ink);
  font-family: var(--num); font-size: 0.78rem; font-weight: 800; line-height: 1;
}
.cart-bubble.is-pinched { animation: pinch 420ms ease-out; }
@keyframes pinch {
  0% { transform: scale(1); }
  30% { transform: scale(1.45, 0.8); }
  60% { transform: scale(0.9, 1.15); }
  100% { transform: scale(1); }
}

/* ── 版面 ── */
.page {
  width: calc(100% - 2 * var(--gutter));
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 0 64px;
}
.narrow-page { max-width: 640px; }

.page-head { margin-bottom: 20px; }
.page-head h1 { margin: 0 0 6px; font-size: 1.6rem; font-weight: 800; }

.section { margin-top: 28px; }
.section-title { margin: 0 0 12px; font-size: 1.1rem; font-weight: 800; }

.muted { margin: 4px 0; color: var(--muted); }
.empty-note { padding: 28px 0; color: var(--muted); }

.breadcrumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; color: var(--muted); font-size: 0.85rem; }
.breadcrumbs a { text-decoration: none; }

/* ── 首頁：一句話＋三個條件（打勾＝小蟹挑過） ── */
.intro { padding: 8px 0 4px; }
.intro h1 {
  margin: 0;
  font-size: clamp(1.9rem, 8.5vw, 3.2rem);
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: -0.03em;
}

.facts {
  display: flex; flex-wrap: wrap; gap: 6px 18px;
  margin: 14px 0 0; padding: 10px 0;
  list-style: none;
  border-top: 1px dashed var(--line); border-bottom: 1px dashed var(--line);
  font-size: 0.92rem; font-weight: 600;
}
.facts li::before { content: "✓"; margin-right: 6px; color: var(--cooked); font-weight: 900; }

/* ── 商品吊牌 ── */
.product-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

.product-card {
  position: relative;
  background: var(--paper);
  /* 吊牌切角 */
  clip-path: polygon(14px 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 0 100%, 0 14px);
  border-radius: 0 0 6px 6px;
}

.product-card-link { display: block; padding: 22px 8px 10px; text-decoration: none; }

.tag-hole {
  position: absolute; top: 7px; left: 50%;
  width: 10px; height: 10px; margin-left: -5px;
  border-radius: 50%;
  background: var(--tide);
  box-shadow: inset 0 0 0 2px var(--line);
}

.product-card h3 {
  margin: 8px 2px 8px;
  font-size: 0.92rem; font-weight: 600; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.tag-price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; margin: 0 2px; }
.tag-price .price {
  padding: 2px 8px 1px;
  border-radius: 3px;
  background: var(--shell); color: var(--ink);
  font-size: 1rem;
}

.price { font-family: var(--num); font-weight: 800; letter-spacing: 0; }
.compare-price { color: var(--muted); font-size: 0.8rem; }

.product-art {
  display: grid; place-items: center;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 3px;
  background: var(--accent, var(--shell));
  color: var(--paper);
  font-size: 2.4rem; font-weight: 900;
}
.product-art img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* ── 商品頁 ── */
.product-page .page { padding-top: 0; padding-bottom: 120px; }

.product-detail { display: grid; gap: 16px; }

.product-art-large {
  margin: 0 calc(-1 * var(--gutter));
  border-radius: 0;
  font-size: 6rem;
}

.gallery { display: flex; gap: 8px; margin-top: 8px; overflow-x: auto; }
.gallery img { flex: none; width: 72px; height: 72px; object-fit: cover; border-radius: 4px; }

.product-page .breadcrumbs { margin: 12px 0; }
.product-info h1 { margin: 0 0 8px; font-size: 1.45rem; font-weight: 800; }

.price-line { display: flex; align-items: baseline; flex-wrap: wrap; gap: 10px; margin: 0 0 6px; }
.price-large { color: var(--cooked); font-size: 1.8rem; }

.stock { margin: 0 0 16px; color: var(--muted); font-size: 0.9rem; }
.description { margin: 0 0 20px; }

.variant-fieldset { margin: 0 0 16px; padding: 0; border: 0; }
.variant-fieldset legend { margin-bottom: 8px; padding: 0; font-size: 0.92rem; font-weight: 700; }
.variant-options { display: flex; flex-wrap: wrap; gap: 8px; }

.variant-option {
  position: relative;
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px; padding: 8px 16px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--paper);
  cursor: pointer;
}
.variant-option input { position: absolute; opacity: 0; pointer-events: none; }
.variant-option:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); font-weight: 700; }
.variant-option:has(input:focus-visible) { outline: 3px solid var(--shell); outline-offset: 2px; }
.variant-option.is-soldout { color: var(--muted); text-decoration: line-through; cursor: not-allowed; }
.variant-option small { font-size: 0.72rem; text-decoration: none; }

.quantity-row { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.quantity-row label { font-size: 0.92rem; font-weight: 700; }
.quantity-row input { width: 88px; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--ink); font: inherit; }

/* 手機：價格＋加入購物車固定在螢幕底部 */
.buy-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom));
  background: var(--paper);
  border-top: 1px solid var(--line);
}
.buy-bar-price { font-family: var(--num); font-weight: 800; font-size: 1.3rem; color: var(--cooked); white-space: nowrap; }
.buy-bar .button { flex: 1; padding-left: 10px; padding-right: 10px; }
.buy-bar .buy-bar-price { display: none; }

.product-terms { margin: 4px 0 0; padding: 12px 0 0 1.1em; border-top: 1px dashed var(--line); color: var(--muted); font-size: 0.88rem; }
.product-terms li { margin-bottom: 4px; }

/* ── 按鈕 ── */
.button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 10px 22px;
  border: 1px solid transparent; border-radius: 999px;
  background: var(--ink); color: var(--paper);
  font: inherit; font-weight: 700; text-decoration: none;
  cursor: pointer;
}
.button:hover:not(:disabled) { background: var(--ink-strong); }
.button:active:not(:disabled) { transform: translateY(1px); }
.button:disabled { background: var(--line); color: var(--muted); cursor: not-allowed; }
.button.is-loading { opacity: 0.7; cursor: wait; }
.button-secondary { background: transparent; border-color: var(--line); color: var(--ink); }
.button-secondary:hover:not(:disabled) { background: var(--paper); }
.button-wide { width: 100%; }
.button-small { min-height: 40px; padding: 6px 14px; font-size: 0.9rem; }
.button-danger { background: var(--error); }

.text-link { color: var(--ink); font-size: 0.9rem; font-weight: 700; }
.link-button { background: none; border: 0; padding: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font: inherit; }

.form-error {
  margin: 12px 0 0; padding: 10px 14px;
  border-left: 3px solid var(--error); background: var(--paper);
  color: var(--error); font-size: 0.92rem;
}
.form-error ul { margin: 4px 0 0; padding-left: 1.2em; }

/* ── 購物車 ── */
.cart-empty { padding: 32px 0; }
.cart-empty p { margin: 0 0 16px; color: var(--muted); }

.cart-layout { display: grid; gap: 16px; align-items: start; }
.cart-items { display: grid; gap: 10px; }

.cart-item {
  display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 12px;
  padding: 12px; background: var(--paper); border-radius: 6px;
}
.cart-art { font-size: 1.6rem; }
.cart-item-name { margin: 0 0 2px; font-size: 1rem; font-weight: 700; }
.cart-item-name a { text-decoration: none; }
.cart-item-numbers { grid-column: 2; }
.line-price { margin: 0; font-family: var(--num); font-weight: 800; }

.qty-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; }
.qty-form input { width: 64px; min-height: 40px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 10px; font: inherit; }

.cart-summary { padding: 16px; background: var(--paper); border-radius: 6px; }
.cart-summary h2 { margin: 0 0 8px; font-size: 1.05rem; font-weight: 800; }
.cart-summary .button { margin-top: 14px; }

.summary-line { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 0; padding: 10px 0; border-top: 1px solid var(--line); }
.summary-line strong { font-family: var(--num); font-weight: 800; }
.summary-line > :last-child { white-space: nowrap; }
.summary-total strong { font-size: 1.3rem; color: var(--cooked); }

/* ── 結帳（1→2→3 是真的順序） ── */
.checkout-form fieldset { margin: 0 0 14px; padding: 12px 14px 4px; border: 0; border-radius: 6px; background: var(--paper); }
.checkout-form legend { float: left; width: 100%; display: flex; align-items: center; gap: 10px; margin: 0 0 10px; padding: 0; font-weight: 800; }
.checkout-form legend + * { clear: both; }

.step {
  display: inline-grid; place-items: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--ink); color: var(--paper);
  font-family: var(--num); font-size: 0.85rem; font-weight: 800;
}

.field { display: grid; gap: 4px; margin-bottom: 12px; }
.field > span { font-size: 0.92rem; font-weight: 600; }
.field input, .field textarea {
  min-height: 48px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--paper); color: var(--ink); font: inherit; font-size: 16px;
}
.field textarea { min-height: 72px; }
.field input:user-invalid { border-color: var(--error); }
.field small { font-size: 0.82rem; }

.radio { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 8px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); cursor: pointer; }
.radio:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.radio input { margin-top: 0.4em; accent-color: var(--ink); }
.checkout-form > .radio { display: block; margin: 12px 0; padding: 0; border: 0; background: none; box-shadow: none; }
.checkout-form > .radio input { margin-right: 6px; }

.checkout-total { display: flex; justify-content: space-between; align-items: baseline; margin: 16px 0 10px; font-weight: 700; }
.checkout-total strong { font-family: var(--num); font-size: 1.5rem; color: var(--cooked); }

/* ── 訂單頁 ── */
.order-no { font-family: var(--num); font-weight: 800; color: var(--ink); letter-spacing: 0.02em; }

.progress { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin: 0 0 20px; padding: 0; list-style: none; counter-reset: step; }
.progress li { position: relative; padding-top: 34px; color: var(--muted); font-size: 0.78rem; line-height: 1.35; text-align: center; counter-increment: step; }
.progress li::before {
  content: counter(step);
  position: absolute; top: 0; left: 50%; z-index: 1;
  width: 26px; height: 26px; margin-left: -13px;
  display: grid; place-items: center;
  border-radius: 50%; background: var(--paper); border: 2px solid var(--line);
  font-family: var(--num); font-weight: 800; font-size: 0.8rem;
}
.progress li + li::after { content: ""; position: absolute; top: 12px; right: 50%; width: calc(100% + 4px); height: 2px; background: var(--line); }
.progress li.is-done::before { content: "✓"; background: var(--ink); border-color: var(--ink); color: var(--paper); }
.progress li.is-done + li::after, .progress li.is-done::after { background: var(--ink); }
.progress li.is-current { color: var(--ink); font-weight: 700; }
.progress li.is-current::before { border-color: var(--cooked); color: var(--cooked); }

/* 轉帳資訊像一張匯款單 */
.notice { margin: 16px 0; padding: 14px 16px; border: 1.5px dashed var(--shell); border-radius: 10px; background: var(--paper); }
.notice h2 { margin: 0 0 8px; font-size: 1.05rem; font-weight: 800; }
.notice p { margin: 6px 0; }
.notice strong { font-size: 1.05rem; }
.copyable { font-family: var(--num); font-size: 1.25rem; letter-spacing: 0.04em; user-select: all; }
.copy-button {
  min-height: 34px; margin-left: 4px; padding: 2px 12px;
  border: 1px solid var(--ink); border-radius: 999px;
  background: var(--paper); color: var(--ink);
  font: inherit; font-size: 0.85rem; font-weight: 700; cursor: pointer;
}
.report-form { margin-top: 12px; }

.status { display: inline-block; white-space: nowrap; padding: 1px 10px; border-radius: 999px; background: var(--tide); font-size: 0.82rem; font-weight: 700; vertical-align: middle; }
.status-pending { background: var(--shell-soft); color: var(--cooked); }
.status-paid, .status-ordered, .status-shipped { background: color-mix(in srgb, var(--ink) 12%, var(--paper)); color: var(--ink); }
.status-cancelled { background: color-mix(in srgb, var(--error) 10%, var(--paper)); color: var(--error); }

.table { width: 100%; margin: 12px 0; border-collapse: collapse; background: var(--paper); font-size: 0.88rem; }
.table th, .table td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table th { white-space: nowrap; }
.table td:last-child, .table th:last-child { white-space: nowrap; text-align: right; }

/* ── 法規頁 ── */
.legal ul { padding-left: 1.2em; }
.legal li { margin-bottom: 8px; }
.info-list { display: grid; grid-template-columns: 1fr; margin: 0; }
.info-list dt { color: var(--muted); font-size: 0.88rem; }
.info-list dd { margin: 0 0 10px; }
.todo { color: var(--error); }

/* ── 頁尾 ── */
.site-footer { padding: 24px var(--gutter) 32px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.88rem; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 6px 18px; max-width: 1080px; margin: 0 auto 10px; }
.site-footer p { max-width: 1080px; margin: 0 auto; }

/* ── 加入購物車彈窗 ── */
.modal-backdrop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: end center; background: rgba(27, 61, 68, 0.5); }
.modal {
  position: relative;
  width: 100%; max-height: calc(100vh - 40px); overflow-y: auto;
  padding: 22px var(--gutter) calc(22px + env(safe-area-inset-bottom));
  border-radius: 16px 16px 0 0;
  background: var(--paper);
}
.modal:focus { outline: none; }
.modal h2 { margin: 0 0 14px; padding-right: 40px; font-size: 1.15rem; font-weight: 800; }
.modal-close {
  position: absolute; top: 14px; right: 14px;
  display: grid; place-items: center; width: 40px; height: 40px;
  border: 1px solid var(--line); border-radius: 50%; background: var(--paper); color: var(--ink);
  font-size: 1.3rem; line-height: 1; cursor: pointer;
}
.modal-product { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 14px; align-items: center; margin-bottom: 18px; }
.modal-product p { margin: 0; }
.modal-art { font-size: 1.6rem; }
.modal-product-name { font-weight: 800; }
.modal-actions { display: grid; gap: 10px; }

/* ── 信任：星等、評價、最近購買 ── */
.stars { color: var(--shell); letter-spacing: 1px; white-space: nowrap; }
.stars-off { color: var(--line); }

.card-rating { margin: 6px 2px 0; font-family: var(--num); font-size: 0.85rem; font-weight: 800; color: var(--cooked); }
.card-rating span { color: var(--muted); font-weight: 400; }

.rating-link { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 6px; font-size: 0.9rem; text-decoration: none; }

.review-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.review { padding: 12px 14px; background: var(--paper); border-left: 3px solid var(--shell); border-radius: 0 6px 6px 0; }
.review p { margin: 0; }
.review-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 0.88rem; }
.review-name { font-weight: 700; }
.verified { padding: 0 8px; border-radius: 999px; background: color-mix(in srgb, var(--ink) 10%, var(--paper)); font-size: 0.75rem; font-weight: 700; }
.verified::before { content: "✓ "; color: var(--cooked); }
.review-text { margin: 6px 0 4px !important; }
.review-meta { color: var(--muted); font-size: 0.8rem; }
.review-photos { display: flex; gap: 6px; margin: 6px 0; }
.review-photos img { width: 72px; height: 72px; object-fit: cover; border-radius: 4px; }
.review-photo-field { margin: 0 0 12px; }
.review-photo-list { display: flex; gap: 6px; margin-bottom: 8px; }
.review-photo-item img { width: 72px; height: 72px; object-fit: cover; border-radius: 4px; }

.review-box { margin: 0 0 20px; padding: 14px 16px; background: var(--paper); border-radius: 10px; }
.review-box h2 { margin: 0 0 8px; font-size: 1.05rem; font-weight: 800; }
.review-thanks { margin: 0 0 8px; color: var(--ink); font-weight: 700; }
.review-thanks::before { content: "✓ "; color: var(--cooked); }
.review-form + .review-form { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--line); }
.review-form-product { margin: 0 0 8px; font-weight: 700; }

.rating-picker { display: grid; gap: 6px; margin: 0 0 12px; padding: 0; border: 0; }
.rating-picker legend { margin-bottom: 6px; padding: 0; font-size: 0.92rem; font-weight: 600; }
.rating-picker label { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.rating-picker label:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.rating-picker input { accent-color: var(--ink); }
.rating-picker span { color: var(--shell); letter-spacing: 1px; min-width: 5.5em; }
.rating-picker small { color: var(--muted); }

/* 最近購買：像一張取貨小單，從角落出現；手機在購買列上方 */
.purchase-toast {
  position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 40;
  display: flex; align-items: center;
  max-width: 360px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-left: 4px solid var(--shell);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(27, 61, 68, 0.16);
  animation: toast-in 260ms ease-out;
}
.product-page .purchase-toast { bottom: calc(80px + env(safe-area-inset-bottom)); }
@keyframes toast-in { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }

.purchase-toast-link { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; padding: 8px 4px 8px 8px; text-decoration: none; }
.purchase-toast-art { flex: none; width: 44px; height: 44px; overflow: hidden; border-radius: 6px; background: var(--shell-soft); }
.purchase-toast-art img { width: 100%; height: 100%; object-fit: cover; }
.purchase-toast-text { display: grid; min-width: 0; font-size: 0.82rem; line-height: 1.4; }
.purchase-toast-text strong { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 0.9rem; }
.purchase-toast-text small { color: var(--muted); }
.purchase-toast-close { flex: none; width: 44px; height: 44px; border: 0; background: none; color: var(--muted); font-size: 1.2rem; cursor: pointer; }

/* ── 頁首公告、首頁分類入口、條款補充 ── */
/* 子分類：手機在分類頁上方左右滑；電腦版頁首滑過去出現下拉 */
.nav-group { position: relative; flex: none; }
.nav-menu { display: none; }
.sub-nav { display: flex; gap: 8px; overflow-x: auto; margin: -8px calc(-1 * var(--gutter)) 16px; padding: 0 var(--gutter) 4px; scrollbar-width: none; }
.sub-nav::-webkit-scrollbar { display: none; }
.sub-nav a { flex: none; padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); font-size: 0.9rem; text-decoration: none; white-space: nowrap; }
.sub-nav a[aria-current="page"] { border-color: var(--ink); background: var(--ink); color: var(--paper); font-weight: 700; }
.collection-item.is-child { margin-left: 18px; border-left: 3px solid var(--shell); }

/* 商品卡標籤（優惠、售完、現貨） */
.card-art { position: relative; display: block; }
.badges { position: absolute; top: 6px; left: 6px; display: flex; flex-wrap: wrap; gap: 4px; }
.badge { padding: 1px 7px; border-radius: 3px; font-size: 0.75rem; font-weight: 800; line-height: 1.6; }
.badge-sale { background: var(--cooked); color: var(--paper); }
.badge-stock { background: var(--ink); color: var(--paper); }
.badge-soldout { background: var(--paper); color: var(--muted); }
.product-card.is-soldout .product-art { opacity: 0.55; }

/* 數量加減 */
.stepper { display: inline-flex; align-items: stretch; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--paper); }
.stepper button { width: 44px; border: 0; background: none; color: var(--ink); font: inherit; font-size: 1.2rem; cursor: pointer; }
.stepper input { width: 56px !important; min-height: 44px; border: 0 !important; border-left: 1px solid var(--line) !important; border-right: 1px solid var(--line) !important; border-radius: 0 !important; text-align: center; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.share-button { margin-top: 10px; padding: 8px 0; border: 0; background: none; color: var(--ink); font: inherit; font-size: 0.9rem; font-weight: 700; text-decoration: underline; cursor: pointer; }
.ship-progress { margin: -6px 0 14px; padding: 8px 12px; border-radius: 6px; background: var(--shell-soft); color: var(--cooked); font-weight: 700; font-size: 0.9rem; }

/* 會員 */
.line-button { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; margin: 8px 0 14px; border-radius: 999px; background: #06C755; color: #fff; font-weight: 800; text-decoration: none; }
.line-button:hover { background: #05b34c; }
.line-mark { padding: 1px 6px; border-radius: 4px; background: #fff; color: #06C755; font-family: var(--num); font-size: 0.75rem; }
.login-note { font-size: 0.85rem; }
.member-line { margin: 6px 0 0; font-size: 0.9rem; }
.account-head { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.account-head img { border-radius: 50%; }
.account-head h1 { margin: 0; font-size: 1.5rem; font-weight: 800; }
.account-orders { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.account-order a { display: grid; gap: 2px; padding: 12px 14px; background: var(--paper); border-radius: 6px; text-decoration: none; }
.account-order .status { justify-self: start; }

/* 搜尋 */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.search-form { display: flex; gap: 8px; margin: 0 0 12px; }
.search-form input { flex: 1; min-width: 0; min-height: 48px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); color: var(--ink); font: inherit; font-size: 16px; }

/* 首頁：各分類一排（左右滑）、最近看過 */
.row-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.row-head a { font-size: 0.9rem; font-weight: 700; }
.product-row { display: grid; grid-auto-flow: column; grid-auto-columns: 44%; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter) 6px; scrollbar-width: none; }
.product-row::-webkit-scrollbar { display: none; }
.product-row > * { scroll-snap-align: start; }
.recent-card { display: grid; gap: 4px; padding: 8px; background: var(--paper); border-radius: 6px; text-decoration: none; font-size: 0.85rem; }
.recent-art { display: block; aspect-ratio: 1; overflow: hidden; border-radius: 3px; background: var(--shell-soft); }
.recent-art img { width: 100%; height: 100%; object-fit: cover; }
.recent-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* 頁首跑馬燈：蟹殼橘一條，滑鼠移上去或按住就停 */
.marquee { overflow: hidden; background: var(--shell); color: var(--ink); }
.marquee-track { display: flex; width: max-content; animation: marquee 32s linear infinite; }
.marquee:hover .marquee-track, .marquee:focus-within .marquee-track { animation-play-state: paused; }
.marquee-item { display: inline-flex; align-items: center; gap: 10px; padding: 7px 28px; font-size: 0.88rem; font-weight: 700; white-space: nowrap; }
.marquee-button { padding: 2px 10px; border-radius: 4px; background: var(--paper); color: var(--ink); font-size: 0.82rem; text-decoration: none; }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) {
  .marquee-track { width: auto; flex-wrap: wrap; justify-content: center; }
  .marquee-item[aria-hidden="true"] { display: none; }
}

/* 首頁宣傳圖：手機滿版可左右滑；圓點做成吊牌的打洞 */
.banner { position: relative; margin: 20px calc(-1 * var(--gutter)); }
.page > .banner:first-child { margin-top: -24px; }
.banner-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.banner-track::-webkit-scrollbar { display: none; }
.banner-slide { flex: 0 0 100%; scroll-snap-align: start; display: block; }
.banner-slide img { display: block; width: 100%; height: auto; }
.banner-dots { display: flex; justify-content: center; gap: 10px; padding: 10px 0 0; }
.banner-dots button { width: 12px; height: 12px; padding: 0; border: 2px solid var(--line); border-radius: 50%; background: var(--tide); cursor: pointer; }
.banner-dots button[aria-current="true"] { border-color: var(--ink); background: var(--ink); }
.banner-arrow { display: none; }

.lookup-form { margin: 0 0 16px; padding: 14px 16px 4px; background: var(--paper); border-radius: 6px; }
.lookup-form .button { margin: 4px 0 12px; }
.intro-text { margin: 10px 0 0; color: var(--muted); }
.collection-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0; padding: 0; list-style: none; }
.collection-links a { display: grid; gap: 2px; min-height: 64px; padding: 12px 14px; background: var(--paper); border-left: 3px solid var(--ink); border-radius: 0 6px 6px 0; text-decoration: none; }
.collection-links span { color: var(--muted); font-size: 0.82rem; }
.legal h2 { margin: 24px 0 8px; font-size: 1.1rem; font-weight: 800; }
.page-editor { padding: 12px 0; border-top: 1px dashed var(--line); }
.page-editor textarea { min-height: 200px; }

/* ── 後台（店主自己用） ── */
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.admin-head h1 { margin: 0; }
.admin-saved { margin: 12px 0; padding: 10px 14px; border-left: 3px solid var(--ink); background: var(--paper); font-weight: 700; }
.admin-thumb { display: grid; place-items: center; width: 48px; height: 48px; object-fit: cover; border-radius: 4px; background: var(--tide); font-size: 0.7rem; color: var(--muted); }
.admin-row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.admin-form fieldset { min-width: 0; margin: 0 0 14px; padding: 12px 14px; border: 0; border-radius: 6px; background: var(--paper); }
.admin-form legend { float: left; width: 100%; margin: 0 0 10px; padding: 0; font-weight: 800; }
.admin-form legend + * { clear: both; }
.admin-form select { min-height: 48px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--ink); font: inherit; font-size: 16px; }
.admin-form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
.admin-danger { margin: 24px 0; padding-top: 16px; border-top: 1px dashed var(--line); }
/* 手機：每個規格是一張小卡（選項一行，售價、原價並排） */
.variant-table, .variant-table tbody { display: block; }
.variant-table thead { display: none; }
.variant-table tr { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.variant-table td { display: grid; gap: 2px; padding: 0; border: 0; text-align: left !important; white-space: normal !important; }
.variant-table td::before { content: attr(data-label); color: var(--muted); font-size: 0.8rem; }
.variant-table td:first-child, .variant-table td:nth-child(4) { grid-column: 1 / -1; }
.variant-table td.center { grid-template-columns: auto 1fr; align-items: center; gap: 8px; }
.variant-table td.center::before { order: 2; }
.variant-table input[type="text"], .variant-table input[type="number"] { width: 100%; min-height: 44px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: 16px; }
.variant-table td:last-child, .variant-table th:last-child { text-align: center; }
.variant-table input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--ink); }
.image-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; margin: 8px 0 12px; padding: 0; list-style: none; }
.image-item { display: grid; gap: 4px; font-size: 0.82rem; }
.image-item img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 4px; background: var(--tide); }
.upload-button { cursor: pointer; }
.collection-list, .section-list { display: grid; gap: 12px; margin: 0 0 20px; padding: 0; list-style: none; }
.collection-item { padding: 12px 14px; background: var(--paper); border-radius: 6px; }
.collection-item .admin-form { margin-bottom: 8px; }
.section-item { padding: 10px 0; border-top: 1px dashed var(--line); }
.field-narrow input { max-width: 100px; }
.field-label { margin: 0 0 6px; font-size: 0.92rem; font-weight: 600; }
.marquee-row { padding: 10px 0; border-top: 1px dashed var(--line); }
.banner-list { display: grid; gap: 16px; margin: 0 0 14px; padding: 0; list-style: none; }
.banner-row { display: grid; gap: 10px; padding: 12px; background: var(--paper); border-radius: 6px; }
.banner-preview { width: 100%; max-height: 220px; object-fit: contain; background: var(--tide); border-radius: 4px; }
.banner-preview-mobile { width: 96px; height: 96px; object-fit: cover; border-radius: 4px; }
.banner-mobile { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 8px; }

/* ── 後台（訂單、評價） ── */
.admin .page { max-width: 1080px; }
.admin-nav, .tabs { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 14px; }
.tabs a { padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); text-decoration: none; }
.tabs a.is-active { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.admin-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.inline-form { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.inline-form input { min-height: 40px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 10px; font: inherit; }

/* ── 寬螢幕 ── */
@media (min-width: 720px) {
  :root { --gutter: 24px; }

  .site-header { position: sticky; top: 0; z-index: 20; }
  .header-inner { display: flex; align-items: center; gap: 24px; padding: 10px 0; }
  .site-nav { flex: 1; margin: 0; padding: 0; }
  .header-actions { position: static; }
  .site-nav { overflow: visible; }
  .nav-menu {
    position: absolute; top: 100%; left: 0; z-index: 25;
    min-width: 180px; padding: 8px; margin-top: 6px;
    background: var(--paper); border-radius: 6px; box-shadow: 0 12px 30px rgba(27, 61, 68, 0.18);
  }
  .nav-group:hover .nav-menu, .nav-group:focus-within .nav-menu { display: grid; }
  .nav-group::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 10px; }
  .nav-menu a { padding: 8px 12px; border-radius: 4px; color: var(--ink); text-decoration: none; white-space: nowrap; }
  .nav-menu a:hover { background: var(--tide); }

  .page { padding-top: 36px; }
  .product-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }

  .product-page .page { padding-top: 32px; padding-bottom: 64px; }
  .product-detail { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; align-items: start; }
  .product-art-large { margin: 0; border-radius: 6px; }
  .product-info h1 { font-size: 1.9rem; }
  .buy-bar { position: static; padding: 0; border: 0; background: none; }

  .cart-layout { grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.8fr); gap: 24px; }
  .cart-item { grid-template-columns: 96px minmax(0, 1fr) auto; align-items: center; }
  .cart-item-numbers { grid-column: auto; }
  .cart-summary { position: sticky; top: 90px; }

  .info-list { grid-template-columns: max-content 1fr; gap: 6px 16px; }
  .info-list dd { margin: 0; }

  .modal-backdrop { place-items: center; padding: 20px; }
  .collection-links { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .banner { margin: 24px 0; }
  .page > .banner:first-child { margin-top: 0; }
  .product-row { grid-auto-columns: 22%; margin: 0; padding: 0 0 6px; }
  .buy-bar .buy-bar-price { display: inline; }
  .banner-track { border-radius: 6px; }
  .banner-arrow {
    position: absolute; top: calc(50% - 32px); display: grid; place-items: center;
    width: 44px; height: 44px; border: 0; border-radius: 50%;
    background: var(--paper); color: var(--ink); font-size: 1.6rem; line-height: 1; cursor: pointer;
  }
  .banner-prev { left: 12px; }
  .banner-next { right: 12px; }
  .marquee-row { display: grid; grid-template-columns: 2fr 1fr 2fr; gap: 10px; }
  .marquee-row .field { margin: 0; }
  .banner-row { grid-template-columns: 320px 1fr; }
  .variant-table { display: table; }
  .variant-table tbody { display: table-row-group; }
  .variant-table thead { display: table-header-group; }
  .variant-table tr { display: table-row; }
  .variant-table td { display: table-cell; padding: 6px; border-bottom: 1px solid var(--line); }
  .variant-table td::before { content: none; }
  .collection-form { display: grid; grid-template-columns: 1fr 1fr 2fr auto; gap: 10px; align-items: end; }
  .collection-form .field { margin: 0; }
  .purchase-toast, .product-page .purchase-toast { right: auto; left: 20px; bottom: 20px; }
  .review-list { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
  .modal { width: min(440px, 100%); border-radius: 16px; padding: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
