:root {
  --bg-body: #050816;
  --bg-card: #001F18;      /* Grundfarbe der gesamten Tabelle */
  --bg-header: #01130F;
  --bg-row-alt: #001913;
  --border-subtle: #064E3B;
  --text-main: #e5e7eb;
  --text-muted: #9ca3af;
  --accent: #38bdf8;
  --accent-soft: rgba(56, 189, 248, 0.15);
}

/* ===========================
   GLOBAL LAYOUT
=========================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, #020617 0, #020617 50%, #000 100%);
  color: var(--text-main);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem 1rem;
}

.wrapper {
  width: 100%;
}

/* Card – Rahmen um Tabelle */

.card {
  background: var(--bg-card);
  border-radius: 18px;
  border: 1px solid rgba(0, 0, 0, 0.65);
  box-shadow:
    0 25px 80px rgba(0, 0, 0, 0.85),
    0 0 0 1px rgba(15, 23, 42, 0.5);
  padding: 1.6rem 1.6rem 1.1rem;
  width: fit-content;
  margin: 0 auto;
}

/* Header oben */

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 1.1rem;
  gap: 1rem;
}

.card-title {
  font-size: 1.4rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.logo-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: radial-gradient(circle, #38bdf8 0, #0ea5e9 40%, #0369a1 100%);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.9);
}

.card-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Tabellen-Container */

.table-container {
  border-radius: 14px;
  border: 1px solid var(--border-subtle);
  background: rgba(0, 31, 24, 0.98);
  overflow: hidden;
  width: fit-content;
  margin: 0 auto;
}

.table-scroll {
  max-height: 85vh;
  overflow-x: auto;
  overflow-y: auto;
}

/* Standard-Tabelle (Overview) */

table {
  border-collapse: collapse;
  table-layout: fixed;
  width: 1150px;
  max-width: 95vw;
  margin: 0 auto;
  font-size: 0.9rem;
}

/* Kopfzeile Overview */

thead {
  position: sticky;
  top: 0;
  z-index: 1000;
}

thead tr th {
  position: sticky;
  top: 0;
  z-index: 1001;
  background: linear-gradient(135deg, #01130F, #033026);
  color: #f9fafb;
  border-bottom: 2px solid rgba(56, 189, 248, 0.9);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.55rem 0.8rem 0.7rem;
  text-align: center;
}

/* Spieler-Header (Overview) */

.player-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.player-avatar {
  width: 45px;
  height: 45px;
  border-radius: 999px;
  object-fit: cover;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.7);
}

.player-name {
  display: none;
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: none;
}

/* Zellen Overview */

th,
td {
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.35);
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
}

td {
  white-space: normal;
}

/* Zeilenfarben Overview */

tbody tr:nth-child(even) {
  background: rgba(0, 40, 32, 0.85);
}

tbody tr:nth-child(odd) {
  background: rgba(0, 31, 24, 0.95);
}

tbody tr:hover {
  background: rgba(56, 189, 248, 0.12);
}

/* Erste Spalte Overview: sticky und hervorgehoben */

