:root {
    --bg-color:#0d0d0d;
    --text-color:#eee;
    --card-bg:#222;
    --card-border:#444;
    --accent:#0d6efd;
    --muted-text:#999;
    --status-online:#3cba54;
    --status-offline:#ea4335;
    --table-bg:#202020;
    --table-border:#444;
    --thead-bg:#262626;
    --thead-text:#ffffff;
    --reload-track:#444;
    --title-bg:rgba(255,255,255,0.06);
    --nav-active-bg-dark:var(--accent);
    --nav-active-text-dark:#ffffff;
    --nav-active-bg-light:rgba(0,0,0,0.06);
    --nav-active-text-light:#000000;
}

body[data-theme="light"] {
    --bg-color:#f5f5f5;
    --text-color:#111;
    --card-bg:#ffffff;
    --card-border:#dddddd;
    --accent:#0d6efd;
    --muted-text:#555;
    --status-online:#188038;
    --status-offline:#d93025;
    --table-bg:#ffffff;
    --table-border:#cccccc;
    --thead-bg:#f0f0f0;
    --thead-text:#000000;
    --reload-track:#dddddd;
    --title-bg:rgba(0,0,0,0.03);
}

body {
    background:var(--bg-color);
    color:var(--text-color);
}

/* Title ribbon */
.title-card {
    display:inline-block;
    padding:0.6rem 1.4rem;
    border-radius:0.75rem;
    border:1px solid var(--card-border);
    background:var(--title-bg);
}
.title-card h1 {
    margin:0;
    font-size:1.6rem;
    color:var(--text-color);
}

/* Server overview cards */

.server-card {
    background:var(--card-bg);
    border:1px solid var(--card-border);
    border-radius:0.85rem;
    padding:0.85rem 1rem;
    box-shadow:0 4px 12px rgba(0,0,0,0.25);
    display:flex;
    flex-direction:column;
    height:100%;
    width:100%;
    transition:transform 0.15s ease, box-shadow 0.15s ease;
}

.server-card:hover {
    transform:translateY(-2px);
    box-shadow:0 6px 18px rgba(0,0,0,0.35);
}

.server-header-top {
    display:flex;
    justify-content:space-between;
    align-items:flex-start;
    gap:0.5rem;
    margin-bottom:0.35rem;
}

.server-header-main {
    display:flex;
    align-items:flex-start;
    gap:0.55rem;
}

/* Game icons */
.game-icon {
    width:34px;
    height:34px;
    border-radius:999px;
    overflow:hidden;
    flex-shrink:0;
}
.game-icon img {
    width:100%;
    height:100%;
    object-fit:contain;
    background-color:#000;
}

/* Server texts */
.server-title-block {
    min-width:0;
}

.server-name-wrapper {
    position:relative;
    overflow:hidden;
    white-space:nowrap;
    max-width:100%;
}

.server-name {
    font-weight:600;
    font-size:1.0rem;
    color:var(--text-color);
    display:inline-block;
}

.server-name.scrollable {
    animation:servername-scroll 10s linear infinite;
}

/* Auto-scroll for long server names */
@keyframes servername-scroll {
    0%   { transform:translateX(0); }
    10%  { transform:translateX(0); }
    90%  { transform:translateX(-40%); }
    100% { transform:translateX(-40%); }
}

/* Host / port row */
.server-host-row {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:0.5rem;
    font-size:0.8rem;
    color:var(--muted-text);
}

.server-host-text {
    flex:1 1 auto;
    font-family:monospace;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}

.server-host-row .d-flex {
    flex-shrink:0;
}

/* Status pill */
.server-status-pill {
    font-size:0.7rem;
    font-weight:600;
    padding:0.2rem 0.55rem;
    border-radius:999px;
    border:1px solid transparent;
    white-space:nowrap;
}
.server-status-online {
    color:var(--status-online);
    border-color:var(--status-online);
}
.server-status-offline {
    color:var(--status-offline);
    border-color:var(--status-offline);
}
.server-status-unknown {
    color:var(--muted-text);
    border-color:var(--muted-text);
}

/* Map preview placeholder */
.map-preview {
    border-radius:0.5rem;
    background:radial-gradient(circle at 30% 30%, #444, #111);
    aspect-ratio: 4 / 3;
    width: 100%;
    margin:0.35rem 0 0.5rem;
    position:relative;
    overflow:hidden;
}
erflow:hidden;
}
erflow:hidden;
}
.map-preview span {
    position:absolute;
    bottom:0.4rem;
    right:0.8rem;
    font-size:0.7rem;
    letter-spacing:0.12em;
    text-transform:uppercase;
    color:rgba(255,255,255,0.7);
}

