/* ========================================
   用户个人主页（/user/{name}）
   依赖 main.min.css 的全局 CSS 变量（--bg-card 等）
   暗黑模式：html[data-theme="dark"]
   ======================================== */

.user-profile {
    width: 100%;
}

/* ========================================
   头部横幅（星空，两种模式均保持深色）
   ======================================== */
.user-profile__hero {
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, #121216 0%, #0a0a0d 60%, #0a0a0d 100%);
    color: #fff;
}

/* 星点 + 微光 */
.user-profile__hero-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image:
        radial-gradient(1.5px 1.5px at 12% 22%, rgba(255, 255, 255, 0.9), transparent 100%),
        radial-gradient(1px 1px at 28% 68%, rgba(255, 255, 255, 0.55), transparent 100%),
        radial-gradient(1.5px 1.5px at 41% 14%, rgba(255, 255, 255, 0.7), transparent 100%),
        radial-gradient(1px 1px at 55% 42%, rgba(255, 255, 255, 0.5), transparent 100%),
        radial-gradient(2px 2px at 63% 76%, rgba(255, 255, 255, 0.65), transparent 100%),
        radial-gradient(1px 1px at 74% 18%, rgba(255, 255, 255, 0.75), transparent 100%),
        radial-gradient(1.5px 1.5px at 84% 56%, rgba(255, 255, 255, 0.6), transparent 100%),
        radial-gradient(1px 1px at 92% 30%, rgba(255, 255, 255, 0.5), transparent 100%),
        radial-gradient(1px 1px at 8% 82%, rgba(255, 255, 255, 0.45), transparent 100%),
        radial-gradient(1.5px 1.5px at 34% 40%, rgba(255, 255, 255, 0.35), transparent 100%),
        radial-gradient(600px 320px at 12% 0%, rgba(99, 91, 255, 0.14), transparent 100%),
        radial-gradient(700px 340px at 88% 6%, rgba(56, 189, 248, 0.10), transparent 100%);
}

/* 自定义背景图层 */
.user-profile__hero-photo {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    pointer-events: none;
}

/* 照片上的暗色渐变，保证文字可读 */
.user-profile__hero-photo::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgb(10 10 13 / 10%) 0%, rgb(10 10 13 / 30%) 55%, rgb(10 10 13 / 50%) 100%);
}

/* 有自定义背景时隐藏默认星空 */
.user-profile__hero.has-photo .user-profile__hero-bg {
    display: none;
}

.user-profile__hero.has-photo::before {
    display: none;
}

/* 星座连线 */
.user-profile__hero::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1400' height='480' viewBox='0 0 1400 480'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='0.14' stroke-width='1'%3E%3Cpath d='M40 320L160 250L300 290L430 180L570 240L700 130L840 200L980 110L1130 170L1270 90L1370 150'/%3E%3Cpath d='M160 250L230 150L430 180M300 290L380 370L570 240M700 130L760 60L980 110M840 200L920 300L1130 170M380 370L540 410L760 320L920 300M540 410L700 380M40 320L40 400'/%3E%3Cpath d='M1270 90L1330 40M1130 170L1240 260L1370 150M1240 260L1300 340'/%3E%3C/g%3E%3Cg fill='%23ffffff'%3E%3Ccircle cx='40' cy='320' r='2' fill-opacity='0.5'/%3E%3Ccircle cx='160' cy='250' r='2.6' fill-opacity='0.6'/%3E%3Ccircle cx='300' cy='290' r='2' fill-opacity='0.45'/%3E%3Ccircle cx='430' cy='180' r='3' fill-opacity='0.65'/%3E%3Ccircle cx='570' cy='240' r='2.2' fill-opacity='0.5'/%3E%3Ccircle cx='700' cy='130' r='2.8' fill-opacity='0.6'/%3E%3Ccircle cx='840' cy='200' r='2' fill-opacity='0.45'/%3E%3Ccircle cx='980' cy='110' r='2.6' fill-opacity='0.6'/%3E%3Ccircle cx='1130' cy='170' r='2.2' fill-opacity='0.5'/%3E%3Ccircle cx='1270' cy='90' r='3' fill-opacity='0.65'/%3E%3Ccircle cx='1370' cy='150' r='2' fill-opacity='0.5'/%3E%3Ccircle cx='230' cy='150' r='1.8' fill-opacity='0.4'/%3E%3Ccircle cx='380' cy='370' r='2.2' fill-opacity='0.45'/%3E%3Ccircle cx='760' cy='60' r='2' fill-opacity='0.5'/%3E%3Ccircle cx='920' cy='300' r='2.4' fill-opacity='0.5'/%3E%3Ccircle cx='540' cy='410' r='2' fill-opacity='0.4'/%3E%3Ccircle cx='760' cy='320' r='1.8' fill-opacity='0.4'/%3E%3Ccircle cx='1240' cy='260' r='2.2' fill-opacity='0.45'/%3E%3Ccircle cx='1300' cy='340' r='1.8' fill-opacity='0.4'/%3E%3Ccircle cx='1330' cy='40' r='1.8' fill-opacity='0.45'/%3E%3Ccircle cx='700' cy='380' r='1.8' fill-opacity='0.4'/%3E%3Ccircle cx='120' cy='90' r='1' fill-opacity='0.25'/%3E%3Ccircle cx='340' cy='70' r='1.2' fill-opacity='0.3'/%3E%3Ccircle cx='520' cy='120' r='1' fill-opacity='0.2'/%3E%3Ccircle cx='640' cy='50' r='1.2' fill-opacity='0.28'/%3E%3Ccircle cx='880' cy='40' r='1' fill-opacity='0.22'/%3E%3Ccircle cx='1050' cy='60' r='1.2' fill-opacity='0.3'/%3E%3Ccircle cx='1180' cy='110' r='1' fill-opacity='0.2'/%3E%3Ccircle cx='1360' cy='240' r='1' fill-opacity='0.25'/%3E%3Ccircle cx='90' cy='180' r='1' fill-opacity='0.2'/%3E%3Ccircle cx='1330' cy='400' r='1.2' fill-opacity='0.25'/%3E%3C/g%3E%3C/svg%3E");
    background-size: cover;
    background-position: center;
}

