:root {
    /* Dark Theme (Default) */
    --bg-primary: #05050a;
    --bg-secondary: #0a0a12;
    --glass-bg: rgba(20, 20, 35, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #e0e0e0;
    --text-muted: #8a8a9b;
    --accent-cyan: #00f3ff;
    --accent-purple: #bc13fe;
    --accent-green: #0aff60;
    --accent-red: #ff0055;
    --card-hover: rgba(0, 243, 255, 0.05);
    --shadow-glow: 0 0 20px rgba(0, 243, 255, 0.15);
    --ad-bg: rgba(255, 255, 255, 0.03);
    --ad-border: #333;
    /* Adjusted for visibility and fineness */
    --grain-opacity: 0.05; 
    --bg-gradient-opacity: 0.4;
}

[data-theme="light"] {
    --bg-primary: #f0f2f5;
    --bg-secondary: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(0, 0, 0, 0.1);
    --text-main: #1a1a1a;
    --text-muted: #555555;
    --accent-cyan: #00CCCC;
    --accent-purple: #8800cc;
    --accent-green: #00cc44;
    --accent-red: #cc0033;
    --card-hover: rgba(0, 102, 204, 0.05);
    --shadow-glow: 0 0 15px rgba(0, 0, 0, 0.1);
    --ad-bg: #e0e0e0;
    --ad-border: #ccc;
    /* Increased opacity for light theme visibility */
    --grain-opacity: 0.08;
    --bg-gradient-opacity: 0.25;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-main);
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
}

/* --- Visual Effects --- */

/* Superfine Grain Effect */
/* Increased baseFrequency to 2.0 for much finer grain */
.grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: var(--grain-opacity);
    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='2.0' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='1'/%3E%3C/svg%3E");
    mix-blend-mode: overlay;
}

/* Animated Background Gradient Mesh */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 50% 50%, 
        rgba(188, 19, 254, var(--bg-gradient-opacity)), 
        transparent 40%),
        radial-gradient(circle at 80% 20%, 
        rgba(0, 243, 255, var(--bg-gradient-opacity)), 
        transparent 30%);
    z-index: -2;
    animation: rotateBackground 30s linear infinite;
    pointer-events: none;
}

@keyframes rotateBackground {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Dynamic Moving Glows */
.bg-glow {
    position: fixed; /* Changed to fixed to stay on screen */
    width: 800px;
    height: 800px;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.15;
    z-index: -1;
    pointer-events: none;
}

.bg-glow-1 {
    top: -200px;
    left: -200px;
    background: var(--accent-purple);
    animation: float1 20s ease-in-out infinite alternate;
}

.bg-glow-2 {
    bottom: -200px;
    right: -200px;
    background: var(--accent-cyan);
    animation: float2 25s ease-in-out infinite alternate;
}

@keyframes float1 {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(100px, 100px) scale(1.2); }
    100% { transform: translate(200px, 50px) scale(1); }
}

@keyframes float2 {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-100px, -150px) scale(1.3); }
    100% { transform: translate(-200px, -50px) scale(1); }
}

/* Pulsing Grid Overlay */
.bg-pulse-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background-image: 
        linear-gradient(rgba(0, 243, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 243, 255, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    opacity: 0.3;
    pointer-events: none;
    animation: pulseGrid 8s ease-in-out infinite;
}

@keyframes pulseGrid {
    0%, 100% { opacity: 0.2; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(1.02); }
}

/* --- Layout --- */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* --- Header --- */
header {
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--glass-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background: var(--glass-bg);
    padding: 15px 0;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    filter: drop-shadow(0 0 5px var(--accent-cyan));
    animation: logoPulse 3s infinite;
}

@keyframes logoPulse {
    0%, 100% { filter: drop-shadow(0 0 5px var(--accent-cyan)); }
    50% { filter: drop-shadow(0 0 15px var(--accent-cyan)); }
}

.logo-text h1 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.5rem;
    letter-spacing: 2px;
    line-height: 1;
}

.logo-text .highlight {
    color: var(--accent-cyan);
    text-shadow: 0 0 10px rgba(0, 243, 255, 0.3);
    animation: textNeon 3s infinite alternate;
}

@keyframes textNeon {
    from { text-shadow: 0 0 10px rgba(0, 243, 255, 0.3); }
    to { text-shadow: 0 0 20px rgba(0, 243, 255, 0.6), 0 0 10px rgba(0, 243, 255, 0.4); }
}

.logo-text .subtitle {
    font-size: 0.7rem;
    color: var(--accent-purple);
    letter-spacing: 3px;
    text-transform: uppercase;
    display: block;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 20px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: 'Orbitron', sans-serif;
}

.dot {
    width: 8px;
    height: 8px;
    background-color: var(--accent-green);
    border-radius: 50%;
}

.dot.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(10, 255, 96, 0.7); }
    70% { box-shadow: 0 0 0 6px rgba(10, 255, 96, 0); }
    100% { box-shadow: 0 0 0 0 rgba(10, 255, 96, 0); }
}

.icon-btn {
    background: none;
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.2);
}

/* Theme Toggle Logic */
[data-theme="dark"] .sun-icon { display: block; }
[data-theme="dark"] .moon-icon { display: none; }
[data-theme="light"] .sun-icon { display: none; }
[data-theme="light"] .moon-icon { display: block; }

