:root {
    --brand-primary: #aa0000;
    --brand-primary-dark: #790000;
    --brand-gold: #f0cb35;
    --brand-gold-soft: #fff7d6;
    --surface: #ffffff;
    --canvas: #f7f5f2;
    --text: #2a2523;
    --muted: #6f6864;
    --border: #ded8d3;
    --success: #18794e;
    --success-soft: #edf8f2;
    --danger: #b42318;
    --danger-soft: #fff0ee;
    --focus: #005fcc;
    --shadow: 0 8px 24px rgba(63, 46, 38, 0.08);
    --radius-sm: 8px;
    --radius: 12px;
    --page: 1180px;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    min-width: 320px;
    background: var(--canvas);
    color: var(--text);
    font-family: "Microsoft JhengHei", "Noto Sans TC", system-ui, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }
a { color: var(--brand-primary-dark); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

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

.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.skip-link {
    position: fixed;
    z-index: 999;
    top: 8px;
    left: 8px;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--brand-primary-dark);
    transform: translateY(-150%);
}
.skip-link:focus { transform: translateY(0); }

.page-shell {
    width: min(var(--page), calc(100% - 40px));
    margin-inline: auto;
}

.site-header {
    position: relative;
    z-index: 20;
    background: var(--brand-primary-dark);
    color: #fff;
}
.site-header__inner {
    width: min(var(--page), calc(100% - 40px));
    min-height: 64px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}
.wordmark {
    display: inline-flex;
    align-items: baseline;
    gap: 10px;
    color: #fff;
    text-decoration: none;
}
.wordmark__name { font-size: 21px; font-weight: 800; letter-spacing: .08em; }
.wordmark__sub { color: #f7eab2; font-size: 14px; }
.header-help { color: #fff; font-weight: 700; text-decoration: none; }
.header-help:hover { text-decoration: underline; }

.checkout-steps {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.checkout-steps ol {
    width: min(760px, calc(100% - 32px));
    min-height: 64px;
    margin: 0 auto;
    padding: 0;
    list-style: none;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    align-items: center;
}
.checkout-steps li {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}
.checkout-steps li:not(:last-child)::after {
    content: "";
    position: absolute;
    top: 50%;
    right: -18%;
    width: 36%;
    height: 1px;
    background: var(--border);
}
.checkout-steps__number {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--surface);
}
.checkout-steps .is-current { color: var(--brand-primary-dark); }
.checkout-steps .is-current .checkout-steps__number {
    border-color: var(--brand-primary);
    background: var(--brand-primary);
    color: #fff;
}
.checkout-steps .is-complete { color: var(--success); }
.checkout-steps .is-complete .checkout-steps__number {
    border-color: var(--success);
    background: var(--success-soft);
}

.shop-hero { background: var(--surface); border-bottom: 1px solid var(--border); }
.shop-hero > img { width: 100%; max-height: 420px; object-fit: cover; object-position: center; }
.shop-hero__content { padding-block: 40px; }
.shop-hero__content h1 { max-width: 800px; margin: 0; font-size: clamp(30px, 5vw, 48px); line-height: 1.2; }
.shop-hero__content p:last-child { max-width: 780px; margin: 12px 0 0; color: var(--muted); font-size: 18px; }

.eyebrow {
    margin: 0 0 6px;
    color: var(--brand-primary);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .12em;
}

.catalog { padding-block: 48px 32px; }
.catalog__heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 32px;
    margin-bottom: 24px;
}
.catalog__heading h2, .workflow-heading h1 { margin: 0; font-size: clamp(28px, 4vw, 36px); line-height: 1.25; }
.catalog__heading p:last-child, .workflow-heading > p:last-child { margin: 8px 0 0; color: var(--muted); }

.search-box { width: min(360px, 100%); }
.search-box input,
.field input,
.field select,
.field textarea {
    width: 100%;
    min-height: 48px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    padding: 10px 12px;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}
.search-box input { padding-left: 16px; }
.search-box input:focus,
.field input:focus,
.field select:focus,
.field textarea:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(170, 0, 0, .12);
    outline: 0;
}

