:root {
    --text-primary: #e2e8f0;
    --text-secondary: #cbd5e1;
    --text-muted: #6ca2ee;
    --card-bg: rgba(30, 41, 59, 0.3);
    --card-border: rgba(148, 163, 184, 0.2);
    --accent-color: #f97316;
    --transition: all 0.3s ease;
}

[data-theme="light"] {
    --text-primary: #b6c2d4;
    --text-secondary: #334155;
    --text-muted: #76a7eb;
    --card-bg: rgba(255, 255, 255, 0.4);
    --card-border: rgba(148, 163, 184, 0.3);
    --accent-color: #ea580c;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: var(--text-primary);
    transition: var(--transition);
    position: relative;
    overflow-x: hidden;
}

/* 优化后的顶部气泡样式 */
.loading-bubble {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: linear-gradient(135deg, var(--accent-color), #ff8c42);
    color: white;
    padding: 14px 28px;
    border-radius: 50px;
    box-shadow:
        0 10px 30px rgba(249, 115, 22, 0.4),
        0 4px 15px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    max-width: 280px;
    width: auto;
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    overflow: hidden;
}

.loading-bubble::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
            rgba(255, 255, 255, 0) 0%,
            rgba(255, 255, 255, 0.2) 50%,
            rgba(255, 255, 255, 0) 100%);
    transform: translateX(-100%);
}

.loading-bubble.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.loading-bubble.hide {
    opacity: 0;
    transform: translateX(-50%) translateY(-100px);
    pointer-events: none;
}

.loading-bubble.show::before {
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

.loading-bubble .spinner {
    width: 22px;
    height: 22px;
    border: 3px solid rgba(255, 255, 255, 0.25);
    border-top-color: white;
    border-radius: 50%;
    animation: bubbleSpin 1s linear infinite;
    flex-shrink: 0;
}

@keyframes bubbleSpin {
    to {
        transform: rotate(360deg);
    }
}

/* 气泡脉冲效果 */
@keyframes bubblePulse {

    0%,
    100% {
        box-shadow:
            0 10px 30px rgba(249, 115, 22, 0.4),
            0 4px 15px rgba(0, 0, 0, 0.2),
            inset 0 1px 0 rgba(255, 255, 255, 0.3);
    }

    50% {
        box-shadow:
            0 15px 40px rgba(249, 115, 22, 0.5),
            0 6px 20px rgba(0, 0, 0, 0.25),
            inset 0 1px 0 rgba(255, 255, 255, 0.4);
    }
}

.loading-bubble.show {
    animation: bubblePulse 2s ease-in-out infinite;
}

/* 成功/失败状态样式 */
.loading-bubble.success {
    background: linear-gradient(135deg, #10b981, #34d399);
    animation: none;
}

.loading-bubble.error {
    background: linear-gradient(135deg, #ef4444, #f87171);
    animation: none;
}

/* 修改背景图片样式，添加渐显效果 */
.background-image {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('');
    /* 初始为空，通过懒加载设置 */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: -2;
    transition: opacity 0.8s ease;
    /* 延长过渡时间，使渐变更平滑 */
    animation: zoomInOut 20s ease-in-out infinite;
    transform-origin: center;
    opacity: 0;
    /* 初始完全透明 */
    will-change: opacity, transform;
    /* 优化性能 */
}

@keyframes zoomInOut {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
        /* 确保动画过程中保持可见 */
    }

    50% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* 添加一个专门的淡入动画类 */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* 如果希望使用纯CSS动画而不是JS控制，可以添加这个类 */
.background-image.fade-in {
    animation: fadeIn 1.2s ease forwards;
}

.dark-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: -1;
    opacity: 1;
    transition: opacity 0.3s ease;
}

[data-theme="light"] .dark-overlay {
    opacity: 0;
}

.container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.card {
    background: var(--card-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--card-border);
    border-radius: 1.5rem;
    padding: 3rem;
    display: flex;
    align-items: center;
    gap: 3rem;
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.2),
        0 1px 0 rgba(255, 255, 255, 0.1) inset;
    transition: var(--transition);
    max-width: 800px;
    width: 100%;
    transform-style: preserve-3d;
    will-change: transform;
    position: relative;
}

.refresh-button {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    width: 28px;
    height: 28px;
    border: none;
    background: none;
    cursor: pointer;
    padding: 0;
    z-index: 10;
    opacity: 0.7;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.refresh-button:hover {
    opacity: 1;
    transform: scale(1.1);
}

.refresh-button img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    animation: rotate 3s linear infinite;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.avatar-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.2rem;
    min-width: 140px;
}

.avatar {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--accent-color);
    cursor: pointer;
    transition: transform 0.5s ease, border-color 0.3s ease;
    background: transparent;
    position: relative;
}

.avatar:hover {
    transform: rotate(360deg);
    border-color: var(--text-primary);
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.avatar-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-color);
    color: white;
    font-size: 40px;
}