td:first-child,
th:first-child {
  position: sticky;
  left: 0;
  z-index: 500;
  background: linear-gradient(180deg, #021812, #023428);
  font-weight: 500;
  color: #f9fafb;
  box-shadow: 4px 0 10px rgba(0, 0, 0, 0.8);
}

/* Farbleiste in erster Spalte Overview */

td:first-child::before,
th:first-child::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(to bottom, #38bdf8, #22c55e);
}

/* Farbcodierung Spalten 2–7 (Overview) */

td:nth-child(2),
th:nth-child(2) { color: #d4853f; }

td:nth-child(3),
th:nth-child(3) { color: #CB4ACE; }

td:nth-child(4),
th:nth-child(4) { color: #ff69b4; }

td:nth-child(5),
th:nth-child(5) { color: #21a589; }

td:nth-child(6),
th:nth-child(6) { color: #e0e879; }

td:nth-child(7),
th:nth-child(7) { color: #8ed2f2; }

/* Zwischenüberschriften (Overview) */

.section-row td {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.8rem;
  padding: 0.5rem 0.9rem;
  background: #001A14;
  color: #e5e7eb;
  border-top: 1px solid rgba(0, 0, 0, 0.45);
  border-bottom: 1px solid rgba(0, 0, 0, 0.45);
  text-align: center;
  z-index: 200;
}

/* Footer */

.table-footer {
  padding: 0.55rem 0.9rem 0.6rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #001612;
  gap: 1rem;
}

.badge {
  border: 1px solid rgba(148, 163, 184, 0.25);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  display: flex;
  gap: 0.3rem;
  align-items: center;
}

.badge .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.8);
}

/* Scrollbar (WebKit) */

.table-scroll::-webkit-scrollbar {
  height: 8px;
  width: 8px;
}

.table-scroll::-webkit-scrollbar-track {
  background: #000f0b;
}

.table-scroll::-webkit-scrollbar-thumb {
  background: #064E3B;
  border-radius: 999px;
}

.table-scroll::-webkit-scrollbar-thumb:hover {
  background: #16a34a;
}

/* ===========================
   HISTORY-NAVIGATION / DROPDOWN
=========================== */

.card-header-controls button {
  background: #01271e;
  border: 1px solid #065f47;
  color: #e5e7eb;
  padding: 0.3rem 0.75rem;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    transform 0.15s ease;
}

.card-header-controls button:hover:not(:disabled) {
  background: #033b2d !important;
  border-color: #1ea67a !important;
  transform: translateY(-1px);
}

.card-header-controls button:active:not(:disabled) {
  transform: translateY(1px);
}

.card-header-controls button:disabled {
  background: #001711 !important;
  border-color: #033126 !important;
  color: #355e52 !important;
  cursor: default;
  transform: none !important;
}

#history-select {
  background: #01271e;
  border: 1px solid #065f47;
  color: #e5e7eb;
  padding: 0.25rem 0.9rem;
  border-radius: 999px;
  font-size: 0.8rem;
  outline: none;
  cursor: pointer;
  transition:
    background 0.2s ease,
    border-color 0.2s ease;
}

#history-select:hover {
  background: #033b2d;
  border-color: #1ea67a;
}

#history-select:focus {
  background: #033b2d;
  border-color: #32d8a5;
}

#history-select::-ms-expand {
  display: none;
}

/* ===========================
   RESPONSIVE
=========================== */

.main-logo {
  height: 80px;
  width: auto;
  margin-right: 0.1rem;
  margin-left: 10rem;
  filter: drop-shadow(0 0 14px rgba(0, 0, 0, 0.6));
}

@media (max-width: 768px) {
  body {
    padding: 1rem 0.5rem;
    align-items: flex-start;
  }

  .card {
    width: 100%;
    max-width: 100%;
    padding: 1.1rem 0.9rem 0.9rem;
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .card-title {
    font-size: 1.1rem;
  }

  .card-header-controls {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 0.4rem;
  }

  .card-header-controls button {
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
  }

  #history-select {
    font-size: 0.75rem;
    margin-left: 0.4rem;
    flex-shrink: 0;
  }

  .table-container {
    width: 100%;
    max-width: 100%;
  }

  .table-scroll {
    max-height: 70vh;
    overflow-x: auto;
    overflow-y: auto;
  }

  table {
    width: 100%;
    min-width: 600px;
    font-size: 0.8rem;
  }

  th,
  td {
    padding: 0.45rem 0.5rem;
  }

  .player-name {
    display: none !important;
  }

  .player-avatar {
    display: block !important;
    width: 26px;
    height: 26px;
    border-radius: 999px;
  }

  .player-header {
    flex-direction: row;
    gap: 0.2rem;
  }

  .table-footer {
    flex-direction: column;
    align-items: flex-start;
    font-size: 0.75rem;
  }

  .main-logo {
    display: none;
    height: 44px;
    margin-bottom: 0.5rem;
  }

  .card-header {
    flex-direction: column;
    align-items: center;
  }
}

/* Link oben rechts: MatchList */

.nav-link,
.nav-link:visited {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.3rem 0.9rem;
  border-radius: 999px;
  border: 1px solid #065f47;
  background: #00130e;
  color: #e5e7eb;
  font-size: 0.8rem;
  text-decoration: none;
  cursor: pointer;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    transform 0.15s ease;
}

.nav-link:hover {
  background: #033b2d;
  border-color: #1ea67a;
  color: #e5e7eb;
  transform: translateY(-1px);
}

.nav-link:active {
  transform: translateY(1px);
}

.nav-link:focus-visible {
  outline: 2px solid #22c55e;
  outline-offset: 2px;
}

/* ===========================
   MATCHLIST-SPEZIFISCH
=========================== */

/* kompakteres Layout */

#matchlist-table {
  table-layout: fixed;
  width: 1400px;
  max-width: 95vw;
  font-size: 0.78rem;
  line-height: 2;
}

/* kleinere Padding + Grundschriftfarbe */

#matchlist-table th,
#matchlist-table td {
  padding: 2px 4px;
  color: #ffffff !important;
}

/* zweite Headerzeile kleiner, nicht fett */

#matchlist-table thead tr:nth-child(2) th {
  font-size: 0.65rem !important;
  font-weight: normal !important;
  padding-top: 1px;
  padding-bottom: 1px;
}

/* Spaltentextfarben (nur Headerzeile 2 + Body) */

