/* ==========================================================================
   Single Product Page Styles
   顏色一律取自 assets/css/color-tokens.css，本檔不定義任何顏色
   ========================================================================== */

.sp-page-wrap {
    background-color: var(--color-bg-grey);
    width: 100%;
    padding-bottom: 80px;
}

.sp-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 40px;
    position: relative;
}

/* Breadcrumb Bar */
.sp-breadcrumb-bar {
    /* 同商品列表的 .pl-breadcrumb-bar：上紫下黃的品牌漸層。
       兩頁的麵包屑是同一個元件，配色不該分開。 */
    background: linear-gradient(
        180deg,
        var(--color-gradient-from) 0%,
        var(--color-gradient-to) 100%
    );
    width: 100%;
    margin-top: var(--header-height);
    border-bottom: 1px solid var(--color-border-light);
}

.sp-breadcrumb-bar .sp-container {
    padding-top: 14px;
    padding-bottom: 14px;
}

.sp-breadcrumbs {
    font-size: 13px;
    color: var(--color-text-light);
    line-height: 1.4;
}

.sp-breadcrumbs a {
    color: var(--color-text-light);
    text-decoration: none;
}

.sp-breadcrumbs a:hover {
    color: var(--color-secondary);
}

.sp-breadcrumb-sep {
    margin: 0 8px;
    color: var(--color-grey);
}

.sp-breadcrumbs .current {
    color: var(--color-text-muted);
}

/* ==========================================================================
   Top Section: Main Info
   ========================================================================== */
.sp-main-info {
    display: flex;
    gap: 48px;
    padding: 40px 0 60px;
    align-items: flex-start;
}

/* Left: Gallery */
.sp-gallery {
    width: 52%;
    max-width: 560px;
    flex-shrink: 0;
}

.sp-main-img-wrap {
    width: 100%;
    aspect-ratio: 1 / 1;
    background-color: var(--color-border-light);
    margin-bottom: 12px;
    overflow: hidden;
}

.sp-main-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sp-thumbnails {
    display: flex;
    gap: 12px;
}

.sp-thumb {
    /* 固定為四格寬（含 3 個 12px 間距），縮圖變少時維持原尺寸、靠左排列而不被拉伸 */
    flex: 0 0 calc((100% - 36px) / 4);
    max-width: calc((100% - 36px) / 4);
    aspect-ratio: 1 / 1;
    background-color: var(--color-border-light);
    cursor: pointer;
    border: 1px solid var(--color-border-light);
    overflow: hidden;
    transition: border-color 0.2s ease;
}

.sp-thumb:hover,
.sp-thumb.active {
    border-color: var(--color-secondary);
}

.sp-thumb--empty {
    cursor: default;
    pointer-events: none;
}

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

.sp-gallery-lightbox-open {
    overflow: hidden;
}

.sp-gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    background: rgba(0, 0, 0, 0.78);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.sp-gallery-lightbox.is-active {
    opacity: 1;
    pointer-events: auto;
}

.sp-gallery-lightbox-img {
    display: block;
    width: auto;
    height: auto;
    max-width: min(92vw, 960px);
    max-height: 86vh;
    object-fit: contain;
    background: var(--color-white);
}

.sp-gallery-lightbox-close {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.75);
    border-radius: 0;
    background: rgba(0, 0, 0, 0.35);
    color: var(--color-white);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

/* Right: Details */
.sp-details {
    flex: 1;
    min-width: 0;
    padding-top: 4px;
}

.sp-tagline {
    font-size: 13px;
    color: var(--color-primary);
    margin: 0 0 10px;
    line-height: 1.5;
}

.sp-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-secondary);
    margin: 0 0 12px;
    line-height: 1.3;
}

.sp-rating-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 18px;
}

.sp-stars {
    color: var(--color-primary);
    font-size: 15px;
    letter-spacing: 1px;
    line-height: 1;
}

.sp-reviews-count {
    color: var(--color-text-light);
    font-size: 13px;
}

.sp-price-wrap {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 10px 12px;
    margin-bottom: 28px;
}

.sp-current-price {
    font-size: 30px;
    font-weight: 700;
    color: var(--color-secondary);
    line-height: 1;
}

.sp-price-wrap.is-on-sale .sp-current-price,
.sp-product-price ins,
.sp-product-price ins .amount,
.sp-product-price ins bdi,
.sp-rv-price ins,
.sp-rv-price ins .amount,
.sp-rv-price ins bdi {
    color: var(--color-danger);
    text-decoration: none;
}

.sp-old-price {
    font-size: 14px;
    color: var(--color-text-light);
    text-decoration: line-through;
}

.sp-discount-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: var(--color-danger);
    color: var(--color-white);
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    line-height: 1;
}

/* 可變商品：頂部價格區間內的金額沿用大字樣式 */
.sp-price-variable .woocommerce-Price-amount,
.sp-price-variable bdi {
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
}

/* 隱藏 WooCommerce 變體自帶的價格，避免與頂部價格區間重複顯示 */
.sp-wc-add-to-cart-wrapper .woocommerce-variation-price {
    display: none;
}

/* Purchase Panel */
.sp-purchase-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 24px;
}

.sp-flavor-group,
.sp-wc-variation-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sp-flavor-label {
    font-size: 14px;
    font-weight: 700;
    color: var(--color-secondary);
}

.sp-flavor-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.sp-flavor-btn {
    min-width: 72px;
    height: 38px;
    padding: 0 16px;
    border: 1px solid var(--color-border-light);
    background: var(--color-white);
    font-family: inherit;
    font-size: 13px;
    color: var(--color-text-strong);
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

/* hover：文字與外框轉淡紫，底維持透明（設計稿指定） */
.sp-flavor-btn:hover {
    background-color: transparent;
    border-color: var(--color-accent);
    color: var(--color-accent);
}

/* 鍵盤操作要有同樣的辨識度 */
.sp-flavor-btn:focus-visible {
    outline: none;
    background-color: transparent;
    border-color: var(--color-accent);
    color: var(--color-accent);
}

/* 選取中：維持深底白字，與 hover 的淡紫區分得開 */
.sp-flavor-btn.active {
    background-color: var(--color-secondary);
    color: var(--color-white);
    border-color: var(--color-secondary);
}

/* 已選取的那顆 hover 時不要跟著變淡紫，否則看不出目前選的是哪一個 */
.sp-flavor-btn.active:hover {
    background-color: var(--color-secondary);
    color: var(--color-white);
    border-color: var(--color-secondary);
}

/* Info List */
.sp-info-list {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 12px;
    color: var(--color-text-light);
    line-height: 1.8;
}

.sp-info-list li {
    margin-bottom: 6px;
}

/* Desktop: only cart-row wishlist/share; hide duplicate mobile actions block */
.sp-mobile-actions {
    display: none;
}

.sp-mobile-info-row {
    display: block;
}

/* Actions (wishlist / share – cart row built via JS) */
.sp-actions-wrap {
    display: none;
}

.sp-cart-actions-row {
    display: flex;
    align-items: stretch;
    gap: 12px;
    width: 100%;
}

.sp-wishlist-btn,
.sp-share-btn {
    /* 兩顆是一組的，尺寸與外框要一致。
       原本收藏是 48x48 加左右 19px 內距（其實是長方形）、
       分享是 56x56 而且完全沒有外框，兩顆長得不一樣。 */
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-white);
    border: 1px solid var(--color-secondary);
    cursor: pointer;
    padding: 0;
    border-radius: 0;
    transition: background-color 0.2s ease;
    box-sizing: border-box;
}

