/* ==========================================
   Bot Arena Dashboard — 8bit × Modern
   ========================================== */

/* --- CSS Variables --- */
:root {
    --bg-primary: #0a0a1a;
    --bg-secondary: #12122b;
    --bg-card: #1a1a3e;
    --bg-card-hover: #222260;
    --border-pixel: #2a2a5e;
    --border-glow: #4a4aff;

    --neon-cyan: #00ffff;
    --neon-green: #39ff14;
    --neon-magenta: #ff00ff;
    --neon-yellow: #ffe100;
    --neon-orange: #ff8c00;
    --neon-red: #ff3366;
    --neon-blue: #4d7aff;

    --text-primary: #e0e0ff;
    --text-secondary: #8888bb;
    --text-dim: #555588;

    --positive: #39ff14;
    --negative: #ff3366;
    --neutral: #8888bb;

    --font-pixel: 'Press Start 2P', monospace;
    --font-mono: 'JetBrains Mono', monospace;

    --pixel-size: 2px;
    --transition-speed: 0.3s;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-mono);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* --- CRT Scanline Overlay --- */
.crt-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    background: repeating-linear-gradient(0deg,
            transparent,
            transparent 2px,
            rgba(0, 0, 0, 0.08) 2px,
            rgba(0, 0, 0, 0.08) 4px);
}

/* --- Animated 8-bit Geometric Background --- */
.pixel-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.pixel-grid::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 200%;
    height: 200%;
    background-image:
        /* Grid lines */
        linear-gradient(rgba(74, 74, 255, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(74, 74, 255, 0.04) 1px, transparent 1px),
        /* Diagonal crosses */
        linear-gradient(45deg, transparent 48%, rgba(0, 255, 255, 0.02) 49%, rgba(0, 255, 255, 0.02) 51%, transparent 52%),
        linear-gradient(-45deg, transparent 48%, rgba(255, 0, 255, 0.015) 49%, rgba(255, 0, 255, 0.015) 51%, transparent 52%),
        /* Diamond pattern */
        linear-gradient(45deg, transparent 45%, rgba(57, 255, 20, 0.012) 45%, rgba(57, 255, 20, 0.012) 55%, transparent 55%),
        linear-gradient(-45deg, transparent 45%, rgba(57, 255, 20, 0.012) 45%, rgba(57, 255, 20, 0.012) 55%, transparent 55%);
    background-size:
        20px 20px,
        20px 20px,
        60px 60px,
        60px 60px,
        40px 40px,
        40px 40px;
    animation: gridDrift 40s linear infinite;
}

.pixel-grid::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background-image:
        /* Large hexagon-like shapes */
        radial-gradient(circle 2px at 30px 30px, rgba(0, 255, 255, 0.04) 2px, transparent 2px),
        radial-gradient(circle 1px at 60px 10px, rgba(255, 0, 255, 0.03) 1px, transparent 1px),
        radial-gradient(circle 1.5px at 10px 50px, rgba(57, 255, 20, 0.03) 1.5px, transparent 1.5px);
    background-size: 80px 60px;
    animation: gridDrift2 60s linear infinite;
}

@keyframes gridDrift {
    0% {
        transform: translate(0, 0);
    }

    100% {
        transform: translate(-20px, -20px);
    }
}

@keyframes gridDrift2 {
    0% {
        transform: translate(0, 0) rotate(0deg);
    }

    100% {
        transform: translate(-40px, -30px) rotate(3deg);
    }
}

/* --- Glitch Text Effect --- */
.glitch-text {
    position: relative;
    font-family: var(--font-pixel);
    animation: glitchFlicker 4s infinite;
}

.glitch-text::before,
.glitch-text::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.8;
}

.glitch-text::before {
    color: var(--neon-cyan);
    animation: glitchBefore 3s infinite;
    clip-path: polygon(0 0, 100% 0, 100% 45%, 0 45%);
}

.glitch-text::after {
    color: var(--neon-magenta);
    animation: glitchAfter 2s infinite;
    clip-path: polygon(0 55%, 100% 55%, 100% 100%, 0 100%);
}

@keyframes glitchBefore {

    0%,
    92%,
    100% {
        transform: translate(0);
    }

    93% {
        transform: translate(-3px, 1px);
    }

    95% {
        transform: translate(2px, -1px);
    }

    97% {
        transform: translate(-1px, 2px);
    }
}

@keyframes glitchAfter {

    0%,
    90%,
    100% {
        transform: translate(0);
    }

    91% {
        transform: translate(3px, -1px);
    }

    94% {
        transform: translate(-2px, 1px);
    }

    96% {
        transform: translate(1px, -2px);
    }
}

@keyframes glitchFlicker {

    0%,
    98%,
    100% {
        opacity: 1;
    }

    99% {
        opacity: 0.9;
    }
}

/* --- Pixel Borders --- */
.pixel-border {
    border: var(--pixel-size) solid var(--border-pixel);
    box-shadow:
        inset 0 0 0 var(--pixel-size) var(--bg-card),
        0 0 10px rgba(74, 74, 255, 0.1);
}

.pixel-border-bottom {
    border-bottom: var(--pixel-size) solid var(--border-pixel);
    padding-bottom: 10px;
}

/* ==========================================
   Header
   ========================================== */
#main-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: linear-gradient(180deg, var(--bg-primary), var(--bg-secondary));
    padding: 16px 24px 0;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1600px;
    margin: 0 auto;
    flex-wrap: wrap;
    gap: 12px;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-pixel-art {
    width: 48px;
    height: 48px;
    background: var(--bg-card);
    border: var(--pixel-size) solid var(--neon-cyan);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: logoPulse 2s ease-in-out infinite;
    image-rendering: pixelated;
}

