/* CSS Variables */
:root {
    --primary: #3498db;
    --primary-light: #e1f0fa;
    --secondary: #7f8c8d;
    --light: #f8f9fa;
    --dark: #2c3e50;
    --border: #e0e0e0;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --shadow-hover: 0 4px 16px rgba(0,0,0,0.12);
    --radius: 10px;
    --transition: all 0.3s ease;
    
    /* Dark Mode Variables */
    --dark-bg: #1a1a1a;
    --dark-text: #ffffff;
    --dark-card: #2d2d2d;
    --dark-border: #404040;
    --dark-shadow: 0 2px 12px rgba(0,0,0,0.3);
}

/* Dark Mode Styles */
body.dark-mode {
    background: var(--dark-bg);
    color: var(--dark-text);
}

body.dark-mode .container {
    background: var(--dark-card);
    box-shadow: var(--dark-shadow);
}

body.dark-mode .header {
    border-bottom-color: var(--dark-border);
}

/* Dark Mode Header Decorations */
body.dark-mode .header-decoration {
    opacity: 0.3;
}

body.dark-mode .header-decoration-left {
    opacity: 0.3;
}

body.dark-mode .header::before {
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(255, 105, 180, 0.1) 0%, transparent 30%),
        radial-gradient(circle at 80% 20%, rgba(100, 200, 255, 0.1) 0%, transparent 30%),
        radial-gradient(circle at 40% 70%, rgba(255, 215, 0, 0.1) 0%, transparent 30%),
        radial-gradient(circle at 60% 80%, rgba(147, 112, 219, 0.1) 0%, transparent 30%);
}

body.dark-mode .header::after {
    opacity: 0.3;
    background-image: 
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23ff9ff3' d='M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2M12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4Z'/%3E%3C/svg%3E"),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%2354a0ff' d='M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2M12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4Z'/%3E%3C/svg%3E"),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23ff9f43' d='M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2M12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4Z'/%3E%3C/svg%3E");
}

body.dark-mode .header-decoration-top {
    opacity: 0.3;
}

body.dark-mode .header-decoration-bottom {
    opacity: 0.3;
}

body.dark-mode .stats-card {
    background: var(--dark-card);
    box-shadow: var(--dark-shadow);
}

