:root {
  --ink: #25343b;
  --muted: #667c87;
  --cream: #edf5f8;
  --paper: #fffdf7;
  --peach: #c9574f;
  --peach-dark: #ef0025;
  --butter: #f1c84b;
  --gold-text: #b87900;
  --sage: #32685d;
  --line: #c8d8df;
  --winter-blue: #47748e;
  --sky-blue: #5ca4cf;
  --shadow: 0 14px 34px rgba(38, 76, 96, 0.16);
}

* { box-sizing: border-box; }
html { background: var(--cream); color: var(--ink); font-family: "Noto Sans TC", sans-serif; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 8% 8%, rgba(255,255,255,.22) 0 3px, transparent 4px), linear-gradient(180deg, #5ca4cf 0, #dcebf0 520px, var(--cream) 900px); background-size: 90px 90px, auto; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }

.site-header { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; padding: 14px max(18px, env(safe-area-inset-left)); background: rgba(71,116,142,.94); border-bottom: 1px solid rgba(255,255,255,.18); color: white; backdrop-filter: blur(12px); }
.site-header h1 { margin: 0; font-size: 1.1rem; }
.eyebrow { margin: 0 0 3px; color: var(--butter); font-size: .68rem; font-weight: 700; letter-spacing: .15em; }
.header-link { padding: 9px 13px; border: 0; border-radius: 13px; background: var(--peach-dark); color: white; font-weight: 700; cursor: pointer; }
.text-button { border: 0; background: transparent; color: var(--peach-dark); font-weight: 700; cursor: pointer; }

main { width: min(100%, 760px); margin: auto; padding: 18px 16px 110px; }
.catalog-search { position: relative; display: block; margin: 18px 0 4px; }
.catalog-search input { width: 100%; padding: 13px 15px; border: 1px solid rgba(255,255,255,.72); border-radius: 16px; background: rgba(255,253,247,.96); color: var(--ink); outline: none; box-shadow: 0 7px 20px rgba(38,76,96,.1); }
.catalog-search input:focus { border-color: var(--butter); box-shadow: 0 0 0 3px rgba(241,200,75,.28), 0 7px 20px rgba(38,76,96,.1); }
.hero { position: relative; overflow: hidden; padding: 32px 24px; border: 1px solid rgba(255,255,255,.18); border-radius: 28px; background: linear-gradient(145deg, var(--winter-blue), var(--sky-blue)); color: white; box-shadow: var(--shadow); }
.hero::after { content: ""; position: absolute; width: 140px; height: 140px; right: -28px; bottom: -45px; border: 26px solid rgba(255,255,255,.35); border-radius: 50%; }
.hero h2 { margin: 10px 0 12px; font-size: clamp(1.35rem, 5.5vw, 2rem); line-height: 1.3; letter-spacing: -.02em; }
.hero p { position: relative; z-index: 1; max-width: 34rem; margin: 0; color: #eff7fa; font-size: .9rem; line-height: 1.7; }
.hero-sticker { display: inline-block; padding: 6px 10px; border-radius: 999px; background: var(--butter); color: var(--ink); font-size: .72rem; font-weight: 700; transform: rotate(-2deg); }

.section-heading { display: flex; align-items: end; justify-content: space-between; margin: 24px 2px 15px; }
.section-heading h2 { margin: 0; font-size: 1.45rem; }
.section-heading > span { color: var(--muted); font-size: .8rem; }
.category-chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 16px; padding: 0 16px 4px; scrollbar-width: none; }
.category-chips button { flex: none; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); color: var(--muted); cursor: pointer; }
.category-chips button.active { border-color: var(--peach-dark); background: var(--peach-dark); color: white; }
.status-panel { padding: 26px 14px; color: var(--muted); text-align: center; }

