/* ========================================
   디자인 시스템 - 변수 & 기본 설정
   ======================================== */
:root {
    /* Premium Palette: Clean Minimalist White */
    --bg-primary: #FAFAFA;
    --bg-secondary: #F5F5F5;
    --bg-card: rgba(255, 255, 255, 0.85);
    --bg-card-hover: rgba(255, 255, 255, 0.98);
    --border-card: rgba(0, 0, 0, 0.04);
    --text-primary: #1d1d1f;
    /* Apple-style dark gray */
    --text-secondary: #6e6e73;
    /* Apple-style light gray */

    /* Accent Glows (Subtle) */
    --glow-purple: rgba(140, 122, 230, 0.06);
    --glow-teal: rgba(0, 184, 148, 0.06);
    --accent-blue: #0071e3;

    --radius-card: 22px;
    /* Smoother corners */

    /* Layered Shadows for 3D depth */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.02);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.03), 0 1px 2px rgba(0, 0, 0, 0.02);
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);

    /* 3D Card Shadows */
    --shadow-3d: 
        0 1px 1px rgba(0, 0, 0, 0.04),
        0 2px 4px rgba(0, 0, 0, 0.04),
        0 4px 8px rgba(0, 0, 0, 0.04),
        0 8px 16px rgba(0, 0, 0, 0.03),
        0 16px 32px rgba(0, 0, 0, 0.02);
    --shadow-3d-hover: 
        0 2px 2px rgba(0, 0, 0, 0.03),
        0 4px 8px rgba(0, 0, 0, 0.04),
        0 8px 16px rgba(0, 0, 0, 0.05),
        0 16px 32px rgba(0, 0, 0, 0.05),
        0 32px 64px rgba(0, 0, 0, 0.04);

    --transition-base: 0.4s cubic-bezier(0.25, 1, 0.5, 1);

    /* Nav */
    --nav-bg: rgba(255, 255, 255, 0.85);
    --nav-border: rgba(0, 0, 0, 0.06);
}

/* ========================================
   다크모드 (Dark Mode)
   ======================================== */
[data-theme="dark"] {
    --bg-primary: #0d0d0f;
    --bg-secondary: #18181b;
    --bg-card: rgba(30, 30, 35, 0.85);
    --bg-card-hover: rgba(40, 40, 50, 0.95);
    --border-card: rgba(255, 255, 255, 0.06);
    --text-primary: #f0f0f2;
    --text-secondary: #a0a0a8;

    --glow-purple: rgba(140, 122, 230, 0.08);
    --glow-teal: rgba(0, 184, 148, 0.08);
    --accent-blue: #4da3ff;

    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.25), 0 1px 2px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.35), 0 1px 2px rgba(0, 0, 0, 0.2);

    /* 3D Card Shadows (Dark Mode) */
    --shadow-3d: 
        0 1px 1px rgba(0, 0, 0, 0.15),
        0 2px 4px rgba(0, 0, 0, 0.15),
        0 4px 8px rgba(0, 0, 0, 0.12),
        0 8px 16px rgba(0, 0, 0, 0.10),
        0 16px 32px rgba(0, 0, 0, 0.08);
    --shadow-3d-hover: 
        0 2px 2px rgba(0, 0, 0, 0.12),
        0 4px 8px rgba(0, 0, 0, 0.14),
        0 8px 16px rgba(0, 0, 0, 0.16),
        0 16px 32px rgba(0, 0, 0, 0.14),
        0 32px 64px rgba(0, 0, 0, 0.12);

    --nav-bg: rgba(13, 13, 15, 0.9);
    --nav-border: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .card:hover {
    background: rgba(50, 50, 60, 0.98);
}

[data-theme="dark"] .news-item:hover {
    background: rgba(40, 40, 50, 0.6);
}

[data-theme="dark"] .news-item-date {
    background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .lang-btn.active {
    background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .search-input:focus {
    background: rgba(30, 30, 35, 0.9);
}

[data-theme="dark"] .sidebar-news-header {
    background: rgba(30, 30, 35, 0.6);
}

/* ========================================
   리셋 & 기본 스타일
   ======================================== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    letter-spacing: -0.01em;
    /* Tighter typography */
    transition: background 0.4s ease, color 0.4s ease;
}

/* ========================================
   배경 효과 (Mesh Gradient & Grain)
   ======================================== */
.page-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background:
        radial-gradient(circle at 10% 10%, var(--glow-purple), transparent 40%),
        radial-gradient(circle at 90% 90%, var(--glow-teal), transparent 40%),
        var(--bg-primary);
    animation: auraMove 15s ease-in-out infinite alternate;
    transition: background 0.4s ease;
}

