:root {
  --ink: #26221e;
  --muted: #6f675d;
  --line: #e6dfd3;
  --paper: #faf7f1;
  --card: #ffffff;
  --red: #8b1e1e;
  --red-dark: #6e1616;
  --gold: #b8912e;
  --gold-soft: #f3ead3;
  --green: #2e7d4f;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(40, 30, 10, 0.06);
  --font: -apple-system, BlinkMacSystemFont, "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
  background-image: radial-gradient(circle at 50% -10%, #fff 0, var(--paper) 60%);
}
a { color: var(--red); }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }

/* ---------------------------------------------------------------- header */
.site-header {
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(6px);
  position: sticky; top: 0; z-index: 10;
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; padding-top: 12px; padding-bottom: 12px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-photo {
  width: 48px; height: 48px; border-radius: 50%; object-fit: cover; flex: 0 0 auto;
  border: 2px solid var(--gold-soft); box-shadow: 0 0 0 1px var(--gold);
}
.brand-name { margin: 0; font-size: 20px; line-height: 1.2; letter-spacing: 0.08em; }
.brand-sub { font-size: 12.5px; color: var(--muted); letter-spacing: 0.14em; text-transform: uppercase; white-space: nowrap; } /* brand.js fits the tracking to the Chinese width */
.social { display: flex; gap: 8px; align-items: center; }
.social a { color: var(--muted); padding: 8px; border-radius: 50%; display: inline-flex; }
.social a:hover { color: var(--red); background: var(--gold-soft); }
/* WhatsApp: official green badge with white glyph */
.social a.social-wa { background: #25D366; color: #fff; padding: 9px; box-shadow: 0 1px 3px rgba(0,0,0,0.15); }
.social a.social-wa:hover { background: #1ebe5b; color: #fff; }

/* -------------------------------------------------------------- sections */
main.wrap { padding-top: 36px; padding-bottom: 40px; }
.section { margin-bottom: 32px; }
.section-title {
  font-size: 18px; margin: 0 0 12px; display: flex; align-items: center; gap: 10px;
  letter-spacing: 0.04em;
}
.section-title .num {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--gold); color: #fff; font-size: 14px; font-weight: 700;
  display: grid; place-items: center;
}
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.form-card, .summary-card { padding: 18px 16px; }
.empty { padding: 32px 20px; text-align: center; }
.empty h2 { margin-top: 0; }

/* --------------------------------------------------------------- notices */
.notice { padding: 12px 14px; border-radius: 10px; margin: 0 0 16px; font-size: 15px; }
.notice-warn { background: #fff6e0; border: 1px solid #f1dfa6; color: #6b4d00; }
.notice-error { background: #fdecec; border: 1px solid #f2b8b8; color: #7a1414; }
.notice-ok { background: #e9f6ee; border: 1px solid #b7e0c5; color: #1d5a35; }

/* -------------------------------------------------------------- products */
.products { display: grid; gap: 18px; }
.product { overflow: hidden; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.product.is-soldout .product-body { opacity: 0.75; }
.gallery-main { position: relative; background: #f0ece4; }
.gallery-main img { width: 100%; aspect-ratio: 1 / 1; object-fit: contain; background: #f0ece4; }
.gallery-zoom { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; position: relative; }
.zoom-hint {
  position: absolute; right: 10px; bottom: 10px; display: inline-flex; align-items: center; gap: 4px;
  background: rgba(38,34,30,0.7); color: #fff; font-size: 12px; padding: 4px 9px; border-radius: 999px; pointer-events: none;
}
.badge-soldout {
  position: absolute; top: 12px; left: 12px;
  background: rgba(38,34,30,0.85); color: #fff; padding: 4px 10px; border-radius: 999px; font-size: 13px;
}
.gallery-thumbs { display: flex; gap: 8px; padding: 10px 12px 0; overflow-x: auto; }
.thumb { flex: 0 0 auto; width: 64px; height: 64px; padding: 0; border: 2px solid transparent; border-radius: 8px; overflow: hidden; background: #f0ece4; cursor: pointer; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.is-active { border-color: var(--gold); }
.product-body { padding: 16px; }
.product-name { margin: 0 0 6px; font-size: 19px; line-height: 1.35; }
.product-price { font-size: 20px; font-weight: 700; color: var(--red); }
.product-price .unit { font-size: 13px; font-weight: 400; color: var(--muted); }
.product-stock { margin-top: 4px; font-size: 13px; color: var(--gold); font-weight: 600; }
.product-desc { margin-top: 12px; font-size: 15px; color: #3d3730; }
.product-desc .desc-inner { max-height: 4.8em; overflow: hidden; position: relative; }
.product-desc .desc-inner::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2.2em;
  background: linear-gradient(rgba(255,255,255,0), #fff);
}
.product-desc.is-open .desc-inner { max-height: none; }
.product-desc.is-open .desc-inner::after { display: none; }
.product-desc p { margin: 0 0 10px; }
.product-desc ul { margin: 0 0 10px; padding-left: 1.3em; }
.product-desc li { margin-bottom: 4px; }
.desc-toggle { background: none; border: 0; padding: 4px 0; color: var(--red); font-size: 14px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.qty-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }
.qty-label { font-size: 15px; color: var(--muted); }
.qty { display: inline-flex; align-items: stretch; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.qty-btn { width: 44px; height: 44px; border: 0; background: #f6f2ea; font-size: 22px; line-height: 1; cursor: pointer; color: var(--ink); }
.qty-btn:active { background: var(--gold-soft); }
.qty input {
  width: 56px; text-align: center; border: 0; border-left: 1px solid var(--line); border-right: 1px solid var(--line);
  font-size: 17px; font-weight: 600; -moz-appearance: textfield; appearance: textfield;
}
.qty input::-webkit-outer-spin-button, .qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty input:focus { outline: none; background: #fffdf7; }
.soldout-text { color: var(--muted); font-weight: 600; }

/* ----------------------------------------------------------------- forms */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field label { display: block; font-weight: 600; font-size: 15px; margin-bottom: 6px; }
.req { color: var(--red); }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 12px; border: 1px solid #d8d0c3; border-radius: 10px; background: #fff;
  font-size: 16px; transition: border-color .15s, box-shadow .15s;
}
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(184,145,46,0.18);
}
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: #c94a4a; }
.hint { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.field-error { margin: 6px 0 0; font-size: 13.5px; color: #a12a2a; }
.phone-row { display: grid; grid-template-columns: 96px 1fr; gap: 8px; }
.phone-row select { padding-left: 10px; padding-right: 26px; font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------- summary */
.summary-empty { margin: 0 0 8px; color: var(--muted); }
.summary-table { width: 100%; border-collapse: collapse; font-size: 15px; margin-bottom: 8px; }
.summary-table td, .summary-table th { padding: 8px 4px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.summary-table .qtycol { white-space: nowrap; color: var(--muted); }
.summary-table .amt { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.summary-table tfoot th { font-size: 16px; border-bottom: 0; }
.summary-table tfoot td { font-size: 20px; font-weight: 700; color: var(--red); border-bottom: 0; }

.pay-methods { border: 0; padding: 0; margin: 16px 0 0; }
.pay-methods legend { font-weight: 600; margin-bottom: 8px; padding: 0; }
.pay-option { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; cursor: pointer; background: #fff; }
.pay-option:has(input:checked) { border-color: var(--gold); background: #fffcf4; box-shadow: 0 0 0 2px rgba(184,145,46,0.18); }
.pay-option input { width: 20px; height: 20px; accent-color: var(--red); margin: 0; flex: 0 0 auto; }
.pay-option-body { display: flex; flex-direction: column; }
.pay-title { font-weight: 600; }
.pay-sub { font-size: 13px; color: var(--muted); }
.pay-action { margin-top: 16px; }
#paypal-buttons { min-height: 48px; width: 100%; }
/* The yellow button lives in PayPal's cross-origin iframe, capped at 750px there (.paypal-button-container).
   site.js renders it at 750px and scales the iframe up when our column is wider (see fitPayPal). */
#paypal-buttons .paypal-buttons, #paypal-buttons > div { max-width: none !important; width: 100%; }
#paypal-buttons.is-scaled { overflow: visible; }
#paypal-buttons.is-scaled .paypal-buttons { transform-origin: 0 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  border: 0; border-radius: 12px; padding: 12px 20px; font-weight: 700; cursor: pointer;
  text-decoration: none; transition: background .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); }
.btn-primary:disabled { background: #b98a8a; cursor: not-allowed; }
.btn-lg { width: 100%; padding: 15px 20px; font-size: 17px; }
/* no-charge test payment (config test_payment) */
.pay-option-test { border-style: dashed; border-color: #d9b84a; background: #fffbea; }
.pay-option-test .pay-title::before { content: "⚠ "; }
.btn-test { background: #fff3cd; color: #7a5a00; border: 2px dashed #d9b84a; }
.btn-test:hover { background: #ffeeb5; }
.btn-test:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-outline { background: #fff; color: var(--red); border: 1px solid var(--red); }
.btn-spinner { width: 18px; height: 18px; border: 2px solid rgba(255,255,255,0.4); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.legal { margin: 14px 0 0; font-size: 13px; color: var(--muted); }

/* ---------------------------------------------------------------- footer */
.site-footer { border-top: 1px solid var(--line); padding: 20px 0 32px; font-size: 13px; color: var(--muted); }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 6px 20px; justify-content: space-between; }

/* -------------------------------------------------------------- lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 100; background: rgba(20,16,12,0.92);
  display: flex; align-items: center; justify-content: center; padding: 16px;
  animation: fadein .15s ease-out;
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.lightbox-body { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; overflow: auto; -webkit-overflow-scrolling: touch; cursor: zoom-out; }
.lightbox-body img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; box-shadow: 0 10px 40px rgba(0,0,0,0.5); cursor: default; }
.lightbox-close {
  position: fixed; top: 10px; right: 10px; z-index: 101;
  width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,0.15); color: #fff;
  font-size: 30px; line-height: 1; cursor: pointer;
}
.lightbox-close:hover { background: rgba(255,255,255,0.3); }
.lightbox-count {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 101;
  color: #fff; font-size: 14px; letter-spacing: .06em; background: rgba(255,255,255,0.15); padding: 4px 12px; border-radius: 999px;
}
.lightbox-nav {
  position: fixed; top: 50%; transform: translateY(-50%); z-index: 101;
  width: 48px; height: 64px; border: 0; border-radius: 10px; background: rgba(255,255,255,0.15); color: #fff;
  font-size: 44px; line-height: 1; cursor: pointer; padding: 0 0 6px;
}
.lightbox-nav:hover { background: rgba(255,255,255,0.3); }
.lightbox-prev { left: 8px; }
.lightbox-next { right: 8px; }
@media (max-width: 639px) {
  /* on touch screens people swipe; keep the arrows small and out of the way */
  .lightbox-nav { width: 36px; height: 48px; font-size: 32px; bottom: 16px; top: auto; transform: none; }
}
#lightbox-img.slide-left { animation: slideL .22s ease-out; }
#lightbox-img.slide-right { animation: slideR .22s ease-out; }
@keyframes slideL { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: none; } }
@keyframes slideR { from { opacity: 0; transform: translateX(-40px); } to { opacity: 1; transform: none; } }
body.lightbox-open { overflow: hidden; }

/* -------------------------------------------------------------- result page */
.result { max-width: 560px; margin: 32px auto; padding: 32px 24px; text-align: center; }
.result-icon { width: 72px; height: 72px; border-radius: 50%; margin: 0 auto 16px; display: grid; place-items: center; font-size: 36px; color: #fff; }
.result-icon.ok { background: var(--green); }
.result-icon.fail { background: #b23a3a; }
.result-icon.wait { background: var(--gold); }
.result h1 { margin: 0 0 8px; font-size: 24px; }
.result .ref { font-size: 22px; font-weight: 700; letter-spacing: 0.06em; color: var(--red); margin: 8px 0 16px; }
.result .lead { color: var(--muted); margin: 0 0 20px; }
.result-details { text-align: left; margin: 20px 0; }
.result-details table { width: 100%; border-collapse: collapse; font-size: 15px; }
.result-details th, .result-details td { padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; text-align: left; }
.result-details th { width: 36%; color: var(--muted); font-weight: 600; white-space: nowrap; }
.result .actions { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }

@media (max-width: 639px) {
  /* single-column layout: don't let it stretch across wide phones / small tablets */
  .wrap { max-width: 500px; }
  /* keep 姓氏/名字 side by side, but stack phone / email on small screens */
  .grid-2.contact-row { grid-template-columns: 1fr; }
}
@media (min-width: 640px) {
  .brand-name { font-size: 24px; }
  .brand-photo { width: 56px; height: 56px; }
  main.wrap { padding-top: 48px; }
  .products { grid-template-columns: 1fr; }
  .product { display: grid; grid-template-columns: 240px 1fr; }
  .product .gallery { border-right: 1px solid var(--line); }
  .gallery-thumbs { padding-bottom: 10px; }
  .result .actions { flex-direction: row; justify-content: center; }
}
@media (min-width: 900px) {
  .product { grid-template-columns: 320px 1fr; }
  .form-card, .summary-card { padding: 24px 24px; }
}