/* Map label */
.map-info-row {
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  flex-wrap:wrap;
  font-size:0.78rem;
  margin-bottom:0.5rem;
  gap:0.5rem 0.75rem;
}

.map-info-left,
.map-info-right {
  display:flex;
  flex-direction:column;
  gap:0.2rem;
}

.map-info-right {
  margin-left:auto;
}
right {
  display:flex;
  flex-direction:column;
  gap:0.2rem;
}

.map-chip {
  display:inline-flex;
  align-items:center;
  gap:0.25rem;
  padding:0.12rem 0.7rem;
  border-radius:999px;
  border:1px solid rgba(255,255,255,0.18);
  background:transparent;
  font-size:0.78rem;
  white-space:nowrap;
  box-sizing:border-box;
  max-width:100%;
}



body[data-theme="light"] .map-chip {
  border-color:rgba(0,0,0,0.18);
}

.map-chip-label {
  font-weight:600;
}

.map-chip-value {
  font-family:monospace;
}

.map-info-right .map-chip {
  align-self:flex-end;
}
font-size:0.78rem;
    margin-bottom:0.25rem;
}
.player-count-row span:first-child { font-weight:600; }

/* Players header */
.players-header-row {
    display:flex;
    justify-content:space-between;
    font-size:0.78rem;
    margin-bottom:0.1rem;
}
.players-header-row span {
    font-weight:600;
}

/* Players list */
.server-players-container {
    position:relative;
    overflow:hidden;
    transition:max-height 0.18s ease;
    margin-bottom:2.0rem;
}

.server-players-list {
    list-style:none;
    padding-left:0;
    margin:0;
    display:table;
    width:100%;
    border-collapse:collapse;
}

.player-row {
    display:table-row;
    font-size:0.8rem;
    line-height:1.3;
    white-space:nowrap;
}

/* player name + frags typography */
.player-name {
    display:table-cell;
    flex:1 1 auto;
    min-width:0;
    overflow:hidden;
    text-overflow:ellipsis;
    padding-right:0.6rem;
}
.player-name-inner {
    display:inline-block;
}
.player-name-inner.scrollable {
    animation:playername-scroll 10s linear infinite;
}
.player-frags {
    display:table-cell;
    font-family:monospace;
    flex-shrink:0;
    width:48px;
    text-align:right;
    padding-left:0.5rem;
}

/* Scroll animation for long player names (desktop) */
@keyframes playername-scroll {
    0%   { transform:translateX(0); }
    10%  { transform:translateX(0); }
    90%  { transform:translateX(-40%); }
    100% { transform:translateX(-40%); }
}

/* When list should be scrollable (mobile) */
.server-players-scrollable {
    max-height:150px;
    overflow-y:auto;
}

/* Default collapsed height for desktop-hover mode */
.server-players-collapsed {
    max-height:150px;
}
.server-card:hover .server-players-collapsed {
    max-height:400px;
}

/* Card footer with Details button */
.server-card-footer {
    margin-top:auto;
    display:flex;
    justify-content:space-between;
    align-items:center;
    padding-top:0.4rem;
}

/* Details button */
.btn-details {
    font-size:0.8rem;
}

/* Copy button in host row */
.copy-btn {
    background:#333;
    border:1px solid #666;
    color:#fff;
    padding:2px 6px;
    border-radius:999px;
    cursor:pointer;
    font-size:0.75rem;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    transition:0.15s ease;
}
body[data-theme="light"] .copy-btn {
    background:#f2f2f2;
    border-color:#bbbbbb;
    color:#222;
}
.copy-btn:hover {
    background:#555;
    transform:translateY(-1px);
}
body[data-theme="light"] .copy-btn:hover {
    background:#e0e0e0;
}
.copy-btn.copied {
    background:#1f7a3a !important;
    border-color:#37d26a !important;
    color:#fff !important;
}


/* Detail-View: players table */
#playerTable {
    background-color:var(--table-bg);
    color:var(--text-color);
}
#playerTable thead th {
    background-color:var(--thead-bg) !important;
    color:var(--thead-text) !important;
    border-color:var(--table-border) !important;
}
#playerTable tbody td {
    border-color:var(--table-border) !important;
}

/* Reload circle + theme + language */
.reload-circle,
.theme-toggle,
.lang-toggle {
    position:relative;
    height:42px;
    border-radius:50%;
    display:flex;
    align-items:center;
    justify-content:center;
}

