:root {
    --bg: #f2f2f7;
    --card: #ffffff;
    --text: #1c1c1e;
    --sub: #8e8e93;
    --blue: #007aff;
    --radius: 18px;
    --gap: 12px;
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
    padding: 0 14px calc(40px + env(safe-area-inset-bottom));
    max-width: 1080px;
    margin: 0 auto;
    overflow-x: hidden;
}
a { text-decoration: none; color: inherit; }

/* ---------- 页头 ---------- */
.page-head { padding: calc(18px + env(safe-area-inset-top)) 0 8px; }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 34px; }
h1 { font-size: 30px; font-weight: 800; letter-spacing: .3px; line-height: 1.2; }
.page-sub { margin-top: 4px; font-size: 13px; color: var(--sub); }
.admin-link, .back-link {
    font-size: 13px; color: var(--sub);
    border: 1px solid #d8d8de; border-radius: 14px; padding: 5px 13px;
    background: var(--card); white-space: nowrap; flex: none;
}
.back-link { font-size: 15px; color: var(--blue); border-color: #cfe3ff; background: #f2f8ff; padding: 5px 14px 6px; }
.admin-link:hover, .back-link:hover { color: var(--blue); border-color: var(--blue); }

.album-title-row { display: flex; align-items: baseline; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.album-title { font-size: 26px; font-weight: 800; word-break: break-all; }
.album-title-cnt { font-size: 13px; color: var(--sub); }

.empty-tip { margin-top: 48px; text-align: center; color: var(--sub); font-size: 15px; line-height: 1.9; padding: 0 20px; }
.empty-tip a { color: var(--blue); }

/* ---------- 首页：分类卡片 ---------- */
.album-grid {
    margin-top: 16px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--gap);
}
.album-card {
    background: var(--card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,.07);
    display: block;
    transition: transform .15s ease, box-shadow .15s ease;
}
@media (hover: hover) {
    .album-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.12); }
}
.album-cover {
    position: relative;
    aspect-ratio: 1 / 1;
    background: #e2e2e7;
}
.album-cover img, .album-cover video { width: 100%; height: 100%; object-fit: cover; display: block; }
.album-cover video { background: #111; }
.cover-empty {
    width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
    color: #a5a5aa; font-size: 13px;
}
.album-info { padding: 10px 12px 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.album-name { font-size: 15px; font-weight: 600; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.album-cnt { font-size: 12px; color: var(--sub); flex: none; }

/* ---------- 详情页：分类快捷切换 ---------- */
.cat-chips {
    display: flex; gap: 8px; overflow-x: auto; padding: 10px 0 4px;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.cat-chips::-webkit-scrollbar { display: none; }
.chip {
    flex: none; font-size: 13px; color: #555; background: var(--card);
    border: 1px solid #e2e2e7; border-radius: 16px; padding: 6px 13px; white-space: nowrap;
}
.chip.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.chip-cnt { font-size: 11px; opacity: .7; margin-left: 5px; }

/* ---------- 详情页：媒体网格 ---------- */
.media-grid {
    margin-top: 14px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}
.tile {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: 12px;
    overflow: hidden;
    background: #d9d9de;
    cursor: pointer;
}
.tile img, .tile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile video { background: #111; }
.tile:active { opacity: .85; }
.play-badge {
    position: absolute; top: 6px; right: 7px;
    color: #fff; font-size: 11px;
    background: rgba(0,0,0,.4); border-radius: 50%;
    width: 22px; height: 22px; line-height: 22px; text-align: center;
    backdrop-filter: blur(4px);
}

/* ---------- 灯箱 ---------- */
.lightbox {
    position: fixed; inset: 0; z-index: 100;
    background: rgba(8,8,10,.96);
    display: none; align-items: center; justify-content: center;
    touch-action: none;
}
.lightbox.open { display: flex; }
.lb-stage { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.lb-stage img, .lb-stage video { max-width: 96vw; max-height: 82vh; border-radius: 6px; }
.lb-close {
    position: absolute; top: calc(10px + env(safe-area-inset-top)); right: 14px;
    width: 38px; height: 38px; border-radius: 50%; z-index: 2;
    border: none; background: rgba(255,255,255,.16); color: #fff;
    font-size: 16px; cursor: pointer;
}
.lb-nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 40px; height: 40px; border-radius: 50%; border: none; z-index: 2;
    background: rgba(255,255,255,.14); color: #fff; font-size: 24px; cursor: pointer;
    user-select: none;
}
.lb-prev { left: 8px; } .lb-next { right: 8px; }
.lb-caption {
    position: absolute; bottom: calc(14px + env(safe-area-inset-bottom)); left: 0; right: 0;
    text-align: center; color: rgba(255,255,255,.85); font-size: 13px;
    overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding: 0 56px;
}

/* ---------- 屏幕适配 ---------- */
/* 小屏手机：2 列 */
@media (max-width: 400px) {
    h1 { font-size: 26px; }
    .album-title { font-size: 22px; }
    .album-grid { gap: 10px; }
    .media-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
    .lb-nav { width: 34px; height: 34px; font-size: 20px; }
}
/* 平板 / 桌面 */
@media (min-width: 560px) {
    .album-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
    .media-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
    .tile { border-radius: 14px; }
}
@media (min-width: 900px) {
    h1 { font-size: 34px; }
    .album-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .media-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .lb-prev { left: 22px; } .lb-next { right: 22px; }
    .lb-nav { width: 46px; height: 46px; font-size: 26px; }
}