.sp-wishlist-btn {
    color: var(--color-primary);
}

.sp-wishlist-btn img {
    display: none;
}

.sp-wishlist-btn::before {
    content: "";
    width: 18px;
    height: 16px;
    display: block;
    background: var(--color-primary, var(--color-primary));
    -webkit-mask: url("../images/heart-icon.svg") center / contain no-repeat;
    mask: url("../images/heart-icon.svg") center / contain no-repeat;
}

.sp-wishlist-btn:hover {
    background-color: color-mix(in srgb, var(--color-primary) 8%, transparent);
}

/* 已收藏狀態：橘底白愛心 */
.sp-wishlist-btn.active,
.sp-mobile-actions .sp-wishlist-btn.active {
    background-color: var(--color-primary, var(--color-primary));
    border-color: var(--color-primary, var(--color-primary));
}
.sp-wishlist-btn.active::before,
.sp-mobile-actions .sp-wishlist-btn.active::before {
    background: var(--color-white);
}

/* 分享圖示改用 mask 上色，跟收藏的愛心同一套作法。
   原本是直接放 <img>，而 SVG 內部寫死 #8F8F8F 灰 ——
   <img> 讀不到頁面的 CSS，那個灰色從自訂器完全改不動。
   遮罩的圖檔路徑由模板以 --sp-share-icon 傳進來，
   所以後台上傳自訂圖示一樣有效。 */
.sp-share-btn img {
    display: none;
}

.sp-share-btn::before {
    content: "";
    width: 15px;
    height: 15px;
    display: block;
    background: var(--color-secondary);
    -webkit-mask: var(--sp-share-icon) center / contain no-repeat;
    mask: var(--sp-share-icon) center / contain no-repeat;
}

.sp-share-btn:hover {
    background-color: color-mix(in srgb, var(--color-secondary) 8%, transparent);
}

.sp-share-symbol {
    color: var(--color-text-light);
    text-align: center;
    font-family: "Noto Sans TC", sans-serif;
    font-size: 16px;
    font-style: normal;
    font-weight: 400;
    line-height: normal;
    display: block;
}



/* Desktop cart row: wishlist/share match add-to-cart height */
@media (min-width: 769px) {
    .sp-cart-actions-row {
        align-items: stretch;
    }

    .sp-cart-actions-row .single_add_to_cart_button {
        height: 48px;
        min-height: 48px;
    }

    .sp-cart-actions-row .sp-wishlist-btn,
    .sp-cart-actions-row .sp-share-btn {
        width: 48px;
        height: auto;
        min-width: 48px;
        min-height: 48px;
        max-width: 48px;
        padding: 0;
        flex: 0 0 48px;
        align-self: stretch;
        box-sizing: border-box;
    }

    /* 這一列的兩顆會被拉高到跟「加入購物車」同高，
       圖示本身維持原尺寸置中，不要跟著撐大 */
    .sp-cart-actions-row .sp-share-btn::before {
        width: 15px;
        height: 15px;
    }
}

/* Trust Badges (四大保證) */
.sp-trust-badges {
    width: 100%;
    background: color-mix(in srgb, var(--color-soft) 40%, transparent);
    padding: 28px 0;
    margin-bottom: 48px;
}

.sp-trust-badges-inner {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
}

.sp-trust-item {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
    min-width: 0;
}

.sp-trust-icon {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 50%;
    border: 1px solid var(--color-accent);
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    /* 圖示跟外圈同色。原本圈是紫的、裡面的圖示卻是深色，
       設計稿上兩者是一體的。 */
    color: var(--color-accent);
}

.sp-trust-icon img {
    width: 22px;
    height: 22px;
    object-fit: contain;
}

.sp-trust-icon svg {
    width: 20px;
    height: 20px;
}

/* 內建圖示一律用 currentColor，交給上面的 color 決定。
   只挑本來就有 stroke 的元素 —— 「正品保證」那顆是實心 fill 圖示，
   對它套 stroke 會憑空多一圈 1px 外框，把裡面的勾描粗。 */
.sp-trust-icon svg [stroke]:not([stroke='none']) {
    stroke: currentColor;
}

.sp-trust-text h4 {
    font-size: 14px;
    font-weight: 700;
    color: var(--color-text);
    margin: 0 0 4px;
    line-height: 1.3;
}

.sp-trust-text p {
    font-size: 12px;
    color: var(--color-text-light);
    margin: 0;
    line-height: 1.4;
    white-space: nowrap;
}

/* ==========================================================================
   Tabs Section
   ========================================================================== */
.sp-tabs-section {
    margin-bottom: 80px;
}

.sp-tabs-nav {
    display: flex;
    justify-content: flex-start;
    align-items: stretch;
    gap: 0;
    margin-bottom: 28px;
    border-bottom: none;
}

