/**
 * 尘钥摄影集 - 完整样式表
 */

:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #111111;
    --bg-tertiary: #1a1a1a;
    --bg-hover: #222222;
    --text-primary: #f0f0f0;
    --text-secondary: #b0b0b0;
    --text-muted: #666666;
    --text-dim: #444444;
    --border-color: #222222;
    --border-light: #333333;
    --accent: #e0e0e0;
    --accent-hover: #ffffff;
    --danger: #ff4444;
    --success: #44ff88;

    --header-height: 56px;
    --shortcut-height: 38px;
    --footer-height: 60px;
    --gap: 16px;
    --radius: 8px;
    --radius-sm: 4px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: 0.15s ease;

    --masonry-gap: 16px;
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

img, video {
    max-width: 100%;
    display: block;
    object-fit: cover;
}

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

button {
    background: none;
    border: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
    outline: none;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

::selection {
    background: rgba(224, 224, 224, 0.2);
    color: var(--text-primary);
}

/* ============================================
   加载屏幕
   ============================================ */
.loading-screen {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loading-content {
    text-align: center;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 20px;
}

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

.loading-text {
    font-size: 16px;
    font-weight: 400;
    color: var(--text-secondary);
    letter-spacing: 2px;
}

.loading-subtext {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 8px;
}

/* ============================================
   顶部导航 - 常驻不隐藏
   ============================================ */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: rgba(10, 10, 10, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    z-index: 1000;
}

.header-inner {
    max-width: 1600px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    transition: opacity var(--transition-fast);
    flex-shrink: 0;
}

.logo:hover {
    opacity: 0.8;
}

.logo-icon {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.logo-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.logo-text {
    letter-spacing: 0.5px;
}

.header-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 16px;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 2px;
    pointer-events: none;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.action-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    transition: all var(--transition-fast);
}

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

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

/* ============================================
   主内容区
   ============================================ */
.main-content {
    padding-top: calc(var(--header-height) + var(--gap));
    padding-bottom: calc(var(--footer-height) + var(--gap));
    min-height: 100vh;
    max-width: 1600px;
    margin: 0 auto;
    padding-left: var(--gap);
    padding-right: var(--gap);
}

/* ============================================
   Masonry 瀑布流 (CSS columns) - 防抽搐
   ============================================ */
.masonry-container {
    column-count: 1;
    column-gap: var(--masonry-gap);
    width: 100%;
}

@media (min-width: 480px) {
    .masonry-container { column-count: 2; }
}

@media (min-width: 768px) {
    .masonry-container { column-count: 3; }
}

@media (min-width: 1200px) {
    .masonry-container { column-count: 4; }
}

@media (min-width: 1600px) {
    .masonry-container { column-count: 5; }
}

.masonry-item {
    position: relative;
    margin-bottom: var(--masonry-gap);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-secondary);
    cursor: pointer;
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    transform: translateY(30px);
    opacity: 0;
    transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.6s ease;
    will-change: transform, opacity;
}

.masonry-item.visible {
    transform: translateY(0);
    opacity: 1;
}

.masonry-item:hover {
    z-index: 10;
}

/* 关键：inner 预设 aspect-ratio，加载前后高度一致，防止布局抽搐 */
.masonry-item-inner {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: var(--radius);
    background: var(--bg-secondary);
}

.masonry-item img,
.masonry-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    position: relative;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.35s ease, transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
    border-radius: var(--radius);
}

.masonry-item.loaded img,
.masonry-item.loaded video {
    opacity: 1;
}

.masonry-item:hover img,
.masonry-item:hover video {
    transform: scale(1.03);
}

.masonry-item video {
    pointer-events: none;
}

/* 视频标识 */
.video-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 12px;
    z-index: 5;
    pointer-events: none;
}

/* 懒加载占位 */
.lazy-placeholder {
    position: absolute;
    inset: 0;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    z-index: 1;
    transition: opacity 0.4s ease;
}

.masonry-item.loaded .lazy-placeholder {
    opacity: 0;
    pointer-events: none;
}

/* ============================================
   EXIF 悬停信息卡
   ============================================ */
.exif-card {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 40px 16px 16px;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.4) 60%, transparent 100%);
    color: #fff;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    pointer-events: none;
    border-radius: 0 0 var(--radius) var(--radius);
    z-index: 6;
}

.masonry-item:hover .exif-card {
    opacity: 1;
    transform: translateY(0);
}

.exif-card-filename {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0.95;
}

.exif-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    font-size: 11px;
    opacity: 0.75;
    line-height: 1.4;
}

