/* ===== 设计系统变量 ===== */
:root {
    color-scheme: dark;
    --accent-fill: #f5f500;
    --accent-fill-hover: #ffff33;
    --bg-base: #111111;
    --bg-surface: #1c1c1c;
    --bg-card: #242526;
    --bg-card-hover: #2e2e2e;
    --bg-panel: #363837;
    --accent: #f5f500;
    --accent-hover: #ffff33;
    --accent-dim: rgba(245, 245, 0, 0.15);
    --text-primary: #f0f0f0;
    --text-secondary: #c8c8c8;
    --text-muted: #b0b0b0;
    --border: #2e2e2e;
    --border-accent: rgba(245, 245, 0, 0.3);
    --shadow-card: 0 2px 12px rgba(0,0,0,0.5);
    --shadow-hover: 0 8px 32px rgba(0,0,0,0.7);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    /* 详情页内容列宽上限。图片墙与顶/底广告位共用 —— 各写各的会在宽屏
       下错位（实测 1920 视口时广告比图片两边各宽 40px）。 */
    --content-max-width: 1280px;
    --locked-blur: 3px;  /* 默认值，由 config.LOCKED_BLUR / 环境变量 LOCKED_BLUR 覆盖 */
}

:root[data-theme="light"] {
    color-scheme: light;
    --bg-base: #f4f4f4;
    --bg-surface: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #e8e8e8;
    --bg-panel: #e0e0e0;
    --accent: #705600;
    --accent-hover: #574700;
    --accent-fill: #ebd447;
    --accent-fill-hover: #dfc62e;
    --accent-dim: rgba(117, 96, 0, 0.09);
    --text-primary: #161616;
    --text-secondary: #393939;
    --text-muted: #525252;
    --border: #d4d4d4;
    --border-accent: rgba(117, 96, 0, 0.3);
    --shadow-card: 0 2px 12px rgba(34, 38, 25, 0.06);
    --shadow-hover: 0 8px 32px rgba(34, 38, 25, 0.12);
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
}
.theme-toggle[hidden], .theme-moon { display: none; }
.theme-toggle:hover { background: var(--bg-card-hover); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
[data-theme="light"] .theme-sun { display: none; }
[data-theme="light"] .theme-moon { display: block; }
/* Theme-specific artwork shares dimensions to avoid shifting the navigation. */
.nav-logo.nav-logo-light { display: none; }
[data-theme="light"] .nav-logo-dark { display: none; }
[data-theme="light"] .nav-logo-light { display: block; }
[data-theme="light"] .alert-success { color: #166534; }
[data-theme="light"] .alert-danger,
[data-theme="light"] .alert-error { color: #991b1b; }
[data-theme="light"] .alert-info,
[data-theme="light"] .alert-message { color: #1e40af; }
[data-theme="light"] .alert-warning { color: #854d0e; }
[data-theme="light"] .membership-card.featured {
    background: linear-gradient(135deg, #fff7cd, var(--bg-card));
}
@media (max-width: 768px) {
    .navbar.nav-search-open .theme-toggle { visibility: hidden; }
    .navbar .container { gap: 10px; }
}

/* Keep small captions readable over photographs in the light theme. */
/* The image covers this static placeholder once decoded; no loading animation. */
[data-theme="light"] .set-cover {
    background-color: #e0e0e0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48' fill='none' stroke='%238a8a8a' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='7' y='9' width='34' height='30' rx='4'/%3E%3Ccircle cx='17' cy='19' r='3'/%3E%3Cpath d='m9 34 10-10 7 7 5-5 8 8'/%3E%3C/svg%3E");
    background-position: center;
    background-repeat: no-repeat;
    background-size: 48px 48px;
}
[data-theme="light"] .set-cover-placeholder {
    background-position: center calc(50% - 24px);
    padding-top: 36px;
}
[data-theme="light"] .set-cover-overlay {
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.82) 48%, rgba(0, 0, 0, 0.94));
}
[data-theme="light"] .set-cover-meta {
    color: #f4f4f4;
    font-size: 0.8rem;
    font-weight: 500;
}

/* ===== 基础重置 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background-color: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

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

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    min-width: 0;
}

/* ===== 导航栏 ===== */
.navbar {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    gap: 16px;
    min-width: 0;
    position: relative;
}

.nav-brand a {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.nav-brand,
.nav-search,
.nav-menu {
    min-width: 0;
}

.nav-logo {
    display: block;
    height: 40px;
    width: auto;
}



.nav-search {
    flex: 0 0 auto;
    margin-left: auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.nav-search-icon {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    border-radius: var(--radius-sm);
    transition: color 0.15s;
    flex-shrink: 0;
}

.nav-search-icon:hover { color: var(--accent); }

.nav-search-form {
    display: none;
    align-items: center;
    gap: 0;
    width: 440px;
}

.nav-search-form.expanded { display: flex; }

.nav-search.expanded .nav-search-icon { display: none; }

.nav-search-input {
    flex: 1;
    min-width: 0;
    height: 34px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-right: none;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    background: var(--bg-base);
    color: var(--text-primary);
    font-size: 0.88rem;
    outline: none;
    transition: border-color 0.2s;
}

.nav-search-input:focus { border-color: var(--accent); }

.nav-search-btn {
    height: 34px;
    padding: 0 18px;
    background: var(--accent-fill);
    color: #000;
    border: none;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
    transition: opacity 0.2s;
}

.nav-search-btn:hover { opacity: 0.85; }

.nav-slogan {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-left: 12px;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 0;
}

.nav-menu a {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0 16px;
    height: 56px;
    display: flex;
    align-items: center;
    transition: color 0.2s;
    border-bottom: 2px solid transparent;
}

.nav-menu a:hover {
    color: var(--text-primary);
}

.nav-menu a.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.nav-menu .btn-nav-cta {
    background: var(--accent-fill);
    color: #111;
    border-radius: var(--radius-sm);
    padding: 6px 16px;
    height: auto;
    font-weight: 700;
    font-size: 0.85rem;
    margin-left: 8px;
    border-bottom: none;
}

.nav-menu .btn-nav-cta:hover {
    background: var(--accent-fill-hover);
    color: #111;
}

/* ===== 语言切换器 ===== */
.lang-switcher {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: 12px;
    padding-left: 12px;
    border-left: 1px solid var(--border);
}

.lang-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
    line-height: 1;
}

.lang-link:hover,
.lang-link.active {
    color: var(--accent);
    background: var(--accent-dim);
}

/* ===== 语言下拉（桌面导航）=====
   语言从 3 种加到 4 种后，并排平铺会挤占导航空间，改为下拉。
   用 <details>/<summary> 而非自写 JS：原生支持键盘与 Esc，无 JS 时也能展开。 */
.lang-dd {
    position: relative;
    margin-left: 12px;
    padding-left: 12px;
    border-left: 1px solid var(--border);
}

.lang-dd-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 8px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    border-radius: 4px;
    cursor: pointer;
    list-style: none;          /* 去掉默认三角 */
    white-space: nowrap;
    transition: color 0.15s, background 0.15s;
}
.lang-dd-toggle::-webkit-details-marker { display: none; }

.lang-dd-toggle:hover,
.lang-dd[open] .lang-dd-toggle {
    color: var(--accent);
    background: var(--accent-dim);
}

.lang-dd-caret {
    width: 0; height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid currentColor;
    transition: transform 0.15s;
}
.lang-dd[open] .lang-dd-caret { transform: rotate(180deg); }

.lang-dd-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 120px;
    padding: 4px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    z-index: 1000;
}

.lang-dd-item {
    display: block;
    padding: 8px 12px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 4px;
    white-space: nowrap;
}

.lang-dd-item:hover,
.lang-dd-item.active {
    color: var(--accent);
    background: var(--accent-dim);
}

/* ===== 语言切换（移动端抽屉）=====
   ★ .nav-menu 在 ≤768px 是 display:none，桌面下拉在它里面，
   所以抽屉必须自带一份，否则手机端（约 56% 流量）无法切换语言。 */
.nav-drawer-lang {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.nav-drawer-lang-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    letter-spacing: 0.04em;
}

.nav-drawer-lang-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* 抽屉里用完整语言名，覆盖 .lang-link 为单字设计的 28px 定宽 */
.nav-drawer-lang-links .lang-link {
    width: auto;
    height: auto;
    padding: 7px 12px;
    font-size: 0.8rem;
    border: 1px solid var(--border);
}

/* ===== 汉堡按钮 (mobile only — shown via media query) ===== */
.nav-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    flex-shrink: 0;
    margin-left: 4px;
}

.nav-menu-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text-secondary);
    border-radius: 1px;
    transition: background 0.15s;
}