/* Subtle grain texture overlay */
.page-bg::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    opacity: 0.03;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* ========================================
   헤더 위젯 컨테이너
   ======================================== */
/* 헤더 위젯 삭제됨 (left-sidebar로 대체 이동) */

/* ========================================
   AI 성능/인기순위 위젯
   ======================================== */
.ai-ranking-widget {
    width: 250px;
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--border-card);
    border-radius: 20px;
    padding: 16px;
    box-shadow:
        0 1px 1px rgba(0, 0, 0, 0.04),
        0 2px 4px rgba(0, 0, 0, 0.04),
        0 4px 8px rgba(0, 0, 0, 0.04),
        0 8px 16px rgba(0, 0, 0, 0.03),
        0 16px 32px rgba(0, 0, 0, 0.02);
    transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

.ai-ranking-widget:hover {
    box-shadow:
        0 2px 2px rgba(0, 0, 0, 0.03),
        0 4px 8px rgba(0, 0, 0, 0.04),
        0 8px 16px rgba(0, 0, 0, 0.05),
        0 16px 32px rgba(0, 0, 0, 0.05),
        0 32px 64px rgba(0, 0, 0, 0.04);
    transform: translateY(-2px);
}

.ranking-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.ranking-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ranking-header-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.04);
    display: flex;
    align-items: center;
    justify-content: center;
}

[data-theme="dark"] .ranking-header-icon {
    background: rgba(255, 255, 255, 0.08);
}

.ranking-header-icon i {
    width: 18px;
    height: 18px;
}

.ranking-header-text {
    display: flex;
    flex-direction: column;
}

.ranking-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
    line-height: 1.2;
}

.ranking-category {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.ranking-updated {
    font-size: 10px;
    color: var(--text-secondary);
    opacity: 0.7;
    display: flex;
    align-items: center;
    gap: 3px;
}

.ranking-updated::before {
    content: '';
    width: 6px;
    height: 6px;
    background: #34c759;
    border-radius: 50%;
    display: inline-block;
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.ranking-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    justify-content: space-between;
}

.ranking-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 0;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
}

.ranking-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    cursor: pointer;
}

.ranking-item:hover {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .ranking-item {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .ranking-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.08);
}

.ranking-medal {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    border-radius: 6px;
    flex-shrink: 0;
    /* 3D 버튼 스타일 */
    box-shadow:
        inset 0 1px 2px rgba(255, 255, 255, 0.6),
        inset 0 -1px 2px rgba(0, 0, 0, 0.1),
        0 1px 3px rgba(0, 0, 0, 0.1);
}

