.album-page {
    --album-ink: #1e2331;
    --album-muted: #6a6d78;
    --album-line: #e0e1e6;
    --album-accent: #4636ff;
    color: var(--album-ink);
    background: #fff;
}

.album-main {
    min-height: 80vh;
}

/* 沿用动态页标题区，保留相册的纯色背景和无面包屑设计。 */
.album-heading.page__title {
    min-height: 300px;
    padding: 64px 0;
    background: #3524ac;
}

.album-heading::before {
    content: none;
}

.album-heading h1 {
    font-size: clamp(40px, 5vw, 64px);
    line-height: 1.2;
    color: #fff;
    margin: 0 0 18px;
}

.album-heading p {
    color: rgba(255, 255, 255, .8);
    font-size: 16px;
    line-height: 1.8;
    margin: 0;
    max-width: 65%;
}

.album-heading .slider__shape {
    pointer-events: none;
    opacity: .65;
}

.album-content {
    padding-top: 44px;
    padding-bottom: 72px;
}

.album-access-note, .album-help {
    color: var(--album-muted);
    font-size: 13px;
    line-height: 1.8;
}

.album-access-note {
    margin: 14px 0 28px;
}

.album-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
    padding: 0 0 18px;
}


.album-list-heading, .album-actions {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.album-list-heading h2 {
    font-size: 27px;
    line-height: 2.2;
    margin: 0;
}

/* 上传入口不继承通用 z-btn 的大尺寸和伪元素。 */
.album-page .album-upload-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 8px 16px;
    border: 1px solid var(--album-accent);
    border-radius: 10px;
    background: var(--album-accent);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    line-height: 22px;
    cursor: pointer;
    transition: background-color .15s, color .15s;
}

.album-page .album-upload-trigger:hover {
    background: #fff;
    color: var(--album-accent);
}

.album-card button, .album-more button {
    background: transparent;
    color: inherit;
    border: 0;
    padding: 8px 0;
    cursor: pointer;
}

.album-card button:hover, .album-more button:hover {
    color: var(--album-accent);
}

.album-page button:disabled {
    opacity: .5;
    cursor: wait;
}

.album-page button:focus-visible, .album-page a:focus-visible {
    outline: 2px solid var(--album-accent);
    outline-offset: 4px;
}

.album-page input[type=checkbox] {
    accent-color: var(--album-accent);
    margin-right: 7px;
}

#album-count {
    color: var(--album-muted);
    font-size: 13px;
}

.album-upload {
    padding: 28px;
    margin-bottom: 28px;
    background: #f7f7fa;
    border: 1px solid var(--album-line);
}

.album-upload h2 {
    font-size: 23px;
}

.album-upload-intro p, .album-help {
    font-size: 13px;
    line-height: 1.8;
}

.album-file {
    display: block;
    padding: 20px;
    border: 1px dashed var(--album-line);
    background: #fff;
}

.album-file input {
    display: block;
    margin-top: 12px;
    max-width: 100%;
}

.album-fields {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 24px;
    margin: 20px 0 8px;
}

.album-fields label {
    display: grid;
    align-content: start;
    gap: 8px;
}

.album-fields input, .album-fields textarea {
    background: #fff;
    border: 1px solid var(--album-line);
    padding: 10px 12px;
    width: 100%;
    color: inherit;
    border-radius: 0;
}

.album-fields ::placeholder {
    color: #9a9da6;
}

.album-location {
    margin-top: 12px;
}

#album-status {
    margin: 22px 0;
    color: var(--album-muted);
}

#album-status:empty {
    display: none;
}

.album-grid {
    margin-top: 28px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 32px 24px;
}

.album-card {
    margin: 0;
    min-width: 0;
}

.album-card button {
    width: 100%;
    text-align: left;
}

.album-page .album-card button {
    padding: 0;
}

.album-card img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    background: #ececf0;
}

.album-card figcaption {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding-top: 13px;
    font-size: 15px;
    align-items: baseline;
}

.album-card figcaption > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.album-card small {
    color: var(--album-muted);
    font-size: 11px;
    white-space: nowrap;
}

.album-more {
    text-align: center;
    padding: 35px 0 0;
}