.nav-menu-toggle:hover span {
    background: var(--text-primary);
}

/* ===== 右侧抽屉菜单 ===== */
.nav-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 1100;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s, visibility 0.25s;
}

.nav-overlay.active {
    opacity: 1;
    visibility: visible;
}

.nav-drawer {
    position: fixed;
    top: 0;
    right: 0;
    height: 100%;
    width: min(280px, 75vw);
    background: var(--bg-surface);
    border-left: 1px solid var(--border);
    z-index: 1101;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    display: flex;
    flex-direction: column;
}

.nav-drawer.open {
    transform: translateX(0);
}

.nav-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    height: 56px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.nav-drawer-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.nav-drawer-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    border-radius: var(--radius-sm);
    transition: color 0.15s;
}

.nav-drawer-close:hover {
    color: var(--text-primary);
}

.nav-drawer-links {
    display: flex;
    flex-direction: column;
    padding: 8px 0;
    flex: 1;
    overflow-y: auto;
}

.nav-drawer-links a {
    padding: 14px 20px;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    border-bottom: 1px solid var(--border);
    transition: color 0.15s, background 0.15s;
}

.nav-drawer-links a:last-child {
    border-bottom: none;
}

.nav-drawer-links a:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

.nav-drawer-links a.active {
    color: var(--accent);
}

.nav-drawer-links .btn-nav-cta {
    margin: 12px 16px;
    background: var(--accent-fill);
    color: #111;
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    font-weight: 700;
    text-align: center;
    border-bottom: none;
    display: block;
}

.nav-drawer-links .btn-nav-cta:hover {
    background: var(--accent-fill-hover);
    color: #111;
}

/* ===== 主内容 ===== */
.main-content {
    min-height: calc(100vh - 56px - 60px);
    padding: 12px 0;
}

/* ===== Flash 消息 ===== */
.flash-stack {
    padding: 12px 16px 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.92rem;
    line-height: 1.4;
    border-left: 3px solid;
    background: var(--bg-card);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
    pointer-events: auto;
    animation: alertSlideIn 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.alert-icon {
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--bg-base);
}

.alert-text {
    flex: 1 1 auto;
    min-width: 0;
}

.alert-close {
    flex: 0 0 auto;
    background: transparent;
    border: 0;
    color: inherit;
    opacity: 0.65;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
    transition: opacity 0.15s;
}
.alert-close:hover { opacity: 1; }