.pixel-icon {
    font-size: 24px;
    filter: drop-shadow(0 0 6px var(--neon-cyan));
}

@keyframes logoPulse {

    0%,
    100% {
        box-shadow: 0 0 8px var(--neon-cyan), inset 0 0 8px rgba(0, 255, 255, 0.1);
    }

    50% {
        box-shadow: 0 0 20px var(--neon-cyan), inset 0 0 15px rgba(0, 255, 255, 0.2);
    }
}

.title-block h1 {
    font-family: var(--font-pixel);
    font-size: 1.4rem;
    letter-spacing: 4px;
    color: var(--neon-cyan);
    text-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
}

.subtitle {
    font-family: var(--font-pixel);
    font-size: 0.5rem;
    color: var(--text-secondary);
    letter-spacing: 3px;
    margin-top: 4px;
}

.header-stats {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.stat-chip {
    background: var(--bg-card);
    border: 1px solid var(--border-pixel);
    padding: 6px 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 70px;
    transition: all var(--transition-speed);
}

.stat-chip:hover {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.2);
    transform: translateY(-1px);
}

.stat-label {
    font-family: var(--font-pixel);
    font-size: 0.45rem;
    color: var(--text-dim);
    letter-spacing: 1px;
}

.stat-value {
    font-family: var(--font-pixel);
    font-size: 0.75rem;
    color: var(--neon-green);
    text-shadow: 0 0 8px rgba(57, 255, 20, 0.4);
}

.status-chip {
    flex-direction: row;
    gap: 8px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--neon-green);
    animation: statusBlink 1.5s ease-in-out infinite;
}

@keyframes statusBlink {

    0%,
    100% {
        opacity: 1;
        box-shadow: 0 0 6px var(--neon-green);
    }

    50% {
        opacity: 0.3;
        box-shadow: none;
    }
}

/* Countdown chip */
.countdown-chip {
    flex-direction: row !important;
    gap: 10px !important;
    padding: 4px 10px !important;
    min-width: auto !important;
}

.countdown-item {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-secondary);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 3px;
}

.countdown-item span {
    font-family: var(--font-pixel);
    font-size: 0.5rem;
    color: var(--neon-yellow);
    text-shadow: 0 0 6px rgba(255, 225, 0, 0.3);
}

.header-bar {
    height: 2px;
    background: linear-gradient(90deg,
            transparent,
            var(--neon-cyan) 20%,
            var(--neon-magenta) 50%,
            var(--neon-cyan) 80%,
            transparent);
    margin-top: 12px;
    animation: barShimmer 3s ease-in-out infinite;
}

@keyframes barShimmer {

    0%,
    100% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }
}

/* ==========================================
   Division Tabs
   ========================================== */
#division-tabs {
    display: flex;
    justify-content: center;
    gap: 4px;
    padding: 16px 24px;
    max-width: 1600px;
    margin: 0 auto;
}

.tab-btn {
    font-family: var(--font-pixel);
    font-size: 0.6rem;
    padding: 10px 20px;
    background: var(--bg-card);
    color: var(--text-secondary);
    border: var(--pixel-size) solid var(--border-pixel);
    cursor: pointer;
    transition: all var(--transition-speed);
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
}

.tab-btn::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 0;
    background: linear-gradient(0deg, rgba(0, 255, 255, 0.1), transparent);
    transition: height var(--transition-speed);
}

.tab-btn:hover::before {
    height: 100%;
}

.tab-btn:hover {
    color: var(--text-primary);
    border-color: var(--neon-cyan);
    transform: translateY(-2px);
}

.tab-btn.active {
    color: var(--neon-cyan);
    border-color: var(--neon-cyan);
    background: var(--bg-card-hover);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.2), inset 0 0 20px rgba(0, 255, 255, 0.05);
}

.tab-icon {
    margin-right: 6px;
}

/* ==========================================
   Main Content & Sections
   ========================================== */
#main-content {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 24px 40px;
}

.section {
    margin-bottom: 32px;
    animation: sectionFadeIn 0.6s ease-out backwards;
}

.section:nth-child(2) {
    animation-delay: 0.15s;
}

.section:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes sectionFadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-title {
    font-family: var(--font-pixel);
    font-size: 0.7rem;
    color: var(--text-primary);
    letter-spacing: 2px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-icon {
    font-size: 1.1rem;
}

/* Summary Cards */
.summary-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.summary-card {
    background: var(--bg-card);
    border: var(--pixel-size) solid var(--border-pixel);
    padding: 16px 20px;
    position: relative;
    overflow: hidden;
    transition: all var(--transition-speed);
    animation: cardSlideIn 0.5s ease-out backwards;
}

.summary-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
}

.summary-card[data-division="upbit"]::before {
    background: var(--neon-blue);
}

.summary-card[data-division="tekkaba"]::before {
    background: var(--neon-orange);
}

.summary-card[data-division="cross"]::before {
    background: var(--neon-magenta);
}

.summary-card[data-division="all"]::before {
    background: var(--neon-cyan);
}

.summary-card:hover {
    transform: translateY(-3px);
    border-color: var(--neon-cyan);
    box-shadow: 0 4px 20px rgba(0, 255, 255, 0.15);
}

@keyframes cardSlideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.summary-card .card-title {
    font-family: var(--font-pixel);
    font-size: 0.55rem;
    color: var(--text-secondary);
    letter-spacing: 2px;
    margin-bottom: 12px;
}

.summary-card .card-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.card-stat {
    text-align: center;
}

.card-stat-label {
    font-family: var(--font-pixel);
    font-size: 0.4rem;
    color: var(--text-dim);
    display: block;
    margin-bottom: 4px;
}