.sp-tab-item {
    appearance: none;
    -webkit-appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 28px;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.4;
    /* 未選取：白底黑字，跟外框同色。
       選取後才變成黑底粉字（見下面的 .active）。 */
    color: var(--color-secondary);
    background: var(--color-white);
    border: 1px solid var(--color-secondary);
    cursor: pointer;
    margin: 0;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.sp-tab-item + .sp-tab-item {
    margin-left: -1px;
}

.sp-tab-item:hover:not(.active) {
    background: var(--color-bg-grey);
}

.sp-tab-item.active {
    background: var(--color-secondary);
    color: var(--color-pink);
    border-color: var(--color-secondary);
    font-weight: 400;
}

.sp-tab-panels {
    text-align: left;
}

.sp-tab-panel[hidden] {
    display: none !important;
}

.sp-tab-content {
    max-width: none;
    margin: 0;
    font-size: 14px;
    line-height: 1.8;
    color: var(--color-text-muted);
}

.sp-tab-content p {
    margin: 0 0 12px;
}

.sp-tab-content .sp-desc-heading,
.sp-tab-content h3.sp-desc-heading {
    font-size: 15px;
    font-weight: 700;
    color: var(--color-primary);
    margin: 28px 0 12px;
}

.sp-tab-content .sp-desc-heading:first-child,
.sp-tab-content h3.sp-desc-heading:first-child {
    margin-top: 0;
}

.sp-precautions-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sp-precautions-list li {
    position: relative;
    padding-left: 14px;
    margin-bottom: 8px;
}

.sp-precautions-list li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--color-text-muted);
}

/* ==========================================================================
   Reviews Section
   ========================================================================== */
/* --------------------------------------------------------------------------
   顧客評價：深色區塊

   左半邊（分數、長條、按鈕）原本是給淺粉底用的深色文字，
   換成深底之後全部要反白；右半邊的評價卡片維持白底深字不動。
   -------------------------------------------------------------------------- */
.sp-reviews-section {
    width: 100%;
    background-color: var(--color-secondary);
    /* 斜向的微亮光帶。用 color-mix 疊白，不寫死色碼。 */
    background-image:
        linear-gradient(
            115deg,
            transparent 26%,
            color-mix(in srgb, var(--color-white) 5%, transparent) 42%,
            transparent 56%
        ),
        linear-gradient(
            125deg,
            transparent 58%,
            color-mix(in srgb, var(--color-white) 3%, transparent) 72%,
            transparent 86%
        );
    padding: 60px 0 70px;
    margin-bottom: 80px;
}

/* 標題反白；底線維持品牌紫 */
.sp-reviews-section .sp-section-title--reviews {
    color: var(--color-white);
}

/* 大分數與 /5 —— 品牌粉 #FFD5D5 */
.sp-reviews-section .sp-rs-score,
.sp-reviews-section .sp-rs-total {
    color: var(--color-pink);
}

/* 「基於 128 則評價」 */
.sp-reviews-section .sp-rs-text {
    color: color-mix(in srgb, var(--color-white) 75%, transparent);
}

/* ★5 ★4 … 的級距標籤 —— 品牌粉 */
.sp-reviews-section .sp-rs-star {
    color: var(--color-pink);
}

/* 長條圖：外框與填色都改用白 */
.sp-reviews-section .sp-rs-bar-bg {
    border-color: color-mix(in srgb, var(--color-white) 55%, transparent);
}

.sp-reviews-section .sp-rs-bar-fill {
    background-color: var(--color-white);
}

/* 「查看全部評價」按鈕 */
.sp-reviews-section .sp-btn-outline {
    border-color: var(--color-white);
    color: var(--color-white);
}

.sp-reviews-section .sp-btn-outline:hover {
    background-color: var(--color-white);
    color: var(--color-secondary);
}

.sp-section-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-text);
    text-align: center;
    margin-bottom: 40px;
    position: relative;
}

.sp-section-title::after {
    content: '';
    display: block;
    width: 40px;
    height: 2px;
    background-color: var(--color-accent);
    margin: 15px auto 0;
}

.sp-section-title--reviews {
    text-align: center;
    margin-bottom: 36px;
    color: var(--color-text);
}

.sp-section-title--reviews::after {
    display: block;
    width: 112px;
    height: 3px;
    background-color: var(--color-primary);
    margin: 14px auto 0;
}

.sp-section-title--related {
    font-size: 20px;
    font-weight: 500;
    color: var(--color-text-strong);
    margin-bottom: 40px;
}

.sp-section-title--related::after {
    width: 200px;
    height: 3px;
    background-color: var(--color-primary);
    margin: 12px auto 0;
}

.sp-reviews-layout {
    display: flex;
    gap: 48px;
    align-items: flex-start;
    justify-content: flex-start;
}

.sp-reviews-summary {
    display: flex;
    align-items: center;
    gap: 40px;
    flex-shrink: 0;
    width: auto;
}

.sp-rs-overview {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex-shrink: 0;
    width: 168px;
}

.sp-rs-score-wrap {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 4px;
    margin-bottom: 10px;
}

.sp-rs-score {
    font-size: 56px;
    font-weight: 700;
    color: var(--color-primary);
    line-height: 1;
}

.sp-rs-total {
    font-size: 22px;
    font-weight: 400;
    color: var(--color-primary);
    line-height: 1;
}

.sp-rs-text {
    font-size: 14px;
    color: var(--color-text-light);
    margin: 0 0 20px;
    white-space: nowrap;
}

.sp-rs-bars {
    flex: 1;
    min-width: 220px;
    max-width: 280px;
    margin: 0;
}

.sp-rs-bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    font-size: 13px;
    color: var(--color-text-strong);
}

.sp-rs-bar-row:last-child {
    margin-bottom: 0;
}

.sp-rs-star {
    width: 26px;
    flex-shrink: 0;
    color: var(--color-primary);
    font-size: 13px;
    line-height: 1;
}

.sp-rs-bar-bg {
    flex-grow: 1;
    height: 8px;
    background-color: transparent;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    overflow: hidden;
}

.sp-rs-bar-fill {
    height: 100%;
    background-color: var(--color-text-strong);
    border-radius: 999px;
}

.sp-btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 168px;
    padding: 10px 16px;
    border: 1px solid var(--color-text);
    background: transparent;
    color: var(--color-text);
    font-family: inherit;
    font-size: 13px;
    font-weight: 400;
    line-height: normal;
    cursor: pointer;
    border-radius: 0;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.sp-btn-outline:hover {
    background-color: var(--color-text);
    color: var(--color-white);
}

