:root {
    --page: #f3f3f1;
    --surface: #ffffff;
    --ink: #111111;
    --muted: #8b8b8b;
    --line: #dededb;
    --price: #c92332;
    --success: #3f7448;
    --success-bg: #edf7ec;
    --danger: #b82c3a;
    --danger-bg: #fff0f1;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--page);
    -webkit-text-size-adjust: 100%;
}

body {
    min-width: 280px;
    min-height: 100%;
    margin: 0;
    padding-bottom: calc(76px + env(safe-area-inset-bottom));
    overflow-x: hidden;
    background: var(--page);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    text-size-adjust: 100%;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
    touch-action: manipulation;
}

a {
    color: inherit;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

label {
    -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
    outline: 3px solid rgba(17, 17, 17, 0.22);
    outline-offset: 2px;
}

.shop-shell {
    width: 100%;
    max-width: 720px;
    min-height: 100vh;
    margin: 0 auto;
    padding-bottom: 0;
    background: #fafaf9;
    box-shadow: 0 8px 26px rgba(19, 19, 19, 0.055);
}

.shop-header {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 86px;
    padding: 16px 22px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 5px 20px rgba(20, 20, 20, 0.035);
    backdrop-filter: blur(14px);
}

.shop-logo {
    position: relative;
    display: grid;
    flex: 0 0 54px;
    width: 54px;
    height: 54px;
    place-items: center;
    overflow: hidden;
    border: 1px solid #222;
    border-radius: 12px;
    background: #080808;
    box-shadow: 0 5px 14px rgba(0, 0, 0, 0.14);
}

.shop-logo img {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.shop-logo-fallback {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 28px;
    font-weight: 800;
}

.shop-title {
    min-width: 0;
    flex: 1;
    margin-left: 12px;
}

.shop-title strong {
    display: block;
    overflow: hidden;
    color: var(--ink);
    font-size: 21px;
    font-weight: 800;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.shop-title span {
    display: none;
}

.header-actions {
    display: flex;
    flex: 0 0 auto;
    gap: 8px;
    margin-left: 12px;
}

.header-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 16px;
    border: 1px solid var(--ink);
    border-radius: 9px;
    background: #fff;
    color: var(--ink);
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

.header-btn-dark {
    border-color: var(--ink);
    background: var(--ink);
    color: #fff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}

.shop-notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 14px 20px 0;
    padding: 14px 16px;
    border: 1px solid #dcdcd8;
    border-radius: 12px;
    background: linear-gradient(135deg, #fff 0%, #f7f7f5 100%);
    color: #646464;
    box-shadow: 0 3px 12px rgba(20, 20, 20, 0.035);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.65;
}

.shop-notice svg {
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
    margin-top: 2px;
}

.shop-notice.warning {
    border-color: #efd3d5;
    background: var(--danger-bg);
    color: var(--danger);
}

.shop-notice > div {
    min-width: 0;
    word-break: break-word;
}

.shop-section {
    padding: 26px 20px 0;
}

.shop-section + .shop-section {
    padding-top: 30px;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 14px;
    color: #26313d;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 0;
}

.section-title svg {
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
}

.category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    overflow-x: auto;
    margin: -2px 0 14px;
    padding-bottom: 2px;
    scrollbar-width: none;
}

.category-tabs::-webkit-scrollbar {
    display: none;
}

.category-tab {
    display: inline-flex;
    min-height: 36px;
    flex: 0 0 auto;
    align-items: center;
    padding: 8px 14px;
    border: 1px solid #d0d0cc;
    border-radius: 10px;
    background: #fff;
    color: #666;
    font-size: 13px;
    font-weight: 700;
}

.category-tab.active {
    border-color: var(--ink);
    background: var(--ink);
    color: #fff;
}

.product-card {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 114px;
    align-items: center;
    gap: 18px;
    margin-bottom: 12px;
    padding: 15px 18px;
    overflow: visible;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 2px 8px rgba(26, 32, 38, 0.07);
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.product-card.featured {
    border-color: #555;
}

.product-card.selected {
    border-color: var(--ink);
    background: #f8f8f7;
    box-shadow: inset 0 0 0 1px var(--ink), 0 3px 11px rgba(17, 17, 17, 0.12);
}

.product-image {
    position: relative;
    display: grid;
    flex: 0 0 78px;
    width: 78px;
    height: 78px;
    place-items: center;
    overflow: hidden;
    border-radius: 3px;
    background: #050505;
}

.product-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-main {
    min-width: 0;
    flex: 1;
}

.product-name {
    display: -webkit-box;
    overflow: hidden;
    margin: 0 0 10px;
    color: #26313d;
    font-size: 16px;
    font-weight: 800;
    line-height: 1.35;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.product-meta {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 15px;
    margin: 0;
}

.product-price {
    color: var(--price);
    font-size: 19px;
    font-weight: 900;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.product-price b {
    font-size: inherit;
    letter-spacing: normal;
}

.product-sold {
    color: var(--muted);
    font-size: 12px;
    font-weight: 400;
    white-space: nowrap;
}

.stock-tag {
    display: inline-flex;
    min-height: 0;
    align-items: center;
    justify-content: center;
    margin: 0 0 0 18px;
    padding: 4px 8px;
    border-radius: 3px;
    background: var(--success-bg);
    color: var(--success);
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.stock-tag.empty {
    background: var(--danger-bg);
    color: var(--danger);
}

.selected-tag {
    position: absolute;
    top: 9px;
    right: 9px;
    z-index: 2;
    padding: 3px 7px;
    border-radius: 3px;
    background: var(--ink);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    line-height: 1.2;
}

.detail-panel {
    overflow: hidden;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(26, 32, 38, 0.055);
}

.detail-block {
    padding: 16px;
    border-bottom: 1px solid var(--line);
}

.detail-block:last-child {
    border-bottom: 0;
}

.detail-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
    color: var(--ink);
    font-size: 14px;
    font-weight: 800;
}

.detail-label small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 400;
}

.product-description {
    color: #666;
    font-size: 13px;
    line-height: 1.7;
    overflow-wrap: anywhere;
}

.quantity-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.stepper {
    display: flex;
    align-items: center;
    overflow: hidden;
    border: 1px solid var(--ink);
    border-radius: 3px;
    background: #fff;
}

.stepper button {
    width: 38px;
    height: 38px;
    border: 0;
    background: #fff;
    color: var(--ink);
    font-size: 20px;
    font-weight: 700;
    line-height: 1;
}

.stepper button:disabled {
    cursor: not-allowed;
    color: #c7c9cc;
}

.stepper input {
    width: 48px;
    height: 38px;
    border: 0;
    border-right: 1px solid var(--line);
    border-left: 1px solid var(--line);
    outline: 0;
    background: #fff;
    color: var(--ink);
    font-size: 14px;
    text-align: center;
    -moz-appearance: textfield;
}

.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button {
    margin: 0;
    -webkit-appearance: none;
}

.contact-input {
    display: block;
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid #bdbdbd;
    border-radius: 3px;
    outline: none;
    background: #fff;
    color: var(--ink);
    font-size: 14px;
}

.contact-input:focus {
    border-color: var(--ink);
}

.field-help {
    margin-top: 8px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

.pay-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pay-option {
    position: relative;
    display: inline-flex;
    min-height: 48px;
    flex: 1 1 130px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    max-width: 180px;
    padding: 10px 12px;
    border: 1px solid #d2d2d2;
    border-radius: 3px;
    background: #fff;
    color: #555;
    font-size: 12px;
    font-weight: 700;
}

.pay-option.active {
    border-color: var(--ink);
    background: #f5f5f5;
    color: var(--ink);
}

.pay-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.pay-option img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.empty-products {
    padding: 30px 20px;
    border-radius: 8px;
    background: #fff;
    color: var(--muted);
    font-size: 13px;
    text-align: center;
}

.shop-footer {
    padding: 12px 20px 34px;
    color: #aaa;
    font-size: 12px;
    line-height: 1.7;
    text-align: center;
}

.shop-footer a {
    color: #777b80;
}

.btn_buy {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 40;
    width: 100%;
    max-width: 720px;
    min-height: 72px;
    margin: 0 auto;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    border-top: 1px solid #cfcfcf;
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 -5px 18px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.btn-buy-inner {
    display: flex;
    width: 100%;
    max-width: 560px;
    align-items: center;
    gap: 18px;
    margin: 0 auto;
}

.pay-total {
    min-width: 0;
    flex: 1;
    line-height: 1.15;
    text-align: left;
}

.pay-total small {
    display: block;
    margin-bottom: 3px;
    color: #777;
    font-size: 12px;
    font-weight: 700;
}

.pay-total strong {
    display: block;
    color: var(--price);
    font-size: 24px;
    font-weight: 900;
}

.to_pay {
    min-height: 50px;
    flex: 0 0 min(54%, 280px);
    border: 0;
    border-radius: 10px;
    background: var(--ink);
    color: #fff;
    font-size: 16px;
    font-weight: 800;
    line-height: 50px;
    text-align: center;
}

.to_pay:disabled {
    cursor: not-allowed;
    background: #b7b9bb;
}

.to_pay.loading,
.to_pay.is-loading,
.checkout-confirm.loading,
.checkout-confirm.is-loading {
    opacity: 0.72;
    pointer-events: none;
    cursor: wait;
}

.checkout-modal {
    position: fixed;
    z-index: 100;
    inset: 0;
    display: none;
    align-items: flex-end;
    justify-content: center;
}

.checkout-modal.is-open {
    display: flex;
}

.checkout-mask {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
}

.checkout-panel {
    position: relative;
    z-index: 1;
    width: min(100%, 680px);
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
    overflow-y: auto;
    border-radius: 12px 12px 0 0;
    background: #fff;
    box-shadow: 0 -12px 36px rgba(0, 0, 0, 0.2);
    animation: checkoutSlideUp 0.22s ease-out;
}

.checkout-eyebrow {
    color: #777;
    font-size: 12px;
    font-weight: 700;
}

.checkout-panel h2 {
    margin: 5px 0 18px;
    color: var(--ink);
    font-size: 21px;
    font-weight: 800;
}

.checkout-close {
    position: absolute;
    top: 12px;
    right: 14px;
    display: grid;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    place-items: center;
    background: #f1f1f1;
    color: #555;
    font-size: 25px;
    line-height: 1;
}

.checkout-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 14px;
    border: 1px solid #d8d8d8;
    border-radius: 3px;
    background: #f7f7f7;
    color: #666;
    font-size: 13px;
}

.checkout-summary strong {
    color: var(--price);
    font-size: 21px;
}

.checkout-field {
    margin-top: 18px;
}

.checkout-field > label {
    display: block;
    margin-bottom: 9px;
    color: var(--ink);
    font-size: 14px;
    font-weight: 800;
}

.checkout-field .contact-input {
    margin: 0;
}

.checkout-field p {
    margin: 7px 0 0;
    color: #888;
    font-size: 12px;
    line-height: 1.45;
}

.checkout-payment-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.checkout-payment-options .pay-option {
    min-width: 130px;
    max-width: none;
    flex: 1;
    margin: 0;
    font-size: 13px;
}

.checkout-pay-error {
    color: var(--danger) !important;
}

.checkout-confirm {
    width: 100%;
    min-height: 50px;
    margin-top: 22px;
    padding: 14px;
    border: 0;
    border-radius: 10px;
    background: var(--ink);
    color: #fff;
    font-size: 16px;
    font-weight: 800;
}

.checkout-confirm:disabled {
    cursor: not-allowed;
    background: #b7b9bb;
}

.checkout-confirm.loading {
    opacity: 0.72;
    pointer-events: none;
}

.checkout-confirm.loading::before,
.checkout-confirm.is-loading::before,
.to_pay.loading::before,
.to_pay.is-loading::before {
    content: "";
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 9px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    vertical-align: -3px;
    animation: paymentSpin 0.75s linear infinite;
}

@keyframes checkoutSlideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

@keyframes paymentSpin {
    to {
        transform: rotate(360deg);
    }
}

.query-shell {
    width: 100%;
    max-width: 720px;
    min-height: 100vh;
    margin: 0 auto;
    padding: 22px 12px 60px;
    background: var(--page);
}

.query-card {
    overflow: hidden;
    padding: 18px 16px;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(26, 32, 38, 0.055);
}

.query-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
}

.query-head a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #f2f3f4;
}

.query-head h1 {
    margin: 0;
    font-size: 18px;
    font-weight: 800;
}

.query-tip {
    margin: 0 0 16px;
    color: #878b90;
    font-size: 12px;
    line-height: 1.6;
}

.query-field {
    margin-bottom: 10px;
}

.query-field input {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid #bdbdbd;
    border-radius: 3px;
    outline: none;
    background: #fff;
    font-size: 14px;
}

.query-field input:focus {
    border-color: var(--ink);
}

.query-submit {
    width: 100%;
    min-height: 48px;
    margin-top: 6px;
    border: 0;
    border-radius: 10px;
    background: var(--ink);
    color: #fff;
    font-size: 15px;
    font-weight: 800;
}

.query-result {
    margin-top: 16px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fafafa;
    color: #555;
    font-size: 13px;
    line-height: 1.7;
    overflow-wrap: anywhere;
}

.query-result strong {
    color: var(--ink);
}

.return-shell {
    width: 100%;
    max-width: 720px;
    min-height: 100vh;
    margin: 0 auto;
    padding: 22px 12px 60px;
    background: var(--page);
}

.return-hero,
.return-card {
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(26, 32, 38, 0.055);
}

.return-hero {
    padding: 26px 18px 22px;
    text-align: center;
}

.return-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    margin-bottom: 14px;
    border-radius: 50%;
    background: var(--success-bg);
    color: var(--success);
}

.return-check svg {
    width: 30px;
    height: 30px;
}

.return-hero h1 {
    margin: 0;
    font-size: 21px;
    font-weight: 800;
}

.return-hero p {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.65;
}

.return-actions {
    display: flex;
    gap: 8px;
    margin-top: 18px;
}

.return-actions a {
    display: inline-flex;
    min-height: 42px;
    flex: 1;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 800;
}

.return-actions .primary {
    background: var(--ink);
    color: #fff;
}

.return-actions .secondary {
    border: 1px solid var(--ink);
    background: #fff;
    color: var(--ink);
}

.return-card {
    margin-top: 12px;
    padding: 16px;
}

.return-card h2 {
    margin: 0 0 10px;
    color: var(--ink);
    font-size: 15px;
}

.return-card p {
    margin: 0;
    color: #666;
    font-size: 13px;
    line-height: 1.7;
    overflow-wrap: anywhere;
}

@media (max-width: 520px) {
    .shop-header {
        min-height: 76px;
        padding: 13px 14px;
    }

    .shop-logo {
        flex-basis: 46px;
        width: 46px;
        height: 46px;
        border-radius: 10px;
    }

    .shop-logo-fallback {
        font-size: 24px;
    }

    .shop-title {
        margin-left: 10px;
    }

    .shop-title strong {
        font-size: 17px;
    }

    .header-actions {
        gap: 6px;
        margin-left: 8px;
    }

    .header-btn {
        min-height: 36px;
        padding: 0 10px;
        border-radius: 8px;
        font-size: 12px;
    }

    .shop-notice {
        margin: 12px 12px 0;
        padding: 13px 14px;
        font-size: 12px;
    }

    .shop-section {
        padding: 22px 12px 0;
    }

    .shop-section + .shop-section {
        padding-top: 28px;
    }

    .section-title {
        margin-bottom: 13px;
        font-size: 18px;
    }

    .product-card {
        min-height: 98px;
        gap: 13px;
        padding: 11px 12px;
    }

    .product-image {
        flex-basis: 66px;
        width: 66px;
        height: 66px;
    }

    .product-main {
        padding-right: 64px;
    }

    .product-name {
        margin-bottom: 8px;
        font-size: 14px;
    }

    .product-meta {
        gap: 8px;
    }

    .product-price {
        font-size: 17px;
    }

    .product-sold {
        font-size: 11px;
    }

    .stock-tag {
        position: absolute;
        right: 12px;
        bottom: 12px;
        margin: 0;
        padding: 4px 8px;
        font-size: 10px;
    }

    .detail-block {
        padding: 15px 14px;
    }

    .shop-footer {
        padding: 12px 12px 30px;
    }

    .btn-buy-inner {
        gap: 12px;
    }

    .btn_buy {
        padding-right: 12px;
        padding-left: 12px;
    }

    .to_pay {
        flex-basis: 54%;
    }

    .checkout-panel {
        padding-right: 16px;
        padding-left: 16px;
    }
}

@media (max-width: 380px) {
    .shop-header {
        padding-right: 9px;
        padding-left: 9px;
    }

    .shop-logo {
        flex-basis: 40px;
        width: 40px;
        height: 40px;
    }

    .shop-title strong {
        font-size: 14px;
    }

    .header-actions {
        gap: 5px;
        margin-left: 5px;
    }

    .header-btn {
        min-height: 34px;
        padding: 0 6px;
        font-size: 10px;
    }

    .product-image {
        flex-basis: 58px;
        width: 58px;
        height: 58px;
    }

    .product-main {
        padding-right: 58px;
    }

    .product-name {
        font-size: 13px;
    }

    .product-price {
        font-size: 16px;
    }

    .product-sold {
        font-size: 10px;
    }

    .stock-tag {
        right: 9px;
        bottom: 9px;
        padding: 3px 6px;
        font-size: 9px;
    }

    .selected-tag {
        top: 7px;
        right: 7px;
        padding: 3px 5px;
        font-size: 9px;
    }

    .btn-buy-inner {
        gap: 10px;
    }

    .pay-total small {
        font-size: 11px;
    }

    .pay-total strong {
        font-size: 22px;
    }

    .to_pay {
        flex-basis: 60%;
        font-size: 15px;
    }
}

@media (max-width: 320px) {
    .shop-header {
        min-height: 70px;
        padding-right: 7px;
        padding-left: 7px;
    }

    .shop-logo {
        flex-basis: 36px;
        width: 36px;
        height: 36px;
    }

    .shop-title {
        margin-left: 7px;
    }

    .shop-title strong {
        max-width: 70px;
        font-size: 13px;
    }

    .header-btn {
        min-height: 32px;
        padding: 0 5px;
        font-size: 9px;
    }

    .shop-section {
        padding-right: 8px;
        padding-left: 8px;
    }

    .product-card {
        min-height: 92px;
        padding: 9px;
    }

    .product-image {
        flex-basis: 54px;
        width: 54px;
        height: 54px;
    }

    .product-main {
        padding-right: 54px;
    }

    .btn_buy {
        padding-right: 8px;
        padding-left: 8px;
    }

    .btn-buy-inner {
        gap: 8px;
    }

    .pay-total strong {
        font-size: 21px;
    }
}

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