.user-profile__hero-inner {
    position: relative;
    z-index: 1;
    max-width: 860px;
    margin: 0 auto;
    padding: 72px 24px 56px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

/* 头像（金色光环） */
.user-profile__avatar {
    width: 128px;
    height: 128px;
    border-radius: 50%;
    padding: 4px;
    background: conic-gradient(from 210deg, #f7d774, #b8860b, #ffe9a8, #8a6d1f, #f7d774);
    box-shadow:
        0 0 0 6px rgba(255, 255, 255, 0.05),
        0 0 40px rgba(247, 215, 116, 0.18),
        0 12px 40px rgba(0, 0, 0, 0.55);
}

.user-profile__avatar img {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    background: #1c1c22;
}

/* 昵称 + 徽章 */
.user-profile__name {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 20px 0 0;
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
}

.user-profile__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f7d774, #d99a1f);
    box-shadow: 0 1px 6px rgba(217, 154, 31, 0.5);
    flex: none;
}

.user-profile__bio {
    margin: 12px 0 0;
    max-width: 520px;
    font-size: 14px;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.55);
}

/* 统计卡片 */
.user-profile__stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px;
    margin-top: 30px;
}

.user-profile__stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 110px;
    padding: 16px 26px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.09);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: background 0.25s, transform 0.25s;
}

.user-profile__stat:hover {
    background: rgba(255, 255, 255, 0.11);
    transform: translateY(-2px);
}

.user-profile__stat-num {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.2;
    color: #fff;
    font-variant-numeric: tabular-nums;
}

.user-profile__stat-label {
    margin-top: 5px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.55);
}

/* 昨日访客头像堆叠 */
.user-profile__visitor-avatars {
    display: flex;
    align-items: center;
    height: 29px;
}

.user-profile__visitor-avatars img {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid rgba(10, 10, 13, 0.9);
    object-fit: cover;
    background: #1c1c22;
}

.user-profile__visitor-avatars img + img {
    margin-left: -8px;
}

.user-profile__visitor-none {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.75);
    line-height: 29px;
}

/* 拥有者操作按钮 */
.user-profile__actions {
    position: absolute;
    top: 22px;
    right: 24px;
    display: flex;
    gap: 10px;
    z-index: 2;
}

.user-profile__action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.88);
    font-size: 13px;
    cursor: pointer;
    transition: background 0.25s, border-color 0.25s;
}

.user-profile__action-btn:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.24);
    color: #fff;
}

/* 恢复默认（弱化样式） */
.user-profile__action-btn--ghost {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.55);
}

.user-profile__action-btn--ghost:hover {
    background: rgba(255, 77, 109, 0.25);
    border-color: rgba(255, 77, 109, 0.4);
    color: #fff;
}

/* ========================================
   作品区域
   ======================================== */
.user-profile__body {
    padding: 32px 0px 72px;
    background: var(--bg-body);
    transition: background 0.3s;
}

/* 作品区容器：留白与限宽由全站统一容器 .x-container 提供 */

/* 工具栏 */
.user-profile__toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 22px;
}

.user-profile__tabs {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    border-radius: 999px;
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    box-shadow: var(--shadow-sm);
}

.user-profile__tab {
    padding: 7px 18px;
    border-radius: 999px;
    font-size: 14px;
    color: var(--text-secondary);
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
}

