* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root {
  --primary: #296ffe;
  --text: #1a1a1a;
  --muted: #8a8f99;
  --border: #eef0f3;
  --bg: #fff;
}
html, body { background: #f2f3f5; font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", Helvetica, Arial, sans-serif; color: var(--text); }
#app { max-width: 480px; margin: 0 auto; background: var(--bg); min-height: 100vh; position: relative; overflow: hidden; }
button, select { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }

/* ===== 顶部：封面 + 信息 ===== */
.album-header { position: relative; }
.cover { width: 100%; position: relative; background: #1668e8; line-height: 0; overflow: hidden; }
.cover img { width: 100%; display: block; }
.album-info { padding: 18px 16px 16px; position: relative; overflow: hidden; }
.album-info::after { content: ""; position: absolute; right: -30px; top: -10px; width: 200px; height: 200px; background: linear-gradient(135deg, transparent 40%, rgba(41,111,254,.035) 40%, rgba(41,111,254,.035) 45%, transparent 45%, transparent 55%, rgba(41,111,254,.028) 55%, rgba(41,111,254,.028) 60%, transparent 60%); pointer-events: none; transform: rotate(15deg); }
.album-title { font-size: 18px; line-height: 1.45; font-weight: 700; letter-spacing: .2px; }
.view-count { display: inline-block; margin-top: 10px; background: #eef4ff; color: var(--primary); font-size: 12px; padding: 4px 9px; border-radius: 4px; }
.album-date { display: flex; align-items: center; gap: 6px; margin-top: 15px; color: #6b7280; font-size: 13px; }

/* ===== 标签栏 ===== */
.tab-bar { display: flex; align-items: center; justify-content: space-between; padding: 0 14px; border-bottom: 1px solid var(--border); height: 48px; }
.tab-left { display: flex; gap: 26px; height: 100%; }
.tab-item { font-size: 15px; color: #4b5563; position: relative; padding: 0 2px; height: 100%; font-weight: 500; }
.tab-item.active { color: var(--primary); font-weight: 600; }
.tab-item.active::after { content: ""; position: absolute; left: 50%; transform: translateX(-50%); bottom: 0; width: 22px; height: 3px; background: var(--primary); border-radius: 2px 2px 0 0; }
.tab-right { display: flex; align-items: center; }
.select-wrap { display: none; }
.icon-group { display: flex; align-items: center; gap: 14px; color: #9ca3af; }
.icon-btn { display: flex; align-items: center; justify-content: center; padding: 4px; }

/* ===== 日期标签 ===== */
.date-tabs { display: flex; gap: 10px; padding: 12px 14px; flex-wrap: wrap; }
.date-tab { padding: 7px 16px; border-radius: 6px; background: #f5f6f8; color: #6b7280; font-size: 13px; font-weight: 500; line-height: 1; }
.date-tab.active { background: #eaf1ff; color: var(--primary); font-weight: 600; }

/* ===== 图片网格 + 悬浮播放按钮 ===== */
.grid-wrap { position: relative; }
.photo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 0 2px; }
.photo-grid.layout-grid { gap: 3px; }
.photo-grid.layout-timeline { grid-template-columns: 1fr; gap: 12px; padding: 0 12px; }
.photo-item { position: relative; overflow: hidden; background: #eef0f3; cursor: pointer; }
/* 统一宽高比 + cover 填满，避免同行被高图撑开后其它图片下方留灰底 */
.photo-item { aspect-ratio: 3 / 2; }
.photo-item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s, opacity .35s; opacity: 0; }
.photo-item img.loaded { opacity: 1; }
.photo-item:active img { transform: scale(.97); }
.photo-grid.layout-waterfall .photo-item,
.photo-grid.layout-grid .photo-item,
.photo-grid.layout-timeline .photo-item { aspect-ratio: 3 / 2; }
.photo-grid.layout-waterfall .photo-item img,
.photo-grid.layout-grid .photo-item img,
.photo-grid.layout-timeline .photo-item img { height: 100%; object-fit: cover; }
.photo-grid.layout-timeline .photo-item { border-radius: 6px; }
/* 自动播放按钮：固定在视口底部中央，滚动页面时位置不变 */
.float-play-btn { position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60; display: inline-flex; align-items: center; gap: 7px; background: var(--primary); color: #fff; font-size: 14px; font-weight: 600; padding: 11px 20px; border-radius: 22px; box-shadow: 0 6px 20px rgba(41,111,254,.45); }
.float-play-btn svg { flex-shrink: 0; }
.float-play-btn:active { transform: translateX(-50%) scale(.97); }
.grid-total { display: block; text-align: center; padding: 16px; color: var(--muted); font-size: 12px; }
.grid-total b { color: var(--text); font-weight: 600; }

/* 空状态 */
.empty-live { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 70vh; gap: 10px; color: #9ca3af; text-align: center; padding: 20px; }
.empty-live h2 { font-size: 17px; color: #4b5563; font-weight: 600; }
.empty-live p { font-size: 13px; }

/* 加载 */
.loading-more { text-align: center; padding: 22px; color: #9ca3af; font-size: 13px; display: none; }
.loading-more.show { display: block; }
.spinner { display: inline-block; width: 13px; height: 13px; border: 2px solid #e5e7eb; border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -2px; margin-right: 5px; }
@keyframes spin { to { transform: rotate(360deg); } }
.footer-note { text-align: center; padding: 30px 20px 40px; color: #9ca3af; font-size: 11px; line-height: 1.7; }
.footer-note p:first-child { font-weight: 600; color: #6b7280; margin-bottom: 4px; }

/* ===== 大图预览 ===== */
.preview { position: fixed; inset: 0; z-index: 100; background: #0e0e0e; display: none; flex-direction: column; width: 100%; height: 100%; }
.preview.show { display: flex !important; }
/* 全屏伪类会重置 display/尺寸，必须显式恢复 flex 纵向布局 */
.preview:fullscreen,
.preview:-webkit-full-screen,
.preview:-moz-full-screen { display: flex !important; flex-direction: column; width: 100vw !important; height: 100vh !important; max-width: none; margin: 0; padding: 0; background: #0e0e0e; }
.preview:fullscreen .preview-stage,
.preview:-webkit-full-screen .preview-stage { flex: 1 1 auto; min-height: 0; }
/* 当前图片的模糊背景（绝对定位铺满、放大避免露边、压暗） */
.preview-bg { position: absolute; inset: -40px; background: #0e0e0e; background-size: cover; background-position: center; filter: blur(28px) saturate(1.2) brightness(.55); transform: scale(1.08); opacity: 0; pointer-events: none; transition: opacity .5s ease; }
.preview.show .preview-bg { opacity: 1; }
/* 顶部状态文字与上一张箭头同左、关闭按钮与下一张箭头同右 */
.preview-head { height: 60px; display: flex; align-items: center; justify-content: space-between; padding: 20px 12px 0; flex-shrink: 0; position: relative; z-index: 1; }
.close-btn { width: 32px; height: 32px; border-radius: 50%; background: rgba(255,255,255,.16); color: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.play-status { font-size: 12px; color: rgba(255,255,255,.6); }
.preview-stage { flex: 1; display: flex; align-items: center; justify-content: center; overflow: hidden; min-height: 0; min-width: 0; touch-action: pan-y; position: relative; z-index: 1; }
.preview-stage img { max-width: 100%; max-height: 100%; object-fit: contain; user-select: none; will-change: transform, opacity, filter; }
/* 切换动画：每次随机使用一种 */
@keyframes sw-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes sw-zoom-in { from { opacity: 0; transform: scale(.78); } to { opacity: 1; transform: scale(1); } }
@keyframes sw-zoom-out { from { opacity: 0; transform: scale(1.22); } to { opacity: 1; transform: scale(1); } }
@keyframes sw-slide-left { from { opacity: 0; transform: translateX(60px) rotate(-3deg); } to { opacity: 1; transform: translateX(0) rotate(0); } }
@keyframes sw-slide-right { from { opacity: 0; transform: translateX(-60px) rotate(3deg); } to { opacity: 1; transform: translateX(0) rotate(0); } }
@keyframes sw-slide-up { from { opacity: 0; transform: translateY(50px) scale(.94); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes sw-slide-down { from { opacity: 0; transform: translateY(-50px) scale(.94); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes sw-blur { from { opacity: 0; filter: blur(16px); transform: scale(1.08); } to { opacity: 1; filter: blur(0); transform: scale(1); } }
@keyframes sw-flip { from { opacity: 0; transform: perspective(900px) rotateY(30deg) scale(.9); } to { opacity: 1; transform: perspective(900px) rotateY(0) scale(1); } }
@keyframes sw-pop { 0% { opacity: 0; transform: scale(.6); } 70% { opacity: 1; transform: scale(1.04); } 100% { opacity: 1; transform: scale(1); } }
@keyframes sw-diagonal { from { opacity: 0; transform: translate(-50px, 40px) rotate(-4deg) scale(.92); } to { opacity: 1; transform: translate(0,0) rotate(0) scale(1); } }
@keyframes sw-rotate { from { opacity: 0; transform: rotate(-14deg) scale(.68); } to { opacity: 1; transform: rotate(0) scale(1); } }
@keyframes sw-flip-x { from { opacity: 0; transform: perspective(900px) rotateX(-65deg) scale(.88); transform-origin: center bottom; } to { opacity: 1; transform: perspective(900px) rotateX(0) scale(1); transform-origin: center center; } }
@keyframes sw-shutter { from { opacity: 0; transform: scaleX(.04) scaleY(.92); } to { opacity: 1; transform: scaleX(1) scaleY(1); } }
@keyframes sw-spiral { from { opacity: 0; transform: translate(90px, -60px) rotate(20deg) scale(.5); } to { opacity: 1; transform: translate(0,0) rotate(0) scale(1); } }
/* 切换动画时长：约 1.2~1.45 秒，独立于图片停留时间，动画更完整清晰 */
.preview-stage img.sw-fade { animation: sw-fade 1.2s ease both; }
.preview-stage img.sw-zoom-in { animation: sw-zoom-in 1.3s cubic-bezier(.2,.75,.3,1) both; }
.preview-stage img.sw-zoom-out { animation: sw-zoom-out 1.3s cubic-bezier(.2,.75,.3,1) both; }
.preview-stage img.sw-slide-left { animation: sw-slide-left 1.3s cubic-bezier(.2,.75,.3,1) both; }
.preview-stage img.sw-slide-right { animation: sw-slide-right 1.3s cubic-bezier(.2,.75,.3,1) both; }
.preview-stage img.sw-slide-up { animation: sw-slide-up 1.3s cubic-bezier(.2,.75,.3,1) both; }
.preview-stage img.sw-slide-down { animation: sw-slide-down 1.3s cubic-bezier(.2,.75,.3,1) both; }
.preview-stage img.sw-blur { animation: sw-blur 1.4s ease both; }
.preview-stage img.sw-flip { animation: sw-flip 1.4s cubic-bezier(.2,.75,.3,1) both; }
.preview-stage img.sw-pop { animation: sw-pop 1.2s cubic-bezier(.2,.75,.3,1) both; }
.preview-stage img.sw-diagonal { animation: sw-diagonal 1.4s cubic-bezier(.2,.75,.3,1) both; }
.preview-stage img.sw-rotate { animation: sw-rotate 1.35s cubic-bezier(.2,.75,.3,1) both; }
.preview-stage img.sw-flip-x { animation: sw-flip-x 1.45s cubic-bezier(.2,.75,.3,1) both; }
.preview-stage img.sw-shutter { animation: sw-shutter 1.25s cubic-bezier(.2,.75,.3,1) both; }
.preview-stage img.sw-spiral { animation: sw-spiral 1.45s cubic-bezier(.2,.75,.3,1) both; }
.stage-arrow { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; background: rgba(255,255,255,.12); color: #fff; font-size: 30px; line-height: 1; display: none; align-items: center; justify-content: center; z-index: 2; }
.stage-arrow:active { background: rgba(255,255,255,.25); }
.stage-prev { left: 12px; }
.stage-next { right: 12px; }
/* ===== 左侧浮层二维码：无黑色背景行 ===== */
.mini-qr { position: absolute; left: 16px; bottom: 250px; z-index: 3; width: 150px; height: 150px; background: #fff; border-radius: 6px; padding: 6px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.mini-qr img, .mini-qr canvas { width: 100%; height: 100%; display: block; }
.ctl-select { display: inline-flex; align-items: center; gap: 3px; color: rgba(255,255,255,.85); font-size: 12px; }
.ctl-select select { appearance: none; -webkit-appearance: none; background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(255,255,255,.22); border-radius: 4px; padding: 6px 22px 6px 8px; font-size: 12px; outline: none; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='white' stroke-width='1.4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 7px center; }
.ctl-select select option { color: #1a1a1a; }
.ctl-btn { color: rgba(255,255,255,.85); background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22); border-radius: 4px; padding: 6px 10px; font-size: 12px; white-space: nowrap; }
.ctl-play { display: inline-flex; align-items: center; gap: 5px; background: var(--primary); color: #fff; border-radius: 4px; padding: 6px 14px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.ctl-play-icon { font-size: 11px; }
/* ===== 缩略图导航条：全宽，跟随当前播放图片 ===== */
.preview-film { flex-shrink: 0; display: flex; align-items: center; gap: 6px; padding: 8px 12px; background: rgba(0,0,0,.82); position: relative; z-index: 1; }
.film-strip { position: relative; flex: 1; min-width: 0; display: flex; gap: 6px; overflow-x: auto; overflow-y: hidden; scroll-behavior: smooth; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.film-strip::-webkit-scrollbar { display: none; }
.film-item { flex: 0 0 96px; height: 64px; border: 2px solid transparent; border-radius: 3px; overflow: hidden; cursor: pointer; opacity: .5; transition: opacity .2s, border-color .2s; }
.film-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.film-item.active { border-color: #fff; opacity: 1; }
.film-arrow { flex: 0 0 24px; height: 64px; color: rgba(255,255,255,.7); font-size: 26px; line-height: 1; display: flex; align-items: center; justify-content: center; }
.preview-film.collapsed { padding: 2px 12px; }
.preview-film.collapsed .film-strip,
.preview-film.collapsed .film-arrow { display: none; }
.preview-bottom { flex-shrink: 0; padding: 10px 16px calc(16px + env(safe-area-inset-bottom)); color: #fff; position: relative; z-index: 1; }
.progress-row { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.progress-bar { flex: 1; height: 2px; background: rgba(255,255,255,.25); border-radius: 2px; overflow: hidden; }
.progress-bar span { display: block; height: 100%; background: #fff; border-radius: 2px; transition: width .2s; }
.progress-text { font-size: 12px; color: rgba(255,255,255,.75); min-width: 46px; text-align: right; }
.preview-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.hd-btn { border: 1px solid rgba(255,255,255,.3); color: rgba(255,255,255,.85); padding: 8px 14px; border-radius: 18px; font-size: 12px; }
.hd-btn.loading { opacity: .6; }
.action-icons { display: flex; gap: 26px; flex-shrink: 0; }
.action-controls { display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.action-icons button { display: flex; flex-direction: column; align-items: center; gap: 4px; color: #fff; font-size: 11px; }
.action-icons button.liked { color: #ff5a5f; }
.action-icons button.liked svg { fill: #ff5a5f; }

/* ===== 弹窗 ===== */
.sheet-mask { position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,.45); display: none; align-items: flex-end; justify-content: center; }
.sheet-mask.show { display: flex; }
.sheet { width: 100%; max-width: 480px; background: #fff; border-radius: 16px 16px 0 0; padding: 20px 20px calc(20px + env(safe-area-inset-bottom)); animation: slideUp .25s ease; }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet-title { text-align: center; font-size: 16px; font-weight: 600; margin-bottom: 20px; }
.sheet-group { margin-bottom: 18px; }
.sheet-label { font-size: 13px; color: #6b7280; margin-bottom: 10px; }
.option-row { display: flex; gap: 10px; flex-wrap: wrap; }
.option { padding: 8px 18px; border-radius: 6px; background: #f3f4f6; font-size: 13px; color: #4b5563; }
.option.active { background: #eaf1ff; color: var(--primary); font-weight: 600; }
.sheet-close { width: 100%; padding: 12px; border-radius: 8px; background: #f3f4f6; color: #4b5563; font-size: 14px; margin-top: 6px; }
.qr-sheet { text-align: center; }
.qr-code { width: 180px; height: 180px; margin: 0 auto 14px; background: #fff; border: 1px solid #eee; }
.qr-tip { font-size: 12px; color: #9ca3af; margin-bottom: 18px; }
.lang-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.lang-item { padding: 12px; border-radius: 8px; background: #f8f9fa; font-size: 14px; }
.lang-item.active { color: var(--primary); background: #eef4ff; }

/* 提示 */
.toast { position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%) translateY(10px); background: rgba(0,0,0,.75); color: #fff; padding: 9px 18px; border-radius: 20px; font-size: 13px; opacity: 0; pointer-events: none; transition: .25s; z-index: 300; white-space: nowrap; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 微信内操作引导 */
.wechat-guide { position: fixed; inset: 0; z-index: 400; background: rgba(0,0,0,.55); display: none; align-items: flex-start; justify-content: flex-end; padding: 12px 16px; }
.wechat-guide.show { display: flex; }
.wechat-guide.no-arrow { align-items: center; justify-content: center; }
.wechat-guide.no-arrow .guide-arrow { display: none; }
.guide-arrow { position: absolute; top: 6px; right: 18px; color: #fff; font-size: 30px; font-weight: 700; letter-spacing: 2px; animation: guideBounce 1s ease-in-out infinite; }
@keyframes guideBounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(6px); } }
.guide-box { max-width: 280px; margin-top: 52px; background: #fff; color: #1f2937; border-radius: 10px; padding: 16px 18px; box-shadow: 0 12px 40px rgba(0,0,0,.3); animation: slideUp .2s ease; }
.wechat-guide.no-arrow .guide-box { margin-top: 0; }
.guide-box p { font-size: 14px; line-height: 1.6; margin-bottom: 12px; }
.guide-box button { width: 100%; padding: 9px; border-radius: 6px; background: var(--primary); color: #fff; font-size: 13px; font-weight: 600; }

/* ===== 响应式：平板 / PC ===== */
/* 手机和平板播放时隐藏二维码、播放顺序、收起列表；电脑端保留 */
@media (max-width: 1023px) {
  .mini-qr, .ctl-order, #filmToggle { display: none !important; }
}

@media (min-width: 481px) {
  body { padding: 0; }
  #app { max-width: 100%; box-shadow: none; border-radius: 0; }
  .stage-arrow { display: flex; }
}

/* 平板：封面全宽大图 + 2 列 */
@media (min-width: 600px) and (max-width: 1023px) {
  .album-title { font-size: 20px; }
  .album-info { padding: 14px 24px 14px; }
  .view-count { margin-top: 6px; }
  .album-date { margin-top: 8px; }
  .photo-grid { grid-template-columns: repeat(2, 1fr); gap: 5px; padding: 0 5px; }
  .photo-grid.layout-timeline { grid-template-columns: 1fr; }
  .tab-bar, .date-tabs { padding-left: 24px; padding-right: 24px; }
  .cover img { max-height: 420px; width: 100%; object-fit: cover; }
  .preview-bottom { padding-left: 28px; padding-right: 28px; }
  .sheet { max-width: 600px; }
}

/* PC：头部横向（左封面右信息）+ 7 列紧密网格 */
@media (min-width: 1024px) {
  /* 页面撑满整个屏幕宽度，不再留左右白边 */
  #app { max-width: 100%; margin: 0; background: var(--bg); box-shadow: none; }
  .album-header { display: flex; align-items: flex-start; gap: 22px; padding: 18px 24px 14px; }
  /* 封面按屏幕宽度放大，参考比例约 2:1 */
  .cover { width: clamp(260px, 24vw, 460px); flex: 0 0 auto; aspect-ratio: 2 / 1; height: auto; }
  .cover img { height: 100%; width: 100%; object-fit: cover; }
  .album-info { padding: 4px 0 0; flex: 1; }
  .album-info::after { display: none; }
  .album-title { font-size: clamp(21px, 1.7vw, 30px); }
  .view-count { margin-top: 8px; font-size: 12px; }
  .album-date { margin-top: 10px; font-size: 12px; }
  .tab-bar { padding: 0 24px; }
  .select-wrap { display: flex; gap: 10px; }
  .select-wrap select { border: 1px solid #e5e7eb; border-radius: 4px; padding: 6px 10px; font-size: 12px; color: #6b7280; background: #fff; outline: none; }
  .select-wrap select:focus { border-color: var(--primary); }
  .icon-group { display: none; }
  .date-tabs { padding: 12px 24px; }
  /* PC 固定 8 列，图片之间留出更明显的间距 */
  .photo-grid { grid-template-columns: repeat(8, 1fr); gap: 20px; padding: 0 16px; }
  .photo-grid.layout-grid { grid-template-columns: repeat(8, 1fr); gap: 20px; }
  .photo-grid.layout-timeline { grid-template-columns: repeat(5, 1fr); }
  .float-play-btn { padding: 12px 24px; font-size: 15px; }
  .stage-arrow { width: 52px; height: 52px; font-size: 36px; }
  .preview-head { padding-left: 12px; padding-right: 12px; max-width: none; margin: 0; }
  /* 底部控制栏与缩略图条撑满整个屏幕宽度 */
  .preview-film, .preview-bottom { max-width: none; margin: 0; width: 100%; }
  .mini-qr { left: 20px; bottom: 270px; width: 170px; height: 170px; }
  .action-controls { gap: 8px; flex-wrap: nowrap; min-width: max-content; }
  .ctl-select, .ctl-btn, .ctl-play { font-size: 13px; }
  .ctl-select select { font-size: 13px; padding: 8px 26px 8px 10px; }
  .ctl-btn { padding: 8px 14px; }
  .ctl-play { padding: 8px 20px; }
  .film-item { flex-basis: 140px; height: 92px; }
  .film-arrow { font-size: 30px; }
  .preview-bottom { padding: 12px 20px calc(18px + env(safe-area-inset-bottom)); }
  .preview-stage img { max-height: 100%; }
  .sheet { max-width: 520px; border-radius: 12px 12px 0 0; margin: 0 auto; }
  .sheet-mask { align-items: flex-end; }
}