.ranking-medal.gold {
    background: linear-gradient(145deg, #FFD700, #FFA500);
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.ranking-medal.silver {
    background: linear-gradient(145deg, #E8E8E8, #B0B0B0);
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
.ranking-medal.bronze {
    background: linear-gradient(145deg, #D4A06A, #B8860B);
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.ranking-medal.normal {
    background: linear-gradient(145deg, #f0f0f4, #dddde1);
    color: var(--text-secondary);
}

[data-theme="dark"] .ranking-medal.normal {
    background: linear-gradient(145deg, #3a3a44, #28282e);
}

.ranking-info {
    flex: 1;
    min-width: 0;
}

.ranking-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ranking-score-bar {
    height: 4px;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 2px;
    margin-top: 4px;
    overflow: hidden;
}

[data-theme="dark"] .ranking-score-bar {
    background: rgba(255, 255, 255, 0.08);
}

.ranking-score-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 1s cubic-bezier(0.25, 1, 0.5, 1);
    background: linear-gradient(90deg, var(--accent-blue), #00d2ff);
}

.ranking-score-text {
    font-size: 10px;
    font-weight: 700;
    color: var(--accent-blue);
    flex-shrink: 0;
    min-width: 28px;
    text-align: right;
}

/* 앱스토어 랭킹 탭 스타일 */
.app-ranking-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    background: rgba(0, 0, 0, 0.03);
    padding: 4px;
    border-radius: 10px;
}

[data-theme="dark"] .app-ranking-tabs {
    background: rgba(255, 255, 255, 0.05);
}

.app-tab {
    flex: 1;
    border: none;
    background: transparent;
    padding: 6px 0;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.2s ease;
}

.app-tab i {
    width: 14px;
    height: 14px;
}

.app-tab:hover {
    color: var(--text-primary);
}

.app-tab.active {
    background: var(--bg-card);
    color: var(--text-primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .app-tab.active {
    background: rgba(40, 40, 50, 0.9);
}

/* 반응형: 모바일에서 숨김 (또는 형태 변경) */
@media (max-width: 1100px) {
    .left-sidebar {
        width: 100%;
        max-width: 540px;
        margin: 0 auto 40px;
    }
    
    .left-sidebar-sticky {
        position: static;
        flex-direction: column;
        align-items: center;
        gap: 20px;
    }
    
    .ai-ranking-widget {
        width: 100% !important;
        max-width: 360px;
    }
}

@media (max-width: 768px) {
    .left-sidebar {
        margin: 20px auto 30px;
    }
}
@keyframes auraMove {
    0% {
        transform: scale(1);
    }

    100% {
        transform: scale(1.1) translate(1%, 1%);
    }
}

/* ========================================
   헤더 및 언어 토글
   ======================================== */
.header {
    padding: 100px 32px 60px;
    text-align: center;
    position: relative;
}

.header-top-actions {
    position: absolute;
    top: 24px;
    right: 32px;
    display: flex;
    gap: 8px;
    align-items: center;
    z-index: 100;
}

.lang-toggle-container {
    display: flex;
    gap: 4px;
    background: var(--bg-card);
    padding: 4px;
    border-radius: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-card);
    backdrop-filter: blur(10px);
}

.lang-btn {
    border: none;
    background: transparent;
    padding: 6px 14px;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.lang-btn.active {
    background: #fff;
    color: var(--accent-blue);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.lang-btn:hover:not(.active) {
    color: var(--accent-blue);
}

/* ========================================
   다크모드 토글 버튼
   ======================================== */
.dark-mode-toggle {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border-card);
    background: var(--bg-card);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    position: relative;
}

.dark-mode-toggle:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-md);
}

.dark-mode-toggle .dark-icon,
.dark-mode-toggle .light-icon {
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
    position: absolute;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.dark-mode-toggle .light-icon {
    opacity: 0;
    transform: rotate(-90deg) scale(0.5);
}

[data-theme="dark"] .dark-mode-toggle .dark-icon {
    opacity: 0;
    transform: rotate(90deg) scale(0.5);
}

[data-theme="dark"] .dark-mode-toggle .light-icon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

/* ========================================
   Gemini Style Search Box
   ======================================== */
.gemini-header-mode {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 240px;
    padding-top: 50px;
    max-width: 1200px;
    margin: 0 auto;
}

.gemini-search-container {
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
}

.gemini-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border-radius: 36px;
    padding: 12px 24px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.08),
        0 2px 4px rgba(0, 0, 0, 0.04),
        inset 0 0 0 1px rgba(255,255,255,0.5);
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    border: 1px solid var(--border-card);
}

.gemini-input-wrapper:hover, .gemini-input-wrapper:focus-within {
    box-shadow: 
        0 12px 48px rgba(0, 0, 0, 0.12),
        0 4px 8px rgba(0, 0, 0, 0.06),
        0 0 0 2px rgba(100, 150, 255, 0.15);
    transform: translateY(-2px);
}

[data-theme="dark"] .gemini-input-wrapper {
    background: rgba(30, 30, 35, 0.7);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.1);
}

.gemini-icon-left {
    width: 24px;
    height: 24px;
    color: #a259ff;
    margin-right: 16px;
    flex-shrink: 0;
    filter: drop-shadow(0 0 4px rgba(162, 89, 255, 0.4));
    animation: gemini-sparkle 3s ease-in-out infinite;
}

@keyframes gemini-sparkle {
    0%, 100% { transform: scale(1) rotate(0deg); opacity: 0.8; }
    50% { transform: scale(1.1) rotate(10deg); opacity: 1; filter: drop-shadow(0 0 8px rgba(162, 89, 255, 0.8)); }
}

.gemini-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 16px;
    color: var(--text-primary);
    outline: none;
    min-width: 0;
    padding: 8px 0;
}

.gemini-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
    font-weight: 400;
}

.gemini-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 12px;
}

.gemini-action-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.gemini-action-btn i {
    width: 20px;
    height: 20px;
}

.gemini-action-btn:hover {
    background: rgba(0, 0, 0, 0.04);
    color: var(--text-primary);
}

[data-theme="dark"] .gemini-action-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* Gemini 답변 영역 */
.gemini-response-container {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: 20px;
    padding: 20px 24px;
    margin-top: 16px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
    text-align: left;
    animation: fadeIn 0.4s ease-out;
}

[data-theme="dark"] .gemini-response-container {
    background: rgba(30, 30, 35, 0.7);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.gemini-response-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
    color: #a259ff;
    margin-bottom: 12px;
}

.gemini-icon-small {
    width: 16px;
    height: 16px;
}

.gemini-response-content {
    font-size: 15px;
    color: var(--text-primary);
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

.gemini-loading {
    display: flex;
    gap: 6px;
    align-items: center;
    font-size: 14px;
    color: var(--text-secondary);
}

/* ========================================
   카테고리 빠른 이동 네비게이션
   ======================================== */
.category-nav {
    position: sticky;
    top: 0;
    z-index: 90;
    background: var(--nav-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--nav-border);
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.category-nav-inner {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 40px;
    display: flex;
    justify-content: center;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

@media (max-width: 1000px) {
    .category-nav-inner {
        justify-content: flex-start;
        padding: 0 20px;
    }
}

.category-nav-inner::-webkit-scrollbar {
    display: none;
}

.cat-nav-item {
    padding: 14px 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    text-decoration: none;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.cat-nav-item:hover {
    color: var(--accent-blue);
}

.cat-nav-item.active {
    color: var(--accent-blue);
    border-bottom-color: var(--accent-blue);
}

/* ========================================
   메인 컨테이너 & 카테고리
   ======================================== */
.container {
    max-width: 1540px;
    margin: 0 auto;
    padding: 60px 40px 100px;
    display: grid;
    grid-template-columns: 260px 1fr 310px;
    gap: 40px;
    align-items: start;
}

.left-sidebar {
    display: block;
}

.left-sidebar-sticky {
    position: sticky;
    top: 100px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

@media (max-width: 1100px) {
    .container {
        grid-template-columns: 1fr;
    }
}

.category-section {
    margin-bottom: 80px;
    scroll-margin-top: 70px;
    overflow: visible;
    position: relative;
    z-index: 1;
}

.category-header {
    margin-bottom: 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
}

.category-header:hover .collapse-btn {
    opacity: 1;
}

.category-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.category-title i {
    width: 26px;
    height: 26px;
    stroke-width: 2px;
    color: var(--cat-color);
}

/* Remove chunky border, use subtle indicator */
.category-title::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 30px;
    height: 3px;
    background: var(--cat-color);
    border-radius: 2px;
    opacity: 0.6;
}

/* ========================================
   카테고리 접기/펼치기
   ======================================== */
.collapse-btn {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border-card);
    background: var(--bg-card);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.5;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.collapse-btn:hover {
    background: var(--bg-card-hover);
    box-shadow: var(--shadow-sm);
}

.collapse-btn i {
    width: 16px;
    height: 16px;
    color: var(--text-secondary);
    transition: transform 0.3s ease;
}

.category-section.collapsed .collapse-btn i {
    transform: rotate(180deg);
}

.collapsible-content {
    max-height: 3000px;
    overflow: visible;
    transition: max-height 0.5s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.3s ease;
    opacity: 1;
}

.category-section.collapsed .collapsible-content {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
}

/* ========================================
   그리드 레이아웃
   ======================================== */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 24px;
    overflow: visible;
}

/* ========================================
   카드 스타일 (3D Shadow Design - 테두리 없음)
   ======================================== */
.card {
    position: relative;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 20px;
    padding: 28px;
    background: var(--bg-card);
    border: none;
    border-radius: var(--radius-card);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    text-decoration: none;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-3d);
    height: 100%;
    /* 3D perspective 효과를 위한 설정 */
    transform: perspective(800px) rotateX(0deg) rotateY(0deg) translateZ(0px);
    transform-style: preserve-3d;
    will-change: transform, box-shadow;
}

.card:hover {
    transform: perspective(800px) rotateX(2deg) translateY(-10px) translateZ(20px) scale(1.02);
    background: var(--bg-card-hover);
    box-shadow: var(--shadow-3d-hover), 0 12px 40px rgba(var(--cat-rgb), 0.15);
}

.card:active {
    transform: perspective(800px) translateY(-2px) translateZ(5px) scale(0.98);
    box-shadow: var(--shadow-3d);
}

/* ========================================
   NEW 뱃지 (최신 도구)
   ======================================== */
.card[data-new]::before {
    content: 'NEW';
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 3px 8px;
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    border-radius: 6px;
    letter-spacing: 1px;
    box-shadow: 0 2px 8px rgba(238, 90, 36, 0.3);
    animation: newPulse 2s ease-in-out infinite;
    z-index: 2;
}

@keyframes newPulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.85;
        transform: scale(1.05);
    }
}

/* ========================================
   카드 내용
   ======================================== */
.card-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    /* 3D 버튼 배경 그라디언트 */
    background: linear-gradient(145deg, #ffffff 0%, #e8e8ec 100%);
    border-radius: 16px;
    border: none;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
    /* 3D 버튼 그림자 (다층) */
    box-shadow:
        inset 0 2px 3px rgba(255, 255, 255, 0.9),
        inset 0 -2px 3px rgba(0, 0, 0, 0.06),
        0 2px 2px rgba(0, 0, 0, 0.04),
        0 4px 6px rgba(0, 0, 0, 0.06),
        0 8px 14px rgba(0, 0, 0, 0.05);
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    transform: perspective(400px) translateZ(0px);
}

/* 상단 빛 반사 효과 */
.card-icon::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.7) 0%, rgba(255, 255, 255, 0) 100%);
    border-radius: 16px 16px 0 0;
    pointer-events: none;
}