.sp-reviews-list {
    flex: 1;
    max-width: 520px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sp-reviews-list--all {
    max-width: 520px;
    margin: 0 0 32px;
}

.sp-review-card {
    padding: 20px 22px;
    background: var(--color-white);
    border: none;
    border-radius: 6px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin: 0;
    font-family: "Noto Sans TC", sans-serif;
}

.sp-review-card-inner {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

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

.sp-review-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: var(--color-border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 400;
    color: var(--color-text-light);
    flex-shrink: 0;
    margin-top: 0;
}

.sp-review-name {
    font-weight: 700;
    font-size: 15px;
    color: var(--color-text-strong);
    margin-bottom: 6px;
    line-height: 1.4;
}

.sp-review-rating-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 0;
}

.sp-review-stars {
    font-size: 14px;
    letter-spacing: 1px;
    line-height: 1;
    flex-shrink: 0;
}

.sp-review-stars-filled {
    color: var(--color-primary);
}

.sp-review-stars-empty {
    color: var(--color-border);
}

.sp-review-date {
    font-size: 12px;
    color: var(--color-text-light);
    flex-shrink: 0;
    white-space: nowrap;
}

.sp-review-content {
    font-size: 14px;
    font-weight: 400;
    color: var(--color-text-strong);
    margin-top: 10px;
    margin-bottom: 8px;
    line-height: 1.6;
}

.sp-review-attrs {
    font-size: 13px;
    font-weight: 400;
    color: var(--color-primary);
    line-height: 1.5;
    margin-top: 0;
}

.sp-all-reviews-panel {
    padding-top: 36px;
}

.sp-all-reviews-panel[hidden] {
    display: none !important;
}

/* ==========================================================================
   Recommended Section
   ========================================================================== */
.sp-recommended {
    margin-bottom: 80px;
}

.sp-products-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
}

.sp-product-card {
    text-decoration: none;
    color: inherit;
}

.sp-product-img {
    width: 100%;
    aspect-ratio: 230 / 280;
    background-color: var(--color-bg-grey);
    margin-bottom: 15px;
    position: relative;
}

.sp-product-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sp-product-name {
    font-size: 13px;
    color: var(--color-text-strong);
    margin-bottom: 5px;
}

.sp-product-price {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-black);
}

/* ==========================================================================
   Recently Viewed
   ========================================================================== */
.sp-recently-viewed-wrap {
    /* 品牌粉 #FFD5D5 30% */
    background-color: color-mix(in srgb, var(--color-pink) 30%, transparent);
    padding: 40px 0;
}

.sp-recently-viewed {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.sp-rv-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-text-strong);
    margin-bottom: 0;
    width: 100%;
    max-width: 510px;
    text-align: left;
}

.sp-rv-list {
    display: flex;
    gap: 30px;
    justify-content: center;
    width: 100%;
    max-width: 510px;
}

.sp-rv-item {
    width: 150px;
    text-decoration: none;
    color: inherit;
}

.sp-rv-img {
    width: 150px;
    height: 180px;
    background-color: var(--color-white);
    margin-bottom: 10px;
}

.sp-rv-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sp-rv-name {
    font-size: 12px;
    color: var(--color-text-strong);
    margin-bottom: 5px;
}

.sp-rv-price {
    font-size: 12px;
    font-weight: 700;
    color: var(--color-black);
}

/* ==========================================================================
   Responsive Styles
   ========================================================================== */
