:root {
  --ink: #202421;
  --paper: #f6f5f0;
  --white: #fff;
  --soft: #e8e9e3;
  --line: #d5d7d0;
  --accent: #bfdb54;
  --muted: #686e69;
  --danger: #9d342d;
  --font-serif: "Noto Serif TC", "Songti TC", "PMingLiU", serif;
  --font-sans: Inter, "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font-sans); line-height: 1.55; }
button, input, select { font: inherit; }
button, a { color: inherit; }
a { text-decoration: none; }
button { cursor: pointer; }

.checkout-header { height: 78px; border-bottom: 1px solid var(--line); background: rgba(246, 245, 240, .97); }
.header-inner { width: min(1160px, calc(100% - 40px)); height: 100%; margin: auto; display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-serif); font-size: 21px; font-weight: 700; line-height: 1; }
.brand small { display: block; margin-top: 5px; font-family: var(--font-sans); font-size: 8px; letter-spacing: 2px; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--ink); font-size: 17px; }
.header-tools { display: flex; align-items: center; gap: 14px; font-size: 11px; }
.header-tools button { min-width: 42px; height: 34px; border: 0; background: transparent; }
.secure-label { color: var(--muted); }

.checkout-progress { width: min(1160px, calc(100% - 40px)); margin: 22px auto 0; display: flex; align-items: center; gap: 12px; color: #898e89; font-size: 11px; }
.checkout-progress a { text-decoration: underline; }
.checkout-progress strong { color: var(--ink); }
.checkout-alert { width: min(1160px, calc(100% - 40px)); margin: 18px auto 0; padding: 12px 15px; border-left: 3px solid var(--danger); background: #f4e8e5; font-size: 12px; }

main { width: min(1160px, calc(100% - 40px)); margin: 28px auto 72px; }
.checkout-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(330px, .75fr); gap: 72px; align-items: start; }
.checkout-form { min-width: 0; }
.form-heading { margin-bottom: 38px; }
.eyebrow { margin: 0 0 12px; font-size: 10px; font-weight: 700; letter-spacing: 2px; }
.form-heading h1 { margin: 0; font: 500 38px/1.2 var(--font-serif); letter-spacing: 0; }
.form-heading > p:last-child { margin: 12px 0 0; color: var(--muted); font-size: 13px; }

fieldset { min-width: 0; margin: 0 0 34px; padding: 25px 0 0; border: 0; border-top: 1px solid var(--line); }
legend { display: flex; align-items: center; gap: 10px; padding: 0 12px 0 0; font-size: 14px; font-weight: 700; }
legend > span:first-child { color: #7b817c; font-size: 10px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px; }
.form-grid label { min-width: 0; display: grid; gap: 7px; font-size: 11px; }
.form-grid .span-2 { grid-column: 1 / -1; }
label small { color: #858a85; font-size: 10px; font-weight: 400; }
input, select { width: 100%; height: 48px; border: 1px solid #cfd1ca; border-radius: 0; background: var(--white); padding: 0 13px; color: var(--ink); }
input:focus, select:focus { outline: 2px solid var(--ink); outline-offset: 1px; }
input:user-invalid, select:user-invalid { border-color: var(--danger); }
.phone-control { height: 48px; display: grid; grid-template-columns: 112px minmax(0, 1fr); border: 1px solid #cfd1ca; background: var(--white); }
.phone-control:focus-within { outline: 2px solid var(--ink); outline-offset: 1px; }
.phone-control .dial-code { height: 46px; border: 0; border-right: 1px solid var(--line); padding: 0 12px; color: var(--muted); font-size: 12px; }
.phone-control input { height: 46px; border: 0; }
.phone-control input:focus { outline: 0; }
.customs-field > small { color: var(--muted); }

.payment-option { min-height: 78px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 13px; border: 2px solid var(--ink); background: var(--white); padding: 15px; cursor: pointer; }
.payment-option input { width: 16px; height: 16px; accent-color: var(--ink); }
.payment-option b, .payment-option small { display: block; }
.payment-option small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.payment-option strong { font-size: 10px; font-weight: 600; color: #59605a; }
.payment-note { margin: 10px 0 0; color: var(--muted); font-size: 10px; }
.form-hint { color: var(--muted); font-size: 10px; line-height: 1.45; }
.field-error { color: var(--danger); font-size: 10px; line-height: 1.45; }
.input-error { border-color: var(--danger) !important; box-shadow: 0 0 0 1px var(--danger); }
.checkout-form input, .checkout-form select { scroll-margin-top: 100px; }
.pay-button, .primary-button { min-height: 54px; border: 0; background: var(--ink); color: var(--white); font-weight: 700; }
.pay-button { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 20px; font-size: 13px; }
.pay-button:disabled { cursor: wait; opacity: .65; }
.form-message { min-height: 20px; margin: 11px 0 0; color: var(--danger); font-size: 11px; text-align: center; }
.terms { margin: 5px 0 0; color: #858a85; font-size: 9px; text-align: center; }

.order-summary { position: sticky; top: 28px; background: var(--soft); padding: 28px; }
.summary-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 20px; }
.summary-heading h2 { margin: 0; font: 500 22px/1.2 var(--font-serif); }
.summary-heading a { font-size: 10px; text-decoration: underline; }
.payment-currency { display: grid; gap: 7px; margin-top: 22px; font-size: 12px; font-weight: 600; }
.payment-currency select { font-weight: 400; cursor: pointer; }
.currency-help { margin: 8px 0 0; color: var(--muted); font-size: 10px; }
.reference-summary { margin-top: 15px; padding-top: 12px; border-top: 1px solid #cccec7; }
.reference-summary p { display: flex; justify-content: space-between; gap: 12px; margin: 0 0 5px; font-size: 11px; }
.reference-summary small { display: block; color: var(--muted); font-size: 10px; }
.summary-item { display: grid; grid-template-columns: 68px minmax(0, 1fr) auto; gap: 13px; align-items: start; padding: 20px 0; border-bottom: 1px solid #cccec7; }
.summary-item img { width: 68px; height: 76px; object-fit: cover; }
.summary-item h3 { margin: 0; font-size: 12px; overflow-wrap: anywhere; }
.summary-item p { margin: 6px 0 0; color: var(--muted); font-size: 10px; }
.summary-item > b { font-size: 12px; }
.summary-lines { padding-top: 13px; }
.summary-lines p { display: flex; justify-content: space-between; gap: 20px; margin: 10px 0; font-size: 12px; }
.summary-total { margin-top: 15px !important; padding-top: 15px; border-top: 1px solid #cccec7; font-size: 17px !important; }
.summary-foot { margin: 17px 0 0; padding-top: 15px; border-top: 1px solid #cccec7; color: var(--muted); font-size: 9px; }

.empty-checkout { max-width: 580px; margin: 90px auto; text-align: center; }
.empty-checkout h1 { margin: 0; font: 500 38px/1.2 var(--font-serif); }
.empty-checkout p { color: var(--muted); }
.primary-button { width: max-content; display: inline-flex; align-items: center; justify-content: center; margin-top: 16px; padding: 0 26px; font-size: 12px; }
.checkout-footer { width: min(1160px, calc(100% - 40px)); margin: 0 auto 30px; padding-top: 22px; border-top: 1px solid var(--line); display: flex; gap: 24px; color: var(--muted); font-size: 9px; }

.result-main { min-height: calc(100vh - 180px); display: grid; place-items: center; margin-top: 0; }
.result-panel { max-width: 620px; padding: 70px 0; text-align: center; }
.result-status { width: 48px; height: 48px; margin: 0 auto 24px; display: grid; place-items: center; border: 1px solid var(--ink); border-radius: 50%; font-size: 21px; }
.result-panel h1 { margin: 0; font: 500 39px/1.2 var(--font-serif); }
.result-panel p { margin: 15px auto; color: var(--muted); font-size: 13px; }
.result-order { color: var(--ink) !important; font-weight: 700; }
.result-actions { margin-top: 24px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.result-actions .primary-button { margin-top: 0; }
.secondary-link { font-size: 11px; text-decoration: underline; }
button.secondary-link { border: 0; background: transparent; color: var(--ink); font-family: inherit; padding: 8px 0; cursor: pointer; }
button.secondary-link:disabled { opacity: .6; cursor: wait; }

.status-main { max-width: none; }
.status-intro { max-width: 620px; margin-bottom: 30px; }
.status-intro h1 { margin: 0; font: 500 40px/1.2 var(--font-serif); }
.status-intro > p:last-child { color: var(--muted); font-size: 13px; }
.lookup-form { display: grid; grid-template-columns: 1fr 1.35fr auto; gap: 12px; align-items: end; padding: 22px 0 28px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.lookup-form label { display: grid; gap: 7px; font-size: 11px; }
.lookup-form button { height: 48px; border: 0; background: var(--ink); color: var(--white); padding: 0 24px; font-size: 12px; font-weight: 700; }
.lookup-message { min-height: 20px; color: var(--danger); font-size: 11px; }
.status-result { margin-top: 42px; }
.status-result-head { display: flex; justify-content: space-between; gap: 40px; align-items: flex-end; }
.status-result-head h2 { margin: 0; font: 500 30px/1.2 var(--font-serif); }
.status-result-head p { margin: 6px 0 0; color: var(--muted); font-size: 10px; }
.status-pair { display: grid; grid-template-columns: repeat(2, minmax(130px, 1fr)); border: 1px solid var(--line); }
.status-pair > div { padding: 13px 16px; }
.status-pair > div + div { border-left: 1px solid var(--line); }
.status-pair span, .tracking-band span { display: block; color: var(--muted); font-size: 9px; }
.status-pair b { display: block; margin-top: 3px; font-size: 12px; }
.order-timeline { margin: 42px 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); list-style: none; }
.order-timeline li { position: relative; color: #979c97; text-align: center; font-size: 10px; }
.order-timeline li::before { content: ""; position: absolute; left: -50%; right: 50%; top: 7px; height: 1px; background: var(--line); }
.order-timeline li:first-child::before { display: none; }
.order-timeline li > span { position: relative; width: 15px; height: 15px; margin: 0 auto 9px; display: block; border: 1px solid #aeb2ae; border-radius: 50%; background: var(--paper); }
.order-timeline li.complete, .order-timeline li.current { color: var(--ink); }
.order-timeline li.complete > span { border-color: var(--ink); background: var(--ink); }
.order-timeline li.current > span { border: 4px solid var(--accent); background: var(--ink); }
.order-timeline li b, .order-timeline li small { display: block; }
.order-timeline li small { min-height: 30px; margin-top: 5px; padding: 0 5px; color: var(--muted); font-size: 8px; font-weight: 400; line-height: 1.4; }
.tracking-band { display: grid; grid-template-columns: 1fr 1fr auto; align-items: center; gap: 20px; padding: 18px 20px; background: var(--soft); }
.tracking-band b { font-size: 12px; }
.tracking-band a { font-size: 11px; text-decoration: underline; }
.status-history-panel { margin-top: 34px; padding-top: 24px; border-top: 1px solid var(--line); }
.status-history-panel h3 { margin: 0 0 14px; font: 500 19px/1.2 var(--font-serif); }
.status-history-panel ol { margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px; list-style: none; }
.status-history-panel li { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 10px; }
.status-history-panel time { color: var(--muted); }
.status-order-grid { display: grid; grid-template-columns: 1.35fr .65fr; gap: 56px; margin-top: 36px; padding-top: 28px; border-top: 1px solid var(--line); }
.status-order-grid h3 { margin: 0 0 8px; font: 500 19px/1.2 var(--font-serif); }
.status-item { display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 13px 0; border-bottom: 1px solid var(--line); }
.status-item img { width: 58px; height: 65px; object-fit: cover; }
.status-item b, .status-item small { display: block; }
.status-item b { font-size: 11px; }
.status-item small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.status-item strong { font-size: 11px; }
.status-totals p { display: flex; justify-content: space-between; gap: 20px; margin: 10px 0; font-size: 11px; }
.status-totals p:nth-child(3) { margin-top: 15px; padding-top: 15px; border-top: 1px solid var(--line); font-size: 15px; }
.status-totals small { display: block; margin-top: 18px; color: var(--muted); font-size: 9px; }
.lookup-privacy { margin: 38px 0 0; padding-top: 17px; border-top: 1px solid var(--line); color: var(--muted); font-size: 9px; }

@media (max-width: 820px) {
  .checkout-grid { grid-template-columns: 1fr; gap: 38px; }
  .order-summary { position: static; grid-row: 1; }
  .checkout-form { grid-row: 2; }
  .form-heading h1 { font-size: 33px; }
  .status-result-head { align-items: stretch; flex-direction: column; }
  .status-order-grid { grid-template-columns: 1fr; gap: 28px; }
}

@media (max-width: 560px) {
  .checkout-header { height: 66px; }
  .header-inner, .checkout-progress, main, .checkout-footer, .checkout-alert { width: calc(100% - 32px); }
  .brand { font-size: 18px; }
  .brand-mark { width: 34px; height: 34px; }
  .secure-label { display: none; }
  .checkout-progress { margin-top: 17px; gap: 8px; }
  main { margin-top: 23px; }
  .order-summary { padding: 21px 18px; }
  .form-grid { grid-template-columns: 1fr; gap: 14px; }
  .form-grid .span-2 { grid-column: auto; }
  .payment-option { grid-template-columns: auto minmax(0, 1fr); }
  .payment-option strong { grid-column: 2; }
  .checkout-footer { flex-wrap: wrap; }
  .lookup-form { grid-template-columns: 1fr; }
  .status-intro h1 { font-size: 34px; }
  .status-pair { width: 100%; }
  .order-timeline { overflow-x: auto; grid-template-columns: repeat(5, minmax(90px, 1fr)); padding-bottom: 8px; }
  .tracking-band { grid-template-columns: 1fr; }
  .status-history-panel ol { grid-template-columns: 1fr; }
  .status-history-panel li { grid-template-columns: 125px minmax(0, 1fr); }
}

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