.card-stat-value {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 700;
    color: var(--neon-green);
}

.card-stat-value.negative {
    color: var(--negative);
}

.card-stat-value.neutral {
    color: var(--neutral);
}

/* Leaderboard Controls */
.leaderboard-controls {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.pixel-select,
.pixel-input {
    font-family: var(--font-pixel);
    font-size: 0.5rem;
    padding: 8px 14px;
    background: var(--bg-card);
    color: var(--text-primary);
    border: var(--pixel-size) solid var(--border-pixel);
    outline: none;
    transition: all var(--transition-speed);
}

.pixel-select:focus,
.pixel-input:focus {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.2);
}

.pixel-input::placeholder {
    color: var(--text-dim);
}

.search-box {
    flex: 1;
    min-width: 200px;
}

.search-box .pixel-input {
    width: 100%;
}

/* Leaderboard Table */
.leaderboard-table-wrapper {
    overflow-x: auto;
    border: var(--pixel-size) solid var(--border-pixel);
    background: var(--bg-card);
}

#leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

#leaderboard-table thead {
    background: var(--bg-secondary);
    position: sticky;
    top: 0;
    z-index: 10;
}

#leaderboard-table th {
    font-family: var(--font-pixel);
    font-size: 0.6rem;
    color: var(--text-dim);
    letter-spacing: 1px;
    padding: 10px 8px;
    text-align: right;
    white-space: nowrap;
    border-bottom: var(--pixel-size) solid var(--border-pixel);
}

#leaderboard-table th.col-rank,
#leaderboard-table th.col-name,
#leaderboard-table th.col-division {
    text-align: left;
}

#leaderboard-table td {
    padding: 8px 10px;
    font-size: 0.8rem;
    text-align: right;
    border-bottom: 1px solid rgba(42, 42, 94, 0.5);
    white-space: nowrap;
    transition: all 0.25s ease;
}

#leaderboard-table tbody tr {
    transition: all 0.25s ease, background 0.15s;
}

#leaderboard-table tbody tr:hover td {
    text-shadow: 0 0 6px rgba(0, 255, 255, 0.3);
}

#leaderboard-table td.col-rank,
#leaderboard-table td.col-name,
#leaderboard-table td.col-division {
    text-align: left;
}

#leaderboard-table tbody tr {
    cursor: pointer;
    transition: all 0.2s;
    animation: rowFadeIn 0.3s ease-out backwards;
}

#leaderboard-table tbody tr:hover {
    background: var(--bg-card-hover);
    transform: scale(1.002);
    box-shadow: 0 0 15px rgba(74, 74, 255, 0.15);
}

@keyframes rowFadeIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.rank-medal {
    font-family: var(--font-pixel);
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
}

.rank-1 {
    color: var(--neon-yellow);
    text-shadow: 0 0 10px rgba(255, 225, 0, 0.6);
    animation: goldPulse 1.5s ease-in-out infinite;
}

.rank-2 {
    color: #c0c0c0;
    text-shadow: 0 0 8px rgba(192, 192, 192, 0.5);
}

.rank-3 {
    color: #cd7f32;
    text-shadow: 0 0 8px rgba(205, 127, 50, 0.5);
}

/* Favorites */
.col-fav {
    width: 28px;
    text-align: center;
    padding: 2px !important;
}

.fav-star {
    cursor: pointer;
    font-size: 1.1rem;
    color: #555;
    transition: color 0.15s, text-shadow 0.15s, transform 0.15s;
}

.fav-star:hover {
    color: #ffd700;
    transform: scale(1.3);
}

.fav-star.fav-active {
    color: #ffd700;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.6);
}

@keyframes goldPulse {

    0%,
    100% {
        text-shadow: 0 0 10px rgba(255, 225, 0, 0.6);
    }

    50% {
        text-shadow: 0 0 20px rgba(255, 225, 0, 0.9);
    }
}