.alert-success {
    background: rgba(34, 197, 94, 0.14);
    border-color: #22c55e;
    color: #bbf7d0;
}
.alert-success .alert-icon { background: #22c55e; }
.alert-success .alert-icon::after { content: "✓"; }

.alert-error,
.alert-danger {
    background: rgba(239, 68, 68, 0.14);
    border-color: #ef4444;
    color: #fecaca;
}
.alert-error .alert-icon,
.alert-danger .alert-icon { background: #ef4444; }
.alert-error .alert-icon::after,
.alert-danger .alert-icon::after { content: "!"; }

.alert-info,
.alert-message {
    background: rgba(59, 130, 246, 0.14);
    border-color: #3b82f6;
    color: #bfdbfe;
}
.alert-info .alert-icon,
.alert-message .alert-icon { background: #3b82f6; }
.alert-info .alert-icon::after,
.alert-message .alert-icon::after { content: "i"; font-style: italic; }

.alert-warning {
    background: rgba(245, 158, 11, 0.14);
    border-color: #f59e0b;
    color: #fde68a;
}
.alert-warning .alert-icon { background: #f59e0b; }
.alert-warning .alert-icon::after { content: "!"; }

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

@media (min-width: 768px) {
    .flash-stack {
        position: fixed;
        top: 72px;
        left: 50%;
        transform: translateX(-50%);
        width: min(520px, calc(100vw - 32px));
        padding: 0;
        z-index: 1100;
    }
}

/* ===== 按钮 ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 24px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--accent-fill);
    color: #111;
}

.btn-primary:hover {
    background: var(--accent-fill-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-ghost {
    background: var(--bg-panel);
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 14px 36px;
    font-size: 1rem;
}

/* ===== 首页 Hero ===== */
.hero {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    padding: 10px 0;
    margin-bottom: 32px;
}

.hero-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.hero h1 {
    font-size: 2.4rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -1px;
}

.hero h1 span {
    color: var(--accent);
}

.hero p {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 0;
}

.hero-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* ===== 搜索框 ===== */
.search-bar {
    margin-bottom: 28px;
}

.search-bar form {
    display: flex;
    gap: 0;
    max-width: 560px;
}

.search-input {
    flex: 1;
    padding: 10px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-right: none;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.search-input::placeholder { color: var(--text-muted); }

.search-input:focus {
    border-color: var(--accent);
}

.search-btn {
    padding: 10px 20px;
    background: var(--accent-fill);
    color: #111;
    border: none;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.search-btn:hover { background: var(--accent-fill-hover); }

/* ===== 分类标签 ===== */
.categories-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.category-tag {
    padding: 5px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 500;
    transition: all 0.2s;
}

.category-tag:hover,
.category-tag.active {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
}

/* ===== 套图网格（顶部从左到右的瀑布流）=====
 * 桌面端 (>768px) 由 JS (masonry.js) 把每个 .set-card 绝对定位到
 * 当前累计最短列的下方，实现 Pinterest 风的"先横向铺满第一行，再
 * 纵向延伸"。容器高度由 JS 同步设定。
 *
 * JS 失败/未加载时，set-card 仍能正常块级显示（fallback）。
 */
.sets-grid {
    position: relative;
    margin-bottom: 40px;
    /* JS 接管时会动态设置高度；初始留点空间避免 0 高度闪烁 */
    min-height: 200px;
}

.sets-grid:not(.js-masonry) {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    align-items: start;
}

@media (min-width: 768px) {
    .sets-grid:not(.js-masonry) {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 1200px) {
    .sets-grid:not(.js-masonry) {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.entry-languages {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
}

.entry-languages a {
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.entry-languages a[aria-current="true"] {
    color: var(--accent);
    border-color: var(--accent);
}

.set-card {
    /* 默认作为 fallback 块级显示；JS 接管后会切换到 absolute 模式 */
    background: var(--bg-card);
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border);
    /* 注意：transform 不进 transition，避免 JS-masonry 初始定位时从 (0,0) "动画"
       到目标位置，造成"左上角扩散"的视觉副作用。hover 时 border 和阴影仍有过渡。 */
    transition: border-color 0.25s, box-shadow 0.25s;
    cursor: pointer;
    display: block;
    width: 100%;
}

/* JS 启用 masonry 后，整个网格切到 absolute 定位模式 */
.sets-grid.js-masonry .set-card {
    position: absolute;
    top: 0;
    left: 0;
    margin: 0;
    /* width / transform 由 JS 实时设置 */
}

.set-card:hover {
    border-color: rgba(245, 245, 0, 0.2);
    box-shadow: var(--shadow-hover);
}

/* JS masonry 模式下：hover 不再 translateY（会破坏 absolute 定位的 transform 复合矩阵），
   改用阴影 + border 高亮 */
.sets-grid:not(.js-masonry) .set-card:hover {
    transform: translateY(-3px);
}

.set-card a {
    display: block;
    color: inherit;
    text-decoration: none;
}

.set-cover {
    width: 100%;
    overflow: hidden;
    background: var(--bg-panel);
    position: relative;
}

.set-cover img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    transition: transform 0.4s;
}

img.lazy-img {
    opacity: 0;
    transition: opacity 0.25s ease;
}

img.lazy-img.loaded {
    opacity: 1;
}

img.cover-pending,
img.lazy-img.loaded.cover-pending {
    opacity: 0;
}

img.cover-ready {
    opacity: 1;
    transition: opacity 0.16s ease, transform 0.4s;
}

@media (prefers-reduced-motion: reduce) {
    img.cover-ready { transition: none; }
}

.set-card:hover .set-cover img {
    transform: scale(1.05);
}

.set-cover-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 13px;
    /* 没有封面 / DB 缺 width/height 时，给一个稳定的占位高度，
       避免 masonry 算列高时拿到 0 */
    aspect-ratio: 3/4;
}

.set-cover-locked img {
    filter: blur(var(--locked-blur));
}

.set-cover-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 2;
}

.set-cover-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 40px 10px 10px;
    background: linear-gradient(transparent, rgba(0,0,0,0.88));
}

.set-cover-overlay h3 {
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.set-cover-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    color: rgba(255,255,255,0.55);
}

.badge-vip {
    background: var(--accent-fill);
    color: #111;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.badge-free {
    background: rgba(255,255,255,0.15);
    color: #fff;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.set-info {
    padding: 10px 12px 12px;
}

.set-info h3 {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 5px;
}

.set-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.set-category {
    color: var(--accent);
    font-weight: 500;
}

/* ===== 分页 ===== */
.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px 0 40px;
}

.pagination a,
.pagination span {
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
}

.pagination a {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    transition: all 0.2s;
}

.pagination a:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.pagination span {
    color: var(--text-muted);
}

.pagination .page-current {
    background: var(--accent-fill);
    color: #111;
    border-radius: var(--radius-sm);
    padding: 7px 14px;
    font-size: 0.85rem;
    font-weight: 700;
}

.pagination .page-ellipsis {
    padding: 7px 6px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ===== 套图详情页 ===== */
.page-jump { display: flex; align-items: center; gap: 8px; }
.page-jump label { display: flex; align-items: center; gap: 8px; color: var(--text-secondary); font-size: .85rem; }
.page-jump input[type="number"] { width: 76px; min-height: 38px; padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-card); color: var(--text-primary); font: inherit; }
.page-jump button { min-height: 38px; padding: 6px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-card); color: var(--text-primary); cursor: pointer; }
.page-jump button:hover, .page-jump input:focus-visible { border-color: var(--accent); }
.pagination .page-jump-total { padding: 0; }
.pagination .pagination-status { flex-basis: 100%; text-align: center; color: var(--text-secondary); }
.pagination-status[hidden] { display: none; }

.set-detail-header {
    container-type: inline-size;
    padding: 28px 0 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
    min-width: 0;
}

.set-detail-header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 8px;
    line-height: 1.35;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.set-detail-subheading {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px 16px;
}

.set-detail-subheading > .set-detail-meta {
    flex: 1 1 0;
    min-width: 0;
    overflow-wrap: anywhere;
}

.set-detail-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-shrink: 0;
    gap: 12px;
    margin-left: auto;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.set-detail-actions .set-detail-action {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 28px;
    padding: 4px 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    white-space: nowrap;
    cursor: pointer;
}

/* Reserve both translated labels so toggling cannot shift the star. */
.set-detail-actions .favorite-btn {
    display: inline-grid;
    grid-template-columns: 20px auto;
    transform: none;
}
.set-detail-actions .favorite-btn svg { grid-area: 1 / 1; }
.set-detail-actions .favorite-btn .set-detail-action-label,
.set-detail-actions .favorite-btn::before,
.set-detail-actions .favorite-btn::after { grid-area: 1 / 2; }
.set-detail-actions .favorite-btn::before {
    content: attr(data-added-text);
    visibility: hidden;
}
.set-detail-actions .favorite-btn::after {
    content: attr(data-removed-text);
    visibility: hidden;
}

.set-detail-actions .set-detail-action:hover,
.set-detail-actions .set-detail-action[aria-pressed="true"] {
    color: var(--accent);
}

.set-detail-action:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.set-detail-action svg {
    color: #facc15;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.set-detail-action[aria-pressed="true"] svg {
    fill: currentColor;
}

@container (max-width: 720px) {
    .set-detail-action-label,
    .set-detail-actions .favorite-btn::before,
    .set-detail-actions .favorite-btn::after { display: none; }
    .set-detail-actions .favorite-btn { grid-template-columns: 20px; }
    .set-detail-actions .set-detail-action { padding: 4px; }
}

@media (max-width: 768px) {
    .set-detail-action-label,
    .set-detail-actions .favorite-btn::before,
    .set-detail-actions .favorite-btn::after { display: none; }
    .set-detail-actions .favorite-btn { grid-template-columns: 20px; }
    .set-detail-actions { font-size: 0.8rem; }
    .set-detail-actions .set-detail-action { padding: 4px; }
}

.set-detail-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.85rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.set-detail-meta .set-category-link {
    color: var(--accent);
    font-weight: 500;
}

.membership-notice {
    background: rgba(245, 245, 0, 0.06);
    border: 1px solid var(--border-accent);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.membership-notice p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.gallery-grid {
    /* 桌面端大图最大宽度。.container 内宽约 1360px (1400 - 20*2 padding)，
       这里留约 80px 呼吸感。原值 900px 显得过窄。
       移动端断点 (max-width:768px) 在下方覆盖为 100%。 */
    max-width: var(--content-max-width);
    margin: 0 auto 32px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    min-width: 0;
}

.gallery-item {
    position: relative;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-panel);
    cursor: pointer;
    transition: all 0.25s;
    width: 100%;
    min-width: 0;
}

.gallery-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* ── 详情页 masonry 瀑布流 ──────────────────────────────────────
   四条要求同时满足（行优先、无缝、加载不跳动、不裁剪），前提是模板能写出
   aspect-ratio（即 images.width/height 有值，2026-08-15 回填后 99.49%）。
   ★ 刻意不放进 @media (min-width:769px)：masonry.js 在所有宽度都会跑并设
     transform，CSS 只在桌面生效的话手机端会整片图叠在一起。
     手机端由 JS 算出 1 列，视觉上与单列一致。
   ★ 与 .sets-grid 那套保持一致：容器 block + relative（高度由 JS 设），
     条目 absolute（width / transform 由 JS 实时设置）。 */
.gallery-grid--masonry {
    display: block;
    position: relative;
}
/* ★ JS 跑之前的形态。masonry.js 在 DOMContentLoaded 之后才执行，在那之前
   条目还在正常文档流里 —— 若不管，每张图按 aspect-ratio 撑成整个容器宽
   （1240px）竖着堆一列，浏览器会把这一帧画出来，然后 JS 一跑跳到两列，
   表现为「加载瞬间图片堆积」（用户 2026-08-16 反馈）。
   这里先用同列数、同为行优先的 grid 顶上，两者位置已经很接近，
   masonry 接手时只是把参差的行底收平，几乎看不出切换。
   ★ 刻意不用「先隐藏、跑完再显示」：JS 一旦失败或被拦截，
     整个图片墙就永远不显示了。这个 grid 同时也是 JS 不可用时的最终形态。 */
.gallery-grid--masonry:not(.js-masonry) {
    display: grid;
    grid-template-columns: repeat(var(--gallery-cols, 2), minmax(0, 1fr));
    gap: 16px;
    align-items: start;
}
@media (max-width: 768px) {
    /* 手机端 masonry 走单列（见 masonry.js），预排布也要跟着单列，
       否则会先闪一下两列再变单列。 */
    .gallery-grid--masonry:not(.js-masonry) {
        grid-template-columns: 1fr;
    }
}
/* ★ 没有尺寸时的兜底比例。模板只给有 width/height 的图写内联 aspect-ratio；
   没写的格子在 masonry 的绝对定位下高度就是 0（图片没加载时），
   于是全部排在同一个 y 上 —— 表现为「加载时图片挤在一起」。
   内联样式优先级高于这里，有尺寸的图不受影响。
   默认取 GALLERY_CELL_RATIO（2/3）：实测全站宽高比 0.67 占 52%，最接近的猜测。 */
.gallery-grid--masonry > .gallery-item {
    aspect-ratio: var(--gallery-cell-ratio, 2 / 3);
}
.gallery-grid--masonry.js-masonry > .gallery-item,
.gallery-grid--masonry.js-masonry > .ad-slot-in_gallery {
    position: absolute;
    top: 0;
    left: 0;
    margin: 0;
    /* ★ masonry 定位不能走过渡动画。.gallery-item 基础规则里有
       `transition: all 0.25s`，而 masonry 靠改 width 和 transform 定位 ——
       transition:all 会把「定位」本身变成动画。实测 67 个格子上挂了约 870 条
       CSSTransition，渲染被节流时全部停在 offset 0（width 仍 100%、transform
       仍 none），布局完全不生效；正常浏览器里则是每次重排抖 250ms。
       .sets-grid 那边用 `:not(.js-masonry)` 限定悬停位移，是同一类问题。 */
    transition: none;
}
/* aspect-ratio 定住格子高度后图片要正好填满，否则底部露出 --bg-panel。
   ★ 不用 object-fit:cover —— 那是裁剪，用户明确禁止。
     比例就来自这张图自己的宽高，所以 height:auto 正好等于格子高度。 */
.gallery-grid--masonry > .gallery-item img {
    width: 100%;
    height: auto;
    display: block;
}

/* ── 详情页图片墙版式（由 config.GALLERY_LAYOUT 选择）─────────────
   .gallery-grid 的基础规则（上方 flex column）就是 single 版式。
   下面两个修饰类只在桌面生效 —— 手机端本来就健康（0.65 屏/图、20.2 屏到底），
   不参与版式切换。断点 769px 与已有的 max-width:768px 块互斥。 */
@media (min-width: 769px) {
    .sets-grid:not(.js-masonry) { gap: 12px; }

    /* two-column：等宽两列。
       代价是横竖图配对必然错高（实测行内留白 17.8%、最大单处 357px）。 */
    .gallery-grid--two-column {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
        /* 不可省：grid 默认 align-items:stretch 会把矮图拉到整行高，
           露出 .gallery-item 的 --bg-panel 底色。 */
        align-items: start;
    }
    /* 广告位占满整行，否则会塌成半宽单元格和图片挤在一行。 */
    .gallery-grid--two-column > .ad-slot-in_gallery {
        grid-column: 1 / -1;
    }

    /* waterfall：CSS 多列瀑布流。高矮不齐自然错落，没有行内留白。
       用 columns 简写（列宽 + 列数上限）而不是单给 column-count ——
       列宽是下限，窄屏放不下就自动降列，不必再写一堆断点。
       ★ 列优先填充：图 1..N/3 全在第一列。顺序浏览靠灯箱。 */
    .gallery-grid--waterfall {
        display: block;                 /* 覆盖基础规则的 flex */
        columns: 280px var(--gallery-cols, 3);
        column-gap: 16px;
    }
    /* column-gap 只管列间距，行间距得靠子元素 margin-bottom。
       inline-block + break-inside:avoid 是站内 .image-card 已在用的写法 ——
       Chrome 上只给 break-inside 有时不生效。 */
    .gallery-grid--waterfall > .gallery-item,
    .gallery-grid--waterfall > .ad-slot-in_gallery {
        display: inline-block;
        width: 100%;
        margin: 0 0 16px;
        break-inside: avoid;
    }
    /* 瀑布流里让广告位撑满列宽（基础规则是 fit-content 收缩到素材）。
       这三条与基础规则重复，留着是为了「就算基础规则以后又加回卡片外观，
       瀑布流里也不会冒出边框」。 */
    .gallery-grid--waterfall > .ad-slot-in_gallery {
        max-width: none;
        border: 0;
        padding: 0;
    }

    /* grid-uniform：等比格子。行优先、无缝隙、加载不跳动 ——
       因为格子高度由 aspect-ratio 定死，不依赖图片加载。
       代价是 object-fit:cover 会按统一比例裁剪，比例可配。 */
    .gallery-grid--grid-uniform {
        display: grid;
        grid-template-columns: repeat(var(--gallery-cols, 2), 1fr);
        gap: 16px;
    }
    .gallery-grid--grid-uniform > .gallery-item {
        aspect-ratio: var(--gallery-cell-ratio, 2/3);
        overflow: hidden;
    }
    /* 基础规则里 .gallery-item img 是 height:auto，那样图不会填满定高的格子，
       底部会露出 --bg-panel。这里必须撑满并裁剪。 */
    .gallery-grid--grid-uniform > .gallery-item img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    .gallery-grid--grid-uniform > .ad-slot-in_gallery {
        grid-column: 1 / -1;
    }
}

.gallery-item img {
    width: 100%;
    display: block;
    transition: transform 0.3s, filter 0.5s;
    max-width: 100%;
    height: auto;
}

.progressive-img {
    transform: scale(1.02);
    transition: transform 0.3s, filter 0.5s, opacity 0.25s ease;
}

.progressive-img.loaded {
    transform: scale(1);
}

/* Fade a decoded original over the existing preview without clearing its pixels. */
.gallery-item img.gallery-original-layer {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.12s ease;
}
.gallery-item img.gallery-original-layer--visible { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
    .gallery-item img.gallery-original-layer { transition: none; }
}

/* Detail photos must remain whole, including loading and hover states. */
.set-detail-page .gallery-item img {
    object-fit: contain;
    transform: none !important;
}

.gallery-item[data-image-unavailable="1"] {
    display: none !important;
}

/* Locked images: initial progressive blur, then locked blur stays */
.gallery-item-locked .blurred {
    filter: blur(8px);
}

.gallery-item-locked .blurred.loaded {
    filter: blur(var(--locked-blur));
}

.gallery-item:hover img {
    transform: scale(1.01);
}

.gallery-item-locked {
    position: relative;
}

.lock-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.45);
    color: var(--text-secondary);
    font-size: 12px;
    gap: 6px;
}

.lock-icon {
    font-size: 22px;
    opacity: 0.7;
}

.preview-mask {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.35);
    pointer-events: none;
}