/* --- Ads --- */
.ad-container {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

.ad-slot {
    background: var(--ad-bg);
    border: 1px dashed var(--ad-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    position: relative;
    overflow: hidden;
    transition: border-color 0.3s;
}

.ad-slot:hover {
    border-color: var(--accent-purple);
}

.ad-label {
    font-size: 0.6rem;
    text-transform: uppercase;
    opacity: 0.5;
    margin-bottom: 5px;
}

.ad-content {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    text-align: center;
    opacity: 0.3;
}

.ad-728x90 { width: 728px; height: 90px; }
.ad-160x600 { width: 160px; height: 600px; }
.ad-300x250 { width: 300px; height: 250px; }
.ad-320x50 { width: 320px; height: 50px; }

/* Sticky Ads */
.sticky-ad-container {
    position: sticky;
    top: 100px; /* Adjust based on header height */
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* --- Main Grid --- */
.content-grid {
    display: grid;
    grid-template-columns: 160px 1fr 300px;
    gap: 30px;
    margin-bottom: 40px;
}

.feed-section {
    min-height: 600px;
}

.feed-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 15px;
}

.feed-header h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2rem;
}

.feed-filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-btn {
    background: none;
    border: 1px solid transparent;
    color: var(--text-muted);
    font-family: 'Orbitron', sans-serif;
    font-size: 0.8rem;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 4px;
    transition: all 0.2s;
}

.filter-btn:hover, .filter-btn.active {
    color: var(--bg-primary);
    background: var(--accent-cyan);
    box-shadow: 0 0 10px var(--accent-cyan);
}

/* --- News Grid --- */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.news-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    animation: cardEntry 0.5s ease-out forwards;
    opacity: 0;
    transform: translateY(20px);
    backdrop-filter: blur(5px);
}

@keyframes cardEntry {
    to { opacity: 1; transform: translateY(0); }
}

.news-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-purple));
    opacity: 0;
    transition: opacity 0.3s;
    box-shadow: 0 0 10px var(--accent-cyan);
}

.news-card:hover {
    transform: translateY(-5px) scale(1.01);
    box-shadow: var(--shadow-glow);
    border-color: rgba(255, 255, 255, 0.3);
    background: var(--card-hover);
}

.news-card:hover::before {
    opacity: 1;
}

.card-image {
    height: 180px;
    background-color: var(--bg-secondary);
    position: relative;
    overflow: hidden;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.news-card:hover .card-image img {
    transform: scale(1.05);
}

.card-source {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255,255,255,0.1);
}

.card-content {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.card-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 10px;
    line-height: 1.4;
    color: var(--text-main);
}

.card-excerpt {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 20px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1;
}

.card-link {
    text-decoration: none;
    color: var(--accent-cyan);
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
    align-self: flex-start;
    transition: gap 0.2s;
}

.card-link:hover {
    gap: 10px;
    text-shadow: 0 0 8px var(--accent-cyan);
}

/* --- Sidebar Widget --- */
.widget {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
}

.widget h3 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1rem;
    margin-bottom: 15px;
    color: var(--accent-purple);
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 10px;
}


/* Special Cool Link Style */
.cool-link {
    text-decoration: none;
    color: inherit; /* Inherit from h3 */
    display: block; /* Fill the h3 */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.cool-link:hover {
    color: var(--accent-cyan);
    text-shadow: 0 0 8px var(--accent-cyan);
    letter-spacing: 1px;
    transform: translateX(5px);
}

.cool-link .highlight {
    transition: all 0.3s ease;
}

.cool-link:hover .highlight {
    color: var(--accent-purple); /* Swap colors or intensify */
    text-shadow: 0 0 15px var(--accent-purple);
}



/* Coin List */
.coin-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.coin-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    transition: background 0.2s;
}

.coin-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.coin-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.coin-rank {
    font-size: 0.8rem;
    color: var(--text-muted);
    min-width: 20px;
}

.coin-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

.coin-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.coin-price-info {
    text-align: right;
}

.coin-price {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.85rem;
    display: block;
}

.coin-change {
    font-size: 0.75rem;
    font-weight: 600;
}

.positive { color: var(--accent-green); }
.negative { color: var(--accent-red); }

/* Tags Cloud */
.tags-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.tag:hover {
    color: var(--bg-primary);
    background: var(--accent-cyan);
    border-color: var(--accent-cyan);
}

/* --- Footer --- */
footer {
    border-top: 1px solid var(--glass-border);
    background: var(--bg-secondary);
    padding: 30px 0;
    margin-top: 60px;
    text-align: center;
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.footer-content p {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.footer-links {
    display: flex;
    gap: 20px;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--accent-cyan);
}

/* --- Loading Animation --- */
.loader-container {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 50px;
    color: var(--accent-cyan);
    font-family: 'Orbitron', sans-serif;
}

.cyber-loader {
    width: 50px;
    height: 50px;
    border: 3px solid transparent;
    border-top-color: var(--accent-cyan);
    border-right-color: var(--accent-purple);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.2);
}

.loader-small {
    color: var(--text-muted);
    font-size: 0.8rem;
    text-align: center;
    padding: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Load More Button */
.load-more-container {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-top: 40px;
    padding-bottom: 20px;
}

.load-more-container.hidden {
    display: none;
}

.cyber-btn {
    background: transparent;
    border: 1px solid var(--accent-cyan);
    color: var(--accent-cyan);
    font-family: 'Orbitron', sans-serif;
    font-size: 1rem;
    padding: 15px 40px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.1);
}

.cyber-btn:hover {
    background: var(--accent-cyan);
    color: var(--bg-primary);
    box-shadow: 0 0 25px rgba(0, 243, 255, 0.4);
}

.cyber-btn:active {
    transform: scale(0.98);
}

/* --- Responsive --- */
@media (max-width: 1200px) {
    .content-grid {
        grid-template-columns: 1fr 300px;
    }
    .left-sidebar {
        display: none;
    }
}

@media (max-width: 900px) {
    .content-grid {
        grid-template-columns: 1fr;
    }
    .right-sidebar {
        display: none;
    }
    .ad-728x90 {
        display: none;
    }
    .mobile-only {
        display: flex;
    }
}

.mobile-only {
    display: none;
}