.reload-circle {
    width:42px;
    background:conic-gradient(var(--accent) 360deg, var(--reload-track) 0deg);
}
.reload-circle-inner {
    width:76%;
    height:76%;
    border-radius:50%;
    background:var(--bg-color);
    display:flex;
    align-items:center;
    justify-content:center;
    font-weight:bold;
    font-size:0.8rem;
}

.theme-toggle {
    width:42px;
    background:transparent;
    border:1px solid var(--card-border);
    color:var(--text-color);
    cursor:pointer;
    margin-right:8px;
    transition:0.15s ease;
    font-size:1.2rem;
}
.theme-toggle:hover {
    background:rgba(255,255,255,0.08);
    transform:translateY(-1px);
}
body[data-theme="light"] .theme-toggle:hover {
    background:rgba(0,0,0,0.05);
}

/* Language selector */
.lang-wrapper { position:relative; margin-right:8px; }
.lang-toggle {
    width:auto;
    padding:0 10px;
    border-radius:999px;
    background:transparent;
    border:1px solid var(--card-border);
    color:var(--text-color);
    cursor:pointer;
    font-size:0.75rem;
    gap:6px;
}
.lang-toggle span.flag { font-size:1rem; }
.lang-toggle span.label { font-size:0.8rem; }

.lang-menu {
    position:absolute;
    top:48px;
    left:0;
    background:var(--card-bg);
    border:1px solid var(--card-border);
    border-radius:0.5rem;
    list-style:none;
    padding:4px 0;
    margin:0;
    min-width:150px;
    box-shadow:0 4px 12px rgba(0,0,0,0.3);
    z-index:1000;
    display:none;
}
.lang-menu.show { display:block; }
.lang-menu li {
    padding:4px 10px;
    font-size:0.85rem;
    cursor:pointer;
    display:flex;
    align-items:center;
    gap:6px;
}
.lang-menu li:hover { background:rgba(255,255,255,0.07); }
body[data-theme="light"] .lang-menu li:hover { background:rgba(0,0,0,0.05); }

/* Tooltip for Chart.js */
#chartjs-tooltip {
    position:absolute;
    background:rgba(0,0,0,0.85);
    color:#fff;
    padding:8px 10px;
    border-radius:4px;
    pointer-events:none;
    transform:translate(-50%, -100%);
    white-space:nowrap;
    font-size:13px;
    z-index:9999;
}