.exif-card-meta span {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.exif-card-meta .separator {
    opacity: 0.3;
}

/* ============================================
   加载更多
   ============================================ */
.load-more {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px 0;
    color: var(--text-muted);
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.load-more.visible {
    opacity: 1;
}

.load-more-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ============================================
   空状态
   ============================================ */
.empty-state {
    text-align: center;
    padding: 120px 20px;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h2 {
    font-size: 22px;
    font-weight: 400;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.empty-state p {
    font-size: 14px;
    line-height: 1.7;
}

.empty-state code {
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-family: "SF Mono", "Fira Code", Consolas, monospace;
    font-size: 13px;
}

/* ============================================
   页脚 - 常驻不隐藏
   ============================================ */
.site-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--footer-height);
    background: rgba(10, 10, 10, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    z-index: 1000;
}

.footer-inner {
    max-width: 1600px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    font-size: 13px;
    color: var(--text-muted);
}

.footer-meta {
    font-family: "SF Mono", "Fira Code", Consolas, monospace;
    font-size: 12px;
}

/* ============================================
   回到顶部
   ============================================ */
.back-to-top {
    position: fixed;
    bottom: 80px;
    right: 24px;
    width: 44px;
    height: 44px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transform: translateY(20px);
    transition: all var(--transition);
    z-index: 999;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.back-to-top.visible {
    opacity: 1;
    transform: translateY(0);
}

.back-to-top:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-light);
    transform: translateY(-2px);
}

/* ============================================
   滚动进度条
   ============================================ */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--text-muted), var(--accent));
    z-index: 1001;
    width: 0%;
    transition: width 0.1s linear;
}

/* ============================================
   模态框
   ============================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    z-index: 4000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 20px;
}

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

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 32px;
    max-width: 480px;
    width: 100%;
    position: relative;
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 20px;
    font-size: 28px;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    transition: color var(--transition-fast);
    line-height: 1;
}

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

.modal-content h2 {
    font-size: 20px;
    font-weight: 500;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.modal-content p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 12px;
}

.modal-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin: 20px 0;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

.modal-stat-item {
    text-align: center;
}

.modal-stat-value {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
    font-family: "SF Mono", monospace;
}

.modal-stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.modal-hint {
    font-size: 12px !important;
    color: var(--text-muted) !important;
    background: var(--bg-tertiary);
    padding: 12px;
    border-radius: var(--radius-sm);
    font-family: "SF Mono", monospace;
}

/* 分享模态框 */
.share-modal .share-preview {
    width: 100%;
    aspect-ratio: 16/9;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.share-preview img,
.share-preview video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.share-link-box {
    display: flex;
    gap: 8px;
}

.share-link-input {
    flex: 1;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: var(--text-secondary);
    font-size: 13px;
    font-family: "SF Mono", monospace;
    outline: none;
}

.share-copy-btn {
    padding: 10px 20px;
    background: var(--bg-hover);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.share-copy-btn:hover {
    background: var(--border-light);
}

.share-copy-btn.copied {
    background: rgba(68, 255, 136, 0.15);
    color: var(--success);
    border-color: var(--success);
}

/* ============================================
   全屏查看器
   ============================================ */
.viewer-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    z-index: 3000;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    user-select: none;
    -webkit-user-select: none;
}

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

/* 媒体舞台 */
.viewer-stage {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    cursor: grab;
}

.viewer-stage:active {
    cursor: grabbing;
}

.viewer-media-wrap {
    position: relative;
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 辅助线层 - 限制在照片区域内 */
.guide-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.guide-layer.visible {
    opacity: 1;
}

.viewer-media {
    max-width: 90vw;
    max-height: calc(100vh - 140px);
    object-fit: contain;
    display: none;
    border-radius: var(--radius-sm);
    position: relative;
    z-index: 1;
}

.viewer-media.active {
    display: block;
}

/* 切换动画 */
.viewer-media-wrap.switching {
    animation: mediaSwitch 0.25s ease;
}

@keyframes mediaSwitch {
    0% { opacity: 0.5; transform: scale(0.98); }
    100% { opacity: 1; transform: scale(1); }
}

/* 左右切换按钮 */
.viewer-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(8px);
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 30;
    border-radius: var(--radius-sm);
}

.viewer-overlay:hover .viewer-nav-btn {
    opacity: 1;
}

.viewer-nav-btn:hover {
    background: rgba(0, 0, 0, 0.6);
    color: var(--text-primary);
}

.viewer-nav-btn.prev {
    left: 12px;
}

.viewer-nav-btn.next {
    right: 12px;
}

.viewer-nav-btn:disabled {
    opacity: 0 !important;
    pointer-events: none;
}

/* 工具栏 */
.viewer-toolbar {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    background: rgba(20, 20, 20, 0.9);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 100px;
    z-index: 20;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.viewer-toolbar.hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
    pointer-events: none;
}

.toolbar-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--text-muted);
    transition: all var(--transition-fast);
    position: relative;
}

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

.toolbar-btn.active {
    color: var(--accent);
    background: var(--bg-hover);
}

.toolbar-counter {
    padding: 0 12px;
    font-size: 13px;
    color: var(--text-secondary);
    font-family: "SF Mono", monospace;
    min-width: 60px;
    text-align: center;
    user-select: none;
}