/* 直接复用 updates/thumbnail.css 的画廊，只补充原生 dialog 和传输进度样式。 */
.album-viewer {
    margin: 0;
    inset: 0;
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    padding: 24px 0;
    border: 0;
    box-sizing: border-box;
    background: transparent;
    color: #fff;
    overflow: hidden;
    box-shadow: none;
    outline: none;
}

.album-viewer:not([open]) {
    display: none;
}

.album-viewer::backdrop {
    background: rgba(0, 0, 0, .88);
}

.album-viewer .gallery-top {
    max-width: calc(100% - 150px);
    flex: none;
}

.album-viewer .gallery-meta {
    text-align: center;
    overflow-wrap: anywhere;
}

.album-viewer .gallery-stage {
    flex-shrink: 1;
}

.album-viewer #album-downloads {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
}

.album-viewer .gallery-bottombar {
    justify-content: space-between;
}

.album-viewer button:hover {
    color: #fff;
}

.album-viewer button:disabled {
    opacity: .3;
    cursor: default;
}

.album-viewer .gallery-arrow:disabled:hover {
    background: transparent;
}

.album-viewer .gallery-hdr-btn {
    min-height: 48px;
}

.album-page .album-viewer button:focus-visible, .album-page .album-viewer a:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
}

#album-login {
    color: rgba(255, 255, 255, .9);
    font-size: 13px;
}

#album-viewer-status {
    color: #ddd;
    font-size: 12px;
    margin: 8px 0 0;
    text-align: center;
}

#album-viewer-status:empty {
    display: none;
}

/* 开关不继承全站表单输入框的整行尺寸。 */
.album-toolbar .album-updates-switch, .album-photo-controls .album-updates-switch {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    position: relative;
    width: auto;
    cursor: pointer;
    white-space: nowrap;
    font-size: 13px;
    min-height: 44px;
}

.album-page .album-updates-switch input {
    position: absolute;
    opacity: 0;
    width: 36px;
    height: 24px;
    margin: 0;
    left: 0;
}

.album-switch-track {
    display: inline-block;
    width: 34px;
    height: 20px;
    border-radius: 10px;
    background: #d7d9e0;
    position: relative;
    flex: none;
}

.album-switch-track::after {
    content: "";
    position: absolute;
    width: 14px;
    height: 14px;
    left: 3px;
    top: 3px;
    border-radius: 50%;
    background: #fff;
}

.album-updates-switch input:checked + .album-switch-track {
    background: var(--album-accent);
}

.album-updates-switch input:checked + .album-switch-track::after {
    transform: translateX(14px);
}

.album-updates-switch input:focus-visible + .album-switch-track {
    outline: 2px solid var(--album-accent);
    outline-offset: 3px;
}

.album-updates-switch input:disabled ~ span {
    opacity: .5;
}

.album-page [hidden] {
    display: none !important;
}

@media (max-width: 991px) {
    .album-heading.page__title {
        min-height: 250px;
        padding: 48px 0;
    }

    .album-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .album-content {
        padding-top: 32px;
    }
}

