@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Khmer:wght@300;400;500;600;700&display=swap');

:root {
    --bg-primary: #1a0b2e;
    /* Deep Purple */
    --bg-card: rgba(43, 20, 62, 0.7);
    /* Glassy Purple */
    --bg-card-hover: rgba(58, 27, 85, 0.85);
    --text-primary: #FFD700;
    /* Gold text */
    --text-secondary: #e0d6ff;
    /* Light purple-white */
    --border-gold: rgba(255, 215, 0, 0.4);
    --glow-gold: 0 0 15px rgba(255, 215, 0, 0.3);
}

body {
    background-color: var(--bg-primary);
    background-image: url('../images/bg.png');
    background-size: cover;
    background-attachment: fixed;
    background-position: center;
    color: var(--text-secondary);
    font-family: 'Noto Sans Khmer', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
}

/* Container */
.container {
    max-width: 1000px;
}

/* Header */
.main-header {
    padding: 10px 0;
    /* Soft gradient to make logo pop against fireworks */
    background: radial-gradient(circle at center, rgba(26, 11, 46, 0.8) 0%, transparent 70%);
}

.main-logo {
    height: 90px;
    /* Clean sharp logo */
    transition: transform 0.3s;
}

.main-logo:hover {
    transform: scale(1.05);
}

/* Section Titles */
.section-title {
    color: var(--text-primary);
    position: relative;
    display: inline-block;
    padding-bottom: 0;
    margin-bottom: 10px;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    border-bottom: 2px solid var(--border-gold);
}

/* Nav Cards */
.nav-card {
    background: linear-gradient(145deg, rgba(40, 20, 60, 0.8), rgba(20, 10, 30, 0.9));
    border: 1px solid var(--border-gold);
    border-radius: 16px;
    /* Smooth corners */
    padding: 24px;
    /* More breathing room */
    height: 100%;
    min-height: 160px;
    /* Force adequate height for separation */
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    /* Bouncy transition */
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

/* Shine Effect */
.nav-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.05), transparent);
    transform: skewX(-25deg);
    transition: 0.5s;
    pointer-events: none;
}

.nav-card:hover::before {
    left: 100%;
}

.nav-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.5), 0 0 15px rgba(255, 215, 0, 0.2);
    border-color: rgba(255, 215, 0, 0.6);
    background: linear-gradient(145deg, rgba(50, 30, 80, 0.9), rgba(30, 10, 40, 0.95));
}

/* Card Header Layout */
.card-head {
    display: flex;
    align-items: center;
    margin-bottom: 25px;
    /* Boosted spacing significantly */
}

/* Larger, cleaner Logo */
.site-logo {
    width: 56px;
    height: 56px;
    margin-right: 15px;
    border-radius: 50%;
    /* Circular */
    border: 2px solid rgba(255, 215, 0, 0.2);
    padding: 2px;
    transition: transform 0.3s;
    background: rgba(0, 0, 0, 0.2);
}

.nav-card:hover .site-logo {
    transform: rotate(360deg);
    /* Playful spin */
    border-color: #FFD700;
}

.site-info {
    overflow: hidden;
}

.site-name {
    color: #fff;
    margin-bottom: 4px;
    font-size: 18px;
    /* Larger Title */
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.site-url {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.5px;
}

.card-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.speed-badge {
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.speed-badge .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #FFD700;
    box-shadow: 0 0 8px currentColor;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
        transform: scale(1.2);
    }

    100% {
        opacity: 0.6;
    }
}

.btn-visit {
    background: linear-gradient(135deg, #FFD700 0%, #FF8C00 100%);
    border: none;
    padding: 6px 20px;
    border-radius: 20px;
    color: #2e003e;
    font-weight: 800;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 10px rgba(255, 215, 0, 0.3);
}

.btn-visit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(255, 215, 0, 0.5);
    filter: brightness(1.1);
}

/* Activity Cards */
.activity-card {
    background: var(--bg-card);
    border-radius: 16px;
    overflow: hidden;
    height: 100%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s;
    backdrop-filter: blur(5px);
}

.activity-card:hover {
    border-color: var(--text-primary);
    transform: translateY(-5px);
    box-shadow: var(--glow-gold);
}

.act-img-wrapper {
    height: 180px;
    overflow: hidden;
    position: relative;
}

.act-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.activity-card:hover .act-img {
    transform: scale(1.1);
}

.act-body {
    padding: 20px;
}