body.dark-mode .api-card {
    background: var(--dark-card);
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

body.dark-mode .api-link {
    background: rgba(255,255,255,0.05);
    border-color: var(--dark-border);
}

body.dark-mode .category-nav-btn {
    background: #333;
    border-color: #444;
    color: var(--dark-text);
}

body.dark-mode .category-nav-btn:hover {
    background: #444;
    border-color: #555;
}

body.dark-mode .category-nav-btn.active {
    background: #555;
    border-color: #666;
}

body.dark-mode .category-nav-btn.disabled {
    background: #2a2a2a;
    border-color: #3a3a3a;
    color: #888;
}

body.dark-mode .category-tag {
    color: var(--dark-text);
}

body.dark-mode .category-tag:hover {
    background: rgba(255,255,255,0.1) !important;
    border-color: rgba(255,255,255,0.2);
}

body.dark-mode .stat-item {
    background: rgba(255,255,255,0.05) !important;
}

body.dark-mode .copy-btn {
    background: #555 !important;
}

body.dark-mode .copy-btn:hover {
    background: #666 !important;
}

body.dark-mode .gradient-title {
    background: linear-gradient(135deg, #ffffff 0%, #cccccc 50%, #ffffff 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

body.dark-mode .gradient-title::after {
    background: linear-gradient(90deg, transparent, #ffffff, transparent);
}

body.dark-mode .image-container {
    background: transparent;
}

body.dark-mode .image-container::before {
    background-image: 
        radial-gradient(circle at 20% 20%, rgba(255, 105, 180, 0.15) 0%, transparent 20%),
        radial-gradient(circle at 80% 80%, rgba(100, 200, 255, 0.15) 0%, transparent 20%),
        radial-gradient(circle at 40% 60%, rgba(255, 215, 0, 0.15) 0%, transparent 20%),
        radial-gradient(circle at 60% 30%, rgba(147, 112, 219, 0.15) 0%, transparent 20%);
}

body.dark-mode .image-container::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23ff69b4' d='M12 2L15.09 8.26L22 9.27L17 14.14L18.18 21.02L12 17.77L5.82 21.02L7 14.14L2 9.27L8.91 8.26L12 2z'/%3E%3C/svg%3E");
    opacity: 0.2;
}

body.dark-mode .image-container .anime-decoration {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%236495ed' d='M21 16.5c0 .83-.67 1.5-1.5 1.5H4.5c-.83 0-1.5-.67-1.5-1.5v-9c0-.83.67-1.5 1.5-1.5h15c.83 0 1.5.67 1.5 1.5v9zM4.5 20h15c.83 0 1.5-.67 1.5-1.5v-9c0-.83-.67-1.5-1.5-1.5h-15c-.83 0-1.5.67-1.5 1.5v9c0 .83.67 1.5 1.5 1.5z'/%3E%3C/svg%3E");
    opacity: 0.2;
}

body.dark-mode .image-container img {
    box-shadow: 0 4px 12px rgba(255,255,255,0.1);
}

body.dark-mode .image-container img:hover {
    box-shadow: 0 6px 16px rgba(255,255,255,0.15);
}

body.dark-mode .refresh-btn {
    background: rgba(0,0,0,0.8);
    box-shadow: 0 2px 8px rgba(255,255,255,0.1);
}

body.dark-mode .refresh-btn:hover {
    background: var(--primary);
}

body.dark-mode .stat-item div:last-child {
    color: #cccccc;
}

body.dark-mode .stat-item:nth-child(5) {
    background: rgba(255, 215, 0, 0.15) !important;
}
body.dark-mode .stat-item:nth-child(6) {
    background: rgba(255, 140, 0, 0.15) !important;
}

body.dark-mode .category-tag .tag-count {
    color: #aaaaaa;
}

body.dark-mode .category-tag.disabled {
    background: rgba(100,100,100,0.3);
    color: #888;
}

body.dark-mode .category-tag.disabled .tag-count {
    color: #777;
}

body.dark-mode .category-tooltip {
    background: rgba(255,255,255,0.95);
    color: #000;
    box-shadow: 0 4px 12px rgba(255,255,255,0.2);
}

body.dark-mode .category-tooltip::after {
    border-bottom-color: rgba(255,255,255,0.95);
}

body.dark-mode .copy-toast {
    background: rgba(255,255,255,0.95);
    color: #000;
    box-shadow: 0 8px 32px rgba(255,255,255,0.3);
    border: 1px solid rgba(0,0,0,0.1);
}

body.dark-mode #imageInfo {
    color: #cccccc;
}

body.dark-mode .category-selector h3 {
    color: #ffffff;
}

body.dark-mode p {
    color: #cccccc;
}

body.dark-mode #weeklyChart {
    filter: brightness(0.8) contrast(1.2);
}

body.dark-mode .category-selector h3[style*="color:#000"] {
    color: #ffffff !important;
}

body.dark-mode .api-card[style*="background:#ffffff"] {
    background: var(--dark-card) !important;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3) !important;
}

body.dark-mode .api-link div[style*="color: #000"] {
    color: #ffffff !important;
}

body.dark-mode .category-nav-btn.disabled[style*="color: #666"] {
    color: #888 !important;
}

body.dark-mode .category-nav-btn.disabled .category-name[style*="color: #666"] {
    color: #888 !important;
}

body.dark-mode .category-nav-btn.disabled .category-count[style*="color: #999"] {
    color: #777 !important;
}

body.dark-mode .category-tag .tag-count[style*="color:#666"] {
    color: #aaaaaa !important;
}

body.dark-mode .category-tag.disabled .tag-count[style*="color:#999"] {
    color: #777 !important;
}

body.dark-mode #imageInfo[style*="color:var(--secondary)"] {
    color: #cccccc !important;
}

body.dark-mode .image-container div[style*="color: #6b7280"] {
    color: #aaaaaa !important;
}

body.dark-mode #noImageMessage {
    color: #aaaaaa !important;
}

body.dark-mode #noImageMessage svg {
    stroke: #aaaaaa !important;
}

body.dark-mode #noImageMessage div {
    color: #aaaaaa !important;
}

