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

:root {
    --primary-color: #5D4037;
    --secondary-color: #FFFBF0;
    --accent-color: #FFB7B2;
    --accent-green: #B5EAD7;
    --accent-yellow: #E2F0CB;
    --text-primary: #4A4A4A;
    --text-secondary: #767676;
    --bg-primary: #FFFBF0;
    --bg-secondary: #F9F7F5;
    --border-color: rgba(200, 180, 200, 0.2);
    --shadow-sm: 0 4px 12px -2px rgba(200, 180, 200, 0.2);
    --shadow-md: 0 8px 20px -4px rgba(200, 180, 200, 0.3);
    --shadow-lg: 0 10px 25px -5px rgba(200, 180, 200, 0.4);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --gradient-subtle: linear-gradient(135deg, #FFFBF0 0%, #F9F7F5 100%);
}

body {
    font-family: 'M PLUS Rounded 1c', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: #fffbf0;
    background-image: radial-gradient(#e0dcd3 1px, transparent 1px);
    background-size: 20px 20px;
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ============== 头部 ============== */
.header {
    border-bottom: none;
    padding: 1.25rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.7);
    box-shadow: none;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--primary-color);
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    font-family: 'M PLUS Rounded 1c', sans-serif;
    transition: var(--transition);
}

.logo-emoji {
    font-size: 1.5rem;
    line-height: 1;
}

.logo:hover {
    transform: translateY(-1px);
}

.logo-jp {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--text-primary);
}

.logo-xg {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.05em;
    color: var(--primary-color);
    position: relative;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.header-stats {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-update {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    background: rgba(255, 183, 178, 0.1);
    transition: var(--transition);
}

.header-update:hover {
    background: rgba(255, 183, 178, 0.2);
    color: var(--text-primary);
}

.header-update svg {
    flex-shrink: 0;
    opacity: 0.6;
}

.update-text {
    white-space: nowrap;
    font-weight: 500;
}

.count-badge {
    background-color: #FFE4E1;
    color: #D47FA6;
    padding: 0.375rem 0.875rem;
    border-radius: 50px;
    font-size: 0.875rem;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(212, 127, 166, 0.2);
    transition: var(--transition);
    border: 2px solid rgba(212, 127, 166, 0.1);
}

.count-badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(212, 127, 166, 0.3);
    background-color: #FFD6D1;
}

.subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ============== 主内容区 ============== */
.main-content {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    width: 100%;
}

/* ============== 图片网格 ============== */
.images-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-top: 1rem;
}

@media (max-width: 1024px) {
    .images-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.75rem;
    }
}

@media (max-width: 768px) {
    .images-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    .images-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
}

/* ============== 图片卡片 ============== */
.image-card {
    position: relative;
    background: var(--bg-primary);
    border-radius: 24px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease;
    box-shadow: 0 10px 25px -5px rgba(200, 180, 200, 0.3);
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(200, 180, 200, 0.15);
}

.image-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px -5px rgba(200, 180, 200, 0.4);
}

.image-card:hover .image-overlay {
    opacity: 1 !important;
}

.image-card:active {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.image-wrapper {
    width: 100%;
    flex: 1;
    position: relative;
    overflow: hidden;
    background: var(--bg-secondary);
}

.image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
    display: block;
}

.image-card:hover .image-wrapper img {
    transform: scale(1.05);
}

/* 确保overlay在hover时显示 */
.image-card:hover .image-overlay {
    opacity: 1;
}

.pinterest-link {
    display: flex;
    flex-direction: column;
    height: 100%;
    text-decoration: none;
    color: inherit;
}

.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(0,0,0,0) 55%, rgba(0,0,0,0.85) 100%);
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: space-between;
    padding: 0;
    z-index: 10;
    pointer-events: auto;
}

.image-card:hover .image-overlay {
    opacity: 1;
}

/* 上半部分：Like/Dislike 按钮区域 */
.action-area {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    padding: 1.5rem;
    pointer-events: auto;
}

.hover-action-btn {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.9);
    border-radius: 50px;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    pointer-events: auto;
    opacity: 0;
    transform: translateY(-10px);
}

.image-card:hover .hover-action-btn {
    opacity: 1;
    transform: translateY(0);
}

.hover-action-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.hover-action-btn:active {
    transform: translateY(0) scale(0.98);
}

.hover-action-btn svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.action-label {
    white-space: nowrap;
    font-family: 'M PLUS Rounded 1c', sans-serif;
}

.hover-like-btn {
    color: #D47FA6;
    border-color: rgba(212, 127, 166, 0.3);
}

.hover-like-btn:hover {
    background: rgba(255, 183, 178, 0.2);
    border-color: rgba(212, 127, 166, 0.5);
    color: #D47FA6;
}

.hover-like-btn.active {
    background: #FFB7B2;
    color: #ffffff;
    border-color: #FFB7B2;
}

.hover-dislike-btn {
    color: #8B7D7D;
    border-color: rgba(139, 125, 125, 0.3);
}

.hover-dislike-btn:hover {
    background: rgba(139, 125, 125, 0.1);
    border-color: rgba(139, 125, 125, 0.5);
    color: #8B7D7D;
}