.preview-mask-text {
    color: rgba(255, 255, 255, 0.85);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.unlock-cta {
    text-align: center;
    padding: 48px 20px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 40px;
}

.unlock-cta h3 {
    font-size: 1.3rem;
    margin-bottom: 8px;
}

.unlock-cta p {
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-size: 0.9rem;
}

/* ===== 同名模特推荐 ===== */
.related-sets {
    margin-top: 56px;
    padding-top: 32px;
    border-top: 1px solid var(--border);
}

.related-sets-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.related-sets-title {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 0;
    color: var(--text-primary);
}

.related-sets-title::before {
    content: '';
    display: inline-block;
    width: 3px;
    height: 1em;
    background: var(--accent-fill);
    border-radius: 2px;
    margin-right: 10px;
    vertical-align: middle;
}

.related-sets-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* "浏览更多 →"按钮：与 facet 切换按钮区分开，靠右且独立样式 */
.related-sets-filters .related-more-link {
    margin-left: auto;
    font-size: 0.82rem;
    color: var(--text-muted);
    border: 1px dashed var(--border);
}
.related-sets-filters .related-more-link:hover {
    color: var(--accent);
    border-color: var(--accent);
}

/* 详情页"更多推荐"固定 4×2 网格。
   与首页瀑布流 .sets-grid 区分：这里强调一致性，每张卡 aspect-ratio 固定，
   不做高度自适应。最多 8 张（模板里 [:8] 切片保证）。
   响应式：>1024px 4列；769-1024px 3列；481-768px 3列；<=480px 2列。 */
.related-grid-fixed {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.related-grid-fixed .set-card {
    /* 覆盖全局 .set-card 的 absolute 定位规则，回到 grid 单元格自然布局 */
    position: static;
    width: auto;
    margin: 0;
    transform: none;
}

.related-grid-fixed .set-cover {
    /* 强制统一长宽比，inline aspect-ratio 不生效 */
    aspect-ratio: 3 / 4 !important;
}

.related-grid-fixed .set-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

@media (max-width: 1024px) {
    .related-grid-fixed { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 480px) {
    .related-grid-fixed { grid-template-columns: repeat(2, 1fr); }
}

/* ===== 表单 ===== */
.form-page {
    min-height: calc(100vh - 56px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.form-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 420px;
}

.form-container h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 28px;
    text-align: center;
}

.form-container h2 span {
    color: var(--accent);
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.form-control::placeholder { color: var(--text-muted); }

.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-dim);
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.form-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.form-footer a {
    color: var(--accent);
    font-weight: 600;
}

/* ===== 会员套餐页 ===== */
.membership-hero {
    text-align: center;
    padding: 48px 20px 36px;
}

.membership-hero h1 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.membership-hero h1 span { color: var(--accent); }

.membership-hero p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.membership-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    max-width: 1100px;
    margin: 0 auto 48px;
    padding: 0 20px;
}

.membership-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px 20px;
    text-align: center;
    transition: all 0.25s;
    position: relative;
}

.membership-card:hover {
    border-color: rgba(245,245,0,0.3);
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.membership-card.featured {
    border-color: var(--accent);
    background: linear-gradient(135deg, #1e1e00 0%, var(--bg-card) 100%);
}

.membership-card.featured::before {
    content: '推荐';
    position: absolute;
    top: -1px;
    right: 24px;
    background: var(--accent-fill);
    color: #111;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 0 0 6px 6px;
}

.membership-card h3 {
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.price {
    font-size: 2.8rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1;
}

.price span {
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--text-muted);
}

.membership-card ul {
    list-style: none;
    margin: 20px 0 28px;
    text-align: left;
}

.membership-card ul li {
    padding: 7px 0;
    font-size: 0.88rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
}

.membership-card ul li::before {
    content: '✓';
    color: var(--accent);
    font-weight: 700;
    flex-shrink: 0;
}

.membership-card ul li:last-child { border-bottom: none; }

/* ===== FAQ ===== */
.faq-section {
    max-width: 760px;
    margin: 0 auto 60px;
    padding: 0 20px;
}

.faq-section h2 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 24px;
    text-align: center;
    color: var(--text-secondary);
}

.faq-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px 24px;
    margin-bottom: 12px;
}

.faq-item h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.faq-item p {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.7;
}

/* ===== 图片详情 ===== */
.image-detail {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 32px;
    padding: 24px 0;
}

.image-main img {
    width: 100%;
    border-radius: var(--radius-md);
    display: block;
}

.image-sidebar {
    padding: 0;
}

.image-sidebar h1 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.image-actions {
    display: flex;
    gap: 10px;
    margin: 20px 0;
    flex-wrap: wrap;
}

/* ===== 图片卡片（搜索/收藏页） ===== */
.images-grid {
    column-count: 4;
    column-gap: 14px;
    margin-bottom: 40px;
}

@media (max-width: 1200px) { .images-grid { column-count: 3; } }
@media (max-width: 768px) { .images-grid { column-count: 2; } }
@media (max-width: 480px) { .images-grid { column-count: 1; } }

.image-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border);
    margin-bottom: 14px;
    break-inside: avoid;
    display: inline-block;
    width: 100%;
    transition: all 0.25s;
}

