/* --- GLOBAL THEME --- */
* {
    font-family: "JetBrains Mono", monospace;
    box-sizing: border-box;
}

body {
    margin: 0;
    background-color: #0d1117;
    color: #f0f6fc;
}

/* --- NAVBAR --- */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 40px;
    background: #161b22;
    border-bottom: 1px solid #30363d;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 15px; 
}

.github-link {
    display: flex;
    align-items: center;
}

.nav-logo { font-weight: 800; font-size: 1.2rem; }
.beta-tag { font-size: 0.7rem; color: #8b949e; vertical-align: middle; }

/* --- HERO & NEON --- */
.prediction-hero {
    background: radial-gradient(circle at center, #1c2128 0%, #0d1117 100%);
    padding: 60px 20px 80px 20px;
    text-align: center;
    border-bottom: 1px solid #30363d;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* --- TWITCH LIVE STATUS BADGE --- */
.twitch-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 30px;
    text-decoration: none !important;
    transition: all 0.2s ease;
    cursor: default;
}

.twitch-badge span {
    text-decoration: none !important;
}

/* Offline state */
.badge-offline {
    background: #21262d;
    border: 1px solid #30363d;
    color: #8b949e !important;
}

/* Live Minecraft state */
.badge-live-mc {
    background: rgba(85, 238, 85, 0.1);
    border: 1px solid #55ee55;
    color: #55ee55 !important;
    box-shadow: 0 0 15px rgba(85, 238, 85, 0.15);
    cursor: pointer;
}
.badge-live-mc:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 25px rgba(85, 238, 85, 0.3);
}

/* Live Other Game state */
.badge-live-other {
    background: rgba(238, 85, 85, 0.1);
    border: 1px solid #ee5555;
    color: #ee5555 !important;
    box-shadow: 0 0 15px rgba(238, 85, 85, 0.15);
    cursor: pointer;
}
.badge-live-other:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 25px rgba(238, 85, 85, 0.3);
}

/* The Red Live Pulse */
.pulse-dot-red {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #ff3333;
    box-shadow: 0 0 8px #ff3333;
    animation: pulse-animation 1.5s infinite alternate;
}

@keyframes pulse-animation {
    from { opacity: 0.4; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1.3); }
}

.neon-glow {
    display: block;
    font-size: 3.5rem;
    color: #cce7ff !important;
    font-weight: 800;
    margin: 10px 0 5px 0;
    text-shadow: 
        0 0 5px rgba(88, 166, 255, 0.6),
        0 0 15px rgba(88, 166, 255, 0.3),
        0 0 25px rgba(88, 166, 255, 0.1);
}

/* Up/Down Trend Indicator underneath the date */
.trend-indicator {
    display: block;
    font-size: 1.1rem;
    font-weight: bold;
    margin-top: 0px;
}
.trend-good {
    color: #55ee55;
    text-shadow: 0 0 8px rgba(85, 238, 85, 0.4);
}
.trend-bad {
    color: #ee5555;
    text-shadow: 0 0 8px rgba(238, 85, 85, 0.4);
}

.prediction-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 20px;
}

.stat-mini span { display: block; font-size: 0.7rem; color: #8b949e; text-transform: uppercase; }
.stat-mini strong { font-size: 1.2rem; }

/* --- GRID & CARDS --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr); 
    gap: 20px;
    padding: 40px;
    max-width: 1400px;
    margin: 0 auto;
}

.stat-card {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    grid-column: span 1; 
}

.stat-card h3 { font-size: 0.8rem; color: #8b949e; margin: 0 0 10px 0; }
.stat-value { font-size: 2rem; font-weight: bold; display: block; }
.stat-subtext { color: #58a6ff; font-size: 0.9rem; }


.pie-card { grid-column: span 2; }
.insights-card { grid-column: span 4; }
.projection-card { grid-column: span 4; }
.poly-card { grid-column: span 2; }

.card {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 12px;
    padding: 25px;
    margin: 20px 40px;
}

.pie-wrapper { height: 300px; width: 100%; display: flex; justify-content: center; align-items: center; }
.chart-container { position: relative; height: 450px; width: 100%; }

/* --- TABLES --- */
.centered-section { max-width: 900px; margin: 40px auto; text-align: center; }
.modern-table { width: 100%; border-collapse: collapse; text-align: left; }
.modern-table td, .modern-table th { padding: 12px; border-bottom: 1px solid #30363d; }

/* --- MODAL --- */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85); display: flex; justify-content: center; align-items: center; z-index: 1000;
}
.modal-content { width: 400px; text-align: center; }