@media (max-width: 991px) {
    .sp-main-info {
        flex-direction: column;
        gap: 30px;
    }
    .sp-gallery {
        width: 100%;
        max-width: 500px;
        margin: 0 auto;
    }
    .sp-main-img-wrap {
        width: 100%;
    }
    .sp-trust-badges-inner {
        flex-wrap: wrap;
        justify-content: flex-start;
        gap: 24px 32px;
    }

    .sp-trust-item {
        flex: 0 1 calc(50% - 16px);
    }

    .sp-trust-text p {
        white-space: normal;
    }
    .sp-reviews-layout {
        flex-direction: column;
        align-items: stretch;
        gap: 40px;
    }

    .sp-reviews-summary {
        flex-direction: column;
        align-items: center;
        gap: 28px;
        width: 100%;
    }

    .sp-rs-overview {
        width: 100%;
        max-width: 220px;
    }

    .sp-rs-bars {
        width: 100%;
        max-width: 320px;
        min-width: 0;
    }

    .sp-reviews-list,
    .sp-reviews-list--all {
        max-width: none;
        width: 100%;
    }
    .sp-products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    /* Mobile: main product block match screenshot */
    .sp-container {
        padding: 0 20px;
    }

    .sp-main-section {
        padding-top: 14px;
    }

    .sp-main-info {
        gap: 18px;
    }

    .sp-gallery {
        max-width: none;
        margin: 0;
    }

    .sp-main-img-wrap {
        border-radius: 0;
    }

    .sp-main-img {
        width: 100%;
        aspect-ratio: 1 / 1;
        object-fit: cover;
        display: block;
    }

    .sp-thumbnails {
        display: flex;
        justify-content: flex-start;
        gap: 10px;
        margin-top: 10px;
        width: auto;
    }

    .sp-thumb {
        flex: 0 0 auto;
        width: 48px;
        height: 48px;
        background-color: var(--color-bg-grey);
    }

    .sp-gallery-lightbox {
        padding: 18px;
    }

    .sp-gallery-lightbox-img {
        max-width: 94vw;
        max-height: 82vh;
    }

    .sp-gallery-lightbox-close {
        top: 12px;
        right: 12px;
        width: 36px;
        height: 36px;
        font-size: 22px;
    }

    .sp-details {
        padding-top: 0;
        width: 100%;
    }

    .sp-tagline {
        font-size: 13px;
        margin: 10px 0 6px;
        color: var(--color-primary);
    }

    .sp-title {
        font-size: 16px;
        line-height: 1.4;
        margin: 0 0 10px;
        color: var(--color-text);
        font-weight: 700;
    }

    .sp-rating-wrap {
        margin-bottom: 8px;
        gap: 10px;
    }

    .sp-stars {
        font-size: 14px;
        letter-spacing: 1px;
    }

    .sp-reviews-count {
        font-size: 13px;
        color: var(--color-text-light);
    }

    .sp-price-wrap {
        margin-bottom: 14px;
        gap: 8px;
    }

    .sp-current-price {
        font-size: 16px;
    }

    .sp-old-price {
        font-size: 12px;
    }

    .sp-discount-badge {
        font-size: 12px;
        padding: 4px 10px;
        border-radius: 0;
    }

    .sp-flavor-label {
        font-size: 14px;
        font-weight: 700;
        color: var(--color-text);
        margin-bottom: 10px;
    }

    .sp-flavor-options {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 10px;
    }

    .sp-flavor-btn {
        width: 100%;
        /* 桌機版的 min-width: 72px 要解掉。
           1fr 軌道的自動最小值是內容的 min-content，而 min-width 會把它撐住 ——
           四欄 × 72px + 三個 10px 間距 = 318px，在 320px 的螢幕上（內容區只有 280px）
           會把整頁撐出橫向捲軸。歸零之後四欄才會真的等分可用寬度。 */
        min-width: 0;
        height: 34px;
        font-size: 13px;
        padding: 0;
    }

    /* Quantity row: [-][ input ][+] — match mobile design spec */
    .sp-custom-qty {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 7px;
    }

    .sp-qty-label {
        margin: 0;
        text-align: left;
    }

    .sp-qty-controls {
        width: 100%;
        display: grid;
        grid-template-columns: 72fr 305fr 72fr;
        gap: 12px;
        align-items: stretch;
    }

    .sp-qty-minus,
    .sp-qty-plus {
        width: auto;
        min-width: 0;
        height: 41px;
        border: 1px solid var(--color-border);
        border-radius: 0;
        color: var(--color-text-strong);
        background: var(--color-white);
        font-size: 16px;
    }

    .sp-qty-val {
        width: auto;
        max-width: none;
        height: 41px;
        border: 1px solid var(--color-border);
        border-radius: 0;
        font-size: 14px;
        color: var(--color-text-strong);
        background: var(--color-white);
    }

    /* Add to cart button full width */
    .sp-wc-add-to-cart-wrapper .sp-cart-actions-row {
        flex-direction: column;
        gap: 12px;
    }

    .sp-wc-add-to-cart-wrapper .sp-cart-actions-row button.single_add_to_cart_button.button {
        width: 100% !important;
        height: 38px;
        font-size: 15px;
    }

    /* Hide desktop actions row; use mobile actions under info list */
    .sp-actions-wrap {
        display: none !important;
    }

    .sp-mobile-actions {
        margin-top: 0;
        display: flex;
        justify-content: flex-end;
        gap: 10px;
        width: auto;
    }

    .sp-mobile-actions .sp-wishlist-btn,
    .sp-mobile-actions .sp-share-btn {
        width: 36px;
        height: 36px;
        min-width: 36px;
        min-height: 36px;
        padding: 0;
    }

    .sp-mobile-actions .sp-wishlist-btn img {
        display: none;
    }

    /* 按鈕縮到 36px，圖示等比縮小；兩顆的圖示視覺大小要一致 */
    .sp-mobile-actions .sp-wishlist-btn::before {
        width: 16px;
        height: 14px;
    }

    .sp-mobile-actions .sp-share-btn::before {
        width: 15px;
        height: 15px;
    }

    .sp-mobile-actions .sp-share-symbol {
        font-size: 14px;
    }

    .sp-mobile-info-row {
        margin-top: 12px;
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 12px;
        width: 100%;
    }

    .sp-mobile-info-row .sp-info-list {
        margin: 0;
        flex: 1;
        min-width: 0;
    }

    .sp-recently-viewed {
        align-items: center;
        padding: 0 20px;
        gap: 24px;
    }

    .sp-rv-title {
        writing-mode: horizontal-tb;
        transform: none;
        text-align: center;
        margin-bottom: 0;
        max-width: 100%;
        width: 100%;
    }

    .sp-rv-list {
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        flex-wrap: nowrap;
        gap: 24px;
        max-width: 400px;
        width: 100%;
    }

    .sp-rv-item {
        display: grid;
        grid-template-columns: 90px 1fr;
        grid-template-rows: auto auto;
        column-gap: 16px;
        row-gap: 4px;
        align-items: center;
        width: 100%;
        max-width: 400px;
    }

    .sp-rv-img {
        grid-row: 1 / span 2;
        grid-column: 1;
        width: 90px;
        height: 90px;
        margin-bottom: 0;
        align-self: center;
    }

    .sp-rv-img img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .sp-rv-name {
        grid-column: 2;
        grid-row: 1;
        font-size: 14px;
        line-height: 1.4;
        color: var(--color-text-strong);
        margin-bottom: 0;
        align-self: end;
    }

    .sp-rv-price {
        grid-column: 2;
        grid-row: 2;
        font-size: 14px;
        font-weight: 700;
        color: var(--color-black);
        align-self: start;
    }

    .sp-rv-price .amount,
    .sp-rv-price bdi,
    .sp-rv-price ins {
        font-weight: 700;
        text-decoration: none;
    }

    .sp-rv-price ins,
    .sp-rv-price ins .amount,
    .sp-rv-price ins bdi {
        color: var(--color-danger);
    }
}

/* ==========================================================================
   WooCommerce Overrides
   ========================================================================== */
/* 加入購物車成功提示（PRG 重導回商品頁時顯示） */
.sp-added-notice {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 0 0 20px;
    padding: 12px 18px;
    background: var(--color-soft);
    border: 1px solid var(--color-border-light);
    border-left: 3px solid var(--color-success);
    border-radius: 4px;
    font-size: 14px;
    color: var(--color-success-dark);
    font-weight: 600;
}
.sp-added-notice a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 700;
}
.sp-added-notice a:hover {
    text-decoration: underline;
}

.sp-wc-add-to-cart-wrapper form.cart {
    display: flex !important;
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
    margin: 0;
    width: 100%;
}

.sp-wc-add-to-cart-wrapper .variations {
    margin: 0;
    width: 100%;
    border: none;
}

.sp-wc-add-to-cart-wrapper .variations tr {
    display: block;
}

.sp-wc-add-to-cart-wrapper .variations td {
    display: block;
    padding: 0;
}

.sp-wc-add-to-cart-wrapper .variations td.label {
    display: none;
}

.sp-wc-add-to-cart-wrapper .variations select {
    display: none;
}

.sp-wc-add-to-cart-wrapper .reset_variations {
    display: none !important;
}

.sp-wc-add-to-cart-wrapper .woocommerce-variation-add-to-cart,
.sp-wc-add-to-cart-wrapper .cart .quantity {
    width: 100%;
}

/* 可變商品：數量與按鈕在內層 .woocommerce-variation-add-to-cart，需自帶直向間距 */
.sp-wc-add-to-cart-wrapper .single_variation_wrap {
    width: 100%;
}
.sp-wc-add-to-cart-wrapper .woocommerce-variation-add-to-cart {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
}
/*
 * 選了尺寸之後，WooCommerce 會把 .single_variation 這塊 slideDown 展開，
 * 裡面放變體的說明、價格、庫存狀態。本主題價格顯示在標題下方（.sp-price-variable），
 * 這裡的價格已經 display:none，說明與庫存也都是空的 ——
 * 但這個容器本身的 margin 仍會在展開瞬間多出高度，
 * 把「數量 / 加入購物車」整塊往下推。
 *
 * 作法：容器不留外距，內層空的區塊直接收掉高度。
 * 這樣既沒有位移，將來若真的替某個尺寸填了說明文字，也還是顯示得出來。
 */