.image-card:hover {
    border-color: rgba(245,245,0,0.2);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.image-card img {
    width: 100%;
    display: block;
}

.image-card-info {
    padding: 10px 12px;
}

.image-card-info h3 {
    font-size: 0.85rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== 页脚 ===== */
.footer {
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    padding: 20px 0;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ===== 页脚合规链接（常驻，不限 free 模式）===== */
.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
}
.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.15s;
}
.footer-links a:hover { color: var(--accent); }
.footer-age-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border: 1px solid var(--border-accent, var(--accent));
    border-radius: var(--radius-sm, 4px);
    color: var(--accent);
    font-weight: 700;
    font-size: 0.72rem;
    letter-spacing: 0.5px;
}

/* ===== 广告位（仅 free_ad_mode 渲染，回滚自动消失）===== */
.ad-slot {
    margin: 16px 0;
    text-align: center;
    overflow: hidden;
}
/* Separate content scaling from the slot transform used by masonry. */
.ad-fit-content {
    display: flow-root;
}
/* 素材拉伸到容器宽度。启用的槽位由 config.AD_STRETCH_SLOTS 决定。
   renderBanner 给 <img> 的内联样式是 max-width:100%;height:auto，没有设 width，
   所以这里的 width 不需要 !important 就能生效（两者是不同属性，不冲突）。
   ★ 这是放大素材：728->1240 是 1.70x、900->1240 是 1.38x，会发虚；
     且广告网络通常要求按原尺寸展示。默认关闭，由 .env 显式开启。
   ★ 只对 NeverBlock 渲染的 <img> 生效 —— 降级注入的 <ins>+脚本由 ExoClick
     自己出 iframe，我们的 CSS 管不到。 */
