:root{
  --bg: #f6f8fa;
  --panel: #ffffff;
  --text: #0b1220;
  --muted: #707b85;
  --accent: #6f42c1; /* brighter indigo */
  --accent-2: rgba(103, 58, 183, 0.12); /* players area tint */
  --success: #28a745;
  --danger: #dc3545;
  --grid: rgba(11,18,32,0.06);
  --hover: rgba(111,66,193,0.9);
  --border: rgba(11,18,32,0.06);
  --shadow: 0 6px 18px rgba(16,24,40,0.06);
}

.dark-mode{
  --bg: #0f1720;
  --panel: #0b1220;
  --text: #e6eef8;
  --muted: #9fb0c8;
  --accent: #66a6ff;
  --border: rgba(255,255,255,0.06);
  --shadow: 0 8px 30px rgba(2,6,23,0.6);
}

html,body{height:100%;margin:0;font-family:Inter,ui-sans-serif,system-ui,Segoe UI,Roboto,Helvetica,Arial,'Apple Color Emoji','Segoe UI Emoji';background:var(--bg);color:var(--text)}

.container{display:flex;gap:24px;max-width:1200px;margin:28px auto;padding:0 18px}

aside#sidebar{width:320px;background:var(--panel);border-radius:12px;padding:18px;box-shadow:var(--shadow);flex:0 0 320px}
aside#sidebar h2{margin:0 0 12px 0;font-size:16px}
#cards{display:flex;flex-direction:column;gap:10px}

.card{display:flex;gap:12px;align-items:center;padding:12px;border-radius:10px;background:linear-gradient(180deg,rgba(0,0,0,0.02),transparent);cursor:pointer;transition:transform .12s ease,box-shadow .12s ease;border:1px solid rgba(0,0,0,0.03)}
.card:hover{transform:translateY(-4px);box-shadow:var(--shadow)}
.card.selected{outline:2px solid rgba(43,138,239,0.14);box-shadow:0 10px 28px rgba(43,138,239,0.06)}
.card-left{width:40px;height:40px;display:flex;align-items:center;justify-content:center;border-radius:8px;background:rgba(0,0,0,0.03);font-size:18px}
.card-left{background:linear-gradient(135deg, rgba(111,66,193,0.12), rgba(111,66,193,0.04));}
.card.selected{outline-color: rgba(111,66,193,0.16);box-shadow:0 10px 28px rgba(111,66,193,0.06)}
.card-body{flex:1}
.card-title{font-weight:600}
.card-sub{font-size:12px;color:var(--muted);margin-top:4px}
.card-uptime{font-size:12px;color:var(--muted);margin-top:6px}
.visit-link, .visit-link svg{vertical-align:middle}
.visit-link{display:inline-flex;align-items:center;justify-content:center;margin-left:8px;color:var(--accent);text-decoration:none;border-radius:6px;padding:2px}
.visit-link:hover{background:rgba(43,138,239,0.06)}

/* Table link icon */
.table-link{margin-left:8px;text-decoration:none}
.table-link:hover{color:var(--accent)}

.status-dot{width:12px;height:12px;border-radius:50%;display:inline-block;margin-right:8px}
.status-dot.online{background:var(--success)}
.status-dot.offline{background:var(--danger)}

.chart-width{width:320px}
#chartPane{width:620px;background:var(--panel);border-radius:12px;padding:18px;box-shadow:var(--shadow);flex:0 0 620px;margin-left:0}
main{flex:1}
.main-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px;gap:12px}
.main-header h1{margin:0;font-size:20px;text-align:center;flex:1}
.main-header .header-left{display:flex;gap:8px;align-items:center;flex:0 0 auto}
.main-header .header-right{display:flex;align-items:center;flex:0 0 220px;justify-content:flex-end}

table{width:100%;border-collapse:collapse}
thead th{text-align:left;padding:12px 16px;background:transparent;color:var(--muted);font-size:12px}
tbody td{padding:14px 16px;border-top:1px solid var(--border)}
tbody tr.highlight{animation: highlight 2s ease}
@keyframes highlight{0%{background:rgba(43,138,239,0.12)}100%{background:transparent}}

tr:nth-child(even) td{background:transparent}

button#darkModeToggle{background:transparent;border:1px solid var(--border);padding:8px 12px;border-radius:8px;cursor:pointer;color:var(--text)}

#lastUpdated{margin-top:12px;font-size:12px;color:var(--muted)}

/* Selected table row */
tbody tr.selected-row{background:rgba(43,138,239,0.06)}

/* Chart pane */
#chartPane h2{margin:0 0 12px 0;font-size:16px}
.chart-controls{display:flex;gap:8px;align-items:center;margin-bottom:8px}
#chartDetails{margin-top:8px;padding:8px;border-radius:8px;background:linear-gradient(180deg,rgba(0,0,0,0.02),transparent);border:1px solid var(--border);font-size:13px}
#chartArea{min-height:300px;display:flex;align-items:center;justify-content:center;color:var(--muted);position:relative}
.chart-empty{color:var(--muted);font-size:13px}
.chart-legend{font-size:11px;color:var(--muted);margin-top:8px}

.chart-title{font-size:13px;fill:var(--text);font-weight:700}
.chart-subtitle{font-size:12px;fill:var(--muted)}

/* Chart tooltip */
#chartArea{position:relative}
.chart-tooltip{position:absolute;pointer-events:none;background:var(--panel);border:1px solid var(--border);padding:6px 8px;border-radius:6px;box-shadow:var(--shadow);font-size:12px;color:var(--text);display:none}
.chart-grid line{stroke:var(--grid);stroke-width:1}
.chart-axis{font-size:10px;fill:var(--muted)}

/* y axis (players) */
.chart-yaxis{font-size:10px;fill:var(--muted)}
.chart-ylabels{font-size:10px;color:var(--muted);position:absolute;right:8px;top:8px;text-align:right}

/* shaded area under player count */
.players-area{fill:var(--accent-2);} 
.players-line{stroke:var(--accent);stroke-width:2;fill:none}
.players-point{fill:var(--accent)}

/* hover line styling if injected as element */
#historySvg #hoverLine{stroke:var(--hover);opacity:0.95}

/* improve tooltip appearance */
.chart-tooltip{min-width:140px}

/* Responsive */
@media (max-width:880px){
  .container{flex-direction:column;padding:12px}
  aside#sidebar{width:100%}
}

/* Table visibility — hidden unless explicitly visible */
.table-wrap{display:none}
.table-wrap.visible{display:block}

/* Card status badge */
.card-status{display:inline-block;font-size:12px;padding:4px 8px;border-radius:999px;border:1px solid transparent;margin-left:8px}
.card-status.online{background:rgba(40,167,69,0.12);color:var(--success);border-color:rgba(40,167,69,0.18)}
.card-status.offline{background:rgba(220,53,69,0.08);color:var(--danger);border-color:rgba(220,53,69,0.12)}

.card-expanded{background:linear-gradient(180deg,rgba(0,0,0,0.02),transparent);}
.card-details{font-size:12px;color:var(--muted);margin-top:8px}