.act-title {
    color: var(--text-primary);
    margin-bottom: 10px;
    font-size: 18px;
    font-weight: 700;
}

.act-desc {
    font-size: 14px;
    color: #dcdcdc;
    margin: 0;
    line-height: 1.6;
}

/* Navigation and Floating Sidebar */
.floating-sidebar {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.sidebar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    background: rgba(20, 10, 40, 0.9);
    border: 2px solid var(--border-gold);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 12px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-decoration: none;
    backdrop-filter: blur(5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}

.sidebar-item i {
    font-size: 24px;
    margin-bottom: 4px;
    filter: drop-shadow(0 0 5px rgba(255, 215, 0, 0.5));
}

.sidebar-item:hover {
    background: var(--text-primary);
    color: #2e003e;
    transform: scale(1.1) translateX(-5px);
    border-color: #fff;
}

/* Footer */
.main-footer {
    margin-top: 60px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: #8878aa;
    font-size: 13px;
    background: rgba(10, 5, 20, 0.95);
    backdrop-filter: blur(10px);
}

/* Responsive */
@media (max-width: 768px) {
    .floating-sidebar {
        flex-direction: row;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        transform: none;
        width: 100%;
        background: rgba(20, 10, 40, 0.98);
        padding: 8px 15px;
        gap: 12px;
        justify-content: space-between;
        border-top: 2px solid var(--text-primary);
        border-radius: 15px 15px 0 0;
    }

    .sidebar-item {
        width: auto;
        flex: 1;
        height: 54px;
        background: transparent;
        border: none;
        box-shadow: none;
        border-radius: 0;
    }

    .sidebar-item:hover {
        transform: none;
        background: transparent;
        color: #fff;
    }

    body {
        padding-bottom: 80px;
    }

    /* Space for navbar */
    .container {
        padding: 0 15px;
    }

    .section-title {
        font-size: 20px;
        margin-bottom: 20px;
    }

    /* Mobile - Stack Winners better */
    .winner-wrapper {
        margin-top: 10px;
    }

    /* Selected Websites Mobile Optimization */
    .nav-card {
        padding: 10px;
        /* Compact Padding */
        min-height: auto;
    }

    .card-head {
        margin-bottom: 8px;
        align-items: center;
    }

    .site-logo {
        width: 32px;
        /* Smaller Logo */
        height: 32px;
        margin-right: 8px;
        border-radius: 8px;
        border-width: 1px;
        /* Thinner border */
    }

    .site-info {
        min-width: 0;
        /* Allow flex child to shrink/truncate */
        flex: 1;
    }

    .site-name {
        font-size: 13px;
        white-space: nowrap;
        /* Prevent Wrap "主线\n路" */
        overflow: hidden;
        text-overflow: ellipsis;
        margin-bottom: 2px;
    }

    .site-url {
        font-size: 10px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        opacity: 0.8;
    }

    .card-actions {
        padding: 4px 6px;
        /* Tight padding */
        flex-direction: row;
        /* Side by side */
        justify-content: space-between;
        gap: 4px;
        background: rgba(0, 0, 0, 0.2);
    }

    .speed-badge {
        font-size: 10px;
        white-space: nowrap;
        /* Prevent wrapping */
    }

    .btn-visit {
        width: auto;
        /* Let content determine width */
        padding: 3px 10px;
        font-size: 12px;
        white-space: nowrap;
        /* Prevent "进\n入" */
        min-width: 40px;
        border-radius: 12px;
        height: auto;
        line-height: normal;
    }

    /* Activity Card Mobile Optimization */
    .activity-card {
        border-radius: 12px;
    }

    .act-img-wrapper {
        height: 140px;
        /* Reduce from 180px */
    }

    .act-body {
        padding: 15px;
    }

    .act-title {
        font-size: 16px;
        /* Reduce from 18px */
        margin-bottom: 5px;
    }

    .act-desc {
        font-size: 12px;
        line-height: 1.4;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        /* Limit to 2 lines */
        -webkit-box-orient: vertical;
        overflow: hidden;

        /* Reduce Header Whitespace */
        .main-header {
            padding: 10px 0;
            /* Huge reduction from 30px */
        }

        .main-logo {
            height: 50px;
            /* Huge reduction from 90px */
        }

        /* Reduce vertical gaps between sections */
        .container.my-4,
        .container.my-5 {
            margin-top: 1rem !important;
            margin-bottom: 2rem !important;
        }
    }
}