.ad-slot-stretch img {
    width: 100%;
    height: auto;
}
/* 顶/底广告位【刻意】不限宽 —— 它们要跟【页面】同宽（撑满 .container，
   宽屏下比图片墙更宽）。这是用户 2026-08-15 明确的预期，别再给它们加
   max-width 去对齐图片墙：那样宽屏下会比页面窄一圈。
   与图片同宽的是 in_gallery（见下方 .ad-slot-in_gallery）。 */
.ad-slot-detail_top { margin: 12px 0 20px; }
.ad-slot-detail_mid { margin: 24px 0; }
/* 图集流内嵌广告：居中限宽的赞助卡，融入全宽大图流 */
.ad-slot-in_gallery {
    /* ★ 盒子收缩到素材本身，不要卡片外观。
       原先是 width:100% + max-width:600px + --bg-panel 底色 + 描边 + 12px 内边距
       （本意「让赞助卡视觉融入」），但素材实际只有 300×250，两侧各露出 150px
       面板底色，看起来就是广告四周镶了一圈黑边。2026-08-15 按用户要求去掉。 */
    width: fit-content;
    max-width: 100%;
    margin: 16px auto;          /* 上下间距 + 水平居中 */
    text-align: center;
    min-height: 0;
    background: transparent;
    border: 0;
    padding: 0;
    box-sizing: border-box;
}
/* 槽位里是 Recommendation Widget（网格）时，fit-content 会让网格按内容
   收缩、宽度不可预期，网格就没意义了 —— 这时改成撑开并限宽居中。
   仍是单张横幅时保持上面的 fit-content（盒子贴着素材，四周无边）。
   :has() 不被支持时整条失效，退回 fit-content，是退化不是崩坏。 */
.ad-slot-in_gallery:has(.nb-native-grid) {
    width: 100%;
    max-width: 728px;
}
/* 拉伸开启时（AD_STRETCH_SLOTS 含 in_gallery）撑满父容器 —— 它本来就在
   .gallery-grid 里，撑满即自动等于图片宽度，图片墙宽度怎么变它就怎么跟，
   不需要写死数值。
   ★ 必须用双类提高优先级：上面的 width:fit-content（为消除四周黑边而设）
     在源码里排在 .ad-slot-stretch 之后，同为单类选择器时后者盖不住它。 */
.ad-slot-in_gallery.ad-slot-stretch {
    width: 100%;
    max-width: none;
}
/* 列表页内嵌广告：占满整行。
   非 JS-masonry（fallback）时为块级全宽，JS 失败也不错位。 */
.ad-slot-list_inline {
    display: block;
    width: 100%;
    margin: 8px 0;
    text-align: center;
    min-height: 0;
}
/* JS masonry 模式：广告位切到 absolute，width / transform 由 masonry.js 设置
   （与 .sets-grid.js-masonry .set-card 一致）。 */
.sets-grid.js-masonry .ad-slot-list_inline {
    position: absolute;
    top: 0;
    left: 0;
    margin: 0;
}
/* 临时止血（2026-06-19）：mobile_sticky 是 728×90 横幅，手机端过宽、关闭按钮被挤出视口。
   移动专用 zone 上线前，先在手机端隐藏此广告位。桌面端不受影响。 */
@media (max-width: 767px) {
    .ad-slot-mobile_sticky { display: none !important; }
}

/* ===== 移动端底部横幅 mobile_banner（300×50，仅手机显示）=====
   桌面端默认 display:none；手机端 fixed 底部居中，配自定义关闭按钮 + cookie 记忆。
   解决 728×90 sticky 在手机端过宽、ExoClick 自带关闭按钮被挤出视口点不到的问题。 */
.mobile-banner-wrap {
    display: none;  /* 桌面端不显示 */
}
/* hidden 属性优先级兜底：JS 控制显隐时，有 hidden 必须不显示 */
.mobile-banner-wrap[hidden] {
    display: none !important;
}
.mobile-banner-close[hidden] {
    display: none !important;
}
@media (max-width: 767px) {
    body.nav-drawer-open .mobile-banner-wrap,
    body.nav-drawer-open .ad-slot-mobile_sticky {
        visibility: hidden !important;
        pointer-events: none !important;
    }
    /* 手机端显示：fixed 底部居中，z-index 9998 在年龄弹窗 9999 之下 */
    .mobile-banner-wrap {
        position: fixed;
        bottom: 0;
        left: 50%;
        transform: translateX(-50%);
        z-index: 9998;
        display: flex;
        align-items: center;
        /* width:max-content 不可删：只给 left:50% 而不给 width 时，
           shrink-to-fit 的可用宽度是「视口 − left」= 半个视口，
           300×50 的素材会被 max-width:100% 压成 180×30（面积仅 36%）。
           max-width 用 100% 不用 100vw —— 后者含滚动条宽，桌面端会撑出横向滚动。 */
        width: max-content;
        max-width: 100%;
        padding: 4px;
    }
    /* 关闭按钮：圆形深色半透明，白色 ×，min 28×28 够大易点，叠在广告之上 */
    .mobile-banner-close {
        position: absolute;
        top: -12px;
        right: -2px;
        width: 28px;
        height: 28px;
        min-width: 28px;
        min-height: 28px;
        padding: 0;
        border: none;
        border-radius: 50%;
        background: rgba(0, 0, 0, 0.75);
        color: #fff;
        font-size: 20px;
        line-height: 28px;
        text-align: center;
        cursor: pointer;
        z-index: 1;  /* 高于同容器内广告 */
    }
    /* 广告本体：宽度约束不溢出，居中 */
    .mobile-banner-ad {
        max-width: 320px;
        margin: 0 auto;
        overflow: hidden;
    }
}

/* ===== 年龄确认弹窗（18+，仅 free_ad_mode）===== */
.age-gate-open { overflow: hidden; }
.age-gate {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(4px);
}
.age-gate[hidden] { display: none; }
.age-gate-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md, 8px);
    padding: 32px 28px;
    max-width: 420px;
    width: 100%;
    text-align: center;
    box-shadow: var(--shadow-hover, 0 12px 40px rgba(0,0,0,0.5));
}
.age-gate-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 14px;
    color: var(--text-primary);
}
.age-gate-text {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 24px;
}
.age-gate-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.age-gate-actions .btn { width: 100%; }

