:root {
    --primary: #b87d56;
    --primary-dark: #985f3a;
    --primary-light: #fbf2eb;
    --primary-gradient: linear-gradient(135deg, #d69870 0%, #b3734b 100%);
    --accent-gold: #cba258;

    --bg-page: #f8f5f2;
    --bg-card: #ffffff;
    --bg-elevated: #ffffff;
    --bg-glass: rgba(255, 255, 255, 0.94);
    --bg-dark: #12100e;

    --text-title: #221c18;
    --text-body: #483f39;
    --text-muted: #8c7e74;
    --text-light: #b5a89e;

    --border-color: #ede2da;
    --border-subtle: #f4ece6;

    --shadow-subtle: 0 2px 6px rgba(100, 70, 50, 0.04);
    --shadow-card: 0 4px 12px rgba(100, 70, 50, 0.06);
    --shadow-float: 0 12px 32px rgba(60, 40, 30, 0.18);

    --radius-xs: 4px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-full: 9999px;

    --font-heading: 'Cinzel', 'Noto Serif SC', Georgia, serif;
    --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;

    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* 基础重置 */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-page);
    color: var(--text-body);
    line-height: 1.4;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    min-height: 100vh;
}

.pc-only { display: flex; }
.mobile-only { display: none; }

@media (max-width: 768px) {
    .pc-only { display: none !important; }
    .mobile-only { display: flex !important; }
}

.app-root {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ================= 顶部导航栏 (清爽奢雅) ================= */
.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-subtle);
}