@media (max-width: 600px) {
    .album-heading.page__title {
        min-height: 220px;
        padding: 40px 0;
    }

    .album-heading p {
        max-width: 80%;
        font-size: 14px;
    }

    .album-heading .slider__shape {
        opacity: .25;
    }

    .album-list-heading h2 {
        font-size: 21px;
    }

    .album-upload {
        padding: 20px 16px;
    }

    .album-grid {
        gap: 24px 12px;
    }

    .album-card figcaption {
        display: block;
        font-size: 13px;
    }

    .album-card small {
        display: block;
        margin-top: 5px;
    }

    .album-fields {
        grid-template-columns: 1fr;
    }

    .album-toolbar {
        gap: 14px;
    }

    .album-actions {
        width: 100%;
        justify-content: space-between;
        gap: 8px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .album-heading .shape {
        animation: none;
    }
}

@media (prefers-reduced-motion: no-preference) {
    .album-card {
        animation: album-reveal .35s ease both;
    }

    @keyframes album-reveal {
        from {
            opacity: 0;
            transform: translateY(8px);
        }
        to {
            opacity: 1;
            transform: none;
        }
    }
}


@media (prefers-reduced-motion: no-preference) {
    .album-switch-track, .album-switch-track::after {
        transition: background .18s, transform .18s;
    }
}

/* 上传区以分区和留白组织，不增加厚重阴影。 */
.album-upload {
    border-radius: 14px;
    background: #fafafa;
    padding: 28px;
}

.album-upload-intro {
    border-bottom: 1px solid var(--album-line);
    margin-bottom: 22px;
    padding-bottom: 12px;
}

.album-file {
    border-radius: 10px;
    padding: 24px;
    color: var(--album-ink);
    font-weight: 500;
}

.album-file > i {
    color: var(--album-accent);
    margin-right: 8px;
}

.album-file input::file-selector-button {
    border: 0;
    border-radius: 8px;
    padding: 8px 14px;
    margin-right: 12px;
    background: #eeecff;
    color: #4636ff;
    cursor: pointer;
}

.album-fields input, .album-fields textarea {
    border-radius: 8px;
}

.album-upload > .z-btn {
    height: 42px;
    line-height: 40px;
    padding: 0 22px;
    border-radius: 10px;
    font-size: 14px;
}

.album-upload .album-location {
    display: flex;
    align-items: center;
    gap: 8px;
}

.album-upload .album-location input {
    width: auto;
    height: auto;
    margin: 0;
}

/* 三档平铺；信息角标仅在大图档出现。 */
.album-grid {
    gap: 6px;
}

.album-grid[data-density="1"] {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.album-grid[data-density="2"] {
    grid-template-columns: repeat(8, minmax(0, 1fr));
}

.album-card button {
    position: relative;
    display: block;
}

.album-grid .album-card figcaption {
    position: absolute;
    bottom: 8px;
    left: 8px;
    max-width: calc(100% - 16px);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    border-radius: 5px;
    background: rgba(0, 0, 0, .62);
    color: #fff;
    font-size: 12px;
    line-height: 1.5;
    pointer-events: none;
}

.album-grid .album-card small {
    color: #eee;
    margin: 0;
    flex: none;
    font-size: 10px;
}

.album-grid[data-density="1"] figcaption,
.album-grid[data-density="2"] figcaption {
    display: none;
}

.album-zoom {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--album-line);
    border-radius: 10px;
    overflow: hidden;
}

.album-zoom button {
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--album-ink);
    cursor: pointer;
}

.album-zoom button:hover:not(:disabled) {
    background: #eeecff;
    color: var(--album-accent);
}

.album-page .album-zoom button:disabled {
    opacity: .3;
    cursor: default;
}

.album-zoom button:focus-visible {
    outline-offset: -4px;
}

.album-zoom span {
    min-width: 38px;
    text-align: center;
    font-size: 12px;
    color: var(--album-muted);
}

