/* MAIN PANEL */
.system-panel { 
    flex-shrink: 0; width: 380px; height: auto; 
    display: flex; flex-direction: column; 
    background: rgba(30, 41, 59, 0.6); backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.1); border-radius: 16px; 
    box-shadow: 0 10px 25px rgba(0,0,0,0.3); 
    position: relative; transition: all 0.5s ease;
}

/* GOLD STATUS (Jackpot) */
.system-panel.gold-status {
    background: linear-gradient(135deg, rgba(255, 204, 0, 0.15), rgba(30, 41, 59, 0.9));
    animation: goldPulse 3s infinite;
}
.system-panel.gold-status .system-name-input { color: #FFCC00; text-shadow: 0 0 10px rgba(255, 204, 0, 0.5); }
.system-panel.gold-status .grid-cell.header { color: #FFCC00; }

/* HEADER */
.system-panel-header { 
    flex-shrink: 0; display: flex; justify-content: space-between; align-items: center; 
    padding: 12px 15px; background: rgba(255,255,255,0.03); border-bottom: 1px solid rgba(255,255,255,0.08); 
}
.header-left { flex-grow: 1; margin-right: 15px; display: flex; align-items: center; }
.header-right { display: flex; align-items: center; gap: 15px; white-space: nowrap; }

.system-name-input { 
    font-weight: 700; font-size: 14px; border: none; width: auto; flex-grow: 1;
    background: transparent; color: #fff; 
}
.system-name-input:focus { outline: none; border-bottom: 1px solid #FFCC00; }

.system-line-count { 
    font-size: 10px; color: #38bdf8; 
    background: rgba(56, 189, 248, 0.1); 
    padding: 3px 8px; border-radius: 12px; font-weight: 700; border: 1px solid rgba(56, 189, 248, 0.2); 
    white-space: nowrap; 
}

.remove-system-btn {
    color: #94a3b8; cursor: pointer; font-size: 14px; transition: 0.2s;
}
.remove-system-btn:hover { color: #ef4444; }

/* VISUALIZATION AREA */
.base-system-viz { 
    flex-shrink: 0; padding: 12px 15px; 
    border-bottom: 1px solid rgba(255,255,255,0.08); 
    background: rgba(0,0,0,0.2); 
    display: flex; justify-content: space-between; align-items: center; 
    position: relative; 
    gap: 0; 
}
.viz-rows-area { flex: 1; padding-right: 15px; }

/* Right Sidebar (Stats) */
.trend-area { 
    width: 130px; 
    padding-left: 15px; 
    border-left: 1px solid rgba(255,255,255,0.08);
    display: flex; justify-content: center; align-items: center; position: relative;
} 

/* Aligned Dist Grid - FONT FIX */
.sys-dist-grid { display: flex; width: 100%; justify-content: space-between; }
.sys-dist-cell {
    width: 33%; text-align: center; 
    font-size: 10px; color: #94a3b8; 
    font-family: inherit !important; font-variant-numeric: tabular-nums; 
    opacity: 0.7;
}

/* VISUALIZATION OUTCOMES */
.base-viz-row { display: flex; align-items: center; font-size: 12px; margin-bottom: 4px; }
.viz-num { font-weight: 700; width: 20px; color: #94a3b8; font-size: 10px; }
.viz-outcomes-container { display: flex; gap: 4px; }

.viz-outcome { 
    width: 22px; height: 18px; display: flex; align-items: center; justify-content: center;
    border-radius: 3px; color: rgba(255,255,255,0.1); font-weight: 700; font-size: 10px;
    border: 1px solid rgba(255,255,255,0.05); transition: all 0.2s; 
    backface-visibility: hidden; transform: translateZ(0); will-change: transform;
}
.viz-outcome.shaded { color: #fff; background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.2); }

/* SOLID GREEN FOR HITS */
.viz-outcome.correct { 
    background: #4ade80 !important; 
    color: #000 !important; 
    border-color: #4ade80 !important; 
    box-shadow: 0 0 8px rgba(74, 222, 128, 0.5); 
    z-index: 2; transform: scale(1.1);
}
.viz-outcome.pop { animation: popSuccess 3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; }

/* SOLID RED FOR MISSES */
.viz-outcome.miss { 
    background: #ef4444 !important; 
    color: #fff !important; 
    border-color: #ef4444 !important; 
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.4); 
    z-index: 2; 
}

/* TREND ARROWS */
.trend-wrapper { 
    position: absolute; 
    right: 0; width: 130px; 
    top: 50%; transform: translateY(-50%);
    z-index: 20; 
    pointer-events: none;
    display: flex; justify-content: center; 
}
.trend-icon { font-size: 40px; font-weight: bold; text-shadow: 0 0 15px rgba(0,0,0,0.9); }
.trend-up { color: #4ade80; filter: drop-shadow(0 0 5px #4ade80); animation: arrowFloatUp 4s ease-out forwards; }
.trend-down { color: #ef4444; filter: drop-shadow(0 0 5px #ef4444); animation: arrowFloatDown 4s ease-out forwards; }

/* MINI TABLE & LEADERBOARD */
.stats-mini-table { flex-shrink: 0; padding: 12px 15px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.stats-mini-table table { width: 100%; font-size: 12px; border-collapse: collapse; }
.stats-mini-table td { padding: 3px 0; color: #94a3b8; }
.stats-mini-table td:last-child { 
    text-align: right; font-weight: 700; color: #fff; 
    font-family: inherit !important; font-variant-numeric: tabular-nums; 
    font-size: 13px; 
}
.winnings-row td { 
    border-top: 1px solid rgba(255,255,255,0.08); padding-top: 8px; 
    color: #4ade80; font-size: 15px; text-shadow: 0 0 10px rgba(74, 222, 128, 0.2);
}

.leaderboard { display: flex; flex-direction: column; overflow: hidden; }
.leaderboard h4 { 
    padding: 8px 15px; margin: 0; font-size: 10px; color: #94a3b8; background: rgba(0,0,0,0.2); 
    border-bottom: 1px solid rgba(255,255,255,0.08); text-transform: uppercase; letter-spacing: 1px; font-weight: 700;
}
.leaderboard-grid { 
    display: grid; grid-template-columns: 30px repeat(5, 1fr); 
    font-family: inherit !important; 
    font-variant-numeric: tabular-nums;
    font-size: 12px; text-align: center; width: 100%; overflow: visible; 
}
/* UPDATED: Centering & Yellow Header */
.grid-cell { 
    padding: 6px 2px; 
    border-bottom: 1px solid rgba(255,255,255,0.08); 
    border-right: 1px solid rgba(255,255,255,0.08); 
    color: #94a3b8; 
    display: flex; align-items: center; justify-content: center; /* Enforce Centering */
}
.grid-cell.header { 
    font-weight: 700; 
    background: rgba(255, 204, 0, 0.05) !important; /* Yellow Tint */
    color: #FFCC00 !important; /* Force Yellow Text */
    border-bottom: 1px solid rgba(255,255,255,0.08); 
    font-size: 14px; 
}
.grid-cell.row-header { color: #555; background: rgba(0,0,0,0.1); }
.grid-cell.correct { background: rgba(74, 222, 128, 0.15); color: #4ade80; font-weight: 700; } 

/* ANIMATIONS */
@keyframes goldPulse {
    0% { box-shadow: 0 0 20px rgba(255, 204, 0, 0.2); border-color: rgba(255, 204, 0, 0.5); }
    50% { box-shadow: 0 0 40px rgba(255, 204, 0, 0.6); border-color: #fff; }
    100% { box-shadow: 0 0 20px rgba(255, 204, 0, 0.2); border-color: rgba(255, 204, 0, 0.5); }
}
@keyframes arrowFloatUp {
    0% { opacity: 0; transform: translateY(20px) scale(0.8); }
    10% { opacity: 1; transform: translateY(0) scale(1); }
    85% { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-20px) scale(0.8); }
}
@keyframes arrowFloatDown {
    0% { opacity: 0; transform: translateY(-20px) scale(0.8); }
    10% { opacity: 1; transform: translateY(0) scale(1); }
    85% { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(20px) scale(0.8); }
}