.user-profile__tab:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.user-profile__tab.is-active {
    background: var(--theme-color);
    color: #fff;
}

.user-profile__sort select {
    height: 38px;
    padding: 0 34px 0 14px;
    border-radius: 999px;
    border: 1px solid var(--border-input);
    background-color: var(--bg-card);
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 14px;
    transition: border-color 0.2s;
}

.user-profile__sort select:focus {
    outline: none;
    border-color: var(--border-focus);
}

/* ========================================
   作品卡片网格
   ======================================== */
.user-profile__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
}

.up-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: none;
    transition: transform 0.25s;
}

.up-card:hover {
    transform: translateY(-4px);
    box-shadow: none;
}

/* 封面 */
.up-card__thumb {
    position: relative;
    display: block;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: var(--bg-secondary);
}

.up-card__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.35s;
}

.up-card:hover .up-card__thumb img {
    transform: scale(1.05);
}

.up-card__thumb--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-hover));
}

.up-card__thumb-placeholder {
    display: inline-flex;
    color: var(--text-muted);
    opacity: 0.7;
}

/* 点赞按钮（默认隐藏，悬停卡片时显示；触屏设备始终显示） */
.up-card__like {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.4);
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    transition: background 0.2s, color 0.2s, transform 0.2s, opacity 0.25s;
}

.up-card__like:hover {
    background: rgba(0, 0, 0, 0.6);
    transform: scale(1.08);
}

.up-card__like.is-liked {
    background: rgba(255, 77, 109, 0.85);
    color: #fff;
}

@media (hover: hover) {
    .up-card__like {
        opacity: 0;
        transform: scale(0.85);
    }

    .up-card:hover .up-card__like,
    .up-card__like:focus-visible {
        opacity: 1;
        transform: scale(1);
    }

    .up-card:hover .up-card__like:hover {
        transform: scale(1.08);
    }

    .up-card:hover .up-card__like.is-liked {
        opacity: 1;
        transform: scale(1);
    }
}

/* 卡片内容 */
.up-card__body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 12px 14px 12px;
}

.up-card__title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-primary);
}

.up-card__title a {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: inherit;
    transition: color 0.2s;
}

.up-card__title a:hover {
    color: var(--color-link);
}

.up-card__badge {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 4px;
    background: var(--color-success);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
}

.up-card__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    margin-top: 7px;
    min-height: 16px;
}

.up-card__tag {
    font-size: 12px;
    color: var(--text-tertiary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 90px;
}

/* 底部作者行 */
.up-card__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: auto;
    padding-top: 11px;
}

.up-card__author {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    font-size: 12px;
    color: var(--text-tertiary);
}

.up-card__author img {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--bg-hover);
    flex: none;
}

.up-card__author span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: color 0.2s;
}

.up-card__author:hover span {
    color: var(--color-link);
}

.up-card__stats {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    flex: none;
}

.up-card__stat {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 12px;
    color: var(--text-tertiary);
    font-variant-numeric: tabular-nums;
}

.up-card__stat--like svg {
    color: var(--text-muted);
    opacity: 0.8;
}

/* 分页 */
.user-profile__pagination {
    margin-top: 34px;
    justify-content: center;
}

/* 空状态 */
.user-profile__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 90px 20px;
    color: var(--text-muted);
    text-align: center;
}

.user-profile__empty svg {
    opacity: 0.35;
}

.user-profile__empty p {
    margin: 0;
    font-size: 14px;
}

/* 轻提示 */
.up-toast {
    position: fixed;
    left: 50%;
    bottom: 48px;
    transform: translateX(-50%) translateY(12px);
    z-index: 99999;
    padding: 10px 20px;
    border-radius: 8px;
    background: rgba(20, 20, 24, 0.92);
    color: #fff;
    font-size: 13px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
    max-width: 80vw;
    word-break: break-all;
}

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

/* ========================================
   响应式
   ======================================== */
@media (max-width: 768px) {
    .user-profile__hero-inner {
        padding: 56px 16px 42px;
    }

    .user-profile__avatar {
        width: 104px;
        height: 104px;
    }

    .user-profile__name {
        font-size: 22px;
    }

    .user-profile__actions {
        top: 14px;
        right: 12px;
    }

    .user-profile__action-btn {
        padding: 6px 12px;
        font-size: 12px;
    }

    .user-profile__stats {
        gap: 10px;
        margin-top: 24px;
    }

    .user-profile__stat {
        min-width: 96px;
        padding: 12px 18px;
    }

    .user-profile__stat-num {
        font-size: 20px;
    }

    .user-profile__body {
        padding: 24px 14px 56px;
    }

    .user-profile__grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 12px;
    }

    .user-profile__toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .user-profile__tabs {
        justify-content: center;
    }

    .user-profile__sort {
        display: flex;
        justify-content: flex-end;
    }
}