.header-inner {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0.65rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.brand-area {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 0;
}

.brand-badge {
    width: 36px;
    height: 36px;
    background: var(--primary-light);
    border: 1px solid rgba(184, 125, 86, 0.2);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.brand-titles {
    display: flex;
    flex-direction: column;
}

.brand-en {
    font-family: var(--font-heading);
    font-size: 0.98rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    color: var(--text-title);
}

.brand-cn {
    font-size: 0.68rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* PC 端版本胶囊 */
.pc-nav-pills {
    display: flex;
    gap: 0.4rem;
    background: #ede3dc;
    padding: 3px;
    border-radius: var(--radius-full);
}

.pc-pill {
    padding: 0.35rem 0.85rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.pc-pill:hover { color: var(--text-title); }
.pc-pill.active {
    background: #fff;
    color: var(--primary-dark);
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.pc-pill-count {
    font-size: 0.68rem;
    background: var(--primary-light);
    color: var(--primary-dark);
    padding: 1px 5px;
    border-radius: var(--radius-full);
}

.pc-pill.active .pc-pill-count {
    background: var(--primary-dark);
    color: #fff;
}

/* 右侧按钮组 */
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.header-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    background: #fff;
    color: var(--text-title);
    border: 1px solid var(--border-color);
    padding: 0.45rem 0.85rem;
    border-radius: var(--radius-full);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.header-btn:hover {
    border-color: var(--primary);
    color: var(--primary-dark);
}

.header-btn.btn-accent {
    background: var(--primary-gradient);
    color: #fff;
    border: none;
    box-shadow: 0 2px 8px rgba(184, 125, 86, 0.3);
}

.header-btn.btn-accent:hover {
    box-shadow: 0 4px 12px rgba(184, 125, 86, 0.4);
    transform: translateY(-1px);
}

/* ================= 手机端版本滚动滑条 ================= */
.mobile-folder-bar {
    position: sticky;
    top: 50px;
    z-index: 90;
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-subtle);
}

.mobile-folder-scroller {
    display: flex;
    overflow-x: auto;
    padding: 0.45rem 0.75rem;
    gap: 0.4rem;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.mobile-folder-scroller::-webkit-scrollbar { display: none; }

.m-folder-chip {
    flex-shrink: 0;
    padding: 0.32rem 0.75rem;
    border-radius: var(--radius-full);
    background: #ede4de;
    color: var(--text-body);
    font-size: 0.76rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.m-folder-chip.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 6px rgba(184, 125, 86, 0.35);
}

/* ================= 快捷过滤胶囊条 ================= */
.filter-strip {
    background: var(--bg-page);
    border-bottom: 1px solid var(--border-subtle);
    padding: 0.4rem 1.25rem;
}

.filter-strip-inner {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.filter-chips {
    display: flex;
    overflow-x: auto;
    gap: 0.35rem;
    scrollbar-width: none;
    padding: 2px 0;
}

.filter-chips::-webkit-scrollbar { display: none; }

.chip-item {
    flex-shrink: 0;
    background: #fff;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.25rem 0.65rem;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all 0.15s ease;
}

.chip-item.active {
    background: var(--text-title);
    color: #fff;
    border-color: var(--text-title);
}

.search-mini {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    padding: 0.25rem 0.65rem;
    flex-shrink: 0;
}

.search-mini input {
    border: none;
    outline: none;
    font-size: 0.75rem;
    width: 120px;
    background: transparent;
    color: var(--text-title);
}

/* ================= 画廊视口与照片卡片 ================= */
.gallery-viewport {
    flex: 1;
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
    padding: 0.75rem 1.25rem 6rem;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}

/* 单张卡片 */
.photo-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-color);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s, border-color 0.25s;
    display: flex;
    flex-direction: column;
    position: relative;
    cursor: pointer;
}

.photo-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(100, 70, 50, 0.12);
    border-color: rgba(184, 125, 86, 0.5);
}

.photo-card.is-selected {
    border: 2px solid var(--primary);
    box-shadow: 0 0 0 3px rgba(184, 125, 86, 0.25);
}

/* 缩略图容器 (支持骨架屏平滑渐显) */
.thumb-box {
    position: relative;
    width: 100%;
    aspect-ratio: 3/4;
    background: linear-gradient(110deg, #ede3da 8%, #f7efe8 18%, #ede3da 33%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s infinite linear;
    overflow: hidden;
}

@keyframes skeletonShimmer {
    to { background-position-x: -200%; }
}

.thumb-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0;
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.thumb-box img.loaded {
    opacity: 1;
}

.photo-card:hover .thumb-box img.loaded {
    transform: scale(1.03);
}

/* 左上角精细勾选圈 */
.pick-checkbox {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 4;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    border: 1.5px solid rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.pick-checkbox:hover {
    transform: scale(1.1);
    border-color: var(--primary);
}

.pick-checkbox.selected {
    background: var(--primary);
    border-color: #fff;
    color: #fff;
    box-shadow: 0 2px 8px rgba(184, 125, 86, 0.6);
}

.pick-checkbox.selected::after {
    content: '✓';
    font-size: 13px;
    font-weight: 900;
}

/* 右上角版本/状态胶囊 */
.card-badge-group {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    align-items: flex-end;
    z-index: 3;
}

.badge-tag {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: var(--radius-full);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.badge-tag.folder-name {
    background: rgba(34, 28, 24, 0.85);
    color: #fff;
}

.badge-tag.multi-version {
    background: var(--primary);
    color: #fff;
}

.badge-tag.status-done {
    background: #27ae60;
    color: #fff;
}

.badge-tag.status-modify {
    background: #e67e22;
    color: #fff;
}

/* 卡片信息 */
.card-info {
    padding: 0.55rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    background: #fff;
}

.card-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.card-filename {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-title);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-stars {
    color: var(--accent-gold);
    font-size: 0.7rem;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.card-note-box {
    font-size: 0.7rem;
    color: var(--text-muted);
    background: #faf5f0;
    padding: 3px 6px;
    border-radius: var(--radius-xs);
    border-left: 2.5px solid var(--primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 空状态 */
.empty-placeholder {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--text-muted);
}

.empty-symbol {
    font-size: 2.8rem;
    margin-bottom: 0.5rem;
}

.empty-title {
    font-size: 1rem;
    color: var(--text-title);
    margin-bottom: 0.25rem;
}

.empty-subtitle {
    font-size: 0.78rem;
}

/* ================= 核心常驻：自选对比悬浮 Dock ================= */
.compare-dock {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 95;
    width: 90%;
    max-width: 520px;
    animation: dockSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes dockSlideUp {
    from { opacity: 0; transform: translateX(-50%) translateY(25px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.dock-inner {
    background: rgba(28, 24, 21, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    color: #fff;
    padding: 0.5rem 0.85rem;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    box-shadow: var(--shadow-float);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.dock-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dock-counter {
    background: var(--primary);
    color: #fff;
    font-weight: 800;
    font-size: 0.75rem;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dock-text {
    display: flex;
    flex-direction: column;
}

.dock-title {
    font-size: 0.78rem;
    font-weight: 700;
}

.dock-subtitle {
    font-size: 0.65rem;
    color: #aaa;
}

.dock-thumbs {
    display: flex;
    align-items: center;
    gap: 4px;
}

.dock-thumb-item {
    position: relative;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-xs);
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.3);
}

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

.dock-thumb-remove {
    position: absolute;
    top: 0;
    right: 0;
    background: rgba(0,0,0,0.7);
    color: #fff;
    width: 12px;
    height: 12px;
    font-size: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.dock-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.dock-btn-clear {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #ccc;
    font-size: 0.72rem;
    padding: 0.3rem 0.6rem;
    border-radius: var(--radius-full);
    cursor: pointer;
}

.dock-btn-go {
    background: var(--primary-gradient);
    border: none;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.32rem 0.8rem;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    gap: 3px;
    cursor: pointer;
}

.dock-btn-go:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ================= 手机端底部导航栏 ================= */
.mobile-tabbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(50px + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 90;
}

.tab-item {
    border: none;
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    padding: 3px 12px;
}

.tab-item.active { color: var(--primary); }

.tab-icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tab-badge {
    position: absolute;
    top: -4px;
    right: -8px;
    background: #e74c3c;
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: var(--radius-full);
}

/* ================= 对比模态框 (卷帘 / 并排 / 闪烁) ================= */
.modal-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(10, 8, 7, 0.92);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.compare-sheet {
    background: #141211;
    color: #fff;
    width: 100vw;
    height: 100vh;
    max-width: 1600px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: none;
}

@media (min-width: 769px) {
    .modal-backdrop {
        padding: 1rem;
    }
    .compare-sheet {
        width: 96vw;
        height: 94vh;
        border-radius: var(--radius-lg);
        box-shadow: 0 25px 60px rgba(0,0,0,0.65);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }
}

.sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 1.25rem;
    background: #1d1917;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sheet-photo-title {
    font-size: 0.95rem;
    font-weight: 700;
}

.sheet-version-tags {
    display: flex;
    gap: 4px;
    margin-top: 2px;
}

.sheet-header-tools {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.mode-pill-group {
    display: flex;
    background: #2d2724;
    padding: 2px;
    border-radius: var(--radius-full);
    gap: 2px;
}

.mode-pill {
    border: none;
    background: transparent;
    color: #bbb;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius-full);
    cursor: pointer;
}

.mode-pill.active {
    background: var(--primary);
    color: #fff;
}

.zoom-reset-btn {
    background: rgba(184, 125, 86, 0.25);
    border: 1px solid var(--primary);
    color: #f7d2b8;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius-full);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 3px;
    animation: fadeIn 0.2s ease;
}

.zoom-reset-btn:hover {
    background: var(--primary);
    color: #fff;
}

.sheet-close-btn {
    background: rgba(255,255,255,0.1);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* 版本选择条 */
.sheet-selector-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.4rem 1rem;
    background: #181514;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    flex-wrap: wrap;
}

.selector-unit {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.selector-unit-label {
    font-size: 0.72rem;
    color: #aaa;
}

.selector-unit select {
    background: #282320;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    outline: none;
    cursor: pointer;
    max-width: 170px;
}

.swap-btn {
    background: #282320;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}

/* 画布视口 */
.sheet-canvas-area {
    flex: 1;
    position: relative;
    background: #0c0a09;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}

.canvas-loader {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.75);
    padding: 0.6rem 1rem;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    z-index: 20;
}

.spin-ring {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.canvas-mode {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 0; left: 0;
}

/* 1. 卷帘滑动对比 */
.slider-stage {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    touch-action: none;
    transform-origin: center center;
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.slider-stage img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    pointer-events: none;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: high-quality;
}

.stage-crop-top {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    clip-path: inset(0 50% 0 0);
    -webkit-clip-path: inset(0 50% 0 0);
    will-change: clip-path;
}

.stage-crop-top .stage-img-top {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: high-quality;
}

.slider-divider {
    position: absolute;
    top: 0; bottom: 0;
    left: 50%;
    width: 40px;
    margin-left: -20px;
    cursor: ew-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    touch-action: none;
}

.divider-line {
    width: 2px;
    height: 100%;
    background: #fff;
    box-shadow: 0 0 8px rgba(0,0,0,0.6);
}

.divider-knob {
    position: absolute;
    width: 32px;
    height: 32px;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4), 0 0 0 2px #fff;
}

.floating-tag {
    position: absolute;
    bottom: 12px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 700;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    backdrop-filter: blur(4px);
    z-index: 5;
    pointer-events: none;
}

.tag-l { left: 12px; }
.tag-r { right: 12px; }

/* 2. 并排对比 */
.mode-side {
    display: flex;
    flex-direction: row;
    width: 100%;
    height: 100%;
    gap: 6px;
    padding: 6px;
    transform-origin: center center;
    will-change: transform;
    touch-action: none;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

@media (max-width: 600px) {
    .mode-side {
        flex-direction: column;
        gap: 6px;
    }
}

.side-cell {
    flex: 1;
    height: 100%;
    min-height: 0;
    position: relative;
    background: #110f0e;
    border-radius: var(--radius-xs);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cell-img-box {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cell-img-box img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: high-quality;
}

.cell-tag {
    position: absolute;
    top: 8px; left: 8px;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    font-size: 0.68rem;
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

/* 3. 闪烁对比 */
.flash-stage {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    transform-origin: center center;
    will-change: transform;
    touch-action: none;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.flash-stage img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.flash-pill-indicator {
    position: absolute;
    bottom: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.82);
    padding: 4px 12px;
    border-radius: var(--radius-full);
    backdrop-filter: blur(8px);
}

.flash-current-badge {
    background: var(--primary);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: var(--radius-full);
}

.flash-tip-text {
    font-size: 0.68rem;
    color: #ddd;
}

/* 底部面板 */
.sheet-footer {
    background: #1c1816;
    padding: 0.6rem 1.1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.footer-control-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.star-rating-box {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.footer-caption {
    font-size: 0.75rem;
    color: #aaa;
}

.star-list {
    display: flex;
    gap: 2px;
}

.star-icon {
    font-size: 1.15rem;
    color: #4a423e;
    cursor: pointer;
}

.star-icon.active { color: var(--accent-gold); }

.status-chip-group {
    display: flex;
    gap: 0.3rem;
}

.status-pill {
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: #282320;
    color: #ccc;
    font-size: 0.72rem;
    padding: 0.25rem 0.55rem;
    border-radius: var(--radius-full);
    cursor: pointer;
}

.status-pill.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.note-input-row {
    display: flex;
    gap: 0.4rem;
}

.note-input-row input {
    flex: 1;
    background: #100e0d;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-sm);
    color: #fff;
    padding: 0.4rem 0.65rem;
    font-size: 0.78rem;
    outline: none;
}

.btn-save-note {
    background: var(--primary-gradient);
    border: none;
    color: #fff;
    padding: 0.4rem 0.85rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
}

/* ================= 通用模态框与表单 ================= */
.dialog-box {
    background: #fff;
    color: var(--text-title);
    width: 92vw;
    max-width: 480px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-float);
}

.dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.dialog-title {
    font-size: 0.95rem;
    font-weight: 700;
}

.dialog-close {
    background: transparent;
    border: none;
    font-size: 1.1rem;
    color: var(--text-muted);
    cursor: pointer;
}

.dialog-body {
    padding: 1.1rem 1.25rem;
}

.dialog-form-item {
    margin-bottom: 0.85rem;
}

.form-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
    color: var(--text-title);
}

.form-inline-row {
    display: flex;
    gap: 0.4rem;
}

.styled-input, .styled-select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    outline: none;
    background: #fff;
}

.styled-input:focus, .styled-select:focus {
    border-color: var(--primary);
}

.btn-text-action {
    background: var(--primary-light);
    border: 1px solid rgba(184, 125, 86, 0.3);
    color: var(--primary-dark);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
}

.drop-area {
    border: 2px dashed rgba(184, 125, 86, 0.4);
    background: #fdfaf7;
    border-radius: var(--radius-md);
    padding: 1.8rem 1.2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.drop-area:hover, .drop-area.dragover {
    background: var(--primary-light);
    border-color: var(--primary);
}

.drop-icon {
    font-size: 2.2rem;
    margin-bottom: 0.35rem;
}

.drop-primary-text {
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
}

.drop-secondary-text {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.progress-container {
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.progress-track {
    width: 100%;
    height: 6px;
    background: #ede4de;
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill {
    width: 0%;
    height: 100%;
    background: var(--primary-gradient);
    transition: width 0.2s ease;
}

.progress-status {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-align: center;
}

.dialog-btn-row {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1rem;
}

.btn-cancel {
    background: #fff;
    border: 1px solid var(--border-color);
    color: var(--text-title);
    padding: 0.45rem 0.9rem;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    cursor: pointer;
}

.btn-confirm {
    background: var(--primary-gradient);
    border: none;
    color: #fff;
    padding: 0.45rem 1rem;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
}

.qr-frame {
    text-align: center;
    margin: 0.3rem 0 0.6rem;
}

.qr-frame img {
    width: 180px;
    height: 180px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
}

.qr-link-text {
    text-align: center;
    font-family: monospace;
    font-weight: 700;
    color: var(--primary-dark);
    font-size: 0.95rem;
    margin-bottom: 0.65rem;
}

.qr-guide-tip {
    background: #fdf6f0;
    padding: 0.65rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    color: #7d5b45;
    line-height: 1.45;
}

.toast-bubble {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(28, 24, 21, 0.94);
    color: #fff;
    padding: 0.5rem 1.1rem;
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 500;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast-bubble.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ================= 移动端适配与细节打磨 ================= */
@media (max-width: 768px) {
    .header-inner {
        padding: 0.5rem 0.85rem;
    }

    .brand-badge {
        width: 32px;
        height: 32px;
        font-size: 1.1rem;
    }

    .brand-en {
        font-size: 0.88rem;
    }

    .gallery-viewport {
        padding: 0.4rem 0.5rem 5rem;
    }

    /* 手机端 2 列完美间隙与卡片微圆角 */
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.45rem;
    }

    .photo-card {
        border-radius: var(--radius-sm);
    }

    .card-info {
        padding: 0.4rem 0.5rem;
    }

    .card-filename {
        font-size: 0.74rem;
    }

    .compare-dock {
        bottom: calc(56px + var(--safe-bottom));
        width: 94%;
    }

    .dock-inner {
        padding: 0.4rem 0.65rem;
    }

    .compare-sheet {
        width: 100vw;
        height: 100vh;
        border-radius: 0;
        border: none;
    }

    .sheet-header {
        padding: calc(0.4rem + var(--safe-top)) 0.75rem 0.4rem;
    }

    .sheet-photo-title {
        font-size: 0.85rem;
    }

    .sheet-selector-bar {
        padding: 0.3rem 0.5rem;
        gap: 0.25rem;
    }

    .selector-unit select {
        padding: 0.2rem 0.35rem;
        font-size: 0.7rem;
        max-width: 110px;
    }

    .sheet-footer {
        padding: 0.5rem 0.75rem;
        padding-bottom: calc(0.5rem + var(--safe-bottom));
    }
}

/* ================= 单张详情浏览 Sheet ================= */
.detail-sheet {
    background: #141211;
    color: #fff;
    width: 100vw;
    height: 100vh;
    max-width: 1600px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: none;
}

@media (min-width: 769px) {
    .detail-sheet {
        width: 96vw;
        height: 94vh;
        border-radius: var(--radius-lg);
        box-shadow: 0 25px 60px rgba(0,0,0,0.65);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }
}

.detail-action-row {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.1rem;
}

.btn-compare-enter {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    background: var(--primary-gradient);
    border: none;
    color: #fff;
    font-size: 0.86rem;
    font-weight: 700;
    padding: 0.7rem 1rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(184, 125, 86, 0.35);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    letter-spacing: 0.02em;
}

.btn-compare-enter:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(184, 125, 86, 0.5);
}

.btn-compare-enter:active {
    transform: translateY(0);
}

/* 详情页左右切换按钮 */
.detail-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(20, 16, 14, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 15;
    transition: background 0.15s ease, transform 0.15s ease;
}

.detail-nav-btn:hover {
    background: rgba(184, 125, 86, 0.7);
    transform: translateY(-50%) scale(1.08);
}

.detail-nav-btn:active {
    transform: translateY(-50%) scale(0.95);
}

.detail-nav-prev { left: 14px; }
.detail-nav-next { right: 14px; }

/* 详情页照片序号计数器 */
.detail-counter {
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20, 16, 14, 0.7);
    color: #eee;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 14px;
    border-radius: var(--radius-full);
    z-index: 15;
    letter-spacing: 0.05em;
}

@media (max-width: 600px) {
    .detail-nav-btn {
        width: 40px;
        height: 40px;
    }
    .detail-nav-prev { left: 8px; }
    .detail-nav-next { right: 8px; }
}

/* 详情页左右切换滑动动画 + 淡入 */
#detailImg {
    opacity: 0;
    will-change: opacity, transform;
    transition: opacity 0.28s ease, transform 0.28s ease;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

#detailImg.detail-loaded {
    opacity: 1;
}

#detailImg.detail-fade-in {
    animation: detailFadeIn 0.32s ease forwards;
}

#detailImg.detail-slide-in-left {
    animation: detailSlideInLeft 0.32s cubic-bezier(0.2, 0.8, 0.3, 1) forwards;
}

#detailImg.detail-slide-in-right {
    animation: detailSlideInRight 0.32s cubic-bezier(0.2, 0.8, 0.3, 1) forwards;
}

@keyframes detailFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 上一张：从左滑入 */
@keyframes detailSlideInLeft {
    from { opacity: 0; transform: translateX(-18px); }
    to { opacity: 1; transform: translateX(0); }
}

/* 下一张：从右滑入 */
@keyframes detailSlideInRight {
    from { opacity: 0; transform: translateX(18px); }
    to { opacity: 1; transform: translateX(0); }
}