.bot-name-cell {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Direction badge (dot before bot name) */
.dir-badge {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 4px;
    vertical-align: middle;
    flex-shrink: 0;
}

.dir-badge.dir-long {
    background: var(--neon-cyan);
    box-shadow: 0 0 6px var(--neon-cyan);
}

.dir-badge.dir-short {
    background: var(--neon-red);
    box-shadow: 0 0 6px var(--neon-red);
}

.dir-badge.dir-both {
    background: linear-gradient(135deg, #ff0000, #ff9900, #ffff00, #00ff00, #0099ff, #9900ff);
    background-size: 400% 400%;
    animation: rainbow-shift 2s ease infinite;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
}

@keyframes rainbow-shift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.division-badge {
    font-family: var(--font-pixel);
    font-size: 0.45rem;
    padding: 3px 8px;
    border: 1px solid;
    letter-spacing: 1px;
    display: inline-block;
}

.division-badge.upbit {
    color: var(--neon-blue);
    border-color: var(--neon-blue);
}

.division-badge.tekkaba {
    color: var(--neon-red);
    border-color: var(--neon-red);
    text-shadow: 0 0 6px rgba(255, 51, 102, 0.4);
}

.division-badge.cross {
    color: var(--neon-magenta);
    border-color: var(--neon-magenta);
}

.division-badge.aigene {
    color: #999;
    border-color: #777;
    text-shadow: 0 0 6px rgba(153, 153, 153, 0.3);
}

.division-badge.evolve {
    color: #ff9d00;
    border-color: #ff9d00;
    text-shadow: 0 0 6px #ff9d0066;
}

/* AI Reference Badge */
.ai-badge {
    display: inline-block;
    font-family: var(--font-pixel);
    font-size: 0.45rem;
    color: #00e5ff;
    background: rgba(0, 229, 255, 0.1);
    border: 1px solid #00e5ff44;
    padding: 1px 5px;
    margin-left: 6px;
    border-radius: 3px;
    vertical-align: middle;
    white-space: nowrap;
}

/* Evolve Reference Badge */
.evo-badge {
    display: inline-block;
    font-family: var(--font-pixel);
    font-size: 0.45rem;
    color: #00ff88;
    background: rgba(0, 255, 136, 0.1);
    border: 1px solid #00ff8844;
    padding: 1px 5px;
    margin-left: 4px;
    border-radius: 3px;
    vertical-align: middle;
    white-space: nowrap;
}

/* Sortable table headers */
.sortable-header {
    cursor: pointer;
    user-select: none;
    transition: color 0.15s, text-shadow 0.15s;
}

.sortable-header:hover {
    color: var(--neon-cyan);
    text-shadow: 0 0 8px var(--neon-cyan);
}

.sortable-header.active-sort {
    color: var(--neon-cyan);
    text-shadow: 0 0 6px var(--neon-cyan);
}

.pnl-positive {
    color: var(--positive);
    font-weight: 700;
}

.pnl-negative {
    color: var(--negative);
    font-weight: 700;
}

.pnl-zero {
    color: var(--neutral);
}

/* Group Header Rows */
.group-header {
    cursor: pointer;
    background: rgba(74, 74, 255, 0.06);
    border-left: 3px solid var(--neon-cyan);
}

.group-header:hover {
    background: rgba(74, 74, 255, 0.12);
}

.expand-icon {
    display: inline-block;
    font-size: 0.5rem;
    margin-right: 6px;
    color: var(--neon-cyan);
    transition: transform 0.2s;
}

.group-count {
    display: inline-block;
    font-family: var(--font-pixel);
    font-size: 0.4rem;
    color: var(--neon-cyan);
    background: rgba(0, 255, 255, 0.1);
    border: 1px solid rgba(0, 255, 255, 0.3);
    padding: 1px 6px;
    margin-left: 8px;
    border-radius: 3px;
    vertical-align: middle;
}

.rank-group {
    color: var(--neon-cyan) !important;
    border-color: var(--neon-cyan) !important;
}

.rank-group sup {
    font-size: 0.4rem;
    color: var(--neon-cyan);
}

/* Sub Rows (expanded group members) */
.group-sub-row {
    background: rgba(42, 42, 94, 0.3);
    cursor: pointer;
}

.group-sub-row:hover {
    background: rgba(42, 42, 94, 0.5);
}

.rank-sub {
    font-family: var(--font-pixel);
    font-size: 0.45rem;
    color: var(--text-dim);
}

.sub-indent {
    color: var(--text-dim);
    margin-right: 4px;
    font-size: 0.6rem;
}

/* Positions Grid */
.positions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 10px;
}

.position-card {
    background: var(--bg-card);
    border: var(--pixel-size) solid var(--border-pixel);
    padding: 12px 16px;
    position: relative;
    transition: all var(--transition-speed);
}

.position-card:hover {
    border-color: var(--neon-cyan);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 255, 255, 0.15);
}

.position-card .pos-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.position-card .pos-symbol {
    font-family: var(--font-pixel);
    font-size: 0.65rem;
    color: var(--neon-cyan);
}

.position-card .pos-direction {
    font-family: var(--font-pixel);
    font-size: 0.45rem;
    padding: 2px 8px;
}

.pos-direction.long {
    color: var(--positive);
    border: 1px solid var(--positive);
}

.pos-direction.short {
    color: var(--negative);
    border: 1px solid var(--negative);
}

.position-card .pos-details {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.position-card .pos-bot {
    font-family: var(--font-pixel);
    font-size: 0.4rem;
    color: var(--text-dim);
    margin-top: 6px;
}

.no-positions {
    text-align: center;
    padding: 30px;
    color: var(--text-dim);
    font-family: var(--font-pixel);
    font-size: 0.6rem;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal.hidden {
    display: none;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--bg-secondary);
    border: var(--pixel-size) solid var(--neon-cyan);
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 24px;
    animation: modalSlideIn 0.3s ease-out;
    box-shadow: 0 0 40px rgba(0, 255, 255, 0.2);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-pixel);
}

.modal-close:hover {
    color: var(--neon-red);
    transform: scale(1.2);
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: var(--pixel-size) solid var(--border-pixel);
}

.modal-title {
    font-family: var(--font-pixel);
    font-size: 0.8rem;
    color: var(--neon-cyan);
}

.modal-strategy {
    font-size: 0.8rem;
    color: var(--text-secondary);
    padding: 10px 14px;
    background: var(--bg-card);
    border-left: 3px solid var(--neon-magenta);
    margin-bottom: 16px;
}

.modal-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
    margin-bottom: 20px;
}

.modal-stat-card {
    background: var(--bg-card);
    padding: 10px;
    text-align: center;
    border: 1px solid var(--border-pixel);
}

.modal-stat-card .stat-label {
    font-family: var(--font-pixel);
    font-size: 0.4rem;
    color: var(--text-dim);
    display: block;
    margin-bottom: 4px;
}

.modal-stat-card .stat-val {
    font-size: 1.1rem;
    font-weight: 700;
}

.modal-subtitle {
    font-family: var(--font-pixel);
    font-size: 0.55rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
    letter-spacing: 1px;
}

.modal-chart-section {
    margin-bottom: 20px;
}

#equity-chart {
    background: var(--bg-card);
    border: 1px solid var(--border-pixel);
    padding: 8px;
}