.sp-wc-add-to-cart-wrapper .woocommerce-variation.single_variation {
    margin: 0;
}

.sp-wc-add-to-cart-wrapper .woocommerce-variation-description:empty,
.sp-wc-add-to-cart-wrapper .woocommerce-variation-availability:empty {
    display: none;
}

/* 說明文字有內容時才給間距 */
.sp-wc-add-to-cart-wrapper .woocommerce-variation-description:not(:empty) {
    margin: 0 0 12px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--color-text-muted);
}

.sp-wc-add-to-cart-wrapper .quantity {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0;
}

.sp-custom-qty {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sp-qty-label {
    font-size: 14px;
    font-weight: 700;
    color: var(--color-secondary);
}

.sp-qty-controls {
    display: flex;
    align-items: center;
}

.sp-qty-minus,
.sp-qty-plus {
    width: 42px;
    height: 42px;
    background: var(--color-white);
    border: 1px solid var(--color-border-light);
    font-family: inherit;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-strong);
    padding: 0;
    line-height: 1;
}

.sp-qty-val {
    width: 60px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-top: 1px solid var(--color-border-light);
    border-bottom: 1px solid var(--color-border-light);
    font-size: 14px;
    color: var(--color-text-strong);
    background: var(--color-white);
}

.sp-wc-add-to-cart-wrapper .quantity input.qty {
    display: none;
}

.sp-wc-add-to-cart-wrapper button.single_add_to_cart_button,
.sp-wc-add-to-cart-wrapper .sp-cart-actions-row button.single_add_to_cart_button.button,
.woocommerce .sp-wc-add-to-cart-wrapper form.cart button.single_add_to_cart_button.button.alt {
    flex: 1;
    min-width: 0;
    height: 48px;
    background-color: var(--color-secondary) !important;
    color: var(--color-white) !important;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    border: none !important;
    border-radius: 0 !important;
    cursor: pointer;
    transition: background-color 0.2s ease;
    padding: 0 24px;
    box-shadow: none !important;
}

.sp-wc-add-to-cart-wrapper button.single_add_to_cart_button:hover,
.sp-wc-add-to-cart-wrapper .sp-cart-actions-row button.single_add_to_cart_button.button:hover,
.woocommerce .sp-wc-add-to-cart-wrapper form.cart button.single_add_to_cart_button.button.alt:hover {
    background-color: var(--color-secondary-dark) !important;
    color: var(--color-white) !important;
}

.sp-wc-add-to-cart-wrapper button.single_add_to_cart_button:disabled,
.sp-wc-add-to-cart-wrapper .sp-cart-actions-row button.single_add_to_cart_button.button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@media (max-width: 768px) {
    /* Mobile: cart row should be CTA only (icons move below info list) */
    .sp-wc-add-to-cart-wrapper .sp-cart-actions-row {
        flex-direction: column !important;
        gap: 12px !important;
        align-items: stretch !important;
    }

    .sp-wc-add-to-cart-wrapper .sp-cart-actions-row .sp-wishlist-btn,
    .sp-wc-add-to-cart-wrapper .sp-cart-actions-row .sp-share-btn {
        display: none !important;
    }

    .sp-wc-add-to-cart-wrapper .sp-cart-actions-row button.single_add_to_cart_button.button,
    .sp-wc-add-to-cart-wrapper .sp-cart-actions-row button.single_add_to_cart_button.button.alt {
        width: 100% !important;
        flex: 0 0 auto !important;
        height: 38px !important;
    }

    /* Prevent WP emoji replacement affecting share glyph */
    .sp-share-symbol img.emoji {
        display: none !important;
    }

    .sp-share-symbol::before {
        content: "⤴";
    }

    /* Quantity selector — must come after base .sp-qty-* rules */
    .sp-wc-add-to-cart-wrapper .sp-custom-qty {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 7px;
    }

    .sp-wc-add-to-cart-wrapper .sp-qty-label {
        font-size: 14px;
        font-weight: 700;
        color: var(--color-text-strong);
        margin: 0;
        text-align: left;
    }

    .sp-wc-add-to-cart-wrapper .sp-qty-controls {
        width: 100%;
        display: grid;
        grid-template-columns: 72fr 305fr 72fr;
        gap: 12px;
        align-items: stretch;
    }

    .sp-wc-add-to-cart-wrapper .sp-qty-minus,
    .sp-wc-add-to-cart-wrapper .sp-qty-plus {
        width: auto;
        min-width: 0;
        height: 41px;
        border: 1px solid var(--color-border);
        border-radius: 0;
        color: var(--color-text-strong);
        background: var(--color-white);
        font-size: 16px;
        padding: 0;
    }

    .sp-wc-add-to-cart-wrapper .sp-qty-val {
        width: auto;
        max-width: none;
        height: 41px;
        border: 1px solid var(--color-border);
        border-top: 1px solid var(--color-border);
        border-bottom: 1px solid var(--color-border);
        border-radius: 0;
        font-size: 14px;
        color: var(--color-text-strong);
        background: var(--color-white);
    }

    /* Product tabs — flat centered mobile style */
    .sp-tabs-section {
        display: flex;
        flex-direction: column;
        align-items: center;
        margin-bottom: 48px;
    }

    .sp-tabs-nav {
        width: 85%;
        max-width: 100%;
        margin-left: auto;
        margin-right: auto;
        border: 1px solid var(--color-secondary);
        box-sizing: border-box;
        margin-bottom: 20px;
        justify-content: center;
    }

    .sp-tab-panels {
        width: 100%;
        align-self: stretch;
    }

    .sp-tab-item {
        flex: 1 1 50%;
        width: 50%;
        min-width: 0;
        height: 38px;
        padding: 0 8px;
        font-size: 14px;
        font-weight: 400;
        line-height: 1;
        color: var(--color-text-strong);
        background: var(--color-white);
        border: none;
        border-right: 1px solid var(--color-secondary);
        border-radius: 0;
    }

    .sp-tab-item:last-child {
        border-right: none;
    }

    .sp-tab-item + .sp-tab-item {
        margin-left: 0;
    }

    .sp-tab-item.active {
        background: var(--color-secondary);
        color: var(--color-white);
    }

    .sp-tab-item:hover:not(.active) {
        background: var(--color-white);
    }

    /* Recently viewed — centered title, vertical list rows */
    .sp-recently-viewed-wrap {
        padding: 32px 0;
    }

    .sp-recently-viewed {
        align-items: center;
        padding: 0 20px;
        gap: 24px;
        max-width: 100%;
    }

    .sp-rv-title {
        text-align: center;
        font-size: 16px;
        font-weight: 700;
        color: var(--color-text);
        width: 100%;
        max-width: 100%;
        margin: 0;
    }

    .sp-rv-list {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 24px;
        width: 100%;
        max-width: 400px;
    }

    .sp-rv-item {
        display: grid;
        grid-template-columns: 90px 1fr;
        grid-template-rows: auto auto;
        column-gap: 16px;
        row-gap: 4px;
        align-items: center;
        width: 100%;
        max-width: 400px;
    }

    .sp-rv-img {
        grid-row: 1 / span 2;
        grid-column: 1;
        width: 90px;
        height: 90px;
        margin-bottom: 0;
        align-self: center;
    }

    .sp-rv-img img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .sp-rv-name {
        grid-column: 2;
        grid-row: 1;
        font-size: 14px;
        line-height: 1.4;
        color: var(--color-text-strong);
        margin-bottom: 0;
        align-self: end;
    }

    .sp-rv-price {
        grid-column: 2;
        grid-row: 2;
        font-size: 14px;
        font-weight: 700;
        color: var(--color-black);
        align-self: start;
    }

    .sp-rv-price .amount,
    .sp-rv-price bdi,
    .sp-rv-price ins {
        font-weight: 700;
        text-decoration: none;
    }

    .sp-rv-price ins,
    .sp-rv-price ins .amount,
    .sp-rv-price ins bdi {
        color: var(--color-danger);
    }
}