@media (max-width: 991px) {
    .album-grid[data-density="1"] {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .album-grid[data-density="2"] {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .album-grid {
        gap: 4px;
    }

    .album-grid[data-density="1"] {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .album-grid[data-density="2"] {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .album-grid .album-card figcaption {
        left: 4px;
        bottom: 4px;
        max-width: calc(100% - 8px);
        gap: 4px;
        padding: 3px 5px;
        font-size: 11px;
    }
}

/* 独立浮动控件低于画廊（9999），原生 dialog 也始终位于其上方。 */
.album-photo-controls {
    position: fixed;
    right: max(30px, env(safe-area-inset-right));
    bottom: max(40px, env(safe-area-inset-bottom));
    z-index: 900;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px 30px;
    max-width: calc(100vw - 40px);
    padding: 10px 24px;
    border: 1px solid var(--album-line);
    border-radius: 20px;
    background: rgba(255, 255, 255, .96);
    /*box-shadow: 0 3px 14px rgba(0, 0, 0, .1);*/
}

.album-photo-controls label {
    margin: 0;
}

.album-photo-controls .album-zoom {
    position: relative;
    border: 0;
    border-radius: 0;
    overflow: visible;
}

.album-photo-controls .album-zoom::before,
.album-photo-controls .album-zoom::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 1px;
    height: 20px;
    background: #4636ff;
    transform: translateY(-50%);
    pointer-events: none;
}

.album-photo-controls .album-zoom::before {
    left: -7px;
}

.album-photo-controls .album-zoom::after {
    right: -7px;
}

.album-content {
    padding-bottom: 160px;
}

.album-grid .album-card figcaption:empty {
    display: none;
}

.album-photo-badge {
    position: absolute;
    top: 8px;
    padding: 3px 7px;
    border-radius: 4px;
    background: rgba(0, 0, 0, .62);
    color: #fff;
    font-size: 11px;
    line-height: 1.5;
    pointer-events: none;
}

.album-photo-source {
    left: 8px;
}

.album-photo-hdr {
    right: 8px;
}

.album-grid[data-density="1"] .album-photo-badge,
.album-grid[data-density="2"] .album-photo-badge {
    display: none;
}

@media (max-width: 600px) {
    .album-photo-controls {
        gap: 4px 10px;
        padding: 8px 10px;
    }

    .album-photo-controls .album-zoom button {
        width: 32px;
    }

    .album-photo-controls .album-zoom span {
        min-width: 32px;
    }

    .album-photo-controls .album-zoom::before {
        left: -5px;
    }

    .album-photo-controls .album-zoom::after {
        right: -5px;
    }

    .album-photo-badge {
        top: 4px;
    }

    .album-photo-source {
        left: 4px;
    }

    .album-photo-hdr {
        right: 4px;
    }
}

/* 与动态上传区一样，逐张预览、移除，名称独立填写。 */
.album-upload-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.album-upload-list:empty {
    display: none;
}

.album-upload-tile {
    min-width: 0;
}

.album-upload-preview {
    position: relative;
    aspect-ratio: 4 / 3;
    background: #eeedf2;
    border-radius: 10px;
    overflow: hidden;
    display: grid;
    place-items: center;
}

.album-upload-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    inset: 0;
}

.album-upload-preview > span {
    padding: 16px;
    font-size: 12px;
    color: var(--album-muted);
}

.album-upload-remove {
    position: absolute;
    right: 6px;
    top: 6px;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, .65);
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
}

.album-upload-tile small {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--album-muted);
    margin: 8px 0;
}

.album-upload-tile label {
    display: grid;
    gap: 6px;
    font-size: 13px;
}

.album-upload-tile input {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid var(--album-line);
    border-radius: 8px;
    background: #fff;
    color: var(--album-ink);
}

.album-upload-tile input::placeholder {
    color: #9a9da6;
}

.album-upload .album-fields {
    grid-template-columns: 1fr;
}

@media (max-width: 480px) {
    .album-upload-list {
        grid-template-columns: 1fr;
    }
}

/* 与动态发布区一致：无外层卡片，描述框在上，虚线图片区在下。 */
.album-upload {
    padding: 32px 0;
    margin: 0 0 28px;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.album-upload-intro {
    border: 0;
    padding: 0;
    margin: 0;
}

.album-upload-intro h2 {
    font-size: 28px;
    color: #211c44;
    margin: 0 0 12px;
}

.album-upload-intro p {
    font-size: 15px;
    color: #333;
    margin: 0 0 8px;
}

.album-upload-description {
    display: block;
    width: 100%;
    min-height: 130px;
    padding: 18px 20px;
    margin: 0 0 12px;
    border: 0;
    border-radius: 12px;
    background: #f5f5f5;
    color: #333;
    font: inherit;
    font-size: 15px;
    line-height: 1.8;
    resize: vertical;
}

.album-upload-description::placeholder {
    color: #686777;
}

.album-upload-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    align-items: start;
    gap: 12px;
    margin: 4px 0 16px;
    padding: 12px;
    border: 1px dashed #d0d7de;
    border-radius: 12px;
    background: #fff;
}

.album-upload-list[data-dragover] {
    border-color: #4636ff;
    background: rgba(70, 54, 255, .04);
}

.album-add-tile {
    position: relative;
    order: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    margin: 0;
    border: 1px solid #ccd6e4;
    border-radius: 10px;
    background: #f8f8f8;
    color: #4636ff;
    font-size: 28px;
    cursor: pointer;
}