body.dark-mode #weeklyChart div[style*="color:#7f8c8d"] {
    color: #aaaaaa !important;
}

/* Dark Mode Toggle Button */
.dark-mode-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid rgba(255, 255, 255, 0.8);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1),
                inset 0 1px 2px rgba(255, 255, 255, 0.8);
    overflow: hidden;
}

.dark-mode-toggle::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #000000 0%, #434343 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 50%;
}

.dark-mode-toggle:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.4);
}

.dark-mode-toggle:active {
    transform: translateY(0) scale(0.95);
    box-shadow: 0 2px 15px rgba(102, 126, 234, 0.2);
}

.dark-mode-toggle svg {
    width: 24px;
    height: 24px;
    color: #4a5568;
    transition: all 0.3s ease;
    position: relative;
    z-index: 2;
}

body.dark-mode .dark-mode-toggle svg {
    color: #e2e8f0;
}

.dark-mode-toggle::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    transform: rotate(45deg);
    animation: shine 3s infinite;
    opacity: 0.6;
}

@keyframes shine {
    0% {
        transform: rotate(45deg) translateX(-100%);
    }
    100% {
        transform: rotate(45deg) translateX(100%);
    }
}

body.dark-mode .dark-mode-toggle::after {
    background: linear-gradient(
        45deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    opacity: 0.4;
}

body.dark-mode .dark-mode-toggle {
    background: linear-gradient(135deg, #2d3748 0%, #4a5568 100%);
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3),
                inset 0 1px 2px rgba(255, 255, 255, 0.1);
}

body.dark-mode .dark-mode-toggle::before {
    opacity: 1;
}

body.dark-mode .dark-mode-toggle:hover {
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.4),
                inset 0 1px 2px rgba(255, 255, 255, 0.15);
}

body.dark-mode .dark-mode-toggle:active {
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.2),
                inset 0 1px 2px rgba(255, 255, 255, 0.05);
}

.dark-mode-toggle .moon-icon,
.dark-mode-toggle .sun-icon {
    position: absolute;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.dark-mode-toggle .moon-icon {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

.dark-mode-toggle .sun-icon {
    opacity: 0;
    transform: scale(0.5) rotate(-90deg);
}

body.dark-mode .dark-mode-toggle .moon-icon {
    opacity: 0;
    transform: scale(0.5) rotate(90deg);
}

body.dark-mode .dark-mode-toggle .sun-icon {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

.dark-mode-tooltip {
    position: fixed;
    top: 80px;
    right: 20px;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    z-index: 1000;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    pointer-events: none;
    backdrop-filter: blur(10px);
}

.dark-mode-tooltip.show {
    opacity: 1;
    transform: translateY(0);
}

body.dark-mode .dark-mode-tooltip {
    background: rgba(255, 255, 255, 0.95);
    color: #000;
}

/* Global Styles */
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #f5f5f5;
    padding: 20px;
    margin: 0;
    color: var(--dark);
    line-height: 1.6;
}

h1, h2, h3 {
    font-weight: 600;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.header {
    text-align: center;
    margin-bottom: 30px;
    padding: 40px 20px;
    border-bottom: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(255, 105, 180, 0.15) 0%, transparent 30%),
        radial-gradient(circle at 80% 20%, rgba(100, 200, 255, 0.15) 0%, transparent 30%),
        radial-gradient(circle at 40% 70%, rgba(255, 215, 0, 0.15) 0%, transparent 30%),
        radial-gradient(circle at 60% 80%, rgba(147, 112, 219, 0.15) 0%, transparent 30%);
    background-size: 400px 400px;
    background-position: 0 0, 200px 150px, 100px 300px, 300px 200px;
    animation: headerAnimeBackground 15s linear infinite;
    z-index: -1;
    pointer-events: none;
}

.header::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23ff9ff3' d='M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2M12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4Z'/%3E%3C/svg%3E"),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%2354a0ff' d='M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2M12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4Z'/%3E%3C/svg%3E"),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23ff9f43' d='M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2M12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4Z'/%3E%3C/svg%3E");
    background-size: 20px 20px, 16px 16px, 12px 12px;
    background-position: 30% 20%, 70% 60%, 15% 75%;
    background-repeat: no-repeat;
    opacity: 0.7;
    z-index: -1;
    animation: smallFloat 5s ease-in-out infinite;
}

