/* 作者: by BiliBili Ayaya小王 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --page-scale: 1;
    --tile-scale: 1;
}

body {
    font-family: 'Segoe UI', 'Microsoft YaHei', Arial, sans-serif;
    background-color: #0a0a0a;
    color: #c9a961;
    overflow-x: hidden;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    transform: scale(var(--page-scale));
    transform-origin: top left;
    width: calc(100% / var(--page-scale));
}

/* ========== 头部样式 ========== */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: linear-gradient(180deg, #0a0a0a 0%, #121212 100%);
    border-bottom: 2px solid #2a2a2a;
    padding: 20px 40px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
}

.title {
    font-size: 2.8rem;
    font-weight: 600;
    letter-spacing: 12px;
    text-align: center;
    margin-bottom: 25px;
    background: linear-gradient(135deg, #d4b76a 0%, #c9a961 30%, #f0d080 60%, #c9a961 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
    padding: 15px 0;
    text-shadow: 0 0 40px rgba(201, 169, 97, 0.6),
                 0 0 80px rgba(201, 169, 97, 0.4),
                 0 0 120px rgba(201, 169, 97, 0.2);
    animation: titleGradient 3s ease infinite;
    filter: drop-shadow(0 0 20px rgba(201, 169, 97, 0.5));
}

@keyframes titleGradient {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

.search-badge {
    display: none;
    margin: 8px auto 12px;
    padding: 6px 12px;
    max-width: 90%;
    text-align: center;
    font-size: 0.95rem;
    color: #d4b76a;
    background: rgba(201, 169, 97, 0.08);
    border: 1px solid #c9a961;
    border-radius: 999px;
    box-shadow: 0 2px 12px rgba(201, 169, 97, 0.15);
}

.search-container {
    position: relative;
    max-width: 600px;
    margin: 0 auto 15px;
}

.search-input {
    width: 100%;
    padding: 15px 50px 15px 20px;
    font-size: 1rem;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    color: #c9a961;
    outline: none;
    transition: all 0.3s ease;
}

.search-input::placeholder {
    color: #5a5a5a;
}

.search-input:focus {
    border-color: #c9a961;
    box-shadow: 0 0 15px rgba(201, 169, 97, 0.2);
    background: #222222;
}

.search-icon {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
    color: #8b7355;
    pointer-events: none;
}

/* ========== 标签页 ========== */
.tabs {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 5px auto 15px;
}

.scale-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 5px auto 12px;
}

.scale-label {
    font-size: 0.95rem;
    color: #8b7355;
}

.scale-select {
    padding: 6px 10px;
    background: #151515;
    border: 1px solid #2a2a2a;
    color: #c9a961;
    border-radius: 6px;
    cursor: pointer;
}

.scale-select:focus {
    outline: none;
    border-color: #c9a961;
    box-shadow: 0 0 10px rgba(201, 169, 97, 0.15);
}

.tab {
    padding: 8px 16px;
    background: #151515;
    border: 1px solid #2a2a2a;
    color: #c9a961;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.25s ease;
    font-size: 0.95rem;
}

.tab:hover {
    border-color: #c9a961;
    box-shadow: 0 4px 16px rgba(201, 169, 97, 0.15);
}

.tab.active {
    background: linear-gradient(135deg, rgba(201,169,97,0.25), rgba(201,169,97,0.05));
    border-color: #c9a961;
    box-shadow: 0 8px 24px rgba(201, 169, 97, 0.2) inset;
}

.stats {
    text-align: center;
    font-size: 0.9rem;
    color: #8b7355;
    font-weight: 300;
}

/* ========== 主内容区 ========== */
.main-content {
    padding: 40px 40px 80px;
    min-height: calc(100vh - 200px);
}

/* ========== 网格布局 ========== */
.gif-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(calc(250px * var(--tile-scale, 1)), 1fr));
    gap: calc(30px * var(--tile-scale, 1));
    margin-bottom: 40px;
    opacity: 1;
    transition: opacity 0.15s ease;
}

.gif-grid.updating {
    opacity: 0.3;
}

/* ========== GIF 卡片 ========== */
.gif-card {
    background: #151515;
    border: 1px solid #2a2a2a;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.gif-card:hover {
    border-color: #c9a961;
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(201, 169, 97, 0.2);
}

.gif-card:hover .gif-image {
    transform: scale(1.05);
}

.gif-image-container {
    width: 100%;
    height: calc(250px * var(--tile-scale, 1));
    background: #0a0a0a;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.gif-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.gif-image.loading {
    opacity: 0;
}

.placeholder {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 100%);
    color: #5a5a5a;
    font-size: 2rem;
}

