:root {
    --bg: #f5f7fb;
    --panel: #ffffff;
    --line: #e8edf5;
    --text: #1d2736;
    --muted: #7d8ba1;
    --blue: #4da2ff;
    --blue-deep: #2f88ff;
    --green: #23c483;
    --shadow: 0 10px 30px rgba(32, 60, 92, 0.08);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    color: var(--text);
    background: var(--bg);
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    display: block;
    max-width: 100%;
}

button,
input {
    font: inherit;
}

.frontend-body {
    min-height: 100vh;
}

.store-shell {
    max-width: 1240px;
    margin: 0 auto;
    padding: 18px;
}

.store-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 14px 18px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
}

.store-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.store-logo-mark {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: linear-gradient(135deg, #111827, #344155);
    color: #fff;
    font-size: 1.35rem;
}

.store-logo-text strong {
    display: block;
    font-size: 1.1rem;
}

.store-logo-text small {
    color: var(--muted);
    font-size: 0.88rem;
}

.store-nav {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
}

.store-nav a {
    color: var(--muted);
    font-size: 0.95rem;
}

.store-nav a.active,
.store-nav a:hover {
    color: var(--text);
}

.store-main {
    display: grid;
    gap: 16px;
    margin-top: 16px;
}

.surface-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
    padding: 18px;
}

.panel-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}

.panel-title-row h2 {
    margin: 0;
    font-size: 1rem;
}

.goods-head {
    align-items: center;
}