/* Q3 colors + top ranks + bot badge */
.q3-0{color:#000}
.q3-1{color:#f00}
.q3-2{color:#0f0}
.q3-3{color:#ff0}
.q3-4{color:#00f}
.q3-5{color:#0ff}
.q3-6{color:#f0f}
.q3-7{color:#fff}

body[data-theme="dark"] .q3-0{
    color:#f8f8f8 !important;
    text-shadow:0 0 3px rgba(0,0,0,0.9);
}

.q3-hex{font-weight:bold;}

.row-1 { background-color: rgba(255,215,0,0.25) !important; }
.row-2 { background-color: rgba(192,192,192,0.25) !important; }
.row-3 { background-color: rgba(205,127,50,0.25) !important; }
.row-1 td { background-color: rgba(255,215,0,0.25) !important; }
.row-2 td { background-color: rgba(192,192,192,0.25) !important; }
.row-3 td { background-color: rgba(205,127,50,0.25) !important; }

.rank-1 { color:#ffd700 !important; font-weight:bold; }
.rank-2 { color:#c0c0c0 !important; font-weight:bold; }
.rank-3 { color:#cd7f32 !important; font-weight:bold; }

.bot-badge {
    font-size:0.65rem;
    padding:0.1rem 0.35rem;
    border-radius:0.5rem;
    margin-right:0.35rem;
    background:#6c757d;
    color:#fff;
    vertical-align:middle;
    position:relative;
    top:-1px;
}


/* Responsive tweaks */
@media (max-width: 768px) {
    .server-card {
        margin-bottom:0.75rem;
    }
    .map-preview {
        height:140px;
    }
}

/* Mode-specific player container behaviour */
.hover-mode { overflow:hidden; }
.scroll-mode { max-height:180px; overflow-y:auto; }

/* On hover, expand hover-mode containers to show all players */
.server-card:hover .server-players-container.hover-mode {
  max-height:9999px !important;
  overflow:visible;
}

.app-header {
  gap:0.75rem;
}

.app-header-wrapper {
  background:var(--card-bg);
  border-radius:0.75rem;
  border:1px solid var(--card-border);
  padding:0.5rem 0.75rem;
}

.app-navbar {
  background:transparent !important;
  border:none !important;
  box-shadow:none !important;
  padding:0;
}

/* Header controls container */
.app-header-controls {
  display:flex;
  align-items:center;
  gap:0.5rem;
}

/* Navbar collapse layout for mobile */
@media (max-width: 991.98px) {
  .navbar-collapse {
    flex-direction:column;
    align-items:center;
    gap:0.75rem;
  }

  .navbar-collapse .navbar-nav {
    margin-top:0.5rem;
  }

  .app-nav {
    width:100%;
    justify-content:center;
  }

  .app-header-controls {
    width:100%;
    justify-content:center;
    margin-top:0.5rem;
  }
}

/* Toggler icon theme overrides */
body[data-theme="dark"] .navbar-toggler {
  border-color:rgba(255,255,255,0.4);
}

body[data-theme="dark"] .navbar-toggler-icon {
  background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255,255,255,0.9%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

body[data-theme="light"] .navbar-toggler {
  border-color:rgba(0,0,0,0.2);
}

body[data-theme="light"] .navbar-toggler-icon {
  background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%280,0,0,0.75%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.app-logo img {
  display:block;
  width:var(--logo-desktop, 32px);
  height:auto;
}

@media (max-width: 576px) {
  .app-logo img {
    width:var(--logo-mobile, 28px);
  }
}


.server-copy-btn.copied {
    background:#1f7a3a !important;
    border-color:#37d26a !important;
    color:#fff !important;
}

/* hover-mode extra players: hidden by default */
.server-players-container.hover-mode .player-row.extra-player {
  display:none;
}

/* show extra players on hover and when expanded on mobile */
.server-card:hover .server-players-container.hover-mode .player-row.extra-player,
.server-card.players-expanded .server-players-container.hover-mode .player-row.extra-player {
  display:table-row;
}


.app-nav {
  display:flex;
  flex-wrap:wrap;
  gap:0.75rem;
}

.app-nav-link {
  font-size:0.95rem;
  padding:0.35rem 0.9rem;
  border-radius:999px;
  border:1px solid transparent;
  text-decoration:none;
  opacity:0.9;
  color:var(--text-color);
  padding:0.35rem 0.9rem;
  border-radius:999px;
  border:1px solid transparent;
  text-decoration:none;
  opacity:0.9;
  transition:
    background 0.15s ease,
    color 0.15s ease,
    transform 0.15s ease,
    border-color 0.15s ease,
    opacity 0.15s ease;
}

.app-nav-link:hover {
  opacity:1;
  background:rgba(255,255,255,0.04);
  border-color:var(--card-border);
  text-decoration:none;
  transform:translateY(-1px);
}

/* Active nav link - shared */
.app-nav-link.active {
  border-radius:0.5rem;
  font-weight:700;
}

/* Dark theme active link */
body[data-theme="dark"] .app-nav-link.active {
  background:var(--nav-active-bg-dark);
  color:var(--nav-active-text-dark);
  border-color:var(--nav-active-bg-dark);
}

/* Light theme active link */
body[data-theme="light"] .app-nav-link.active {
  background:var(--nav-active-bg-light);
  color:var(--nav-active-text-light);
  border-color:rgba(0,0,0,0.08);
}

@media (max-width: 576px) {
  .app-header {
    flex-direction:column;
    align-items:flex-start;
  }
  .app-header-right {
    width:100%;
    justify-content:space-between;
  }
  .app-nav {
    order:1;
  }
}


.players-table {
    width:100%;
    border-collapse:collapse;
}


/* Improve button contrast in light theme */
body[data-theme="light"] .server-card .btn-outline-light {
  border-color:#222;
  color:#111;
}
body[data-theme="light"] .server-card .btn-outline-light:hover {
  background:#e9e9e9;
}




.players-hint-bottom {
  font-size:0.72rem;
  opacity:0.7;
  text-align:center;
  margin-top:0.25rem;
}
.server-card:hover .players-hint-bottom,
.server-card.players-expanded .players-hint-bottom {
  display:none;
}

/* Non-active nav link colors */
body[data-theme="dark"] .app-nav-link:not(.active) {
  color:#cfcfcf;
}

body[data-theme="light"] .app-nav-link:not(.active) {
  color:#333333;
}


/* Team headers (no separating lines, only badges) */
.players-table .team-header td {
  padding-top:0.3rem;
  padding-bottom:0.1rem;
  font-size:0.75rem;
}

.team-badge {
  display:inline-flex;
  align-items:center;
  padding:0.05rem 0.55rem;
  border-radius:999px;
  font-size:0.7rem;
  font-weight:600;
  text-transform:uppercase;
  letter-spacing:0.05em;
}

body[data-theme="dark"] .team-badge-blue { background:#1a3b5f; color:#7ec0ff; }
body[data-theme="dark"] .team-badge-red  { background:#5a1b1b; color:#ff9a9a; }
body[data-theme="dark"] .team-badge-spec { background:#2f2f2f; color:#cccccc; }

body[data-theme="light"] .team-badge-blue { background:#e1efff; color:#004b9a; }
body[data-theme="light"] .team-badge-red  { background:#ffe0e0; color:#b32121; }
body[data-theme="light"] .team-badge-spec { background:#f0f0f0; color:#555555; }

.players-table .team-subheader td {
  padding-top:0.15rem;
  padding-bottom:0.15rem;
  font-size:0.7rem;
  text-transform:uppercase;
  letter-spacing:0.04em;
  opacity:0.8;
}

.players-table .team-subheader-name {
  text-align:left;
}

.players-table .team-subheader-frags {
  text-align:right;
}

/* Team Score + Mode under the map */
.team-score-mode-row {
  display:flex;
  flex-direction:column;
  gap:0.1rem;
  margin-top:0.2rem;
  margin-bottom:0.3rem;
  font-size:0.75rem;
}

.team-score-row {
  display:flex;
  align-items:center;
  justify-content:center;
  gap:0.5rem;
}

.team-score-badge {
  display:inline-flex;
  align-items:center;
  padding:0.05rem 0.7rem;
  border-radius:999px;
  font-size:0.7rem;
  font-weight:600;
  text-transform:uppercase;
  letter-spacing:0.05em;
}
t:600;
  text-transform:uppercase;
  letter-spacing:0.05em;
}

.team-score-badge-left {
  justify-content:flex-start;
}

.team-score-badge-right {
  justify-content:flex-end;
}

.team-score-value {
  font-weight:700;
  font-size:0.8rem;
}

body[data-theme="dark"] .team-score-badge-left,
body[data-theme="dark"] .team-score-badge-right {
  background:rgba(255,255,255,0.05);
  color:var(--text-color);
}

body[data-theme="light"] .team-score-badge-left,
body[data-theme="light"] .team-score-badge-right {
  background:rgba(0,0,0,0.04);
  color:#222222;
}

.team-mode-label {
  opacity:0.85;
}


body[data-theme="dark"] .team-score-badge.team-badge-red,
body[data-theme="light"] .team-score-badge.team-badge-red {
  background:#b52a2a;
  color:#ffffff;
}

body[data-theme="dark"] .team-score-badge.team-badge-blue,
body[data-theme="light"] .team-score-badge.team-badge-blue {
  background:#225bb5;
  color:#ffffff;
}

/* Bold headers in overview player list */
.players-header-row span {
  font-weight:600;
}


.players-table .team-subheader-name,
.players-table .team-subheader-frags {
  font-weight:600;
}


.no-players-wrapper {
  display:flex;
  justify-content:center;
  margin:0.75rem 0 0.5rem;
}

.no-players-pill {
  display:inline-flex;
  align-items:center;
  padding:0.12rem 0.9rem;
  border-radius:999px;
  border:1px solid rgba(255,255,255,0.25);
  font-size:0.8rem;
  white-space:nowrap;
}

body[data-theme="light"] .no-players-pill {
  border-color:rgba(0,0,0,0.25);
}


@media (max-width: 576px) {
  .map-info-row {
    flex-direction:column;
    align-items:flex-start;
  }
  .map-info-right {
    margin-left:0;
  }
}


.map-preview-img {
    width:100%;
    height:100%;
    object-fit:cover;
    display:block;
}


/* FIX63 Map preview scaling */
.map-preview {
    border-radius:0.5rem;
    background:radial-gradient(circle at 30% 30%, #444, #111);
    width:100%;
    margin:0.35rem 0 0.5rem;
    position:relative;
    overflow:hidden;
    max-height: var(--map-preview-max-height, 200px);
}
.map-preview-img {
    width:100%;
    height:auto;
    display:block;
    object-fit:cover;
}


/* Override Bootstrap grid for server cards at very small widths */
@media (min-width: 768px) and (max-width: 777px) {
  .server-card-col {
    flex: 0 0 100%;
    max-width: 100%;
  }
}