/* ===== 合规静态页（隐私 / 内容声明）===== */
.legal-page {
    max-width: 760px;
    margin: 0 auto;
    padding: 48px 20px 64px;
    color: var(--text-secondary);
    line-height: 1.85;
}
.legal-page h1 {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 8px;
}
.legal-page .legal-updated {
    color: var(--text-muted);
    font-size: 0.82rem;
    margin-bottom: 32px;
}
.legal-page h2 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 32px 0 12px;
}
.legal-page p { margin-bottom: 14px; }
.legal-page ul {
    margin: 0 0 14px 20px;
    list-style: disc;
}
.legal-page li { margin-bottom: 8px; }

/* ===== 空状态 ===== */
.no-content {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 0.9rem;
    grid-column: 1 / -1;
}

/* ===== 加载动画 ===== */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .sets-grid {
        columns: unset;
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 10px;
    }
    .set-card {
        display: block;
        margin-bottom: 0;
    }
    .set-cover {
        aspect-ratio: 3/4 !important;
    }
    .set-cover img {
        height: 100%;
        object-fit: cover;
    }

    .hero h1 { font-size: 1.6rem; }

    .navbar .container {
        height: 56px;
        min-height: 56px;
    }

    .nav-logo {
        height: 34px;
    }

    .nav-search {
        flex: 0 0 auto;
        margin-left: auto;
        position: static;
    }

    .nav-search-form {
        width: min(260px, calc(100vw - 130px));
    }

    .nav-search-form.expanded {
        width: min(260px, calc(100vw - 130px));
    }

    .nav-search-btn {
        padding: 0 12px;
    }

    .nav-search.expanded .nav-search-form {
        position: absolute;
        left: 12px;
        right: 12px;
        top: 50%;
        transform: translateY(-50%);
        width: auto;
        background: var(--bg-surface);
        z-index: 5;
    }

    .navbar.nav-search-open .nav-brand,
    .navbar.nav-search-open .nav-menu-toggle {
        visibility: hidden;
    }

    .nav-menu {
        display: none;
    }



    .nav-menu-toggle {
        display: flex;
    }

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

    .membership-cards {
        grid-template-columns: 1fr;
    }

    .set-detail-page {
        padding-left: 12px;
        padding-right: 12px;
        overflow-x: hidden;
    }

    .set-detail-header {
        padding: 18px 0 14px;
        margin-bottom: 16px;
    }

    .set-detail-header h1 {
        font-size: 1.18rem;
        line-height: 1.4;
    }

    .set-detail-meta {
        gap: 8px 12px;
        font-size: 0.8rem;
    }

    .gallery-grid {
        max-width: 100%;
        gap: 12px;
        margin-bottom: 24px;
    }

    .gallery-item {
        border-radius: var(--radius-md);
    }
}

@media (max-width: 480px) {
    .sets-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
/* ===== 两栏布局 ===== */
.content-layout {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

/* ===== 横向分类栏 ===== */
.category-bar-wrap {
    padding: 10px 0 14px;
}

.category-bar {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 0;
    scrollbar-width: none;
}

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

.category-tab {
    display: inline-block;
    padding: 6px 20px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    transition: all 0.15s;
    flex-shrink: 0;
}

.category-tab:hover {
    color: var(--text-primary);
    border-color: var(--text-muted);
}

.category-tab.active {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-dim);
    font-weight: 600;
}

/* 三层筛选：分类/模特/发布商，行首带标签 */
.filter-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.filter-row:last-child { margin-bottom: 0; }
.filter-label {
    flex-shrink: 0;
    font-size: 0.8rem;
    color: var(--text-muted);
    width: 48px;
    text-align: right;
}
.category-tab-more {
    color: var(--accent);
    border-color: var(--accent);
    border-style: dashed;
}

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

/* ===== 排序栏 ===== */
.sort-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.total-count {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.sort-links {
    display: flex;
    gap: 6px;
}

.sort-link {
    background: none;
    cursor: pointer;
    font-family: inherit;
    padding: 3px 12px;
    border-radius: 4px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    transition: all 0.15s;
}

.sort-link:hover,
.sort-link.active {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-dim);
}

/* ===== 图片灯箱 ===== */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    z-index: 10001;
    background: #000;
    overflow: hidden;
    animation: lbFadeIn 0.2s ease;
}
@keyframes lbFadeIn { from { opacity: 0; } to { opacity: 1; } }

.lightbox-overlay.closing {
    animation: lbFadeOut 0.15s ease forwards;
}
@keyframes lbFadeOut { from { opacity: 1; } to { opacity: 0; } }

.lightbox-track {
    display: flex;
    width: 300vw;
    height: 100vh;
    transform: translateX(-100vw);
}

.lightbox-slide {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.lightbox-slide img {
    max-width: 100vw;
    max-height: 100vh;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
}

.lightbox-close {
    position: fixed;
    top: 8px;
    right: 72px;
    background: none;
    border: none;
    color: #fff;
    font-size: 36px;
    cursor: pointer;
    padding: 4px 12px;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.15s;
    z-index: 10002;
    text-shadow: 0 1px 4px rgba(0,0,0,0.6);
}
.lightbox-close:hover { opacity: 1; }

.lightbox-nav {
    /* Prevent mobile tap feedback from painting the full-height hit area. */
    -webkit-tap-highlight-color: transparent;
    position: fixed;
    top: 0;
    bottom: 0;
    width: 64px;
    background: none;
    border: none;
    color: #fff;
    font-size: 48px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.5;
    transition: opacity 0.15s;
    z-index: 10002;
    user-select: none;
    text-shadow: 0 1px 6px rgba(0,0,0,0.5);
    padding: 0;
}
.lightbox-nav:hover { opacity: 0.9; }

.lightbox-prev { left: 0; }
.lightbox-next { right: 0; }

.lightbox-info {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 24px 16px 16px;
    background: linear-gradient(to top, rgba(0,0,0,0.6), transparent);
    color: #fff;
    text-align: center;
    font-size: 0.9rem;
    z-index: 10002;
    pointer-events: none;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .lightbox-nav { width: 48px; font-size: 36px; opacity: 0.4; }
    .lightbox-close { font-size: 30px; top: 4px; right: 56px; }
    .lightbox-info { font-size: 0.82rem; padding: 16px 12px 12px; }
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .category-tab { min-height: 44px; display: inline-flex; align-items: center; padding: 0 14px; font-size: 0.82rem; }
}

/* ── NeverBlock native_ad（list_inline）────────────────────────
   镜像 .set-card 的观感：满铺方图 + 标题叠在底部渐变上。
   ★ 不要照「整行满宽」去设计：.ad-slot-list_inline 只有在 masonry 没跑起来的
     fallback 分支才是整行，真实布局里 masonry.js 把它切成 absolute 并给一列
     的宽度（实测 297px，与 .set-card 同宽）。max-width 是给那条 fallback 兜底的。
   ★ 图框 1:1 —— ExoClick 这个 zone 实际发 300×300 方图（2026-08-14 实测），
     按 16:10 之类开框会被 object-fit:cover 上下各裁掉约三分之一。 */
/* Recommendation Widget 的容器。
   --nb-cols 来自 ExoClick 的 zone 配置（layout.itemsPerRow），经代理传进来。

   ★ 它是【上限】不是硬性值。这个版位在 masonry 里只有一列宽（实测 301px），
     照 itemsPerRow=5 硬排每张卡只剩 54×54px，标题全截断、不可用。
     所以每列先取「按 itemsPerRow 均分的宽度」与 110px 的较大者作为下限，
     再让 auto-fit 决定实际放得下几列：
       1240px 槽位 + cols=5 → 下限 241px → 排 5 列
       301px  槽位 + cols=5 → 下限 110px → 排 2 列，5 条折成 3 行
   ★ 必须纯 CSS。用 JS 读 el.clientWidth 会踩时序坑 —— neverblock.js 可能
     先于 masonry.js 跑，那时槽位还是整块宽度，会算出 5 列然后被缩回 301px。 */
.nb-native-grid {
    position: relative;
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(auto-fit, minmax(
        max(110px, calc((100% - (var(--nb-cols, 1) - 1) * 8px) / var(--nb-cols, 1))),
        1fr));
}
.nb-native {
    display: block;
    position: relative;
    margin: 0 auto;
    width: 100%;
    text-decoration: none;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}
.nb-native-img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
}
.nb-native-body {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 40px 10px 10px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.88));
    display: flex;
    flex-direction: column;
    gap: 3px;
    text-align: left;
}
/* 描述与品牌单行截断；标题允许两行。
   ★ 标题不能也用单行：广告标题长度完全不受我们控制，之前靠容器查询按卡片
     宽度调字号来避让，是在追像素阈值 —— 实测 163px 卡片刚好越过 160px 阈值，
     标题又被切掉。两行 + 行尾省略号对任何宽度、任何长度都成立。
   遮罩是绝对定位的，标题多一行只会往上长，不会把卡片顶变形。 */
