:root {
    --detail-red: var(--color-accent);
    --detail-text: var(--color-text-primary);
    --detail-muted: var(--color-text-muted);
    --detail-border: var(--color-border);
    --detail-footer-h: 54px;
    --toast-bottom: calc(var(--detail-footer-h) + 16px);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--color-bg-body);
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
    color: var(--detail-text);
    -webkit-font-smoothing: antialiased;
}

.detail-page {
    max-width: 430px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--color-bg-card);
    padding-bottom: calc(var(--detail-footer-h) + env(safe-area-inset-bottom, 0px) + 12px);
}

/* 轮播图 */
.detail-gallery {
    position: relative;
    background: var(--color-bg-muted);
}

.detail-nav {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 300;
    width: 100%;
    max-width: 430px;
    display: grid;
    grid-template-columns: 44px 1fr 44px;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    padding-top: calc(10px + env(safe-area-inset-top, 0px));
    background: transparent;
    transition: background .25s, box-shadow .25s;
}

.detail-nav-title {
    margin: 0;
    min-width: 0;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
    text-align: center;
    color: var(--detail-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s, visibility .25s;
    pointer-events: none;
}

.detail-nav.is-solid .detail-nav-title {
    opacity: 1;
    visibility: visible;
}

.detail-nav.is-solid {
    background: var(--color-bg-page);
    box-shadow: 0 1px 0 rgba(0, 0, 0, .06);
}

.detail-nav-btn {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    color: var(--color-text-primary);
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: background .25s, box-shadow .25s;
}

.detail-nav.is-solid .detail-nav-btn {
    background: var(--color-bg-card);
    box-shadow: 0 1px 4px rgba(0, 0, 0, .08);
}

.detail-nav-btn:active {
    background: rgba(255, 255, 255, 0.78);
}

.detail-nav.is-solid .detail-nav-btn:active {
    background: var(--color-bg-muted);
}

.detail-swiper {
    width: 100%;
    aspect-ratio: 1 / 1;
}

.detail-swiper .swiper-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    cursor: zoom-in;
}

.detail-swiper .swiper-pagination-bullet {
    width: 6px;
    height: 6px;
    background: rgba(255, 255, 255, .6);
    opacity: 1;
}

.detail-swiper .swiper-pagination-bullet-active {
    background: #e8a849;
    width: 14px;
    border-radius: 3px;
}

/* 价格标题 */
.detail-price-block {
    padding: 14px 16px 12px;
    border-bottom: 8px solid var(--color-bg-page);
}

.detail-views {
    margin-bottom: 10px;
    font-size: 16px;
    font-weight: 600;
    color: var(--detail-muted);
    line-height: 1.2;
}

.detail-price {
    display: flex;
    align-items: baseline;
    gap: 2px;
    margin-bottom: 10px;
}

.detail-price-label {
    font-size: 14px;
    color: var(--detail-red);
    margin-right: 4px;
}

.detail-price-empty {
    font-size: 18px;
    font-weight: 600;
    color: var(--detail-muted);
}

.detail-price-symbol {
    font-size: 16px;
    font-weight: 700;
    color: var(--detail-red);
}

.detail-price strong {
    font-size: 28px;
    font-weight: 700;
    color: var(--detail-red);
    line-height: 1;
}

.detail-title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.5;
    color: var(--detail-text);
}

/* 证书图册 */
.detail-cert-row {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 8px solid var(--color-bg-page);
    gap: 8px;
}

.detail-cert-scroll {
    flex: 1;
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scrollbar-width: none;
}

.detail-cert-scroll::-webkit-scrollbar {
    display: none;
}

.detail-cert-item {
    flex-shrink: 0;
    cursor: zoom-in;
}

.detail-cert-item img {
    width: 72px;
    height: 72px;
    border-radius: 8px;
    object-fit: cover;
    display: block;
    border: 2px solid #f0ebe4;
    pointer-events: none;
}

.detail-cert-more {
    flex-shrink: 0;
    font-size: 12px;
    color: var(--detail-muted);
    white-space: nowrap;
}

/* 藏品参数 */
.detail-params {
    border-bottom: 8px solid var(--color-bg-page);
    padding: 4px 16px;
}

.detail-param-row {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--detail-border);
}

.detail-param-row:last-child {
    border-bottom: none;
}

.detail-param-label {
    flex-shrink: 0;
    width: 40px;
    font-size: 14px;
    color: var(--detail-muted);
    line-height: 1.5;
}

.detail-param-value {
    flex: 1;
    min-width: 0;
    font-size: 14px;
    color: var(--detail-text);
    line-height: 1.5;
    word-break: break-all;
}