.card-icon img {
    padding: 4px;
}

.card:hover .card-icon {
    transform: perspective(400px) translateZ(12px) scale(1.08) rotate(-3deg);
    box-shadow:
        inset 0 2px 3px rgba(255, 255, 255, 0.95),
        inset 0 -2px 3px rgba(0, 0, 0, 0.04),
        0 4px 4px rgba(0, 0, 0, 0.04),
        0 8px 12px rgba(0, 0, 0, 0.08),
        0 14px 24px rgba(var(--cat-rgb), 0.15);
    background: linear-gradient(145deg, #ffffff 0%, #f0f0f4 100%);
}

.card:active .card-icon {
    transform: perspective(400px) translateZ(-2px) scale(0.96);
    box-shadow:
        inset 0 1px 2px rgba(0, 0, 0, 0.08),
        inset 0 -1px 1px rgba(255, 255, 255, 0.5),
        0 1px 2px rgba(0, 0, 0, 0.06);
}

/* 다크모드 3D 아이콘 */
[data-theme="dark"] .card-icon {
    background: linear-gradient(145deg, #3a3a44 0%, #28282e 100%);
    box-shadow:
        inset 0 2px 3px rgba(255, 255, 255, 0.08),
        inset 0 -2px 3px rgba(0, 0, 0, 0.3),
        0 2px 2px rgba(0, 0, 0, 0.15),
        0 4px 6px rgba(0, 0, 0, 0.2),
        0 8px 14px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] .card-icon::before {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0) 100%);
}