.nb-native-desc,
.nb-native-brand {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nb-native-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.nb-native-title { font-size: 0.85rem; font-weight: 600; color: #fff; }
/* 窄卡片下把文字收小，否则一行塞不下几个字。
   ★ 容器查询必须挂在【卡片】上，不是网格上：决定文字放不放得下的是卡片宽度。
     实测 640px 网格排 5 列时卡片只有 122px，按网格宽度判断（640 > 阈值）
     字号不会收，标题照样截断。
   ★ 也不能用视口媒体查询：同一视口下首页的窄槽位（301px）和详情页的宽槽位
     要有不同表现。 */
.nb-native { container-type: inline-size; }
@container (max-width: 160px) {
    .nb-native-body { padding: 24px 6px 6px; gap: 2px; }
    .nb-native-title { font-size: 0.72rem; }
    .nb-native-desc { font-size: 0.65rem; }
    .nb-native-brand { font-size: 0.6rem; }
}
@container (max-width: 125px) {
    .nb-native-body { padding: 18px 4px 4px; }
    .nb-native-title { font-size: 0.62rem; }
    .nb-native-desc { display: none; }   /* 这么窄放不下第二行，只留标题和品牌 */
}
.nb-native-desc { font-size: 0.75rem; color: rgba(255, 255, 255, 0.75); }
.nb-native-brand { font-size: 0.7rem; color: rgba(255, 255, 255, 0.55); }
/* 广告角标：卡片刻意像站内内容，这个标识就不能省。
   挂在 .nb-native-grid 容器右上角，不是每张卡一个。 */
.nb-native-label {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 11px;
    line-height: 1;
    padding: 3px 6px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.62);
    color: rgba(255, 255, 255, 0.85);
    letter-spacing: .5px;
}

/* Image zoom stays inside its slide, below the viewer controls. */
.lightbox-slide { overflow: hidden; touch-action: none; }
.lightbox-slide img { transform-origin: center; }
.lightbox-slide.is-zoomed { cursor: grab; }
.lightbox-slide.is-zoomed:active { cursor: grabbing; }
.lightbox-zoom {
    position: fixed; top: 12px; left: 50%; transform: translateX(-50%);
    z-index: 10003; display: flex; gap: 4px; border-radius: 8px;
    padding: 4px; background: rgba(20, 20, 20, .8);
}
.lightbox-zoom button {
    min-width: 44px; min-height: 44px; padding: 4px 8px; border: 0;
    border-radius: 4px; background: transparent; color: white;
    font-size: 18px; cursor: pointer; touch-action: manipulation;
}
.lightbox-zoom button:disabled { opacity: .35; cursor: default; }
.lightbox-zoom button:focus-visible { outline: 2px solid white; }
@media (max-width: 380px) {
    .lightbox-zoom { top: 56px; }
}

/* Feedback remains a private, same-origin document, loaded only on demand. */
.feedback-dialog {
    width: min(560px, calc(100vw - 24px));
    max-height: calc(100dvh - 24px);
    margin: auto;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-base);
    color: var(--text-primary);
    overflow: hidden;
}
.feedback-dialog::backdrop { background: rgba(0, 0, 0, 0.65); }
.feedback-dialog-open { overflow: hidden; }
.feedback-dialog-heading { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.feedback-dialog-heading h2 { margin: 0; font-size: 1rem; }
.feedback-dialog-close { border: 0; background: transparent; color: var(--text-secondary); font-size: 1.5rem; width: 32px; height: 32px; cursor: pointer; }
.feedback-dialog-frame { display: block; width: 100%; height: min(620px, calc(100dvh - 132px)); border: 0; }
.feedback-frame-page .form-page { min-height: 0; padding: 16px; }
.feedback-frame-page .form-container { width: 100%; max-width: none; margin: 0; padding: 0; border: 0; box-shadow: none; background: transparent; }
.feedback-frame-page .form-container h1 { font-size: 1.2rem; }

/* Topic covers retain position order in a fixed four/two-column grid. */
.topic-gallery-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 768px) {
    .topic-gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Mobile UX: keep labels legible and controls independently tappable. */
.return-list{display:inline-flex;align-items:center;min-height:44px;margin-bottom:8px}
.sponsor-entry{min-height:44px;padding:8px 16px;color:var(--text-secondary);background:var(--bg-card);border:1px solid var(--border);border-radius:6px;cursor:pointer}
.sponsor-entry[hidden],.image-retry[hidden],.nb-sticky-close[hidden]{display:none!important}
.image-status-host{position:relative}
.image-retry{position:absolute;top:30%;left:8%;width:84%;z-index:3;min-height:44px;padding:8px;border:1px solid var(--border);border-radius:6px;background:var(--bg-card);color:var(--text-primary);cursor:pointer}
@media(max-width:600px){
 .sort-bar{align-items:stretch;flex-direction:column;gap:8px}
 .sort-links{display:flex;flex-wrap:wrap;gap:6px}
 .sort-links .sort-link{flex:1 1 auto;min-height:44px;display:flex;align-items:center;justify-content:center;white-space:nowrap;padding:6px 10px;box-sizing:border-box}
 .total-count{display:block;align-self:flex-start}
 .mobile-banner-close{min-width:44px;min-height:44px}
}