/* Trade History in Modal */
.trades-list {
    max-height: 250px;
    overflow-y: auto;
}

.trade-item {
    display: grid;
    grid-template-columns: 80px 60px 1fr 80px;
    gap: 8px;
    padding: 6px 10px;
    font-size: 0.75rem;
    border-bottom: 1px solid rgba(42, 42, 94, 0.5);
    align-items: center;
    transition: background 0.2s;
}

.trade-item:hover {
    background: var(--bg-card-hover);
}

.trade-symbol {
    font-weight: 700;
    color: var(--neon-cyan);
}

.trade-direction {
    font-family: var(--font-pixel);
    font-size: 0.4rem;
}

.trade-details {
    color: var(--text-secondary);
    font-size: 0.7rem;
}

.trade-pnl {
    text-align: right;
    font-weight: 700;
}

.no-trades {
    text-align: center;
    padding: 20px;
    color: var(--text-dim);
    font-family: var(--font-pixel);
    font-size: 0.5rem;
}

/* Footer */
#main-footer {
    border-top: var(--pixel-size) solid var(--border-pixel);
    padding: 16px 24px;
    background: var(--bg-secondary);
}

.footer-content {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.footer-text,
.footer-update {
    font-family: var(--font-pixel);
    font-size: 0.45rem;
    color: var(--text-dim);
    letter-spacing: 1px;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-pixel);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--neon-cyan);
}

/* Equity Chart Section */
.equity-controls {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.equity-chart-wrapper {
    background: var(--bg-card);
    border: var(--pixel-size) solid var(--border-pixel);
    padding: 16px;
    position: relative;
    min-height: 300px;
}

.equity-chart-wrapper canvas {
    width: 100% !important;
    cursor: pointer;
}

/* Battle View Toggle */
.battle-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px;
}

.battle-header .section-title {
    margin-bottom: 0;
}

.view-toggle {
    display: flex;
    gap: 4px;
    border: var(--pixel-size) solid var(--border-pixel);
    padding: 2px;
    background: var(--bg-primary);
}

.toggle-btn {
    font-family: 'Press Start 2P', monospace;
    font-size: 9px;
    padding: 8px 14px;
    background: transparent;
    color: var(--text-dim);
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.toggle-btn:hover {
    color: var(--text-primary);
    background: rgba(42, 42, 94, 0.4);
}

.toggle-btn.active {
    background: var(--neon-cyan);
    color: var(--bg-primary);
    text-shadow: none;
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.4);
}

.battle-view {
    animation: fadeSlideIn 0.3s ease;
}

.battle-view.hidden {
    display: none;
}

/* Compact Positions Summary */
.positions-summary {
    width: 100%;
}

.pos-count-badge {
    display: inline-block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    background: var(--neon-magenta);
    color: #fff;
    padding: 2px 8px;
    margin-left: 8px;
    vertical-align: middle;
}

.pos-summary-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
}

.pos-summary-table th {
    padding: 6px 10px;
    text-align: left;
    font-size: 9px;
    color: var(--text-dim);
    border-bottom: var(--pixel-size) solid var(--border-pixel);
    font-family: 'Press Start 2P', monospace;
}

.pos-summary-table td {
    padding: 5px 10px;
    border-bottom: 1px solid rgba(42, 42, 94, 0.3);
    color: var(--text-secondary);
}

.pos-summary-table tr:hover td {
    background: rgba(42, 42, 94, 0.3);
}

.pos-sym {
    color: var(--neon-yellow);
    font-weight: 700;
}

.pos-long {
    color: var(--neon-green);
}

.pos-short {
    color: var(--neon-red);
}

.pos-bots-list {
    font-size: 9px;
    color: var(--text-dim);
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.no-positions {
    text-align: center;
    color: var(--text-dim);
    padding: 20px;
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
}

/* Leaderboard Pagination */
.leaderboard-pager {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    padding: 12px 0;
    margin-top: 8px;
}

.pager-btn {
    font-family: 'Press Start 2P', monospace;
    font-size: 9px;
    padding: 8px 16px;
    background: var(--bg-card);
    color: var(--neon-cyan);
    border: var(--pixel-size) solid var(--border-pixel);
    cursor: pointer;
    transition: all 0.2s;
}

.pager-btn:hover:not(:disabled) {
    background: var(--neon-cyan);
    color: var(--bg-primary);
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.4);
}

.pager-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.load-all-btn {
    background: rgba(0, 255, 0, 0.15);
    border-color: var(--neon-green);
    color: var(--neon-green);
    margin-left: 12px;
    animation: pulse-glow 2s ease-in-out infinite;
}

.load-all-btn:hover:not(:disabled) {
    background: rgba(0, 255, 0, 0.3);
    box-shadow: 0 0 12px var(--neon-green);
}

.pager-info {
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    color: var(--text-dim);
}

/* Sort Direction Button */
.sort-dir-btn {
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    padding: 6px 12px;
    background: var(--bg-card);
    color: var(--neon-orange);
    border: var(--pixel-size) solid var(--border-pixel);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.sort-dir-btn:hover {
    background: var(--neon-orange);
    color: var(--bg-primary);
    box-shadow: 0 0 8px rgba(255, 170, 0, 0.4);
}

/* Modal Position Detail Table */
.modal-positions-section {
    margin: 16px 0;
}

.modal-pos-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    margin-top: 8px;
}

.modal-pos-table thead th {
    padding: 6px 8px;
    text-align: left;
    font-size: 8px;
    font-family: 'Press Start 2P', monospace;
    color: var(--text-dim);
    border-bottom: var(--pixel-size) solid var(--border-pixel);
}

