/* ========== 全局重置 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ========== 基础样式 ========== */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #0a0a0a;
    color: #e0e0e0;
    min-height: 100vh;
    padding: 0 20px 20px;
}

/* ========== 头部 ========== */
header {
    text-align: center;
    padding: 30px 0 20px;
    border-bottom: 1px solid #2a2a2a;
    margin-bottom: 40px;
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
}

header h1 {
    font-size: 2.8rem;
    font-weight: 800;
    background: linear-gradient(135deg, #ff6b6b, #ffd93d, #6bcb77, #4d96ff);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientMove 6s ease-in-out infinite;
}

@keyframes gradientMove {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

header p {
    color: #888;
    margin-top: 6px;
    font-size: 1.05rem;
}

.time-display {
    margin-top: 10px;
    color: #666;
    font-size: 0.85rem;
    font-family: "SF Mono", "Menlo", monospace;
}

/* ========== 通用章节 ========== */
section {
    max-width: 1200px;
    margin: 0 auto 50px;
}

section h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: #ccc;
    font-weight: 600;
}

/* ========== 今日壁纸卡片 ========== */
#todayCard {
    background: #161616;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

#todayCard:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.8);
}

#todayCard img {
    width: 100%;
    max-height: 65vh;
    object-fit: cover;
    display: block;
    background: #111;
}

#todayCard .info {
    padding: 20px 28px;
}

#todayCard .info .date {
    font-size: 0.9rem;
    color: #888;
    letter-spacing: 0.5px;
}

#todayCard .info .copyright {
    font-size: 1rem;
    color: #aaa;
    margin-top: 4px;
}

#todayCard .info .copyright a {
    color: #4d96ff;
    text-decoration: none;
}

#todayCard .info .copyright a:hover {
    text-decoration: underline;
}

#todayCard .info .actions {
    display: flex;
    gap: 12px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.btn {
    display: inline-block;
    padding: 8px 22px;
    background: #2a2a2a;
    color: #e0e0e0;
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.btn:hover {
    background: #3a3a3a;
    border-color: #4a4a4a;
}

.btn-primary {
    background: #4d96ff;
    border-color: #4d96ff;
    color: #fff;
}

.btn-primary:hover {
    background: #3a7bd5;
    border-color: #3a7bd5;
}

.btn-secondary {
    background: transparent;
    border-color: #4d96ff;
    color: #4d96ff;
}

.btn-secondary:hover {
    background: rgba(77, 150, 255, 0.1);
}

/* ========== 历史壁纸网格 ========== */
#historyGrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.history-item {
    background: #161616;
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    cursor: pointer;
}

.history-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.history-item img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
    background: #111;
}

.history-item .info {
    padding: 10px 14px 14px;
}

.history-item .info .date {
    font-size: 0.8rem;
    color: #888;
}

.history-item .info .copyright {
    font-size: 0.75rem;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

/* ========== 加载状态 ========== */
.loading {
    text-align: center;
    padding: 60px 0;
    color: #666;
    font-size: 1rem;
}

.loading::after {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-left: 10px;
    border: 3px solid #2a2a2a;
    border-top-color: #4d96ff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.error {
    text-align: center;
    padding: 40px;
    color: #ff6b6b;
    background: #1a0a0a;
    border-radius: 12px;
    border: 1px solid #3a1a1a;
}

/* ========== 页脚 ========== */
footer {
    text-align: center;
    padding: 30px 0 10px;
    border-top: 1px solid #1a1a1a;
    color: #555;
    font-size: 0.9rem;
    max-width: 1200px;
    margin: 0 auto;
}

footer .footer-small {
    font-size: 0.75rem;
    color: #3a3a3a;
    margin-top: 4px;
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    header p {
        font-size: 0.9rem;
    }

    #todayCard .info {
        padding: 16px 18px;
    }

    #todayCard .info .copyright {
        font-size: 0.9rem;
    }

    #historyGrid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }

    .btn {
        padding: 6px 16px;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    body {
        padding: 0 12px 12px;
    }

    header {
        padding: 20px 0 16px;
    }

    header h1 {
        font-size: 1.6rem;
    }

    #historyGrid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
    }

    .history-item .info {
        padding: 6px 10px 10px;
    }

    #todayCard .info .actions {
        flex-direction: column;
    }

    .btn {
        text-align: center;
    }
}