[data-theme="dark"] .card:hover .card-icon {
    background: linear-gradient(145deg, #44444e 0%, #32323a 100%);
    box-shadow:
        inset 0 2px 3px rgba(255, 255, 255, 0.1),
        inset 0 -2px 3px rgba(0, 0, 0, 0.2),
        0 4px 4px rgba(0, 0, 0, 0.12),
        0 8px 12px rgba(0, 0, 0, 0.2),
        0 14px 24px rgba(var(--cat-rgb), 0.2);
}

.card-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.card-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    transition: color 0.3s;
}

/* Remove title underline for cleaner look */
.card-title::after {
    display: none;
}

.card-desc {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    opacity: 0.85;
    font-weight: 400;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card:hover .card-title {
    color: var(--cat-color);
}

/* ========================================
   검색창 (Search Bar)
   ======================================== */
.search-container {
    width: 100%;
    max-width: 600px;
    margin: 32px auto 0;
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 20px;
    color: var(--text-secondary);
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.search-input {
    width: 100%;
    padding: 16px 20px 16px 52px;
    border: 1px solid var(--border-card);
    border-radius: 30px;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    font-size: 16px;
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
    transition: var(--transition-base);
    font-family: inherit;
    outline: none;
    box-sizing: border-box;
}

.search-input:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.1), var(--shadow-md);
    background: #fff;
}

/* ========================================
   제보 및 구독 섹션 (Submission Section)
   ======================================== */
.submission-section {
    margin-top: 60px;
    background: linear-gradient(135deg, rgba(140, 122, 230, 0.08), rgba(0, 184, 148, 0.08));
    border-radius: var(--radius-card);
    padding: 50px 40px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: var(--shadow-md);
}