.modal-pos-table tbody td {
    padding: 6px 8px;
    border-bottom: 1px solid rgba(42, 42, 94, 0.3);
}

.modal-pos-table .pos-sym {
    font-weight: bold;
    color: var(--neon-cyan);
}

.pos-tpsl-row td {
    padding: 2px 8px 8px !important;
    border-bottom: var(--pixel-size) solid var(--border-pixel) !important;
}

.pos-tpsl {
    font-size: 9px;
    color: var(--text-dim);
    font-style: italic;
}

/* --- Champion Strips (compact horizontal) --- */
.champ-strip {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-card);
    border: 1px solid rgba(42, 42, 94, 0.6);
    border-radius: 4px;
    padding: 10px 16px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.2s;
    animation: cardSlideIn 0.4s ease-out backwards;
}

.champ-strip:hover {
    background: var(--bg-card-hover);
    border-color: var(--neon-cyan);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.1);
    transform: translateX(4px);
}

/* Colored accent bar */
.champ-accent {
    position: absolute;
    left: 0;
    top: 0;
    width: 3px;
    height: 100%;
}

.champ-accent-upbit {
    background: var(--neon-blue);
    box-shadow: 0 0 8px var(--neon-blue);
}

.champ-accent-tekkaba {
    background: var(--neon-orange);
    box-shadow: 0 0 8px var(--neon-orange);
}

.champ-accent-cross {
    background: var(--neon-magenta);
    box-shadow: 0 0 8px var(--neon-magenta);
}

.champ-accent-aigene {
    background: #00ff88;
    box-shadow: 0 0 8px #00ff88;
}

.champ-accent-evolve {
    background: #ff9d00;
    box-shadow: 0 0 8px #ff9d00;
}

.champ-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
    width: 28px;
    text-align: center;
}

.champ-info {
    flex: 0 0 auto;
    min-width: 120px;
    max-width: 280px;
}

.champ-div-label {
    font-family: var(--font-pixel);
    font-size: 0.45rem;
    color: var(--text-dim);
    letter-spacing: 2px;
    margin-bottom: 2px;
}

.champ-bot-name {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--neon-yellow);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 0 6px rgba(255, 225, 0, 0.3);
}

.champ-metrics {
    display: flex;
    align-items: center;
    gap: 20px;
    flex: 1;
    justify-content: flex-end;
}

.champ-metric {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 50px;
}

.champ-pnl-metric {
    min-width: 80px;
    align-items: flex-start;
}

.champ-metric-label {
    font-family: var(--font-pixel);
    font-size: 0.35rem;
    color: var(--text-dim);
    letter-spacing: 1px;
}

.champ-metric-val {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 700;
    color: var(--neon-green);
}

.champ-metric-val.negative {
    color: var(--negative);
}

.champ-metric-val.neutral {
    color: var(--text-secondary);
}

.champ-live {
    font-size: 9px;
    color: var(--neon-cyan);
    opacity: 0.7;
}

/* Live PnL coloring (shared between leaderboard & champions) */
.live-pos {
    color: var(--neon-green) !important;
}

.live-neg {
    color: var(--neon-red) !important;
}

.champ-badge {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    text-align: center;
    flex-shrink: 0;
    min-width: 50px;
    padding: 4px 8px;
    background: rgba(42, 42, 94, 0.4);
    border-radius: 4px;
}

.champ-badge-label {
    display: block;
    font-family: var(--font-pixel);
    font-size: 0.3rem;
    color: var(--text-dim);
    letter-spacing: 1px;
}

/* Season History */
.modal-season-section {
    margin-top: 16px;
}

.season-history-table th {
    font-size: 0.6rem;
    padding: 4px 6px;
}

.season-history-table td {
    font-size: 0.65rem;
    padding: 4px 6px;
    text-align: center;
}

/* ==========================================
   Value Glow Animations
   ========================================== */
.pnl-positive {
    animation: glowPositive 2s ease-in-out infinite alternate;
}

.pnl-negative {
    animation: glowNegative 2s ease-in-out infinite alternate;
}

@keyframes glowPositive {
    0% {
        text-shadow: none;
    }

    100% {
        text-shadow: 0 0 8px rgba(57, 255, 20, 0.4);
    }
}

@keyframes glowNegative {
    0% {
        text-shadow: none;
    }

    100% {
        text-shadow: 0 0 8px rgba(255, 51, 102, 0.4);
    }
}

/* Stat chips pulse */
.stat-chip {
    animation: chipPulse 4s ease-in-out infinite;
}

.stat-chip:nth-child(2) {
    animation-delay: 1s;
}

.stat-chip:nth-child(3) {
    animation-delay: 2s;
}

.stat-chip:nth-child(4) {
    animation-delay: 3s;
}

@keyframes chipPulse {

    0%,
    100% {
        border-color: var(--border-pixel);
    }

    50% {
        border-color: rgba(0, 255, 255, 0.3);
    }
}

/* Champion strip hover glow */
.champ-strip {
    transition: all 0.3s ease, box-shadow 0.3s;
}

.champ-strip:hover {
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.15), inset 0 0 30px rgba(0, 255, 255, 0.03);
}

/* Division badge micro-animation */
.division-badge {
    transition: all 0.2s ease;
}

.division-badge:hover {
    transform: scale(1.1);
    filter: brightness(1.3);
}

/* ==========================================
   Bot Name: Full / Short toggle
   ========================================== */
.bot-name-short {
    display: none;
}

/* ==========================================
   Mobile Responsive
   ========================================== */
