/* ==========================================================================
   商品展示站 · 前台样式
   主题配色：通过 <html data-theme="xxx"> 切换，变量集中在下方主题块中
   ========================================================================== */

/* ---------------- 主题变量：经典蓝（默认） ---------------- */
:root,
html[data-theme="blue"] {
    --brand: #2563eb;
    --brand-dark: #1d4ed8;
    --brand-soft: #e8f0ff;
    --brand-contrast: #ffffff;
    --bg: #f2f5fa;
    --bg-soft: #e9eef7;
    --card: #ffffff;
    --text: #1f2937;
    --text-soft: #4b5563;
    --muted: #7b8794;
    --border: #e3e9f2;
    --header-bg: linear-gradient(120deg, #1d4ed8 0%, #2563eb 45%, #3b82f6 100%);
    --header-text: #ffffff;
    --notice-bg: #fff9e8;
    --notice-border: #f0d18a;
    --shadow: 0 8px 26px rgba(23, 43, 77, .08);
    --shadow-hover: 0 14px 34px rgba(23, 43, 77, .16);
    --radius: 14px;
}

/* ---------------- 主题：中国红 ---------------- */
html[data-theme="red"] {
    --brand: #d92b2b;
    --brand-dark: #b32020;
    --brand-soft: #fdeceb;
    --brand-contrast: #ffffff;
    --bg: #faf4f2;
    --bg-soft: #f5e6e2;
    --card: #ffffff;
    --text: #2c1d1b;
    --text-soft: #5b403c;
    --muted: #8d716c;
    --border: #f0dedb;
    --header-bg: linear-gradient(120deg, #a81616 0%, #d92b2b 50%, #ef5350 100%);
    --header-text: #ffffff;
    --notice-bg: #fff6e6;
    --notice-border: #f2cf90;
    --shadow: 0 8px 26px rgba(120, 30, 20, .10);
    --shadow-hover: 0 14px 34px rgba(120, 30, 20, .18);
}

/* ---------------- 主题：薄荷绿 ---------------- */
html[data-theme="green"] {
    --brand: #0f9d70;
    --brand-dark: #0b7d59;
    --brand-soft: #e6f7f1;
    --brand-contrast: #ffffff;
    --bg: #f2f8f5;
    --bg-soft: #e6f2ec;
    --card: #ffffff;
    --text: #16302a;
    --text-soft: #3c5a52;
    --muted: #70877f;
    --border: #dcebe4;
    --header-bg: linear-gradient(120deg, #0b7d59 0%, #0f9d70 50%, #34d399 100%);
    --header-text: #ffffff;
    --notice-bg: #f0fbf5;
    --notice-border: #a9e3c9;
    --shadow: 0 8px 26px rgba(10, 70, 50, .09);
    --shadow-hover: 0 14px 34px rgba(10, 70, 50, .16);
}

/* ---------------- 主题：暖橙 ---------------- */
html[data-theme="orange"] {
    --brand: #ea6a1a;
    --brand-dark: #c4550f;
    --brand-soft: #fff1e5;
    --brand-contrast: #ffffff;
    --bg: #fdf7f1;
    --bg-soft: #f8ebdd;
    --card: #ffffff;
    --text: #33241a;
    --text-soft: #5d4632;
    --muted: #8b7563;
    --border: #f2e3d5;
    --header-bg: linear-gradient(120deg, #c4550f 0%, #ea6a1a 50%, #fbbf24 100%);
    --header-text: #ffffff;
    --notice-bg: #fff6e9;
    --notice-border: #f4cf9b;
    --shadow: 0 8px 26px rgba(120, 70, 20, .10);
    --shadow-hover: 0 14px 34px rgba(120, 70, 20, .18);
}

/* ---------------- 主题：暗夜黑 ---------------- */
html[data-theme="dark"] {
    --brand: #6366f1;
    --brand-dark: #4f46e5;
    --brand-soft: #232746;
    --brand-contrast: #ffffff;
    --bg: #0f1523;
    --bg-soft: #161d2e;
    --card: #1b2434;
    --text: #e8edf6;
    --text-soft: #c3ccdb;
    --muted: #94a3b8;
    --border: #2b3648;
    --header-bg: linear-gradient(120deg, #131a2a 0%, #222a45 50%, #3b3f76 100%);
    --header-text: #f3f6fc;
    --notice-bg: #202a3d;
    --notice-border: #3a4864;
    --shadow: 0 8px 26px rgba(0, 0, 0, .35);
    --shadow-hover: 0 14px 34px rgba(0, 0, 0, .5);
}

/* ---------------- 基础 ---------------- */
* { box-sizing: border-box; }

/* 移动端浏览器（iOS Safari / 部分安卓内核）禁止自动放大字号，保证排版稳定 */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
                 "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }
img { max-width: 100%; }

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 18px;
}

.page-main { padding-bottom: 40px; }

.panel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px 20px;
    margin-top: 18px;
}

/* ---------------- 顶部导航 ---------------- */
.site-header {
    background: var(--header-bg);
    color: var(--header-text);
    box-shadow: 0 4px 18px rgba(15, 30, 60, .18);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-inner {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
    min-height: 72px;
    padding-top: 8px;
    padding-bottom: 8px;
}

.header-left { display: flex; gap: 18px; align-items: center; }

.header-link {
    color: var(--header-text);
    opacity: .92;
    font-size: 14px;
    padding: 6px 2px;
    border-bottom: 2px solid transparent;
    transition: .2s;
}
.header-link:hover { opacity: 1; color: var(--header-text); border-bottom-color: currentColor; }

.header-center { text-align: center; justify-self: center; }

.site-name {
    display: block;
    color: var(--header-text);
    font-size: 25px;
    font-weight: 800;
    letter-spacing: 2px;
    line-height: 1.3;
}
.site-name:hover { color: var(--header-text); opacity: .92; }

.site-slogan {
    display: block;
    font-size: 12px;
    opacity: .82;
    letter-spacing: 1px;
}

.header-right { display: flex; justify-content: flex-end; }

/* 主题切换 */
.theme-switch { position: relative; }

.theme-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: rgba(255, 255, 255, .16);
    color: var(--header-text);
    border: 1px solid rgba(255, 255, 255, .38);
    border-radius: 999px;
    padding: 8px 15px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: .2s;
    backdrop-filter: blur(4px);
}
.theme-btn:hover { background: rgba(255, 255, 255, .3); }

.theme-dot {
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: var(--brand);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, .7);
}

.caret { font-size: 11px; opacity: .85; }

.theme-panel {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    width: 268px;
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 18px 40px rgba(15, 25, 45, .22);
    padding: 14px;
    z-index: 60;
}
.theme-panel.is-open { display: block; animation: fadeDown .18s ease; }

@keyframes fadeDown {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.theme-panel-title {
    margin: 0 0 10px;
    font-size: 12px;
    color: var(--muted);
    font-weight: 600;
}

.theme-options { display: grid; gap: 6px; }

.theme-option {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 9px;
    padding: 8px 10px;
    font-size: 14px;
    color: var(--text);
    cursor: pointer;
    text-align: left;
    transition: .18s;
}
.theme-option:hover { background: var(--bg-soft); }
.theme-option.is-active { border-color: var(--brand); background: var(--brand-soft); }

.theme-option-name { flex: 1; }
.theme-check { color: var(--brand); font-weight: 700; opacity: 0; }
.theme-option.is-active .theme-check { opacity: 1; }

.swatch {
    width: 18px;
    height: 18px;
    border-radius: 6px;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12);
    flex: 0 0 auto;
}
.swatch-blue   { background: linear-gradient(135deg, #2563eb, #60a5fa); }
.swatch-red    { background: linear-gradient(135deg, #b32020, #ef5350); }
.swatch-green  { background: linear-gradient(135deg, #0b7d59, #34d399); }
.swatch-orange { background: linear-gradient(135deg, #c4550f, #fbbf24); }
.swatch-dark   { background: linear-gradient(135deg, #131a2a, #4f46e5); }

/* ---------------- 提示消息 ---------------- */
.flash-wrap { max-width: 1200px; margin: 14px auto 0; padding: 0 18px; }

.flash {
    border-radius: 10px;
    padding: 11px 16px;
    font-size: 14px;
    margin-bottom: 8px;
    border: 1px solid transparent;
}
.flash-success { background: #e9f9f1; color: #0b7d59; border-color: #a9e3c9; }
.flash-error   { background: #fdeceb; color: #b32020; border-color: #f3bebb; }
.flash-info    { background: #eef4ff; color: #1d4ed8; border-color: #c3d7ff; }

/* ---------------- 公告展示框 ---------------- */
.notice-panel {
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    gap: 20px;
    padding: 0;
    overflow: hidden;
}

.notice-scroll {
    padding: 16px 18px;
    border-right: 1px dashed var(--border);
    min-width: 0;
}

.notice-scroll-head, .notice-static-head { margin-bottom: 10px; }

.notice-badge {
    display: inline-block;
    background: var(--brand);
    color: var(--brand-contrast);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 3px 11px;
    border-radius: 999px;
}
.notice-badge-static { background: #d98324; }

.notice-viewport {
    height: 116px;
    overflow: hidden;
    position: relative;
    border-radius: 10px;
    background: var(--notice-bg);
    border: 1px solid var(--notice-border);
}

.notice-track { animation: noticeRoll linear infinite; }
.notice-viewport:hover .notice-track { animation-play-state: paused; }

@keyframes noticeRoll {
    from { transform: translateY(0); }
    to   { transform: translateY(-50%); }
}

.notice-item {
    display: flex;
    align-items: baseline;
    gap: 7px;
    padding: 9px 14px;
    font-size: 14px;
    color: var(--text-soft);
    line-height: 1.6;
    border-bottom: 1px dashed rgba(0, 0, 0, .06);
}
.notice-item-title { color: var(--brand-dark); flex: 0 0 auto; }
.notice-item-content { flex: 1 1 auto; }

.notice-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--brand);
    flex: 0 0 auto;
    transform: translateY(-3px);
}

.notice-static { padding: 16px 18px; }

.notice-static-list { list-style: none; margin: 0; padding: 0; }

.notice-static-list li {
    position: relative;
    padding: 7px 0 7px 16px;
    font-size: 14px;
    color: var(--text-soft);
    border-bottom: 1px dashed var(--border);
    line-height: 1.65;
}
.notice-static-list li:last-child { border-bottom: 0; }

.notice-static-list li::before {
    content: "";
    position: absolute;
    left: 2px;
    top: 16px;
    width: 6px;
    height: 6px;
    border-radius: 2px;
    background: #d98324;
}

.notice-static-title { font-weight: 700; color: var(--text); margin-right: 6px; }

.notice-empty { color: var(--muted); font-size: 14px; margin: 6px 0; }

/* ---------------- 搜索框 ---------------- */
.search-panel { padding: 22px 22px 16px; }

.search-form {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 6px 8px 6px 18px;
    transition: .2s;
}
.search-form:focus-within {
    border-color: var(--brand);
    box-shadow: 0 0 0 4px var(--brand-soft);
}

.search-icon {
    width: 15px;
    height: 15px;
    border: 2px solid var(--muted);
    border-radius: 50%;
    position: relative;
    flex: 0 0 auto;
}
.search-icon::after {
    content: "";
    position: absolute;
    right: -5px;
    bottom: -4px;
    width: 8px;
    height: 2px;
    background: var(--muted);
    transform: rotate(45deg);
    border-radius: 2px;
}

.search-input {
    flex: 1 1 auto;
    min-width: 0;
    border: 0;
    background: transparent;
    outline: none;
    font-size: 15px;
    color: var(--text);
    padding: 10px 4px;
}
.search-input::placeholder { color: var(--muted); }

.search-btn {
    flex: 0 0 auto;
    background: var(--brand);
    color: var(--brand-contrast);
    border: 0;
    border-radius: 999px;
    padding: 11px 26px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: .2s;
}
.search-btn:hover { background: var(--brand-dark); }

.search-hint { margin: 12px 2px 2px; font-size: 13px; color: var(--muted); }
.search-clear { margin-left: 8px; color: var(--brand); }

/* ---------------- 商品区：左分类 + 右列表 ---------------- */
.products-layout {
    display: grid;
    grid-template-columns: 232px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
    margin-top: 18px;
}

.category-side { position: sticky; top: 94px; padding: 16px 14px; }

.side-title {
    margin: 2px 0 12px;
    font-size: 16px;
    padding-left: 10px;
    border-left: 4px solid var(--brand);
    line-height: 1.2;
}

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

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

.category-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 13px;
    border-radius: 10px;
    color: var(--text-soft);
    font-size: 14px;
    transition: .18s;
}
.category-list a:hover { background: var(--bg-soft); color: var(--brand-dark); }

.category-list li.is-active a {
    background: var(--brand);
    color: var(--brand-contrast);
    font-weight: 700;
    box-shadow: 0 6px 16px rgba(30, 60, 130, .22);
}

.cat-name { flex: 1 1 auto; }

.cat-count {
    font-size: 12px;
    background: rgba(0, 0, 0, .06);
    border-radius: 999px;
    padding: 1px 8px;
}
.category-list li.is-active .cat-count { background: rgba(255, 255, 255, .28); }

.side-empty { color: var(--muted); font-size: 13px; margin: 8px 0 0; }

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

.list-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 0;
}

.list-title { margin: 0; font-size: 18px; }
.list-meta { font-size: 13px; color: var(--muted); }

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(238px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

/* 商品卡片 */
.product-card {
    display: flex;
    flex-direction: column;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    color: var(--text);
    transition: transform .2s, box-shadow .2s;
}
.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    color: var(--text);
}

.product-thumb {
    position: relative;
    background: var(--bg-soft);
    aspect-ratio: 4 / 3;
    overflow: hidden;
}
.product-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .35s;
}
.product-card:hover .product-thumb img { transform: scale(1.06); }

.product-info {
    padding: 13px 15px 15px;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
}

.product-title {
    margin: 0 0 6px;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-summary {
    margin: 0 0 12px;
    font-size: 13px;
    color: var(--muted);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1 1 auto;
}

.product-foot { display: flex; justify-content: flex-end; }

/* “立即查看”：红色字体 + 粗体 + 浅黑色背景（需求指定样式） */
.view-badge {
    display: inline-block;
    color: #ff2d2d;
    font-weight: 800;
    font-size: 13px;
    letter-spacing: .5px;
    background: rgba(0, 0, 0, .55);
    border-radius: 7px;
    padding: 5px 12px;
    transition: .2s;
}
.product-card:hover .view-badge {
    background: rgba(0, 0, 0, .72);
    color: #ff5252;
}

/* 空状态 */
.empty-state { text-align: center; padding: 46px 20px; margin-top: 16px; }
.empty-title { font-size: 17px; font-weight: 700; margin: 0 0 8px; }
.empty-tip { color: var(--muted); margin: 0; font-size: 14px; }

/* ---------------- 分页 ---------------- */
.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    align-items: center;
    margin: 26px 0 6px;
}
.pagination a,
.pagination .current,
.pagination .dots {
    min-width: 38px;
    text-align: center;
    padding: 8px 12px;
    border-radius: 9px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text-soft);
    font-size: 14px;
}
.pagination a:hover { border-color: var(--brand); color: var(--brand); }
.pagination .current {
    background: var(--brand);
    border-color: var(--brand);
    color: var(--brand-contrast);
    font-weight: 700;
}
.pagination .dots { border: 0; background: transparent; color: var(--muted); }

/* ---------------- 商品详情页 ---------------- */
.breadcrumb {
    font-size: 13px;
    color: var(--muted);
    margin: 18px 0 -4px;
    line-height: 1.9;
}
.breadcrumb a { color: var(--text-soft); }
.breadcrumb .crumb-current { color: var(--text); font-weight: 600; }

/* 轮播 */
.carousel {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius);
    background: #0b0f16;
    box-shadow: var(--shadow);
    margin-top: 16px;
}

.carousel-track {
    display: flex;
    transition: transform .45s cubic-bezier(.22, .61, .36, 1);
}

.carousel-slide { flex: 0 0 100%; }

.carousel-slide img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    max-height: 560px;
    object-fit: cover;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 0;
    background: rgba(0, 0, 0, .42);
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: .2s;
    z-index: 3;
}
.carousel-btn:hover { background: rgba(0, 0, 0, .68); }
.carousel-prev { left: 14px; }
.carousel-next { right: 14px; }

.carousel-dots {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 14px;
    display: flex;
    justify-content: center;
    gap: 8px;
    z-index: 3;
}
.carousel-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 0;
    background: rgba(255, 255, 255, .5);
    cursor: pointer;
    padding: 0;
    transition: .2s;
}
.carousel-dot.is-active { background: #fff; width: 24px; border-radius: 999px; }

.carousel-counter {
    position: absolute;
    right: 14px;
    bottom: 14px;
    background: rgba(0, 0, 0, .55);
    color: #fff;
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 999px;
    z-index: 3;
}

/* 立即去购买按钮：背景红色 + 字体红色（白色描边保证可读）；
   如需改为白字，把下面的 color 改成 #ffffff 并删除 -webkit-text-stroke 即可 */
.btn-buy {
    display: block;
    width: 100%;
    margin-top: 16px;
    padding: 20px 16px;
    text-align: center;
    text-decoration: none;
    border-radius: 12px;
    border: 2px solid #ff4d4d;
    background: linear-gradient(135deg, #ff2d2d 0%, #cc1414 55%, #8c0000 100%);
    color: #ff3b3b;
    font-size: 22px;
    font-weight: 900;
    letter-spacing: 8px;
    text-indent: 8px;
    -webkit-text-stroke: 1px rgba(255, 255, 255, .92);
    text-shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 0 12px rgba(255, 255, 255, .35);
    box-shadow: 0 10px 24px rgba(190, 20, 20, .32);
    cursor: pointer;
    transition: transform .18s, box-shadow .18s, filter .18s;
}
.btn-buy:hover {
    color: #ff5252;
    transform: translateY(-2px);
    filter: brightness(1.06);
    box-shadow: 0 14px 30px rgba(190, 20, 20, .42);
}
.btn-buy:active { transform: translateY(0); }

.buy-note {
    margin: 10px 2px 0;
    font-size: 13px;
    color: var(--muted);
    text-align: center;
}

/* 商品信息与详情介绍框 */
.detail-card { padding: 22px 24px; margin-top: 18px; }

.detail-head { border-bottom: 1px solid var(--border); padding-bottom: 14px; margin-bottom: 16px; }

.detail-title { margin: 0 0 8px; font-size: 22px; line-height: 1.5; }

.detail-sub { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--muted); }

.detail-summary {
    margin: 12px 0 0;
    font-size: 14px;
    color: var(--text-soft);
    background: var(--bg-soft);
    border-radius: 10px;
    padding: 12px 14px;
    line-height: 1.75;
}

.detail-block-title {
    font-size: 17px;
    margin: 0 0 14px;
    padding-left: 11px;
    border-left: 4px solid var(--brand);
    line-height: 1.2;
}

.detail-block + .detail-block { margin-top: 18px; }

.detail-block-text {
    font-size: 15px;
    color: var(--text-soft);
    line-height: 1.95;
    white-space: pre-wrap;
    word-break: break-word;
}

.detail-block-media { text-align: center; }

.detail-block-media img {
    border-radius: 12px;
    border: 1px solid var(--border);
    display: inline-block;
    max-width: 100%;
}

.detail-block-media video {
    width: 100%;
    max-height: 620px;
    border-radius: 12px;
    background: #000;
    display: block;
}

.detail-caption {
    margin: 8px 0 0;
    font-size: 13px;
    color: var(--muted);
    text-align: center;
}

.detail-empty { color: var(--muted); padding: 20px 0; text-align: center; }

/* 最近预览的商品 */
.recent-section { margin-top: 26px; }

.recent-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
}
.recent-title {
    margin: 0;
    font-size: 18px;
    padding-left: 11px;
    border-left: 4px solid var(--brand);
    line-height: 1.2;
}
.recent-tip { font-size: 13px; color: var(--muted); }

.recent-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 14px;
}

.product-card-compact .product-thumb { aspect-ratio: 4 / 3; }
.product-card-compact .product-title { font-size: 14px; -webkit-line-clamp: 1; }
.product-card-compact .product-info { padding: 10px 12px 12px; }
.product-card-compact .view-badge { font-size: 12px; padding: 4px 10px; }

/* ---------------- 页脚 ---------------- */
.site-footer {
    background: var(--bg-soft);
    border-top: 1px solid var(--border);
    margin-top: 40px;
    padding: 24px 0;
}
.footer-inner {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
}
.footer-text { margin: 0; font-size: 13px; color: var(--muted); }
.footer-links { margin: 0; display: flex; gap: 16px; font-size: 13px; }

/* 回到顶部 */
.back-top {
    position: fixed;
    right: 22px;
    bottom: 26px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--brand);
    font-size: 19px;
    cursor: pointer;
    box-shadow: var(--shadow);
    opacity: 0;
    visibility: hidden;
    transition: .25s;
    z-index: 40;
}
.back-top.is-show { opacity: 1; visibility: visible; }
.back-top:hover { background: var(--brand); color: var(--brand-contrast); }

/* ---------------- 响应式 ---------------- */
/* 断点说明：
   - 980px：平板竖屏及以下，公告区改为单列，商品区暂时改为单列（分类为横向胶囊）
   - 720px：手机（含横向）及以下，商品区恢复「左分类 + 右商品」双栏：
            左栏为纵向分类列表、常驻并可独立滚动，右栏为「左图右文」的横向商品卡片列表；
            顶栏改为两行（站名独占一行），避免主题按钮被挤到换行
   - 480px：主流手机竖屏，进一步收紧内边距与字号、放大触摸目标（≥44px）
   桌面（>980px）保持原有视觉不变。 */

@media (max-width: 980px) {
    /* 触屏设备（平板/手机）主要交互元素不小于 44px，方便点按 */
    .header-link {
        display: inline-flex; align-items: center; justify-content: center;
        min-height: 44px; min-width: 44px; padding: 0 8px;
    }
    .theme-btn { min-height: 44px; }
    .theme-option { min-height: 44px; }
    .search-btn { min-height: 46px; }
    .category-list a { min-height: 44px; }
    .pagination a,
    .pagination .current,
    .pagination .dots {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .notice-panel { grid-template-columns: 1fr; }
    .notice-scroll { border-right: 0; border-bottom: 1px dashed var(--border); }
    .products-layout { grid-template-columns: minmax(0, 1fr); }
    .category-side { position: static; }
    .category-list { display: flex; flex-wrap: wrap; gap: 8px; }
    .category-list li { margin: 0; }
    .category-list a { padding: 8px 14px; border: 1px solid var(--border); }
    .category-list li.is-active a { border-color: var(--brand); }
}

@media (max-width: 720px) {
    /* 顶栏：站名独占第一行，导航与主题切换在第二行，彻底避免按钮文字换行 */
    .header-inner {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: 6px 10px;
        min-height: 0;
        padding-top: 10px;
        padding-bottom: 10px;
    }
    .header-center { order: -1; flex: 1 1 100%; text-align: center; }
    .header-left { gap: 4px; }
    .header-right { flex: 0 0 auto; }
    .site-name { font-size: 20px; letter-spacing: 1px; }
    .site-slogan { display: block; font-size: 11px; }
    .header-left .header-link:nth-child(2) { display: inline-flex; }
    .theme-btn { white-space: nowrap; padding: 8px 13px; font-size: 13px; }
    .theme-btn .theme-dot { width: 11px; height: 11px; }

    .search-form { flex-wrap: wrap; border-radius: 14px; padding: 10px 12px; }
    .search-btn { width: 100%; border-radius: 10px; }
    .product-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
    .product-title { font-size: 14px; }
    .btn-buy { font-size: 18px; letter-spacing: 4px; text-indent: 4px; padding: 16px 10px; }
    .theme-panel { width: 236px; }
    .detail-title { font-size: 18px; }

    /* ---- 手机端商品区：保持「左分类 + 右商品」双栏，不做上下堆叠 ---- */
    .products-layout {
        grid-template-columns: clamp(94px, 27vw, 132px) minmax(0, 1fr);
        gap: 8px;
    }

    /* 左栏：纵向分类列表，常驻并可独立滚动 */
    .category-side {
        position: sticky;
        top: 98px;
        max-height: calc(100vh - 114px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        padding: 10px 8px;
    }
    .side-title {
        font-size: 13px;
        margin: 0 0 8px;
        padding-left: 7px;
        border-left-width: 3px;
    }
    .category-list { display: block; }
    .category-list li { margin-bottom: 4px; }
    .category-list a {
        display: block;
        padding: 8px;
        border: 0;
        border-radius: 8px;
        font-size: 13px;
        line-height: 1.45;
        word-break: break-word;
    }
    /* 选中态：浅色底 + 主题色文字 + 左侧色条，窄栏下更清晰，也更贴近参考模板 */
    .category-list li.is-active a {
        background: var(--brand-soft);
        color: var(--brand-dark);
        box-shadow: inset 3px 0 0 var(--brand);
    }
    .cat-count {
        display: block;
        margin-top: 2px;
        padding: 0;
        background: transparent;
        border-radius: 0;
        color: var(--muted);
        font-size: 11px;
    }
    .category-list li.is-active .cat-count {
        background: transparent;
        color: var(--brand-dark);
        opacity: .8;
    }

    /* 右栏：单列「左图右文」横向卡片，贴合手机端参考布局 */
    .product-grid { grid-template-columns: minmax(0, 1fr); gap: 8px; }
    .product-grid .product-card { flex-direction: row; }
    .product-grid .product-card:hover { transform: none; }
    .product-grid .product-thumb {
        flex: 0 0 auto;
        width: 34%;
        max-width: 118px;
        aspect-ratio: 1 / 1;
        align-self: flex-start;
    }
    .product-grid .product-info {
        min-width: 0;
        padding: 10px 11px 11px;
    }
    .product-grid .product-title { font-size: 14px; margin-bottom: 4px; }
    .product-grid .product-summary { font-size: 12.5px; margin-bottom: 8px; }
    .product-grid .view-badge { font-size: 12px; padding: 4px 10px; }
}

@media (max-width: 480px) {
    /* 收紧容器与卡片内边距，为窄屏争取内容宽度 */
    .container { padding: 0 14px; }
    .panel { padding: 15px 14px; border-radius: 12px; }
    .search-panel { padding: 16px 14px 12px; }
    .list-head { padding: 14px; }

    /* 触摸目标统一不小于 44px（iOS HIG / Material 建议值） */
    .header-link {
        display: inline-flex;
        align-items: center;
        min-height: 44px;
        padding: 0 8px;
        font-size: 14px;
    }
    .theme-btn { min-height: 44px; }
    .theme-option { min-height: 44px; padding: 10px 12px; }
    .search-btn { min-height: 46px; font-size: 16px; }
    .search-input { font-size: 16px; }        /* 16px 及以上可避免 iOS 聚焦时自动放大 */
    .category-list a { min-height: 44px; }
    .pagination a,
    .pagination .current,
    .pagination .dots {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    .breadcrumb { font-size: 12.5px; }
    .breadcrumb a { display: inline-block; padding: 5px 0; }

    /* 轮播：圆点视觉尺寸不变，但扩大可点击热区到 44px */
    .carousel-dot { position: relative; }
    .carousel-dot::after {
        content: "";
        position: absolute;
        left: 50%;
        top: 50%;
        width: 44px;
        height: 44px;
        transform: translate(-50%, -50%);
    }
    .carousel-dots { gap: 4px; }
    .carousel-counter { right: 10px; bottom: 10px; }

    /* 公告滚动区高度按窄屏两行文案调整，避免长文案被整段截掉 */
    .notice-viewport { height: 138px; }
    .notice-scroll, .notice-static { padding: 14px; }
    .notice-item { font-size: 13.5px; padding: 9px 12px; }
    .notice-static-list li { font-size: 13.5px; }
    .notice-viewport:hover .notice-track { animation-play-state: running; }

    .product-info { padding: 11px 12px 13px; }
    .product-summary { -webkit-line-clamp: 1; margin-bottom: 9px; }
    .recent-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

    .detail-card { padding: 16px 14px; }
    .detail-title { font-size: 18px; }
    .detail-sub { gap: 10px; }
    .btn-buy { font-size: 17px; letter-spacing: 3px; text-indent: 3px; padding: 15px 12px; }
    .detail-block-title { font-size: 16px; }

    .theme-panel { width: min(268px, calc(100vw - 28px)); }
    .back-top { right: 14px; bottom: 16px; }

    /* ---- 手机端商品区双栏：窄屏进一步收紧 ---- */
    .products-layout {
        grid-template-columns: clamp(86px, 26vw, 104px) minmax(0, 1fr);
        gap: 7px;
    }
    .category-side {
        top: 94px;
        max-height: calc(100vh - 108px);
        padding: 9px 7px;
    }
    .side-title { font-size: 12px; margin-bottom: 7px; }
    .category-list a { font-size: 12.5px; padding: 7px 6px; }
    .cat-count { font-size: 10.5px; }

    .product-grid { grid-template-columns: minmax(0, 1fr); gap: 7px; }
    .product-grid .product-thumb { width: 33%; }
    .product-grid .product-info { padding: 9px 10px 10px; }
    .product-grid .product-title { font-size: 13.5px; }
    .product-grid .product-summary { font-size: 12px; -webkit-line-clamp: 1; margin-bottom: 7px; }
    .product-grid .view-badge { font-size: 11.5px; padding: 3px 9px; }
    .list-head { padding: 12px; }
    .list-title { font-size: 16px; }
}