html, body {
    overflow: hidden;
}

/* JKA palette (full saturation reference):
   ^1 Red     #ff0000   ^2 Green   #00ff00   ^3 Yellow  #ffff00
   ^4 Blue    #0000ff   ^5 Cyan    #00ffff   ^6 Magenta #ff00ff
   ^8 Orange  #ff8000   ^9 Gray    #808080
   Primary accent: ^2 Green  #00cc44
   Secondary accent: ^6 Magenta  #cc00cc
*/

/* Server selector in navbar */
.navbar-server-wrap {
    float: right;
    display: flex;
    align-items: center;
    gap: 10px;
    height: 60px;
    padding-right: 12px;
}
.navbar-server-icon {
    color: #00cc44;
    font-size: 18px;
    opacity: 0.75;
}
.navbar-server-select {
    appearance: none;
    -webkit-appearance: none;
    background: #111;
    border: 1px solid #00cc44;
    color: #00cc44;
    font-size: 15px;
    font-weight: 600;
    padding: 6px 34px 6px 14px;
    height: 38px;
    border-radius: 19px;
    cursor: pointer;
    letter-spacing: 0.3px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2300cc44'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    transition: background 0.15s, box-shadow 0.15s;
}
.navbar-server-select:hover { background-color: #1a2e1a; box-shadow: 0 0 0 1px #00cc44; }
.navbar-server-select:focus { outline: none; box-shadow: 0 0 0 2px rgba(0,204,68,0.4); }
.navbar-server-select option { background: #1a1a1a; color: #ccc; }

/* Count bar */
.count-bar-wrap { margin-bottom: 12px; }

.count-bar-controls { display: flex; gap: 4px; margin-bottom: 6px; }
.count-bar-btn {
    background: transparent;
    border: 1px solid #383838;
    color: #888;
    border-radius: 3px;
    padding: 2px 8px;
    font-size: 11px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.count-bar-btn:hover { background: #2c2c2c; color: #ccc; }
.count-bar-btn.active { background: #303030; color: #ccc; border-color: #505050; }

.count-bar {
    display: flex;
    width: 100%;
    height: 28px;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 6px;
}

.count-bar-seg {
    min-width: 2px;
    overflow: hidden;
    display: flex;
    align-items: center;
    transition: opacity 0.15s;
    cursor: default;
}
/* Cycling JKA ^1-^6 palette, slightly pulled back from pure saturation */
.count-bar-seg:nth-child(1)  { background: #cc2222; }
.count-bar-seg:nth-child(2)  { background: #00cc44; }
.count-bar-seg:nth-child(3)  { background: #cc00cc; }
.count-bar-seg:nth-child(4)  { background: #2255cc; }
.count-bar-seg:nth-child(5)  { background: #00aacc; }
.count-bar-seg:nth-child(6)  { background: #ccaa00; }
.count-bar-seg:nth-child(7)  { background: #cc4400; }
.count-bar-seg:nth-child(8)  { background: #008855; }
.count-bar-seg:nth-child(9)  { background: #881188; }
.count-bar-seg:nth-child(10) { background: #1133aa; }
.count-bar-seg:nth-child(11) { background: #009999; }
.count-bar-seg:nth-child(12) { background: #998800; }
.count-bar-seg:nth-child(13) { background: #991111; }
.count-bar-seg:nth-child(14) { background: #006633; }
.count-bar-seg:nth-child(15) { background: #660066; }
.count-bar-seg:nth-child(16) { background: #113388; }
.count-bar-seg:nth-child(17) { background: #007788; }
.count-bar-seg:nth-child(18) { background: #776600; }
.count-bar-seg:nth-child(19) { background: #aa3300; }
.count-bar-seg:nth-child(20) { background: #005533; }
.count-bar-seg:hover { opacity: 0.8; }

.count-bar-seg-text {
    font-size: 11px;
    color: rgba(255,255,255,0.9);
    white-space: nowrap;
    padding: 0 6px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.7);
    pointer-events: none;
}

.count-bar-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 12px;
    color: #888;
}
.count-bar-item { white-space: nowrap; }
.count-bar-dot {
    display: inline-block;
    width: 10px; height: 10px;
    border-radius: 50%;
    background: #444;
    margin-right: 4px;
}
.count-bar-item:nth-child(1)  .count-bar-dot { background: #cc2222; }
.count-bar-item:nth-child(2)  .count-bar-dot { background: #00cc44; }
.count-bar-item:nth-child(3)  .count-bar-dot { background: #cc00cc; }
.count-bar-item:nth-child(4)  .count-bar-dot { background: #2255cc; }
.count-bar-item:nth-child(5)  .count-bar-dot { background: #00aacc; }
.count-bar-item:nth-child(6)  .count-bar-dot { background: #ccaa00; }
.count-bar-item:nth-child(7)  .count-bar-dot { background: #cc4400; }
.count-bar-item:nth-child(8)  .count-bar-dot { background: #008855; }
.count-bar-item:nth-child(9)  .count-bar-dot { background: #881188; }
.count-bar-item:nth-child(10) .count-bar-dot { background: #1133aa; }
.count-bar-item:nth-child(11) .count-bar-dot { background: #009999; }
.count-bar-item:nth-child(12) .count-bar-dot { background: #998800; }
.count-bar-item:nth-child(13) .count-bar-dot { background: #991111; }
.count-bar-item:nth-child(14) .count-bar-dot { background: #006633; }
.count-bar-item:nth-child(15) .count-bar-dot { background: #660066; }
.count-bar-item:nth-child(16) .count-bar-dot { background: #113388; }
.count-bar-item:nth-child(17) .count-bar-dot { background: #007788; }
.count-bar-item:nth-child(18) .count-bar-dot { background: #776600; }
.count-bar-item:nth-child(19) .count-bar-dot { background: #aa3300; }
.count-bar-item:nth-child(20) .count-bar-dot { background: #005533; }

/* Activity sparkline */
.activity-chart {
    display: flex;
    align-items: flex-end;
    width: 100%;
    height: 60px;
    gap: 1px;
    overflow-x: auto;
}
.activity-bar {
    flex: 1 1 0;
    min-width: 1px;
    background: #00cc44;
    border-radius: 1px 1px 0 0;
    opacity: 0.85;
    transition: opacity 0.15s;
    cursor: default;
}
.activity-bar:hover { opacity: 1; }
.activity-axis {
    position: relative;
    height: 18px;
    margin-top: 2px;
}
.activity-marker {
    position: absolute;
    transform: translateX(-50%);
    font-size: 10px;
    color: #555;
    white-space: nowrap;
}
.activity-marker.major {
    color: #888;
    font-weight: 600;
}
.activity-marker.major::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    width: 1px;
    height: 5px;
    background: #383838;
}

/* Map cards */
.map-cards { display: flex; flex-wrap: nowrap; gap: 12px; overflow-x: auto; padding-bottom: 4px; }
.map-card {
    flex: 0 0 200px;
    border-radius: 6px;
    overflow: hidden;
    background: #282828;
    position: relative;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}
.map-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.5); }
.map-card.active { box-shadow: 0 0 0 2px #00cc44; }
.map-card-bg {
    height: 80px;
    background-size: cover;
    background-position: center;
    background-color: #1a1a1a;
    position: relative;
}
.map-card-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0.2), rgba(0,0,0,0.7));
}
.map-card-title {
    position: absolute;
    bottom: 6px; left: 8px; right: 8px;
    z-index: 1;
    font-size: 12px;
    font-weight: 600;
    color: #ddd;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 1px 3px rgba(0,0,0,0.9);
}
.map-card-body { padding: 8px 10px; }
.map-card-stats { display: flex; gap: 12px; font-size: 11px; color: #888; margin-bottom: 6px; }
.map-card-stat-val { font-size: 13px; font-weight: 600; color: #ccc; display: block; }
.map-card-record { font-size: 11px; color: #888; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-card-record a { color: #00cc44; }

/* Player cards */
.player-cards { display: flex; flex-wrap: nowrap; gap: 12px; overflow-x: auto; padding-bottom: 4px; }
.player-card {
    flex: 1 1 160px;
    min-width: 150px;
    max-width: 200px;
    background: #282828;
    border-radius: 6px;
    padding: 12px;
    transition: transform 0.15s, box-shadow 0.15s;
    cursor: default;
}
.player-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.5); }
.player-card-name { font-size: 14px; font-weight: 600; margin-bottom: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-card-name a { color: #cc00cc; text-decoration: none; }
.player-card-name a:hover { text-decoration: underline; color: #ff33ff; }
.player-card-pct-bar { height: 4px; background: #333; border-radius: 2px; margin-bottom: 8px; }
.player-card-pct-fill { height: 100%; border-radius: 2px; background: #00cc44; }
.player-card-stats { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 11px; color: #888; }
.player-card-stat-val { color: #ccc; font-weight: 600; }

/* Player detail avatar */
.player-detail-heading {
    display: flex;
    flex: 1 1 100%;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    width: 100%;
    min-height: 34px;
}
.player-detail-title-wrap {
    display: grid;
    align-items: stretch;
    grid-template-columns: minmax(245px, 305px) minmax(0, 1fr);
    gap: 0;
    width: 100%;
    min-width: 0;
    --player-heading-row-height: 57px;
}
.player-detail-title-wrap > div:first-child {
    grid-column: 1;
    grid-row: 1;
    margin-bottom: 0 !important;
    min-width: 0;
    padding-right: 132px;
    min-height: var(--player-heading-row-height);
    align-items: center !important;
}
.player-detail-tabs {
    grid-column: 1;
    grid-row: 1;
    justify-self: end;
    align-self: center;
    display: flex;
    align-items: center;
    gap: 4px;
    height: auto;
    line-height: normal;
    margin-right: 10px;
    white-space: nowrap;
}
.btn-group.player-detail-tabs > .btn.btn-sm {
    display: inline-flex !important;
    float: none !important;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    margin: 0;
    padding: 0 18px !important;
    border: 0 !important;
    border-radius: 5px !important;
    background: rgba(0,204,68,0.12) !important;
    box-shadow: none !important;
    color: #00cc44 !important;
    font-size: 14px;
    font-weight: 700;
    line-height: 1 !important;
}
.btn-group.player-detail-tabs > .btn.btn-sm:hover,
.btn-group.player-detail-tabs > .btn.btn-sm:focus {
    background: rgba(0,204,68,0.2) !important;
    color: #33ff77 !important;
    outline: none;
}
.btn-group.player-detail-tabs > .btn.btn-sm.btn-primary {
    background: #00cc44 !important;
    color: #07120a !important;
}
.player-heading-overall {
    grid-column: 2;
    grid-row: 1;
    display: grid;
    grid-template-columns: repeat(5, minmax(74px, max-content)) minmax(0, 1fr);
    align-items: stretch;
    gap: 6px;
    width: 100%;
    min-width: 0;
    min-height: var(--player-heading-row-height);
}
.player-heading-duel-awards {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    align-items: stretch;
    gap: 6px;
    width: 100%;
    min-width: 0;
    height: 66px;
    min-height: 66px;
    overflow: hidden;
}
.player-heading-award {
    display: flex;
    flex: 0 0 92px;
    min-width: 0;
    min-height: 66px;
    box-sizing: border-box;
    flex-direction: column;
    justify-content: center;
    padding: 8px 8px 7px;
    border: 1px solid rgba(0,204,68,0.14);
    border-radius: 5px;
    background: rgba(30,30,30,0.72);
    text-align: center;
}
.player-heading-award strong {
    color: #ddd;
    font-size: 16px;
    line-height: 1.1;
}
.player-heading-award span {
    overflow: hidden;
    margin-top: 3px;
    color: #666;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.35px;
    line-height: 1.1;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}
.player-heading-stat {
    min-width: 74px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 8px 8px 7px;
    border: 1px solid rgba(0,204,68,0.14);
    border-radius: 5px;
    background: rgba(30,30,30,0.72);
    text-align: center;
}
.player-heading-stat strong {
    display: block;
    color: #ddd;
    font-size: 16px;
    line-height: 1.1;
}
.player-heading-stat span {
    display: block;
    margin-top: 2px;
    color: #666;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.5px;
    line-height: 1;
    text-transform: uppercase;
}
.player-heading-activity {
    display: flex;
    min-width: 0;
    width: 100%;
    flex-direction: column;
    justify-content: flex-end;
    padding: 8px 8px 7px;
    border: 1px solid rgba(0,204,68,0.14);
    border-radius: 5px;
    background: rgba(30,30,30,0.72);
}
.player-heading-activity-label {
    margin-bottom: 4px;
    color: #666;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.5px;
    line-height: 1;
    text-transform: uppercase;
}
.player-heading-activity-bars {
    display: flex;
    align-items: flex-end;
    gap: 1px;
    height: 36px;
    min-width: 0;
    overflow: hidden;
}
.player-heading-activity-bars .activity-bar {
    flex: 1 1 2px;
    min-width: 1px;
}
.player-name-picker {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    min-width: 0;
    margin-bottom: 8px;
}
.player-name-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: var(--player-heading-row-height);
    min-width: 0;
    max-width: 100%;
    padding: 0;
    border: 0;
    border-bottom: 1px dashed rgba(0,204,68,0.55);
    background: transparent;
    color: #f1f1f1;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.25;
    text-align: left;
}
.player-name-trigger span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.player-name-trigger i {
    color: #00cc44;
    font-size: 13px;
}
.player-name-trigger:hover,
.player-name-trigger:focus {
    color: #fff;
    border-bottom-color: #00cc44;
    outline: none;
}
.player-profile-top {
    display: grid;
    grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
    gap: 0;
    column-gap: 0;
    align-items: stretch;
    margin-bottom: 0;
    flex-shrink: 0;
    position: relative;
}
.player-detail-panel {
    height: calc(100vh - 84px);
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
    min-height: 0;
    position: relative;
    isolation: isolate;
}
.player-saber-page-lightmap {
    position: absolute;
    inset: 0;
    z-index: 60;
    width: 100%;
    height: 100%;
    pointer-events: none;
    mix-blend-mode: screen;
    opacity: 0.95;
}
.player-detail-panel > .panel-heading {
    flex-shrink: 0;
}
.player-detail-body {
    position: relative;
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    overflow: visible;
    padding-left: 0 !important;
    padding-right: 0 !important;
}
.player-detail-body > .player-profile-top {
    display: block;
    min-height: 520px;
    padding-left: 320px;
    position: relative;
    z-index: 3;
}
.player-profile-avatar-stable {
    position: absolute;
    left: 0;
    top: 0;
    z-index: 20;
    pointer-events: none;
}
.player-races-section {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 160px;
    margin-top: -16px;
    position: relative;
    z-index: 3;
}
.player-races-section > div:first-child {
    flex-shrink: 0;
    padding-left: 18px;
}
.player-races-section .table-scroll {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow: auto;
}
.player-duels-section {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 160px;
    margin-top: -16px;
    position: relative;
    z-index: 3;
}
.player-duels-section > div:first-child {
    flex-shrink: 0;
    padding-left: 18px;
}
.player-duels-section .table-scroll {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow: auto;
}
.player-duels-section .table > thead > tr > th:first-child,
.player-duels-section .table > tbody > tr > td:first-child {
    padding-left: 18px;
}
.player-profile-avatar-col {
    display: flex;
    min-width: 0;
    min-height: 520px;
}
.player-profile-main-col {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.player-race-achievements { order: 3; }
.player-race-styles-label { order: 4; }
.player-race-styles {
    order: 4;
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    width: 100%;
    margin-bottom: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 2px 8px;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}
.player-achievements-cosmetic-trigger {
    display: inline-flex;
    align-items: baseline;
    width: fit-content;
    border-bottom: 1px dashed rgba(0,204,68,0.55);
    color: #00cc44;
    cursor: pointer;
    text-decoration: none;
}
.player-achievements-cosmetic-trigger:hover {
    color: #33ff77;
    border-bottom-color: #00cc44;
    text-decoration: none;
}
.player-cosmetic-selector {
    position: fixed;
    z-index: 10000;
    width: 236px;
    max-height: min(420px, calc(100vh - 160px));
    overflow: auto;
    padding: 8px;
    border: 1px solid rgba(0,204,68,0.28);
    border-radius: 5px;
    background: rgba(13,15,18,0.98);
    box-shadow: 0 12px 32px rgba(0,0,0,0.55);
}
.player-cosmetic-selector-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
    color: #00cc44;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}
.player-cosmetic-clear {
    border: 0;
    background: transparent;
    color: #888;
    font-size: 11px;
    padding: 0;
}
.player-cosmetic-clear:hover,
.player-cosmetic-clear:focus {
    color: #ddd;
    outline: none;
}
.player-cosmetic-group {
    margin: 8px 0 4px;
    color: #666;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
}
.player-cosmetic-option {
    display: block;
    width: 100%;
    min-height: 26px;
    margin: 0 0 3px;
    padding: 4px 7px;
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 3px;
    background: rgba(255,255,255,0.035);
    color: #ccc;
    font-size: 12px;
    line-height: 1.25;
    text-align: left;
}
.player-cosmetic-option:hover,
.player-cosmetic-option:focus {
    border-color: rgba(0,204,68,0.38);
    color: #fff;
    outline: none;
}
.player-cosmetic-option.active {
    border-color: #00cc44;
    background: rgba(0,204,68,0.14);
    color: #00cc44;
}
.player-cosmetic-empty {
    padding: 14px 8px;
    color: #777;
    text-align: center;
}
.player-duel-awards { order: 1; }
.player-duel-history { order: 2; }
.player-duel-elo-types { order: 3; }
.player-duel-awards.panel-section-label {
    margin-top: 0 !important;
}
.player-profile-main-col > .player-duel-awards {
    display: none;
}
.duel-award-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 20px;
}
.duel-award-grid::before,
.duel-award-grid::after {
    display: none;
}
.duel-award-grid > [class*="col-"] {
    width: 96px;
    flex: 0 0 96px;
    float: none;
    padding: 0;
}
.duel-award-grid .panel.panel-filled {
    min-height: 64px;
    margin-bottom: 0;
}
.duel-elo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 180px));
    gap: 8px;
    justify-content: start;
}
.duel-elo-card {
    min-height: 84px;
}
.player-avatar3d {
    position: relative;
    flex: 0 0 132px;
    width: 132px;
    height: 132px;
    border: 0;
    border-radius: 0;
    background: transparent;
    overflow: visible;
    -webkit-mask-image:
        linear-gradient(to bottom, rgba(0,0,0,0) 0%, #000 9%, #000 84%, rgba(0,0,0,0) 100%),
        linear-gradient(to right, #000 0%, #000 92%, rgba(0,0,0,0) 100%);
    -webkit-mask-composite: source-in;
    mask-image:
        linear-gradient(to bottom, rgba(0,0,0,0) 0%, #000 9%, #000 84%, rgba(0,0,0,0) 100%),
        linear-gradient(to right, #000 0%, #000 92%, rgba(0,0,0,0) 100%);
    mask-composite: intersect;
}
.player-avatar3d::before {
    content: "";
    position: absolute;
    inset: -96px -52px -56px;
    transform: translateX(-24px);
    pointer-events: none;
    background:
        radial-gradient(ellipse at 50% 50%, rgba(5,5,8,0.86) 0%, rgba(7,7,10,0.62) 42%, rgba(7,7,10,0.20) 68%, rgba(7,7,10,0) 88%),
        radial-gradient(ellipse at 45% 36%, rgba(164,92,255,0.66) 0%, rgba(164,92,255,0.34) 38%, rgba(164,92,255,0) 76%);
    filter: blur(28px);
    z-index: -2;
}
.player-avatar3d::after {
    content: "";
    position: absolute;
    inset: -48px -24px -18px;
    pointer-events: none;
    background:
        linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(0,0,0,0) 58%, rgba(0,0,0,0.48) 78%, rgba(0,0,0,0.96) 100%),
        radial-gradient(ellipse at center, rgba(0,0,0,0) 50%, rgba(0,0,0,0.46) 76%, rgba(0,0,0,0) 100%);
    filter: blur(16px);
    z-index: 1;
}
.player-profile-avatar-col .player-avatar3d {
    position: absolute;
    left: -3px;
    top: -88px;
    width: 560px;
    height: 590px;
    flex: none;
    margin-left: 0;
    min-height: unset;
    z-index: 20;
    /* no top fade — head should show above the row */
    -webkit-mask-image:
        linear-gradient(to bottom, #000 0%, #000 84%, rgba(0,0,0,0) 100%),
        linear-gradient(to right, #000 0%, #000 88%, rgba(0,0,0,0) 100%);
    -webkit-mask-composite: source-in;
    mask-image:
        linear-gradient(to bottom, #000 0%, #000 84%, rgba(0,0,0,0) 100%),
        linear-gradient(to right, #000 0%, #000 88%, rgba(0,0,0,0) 100%);
    mask-composite: intersect;
}
.player-profile-avatar-col .player-avatar3d::before {
    inset: 120px 220px -56px 73px;
}
.player-avatar3d-interact {
    position: absolute;
    inset: 0;
    z-index: 2;
    cursor: grab;
}
.player-avatar3d-interact:active {
    cursor: grabbing;
}
/* in profile mode: wrapper is click-through; interact zone avoids visual spillover */
.player-profile-avatar-col .player-avatar3d {
    pointer-events: none;
}
.player-profile-avatar-col .player-avatar3d-interact {
    top: 100px;
    right: auto;
    width: 320px;
    pointer-events: auto;
}
.player-avatar3d-canvas {
    display: block;
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 0;
}
.player-avatar3d-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #00cc44;
    font-size: 16px;
    pointer-events: none;
    background: rgba(0,0,0,0.25);
    z-index: 2;
}
.player-profile-avatar-col .player-avatar3d-overlay {
    right: 200px;
}
.player-avatar3d-placeholder {
    position: absolute;
    left: -3px;
    top: -88px;
    width: 560px;
    height: 590px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(0, 204, 68, 0.7);
    pointer-events: none;
    z-index: 20;
}
.player-avatar3d-error {
    padding: 10px;
    color: #888;
    font-size: 11px;
    text-align: center;
    line-height: 1.3;
}

@media (max-width: 520px) {
    .player-detail-heading {
        align-items: stretch;
        gap: 10px;
    }
    .player-detail-title-wrap {
        align-items: flex-start;
        flex-direction: column;
        display: flex;
    }
    .player-detail-title-wrap > div:first-child {
        padding-right: 0;
    }
    .player-heading-overall {
        flex-wrap: wrap;
        width: 100%;
    }
    .player-detail-tabs {
        margin-left: 0;
    }
    .player-detail-body > .player-profile-top {
        min-height: 0;
        padding-left: 0;
    }
    .player-profile-avatar-stable {
        position: relative;
        left: auto;
        top: auto;
    }
    .player-profile-top {
        grid-template-columns: 1fr;
    }
    .player-avatar3d {
        flex-basis: 104px;
        width: 104px;
        height: 104px;
    }
    .player-profile-avatar-col .player-avatar3d {
        position: relative;
        left: auto;
        top: auto;
        width: calc(100% + 15px);
        height: 300px;
        min-height: 300px;
        flex: 1 1 auto;
        margin-left: -15px;
    }
    .player-profile-avatar-col {
        min-height: 0;
    }
}

@media (max-width: 767px) {
    html,
    body {
        overflow-x: hidden;
        overflow-y: auto;
    }
    .content {
        min-height: calc(100vh - 60px);
        overflow: visible;
    }
    #main-content {
        overflow: visible;
    }
    .player-detail-panel {
        height: auto;
        min-height: calc(100vh - 72px);
        overflow: visible;
    }
    .player-detail-panel > .panel-heading {
        display: block;
        padding: 10px 12px;
    }
    .player-detail-heading {
        display: block;
        min-height: 0;
    }
    .player-detail-title-wrap {
        display: flex;
        width: 100%;
        flex-direction: column;
        gap: 10px;
        --player-heading-row-height: 52px;
    }
    .player-detail-title-wrap > div:first-child {
        width: 100%;
        min-height: 0;
        padding-right: 0;
    }
    .player-name-trigger {
        width: 100%;
        min-height: 36px;
        font-size: 18px;
    }
    .player-detail-tabs {
        width: 100%;
        justify-self: auto;
        margin: 0;
    }
    .btn-group.player-detail-tabs > .btn.btn-sm {
        flex: 1 1 0;
        min-height: 40px;
        padding: 0 12px !important;
    }
    .player-heading-overall,
    .player-heading-duel-awards {
        display: flex;
        flex-wrap: wrap;
        width: calc(100% + 24px);
        min-height: 0;
        margin: 0 -12px;
        padding: 0 12px 2px;
        gap: 6px;
    }
    .player-heading-duel-awards {
        height: auto;
    }
    .player-heading-stat,
    .player-heading-award,
    .player-heading-activity {
        min-height: 58px;
    }
    .player-heading-stat {
        flex: 1 1 0;
        min-width: 58px;
        padding: 6px 5px 5px;
    }
    .player-heading-stat strong {
        font-size: 14px;
    }
    .player-heading-stat span {
        font-size: 8px;
        letter-spacing: 0.25px;
    }
    .player-heading-award {
        flex: 1 1 calc(50% - 3px);
    }
    .player-heading-activity {
        flex: 0 0 100%;
        min-width: 0;
        overflow: hidden;
    }
    .player-heading-activity-bars {
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        justify-content: flex-start;
    }
    .player-heading-activity-bars .activity-bar {
        flex: 0 0 5px;
        min-width: 5px;
    }
    .player-detail-body {
        display: block;
        padding: 0 12px 14px !important;
        overflow: visible;
    }
    .player-detail-body > .player-profile-top {
        display: block;
        min-height: 0;
        padding-left: 0;
    }
    .player-profile-main-col {
        display: block;
    }
    .player-race-achievements {
        gap: 8px !important;
    }
    .player-race-achievements img {
        height: 58px !important;
    }
    .duel-elo-grid {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 8px !important;
    }
    .stat-hero-card,
    .style-stat-row {
        min-width: 0;
    }
    .player-races-section,
    .player-duels-section {
        display: block;
        min-height: 0;
        margin-top: 14px;
    }
    .player-races-section > div:first-child,
    .player-duels-section > div:first-child {
        padding-left: 0;
    }
    .player-races-section .table-scroll,
    .player-duels-section .table-scroll {
        max-height: 58vh;
        margin: 0 -12px;
        border-top: 1px solid rgba(255,255,255,0.06);
    }
}

.navbar-account-wrap {
    float: right;
    display: flex;
    align-items: center;
    height: 60px;
    padding: 0 14px;
}
.navbar-account-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.account-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    padding: 72px 18px 18px;
    background: rgba(0, 0, 0, 0.42);
}
.account-modal {
    width: min(420px, calc(100vw - 36px));
    max-height: calc(100vh - 90px);
    overflow: auto;
    background: #20252b;
    border: 1px solid #343b44;
    border-radius: 6px;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.38);
    padding: 18px;
    color: #d7dde5;
}
.account-modal-head,
.account-actions,
.account-link-row {
    display: flex;
    align-items: center;
}
.account-modal-head {
    justify-content: space-between;
    margin-bottom: 14px;
}
.account-modal-head h3 {
    margin: 0;
    font-size: 18px;
    color: #fff;
}
.account-icon-btn {
    border: 0;
    background: transparent;
    color: #aeb7c2;
    padding: 4px 6px;
}
.account-icon-btn:hover {
    color: #fff;
}
.account-label {
    display: block;
    margin: 10px 0 6px;
    color: #aeb7c2;
    font-size: 12px;
    text-transform: uppercase;
}
.account-primary {
    margin-top: 12px;
    width: 100%;
}
.account-alert {
    margin-bottom: 12px;
    padding: 8px 10px;
}
.account-server-list {
    display: grid;
    gap: 8px;
}
.account-server-option {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid #3a424d;
    border-radius: 4px;
    background: #171b20;
    color: #d7dde5;
    padding: 9px 10px;
    text-align: left;
}
.account-server-option.active {
    border-color: #00cc44;
    box-shadow: inset 0 0 0 1px rgba(0, 204, 68, 0.35);
}
.account-server-option small,
.account-selected-server,
.account-link-row span,
.account-muted {
    color: #8d98a5;
}
.account-selected-server {
    padding: 8px 0 2px;
}
.account-actions {
    justify-content: space-between;
    gap: 8px;
    margin-top: 14px;
}
.account-actions-end {
    justify-content: flex-end;
}
.account-section {
    border-top: 1px solid #343b44;
    margin-top: 14px;
    padding-top: 14px;
}
.account-section-title {
    margin-bottom: 8px;
    color: #fff;
    font-weight: 700;
}
.account-link-row {
    justify-content: space-between;
    gap: 10px;
    padding: 8px 0;
}
.account-link-row div {
    display: grid;
    gap: 2px;
}
.account-link-target {
    display: grid;
    gap: 2px;
    min-width: 0;
    color: #00cc44;
    text-decoration: none;
}
.account-link-target:hover,
.account-link-target:focus {
    color: #33ff77;
    text-decoration: underline;
}
.account-field {
    margin-bottom: 8px;
}

.player-equipped-edit-trigger {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #00cc44;
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid rgba(0, 204, 68, 0.28);
    border-radius: 4px;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.player-equipped-edit-trigger:hover,
.player-equipped-edit-trigger:focus {
    color: #fff;
    background: rgba(0, 204, 68, 0.14);
    border-color: rgba(0, 204, 68, 0.55);
    outline: none;
}
.player-equipped-overlay {
    position: fixed;
    inset: 0;
    z-index: 3000;
    background: rgba(0, 0, 0, 0.16);
    pointer-events: auto;
}
.player-equipped-drawer {
    position: fixed;
    top: 72px;
    right: 14px;
    bottom: 14px;
    width: min(380px, calc(100vw - 28px));
    overflow-y: auto;
    padding: 14px;
    background: rgba(20, 24, 30, 0.96);
    border: 1px solid rgba(0, 204, 68, 0.24);
    border-radius: 6px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}
.player-equipped-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: #fff;
    font-weight: 700;
}
.player-equipped-close {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #98a4b1;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
}
.player-equipped-close:hover,
.player-equipped-close:focus {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.14);
    outline: none;
}
.player-equipped-form {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}
.player-equipped-form label {
    margin: 0;
    color: #aeb7c2;
    font-size: 12px;
    font-weight: 400;
}
.player-equipped-color {
    width: 48px;
    height: 30px;
    padding: 0;
    border: 1px solid #3a424d;
    background: transparent;
}
.player-equipped-save {
    grid-column: 2;
    justify-self: start;
}
.player-equipped-error {
    margin: 10px 0 0;
    padding: 7px 9px;
}

@media (max-width: 767px) {
    .navbar.navbar-fixed-top .container-fluid {
        display: flex;
        align-items: center;
        gap: 4px;
        min-height: 60px;
        padding-left: 0;
        padding-right: 6px;
        overflow: hidden;
    }
    .navbar.navbar-fixed-top .navbar-header {
        display: flex;
        align-items: center;
        flex: 0 1 auto;
        min-width: 0;
        margin-left: 0;
        margin-right: 0;
    }
    #mobile-menu,
    .left-nav-toggle {
        display: flex;
        align-items: center;
        flex: 0 0 auto;
        margin: 0;
        padding: 0;
    }
    .nav-toggle-button {
        width: 32px;
        height: 34px;
        margin: 0;
        padding: 0;
    }
    .navbar.navbar-fixed-top .navbar-brand {
        height: 60px;
        max-width: 118px;
        padding: 0 6px;
        overflow: hidden;
        font-size: 16px;
        line-height: 60px;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .navbar.navbar-fixed-top .navbar-page-title {
        display: none !important;
    }
    #navbar-actions {
        flex: 0 1 auto;
        min-width: 0;
        height: 60px !important;
        padding: 0 3px !important;
    }
    #navbar-actions .update-button {
        width: 32px;
        height: 30px;
        padding: 0;
        overflow: hidden;
        font-size: 0;
        line-height: 30px;
        text-align: center;
    }
    #navbar-actions .update-button::before {
        content: "\f021";
        font: normal normal normal 12px/1 FontAwesome;
    }
    #navbar-actions .update-button.is-updating::before {
        content: none;
    }
    #navbar-actions .update-button .fa {
        font-size: 12px;
    }
    #navbar-actions .update-button .fa + span,
    #navbar-actions .update-button span {
        display: none;
    }
    .navbar-server-wrap {
        flex: 0 1 auto;
        float: none;
        gap: 4px;
        height: 60px;
        min-width: 0;
        padding: 0 3px;
    }
    .navbar-server-icon {
        display: none;
    }
    .navbar-server-select {
        width: 88px;
        height: 32px;
        padding: 4px 24px 4px 8px;
        border-radius: 16px;
        font-size: 12px;
    }
    .navbar-account-wrap {
        position: static;
        flex: 0 1 auto;
        float: none;
        height: 60px;
        min-width: 0;
        margin-left: auto;
        padding: 0;
    }
    .navbar-account-btn {
        max-width: 92px;
        height: 30px;
        min-width: 0;
        padding: 4px 7px;
        gap: 4px;
        font-size: 12px;
    }
    .navbar-account-btn span {
        display: block;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .races-page .page-header-row,
    .races-page .page-header-row [class*="col-"] {
        height: auto;
    }
    .races-table-viz-row.races-viz-expanded {
        display: block !important;
        height: auto;
        min-height: 0;
        overflow: visible;
    }
    .races-table-viz-row.races-viz-expanded > .races-records-col,
    .races-table-viz-row.races-viz-expanded > .races-viz-col {
        width: 100% !important;
        max-width: 100% !important;
        min-height: 0;
        float: none;
        flex: none !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
    .races-table-viz-row.races-viz-expanded > .races-records-col {
        margin-bottom: 14px;
    }
    .races-table-viz-row.races-viz-expanded .races-records-col .panel.panel-filled {
        height: auto;
        overflow: visible;
    }
    .races-table-viz-row.races-viz-expanded .races-records-col .panel-body {
        display: block;
        overflow: visible;
    }
    .races-table-viz-row.races-viz-expanded .races-records-col .table-scroll {
        max-height: 46vh;
        overflow: auto;
        -webkit-overflow-scrolling: touch;
    }
    .races-viz-panel {
        display: flex !important;
        flex-direction: column !important;
        position: relative !important;
        top: auto !important;
        height: min(72vh, 520px) !important;
        min-height: 360px;
        max-height: none !important;
        overflow: hidden !important;
    }
    .races-viz-panel > .panel-heading {
        flex: 0 0 auto;
    }
}

@media (max-width: 420px) {
    .navbar.navbar-fixed-top .navbar-brand {
        max-width: 100px;
    }
    .navbar-server-select {
        width: 74px;
        font-size: 11px;
    }
    .navbar-account-btn {
        max-width: 76px;
    }
}

/* Style color badge */
.style-badge {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 3px;
    border: 1px solid;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

/* Panel section label */
.panel-section-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #00cc44;
    margin-bottom: 10px;
}

/* Overall stat hero cards */
.stat-hero-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 8px;
    margin-bottom: 4px;
}
.stat-hero-card {
    background: rgba(30,30,30,0.8);
    border: 1px solid rgba(0,204,68,0.18);
    border-radius: 6px;
    padding: 12px 8px 10px;
    text-align: center;
}
.stat-hero-val {
    font-size: 20px;
    font-weight: 700;
    color: #ddd;
    line-height: 1.1;
}
.stat-hero-label {
    font-size: 10px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin: 3px 0;
}
.stat-hero-top {
    font-size: 11px;
    color: #00cc44;
    font-weight: 600;
}

/* Style breakdown rows */
.style-stat-row {
    background: rgba(30,30,30,0.6);
    border: 1px solid rgba(0,204,68,0.12);
    border-radius: 6px;
    padding: 10px 14px;
    margin-bottom: 6px;
}
.player-race-styles .style-stat-row {
    flex: 0 0 174px;
    min-height: 184px;
    margin-bottom: 0;
    padding: 10px;
}
.player-race-styles .style-stat-row > div:first-child {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center !important;
    gap: 6px !important;
    margin-bottom: 10px !important;
}
.player-race-styles .style-badge {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.player-race-styles .style-pct-bar-wrap {
    grid-column: 1 / -1;
    width: 100%;
}
.player-race-styles .style-stat-metrics {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    margin-top: 0;
}
.player-race-styles .style-stat-metric {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}
.player-race-styles .style-stat-metric .style-top-pct {
    margin-left: auto;
}
.style-stat-name {
    font-size: 12px;
    font-weight: 700;
    color: #c0c8d4;
    min-width: 60px;
}
.style-pct-bar-wrap {
    flex: 1;
    height: 5px;
    background: #2a2a2a;
    border-radius: 3px;
    overflow: hidden;
}
.style-pct-bar-fill {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, #00aa33, #00cc44);
    transition: width 0.4s ease;
}
.style-stat-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    margin-top: 8px;
    font-size: 12px;
    color: #777;
}
.style-stat-metric strong {
    color: #ccc;
}
.style-top-pct {
    font-size: 10px;
    color: #00cc44;
    font-weight: 600;
}

/* Elo history chart */
.elo-chart-wrap {
    position: relative;
    width: 100%;
    height: 120px;
}
.elo-chart-wrap canvas {
    width: 100% !important;
    height: 120px !important;
}
.elo-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    margin-top: 6px;
    font-size: 11px;
    color: #888;
}
.elo-legend-dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    margin-right: 4px;
}

/* Podium rank colors */
.rank-gold   { color: #ffd700; text-shadow: 0 0 6px #ffd700, 0 0 16px #cc8800; font-weight: 700; }
.rank-silver { color: #d8d8d8; text-shadow: 0 0 6px #c0c0c0, 0 0 16px #909090; font-weight: 700; }
.rank-bronze { color: #f0a060; text-shadow: 0 0 6px #cd7f32, 0 0 16px #7a4010; font-weight: 700; }

/* Tighten panel headings with pull-right controls */
.panel-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px; }
.panel-heading .pull-right { float: none !important; }

/* Make tables look right with small screens */
.table-sm td, .table-sm th { padding: 4px 8px; font-size: 13px; }
.page-fluid-table .table > thead > tr > th,
.page-fluid-table .table > tbody > tr > td { padding-left: 26px; padding-right: 26px; }

/* Scrollable table containers with sticky header */
.table-responsive,
.table-scroll {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

.table-responsive > .table,
.table-scroll > .table {
    min-width: max-content;
}

.table-scroll { max-height: 500px; }
.table-scroll thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background-color: rgba(15,15,18,0.96);
}

/* Transparent panel + table — let background image show through */
.panel.panel-filled {
    background-color: rgba(15,15,18,0.85) !important;
}
.panel-filled .table-striped > tbody > tr:nth-of-type(odd) {
    background-color: rgba(38,38,38,0.22);
}
.panel-filled .table-hover > tbody > tr:hover {
    background-color: rgba(80,80,80,0.28);
}

/* SearchSelect combobox */
.ss-wrap { position: relative; display: inline-block; vertical-align: middle; }
.ss-display {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    min-width: 100px;
}
.ss-display span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-display .ss-caret { margin-left: 4px; opacity: 0.5; font-size: 10px; flex-shrink: 0; }
.ss-dropdown {
    position: absolute;
    z-index: 9999;
    top: 100%;
    left: 0;
    min-width: 100%;
    background: #1e2028;
    border: 1px solid #3a3d4a;
    border-radius: 4px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.5);
    margin-top: 2px;
}
.ss-search {
    border: none !important;
    border-bottom: 1px solid #3a3d4a !important;
    border-radius: 4px 4px 0 0 !important;
    background: #252830 !important;
    color: #ddd !important;
    width: 100%;
    box-sizing: border-box;
}
.ss-options { list-style: none; margin: 0; padding: 3px 0; max-height: 200px; overflow-y: auto; }
.ss-option {
    padding: 5px 12px;
    cursor: pointer;
    white-space: nowrap;
    font-size: 13px;
    color: #ccc;
}
.ss-option:hover, .ss-option.focused { background: #2d3040; }
.ss-option.selected { color: #00cc44; }
.ss-empty { padding: 6px 12px; color: #555; font-size: 12px; }

/* Map cards */
.map-card {
    width: 220px;
    height: 150px;
    border-radius: 6px;
    background-size: cover;
    background-position: center;
    background-color: #111;
    position: relative;
    overflow: hidden;
    flex: 0 0 auto;
}
.map-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.1) 55%, transparent 100%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: flex-start;
    padding: 10px;
    gap: 6px;
}
.map-card-name {
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    text-shadow: 0 1px 4px rgba(0,0,0,0.8);
    line-height: 1;
}
.map-card-btn { pointer-events: auto; }

/* Download page layout — left-anchored panels, cards flow into columns */
.download-about { max-width: 560px; }
.map-download-panel { width: fit-content; max-width: 100%; }
.map-grid {
    display: grid;
    grid-auto-flow: column;
    grid-template-rows: repeat(auto-fill, 150px);
    grid-auto-columns: 220px;
    gap: 12px;
    justify-content: start;
    /* Fill the visible height, then add columns instead of growing the page.
       Tweak the 320px offset if the About box height changes. */
    max-height: calc(100vh - 320px);
    overflow-x: auto;
}

/* Server cards */
.server-card {
    background: #1e2028;
    border: 1px solid #2d3040;
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 12px;
}
.server-card.offline { opacity: 0.5; }
.server-hostname { font-size: 16px; font-weight: 700; color: #ddd; margin-bottom: 4px; }
.server-meta { font-size: 12px; color: #666; margin-bottom: 10px; }
.server-players-header { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: #00cc44; margin-bottom: 6px; }
.server-player-row { display: flex; gap: 16px; font-size: 13px; padding: 3px 0; border-bottom: 1px solid #2a2c38; }
.server-player-row:last-child { border-bottom: none; }
.server-player-name { flex: 1; color: #ccc; }
.server-player-score { color: #888; width: 50px; text-align: right; }
.server-player-ping { color: #555; width: 50px; text-align: right; }
.server-row-stats {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
}
.server-row-stats span {
    border: 1px solid rgba(0,204,68,0.16);
    border-radius: 3px;
    background: rgba(20,24,20,0.58);
    color: #777;
    font-size: 12px;
    line-height: 1.2;
    padding: 3px 7px;
    white-space: nowrap;
}
.server-row-stats b {
    color: #ddd;
    font-weight: 700;
}

.server-table-wrap {
    flex: 1;
    min-height: 0;
    align-self: flex-start;
    width: fit-content;
    max-width: 100%;
}

.server-table-panel {
    height: 100%;
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
    width: fit-content;
    max-width: 100%;
    overflow: hidden;
}

.server-table-scroll {
    flex: 1;
    min-height: 0;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

.server-table-scroll table {
    width: max-content;
}

/* Team leaderboard mini cards */
.team-lb-grid { display: flex; flex-wrap: nowrap; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.team-lb-card {
    background: #1e2028;
    border: 1px solid #2d3040;
    border-radius: 6px;
    padding: 10px 14px;
    min-width: 160px;
    flex: 0 0 160px;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.15s;
}
.team-lb-card:hover { border-color: #00cc44; transform: translateY(-1px); }
.team-lb-rank { font-size: 11px; color: #555; margin-bottom: 2px; }
.team-lb-name { font-size: 14px; font-weight: 700; color: #00cc44; margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.team-lb-stats { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 11px; color: #777; }
.team-lb-stat-val { color: #ccc; font-weight: 600; }
.team-detail-column {
    display: inline-flex;
    flex-direction: column;
    max-width: 100%;
}
.team-detail-panel {
    width: fit-content;
    max-width: 100%;
}
.team-detail-panel .table {
    width: auto;
}
.team-overview-stats {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    margin-bottom: 0;
}
.team-overview-stats .stat-hero-card {
    min-width: 112px;
    padding: 8px 12px;
}
.team-overview-stats .stat-hero-val {
    font-size: 18px;
    line-height: 1.15;
}
.team-overview-stats .stat-hero-label {
    font-size: 10px;
}

/* Badges */
.badge-leaderboard-panel {
    flex: 0 0 300px;
    max-height: calc(100vh - 150px);
    margin-bottom: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.badge-leaderboard-body {
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
}

/* Full-height page table layout */
.page-fluid-wrap {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 84px);
    overflow: hidden;
}
.page-header-row {
    flex-shrink: 0;
}
.page-fluid-table {
    flex: 1;
    min-height: 0;
    margin-left: 0;
    margin-right: 0;
}
.page-fluid-table [class*="col-"] {
    height: 100%;
    min-width: 0;
}
.page-fluid-table .col-md-12 {
    width: fit-content;
    max-width: 100%;
    float: none;
    padding-left: 0;
    padding-right: 0;
}
.page-fluid-table .panel.panel-filled {
    height: 100%;
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}
.page-fluid-table .panel-body {
    flex: 1;
    min-height: 0;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
}
.page-fluid-table .panel-body > div:first-child {
    flex-shrink: 0;
}
.page-fluid-table .table-scroll {
    flex: 1;
    min-height: 0;
    max-height: none;
    overflow: auto;
}
.page-fluid-table .col-md-12 table {
    width: max-content;
}

.demo-archive-page {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 84px);
    min-height: 0;
    overflow: hidden;
}
.demo-archive-page > .alert {
    flex-shrink: 0;
}
.demo-archive-panel {
    display: grid;
    grid-template-columns: minmax(280px, 320px) minmax(0, 1fr);
    flex: 1 1 auto;
    min-height: 0;
    gap: 12px;
    margin-bottom: 0;
    overflow: hidden;
}

@media (max-width: 767px) {
    .page-fluid-wrap.races-page {
        display: block !important;
        height: auto !important;
        min-height: calc(100vh - 72px) !important;
        overflow: visible !important;
    }
    .races-page .page-fluid-table.races-table-viz-row {
        display: block !important;
        flex: none !important;
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
    }
    .demo-archive-page {
        height: auto;
        min-height: calc(100vh - 72px);
        overflow: visible;
    }
    .demo-archive-panel {
        display: flex;
        flex-direction: column;
        min-height: 640px;
        overflow: hidden;
    }
}

.rankings-table-row.rankings-stacked,
.teams-table-row.teams-stacked {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 14px;
    overflow: visible;
    height: auto;
    min-height: 0;
}

.rankings-page-stacked,
.teams-page-stacked {
    height: auto;
    min-height: calc(100vh - 84px);
    overflow: visible;
}

.rankings-table-row > [class*="col-"]:first-child,
.teams-table-row > [class*="col-"]:first-child {
    padding-left: 0;
    padding-right: 6px;
}

.rankings-table-row > [class*="col-"]:last-child,
.teams-table-row > [class*="col-"]:last-child {
    padding-left: 6px;
    padding-right: 0;
}

.rankings-table-row.rankings-stacked > [class*="col-"],
.teams-table-row.teams-stacked > [class*="col-"] {
    width: 100%;
    max-width: 100%;
    height: auto;
    min-height: 360px;
    float: none;
    padding-left: 0;
    padding-right: 0;
}

.rankings-table-row.rankings-stacked .panel.panel-filled,
.teams-table-row.teams-stacked .panel.panel-filled {
    height: 100%;
}

.badge-detail-column {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
    width: fit-content;
}

/* Global activity feed */
.activity-atmosphere {
    position: relative;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 84px);
}
.activity-active-servers {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}
.activity-active-servers-title {
    color: #00cc44;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.1px;
    text-transform: uppercase;
}
.activity-server-cards {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    overflow-y: visible;
    padding-bottom: 2px;
}
.activity-server-card {
    flex: 0 0 220px;
    height: 112px;
    border: 1px solid rgba(0,204,68,0.16);
    background:
        radial-gradient(circle at top left, rgba(0,204,68,0.13), transparent 58%),
        rgba(18,22,18,0.74);
    padding: 9px 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}
.activity-server-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.activity-server-row-dot {
    color: #00cc44;
    font-size: 8px;
}
.activity-server-row-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 700;
    font-size: 13px;
}
.activity-server-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.activity-server-card-meta span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #aaa;
    font-size: 12px;
}
.activity-server-card-meta span:last-child {
    color: #777;
    flex-shrink: 0;
}
.activity-server-card-sub {
    color: #555;
    font-size: 11px;
    margin-top: auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.activity-server-row-count {
    color: #00cc44;
    font-size: 13px;
    font-weight: 700;
}
.activity-server-card-top-right {
    display: flex;
    align-items: center;
    gap: 8px;
}
.activity-spectate-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    border: 1px solid rgba(0,204,68,0.32);
    border-radius: 4px;
    background: rgba(0,204,68,0.10);
    color: #00cc44;
    font-size: 11px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
}
.activity-spectate-btn:hover {
    background: rgba(0,204,68,0.22);
    border-color: rgba(0,204,68,0.55);
}
.activity-spectate-btn i {
    font-size: 12px;
}
.activity-spectate-count {
    font-weight: 700;
}
.activity-server-hover {
    position: fixed;
    z-index: 9999;
    width: 520px;
    max-width: calc(100vw - 24px);
    border: 1px solid rgba(0,204,68,0.24);
    background: #111418;
    box-shadow: 0 8px 24px rgba(0,0,0,0.45);
    padding: 10px;
}
.activity-server-hover-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}
.activity-server-hover-stats div {
    min-width: 0;
}
.activity-server-hover-stats span {
    display: block;
    color: #666;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}
.activity-server-hover-stats strong {
    display: block;
    color: #ddd;
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.activity-server-hover-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.activity-server-hover-columns {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: 10px;
}
.activity-server-hover-column {
    min-width: 0;
}
.activity-server-hover-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 5px;
    color: #00cc44;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}
.activity-server-hover-header span {
    color: #777;
    font-weight: 600;
}
.activity-server-hover-player {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 42px 52px;
    align-items: center;
    gap: 8px;
    padding: 4px 6px;
    background: #1a1d26;
    border: 1px solid #252936;
    font-size: 12px;
}
.activity-server-hover-viewer,
.activity-server-hover-empty {
    display: flex;
    align-items: center;
    min-height: 27px;
    padding: 4px 6px;
    background: #1a1d26;
    border: 1px solid #252936;
    font-size: 12px;
}
.activity-server-hover-empty {
    color: #666;
    font-style: italic;
}
.activity-server-hover-name {
    color: #ccc;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.activity-server-hover-score {
    color: #f0a500;
    text-align: right;
}
.activity-server-hover-ping {
    color: #666;
    text-align: right;
}
.activity-potd-card {
    border: 1px solid rgba(204,170,0,0.35);
    background: rgba(30,25,8,0.74);
    color: inherit;
    text-align: left;
    justify-content: flex-start;
}
.activity-potd-card:hover {
    background: rgba(40,33,10,0.82);
}
.activity-potd-card:focus {
    outline: none;
}
.activity-potd-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 4px;
    color: #ccaa00;
    background: rgba(204,170,0,0.12);
}
.activity-potd-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.25;
    margin-top: 4px;
    margin-bottom: 2px;
}
.activity-potd-label {
    color: #ccaa00;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    flex: 1;
    min-width: 0;
}
.activity-potd-server {
    border: 1px solid rgba(0,204,68,0.24);
    border-radius: 3px;
    color: #00cc44;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    white-space: nowrap;
}
.activity-potd-card-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}
.activity-potd-card-stats span {
    border: 1px solid rgba(204,170,0,0.22);
    border-radius: 3px;
    color: #ccc;
    background: rgba(20,20,20,0.35);
    font-size: 11px;
    padding: 2px 6px;
}
.activity-discord-card {
    flex: 0 0 auto;
    min-width: 132px;
    border-color: rgba(88,101,242,0.4);
    background: rgba(10,12,30,0.74);
    color: inherit;
    text-decoration: none;
}
.activity-discord-card:hover,
.activity-discord-card:focus {
    background: rgba(15,18,45,0.82);
    color: inherit;
    text-decoration: none;
    outline: none;
}
.activity-discord-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 4px;
    color: #fff;
    background: #5865F2;
}
.activity-discord-label {
    color: #9ea6ff;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    flex: 1;
    min-width: 0;
}
.activity-discord-name {
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.25;
    margin-top: 4px;
}
.activity-discord-card .activity-server-card-meta span {
    flex-shrink: 0;
}
.activity-page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}
.activity-page-title {
    color: #00cc44;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.1px;
    text-transform: uppercase;
}
.activity-page-subtitle {
    color: #aaa;
    font-size: 11px;
    margin-top: 2px;
}
.activity-panel {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    overflow: auto;
    margin-bottom: 0;
    background-color: rgba(14,14,16,0.85) !important;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    -webkit-overflow-scrolling: touch;
}
.activity-feed {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: 0;
}
.activity-row {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 46px;
    min-width: 760px;
    padding: 7px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    color: inherit;
}
.activity-row:hover {
    background: rgba(0,204,68,0.06);
}
.activity-row-race {
    background: transparent;
}
.activity-row-duel {
    background: rgba(204,0,204,0.035);
    box-shadow: inset 1px 0 0 rgba(204,0,204,0.14);
}
.activity-row-duel:hover {
    background: rgba(204,0,204,0.06);
}
.activity-row-badge {
    background: rgba(204,170,0,0.06);
    box-shadow: inset 3px 0 0 rgba(204,170,0,0.45);
}
.activity-row-badge:hover {
    background: rgba(204,170,0,0.1);
}
.activity-row-duel .activity-icon {
    color: #cc00cc;
    background: rgba(204,0,204,0.075);
}
.activity-row-badge .activity-icon {
    color: #ccaa00;
    background: rgba(204,170,0,0.12);
}
.activity-row-primary {
    display: grid;
    grid-template-columns: 28px minmax(70px, 140px) 76px minmax(70px, 120px) 52px minmax(250px, 1fr) 60px 70px 70px;
    align-items: center;
    min-width: 0;
    gap: 8px;
    border: 0;
    background: transparent;
    color: inherit;
    padding: 0;
    text-align: left;
    cursor: pointer;
}
.activity-row-primary:focus,
.activity-action-btn:focus {
    outline: none;
    box-shadow: none;
}
.activity-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    color: #00cc44;
    background: rgba(0,204,68,0.08);
}
.activity-actor,
.activity-subject,
.activity-mode,
.activity-metric,
.activity-condition,
.activity-result {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.activity-actor {
    color: #e5e5e5;
    font-size: 13px;
    font-weight: 600;
}
.activity-actor:hover,
.activity-actor:focus {
    color: #00cc44;
    text-decoration: none;
}
.activity-subject {
    color: #f2f2f2;
    font-size: 13px;
    font-weight: 600;
}
.activity-mode,
.activity-condition {
    color: #777;
    font-size: 11px;
}
.activity-metric {
    color: #ddd;
    font-size: 12px;
    font-weight: 700;
}
.activity-result {
    color: #aaa;
    font-size: 12px;
    font-weight: 700;
}
.activity-result.is-best {
    color: #ffd700;
    text-shadow: 0 0 8px rgba(255,215,0,0.45);
}
.activity-result.is-duel {
    color: #cc00cc;
}
.activity-result.is-badge {
    color: #00cc44;
}
.activity-server {
    border: 1px solid rgba(0,204,68,0.28);
    border-radius: 3px;
    color: #00cc44;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    white-space: nowrap;
    justify-self: start;
}
.activity-time {
    color: #777;
    font-size: 12px;
    white-space: nowrap;
}
.activity-actions {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    width: 53px;
    flex: 0 0 53px;
    justify-content: flex-start;
}
.activity-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: 1px solid #333;
    border-radius: 3px;
    background: rgba(20,20,20,0.6);
    color: #00aacc;
    padding: 0;
}
.activity-action-placeholder {
    display: inline-flex;
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
}
.activity-action-btn:hover {
    border-color: #00aacc;
    color: #7ee8ff;
}
.activity-action-btn svg {
    display: block;
    stroke: currentColor;
    fill: none;
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Visualizer demo toggle */
.viz-toggle-head,
.viz-toggle-cell {
    width: 42px;
    text-align: center;
    padding-left: 8px !important;
    padding-right: 8px !important;
}
.viz-toggle-head {
    color: #888;
}
.viz-play-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    margin: 0;
    cursor: pointer;
    vertical-align: middle;
    user-select: none;
    -webkit-user-select: none;
}
.viz-cb {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}
.viz-play-icon {
    display: block;
    width: 18px;
    height: 18px;
    color: #00cc44;
    transition: color 0.12s, filter 0.12s, transform 0.12s;
}
.viz-play-icon::before {
    content: '';
    position: absolute;
}
.viz-play-icon {
    position: relative;
}
.viz-play-icon::before {
    left: 3px;
    top: 1px;
    width: 0;
    height: 0;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-left: 13px solid currentColor;
    filter: drop-shadow(1px 0 0 #111) drop-shadow(-1px 0 0 #111) drop-shadow(0 1px 0 #111) drop-shadow(0 -1px 0 #111);
}
.viz-play-toggle:hover .viz-play-icon,
.viz-cb:focus + .viz-play-icon {
    color: #33ff77;
    transform: scale(1.08);
}
.viz-cb:checked + .viz-play-icon {
    color: #00cc44;
    filter: drop-shadow(0 0 4px rgba(0,204,68,0.65));
}
.viz-cb:not(:checked) + .viz-play-icon::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 4px;
    width: 0;
    height: 0;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-left: 8px solid #111;
}

/* Race table media actions */
.race-media-head,
.race-media-cell {
    width: 76px;
    min-width: 76px;
    text-align: center;
    padding-left: 4px !important;
    padding-right: 4px !important;
}
.race-media-head {
    color: #888;
}
.race-media-cell {
    white-space: nowrap;
}
.race-media-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 3px;
}
.race-media-link,
.race-media-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
}
.race-media-video {
    color: #00cc44;
}
.race-media-replay {
    color: #00cc44;
}
.race-media-trail {
    color: #00aaff;
}
.race-media-link:hover,
.race-media-link:focus {
    color: #7ee8ff;
    text-decoration: none;
}
.race-media-link svg {
    display: block;
    stroke: currentColor;
    fill: none;
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.race-rank-head,
.race-rank-cell {
    width: 54px;
    min-width: 54px;
    text-align: center;
    padding-left: 8px !important;
    padding-right: 8px !important;
}
.race-rank-cell .btn {
    min-width: 34px;
    padding-left: 6px;
    padding-right: 6px;
}

@media (max-width: 767px) {
    .badge-leaderboard-panel {
        flex: 1 1 auto;
        max-height: 320px;
        margin-bottom: 14px;
    }
    .activity-server-card {
        flex-basis: 200px;
        height: 108px;
    }
    .activity-actions {
        width: 53px;
        flex-basis: 53px;
        justify-content: flex-start;
    }
    .activity-atmosphere {
        height: auto;
        min-height: calc(100vh - 72px);
        overflow: visible;
    }
    .activity-main-row {
        display: flex !important;
        flex: none !important;
        flex-direction: column;
        width: 100% !important;
        max-width: 100% !important;
        min-height: 0;
    }
    .activity-panel {
        flex: 0 0 auto;
        width: 100%;
        min-height: 260px;
        max-height: 56vh;
    }
    .activity-side-column {
        width: 100% !important;
        flex: 0 0 auto !important;
        display: flex !important;
        flex-direction: column;
        min-height: 0;
    }
    .activity-potd-card {
        flex: 0 0 auto !important;
    }
    .activity-side-panel {
        flex: 0 0 auto !important;
        width: 100%;
        min-height: 220px;
        max-height: 46vh;
    }
    .activity-side-table-scroll {
        flex: 1 1 auto;
        min-height: 0;
        overflow: auto !important;
        -webkit-overflow-scrolling: touch;
    }
}