@media (max-width: 768px) {
    html {
        font-size: 12px;
    }

    /* Show short name, hide full name */
    .bot-name-full {
        display: none !important;
    }

    .bot-name-short {
        display: inline !important;
    }

    /* --- Header compact --- */
    #main-header {
        padding: 8px 10px 0;
    }

    .header-content {
        gap: 8px;
    }

    .logo-section {
        gap: 8px;
    }

    .pixel-icon {
        font-size: 1.4rem;
    }

    .glitch-text {
        font-size: 1rem;
    }

    .subtitle {
        font-size: 0.35rem;
        letter-spacing: 1px;
    }

    .header-stats {
        gap: 4px;
    }

    .stat-chip {
        padding: 4px 8px;
        min-width: 50px;
    }

    .stat-label {
        font-size: 0.35rem;
    }

    .stat-value {
        font-size: 0.55rem;
    }

    /* --- Tabs: horizontal scroll --- */
    #division-tabs {
        justify-content: flex-start;
        gap: 4px;
        padding: 8px 10px;
        overflow-x: auto;
        overflow-y: hidden;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    #division-tabs::-webkit-scrollbar {
        display: none;
    }

    .tab-btn {
        font-size: 0.45rem;
        padding: 6px 10px;
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* --- Main content --- */
    #main-content {
        padding: 0 6px 20px;
    }

    .section {
        margin-bottom: 16px;
    }

    .section-title {
        font-size: 0.55rem;
        gap: 6px;
        margin-bottom: 10px;
    }

    .section-icon {
        font-size: 0.9rem;
    }

    /* --- Champion strips --- */
    .champ-strip {
        padding: 8px 10px;
        gap: 8px;
    }

    .champ-icon {
        font-size: 1.2rem;
        min-width: 24px;
    }

    .champ-div-label {
        font-size: 0.35rem;
    }

    .champ-bot-name {
        font-size: 0.45rem;
    }

    .champ-metrics {
        gap: 6px;
    }

    .champ-metric-label {
        font-size: 0.3rem;
    }

    .champ-metric-val {
        font-size: 11px;
    }

    .champ-pnl-metric .champ-metric-val {
        font-size: 13px;
    }

    .champ-live {
        font-size: 7px;
    }

    .champ-badge {
        font-size: 11px;
        min-width: 36px;
        padding: 3px 6px;
    }

    .champ-badge-label {
        font-size: 0.25rem;
    }

    /* --- Leaderboard table --- */
    .leaderboard-controls {
        gap: 6px;
        margin-bottom: 8px;
    }

    .pixel-select,
    .pixel-input {
        font-size: 0.4rem;
        padding: 6px 8px;
    }

    .leaderboard-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
    }

    /* Leaderboard table: scrollable with min-width */
    #leaderboard-table {
        min-width: 700px;
    }

    /* Hide only least critical columns */
    .col-fav,
    .col-balance,
    #leaderboard-table th.col-fav,
    #leaderboard-table th.col-balance {
        display: none;
    }

    /* Table cells compact */
    #leaderboard-table {
        font-size: 0.75rem;
    }

    #leaderboard-table th {
        font-size: 0.4rem;
        padding: 8px 6px;
        letter-spacing: 0.5px;
    }

    #leaderboard-table td {
        padding: 10px 6px;
        font-size: 0.75rem;
    }

    /* Rank column */
    .rank-medal {
        width: 24px;
        height: 24px;
        font-size: 0.65rem;
    }

    /* Bot name column */
    .col-name {
        text-align: left;
    }

    .bot-name-cell.bot-name-short {
        font-size: 0.65rem;
        font-weight: 600;
        max-width: none;
    }

    /* PnL columns prominent */
    .col-pnl {
        font-weight: 700;
        font-size: 0.8rem !important;
    }

    .col-pnl-pct {
        font-size: 0.7rem !important;
    }

    /* Row tap feedback */
    #leaderboard-table tbody tr {
        cursor: pointer;
    }

    #leaderboard-table tbody tr:active {
        background: var(--bg-card-hover);
        transform: scale(0.99);
    }

    /* Division column hidden in table (saves space) */
    #leaderboard-table .col-division {
        display: none;
    }

    /* Badges hidden */
    .ai-badge,
    .evo-badge {
        display: none;
    }

    /* --- Pagination --- */
    .leaderboard-pager {
        gap: 4px;
    }

    .pager-btn {
        font-size: 0.4rem;
        padding: 6px 10px;
    }

    .pager-info {
        font-size: 0.4rem;
    }

    /* --- View toggle --- */
    .view-toggle {
        gap: 4px;
    }

    .toggle-btn {
        font-size: 0.4rem;
        padding: 6px 10px;
    }

    /* --- Battle header --- */
    .battle-header {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }

    /* --- Positions: fit within screen --- */
    #positions-section {
        overflow: hidden;
    }

    .positions-summary {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100vw;
    }

    .pos-summary-table {
        width: 100%;
        table-layout: fixed;
    }

    .pos-summary-table th,
    .pos-summary-table td {
        font-size: 0.45rem;
        padding: 6px 4px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Hide BOTS column (too long) on mobile */
    .pos-bots-list,
    .pos-summary-table th:nth-child(5) {
        display: none;
    }

    .pos-summary-table .pos-sym {
        font-weight: 700;
        color: var(--neon-cyan);
    }

    .no-positions {
        font-size: 0.45rem;
        padding: 16px;
    }

    .positions-grid {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .position-card {
        padding: 8px 10px;
    }

    .position-card .pos-symbol {
        font-size: 0.5rem;
    }

    .position-card .pos-direction {
        font-size: 0.35rem;
    }

    .position-card .pos-details {
        font-size: 0.65rem;
    }

    .position-card .pos-bot {
        font-size: 0.3rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }

    /* --- Modal --- */
    .modal-content {
        width: 96%;
        max-width: none;
        padding: 14px;
        max-height: 90vh;
    }

    .modal-header {
        gap: 8px;
        margin-bottom: 12px;
    }

    .modal-title {
        font-size: 0.6rem;
    }

    .modal-strategy {
        font-size: 0.7rem;
        padding: 8px 10px;
    }

    .modal-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }

    .modal-stat-card {
        padding: 8px 6px;
    }

    .modal-stat-card .stat-label {
        font-size: 0.35rem;
    }

    .modal-stat-card .stat-val {
        font-size: 0.9rem;
    }

    .modal-subtitle {
        font-size: 0.45rem;
    }

    .modal-pos-table th,
    .modal-pos-table td {
        font-size: 0.55rem;
        padding: 4px 4px;
    }

    .trade-item {
        grid-template-columns: 60px 40px 1fr 60px;
        gap: 4px;
        font-size: 0.65rem;
        padding: 4px 6px;
    }

    /* --- Footer --- */
    #main-footer {
        padding: 12px 10px;
    }

    .footer-text,
    .footer-update {
        font-size: 0.35rem;
    }

    /* --- Sort button --- */
    .sort-dir-btn {
        font-size: 0.4rem;
        padding: 6px 10px;
    }
}