/* 彩虹色用户名样式 - 已修复 text-fill-color 问题 */
.username {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 1px;
    background: linear-gradient(90deg,
            #ff0000 0%,
            #ff8000 20%,
            #ffff00 40%,
            #00ff00 60%,
            #0080ff 80%,
            #8000ff 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    /* 移除了 text-fill-color，只保留 -webkit-text-fill-color */
    animation: rainbowText 3s linear infinite;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    padding: 0.3rem 0;
    position: relative;
    display: inline-block;
}

/* 彩虹动画效果 */
@keyframes rainbowText {
    0% {
        background-position: 0% center;
    }

    100% {
        background-position: 200% center;
    }
}

/* 移除了用户名下的横线 */

.info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.clock {
    font-size: 3rem;
    font-weight: 700;
    color: var(--accent-color);
    letter-spacing: 1px;
    text-shadow: 0 2px 10px rgba(249, 115, 22, 0.3);
    font-family: 'Segoe UI', 'PingFang SC', monospace;
}

.greeting {
    font-size: 1.25rem;
    color: var(--text-secondary);
    font-weight: 300;
    margin-bottom: 0.5rem;
    opacity: 0.9;
}

.links-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-top: 0.5rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(148, 163, 184, 0.1);
    transition: all 0.3s ease;
}

.link-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 400;
    padding: 0.4rem 0.8rem;
    border-radius: 0.8rem;
    background: rgba(121, 168, 235, 0.08);
    transition: all 0.3s ease;
    border: 1px solid transparent;
    position: relative;
    z-index: 1;
}

/* 默认状态下所有链接都有一定透明度 */
.links-container .link-item {
    opacity: 0.9;
}

/* 悬停时的效果 */
.link-item:hover {
    color: var(--accent-color);
    background: rgba(249, 115, 22, 0.15);
    border-color: rgba(249, 115, 22, 0.3);
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 5px 15px rgba(249, 115, 22, 0.2);
    opacity: 1;
    z-index: 2;
}

/* 当有链接被悬停时，淡化其他链接 */
.links-container:hover .link-item:not(:hover) {
    opacity: 0.4;
    transform: scale(0.95);
    filter: grayscale(0.3);
}

/* 鼠标移出容器时恢复所有链接 */
.links-container:not(:hover) .link-item {
    opacity: 0.9;
    transform: scale(1);
    filter: grayscale(0);
}

.link-icon {
    width: 16px;
    height: 16px;
    opacity: 0.8;
    transition: all 0.3s ease;
}

.link-item:hover .link-icon {
    opacity: 1;
    transform: scale(1.2) rotate(8deg);
}

footer {
    text-align: center;
    padding: 2rem;
    color: var(--card-bg);
    font-size: 0.9rem;
}

footer a {
    text-decoration: none;
    color: var(--card-bg);
    transition: color 0.3s ease;
}

footer a:hover {
    color: var(--accent-color);
}

.background-placeholder {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    z-index: -3;
    /* 在背景图片之下 */
    opacity: 1;
    transition: opacity 1s ease;
}

.background-image.loaded~.background-placeholder {
    opacity: 0;
    pointer-events: none;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .card {
        flex-direction: column;
        text-align: center;
        padding: 2.5rem 2rem;
        gap: 2.5rem;
    }

    .avatar-container {
        min-width: auto;
    }

    .info {
        align-items: center;
    }

    .links-container {
        justify-content: center;
        gap: 1.2rem;
    }

    .clock {
        font-size: 2.5rem;
    }

    .greeting {
        font-size: 1.15rem;
    }

    .avatar {
        width: 130px;
        height: 130px;
    }

    .username {
        font-size: 1.6rem;
    }

    .refresh-button {
        top: 1rem;
        right: 1rem;
        width: 26px;
        height: 26px;
    }

    /* 移动端气泡样式调整 */
    .loading-bubble {
        top: 15px;
        max-width: 240px;
        padding: 12px 22px;
        font-size: 0.9rem;
        gap: 12px;
    }

    .loading-bubble .spinner {
        width: 20px;
        height: 20px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 1rem;
    }

    .card {
        padding: 2rem 1.5rem;
        gap: 2rem;
    }

    .avatar {
        width: 110px;
        height: 110px;
    }

    .username {
        font-size: 1.4rem;
    }

    .clock {
        font-size: 2.2rem;
    }

    .greeting {
        font-size: 1rem;
    }

    .links-container {
        gap: 1rem;
    }

    .link-item {
        font-size: 0.9rem;
        padding: 0.35rem 0.7rem;
    }

    .refresh-button {
        position: relative;
        top: auto;
        right: auto;
        align-self: flex-end;
        margin-bottom: 0.5rem;
        width: 24px;
        height: 24px;
    }

    /* 小屏幕气泡样式调整 */
    .loading-bubble {
        top: 10px;
        max-width: 200px;
        padding: 10px 18px;
        font-size: 0.85rem;
        gap: 10px;
    }

    .loading-bubble .spinner {
        width: 18px;
        height: 18px;
    }
}

/* 主题切换时调整用户名颜色 */
[data-theme="light"] .username {
    text-shadow: 0 2px 10px rgba(255, 255, 255, 0.3);
}

/* 浅色主题下的气泡样式 */
[data-theme="light"] .loading-bubble {
    background: linear-gradient(135deg, var(--accent-color), #ff7b24);
    box-shadow:
        0 10px 30px rgba(249, 115, 22, 0.35),
        0 4px 15px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.35);
}

/* 浅色主题下的链接样式 */
[data-theme="light"] .links-container .link-item {
    opacity: 0.8;
}

[data-theme="light"] .link-item:hover {
    background: rgba(249, 115, 22, 0.12);
    border-color: rgba(249, 115, 22, 0.25);
}

[data-theme="light"] .links-container:hover .link-item:not(:hover) {
    opacity: 0.3;
}