[data-theme="dark"] .submission-section {
    border-color: rgba(255, 255, 255, 0.06);
}

.submission-title {
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.submission-desc {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 30px;
}

.submission-contact {
    margin-top: 10px;
}

.email-link {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition-base);
    letter-spacing: 0.5px;
}

.email-link:hover {
    color: var(--accent-blue);
    text-decoration: underline;
    text-underline-offset: 4px;
}

/* ========================================
   맨 위로 버튼 (Scroll to Top)
   ======================================== */
.scroll-top-btn {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 48px;
    height: 48px;
    border: 1px solid var(--border-card);
    background: var(--bg-card);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--shadow-md);
    z-index: 80;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.scroll-top-btn.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.scroll-top-btn:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    background: var(--accent-blue);
}

.scroll-top-btn:hover i {
    color: #fff;
}

.scroll-top-btn i {
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

/* ========================================
   푸터
   ======================================== */
.footer {
    text-align: center;
    padding: 60px 32px 100px;
    color: var(--text-secondary);
    font-size: 15px;
    opacity: 0.6;
}

/* ========================================
   우측 실시간 뉴스 사이드바 (Sidebar Widget)
   ======================================== */
.sidebar-news {
    position: sticky;
    top: 70px;
    border-radius: var(--radius-card);
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 120px);
    transition: background 0.4s ease, border-color 0.4s ease;
}

.sidebar-news-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.sidebar-news-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-card);
    background: rgba(255, 255, 255, 0.4);
}

.sidebar-news-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.sidebar-news-header h3 i {
    color: var(--accent-blue);
    width: 20px;
    height: 20px;
}

.sidebar-news-body {
    padding: 0;
    overflow-y: auto;
    flex: 1;
}

/* Custom Scrollbar */
.sidebar-news-body::-webkit-scrollbar {
    width: 6px;
}

.sidebar-news-body::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-news-body::-webkit-scrollbar-thumb {
    background: #d1d1d6;
    border-radius: 10px;
}

[data-theme="dark"] .sidebar-news-body::-webkit-scrollbar-thumb {
    background: #3a3a44;
}

.sidebar-news-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px 0;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

.sidebar-news-list {
    display: flex;
    flex-direction: column;
}

.news-item {
    display: block;
    text-decoration: none;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-card);
    transition: var(--transition-base);
}

.news-item:last-child {
    border-bottom: none;
}

.news-item:hover {
    background: #ffffff;
    padding-left: 24px;
}

.news-item-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-item-meta {
    font-size: 11px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.news-item-date {
    background: #f1f1f2;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
}

/* ========================================
   스핀 애니메이션 (로딩용)
   ======================================== */
.spin-anim {
    animation: spin 1s linear infinite;
}

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

/* ========================================
   애니메이션 & 트랜지션
   ======================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.category-section {
    animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.category-section:nth-child(1) {
    animation-delay: 0.1s;
}

.category-section:nth-child(2) {
    animation-delay: 0.2s;
}

.category-section:nth-child(3) {
    animation-delay: 0.3s;
}

.category-section:nth-child(4) {
    animation-delay: 0.4s;
}

.category-section:nth-child(5) {
    animation-delay: 0.5s;
}

.category-section:nth-child(6) {
    animation-delay: 0.6s;
}

.category-section:nth-child(7) {
    animation-delay: 0.7s;
}

.category-section:nth-child(8) {
    animation-delay: 0.8s;
}

/* ========================================
   반응형 디자인
   ======================================== */
@media (max-width: 768px) {
    .header {
        padding: 60px 24px 40px;
    }

    .header-top-actions {
        top: 16px;
        right: 16px;
    }

    .logo-text {
        font-size: 32px;
    }

    .container {
        padding: 0 24px 60px;
    }

    .grid {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 22px;
    }

    .category-nav-inner {
        padding: 0 16px;
    }

    .cat-nav-item {
        padding: 12px 12px;
        font-size: 13px;
    }

    .scroll-top-btn {
        bottom: 20px;
        right: 20px;
        width: 42px;
        height: 42px;
    }
}

/* ========================================
   접근성
   ======================================== */
@media (prefers-reduced-motion: reduce) {

    *,
    ::before,
    ::after {
        animation-delay: -1ms !important;
        animation-duration: 1ms !important;
        animation-iteration-count: 1 !important;
        background-attachment: initial !important;
        scroll-behavior: auto !important;
        transition-duration: 0s !important;
        transition-delay: 0s !important;
    }
}