@keyframes smallFloat {
    0%, 100% { transform: translateY(0px) scale(1); }
    50% { transform: translateY(-10px) scale(1.1); }
}

@keyframes headerAnimeBackground {
    0% {
        background-position: 0 0, 200px 150px, 100px 300px, 300px 200px;
    }
    100% {
        background-position: 400px 400px, 600px 550px, 500px 700px, 700px 600px;
    }
}

.header-decoration {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 60px;
    height: 60px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23ff69b4' d='M12 2L15.09 8.26L22 9.27L17 14.14L18.18 21.02L12 17.77L5.82 21.02L7 14.14L2 9.27L8.91 8.26L12 2z'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    opacity: 0.6;
    animation: headerFloat 3s ease-in-out infinite;
    z-index: 1;
}

@keyframes headerFloat {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-12px) rotate(10deg); }
}

.header-decoration-left {
    position: absolute;
    bottom: 15px;
    left: 15px;
    width: 50px;
    height: 50px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%236495ed' d='M21 16.5c0 .83-.67 1.5-1.5 1.5H4.5c-.83 0-1.5-.67-1.5-1.5v-9c0-.83.67-1.5 1.5-1.5h15c.83 0 1.5.67 1.5 1.5v9zM4.5 20h15c.83 0 1.5-.67 1.5-1.5v-9c0-.83-.67-1.5-1.5-1.5h-15c-.83 0-1.5.67-1.5 1.5v9c0 .83.67 1.5 1.5 1.5z'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    opacity: 0.6;
    animation: headerSpin 4s linear infinite;
    z-index: 1;
}

.header-decoration-top {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 30px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23ff7675' d='M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2M12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4Z'/%3E%3C/svg%3E"),
                    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%2355efc4' d='M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2M12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4Z'/%3E%3C/svg%3E");
    background-size: 15px 15px, 12px 12px;
    background-position: 0 50%, 100% 50%;
    background-repeat: no-repeat;
    opacity: 0.7;
    animation: topDecoration 6s ease-in-out infinite;
    z-index: 1;
}

@keyframes topDecoration {
    0%, 100% { transform: translateX(-50%) scale(1); }
    50% { transform: translateX(-50%) scale(1.25); }
}

.header-decoration-bottom {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 140px;
    height: 25px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23fdcb6e' d='M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2M12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4Z'/%3E%3C/svg%3E"),
                    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23a29bfe' d='M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2M12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4Z'/%3E%3C/svg%3E"),
                    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23fd79a8' d='M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2M12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4Z'/%3E%3C/svg%3E");
    background-size: 12px 12px, 15px 15px, 12px 12px;
    background-position: 0 50%, 50% 50%, 100% 50%;
    background-repeat: no-repeat;
    opacity: 0.7;
    animation: bottomDecoration 8s ease-in-out infinite;
    z-index: 1;
}

@keyframes bottomDecoration {
    0%, 100% { transform: translateX(-50%) scale(1); }
    50% { transform: translateX(-50%) scale(1.3); }
}

@keyframes headerSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.gradient-title {
    background: linear-gradient(135deg, #000000 0%, #434343 50%, #000000 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    display: inline-block;
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: 1px;
    margin: 0;
    padding: 10px 0;
    position: relative;
    text-shadow: 0px 2px 3px rgba(255,255,255,0.1);
}

.gradient-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background: linear-gradient(90deg, transparent, #000000, transparent);
}

.main {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

.image-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.image-container {
    position: relative;
    text-align: center;
    padding: 25px;
    background: transparent;
    transition: var(--transition);
    overflow: hidden;
}

.image-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 20% 20%, rgba(255, 105, 180, 0.1) 0%, transparent 20%),
        radial-gradient(circle at 80% 80%, rgba(100, 200, 255, 0.1) 0%, transparent 20%),
        radial-gradient(circle at 40% 60%, rgba(255, 215, 0, 0.1) 0%, transparent 20%),
        radial-gradient(circle at 60% 30%, rgba(147, 112, 219, 0.1) 0%, transparent 20%);
    background-size: 300px 300px;
    background-position: 0 0, 150px 150px, 75px 225px, 225px 75px;
    animation: animeBackground 20s linear infinite;
    z-index: -1;
    pointer-events: none;
}