.album-add-tile input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.album-add-tile:focus-within {
    outline: 2px solid #4636ff;
    outline-offset: 2px;
}

.album-add-tile:has(input:disabled) {
    opacity: .45;
}

.album-upload-preview {
    aspect-ratio: 1;
}

.album-upload-tile input {
    font-size: 12px;
    padding: 8px;
    background: #f5f5f5;
    border: 0;
}

.album-upload-tile small {
    font-size: 11px;
}

.album-upload > .z-btn {
    height: 54px;
    line-height: 52px;
    padding: 0 48px;
    font-size: 16px;
}

@media (max-width: 480px) {
    .album-upload {
        padding: 24px 0;
    }

    .album-upload-intro h2 {
        font-size: 25px;
    }

    .album-upload-list {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    }
}

.album-card {
    position: relative;
}

/* 相册筛选采用低对比边界，避免环绕式亮阴影。 */
.album-page #filterBar {
    box-shadow: 0 2px 6px rgba(25, 22, 50, .06);
    border: 1px solid #e4e4e9;
}

.album-filter-shell {
    display: contents;
}

.album-delete-control {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 20px;
    font-size: 14px;
    cursor: pointer;
}

.album-delete-control input {
    width: 16px;
    height: 16px;
    margin: 0;
}

.album-grid[data-delete-mode="true"] .album-card > button {
    cursor: pointer;
    outline: 1px solid #b54b55;
    outline-offset: -1px;
}

.album-grid[data-delete-mode="true"] .album-card > button:hover {
    opacity: .75;
}

/* 沿用动态页右下角筛选按钮，不占用正文空间。 */
.album-filter-toggle {
    position: fixed;
    right: max(50px, env(safe-area-inset-right));
    bottom: max(150px, calc(env(safe-area-inset-bottom) + 110px));
    width: 40px;
    height: 40px;
    line-height: 40px;
    text-align: center;
    padding: 0;
    border: 1px solid #4636ff;
    border-radius: 0;
    background: #4636ff;
    color: #fff;
    font-size: 15px;
    cursor: pointer;
    z-index: 1001;
}

.album-filter-toggle i {
    margin: 0;
}

@media (max-width: 993px) {
    .album-filter-toggle {
        bottom: max(210px, calc(env(safe-area-inset-bottom) + 170px));
    }
}

@media (max-width: 1200px) {
    .album-filter-shell {
        display: block;
        position: sticky;
        top: 90px;
        z-index: 100;
    }

    .album-page #filterBar {
        position: static;
        margin: 8px 0 0;
        max-width: 100%;
        max-height: 60dvh;
        overflow-y: auto;
    }

    .album-page #filterBar .filter-row--controls {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas: "time" "place" "search";
    }

    .album-page #filterBar .filter-group {
        min-width: 0;
    }
}

@media (max-width: 600px) {
    .album-actions {
        justify-content: flex-start;
        gap: 16px;
    }

    .album-photo-controls {
        flex-wrap: nowrap;
        right: max(10px, env(safe-area-inset-right));
        max-width: calc(100vw - 20px);
        padding: 6px 8px;
        gap: 8px;
    }

    .album-photo-controls #album-count {
        white-space: nowrap;
        font-size: 12px;
    }

    .album-photo-controls .album-updates-switch {
        gap: 5px;
        font-size: 12px;
    }

    .album-photo-controls .album-zoom button {
        width: 28px;
    }

    .album-photo-controls .album-zoom span {
        min-width: 28px;
    }

    .album-photo-controls .album-zoom::before {
        left: -4px;
    }

    .album-photo-controls .album-zoom::after {
        right: -4px;
    }

    .album-page #filterBar .filter-label {
        min-width: 0;
    }

    .album-page #filterBar select {
        min-width: 0;
        flex: 1;
        width: 0;
        padding-left: 8px;
        padding-right: 20px;
    }
}

/* 左下角独立悬浮，避开右侧回顶和筛选按钮。 */
.album-page .album-photo-controls {
    left: max(20px, env(safe-area-inset-left));
    right: auto;
}
@media (max-width: 600px) {
    .album-page .album-photo-controls {
        left: max(10px, env(safe-area-inset-left));
        right: auto;
    }
}