#matchlist-table thead tr:nth-child(2) th:nth-child(n+9):nth-child(-n+14),
#matchlist-table tbody td:nth-child(n+9):nth-child(-n+14) {
  color: #d4853f !important;
}

#matchlist-table thead tr:nth-child(2) th:nth-child(n+15):nth-child(-n+20),
#matchlist-table tbody td:nth-child(n+15):nth-child(-n+20) {
  color: #CB4ACE !important;
}

#matchlist-table thead tr:nth-child(2) th:nth-child(n+21):nth-child(-n+26),
#matchlist-table tbody td:nth-child(n+21):nth-child(-n+26) {
  color: #ff69b4 !important;
}

#matchlist-table thead tr:nth-child(2) th:nth-child(n+27):nth-child(-n+32),
#matchlist-table tbody td:nth-child(n+27):nth-child(-n+32) {
  color: #21a589 !important;
}

#matchlist-table thead tr:nth-child(2) th:nth-child(n+33):nth-child(-n+38),
#matchlist-table tbody td:nth-child(n+33):nth-child(-n+38) {
  color: #e0e879 !important;
}

#matchlist-table thead tr:nth-child(2) th:nth-child(n+39):nth-child(-n+44),
#matchlist-table tbody td:nth-child(n+39):nth-child(-n+44) {
  color: #8ed2f2 !important;
}

/* Avatare im MatchList-Header */

#matchlist-table .player-avatar-matchlist {
  width: 50px;
  height: 40px;
  border-radius: 999px;
  object-fit: cover;
}

/* Spalten 8–44 zentriert */

#matchlist-table thead tr:nth-child(2) th:nth-child(n+8):nth-child(-n+44),
#matchlist-table tbody td:nth-child(n+8):nth-child(-n+44) {
  text-align: center !important;
}

/* Hover über ganze Zeile (inkl. Spalte 1) */

#matchlist-table tbody tr:hover td {
  background-color: rgba(255, 255, 255, 0.08) !important;
}

/* Max-/Min-Highlight mit Glow */

@keyframes matchlistPulseMax {
  0%   { box-shadow: 0 0 6px 3px rgba(31, 255, 127, 0.45); }
  50%  { box-shadow: 0 0 16px 8px rgba(31, 255, 127, 0.85); }
  100% { box-shadow: 0 0 6px 3px rgba(31, 255, 127, 0.45); }
}

.matchlist-highlight-max {
  background-color: #1b8047 !important;
  animation: matchlistPulseMax 0.9s ease-in-out infinite;
  border-radius: 4px;
}

@keyframes matchlistPulseMin {
  0%   { box-shadow: 0 0 6px 3px rgba(255, 80, 80, 0.45); }
  50%  { box-shadow: 0 0 14px 6px rgba(255, 60, 60, 0.85); }
  100% { box-shadow: 0 0 6px 3px rgba(255, 80, 80, 0.45); }
}

.matchlist-highlight-min {
  background-color: #c02f2f !important;
  animation: matchlistPulseMin 1.0s ease-in-out infinite;
  border-radius: 4px;
}

/* Score-Blöcke (Spalten 3–6) */

#matchlist-table td.score-block-green {
  background-color: rgba(23, 235, 100, 0.5) !important;
}

#matchlist-table td.score-block-orange {
  background-color: rgba(253, 197, 14, 0.61) !important;
}

#matchlist-table td.score-block-red {
  background-color: rgba(239, 68, 68, 0.45) !important;
}

/* Map-Thumbnail in Spalte 7 */

#matchlist-table .map-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1.2;
}

#matchlist-table .map-thumb {
  width: 48px;
  height: 27px;
  object-fit: cover;
  border-radius: 3px;
  flex-shrink: 0;
}

/* erste Spalte im MatchList-Body NICHT sticky + ohne Balken */

#matchlist-table tbody td:first-child {
  position: static !important;
  left: auto !important;
  z-index: 0 !important;
  box-shadow: none !important;
}

#matchlist-table tbody td:first-child::before {
  content: none !important;
}

/* Header der MatchList: als Block sticky, voll deckend */

#matchlist-table thead,
#matchlist-table thead tr,
#matchlist-table thead th {
  position: static !important;
  top: auto !important;
  border: none !important;
  box-shadow: none !important;
  outline: none !important;
}

#matchlist-table thead {
  position: sticky !important;
  top: 0 !important;
  z-index: 60 !important;
  background-color: #031f19 !important;
}

#matchlist-table thead th {
  background-color: #031f19 !important;
  opacity: 1 !important;
}

#matchlist-table thead tr:last-child th {
  border-bottom: 1px solid rgba(0, 0, 0, 0.7) !important;
}

#matchlist-table thead th:focus,
#matchlist-table thead th:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}