/* Reviews */
/* --------------------------------------------------------------------------
   展開／收合

   用 grid-template-rows: 0fr -> 1fr，高度交給內容自己決定 ——
   不用量高度、不用寫死 max-height，收尾也不會因為猜錯高度而頓一下。
   原本是切換 hidden 屬性，那是瞬間的，所以會「跳」。
   -------------------------------------------------------------------------- */
.sp-reveal {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.45s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.sp-reveal.is-open {
    grid-template-rows: 1fr;
}

.sp-reveal-inner {
    overflow: hidden;
    /* 收合時內容一起淡出，只有高度變化會顯得生硬 */
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sp-reveal.is-open .sp-reveal-inner {
    opacity: 1;
    transition-delay: 0.12s;
}

@media (prefers-reduced-motion: reduce) {
    .sp-reveal,
    .sp-reveal-inner {
        transition: none;
    }
}

/* 「更多評價」文字鈕 */
.sp-btn-text {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 18px;
    padding: 8px 0;
    background: none;
    border: 0;
    color: var(--color-white);
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    transition: color 0.2s ease;
}

.sp-btn-text:hover {
    color: var(--color-pink);
}

.sp-btn-text-arrow {
    width: 8px;
    height: 8px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg) translate(-2px, -2px);
    transition: transform 0.3s ease;
}

.sp-btn-text.is-open .sp-btn-text-arrow {
    transform: rotate(-135deg) translate(-3px, -3px);
}

.sp-reviews-col {
    flex: 1;
    max-width: 520px;
    min-width: 0;
}

.sp-reviews-list--rest {
    margin-top: 16px;
}

/* --------------------------------------------------------------------------
   評價表單

   WooCommerce 原生的表單是瀏覽器預設樣式（細框輸入框、灰色送出鈕、
   空心星星），跟這一區的深色底完全搭不起來。這裡整組換掉。
   -------------------------------------------------------------------------- */
.sp-wc-reviews-wrap {
    max-width: 520px;
    margin: 24px 0 0;
    background: var(--color-white);
    padding: 28px;
    border-radius: 6px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

/* 評價列表由主題自己畫，WooCommerce 這幾塊不要重複輸出 */
.sp-wc-reviews-wrap .woocommerce-Reviews-title,
.sp-wc-reviews-wrap .commentlist,
.sp-wc-reviews-wrap #reviews > .woocommerce-Reviews > ol.commentlist,
.sp-wc-reviews-wrap .woocommerce-noreviews {
    display: none;
}

.sp-wc-reviews-wrap #review_form_wrapper {
    margin-top: 0;
}

.sp-wc-reviews-wrap #respond .comment-reply-title {
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: var(--color-text-strong);
    margin: 0 0 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--color-border-light);
}

.sp-wc-reviews-wrap #respond label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text-strong);
    margin-bottom: 8px;
}

.sp-wc-reviews-wrap #respond .required {
    color: var(--color-danger);
    text-decoration: none;
    border: 0;
}

.sp-wc-reviews-wrap #respond .comment-form-rating,
.sp-wc-reviews-wrap #respond .comment-form-comment,
.sp-wc-reviews-wrap #respond .comment-form-author,
.sp-wc-reviews-wrap #respond .comment-form-email {
    margin: 0 0 18px;
}

/* 輸入框與文字區 */
.sp-wc-reviews-wrap #respond textarea,
.sp-wc-reviews-wrap #respond input[type="text"],
.sp-wc-reviews-wrap #respond input[type="email"] {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    border: 1px solid var(--color-border);
    border-radius: 0;
    background: var(--color-white);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.6;
    color: var(--color-text);
    transition: border-color 0.2s ease;
}

.sp-wc-reviews-wrap #respond textarea {
    min-height: 120px;
    resize: vertical;
}

.sp-wc-reviews-wrap #respond textarea:focus,
.sp-wc-reviews-wrap #respond input[type="text"]:focus,
.sp-wc-reviews-wrap #respond input[type="email"]:focus {
    outline: none;
    border-color: var(--color-accent);
}

/* 星等：WooCommerce 用 p.stars > span > a，預設是空心星 */
.sp-wc-reviews-wrap #respond p.stars {
    display: flex;
    gap: 10px;
    margin: 0 0 4px;
    line-height: 1;
}

/* WooCommerce 把五顆星包在一個 <span> 裡，星星之間沒有任何間距，
   全部黏成一團。這裡讓 span 也是 flex 才撐得開。 */
.sp-wc-reviews-wrap #respond p.stars span {
    display: flex;
    gap: 10px;
}

.sp-wc-reviews-wrap #respond p.stars a {
    display: block;
    width: 30px;
    height: 30px;
    color: var(--color-border);
    font-size: 0;
    text-indent: 0;
    transition: color 0.15s ease, transform 0.15s ease;
}

.sp-wc-reviews-wrap #respond p.stars a::before {
    content: "★";
    display: block;
    font-size: 30px;
    line-height: 1;
    /* WooCommerce 自己的樣式會用 ::before 放字型圖示，蓋掉它 */
    font-family: inherit;
}