.toolbar-divider {
    width: 1px;
    height: 20px;
    background: var(--border-color);
    margin: 0 4px;
}

/* 信息面板 */
.viewer-info-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: 320px;
    max-width: 90vw;
    height: 100%;
    background: rgba(15, 15, 15, 0.95);
    backdrop-filter: blur(30px);
    border-left: 1px solid var(--border-color);
    z-index: 25;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    overflow-y: auto;
    padding: 20px;
}

.viewer-info-panel.open {
    transform: translateX(0);
}

.info-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.info-panel-header h3 {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
}

.info-panel-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    transition: all var(--transition-fast);
}

.info-panel-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.info-panel-content {
    font-size: 13px;
}

.info-group {
    margin-bottom: 20px;
}

.info-group-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 10px;
    font-weight: 500;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.info-row-label {
    color: var(--text-muted);
    font-size: 12px;
}

.info-row-value {
    color: var(--text-secondary);
    font-family: "SF Mono", monospace;
    font-size: 12px;
    text-align: right;
    word-break: break-all;
}

/* 缩略图导航条 */
.viewer-thumbnails {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 80vw;
    padding: 8px;
    background: rgba(20, 20, 20, 0.9);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    z-index: 20;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    overflow: hidden;
}

.viewer-thumbnails.visible {
    opacity: 1;
    visibility: visible;
}

.thumbnails-track {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scroll-behavior: smooth;
    padding: 2px;
}

.thumbnails-track::-webkit-scrollbar {
    display: none;
}

.thumbnail-item {
    width: 60px;
    height: 45px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    flex-shrink: 0;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all var(--transition-fast);
    opacity: 0.5;
}

.thumbnail-item img,
.thumbnail-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumbnail-item:hover {
    opacity: 0.8;
}

.thumbnail-item.active {
    border-color: var(--accent);
    opacity: 1;
}

/* Toast 提示 */
.viewer-toast {
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    padding: 10px 20px;
    background: rgba(30, 30, 30, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 100px;
    font-size: 13px;
    color: var(--text-secondary);
    z-index: 30;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
    white-space: nowrap;
}

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

/* 自动播放指示 */
.autoplay-indicator {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 16px;
    background: rgba(30, 30, 30, 0.9);
    border-radius: 100px;
    font-size: 12px;
    color: var(--text-muted);
    z-index: 20;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.autoplay-indicator.visible {
    opacity: 1;
}

.autoplay-dot {
    width: 6px;
    height: 6px;
    background: var(--danger);
    border-radius: 50%;
    animation: pulse 1.5s ease infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ============================================
   响应式布局
   ============================================ */
@media (max-width: 768px) {
    :root {
        --masonry-gap: 8px;
        --gap: 8px;
    }

    .header-inner {
        padding: 0 12px;
    }

    .quick-links {
        padding: 10px 12px;
        height: auto;
        flex-wrap: wrap;
        justify-content: center;
    }

    .quick-link {
        font-size: 11px;
    }

    .header-title {
        font-size: 14px;
        letter-spacing: 1px;
    }

    .logo-text {
        display: none;
    }

    .header-actions {
        gap: 0;
    }

    .footer-inner {
        padding: 0 12px;
        flex-direction: column;
        gap: 4px;
        justify-content: center;
    }

    .exif-card {
        display: none;
    }

    .masonry-item:hover img,
    .masonry-item:hover video {
        transform: none;
    }

    .back-to-top {
        bottom: 72px;
        right: 12px;
        width: 40px;
        height: 40px;
    }

    .viewer-toolbar {
        padding: 6px 10px;
        gap: 2px;
        bottom: 12px;
    }

    .toolbar-btn {
        width: 36px;
        height: 36px;
    }

    .toolbar-counter {
        padding: 0 6px;
        font-size: 12px;
    }

    .viewer-info-panel {
        width: 100%;
        max-width: 100%;
    }

    .viewer-nav-btn {
        width: 44px;
        height: 60px;
    }

    .viewer-nav-btn.prev { left: 4px; }
    .viewer-nav-btn.next { right: 4px; }

    .viewer-thumbnails {
        bottom: 68px;
        max-width: 95vw;
    }

    .thumbnail-item {
        width: 48px;
        height: 36px;
    }
}

@media (max-width: 480px) {
    .modal-content {
        padding: 24px 20px;
    }

    .viewer-toolbar {
        border-radius: var(--radius);
        flex-wrap: wrap;
        justify-content: center;
        max-width: 95vw;
    }

    .toolbar-divider {
        display: none;
    }
}

@media print {
    .site-header,
    .site-footer,
    .back-to-top,
    .scroll-progress,
    .action-btn,
    .viewer-overlay,
    .modal-overlay {
        display: none !important;
    }

    .main-content {
        padding-top: 20px;
    }
}