@keyframes animeBackground {
    0% {
        background-position: 0 0, 150px 150px, 75px 225px, 225px 75px;
    }
    100% {
        background-position: 300px 300px, 450px 450px, 375px 525px, 525px 375px;
    }
}

.image-container::after {
    content: '';
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23ff69b4' d='M12 2L15.09 8.26L22 9.27L17 14.14L18.18 21.02L12 17.77L5.82 21.02L7 14.14L2 9.27L8.91 8.26L12 2z'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    opacity: 0.3;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-5px) rotate(5deg); }
}

.image-container .anime-decoration {
    position: absolute;
    bottom: 10px;
    left: 10px;
    width: 30px;
    height: 30px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%236495ed' d='M21 16.5c0 .83-.67 1.5-1.5 1.5H4.5c-.83 0-1.5-.67-1.5-1.5v-9c0-.83.67-1.5 1.5-1.5h15c.83 0 1.5.67 1.5 1.5v9zM4.5 20h15c.83 0 1.5-.67 1.5-1.5v-9c0-.83-.67-1.5-1.5-1.5h-15c-.83 0-1.5.67-1.5 1.5v9c0 .83.67 1.5 1.5 1.5z'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    opacity: 0.3;
    animation: spin 4s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.image-container img {
    max-width: 100%;
    max-height: 400px;
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: var(--transition);
    cursor: pointer;
}

.image-container img:hover {
    transform: scale(1.01);
    box-shadow: 0 6px 16px rgba(0,0,0,0.15);
}

.refresh-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255,255,255,0.9);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: var(--transition);
}

.refresh-btn:hover {
    background: var(--primary);
    color: white;
    transform: rotate(90deg);
}

.stats-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 100%;
    overflow: hidden;
}

.stats-card {
    padding: 20px;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr 1fr;
    gap: 10px;
    margin-top: 15px;
}

.stat-item:nth-child(5) {
    text-align: center;
    padding: 10px;
    background: rgba(255, 245, 157, 0.3);
    border-radius: var(--radius);
}
.stat-item:nth-child(6) {
    text-align: center;
    padding: 10px;
    background: rgba(255, 204, 188, 0.3);
    border-radius: var(--radius);
}

.stat-item:nth-child(1) {
    text-align: center;
    padding: 10px;
    background: rgba(244, 211, 187, 0.2);
    border-radius: var(--radius);
}
.stat-item:nth-child(2) {
    text-align: center;
    padding: 10px;
    background: rgba(173, 216, 230, 0.2);
    border-radius: var(--radius);
}
.stat-item:nth-child(3) {
    text-align: center;
    padding: 10px;
    background: rgba(144, 238, 144, 0.2);
    border-radius: var(--radius);
}
.stat-item:nth-child(4) {
    text-align: center;
    padding: 10px;
    background: rgba(255, 182, 193, 0.2);
    border-radius: var(--radius);
}
.stat-item div:first-child {
    font-weight: bold;
}
.stat-item div:last-child {
    color: var(--secondary);
    font-size: 0.9em;
}

.category-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: tooltipFadeIn 0.2s ease-out;
}

.category-tooltip::after {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid rgba(0, 0, 0, 0.85);
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.bubble-effect {
    position: fixed;
    background: rgba(74, 144, 226, 0.6);
    border-radius: 50%;
    pointer-events: none;
    z-index: 999;
    animation: bubbleRise 1s ease-out forwards;
}

@keyframes bubbleRise {
    0% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translateY(-80px) scale(0.3);
        opacity: 0;
    }
}

.bubble-effect:nth-child(2n) {
    background: rgba(255, 193, 7, 0.6);
}

.bubble-effect:nth-child(3n) {
    background: rgba(102, 187, 106, 0.6);
}

.bubble-effect:nth-child(4n) {
    background: rgba(156, 39, 176, 0.6);
}

.bubble-effect:nth-child(5n) {
    background: rgba(244, 67, 54, 0.6);
}

.category-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin: 20px 0;
}