.sp-wc-reviews-wrap #respond p.stars a:hover {
    transform: scale(1.08);
}

.sp-wc-reviews-wrap #respond p.stars a:hover,
.sp-wc-reviews-wrap #respond p.stars a.active,
.sp-wc-reviews-wrap #respond p.stars:hover a {
    color: var(--color-accent);
}

/* 滑到某顆星時，它右邊的要變回未選色 —— 否則整排都會亮 */
.sp-wc-reviews-wrap #respond p.stars a:hover ~ a {
    color: var(--color-border);
}

/* 送出鈕：沿用站上主要按鈕的深色樣式 */
.sp-wc-reviews-wrap #respond input[type="submit"],
.sp-wc-reviews-wrap #respond .submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 140px;
    height: 44px;
    padding: 0 28px;
    border: 1px solid var(--color-secondary);
    border-radius: 0;
    background-color: var(--color-secondary);
    color: var(--color-pink);
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.sp-wc-reviews-wrap #respond input[type="submit"]:hover,
.sp-wc-reviews-wrap #respond .submit:hover {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    color: var(--color-white);
}

/* 隱私權說明文字 */
.sp-wc-reviews-wrap #respond .comment-form-cookies-consent,
.sp-wc-reviews-wrap #respond .comment-notes {
    font-size: 12px;
    line-height: 1.6;
    color: var(--color-text-light);
}

.sp-wc-reviews-wrap #respond .comment-form-cookies-consent input {
    margin-right: 6px;
}

@media (max-width: 768px) {
    .sp-wc-reviews-wrap {
        max-width: none;
        padding: 20px;
    }

    .sp-reviews-col {
        max-width: none;
    }
}

/* Recently Viewed shortcode styles */
.sp-rv-list ul.products {
    display: flex;
    gap: 30px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.sp-rv-list ul.products li.product {
    width: 150px;
}

.sp-rv-list ul.products li.product img {
    width: 150px;
    height: 180px;
    object-fit: cover;
    margin-bottom: 10px;
}

.sp-rv-list ul.products li.product h2.woocommerce-loop-product__title {
    font-size: 12px;
    color: var(--color-text-strong);
    margin-bottom: 5px;
    padding: 0;
}

.sp-rv-list ul.products li.product .price {
    font-size: 12px;
    font-weight: 700;
    color: var(--color-black);
}

/* Desktop min-width guard for hero layout */
@media (min-width: 992px) {
    .sp-main-info {
        flex-wrap: nowrap;
    }
}

@media (max-width: 991px) {
    .sp-main-info {
        flex-direction: column;
        gap: 30px;
        padding-top: 24px;
    }

    .sp-gallery {
        width: 100%;
        max-width: 560px;
        margin: 0 auto;
    }

    .sp-cart-actions-row {
        flex-wrap: wrap;
    }

    .sp-wc-add-to-cart-wrapper button.single_add_to_cart_button {
        width: 100%;
        flex: 1 1 100%;
    }
}

/* --------------------------------------------------------------------------
   購買區的組裝期間

   數量選擇器與「加入購物車 + 收藏 + 分享」那一列都是 single-product.js
   在 DOMContentLoaded 之後才建出來的。腳本掛在頁尾，瀏覽器會先畫一次
   還沒重組的樣子（小黑條按鈕、沒有數量、沒有收藏分享），再跳成正確版面。

   模板裡的 inline script 會在那次繪製前掛上 .is-building，
   這裡先把內容藏起來並預留高度，等 JS 組完再移除，避免畫面跳動。
   -------------------------------------------------------------------------- */
.sp-purchase-panel.is-building {
    /* 桌機組裝後的高度：數量區約 72px + form gap 20px + 按鈕列 48px */
    min-height: 140px;
}

.sp-purchase-panel.is-building .sp-wc-add-to-cart-wrapper {
    /* 用 visibility 而不是 display:none —— 要保留元素才量得到、
       JS 也才搬得動；display:none 會讓變體價格之類的計算拿到 0。 */
    visibility: hidden;
}

@media (max-width: 768px) {
    .sp-purchase-panel.is-building {
        min-height: 120px;
    }
}

/* --------------------------------------------------------------------------
   顧客評價：還沒有人評價時

   原本沒有評價會顯示一組寫死的 4.8 分 / 128 則示範資料，
   商品剛上架就看起來已經賣很久。改成誠實顯示空狀態。
   -------------------------------------------------------------------------- */
.sp-reviews-empty {
    text-align: center;
    padding: 20px 0 8px;
}

.sp-reviews-empty-text {
    margin: 0 0 6px;
    font-size: 16px;
    color: var(--color-white);
}

.sp-reviews-empty-hint {
    margin: 0 0 22px;
    font-size: 14px;
    color: color-mix(in srgb, var(--color-white) 70%, transparent);
}

/* 這一區是深色底，按鈕沿用區塊內既有的反白樣式 */
.sp-reviews-empty .sp-btn-outline {
    width: auto;
    min-width: 168px;
}

/* --------------------------------------------------------------------------
   撰寫評價浮層

   蓋在評價區塊上置中顯示，後方用 backdrop-filter 模糊。
   範圍只到 .sp-reviews-section（section 本身是 position: relative），
   所以 header 與其他區塊不會被一起模糊。
   -------------------------------------------------------------------------- */
.sp-reviews-section {
    position: relative;
}

.sp-review-modal {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    /* 關閉時不可見也不吃點擊 */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sp-review-modal.is-open {
    opacity: 1;
    visibility: visible;
}

.sp-review-modal-backdrop {
    position: absolute;
    inset: 0;
    background-color: color-mix(in srgb, var(--color-secondary) 55%, transparent);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

.sp-review-modal-box {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 520px;
    /* 表單比區塊高時內部自己捲，不要撐破區塊 */
    max-height: 100%;
    overflow-y: auto;
    transform: translateY(12px) scale(0.98);
    transition: transform 0.35s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.sp-review-modal.is-open .sp-review-modal-box {
    transform: translateY(0) scale(1);
}

.sp-review-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--color-text-muted);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.sp-review-modal-close:hover {
    background-color: var(--color-bg-grey);
    color: var(--color-text-strong);
}

/* 浮層裡的表單本體不用再另外留外距 */
.sp-review-modal .sp-wc-reviews-wrap {
    max-width: none;
    margin: 0;
}

@media (prefers-reduced-motion: reduce) {
    .sp-review-modal,
    .sp-review-modal-box {
        transition: none;
    }
}

@media (max-width: 768px) {
    .sp-review-modal {
        padding: 16px;
    }
}