.dataset-btn {
    background: #21262d; border: 1px solid #30363d; color: #c9d1d9;
    padding: 5px 15px; border-radius: 6px; cursor: pointer;
}
.dataset-btn:hover { background: #30363d; }

/* --- VOD LINK UI --- */
.vod-link {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    margin-left: -6px;
    border-radius: 4px;
    text-decoration: none;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.vod-link:hover {
    background-color: rgba(88, 166, 255, 0.15); 
    text-decoration: underline;
}

.vod-link:active {
    transform: scale(0.95);
}

/* --- TABLET RESPONSIVENESS (Screens under 1200px) --- */
@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: repeat(3, 1fr); 
    }
    
    .pie-wrapper {
        height: 350px; 
    }

    .pie-card, .insights-card, .projection-card, .poly-card {
        grid-column: span 3 !important; 
    }
}

/* --- MOBILE RESPONSIVENESS (Screens under 768px) --- */
@media (max-width: 768px) {
    
    .navbar { flex-direction: column; padding: 15px; gap: 15px; text-align: center; }

    .neon-glow { font-size: 2.2rem; }
    .prediction-hero { padding: 40px 15px; }
    .prediction-stats { flex-direction: column; gap: 15px; }
  
    .dashboard-grid { 
        grid-template-columns: repeat(2, 1fr); 
        padding: 15px; 
        gap: 15px; 
    }

    .pie-card, .insights-card, .projection-card, .poly-card { 
        grid-column: span 2 !important; 
    }

    .card { margin: 20px 10px; padding: 15px; }

    .insights-card > div { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)) !important; }

    .modal-content { width: 90%; max-width: 400px; }

    /* Mobile tables shouldn't squish; they should allow swiping left/right */
    .table-container {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch; 
    }
    .modern-table {
        min-width: 500px; 
    }

    .card > div[style*="justify-content: space-between"] {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 15px;
    }
    
    select {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        margin-bottom: 10px !important;
    }

    #summary-runs {
        width: 100%;
        max-height: 500px; 
        overflow-y: auto;  
        overflow-x: auto;  
        -webkit-overflow-scrolling: touch; 
        padding-bottom: 10px; 
    }

    #summary-runs > div {
        min-width: 400px; 
    }

    #summary-runs > div:first-child {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px !important;
    }
   
    #summary-runs > div {
        font-size: 0.75rem !important; 
        padding-left: 0 !important; 
        padding-right: 0 !important;
        gap: 5px !important; 
    }

    #summary-runs img {
        width: 20px !important;
        height: 20px !important;
    }
}

/* --- CUSTOM HTML LEGEND STYLES --- */
.custom-legend-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-family: "JetBrains Mono", monospace;
    font-size: 0.85rem;
    color: #8b949e;
    min-width: 150px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.legend-color-box {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    border: 1px solid #161b22;
}

.legend-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

/* --- ENHANCED MOBILE RESPONSIVENESS (< 400px) --- */
@media (max-width: 480px) {
    .dashboard-grid { 
        padding: 10px; 
        gap: 10px; 
    }
    
    .card { 
        margin: 15px 10px; 
        padding: 15px; 
        width: auto; 
    }

    .stat-card {
        padding: 15px 10px;
    }

    .stat-value {
        font-size: 1.5rem; 
    }

    .pie-layout-wrapper {
        flex-direction: column;
    }
}