.category-tabs {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.category-chip {
    min-width: 112px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #f7f9fc;
    cursor: pointer;
    text-align: left;
}

.category-chip span,
.category-chip small {
    display: block;
}

.category-chip span {
    font-size: 0.95rem;
    color: var(--text);
}

.category-chip small {
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.8rem;
}

.category-chip.active {
    background: linear-gradient(135deg, #57b3ff, #6bc6ff);
    border-color: transparent;
}

.category-chip.active span,
.category-chip.active small {
    color: #fff;
}

.search-box {
    position: relative;
    width: min(100%, 280px);
}

.search-box input {
    width: 100%;
    height: 40px;
    padding: 0 14px 0 38px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #f8fafc;
    outline: none;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
}

.goods-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.goods-card {
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
    overflow: hidden;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.goods-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 32px rgba(50, 89, 133, 0.12);
}

.goods-link {
    display: grid;
    grid-template-columns: 92px 1fr;
    gap: 12px;
    padding: 12px;
}

.goods-thumb {
    width: 92px;
    height: 92px;
    border-radius: 12px;
    overflow: hidden;
    background: linear-gradient(135deg, #ffe07a, #ffb41f);
}

.goods-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.goods-thumb-fallback,
.detail-image-fallback {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #4da2ff, #7fc7ff);
}

.goods-info {
    min-width: 0;
}

.goods-info h3 {
    margin: 0 0 6px;
    font-size: 0.94rem;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}

.goods-category {
    margin: 0 0 10px;
    color: var(--muted);
    font-size: 0.82rem;
}

.goods-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.goods-meta strong {
    color: var(--blue-deep);
    font-size: 1rem;
}

.goods-meta span {
    color: var(--green);
    font-size: 0.82rem;
}

.goods-buy {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 90px;
    height: 34px;
    padding: 0 14px;
    border-radius: 999px;
    background: #edf7ff;
    color: var(--blue-deep);
    font-size: 0.86rem;
}

.query-inline-form {
    display: flex;
    gap: 12px;
}

.query-inline-form input,
.buy-form-clean input {
    width: 100%;
    height: 42px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    outline: none;
}

.primary-action {
    height: 42px;
    padding: 0 20px;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, #58b4ff, #4b98ff);
    color: #fff;
    cursor: pointer;
}

.primary-action.wide {
    width: 180px;
}

.secondary-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 42px;
    padding: 0 20px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--text);
}

.detail-surface {
    padding: 22px;
}

.detail-layout-clean {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.detail-image-box {
    width: 100%;
    aspect-ratio: 1 / 1;
    border: 1px solid var(--line);
    border-radius: 18px;
    overflow: hidden;
    background: #f5f8fd;
}

.detail-image-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.detail-content-box h1 {
    margin: 8px 0 10px;
    font-size: 1.35rem;
    line-height: 1.5;
}

.detail-header-line {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.detail-badge {
    display: inline-flex;
    align-items: center;
    height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    background: #edf7ff;
    color: var(--blue-deep);
    font-size: 0.8rem;
}

.detail-stock {
    color: var(--green);
    font-size: 0.84rem;
}

.detail-amount {
    margin-bottom: 18px;
    color: #ff5b57;
    font-size: 1.85rem;
    font-weight: 700;
}

.buy-form-clean {
    display: grid;
    gap: 14px;
    max-width: 460px;
}

.buy-form-clean label span {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

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

.pay-line-option {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    height: 42px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    cursor: pointer;
}

.pay-line-option input {
    display: none;
}

.pay-line-option.active,
.pay-line-option:has(input:checked) {
    border-color: #8fcbff;
    background: #edf7ff;
}

.pay-icon {
    width: 22px;
    height: 22px;
    display: inline-grid;
    place-items: center;
    border-radius: 999px;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
}

.pay-icon.alipay {
    background: #1677ff;
}

.pay-icon.wechat {
    background: #07c160;
}

.order-result-box {
    display: grid;
    gap: 12px;
    max-width: 460px;
}

.detail-description-panel {
    padding: 20px 22px;
}

.pay-surface {
    padding: 22px;
}

.pay-layout {
    display: grid;
    grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.pay-product-box,
.pay-info-box {
    display: grid;
    gap: 14px;
}

.pay-image-box {
    max-width: 340px;
}

.pay-product-meta h1 {
    margin: 0;
    font-size: 1.55rem;
}

.pay-method-preview {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.pay-channel-chip {
    min-width: 100px;
    height: 40px;
    padding: 0 16px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #f8fbff;
    color: var(--muted);
}

.pay-channel-chip.active {
    border-color: #8fcbff;
    background: #edf7ff;
    color: var(--blue-deep);
}

.pay-action-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.pay-action-button {
    min-width: 150px;
}

.product-description-view {
    color: var(--text);
    line-height: 1.8;
    font-size: 0.95rem;
}

.product-description-view > *:first-child {
    margin-top: 0;
}

.product-description-view img,
.product-description-view video {
    display: block;
    max-width: min(100%, 520px);
    max-height: 520px;
    width: auto;
    height: auto;
    margin: 14px 0;
    border-radius: 12px;
}

.product-description-view video {
    background: #000;
}

.order-result-row,
.delivery-code {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fbfcfe;
}

.order-result-row span,
.delivery-code span {
    color: var(--muted);
}

.delivery-code code {
    font-family: Consolas, monospace;
    word-break: break-all;
}

.store-alert {
    padding: 12px 14px;
    border-radius: 14px;
    font-size: 0.92rem;
}

.store-alert-success {
    background: #ecfff7;
    border: 1px solid #c6f4e0;
    color: #157a4d;
}

.store-alert-error {
    background: #fff2f1;
    border: 1px solid #ffd4d0;
    color: #bd3b33;
}

@media (max-width: 980px) {
    .goods-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .detail-layout-clean {
        grid-template-columns: 1fr;
    }

    .pay-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .store-shell {
        padding: 12px;
    }

    .store-header,
    .store-nav,
    .panel-title-row,
    .query-inline-form {
        flex-direction: column;
        align-items: flex-start;
    }

    .store-nav,
    .query-inline-form,
    .search-box,
    .secondary-action,
    .primary-action,
    .primary-action.wide {
        width: 100%;
    }

    .goods-grid {
        grid-template-columns: 1fr;
    }

    .goods-link {
        grid-template-columns: 78px 1fr;
        gap: 10px;
    }

    .goods-thumb {
        width: 78px;
        height: 78px;
    }

    .surface-panel,
    .detail-surface {
        padding: 14px;
    }

    .store-header {
        padding: 12px 14px;
    }

    .intro-stats {
        width: 100%;
    }
}