/* ==========================================
   Loading Overlay
   ========================================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

.loading-overlay.fade-out {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loading-content {
    text-align: center;
    animation: loadingPulse 2s ease-in-out infinite;
}

@keyframes loadingPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.02);
    }
}

.loading-arena {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 40px;
}

.loading-logo {
    font-family: var(--font-pixel);
    font-size: 2rem;
    color: var(--neon-cyan);
    text-shadow:
        0 0 20px rgba(0, 255, 255, 0.6),
        0 0 40px rgba(0, 255, 255, 0.3),
        0 0 80px rgba(0, 255, 255, 0.15);
    letter-spacing: 6px;
    animation: logoGlitch 3s infinite;
}

@keyframes logoGlitch {

    0%,
    92%,
    100% {
        transform: translate(0);
        opacity: 1;
    }

    93% {
        transform: translate(-3px, 1px);
        opacity: 0.9;
    }

    95% {
        transform: translate(2px, -1px);
        opacity: 0.95;
    }

    97% {
        transform: translate(-1px, 2px);
        opacity: 0.9;
    }
}

.loading-sword {
    font-size: 2.5rem;
    filter: drop-shadow(0 0 10px var(--neon-cyan));
}

.loading-sword.left {
    animation: swordFloat 2s ease-in-out infinite;
}

.loading-sword.right {
    animation: swordFloat 2s ease-in-out infinite 0.5s;
    transform: scaleX(-1);
}

@keyframes swordFloat {

    0%,
    100% {
        transform: translateY(0) rotate(-5deg);
    }

    50% {
        transform: translateY(-8px) rotate(5deg);
    }
}

.loading-sword.right {
    animation: swordFloatR 2s ease-in-out infinite 0.5s;
}

@keyframes swordFloatR {

    0%,
    100% {
        transform: translateY(0) scaleX(-1) rotate(-5deg);
    }

    50% {
        transform: translateY(-8px) scaleX(-1) rotate(5deg);
    }
}

.loading-bar-track {
    width: 300px;
    height: 8px;
    background: var(--bg-card);
    border: 2px solid var(--border-pixel);
    margin: 0 auto 24px;
    overflow: hidden;
    position: relative;
}

.loading-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--neon-cyan), var(--neon-magenta), var(--neon-cyan));
    background-size: 200% 100%;
    animation: loadingBarFill 2.5s ease-in-out forwards, loadingBarShimmer 1.5s linear infinite;
    width: 0%;
    box-shadow: 0 0 10px var(--neon-cyan), 0 0 20px rgba(0, 255, 255, 0.3);
}

@keyframes loadingBarFill {
    0% {
        width: 0%;
    }

    20% {
        width: 30%;
    }

    50% {
        width: 55%;
    }

    80% {
        width: 75%;
    }

    100% {
        width: 90%;
    }
}

@keyframes loadingBarShimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.loading-text {
    font-family: var(--font-pixel);
    font-size: 0.55rem;
    color: var(--text-secondary);
    letter-spacing: 3px;
    margin-bottom: 8px;
    animation: textBlink 1.5s step-end infinite;
}

@keyframes textBlink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

.loading-dots {
    font-family: var(--font-pixel);
    font-size: 1.2rem;
    color: var(--neon-green);
    letter-spacing: 8px;
}

.loading-dots span {
    animation: dotPulse 1.4s ease-in-out infinite;
    display: inline-block;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes dotPulse {

    0%,
    80%,
    100% {
        opacity: 0.2;
        transform: translateY(0);
    }

    40% {
        opacity: 1;
        transform: translateY(-6px);
        text-shadow: 0 0 8px var(--neon-green);
    }
}

/* Chart Mode Toggle */
.modal-chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.chart-mode-toggle {
    display: flex;
    gap: 4px;
}

.chart-mode-btn {
    font-family: var(--font-pixel);
    font-size: 0.4rem;
    padding: 4px 10px;
    border: 1px solid var(--border-pixel);
    background: transparent;
    color: #555588;
    cursor: pointer;
    transition: all 0.2s;
}

.chart-mode-btn:hover {
    border-color: var(--neon-cyan);
    color: var(--neon-cyan);
}

.chart-mode-btn.active {
    background: rgba(0, 255, 255, 0.12);
    border-color: var(--neon-cyan);
    color: var(--neon-cyan);
    text-shadow: 0 0 6px rgba(0, 255, 255, 0.4);
}