.hover-dislike-btn.active {
    background: #8B7D7D;
    color: #ffffff;
    border-color: #8B7D7D;
}

.image-overlay .image-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1.5rem 1.75rem;
    width: 100%;
    box-sizing: border-box;
    max-height: 50%;
    overflow: visible;
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
    pointer-events: none;
}

.image-info {
    color: #ffffff;
    width: 100%;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6), 0 2px 6px rgba(0, 0, 0, 0.4);
}

.image-title {
    font-size: 0.9375rem;
    font-weight: 600;
    margin: 0;
    padding: 0;
    line-height: 1.6;
    display: block;
    overflow: visible;
    font-family: 'M PLUS Rounded 1c', sans-serif;
    letter-spacing: -0.01em;
    word-wrap: break-word;
    word-break: break-word;
    white-space: normal;
    max-height: none;
    hyphens: auto;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.image-stats {
    display: flex;
    gap: 1.25rem;
    font-size: 0.8125rem;
    opacity: 1;
    font-weight: 500;
    flex-wrap: wrap;
}

.image-stat {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-family: 'M PLUS Rounded 1c', sans-serif;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.image-stat svg {
    flex-shrink: 0;
}

.image-footer {
    padding: 0.75rem 1.125rem;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    backdrop-filter: blur(10px);
}

.footer-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.image-meta {
    display: flex;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    flex: 1;
}

.image-meta-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.image-score {
    font-size: 0.75rem;
    font-weight: 600;
    color: #D47FA6;
    background: #FFE4E1;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    white-space: nowrap;
    flex-shrink: 0;
}


/* ============== 加载状态 ============== */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(200, 180, 200, 0.2);
    border-top-color: #FFB7B2;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 1rem;
}

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

/* ============== 空状态 ============== */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.empty-state h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

/* ============== 响应式设计 ============== */
@media (max-width: 1024px) {
    .image-footer {
        padding: 0.75rem 1rem;
        gap: 0.5rem;
}

    .action-area {
        gap: 1.5rem;
        padding: 1rem;
    }
    
    .hover-action-btn {
        padding: 0.625rem 1.25rem;
        font-size: 0.8125rem;
}

    .hover-action-btn svg {
        width: 18px;
        height: 18px;
    }
    
    .images-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.75rem;
}
}

@media (max-width: 768px) {
    .header-content {
        padding: 0 1rem;
}

    .header-info {
        gap: 0.75rem;
}

    .header-update {
        font-size: 0.7rem;
        padding: 0.2rem 0.4rem;
}

    .header-update svg {
        width: 10px;
        height: 10px;
}

    .main-content {
        padding: 1rem;
}

    .images-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
}

    .image-footer {
        padding: 0.5rem 0.75rem;
    gap: 0.5rem;
}

    .image-meta {
        font-size: 0.7rem;
        gap: 0.5rem;
    }
    
    .action-area {
        gap: 1.25rem;
        padding: 1rem 0.75rem;
}

    .hover-action-btn {
        padding: 0.625rem 1.125rem;
        font-size: 0.8125rem;
}

    .hover-action-btn svg {
        width: 16px;
        height: 16px;
}

    .action-label {
        display: none;
}

    .image-score {
        font-size: 0.7rem;
        padding: 0.2rem 0.4rem;
    }
}

@media (max-width: 480px) {
    .header-info {
        gap: 0.5rem;
        flex-direction: column;
        align-items: flex-end;
}

    .header-stats {
        order: 1;
}

    .header-update {
        order: 2;
        font-size: 0.65rem;
        padding: 0.15rem 0.35rem;
        align-self: flex-end;
}

    .header-update svg {
        width: 9px;
        height: 9px;
    }
    
    .images-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
}

    .image-footer {
        padding: 0.5rem 0.6rem;
        gap: 0.4rem;
}

    .action-area {
        gap: 0.875rem;
        padding: 0.625rem 0.5rem;
    }
    
    .hover-action-btn {
        padding: 0.5rem 0.875rem;
        font-size: 0.7rem;
        border-radius: 35px;
    }
    
    .hover-action-btn svg {
        width: 14px;
        height: 14px;
}

    .action-label {
        display: none;
    }
    
    .image-meta {
        font-size: 0.65rem;
        gap: 0.4rem;
}

    .image-score {
        font-size: 0.65rem;
        padding: 0.15rem 0.35rem;
    }
}

/* ============== 动画效果 ============== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.image-card {
    animation: fadeIn 0.4s ease-out;
    animation-fill-mode: both;
}

.image-card:nth-child(1) { animation-delay: 0.05s; }
.image-card:nth-child(2) { animation-delay: 0.1s; }
.image-card:nth-child(3) { animation-delay: 0.15s; }
.image-card:nth-child(4) { animation-delay: 0.2s; }
.image-card:nth-child(5) { animation-delay: 0.25s; }
.image-card:nth-child(n+6) { animation-delay: 0.3s; }

/* ============== Pinterest链接样式 ============== */
.pinterest-link {
    text-decoration: none;
    color: inherit;
    display: block;
    width: 100%;
    height: 100%;
}