.product-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.product-card { overflow: hidden; border: 1px solid var(--line); border-radius: 19px; background: var(--paper); box-shadow: 0 7px 20px rgba(79,57,43,.06); cursor: pointer; transition: transform .16s ease; }
.product-card:active { transform: scale(.98); }
.product-card img { display: block; width: 100%; aspect-ratio: 1/1; object-fit: cover; background: #f3eee9; }
.product-card-body { padding: 11px 11px 13px; }
.category-label { display: inline-block; color: var(--gold-text); font-size: .68rem; font-weight: 700; }
.product-card h3 { display: -webkit-box; min-height: 2.8em; max-height: 2.8em; margin: 5px 0 8px; overflow: hidden; font-size: .9rem; line-height: 1.4; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.product-card-purchase { display: flex; gap: 7px; align-items: center; justify-content: space-between; }
.product-card .price { margin: 0; color: var(--gold-text); font-size: 1.08rem; font-weight: 700; letter-spacing: -.02em; }
.card-add-button { flex: none; min-height: 34px; padding: 7px 10px; border: 0; border-radius: 10px; background: var(--peach-dark); color: white; font-size: .72rem; font-weight: 700; cursor: pointer; }
.card-add-button:focus-visible { outline: 3px solid rgba(239,0,37,.22); outline-offset: 2px; }
.product-card small { display: block; margin-top: 5px; color: var(--muted); font-size: .7rem; }

.cart-dock { position: fixed; z-index: 30; right: 0; bottom: 0; left: 0; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); background: rgba(237,245,248,.93); border-top: 1px solid var(--line); backdrop-filter: blur(12px); }
.cart-dock button { display: flex; width: min(100%, 732px); margin: auto; padding: 14px 17px; align-items: center; justify-content: space-between; border: 0; border-radius: 16px; background: var(--peach-dark); color: white; cursor: pointer; }
.cart-dock button span:last-child { font-size: .82rem; }

dialog { width: min(calc(100% - 24px), 560px); max-height: calc(100dvh - 24px); padding: 0; border: 0; border-radius: 25px; background: var(--paper); color: var(--ink); box-shadow: 0 30px 80px rgba(40,30,25,.26); }
dialog::backdrop { background: rgba(55,43,36,.52); backdrop-filter: blur(3px); }
.dialog-close { width: 38px; height: 38px; border: 0; border-radius: 50%; background: rgba(255,255,255,.92); font-size: 1.6rem; line-height: 1; cursor: pointer; }
.product-dialog > form { position: absolute; z-index: 1; top: 12px; right: 12px; }
.product-dialog-gallery > img { display: block; width: 100%; max-height: 45vh; aspect-ratio: 4/3; object-fit: cover; background: #f3eee9; }
.product-dialog-thumbnails { display: flex; gap: 7px; overflow-x: auto; padding: 8px 10px 1px; scrollbar-width: thin; }
.product-dialog-thumbnails:empty { display: none; }
.product-dialog-thumbnails button { flex: none; width: 56px; height: 56px; padding: 2px; overflow: hidden; border: 2px solid transparent; border-radius: 10px; background: white; }
.product-dialog-thumbnails button.active { border-color: var(--peach-dark); }
.product-dialog-thumbnails img { width: 100%; height: 100%; border-radius: 6px; object-fit: cover; }
.dialog-body { padding: 20px; }
.dialog-body h2 { margin: 5px 0; }
.twd-price { margin: 8px 0 12px; color: var(--peach-dark); font-size: 1.35rem; font-weight: 700; }
.product-description { color: var(--muted); font-size: .86rem; line-height: 1.65; white-space: pre-wrap; }
.field { display: grid; gap: 7px; margin: 14px 0; }
.field > span { font-size: .82rem; font-weight: 700; }
.field input, .field select, .field textarea { width: 100%; padding: 12px 13px; border: 1px solid var(--line); border-radius: 13px; background: var(--cream); color: var(--ink); outline: none; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--sky-blue); box-shadow: 0 0 0 3px rgba(92,164,207,.18); }
.primary-button { width: 100%; padding: 14px 17px; border: 0; border-radius: 15px; background: var(--peach-dark); color: white; font-weight: 700; cursor: pointer; }
.primary-button:disabled { opacity: .5; cursor: wait; }

.checkout-dialog { padding: 20px; }
.checkout-header { display: flex; align-items: start; justify-content: space-between; }
.checkout-header h2 { margin: 0; }
.checkout-header .dialog-close { background: var(--cream); }
.checkout-items { margin: 18px 0; border-top: 1px solid var(--line); }
.checkout-item { display: grid; grid-template-columns: 54px 1fr auto; gap: 10px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.checkout-item img { width: 54px; height: 54px; border-radius: 10px; object-fit: cover; background: #f3eee9; }
.checkout-item strong, .checkout-item small { display: block; }
.checkout-item small { margin-top: 3px; color: var(--muted); }
.remove-item { border: 0; background: transparent; color: var(--peach-dark); cursor: pointer; }
.money-card { padding: 15px; border-radius: 16px; background: #e7f1f5; }
.money-card > div { display: flex; justify-content: space-between; padding: 5px 0; font-size: .88rem; }
.money-card .deposit-row { margin: 5px -7px; padding: 9px 7px; border-radius: 10px; background: white; color: var(--peach-dark); }
.money-card small { display: block; margin-top: 6px; color: var(--muted); line-height: 1.5; }
.form-title { margin: 24px 0 5px; }
.transfer-info { margin: 16px 0 4px; padding: 13px; border: 1px dashed #86aabd; border-radius: 13px; background: #f1f7f9; }
.transfer-info strong { color: var(--peach-dark); font-size: .82rem; }
.transfer-info p { margin: 5px 0 0; color: var(--muted); font-size: .8rem; line-height: 1.55; white-space: pre-wrap; }
.order-first-note { margin: 16px 0 4px; padding: 13px; border-radius: 13px; background: #e2eef2; }
.order-first-note strong { color: var(--winter-blue); font-size: .86rem; }
.order-first-note p { margin: 5px 0 0; color: var(--muted); font-size: .8rem; line-height: 1.55; }
.payment-order-summary { display: grid; grid-template-columns: 1fr auto; gap: 7px 14px; margin: 18px 0 10px; padding: 14px; border-radius: 14px; background: #e7f1f5; }
.payment-order-summary span { color: var(--muted); font-size: .78rem; }
.payment-order-summary strong { text-align: right; }
.later-button { width: 100%; margin-top: 9px; padding: 12px; border: 0; background: transparent; color: var(--muted); font-weight: 700; cursor: pointer; }
.agreement { display: flex; gap: 9px; align-items: start; margin: 20px 0; color: var(--muted); font-size: .78rem; line-height: 1.55; }
.agreement input { flex: none; margin-top: 3px; }
.submit-button { margin-bottom: 0; }
.order-submit-status { position: relative; margin: 10px 0 max(0px, env(safe-area-inset-bottom)); padding: 12px 13px 12px 40px; border: 1px solid #b8d1de; border-radius: 13px; background: #e8f3f7; color: var(--winter-blue); font-size: .8rem; font-weight: 600; line-height: 1.6; }
.order-submit-status::before { position: absolute; top: 14px; left: 14px; width: 15px; height: 15px; border: 2px solid rgba(71,116,142,.25); border-top-color: var(--winter-blue); border-radius: 50%; content: ""; animation: order-submit-spin .8s linear infinite; }
.order-submit-status.is-busy { border-color: #e1c67c; background: #fff8df; color: #765c16; }
.order-submit-status.is-busy::before { border-color: rgba(184,121,0,.22); border-top-color: var(--gold-text); }
@keyframes order-submit-spin { to { transform: rotate(360deg); } }

.sale-closed-dialog { width: min(calc(100% - 32px), 440px); overflow: hidden; text-align: center; }
.sale-closed-dialog::backdrop { background: rgba(31,43,50,.78); backdrop-filter: blur(8px); }
.sale-closed-content { padding: 34px 26px 38px; background: linear-gradient(160deg, #fffdf7, #e7f1f5); }
.sale-closed-icon { display: grid; width: 62px; height: 62px; margin: 0 auto 17px; place-items: center; border-radius: 50%; background: var(--winter-blue); color: white; font-size: 1.8rem; font-weight: 700; box-shadow: 0 8px 24px rgba(71,116,142,.28); }
.sale-closed-content .eyebrow { color: var(--peach-dark); }
.sale-closed-content h2 { margin: 7px 0 12px; font-size: 1.65rem; }
.sale-closed-content > p:last-child { margin: 0; color: var(--muted); line-height: 1.75; white-space: pre-wrap; }

.order-list { display: grid; gap: 12px; }
.order-card { padding: 16px; border: 1px solid var(--line); border-radius: 18px; background: white; }
.order-card-header { display: flex; justify-content: space-between; gap: 10px; }
.order-card h3 { margin: 0; font-size: 1rem; }
.order-card time { color: var(--muted); font-size: .72rem; }
.order-status { flex: none; align-self: start; padding: 5px 9px; border-radius: 999px; background: #dcece6; color: var(--sage); font-size: .72rem; font-weight: 700; }
.order-status.overdue { background: #f3e4e1; color: #9a3e36; }
.order-card pre { margin: 12px 0; color: var(--muted); font: inherit; font-size: .8rem; line-height: 1.6; white-space: pre-wrap; }
.order-shortage-notice { display: grid; gap: 3px; margin: 0 0 12px; padding: 10px 11px; border-radius: 11px; background: #fff3df; color: #795d34; font-size: .72rem; }
.order-shortage-notice strong { color: #b35d35; }
.order-money { display: grid; grid-template-columns: repeat(3,1fr); gap: 6px; padding-top: 11px; border-top: 1px solid var(--line); }
.order-money div { display: grid; gap: 3px; }
.order-money span { color: var(--muted); font-size: .66rem; }
.order-money strong { font-size: .82rem; }
.payment-action { width: 100%; margin-top: 13px; padding: 11px; border: 1px solid var(--peach-dark); border-radius: 12px; background: white; color: var(--peach-dark); font-weight: 700; cursor: pointer; }
.payment-report-complete { display: grid; gap: 3px; margin-top: 13px; padding: 11px 12px; border: 1px solid var(--sky-blue); border-radius: 12px; background: #edf5f8; color: var(--winter-blue); font-size: .75rem; }
.payment-report-complete span { color: var(--muted); }
.mall-payment { margin-top: 13px; padding-top: 13px; border-top: 1px solid var(--line); }
.mall-payment p { margin: 0 0 9px; color: var(--muted); font-size: .76rem; line-height: 1.55; }
.mall-payment .payment-action { display: block; margin-top: 0; background: var(--peach-dark); color: white; text-align: center; text-decoration: none; }
.mall-payment-expired { color: #9a3e36 !important; font-weight: 700; }
.toast { position: fixed; z-index: 100; left: 50%; bottom: 92px; max-width: calc(100% - 32px); padding: 11px 15px; border-radius: 12px; background: #302822; color: white; font-size: .82rem; opacity: 0; pointer-events: none; transform: translate(-50%, 12px); transition: .2s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 650px) {
  main { padding-top: 28px; }
  .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 17px; }
  .product-card h3 { font-size: .96rem; }
}