.gif-info {
    padding: 15px;
    background: linear-gradient(180deg, #151515 0%, #0a0a0a 100%);
}

.gif-name {
    font-size: calc(1rem * var(--tile-scale, 1));
    color: #c9a961;
    margin-bottom: 8px;
    font-weight: 500;
    text-align: center;
    padding: 8px 12px;
    background: linear-gradient(135deg, rgba(201, 169, 97, 0.12) 0%, rgba(201, 169, 97, 0.06) 100%);
    border-radius: 6px;
    word-break: break-word;
    overflow-wrap: break-word;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
}

.gif-name:hover {
    background: linear-gradient(135deg, rgba(201, 169, 97, 0.2) 0%, rgba(201, 169, 97, 0.12) 100%);
}

.gif-id {
    font-size: calc(0.85rem * var(--tile-scale, 1));
    color: #c9a961;
    font-weight: 500;
    margin-top: 6px;
    text-align: center;
    word-break: break-all;
    cursor: pointer;
    user-select: none;
    transition: opacity 0.2s ease;
}

.gif-id:hover {
    opacity: 0.8;
}

/* ========== 模态框样式 ========== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    position: relative;
    background: #0a0a0a;
    border: 2px solid #c9a961;
    border-radius: 16px;
    max-width: 98%;
    max-height: 98%;
    overflow: auto;
    box-shadow: 0 0 50px rgba(201, 169, 97, 0.3);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { 
        transform: scale(0.8);
        opacity: 0;
    }
    to { 
        transform: scale(1);
        opacity: 1;
    }
}

.close-button {
    position: absolute;
    top: 15px;
    right: 20px;
    color: #c9a961;
    font-size: 2rem;
    font-weight: 300;
    cursor: pointer;
    z-index: 1001;
    transition: all 0.3s ease;
    line-height: 1;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
}

.close-button:hover {
    color: #fff;
    background: rgba(201, 169, 97, 0.3);
    transform: rotate(90deg);
}

.modal-body {
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.modal-image {
    width: min(85vmin, 95vw);
    height: min(85vmin, 95vw);
    max-height: 70vh;
    max-width: 95vw;
    border-radius: 8px;
    box-shadow: 0 0 30px rgba(201, 169, 97, 0.2);
    object-fit: contain;
}

.modal-info {
    text-align: center;
    padding: 15px 20px;
    background: linear-gradient(180deg, #151515 0%, #0a0a0a 100%);
    border-radius: 8px;
    border: 1px solid #2a2a2a;
    width: 100%;
    max-width: min(85vmin, 95vw);
    min-width: 300px;
    margin: 0 auto;
}

.modal-title {
    font-size: 1.5rem;
    color: #c9a961;
    margin-bottom: 10px;
    font-weight: 400;
    cursor: pointer;
    user-select: none;
    transition: opacity 0.2s ease;
    padding: 8px 12px;
    border-radius: 6px;
    display: inline-block;
}

.modal-title:hover {
    opacity: 0.8;
    background: rgba(201, 169, 97, 0.08);
}

.modal-id {
    font-size: 1.1rem;
    color: #c9a961;
    font-weight: 600;
    margin-top: 8px;
    text-align: center;
    word-break: break-all;
    cursor: pointer;
    user-select: none;
    transition: opacity 0.2s ease;
}

.modal-id:hover {
    opacity: 0.8;
}

/* ========== 加载状态 ========== */
.loading {
    text-align: center;
    padding: 60px 40px;
    font-size: 1.2rem;
    color: #8b7355;
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.loading.active {
    display: flex;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid #2a2a2a;
    border-top-color: #c9a961;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ========== 响应式设计 ========== */
@media (max-width: 1200px) {
    .gif-grid {
        grid-template-columns: repeat(auto-fill, minmax(calc(200px * var(--tile-scale, 1)), 1fr));
        gap: calc(20px * var(--tile-scale, 1));
    }
}

@media (max-width: 768px) {
    .header {
        padding: 15px 20px;
    }
    
    .title {
        font-size: 1.5rem;
        letter-spacing: 2px;
    }
    
    .main-content {
        padding: 20px;
    }
    
    .gif-grid {
        grid-template-columns: repeat(auto-fill, minmax(calc(150px * var(--tile-scale, 1)), 1fr));
        gap: calc(15px * var(--tile-scale, 1));
    }
    
    .gif-image-container {
        height: calc(200px * var(--tile-scale, 1));
    }
    
    .modal-body {
        padding: 15px;
    }
    
    .modal-info {
        min-width: 200px;
    }
}

/* ========== 作者水印 ========== */
.watermark {
    position: fixed;
    right: 12px;
    bottom: 12px;
    z-index: 2000;
    padding: 8px 14px;
    font-size: 14px;
    color: #d4b76a;
    background: rgba(10, 10, 10, 0.7);
    border: 1px solid #c9a961;
    border-radius: 6px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6);
    pointer-events: auto;
    user-select: none;
    text-decoration: none;
    cursor: pointer;
}

.watermark:hover {
    color: #fff;
    background: rgba(201, 169, 97, 0.15);
    border-color: #d4b76a;
    box-shadow: 0 6px 18px rgba(201, 169, 97, 0.25);
}

@media (max-width: 480px) {
    .gif-grid {
        grid-template-columns: repeat(auto-fill, minmax(calc(120px * var(--tile-scale, 1)), 1fr));
        gap: calc(10px * var(--tile-scale, 1));
    }
    
    .gif-image-container {
        height: calc(150px * var(--tile-scale, 1));
    }
}

/* ========== Toast 提示 ========== */
.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(10, 10, 10, 0.95);
    color: #c9a961;
    padding: 12px 24px;
    border-radius: 8px;
    border: 1px solid #c9a961;
    box-shadow: 0 4px 20px rgba(201, 169, 97, 0.3);
    font-size: 0.95rem;
    z-index: 3000;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    max-width: 90%;
    text-align: center;
    word-break: break-all;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