/* 评价 */
.detail-reviews {
    padding: 16px;
    border-bottom: 8px solid var(--color-bg-page);
}

.detail-reviews-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.detail-reviews-title {
    font-size: 15px;
    font-weight: 700;
}

.detail-reviews-rate {
    font-size: 13px;
    color: var(--detail-muted);
    text-decoration: none;
}

.detail-review-item {
    padding: 14px;
    margin-bottom: 10px;
    background: #fafafa;
    border-radius: 8px;
}

.detail-review-item:last-child {
    margin-bottom: 0;
}

.detail-review-user {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.detail-review-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #ddd;
}

.detail-review-user > span {
    font-size: 13px;
    color: var(--detail-muted);
}

.detail-review-stars {
    margin-left: auto;
    display: flex;
    gap: 1px;
}

.detail-review-stars i {
    font-style: normal;
    font-size: 12px;
}

.detail-review-stars i.on {
    color: #e8a849;
}

.detail-review-stars i.off {
    color: #ddd;
}

.detail-review-text {
    margin: 0 0 10px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--detail-text);
}

.detail-review-imgs {
    display: flex;
    gap: 6px;
}

.detail-review-img {
    position: relative;
    width: 64px;
    height: 64px;
    border-radius: 6px;
    overflow: hidden;
}

.detail-review-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.detail-review-img.more em {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .45);
    color: #fff;
    font-style: normal;
    font-size: 16px;
}

/* 产品介绍 */
.detail-desc {
    padding: 16px;
}

.detail-desc-title {
    text-align: center;
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 14px;
    color: var(--detail-text);
}

.detail-desc-body {
    font-size: 14px;
    line-height: 1.7;
    color: var(--color-text-secondary);
}

.detail-desc-body img {
    max-width: 100%;
    height: auto;
    cursor: zoom-in;
}

.detail-desc-empty {
    text-align: center;
    color: var(--detail-muted);
    padding: 20px 0;
}

/* 回到顶部 */
.detail-back-top {
    position: fixed;
    z-index: 99;
    right: calc(50vw - min(215px, 50vw) + 12px);
    bottom: calc(var(--detail-footer-h) + env(safe-area-inset-bottom, 0px) + 12px);
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, .96);
    color: var(--detail-text);
    box-shadow: 0 2px 10px rgba(0, 0, 0, .12);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s, visibility .2s;
    -webkit-tap-highlight-color: transparent;
}

.detail-back-top.show {
    opacity: 1;
    visibility: visible;
}

.detail-back-top:active {
    transform: scale(.94);
}

/* 底部栏 */
.detail-footer {
    position: fixed;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    z-index: 100;
    width: 100%;
    max-width: 430px;
    display: flex;
    align-items: center;
    height: calc(var(--detail-footer-h) + env(safe-area-inset-bottom, 0px));
    padding: 0 12px env(safe-area-inset-bottom, 0px);
    background: var(--color-bg-card);
    border-top: 1px solid var(--detail-border);
    box-shadow: 0 -2px 8px rgba(0, 0, 0, .04);
    gap: 8px;
}

.detail-footer-icon {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    width: 44px;
    text-decoration: none;
    color: var(--detail-text);
    font-size: 10px;
}

.detail-footer-icon.active {
    color: var(--color-accent);
}

.detail-footer-icon.active svg {
    fill: var(--color-accent);
    stroke: var(--color-accent);
}

.detail-btn {
    flex: 1;
    height: 40px;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.detail-btn-cart {
    background: var(--color-accent-light);
    color: var(--color-brown-mid);
}

.detail-btn-buy {
    background: var(--detail-red);
    color: #fff;
}

.detail-btn:active {
    opacity: .85;
}

/* 图片预览 */
body.mall-image-viewer-open {
    overflow: hidden;
}

.mall-image-viewer {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}

.mall-image-viewer.show {
    display: flex;
}

.mall-image-viewer-mask {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .92);
}

.mall-image-viewer-stage {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 16px 64px;
}

.mall-image-viewer-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
}

.mall-image-viewer-close {
    position: absolute;
    top: calc(12px + env(safe-area-inset-top, 0px));
    right: 12px;
    z-index: 2;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, .16);
    color: #fff;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.mall-image-viewer-nav {
    position: absolute;
    top: 50%;
    z-index: 2;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, .16);
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.mall-image-viewer-prev {
    left: 12px;
}

.mall-image-viewer-next {
    right: 12px;
}

.mall-image-viewer-counter {
    position: absolute;
    bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    z-index: 2;
    transform: translateX(-50%);
    padding: 4px 12px;
    border-radius: 12px;
    background: rgba(0, 0, 0, .45);
    color: #fff;
    font-size: 13px;
}
