:root{--row-overlay:0.35;--bg:#0b1020;--card:#121a33;--muted:#96a0c6;--text:#e9edff;--acc:#6ea8fe;--grid:#1c2648}
*{box-sizing:border-box}
body{margin:0;background:linear-gradient(180deg,#0b1020 0%,#0e1630 100%);color:var(--text);font:500 16px/1.5 system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,"Helvetica Neue",Arial}
.header{padding:20px 16px 8px;display:flex;flex-wrap:wrap;align-items:center;gap:12px}
.header h1{font-size:20px;margin:0;letter-spacing:.3px}
.badge{border:1px solid var(--grid);background:#0f1630;border-radius:999px;padding:4px 10px;font-size:12px;color:var(--muted)}
.lang-switch select{background:#0e1530;border:1px solid var(--grid);color:var(--text);padding:8px 10px;border-radius:10px}
.lang-switch .sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}
.wrap{display:grid;grid-template-columns:1.6fr .9fr;gap:16px;padding:0 16px}
.panel{background:var(--card);border:1px solid var(--grid);border-radius:14px;box-shadow:0 10px 30px rgba(0,0,0,.25)}
.controls{display:flex;flex-wrap:wrap;gap:10px;padding:12px;border-bottom:1px solid var(--grid)}
.controls input[type="search"],.controls select{background:#0e1530;border:1px solid var(--grid);color:var(--text);padding:10px 12px;border-radius:10px;outline:none;min-width:220px}
.btn{cursor:pointer;border:1px solid var(--grid);background:#0e1530;color:var(--text);padding:10px 12px;border-radius:10px}
.status{margin-left:auto;display:flex;align-items:center;gap:10px;font-size:12px;color:var(--muted)}
.scroll{overflow:auto;max-height:43vh}
table{width:100%;border-collapse:separate;border-spacing:0}
thead th{position:sticky;top:0;background:#10183a;border-bottom:1px solid var(--grid);padding:12px;text-align:left;font-size:13px;color:#b7c2ee;z-index:2}
tbody td{padding:12px;border-bottom:1px solid #15204a;font-size:14px}
tr:hover td{background:#0f1738}
.num{text-align:right;font-variant-numeric:tabular-nums}
.pill{display:inline-block;padding:4px 8px;border-radius:999px;border:1px solid #223166;background:#101a3a;font-size:12px}
.sortable{cursor:pointer;user-select:none}
.sortable:after{content:"⇅";opacity:.35;margin-left:6px;font-size:11px}
.sorted-asc:after{content:"↑"} .sorted-desc:after{content:"↓"}
.empty{padding:28px;text-align:center;color:var(--muted)}
.footer{
  padding:14px 16px;
  color:var(--muted);
  font-size:12px;
  display:flex;
  justify-content:space-between; /* links „Stand: …“, rechts Credits */
  align-items:center;
}
.footer .credits{ white-space:nowrap; }
.panel .body{padding:12px}
.chartBox{padding:12px}
.legend{font-size:13px;color:#b7c2ee}
.h3{margin:4px 0 10px}
@media (max-width:1100px){ .wrap{grid-template-columns:1fr} }
/* Top-3 Hervorhebung */
.rank-1 { 
  background: linear-gradient(90deg, rgba(255,215,0,0.20) 0%, rgba(255,215,0,0.05) 60%, transparent 100%);
  border-left: 4px solid #ffd700;
  font-weight: 600;
}
.rank-2 { 
  background: linear-gradient(90deg, rgba(192,192,192,0.20) 0%, rgba(192,192,192,0.05) 60%, transparent 100%);
  border-left: 4px solid #c0c0c0;
  font-weight: 600;
}
.rank-3 { 
  background: linear-gradient(90deg, rgba(205,127,50,0.20) 0%, rgba(205,127,50,0.05) 60%, transparent 100%);
  border-left: 4px solid #cd7f32;
  font-weight: 600;
}

/* --- Event-Bar neben Language-Dropdown fix (bundle) --- */
#langSel { margin-right: 16px !important; vertical-align: middle !important; }
#event-bar.event-inline, .event-bar.event-inline {
  display: inline-flex !important; align-items: center !important;
  margin-left: 16px !important; white-space: nowrap !important;
}
#event-bar.event-inline { position: relative; top: 1px; } /* Feintuning */


/* == Grid: Ability Avg + Recent table side by side == */
.avg-recent-grid{
  display:grid;
  grid-template-columns: 1fr minmax(420px, 66%);
  gap: 6px;
  align-items:start;
}
.avg-recent-grid .recent-col .recent-table-container{
  max-height: 450px;
  overflow: auto;
}
.table.recent-table thead th{
  position: sticky;
  top: 0;
  background: rgba(15,23,42,0.85);
  backdrop-filter: blur(2px);
}
@media (max-width: 1200px){
  .avg-recent-grid{ grid-template-columns: 1fr; }
}
/* Bündigkeit rechts: Recent-Panel ohne rechten Innenabstand */
.panel .body.avg-recent-grid {
  padding-right: 0;        /* vorher 12px */
}

/* Sicherheit: Tabelle darf volle Spaltenbreite nutzen */
.avg-recent-grid .recent-col,
.avg-recent-grid .recent-col .recent-table-container,
.avg-recent-grid .recent-col .table.recent-table {
  width: 100%;
}

/* === Row background images === */
#grid tbody tr.row-has-bg {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
#grid tbody tr.row-has-bg td {
  background: transparent; /* allow image to show through */
}
#grid tbody tr.row-has-bg:hover td {
  background: rgba(0,0,0,0.25);
}


/* === Preloader Overlay === */
body.is-loading { overflow: hidden; }
#preloader{
  position: fixed; inset: 0;
  background: linear-gradient(180deg, #0b1020 0%, #0e1635 100%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  z-index: 9999; color: var(--text);
}
#preloader .loading-text{ margin-top: 14px; font-size: 14px; color: var(--muted); letter-spacing: .3px; }
#preloader .spinner{
  width: 48px; height: 48px; border-radius: 50%;
  border: 4px solid rgba(255,255,255,.15); border-top-color: var(--acc);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }


/* Ensure spinner/text are above background image */
#preloader .spinner, #preloader .loading-text { position: relative; z-index: 1; }


/* === Bot Analytics line layout === */
.footer{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:12px 16px;
  color:var(--muted);
  font-size:12px;
}
.footer .bot-analytics{
  text-align:center;
  flex:1;
}
.footer > div:first-child{ flex:1; }
.footer .credits{ flex:1; text-align:right; }
@media (max-width: 720px){
  .footer{ flex-direction:column; align-items:center; gap:6px; }
  .footer > div:first-child,
  .footer .bot-analytics,
  .footer .credits{ flex:unset; text-align:center; }
}