.category-chips {
    display: flex;
    gap: 8px;
    padding-bottom: 20px;
    overflow-x: auto;
    scrollbar-width: thin;
}
.chip {
    min-height: 44px;
    flex: 0 0 auto;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
}
.chip:hover { border-color: var(--brand-primary); }
.chip.is-active {
    border-color: var(--brand-primary-dark);
    background: var(--brand-primary-dark);
    color: #fff;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
}
.product-card {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}
.product-card.is-updating { opacity: .72; }
.product-card__image {
    aspect-ratio: 1 / 1;
    display: grid;
    place-items: center;
    background: #fbfaf8;
    border-bottom: 1px solid var(--border);
    overflow: hidden;
}
.product-card__image img { width: 100%; height: 100%; object-fit: contain; transition: transform 180ms ease; }
.product-card:hover .product-card__image img { transform: scale(1.025); }
.product-card__body { padding: 16px; }
.product-card__meta, .cart-item__sku {
    min-height: 22px;
    margin: 0 0 4px;
    color: var(--muted);
    font-size: 13px;
}
.product-card h3 { min-height: 52px; margin: 0 0 12px; font-size: 17px; line-height: 1.5; }
.product-card__price { min-height: 56px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.product-card__price strong { color: var(--brand-primary-dark); font-size: 22px; }
.product-card__price del { color: var(--muted); font-size: 13px; }

.quantity-control {
    display: grid;
    grid-template-columns: 44px minmax(52px, 1fr) 44px;
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.quantity-control button,
.quantity-control input {
    min-width: 0;
    min-height: 44px;
    border: 0;
    background: var(--surface);
    color: var(--text);
    text-align: center;
}
.quantity-control button { font-size: 21px; cursor: pointer; }
.quantity-control button:hover:not(:disabled) { background: var(--brand-gold-soft); }
.quantity-control button:disabled { color: #aaa39f; cursor: not-allowed; }
.quantity-control input {
    width: 100%;
    border-inline: 1px solid var(--border);
    border-radius: 0;
    font-weight: 800;
    appearance: textfield;
}
.quantity-control input::-webkit-inner-spin-button { appearance: none; }
.product-card__feedback, .cart-item__feedback { min-height: 22px; margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.product-card__feedback.is-error, .cart-item__feedback.is-error { color: var(--danger); }
.product-card__feedback.is-success, .cart-item__feedback.is-success { color: var(--success); }

.status-text { font-weight: 700; }
.status-text--danger { color: var(--danger) !important; }
.is-hidden { display: none !important; }

.cart-dock {
    position: sticky;
    z-index: 15;
    bottom: max(12px, env(safe-area-inset-bottom));
    width: min(680px, calc(100% - 32px));
    min-height: 68px;
    margin: 20px auto;
    padding: 10px 12px 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border: 1px solid #d1c5b8;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .97);
    box-shadow: 0 12px 36px rgba(42, 37, 35, .16);
}
.cart-dock > div { display: flex; flex-direction: column; }
.cart-dock > div > strong { color: var(--brand-primary-dark); font-size: 20px; }

.button {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-weight: 800;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}
.button:hover { transform: translateY(-1px); }
.button--primary { background: var(--brand-primary); color: #fff; }
.button--primary:hover { background: var(--brand-primary-dark); color: #fff; }
.button--gold { background: var(--brand-gold); color: #352b08; }
.button--gold:hover { background: #e4bd20; color: #2a2205; }
.button--quiet { border-color: var(--border); background: var(--surface); color: var(--brand-primary-dark); }
.button--quiet:hover { border-color: var(--brand-primary); background: #fffafa; }
.button--full { width: 100%; margin-top: 12px; }
.button.is-disabled, .button[disabled] { opacity: .48; pointer-events: none; }

.activity-details { padding-block: 32px 100px; }
.activity-details h2 { font-size: 28px; }
.activity-details details { margin-bottom: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.activity-details summary { min-height: 52px; padding: 14px 18px; font-weight: 800; cursor: pointer; }
.activity-details .prose { padding: 0 18px 20px; border-top: 1px solid var(--border); }
.prose { overflow-wrap: anywhere; }
.prose img { width: auto !important; height: auto !important; margin: 18px auto; border-radius: var(--radius-sm); }
.prose table { max-width: 100%; display: block; overflow-x: auto; }

.workflow-page { padding-block: 40px 72px; }
.workflow-heading { margin-bottom: 28px; }
.cart-layout, .checkout-layout, .completion-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    align-items: start;
    gap: 24px;
}
.cart-items { display: grid; gap: 12px; }
.cart-item {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr) 180px;
    gap: 18px;
    align-items: center;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}
.cart-item > img { width: 120px; height: 120px; object-fit: contain; border-radius: var(--radius-sm); background: #fbfaf8; }
.cart-item h2 { margin: 0 0 6px; font-size: 18px; line-height: 1.45; }
.cart-item__unit { margin: 0; color: var(--brand-primary-dark); font-weight: 700; }
.cart-item__actions { min-width: 0; text-align: right; }
.cart-item__line-total { display: block; margin-top: 8px; color: var(--brand-primary-dark); font-size: 18px; }
.text-button { min-height: 44px; border: 0; background: transparent; font-weight: 700; text-decoration: underline; cursor: pointer; }
.text-button--danger { color: var(--danger); }

.order-summary-card,
.form-card,
.empty-state--card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}
.order-summary-card { position: sticky; top: 20px; padding: 22px; }
.order-summary-card h2, .form-card > h2 { margin: 0 0 16px; font-size: 21px; }
.price-summary > div { display: flex; justify-content: space-between; gap: 20px; padding: 8px 0; }
.price-summary strong { white-space: nowrap; }
.price-summary__discount { color: var(--success); }
.price-summary__total { margin-top: 8px; padding-top: 16px !important; border-top: 1px solid var(--border); font-size: 20px; }
.price-summary__total strong { color: var(--brand-primary-dark); font-size: 24px; }
.secure-note { padding: 12px; border-radius: var(--radius-sm); background: var(--brand-gold-soft); color: #56460e; font-size: 14px; }

.checkout-form-sections { display: grid; gap: 16px; }
.form-card { padding: 24px; }
.form-card__heading { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.form-card__heading > span { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: var(--brand-primary-dark); color: #fff; font-weight: 800; }
.form-card__heading h2 { margin: 0; font-size: 22px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field { display: grid; gap: 6px; color: var(--text); font-weight: 700; }
.field--full { grid-column: 1 / -1; }
.field b { color: var(--danger); }
.field small { color: var(--muted); font-size: 13px; font-weight: 400; }
.field textarea { resize: vertical; }
.choice-list { margin: 0 0 20px; padding: 0; border: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.choice-list label { min-height: 56px; display: flex; align-items: flex-start; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; }
.choice-list label:has(input:checked), .choice-list label.is-selected { border-color: var(--brand-primary); background: #fff8f8; box-shadow: inset 0 0 0 1px var(--brand-primary); }
.choice-list input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--brand-primary); }
.choice-list span { display: grid; font-weight: 800; }
.choice-list small { color: var(--muted); font-weight: 400; }
.order-summary-card--checkout { top: 16px; }
.mini-items { margin: 0 0 12px; padding: 0 0 12px; border-bottom: 1px solid var(--border); list-style: none; }
.mini-items li { display: flex; justify-content: space-between; gap: 16px; padding: 6px 0; font-size: 14px; }
.mini-items span { overflow-wrap: anywhere; }
.mini-items strong { white-space: nowrap; }

.form-alert { margin: 0 0 20px; padding: 12px 14px; border-radius: var(--radius-sm); }
.form-alert--error { border: 1px solid #e9a49d; background: var(--danger-soft); color: #7f1d16; }
.payment-instructions { margin: 16px 0; padding: 14px; border: 1px solid #ead58b; border-radius: var(--radius-sm); background: #fffaf0; overflow-wrap: anywhere; }
.payment-instructions p { margin: 6px 0 0; }

.empty-state { padding-block: 64px; text-align: center; }
.empty-state--card { max-width: 680px; margin: 36px auto; padding: 48px 24px; }
.empty-state h1, .empty-state h2 { margin-top: 0; }

.completion-page { padding-block: 40px 72px; }
.completion-status { display: flex; align-items: center; gap: 18px; margin-bottom: 28px; padding: 24px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.completion-status__icon { width: 52px; height: 52px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; font-size: 26px; font-weight: 900; }
.completion-status h1 { margin: 0; font-size: clamp(26px, 4vw, 34px); }
.completion-status p:last-child { margin: 6px 0 0; color: var(--muted); }
.completion-status--success .completion-status__icon { background: var(--success-soft); color: var(--success); }
.completion-status--pending .completion-status__icon { background: var(--brand-gold-soft); color: #6b5400; }
.completion-status--error .completion-status__icon { background: var(--danger-soft); color: var(--danger); }
.completed-items { display: grid; gap: 10px; }
.completed-items article { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding-block: 10px; border-top: 1px solid var(--border); }
.completed-items img { width: 72px; height: 72px; object-fit: contain; border-radius: var(--radius-sm); background: #fbfaf8; }
.completed-items h3 { margin: 0; font-size: 16px; }
.completed-items p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.order-meta { margin: 16px 0 0; padding-top: 12px; border-top: 1px solid var(--border); }
.order-meta > div { display: flex; justify-content: space-between; gap: 16px; padding: 5px 0; }
.order-meta dt { color: var(--muted); }
.order-meta dd { margin: 0; text-align: right; }
.optional-survey { margin-top: 24px; display: grid; grid-template-columns: 1fr 2fr; gap: 28px; }
.optional-survey h2 { margin: 0; }
.optional-survey p:last-child { color: var(--muted); }
.optional-survey form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: end; }
.optional-survey button { grid-column: 1 / -1; justify-self: end; }

.site-footer { padding: 32px 20px calc(32px + env(safe-area-inset-bottom)); background: #2e2724; color: #eee8e4; text-align: center; font-size: 14px; }
.site-footer p { margin: 3px 0; }
.site-footer a { color: #fff1b0; }

@media (max-width: 980px) {
    .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .cart-layout, .checkout-layout, .completion-layout { grid-template-columns: minmax(0, 1fr) 320px; }
    .cart-item { grid-template-columns: 96px minmax(0, 1fr); }
    .cart-item > img { width: 96px; height: 96px; }
    .cart-item__actions { grid-column: 2; text-align: left; }
}

@media (max-width: 760px) {
    .page-shell, .site-header__inner { width: min(100% - 28px, var(--page)); }
    .site-header__inner { min-height: 56px; }
    .header-help { font-size: 13px; }
    .wordmark__sub { display: none; }
    .checkout-steps ol { min-height: 58px; width: calc(100% - 20px); }
    .checkout-steps li { gap: 5px; font-size: 12px; }
    .checkout-steps li:not(:last-child)::after { display: none; }
    .checkout-steps__number { width: 25px; height: 25px; }
    .shop-hero__content { padding-block: 28px; }
    .shop-hero > img { max-height: 280px; }
    .catalog { padding-top: 32px; }
    .catalog__heading { align-items: stretch; flex-direction: column; gap: 18px; }
    .search-box { width: 100%; }
    .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .product-card__body { padding: 12px; }
    .product-card h3 { min-height: 72px; font-size: 15px; }
    .product-card__price strong { font-size: 19px; }
    .cart-dock { width: calc(100% - 20px); bottom: max(8px, env(safe-area-inset-bottom)); margin-block: 10px; }
    .activity-details { padding-bottom: 88px; }
    .workflow-page, .completion-page { padding-block: 28px 56px; }
    .cart-layout, .checkout-layout, .completion-layout { grid-template-columns: 1fr; }
    .order-summary-card { position: static; }
    .checkout-layout .order-summary-card { order: -1; }
    .cart-item { grid-template-columns: 82px minmax(0, 1fr); gap: 12px; padding: 12px; }
    .cart-item > img { width: 82px; height: 82px; }
    .form-card { padding: 18px; }
    .choice-list { grid-template-columns: 1fr; }
    .optional-survey { grid-template-columns: 1fr; }
    .optional-survey form { grid-template-columns: 1fr; }
    .optional-survey button { grid-column: 1; justify-self: stretch; }
}

@media (max-width: 390px) {
    .header-help { display: none; }
    .product-grid { grid-template-columns: 1fr; }
    .product-card { display: grid; grid-template-columns: 128px minmax(0, 1fr); }
    .product-card__image { width: 100%; height: 100%; min-height: 190px; aspect-ratio: auto; border-bottom: 0; border-right: 1px solid var(--border); }
    .product-card h3 { min-height: 0; }
    .product-card__price { min-height: 48px; }
    .quantity-control { grid-template-columns: 44px minmax(44px, 1fr) 44px; }
    .cart-dock { padding-left: 14px; }
    .cart-dock .button { padding-inline: 13px; }
    .form-grid { grid-template-columns: 1fr; }
    .field--full { grid-column: 1; }
    .completed-items article { grid-template-columns: 58px minmax(0, 1fr); }
    .completed-items img { width: 58px; height: 58px; }
    .completed-items article > strong { grid-column: 2; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        transition-duration: .001ms !important;
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
    }
}