.category-nav-btn {
    padding: 6px 12px;
    border: 1px solid #000;
    border-radius: 6px;
    background: #000;
    color: #fff;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.category-nav-btn:hover {
    background: #333;
    transform: translateY(-1px);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
    border-color: #333;
}

.category-nav-btn.active {
    background: #333;
    color: white;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.3);
    border-color: #333;
    transform: scale(1.02);
}

.category-count {
    font-size: 0.85rem;
    opacity: 0.8;
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
}

.category-nav-btn.active .category-count {
    background: rgba(255, 255, 255, 0.3);
}

.category-tag {
    padding: 4px 10px;
    border-radius: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    position: relative;
    border: 2px solid transparent;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--dark);
}

.category-tag:hover {
    border-color: rgba(0, 0, 0, 0.2);
    background: rgba(255, 255, 255, 0.9) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.category-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
    flex-shrink: 0;
}

.tag-name {
    margin-right: 4px;
    font-weight: 600;
}

.tag-count {
    font-size: 0.85rem;
    opacity: 0.8;
    margin-right: 4px;
}

.hot-icon {
    margin-left: 4px;
    vertical-align: middle;
    display: inline-flex;
    align-items: center;
    font-size: 0.9rem;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

.api-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.api-link > div:first-child {
    min-width: 70px;
    color: #6c757d;
    font-size: 0.9rem;
    font-weight: 500;
    flex-shrink: 0;
}

.api-link > div:nth-child(2) {
    flex: 1;
    min-width: 0;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.85rem;
    color: #6c757d;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: break-word;
    padding: 4px 0;
    box-sizing: border-box;
}

.copy-btn {
    background: #495057 !important;
    border: none !important;
    padding: 6px !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    flex-shrink: 0 !important;
    color: white !important;
    opacity: 1 !important;
    position: relative !important;
    z-index: 1 !important;
}

.copy-btn:hover,
.copy-btn:focus,
.copy-btn:active {
    background: #495057 !important;
    transform: none !important;
    opacity: 1 !important;
}

.copy-toast {
    position: fixed;
    top: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(-50px);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 28px;
    border-radius: 16px;
    font-size: 15px;
    font-weight: 600;
    z-index: 10000;
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.4);
    animation: toastBounceIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
    display: flex;
    align-items: center;
    gap: 12px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

@keyframes toastBounceIn {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(-80px) scale(0.8);
    }
    60% {
        opacity: 1;
        transform: translateX(-50%) translateY(25px) scale(1.05);
    }
    80% {
        transform: translateX(-50%) translateY(-10px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
}

.copy-toast::before {
    display: none;
}

.breathing-text {
    animation: breathing 2s ease-in-out infinite;
}

@keyframes breathing {
    0%, 100% {
        text-shadow: 0 0 5px rgba(255, 100, 100, 0.5);
        transform: scale(1);
    }
    50% {
        text-shadow: 0 0 20px rgba(255, 100, 100, 0.8);
        transform: scale(1.05);
    }
}

.fireworks-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.firework {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    pointer-events: none;
}

@keyframes firework {
    0% {
        transform: translate(0, 0);
        opacity: 1;
    }
    100% {
        transform: translate(var(--tx), var(--ty));
        opacity: 0;
    }
}

.copy-toast svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.copy-toast::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: shine 3s infinite;
}

.breathing-red {
    animation: breathingRed 3s ease-in-out infinite;
}

.breathing-gold {
    animation: breathingGold 3s ease-in-out infinite;
}

@keyframes breathingRed {
    0% {
        box-shadow: 0 0 2px rgba(255, 68, 68, 0.2);
    }
    50% {
        box-shadow: 0 0 4px rgba(255, 68, 68, 0.4);
    }
    100% {
        box-shadow: 0 0 2px rgba(255, 68, 68, 0.2);
    }
}

@keyframes breathingGold {
    0% {
        box-shadow: 0 0 2px rgba(255, 215, 0, 0.2);
    }
    50% {
        box-shadow: 0 0 5px rgba(255, 215, 0, 0.4);
    }
    100% {
        box-shadow: 0 0 2px rgba(255, 215, 0, 0.2);
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .stat-grid {
        grid-template-columns: 1fr 1fr;
    }
    .main {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    .image-container {
        padding: 15px;
    }
    .category-selector div {
        justify-content: center;
    }
    .stats-card {
        padding: 15px;
    }
    .api-link > div:nth-child(2) {
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .stat-grid {
        grid-template-columns: 1fr !important;
    }
    .container {
        padding: 15px;
    }
    .category-selector div {
        gap: 8px;
    }
    .api-link > div:nth-child(2) {
        font-size: 0.7rem;
    }
    .api-link {
        flex-wrap: wrap;
    }
    .api-link > div:first-child {
        min-width: 60px;
    }
}

/* Additional Animations */
@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes toastSlideOut {
    from {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    to {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
}

/* Image Wrapper */
#imageWrapper {
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    position: relative;
    z-index: 2;
}

#randomImage {
    cursor: pointer;
    max-width: 100%;
    max-height: 400px;
    opacity: 1;
    transition: opacity 0.3s ease;
}

#loadingIndicator {
    position: absolute;
    display: none;
    justify-content: center;
    align-items: center;
}

#noImageMessage {
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 16px;
    color: #6b7280;
    text-align: center;
    padding: 60px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

#noImageMessage svg {
    width: 64px;
    height: 64px;
    opacity: 0.5;
}

#noImageMessage div:first-child {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 8px;
}

#noImageMessage div:last-child {
    font-size: 14px;
    opacity: 0.8;
    max-width: 300px;
}

#imageInfo {
    margin-top: 15px;
    font-size: 0.9rem;
    color: var(--secondary);
    text-align: center;
}

.category-selector {
    margin-top: 25px;
}

.category-selector h3 {
    margin-bottom: 15px;
    color: #000;
    font-size: 1.1rem;
    font-weight: 600;
}

.api-card {
    margin-top: 25px;
    padding: 20px;
    background: #ffffff;
    border-radius: 12px;
    border: none;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.api-card h4 {
    margin: 0 0 16px 0;
    color: #333;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.api-link > div:first-child {
    color: #000;
    font-weight: 600;
}

.category-tag {
    position: relative;
}

.category-tag .category-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
    flex-shrink: 0;
}

.category-tag .tag-name {
    margin-right: 4px;
    font-weight: 600;
}

.category-tag .tag-count {
    font-size: 0.85rem;
    opacity: 0.8;
    margin-right: 4px;
}

.hot-icon {
    margin-left: 4px;
    vertical-align: middle;
    display: inline-flex;
    align-items: center;
    font-size: 0.9rem;
    animation: pulse 1.5s infinite;
}

.stats-card h3 {
    margin-bottom: 15px;
}

.stats-card > div:first-child + div {
    margin-top: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

#weeklyChart {
    width: 100%;
    max-height: 100%;
}

#weeklyChart + div {
    height: 180px;
    position: relative;
}

/* Image Preview Modal */
.image-preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.image-preview-modal.show {
    opacity: 1;
    visibility: visible;
}

.image-preview-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.image-preview-modal.show .image-preview-content {
    transform: scale(1);
}

.image-preview-content img {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.image-preview-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.3s ease;
}

.image-preview-close:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: rotate(90deg);
}

.image-preview-download {
    position: absolute;
    top: -40px;
    left: 0;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.image-preview-download:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
}

/* Search Container */
.search-container {
    margin: 20px 0;
    padding: 20px;
    background: var(--light);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.search-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    transition: var(--transition);
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.search-btn {
    margin-top: 12px;
    padding: 10px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
}

.search-btn:hover {
    background: #2980b9;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.search-btn:active {
    transform: translateY(0);
}

/* Collection Button */
.collect-btn {
    position: absolute;
    bottom: 15px;
    left: 15px;
    background: rgba(255,255,255,0.9);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: var(--transition);
    z-index: 10;
}

.collect-btn:hover {
    background: #e74c3c;
    color: white;
    transform: scale(1.1);
}

.collect-btn.collected {
    background: #e74c3c;
    color: white;
}

.collect-btn.collected:hover {
    background: #c0392b;
}

/* Toast Animations */
@keyframes shine {
    0% {
        left: -100%;
    }
    20% {
        left: 100%;
    }
    100% {
        left: 100%;
    }
}