* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

html, body {
    width: 100%;
    height: 100%;
    background: #131722;
    overflow: hidden;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
}

.trading-container {
    background: #1e222d;
    border-radius: 8px;
    width: 100%;
    height: 100%;
    max-width: 1400px;
    max-height: 900px;
    display: flex;
    flex-direction: column;
    border: 1px solid #2a2e39;
}

/* ===== ВЕРХНЯЯ ПАНЕЛЬ ===== */
.trading-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid #2a2e39;
    flex-shrink: 0;
    background: #1e222d;
    flex-wrap: wrap;
    gap: 10px;
}

.trading-symbol {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-shrink: 0;
}

.symbol {
    color: #d1d4dc;
    font-size: 24px;
    font-weight: 700;
}

.exchange {
    color: #787b86;
    font-size: 14px;
}

.trading-price {
    display: flex;
    align-items: baseline;
    gap: 16px;
    flex-shrink: 0;
}

.price-main {
    color: #00ff41;
    font-size: 32px;
    font-weight: 700;
    font-family: 'Courier New', monospace;
}

.price-main.negative {
    color: #f23645;
}

.price-change {
    color: #00ff41;
    font-size: 16px;
    font-weight: 500;
    font-family: 'Courier New', monospace;
}

.price-change.negative {
    color: #f23645;
}

.trading-stats {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    min-width: 50px;
}

.stat-item:last-child {
    cursor: pointer;
    padding: 4px 12px;
    border: 1px solid #2a2e39;
    border-radius: 6px;
    transition: all 0.3s;
    background: rgba(0, 255, 65, 0.02);
}

.stat-item:last-child:hover {
    border-color: #00ff41;
    background: rgba(0, 255, 65, 0.05);
    box-shadow: 0 0 20px rgba(0, 255, 65, 0.05);
}

.stat-label {
    color: #787b86;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    color: #d1d4dc;
    font-size: 16px;
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

/* ===== ГРАФИК ===== */
.trading-chart {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #131722;
    min-height: 0;
}

.chart-wrapper {
    flex: 1;
    padding: 10px;
    min-height: 0;
}

#chart {
    display: block;
    width: 100%;
    height: 100%;
    background: transparent;
}

/* ===== СПИСОК ИГРОКОВ ===== */
.players-section {
    background: #131722;
    border-top: 1px solid #2a2e39;
    border-bottom: 1px solid #2a2e39;
    max-height: 200px;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.players-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    color: #787b86;
    font-size: 13px;
    border-bottom: 1px solid #1e222d;
    flex-shrink: 0;
}

.players-header span:first-child {
    color: #d1d4dc;
    font-weight: 500;
}

.players-count {
    color: #00ff41;
    font-weight: 700;
    font-family: 'Courier New', monospace;
}

.players-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-content: flex-start;
}

.players-list::-webkit-scrollbar {
    width: 4px;
}

.players-list::-webkit-scrollbar-track {
    background: #1e222d;
}

.players-list::-webkit-scrollbar-thumb {
    background: #2a2e39;
    border-radius: 4px;
}

.player-item {
    background: #1e222d;
    color: #d1d4dc;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 13px;
    border: 1px solid #2a2e39;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.player-item:hover {
    border-color: #00ff41;
    background: rgba(0, 255, 65, 0.05);
}

.player-item.empty {
    color: #787b86;
    font-style: italic;
    border-color: transparent;
    width: 100%;
    text-align: center;
    justify-content: center;
}

.player-item .player-name {
    color: #00ff41;
    font-weight: 500;
    margin: 0 4px;
}

.player-item .player-score {
    color: #f0b90b;
    font-size: 10px;
}

.player-item .player-ping {
    color: #787b86;
    font-size: 10px;
}

.player-item .player-id {
    color: #787b86;
    font-size: 10px;
    opacity: 0.5;
}

/* ===== НИЖНЯЯ ПАНЕЛЬ ===== */
.trading-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    border-top: 1px solid #2a2e39;
    background: #1e222d;
    flex-shrink: 0;
    flex-wrap: wrap;
    gap: 8px;
}

.footer-left, .footer-right {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #787b86;
    font-size: 13px;
}

.footer-right span {
    color: #d1d4dc;
}

#status.online {
    color: #00ff41;
}

#status.offline {
    color: #f23645;
}

/* ===== МОДАЛЬНОЕ ОКНО ===== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.modal-overlay.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.modal {
    background: #1e222d;
    border-radius: 12px;
    border: 1px solid #2a2e39;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid #2a2e39;
    color: #d1d4dc;
    font-size: 18px;
    font-weight: 600;
    flex-shrink: 0;
}

.modal-close {
    cursor: pointer;
    color: #787b86;
    font-size: 24px;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #f23645;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px;
    min-height: 200px;
}

.modal-body::-webkit-scrollbar {
    width: 4px;
}

.modal-body::-webkit-scrollbar-track {
    background: #131722;
}

.modal-body::-webkit-scrollbar-thumb {
    background: #2a2e39;
    border-radius: 4px;
}

/* ===== ТАБЛИЦА ТОП ИГРОКОВ ===== */
.top-table {
    width: 100%;
    border-collapse: collapse;
}

.top-table th {
    color: #787b86;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: left;
    padding: 8px 8px 8px 0;
    border-bottom: 1px solid #2a2e39;
}

.top-table td {
    color: #d1d4dc;
    padding: 8px 8px 8px 0;
    border-bottom: 1px solid #1e222d;
    font-size: 14px;
}

.top-table tr:hover td {
    background: rgba(0, 255, 65, 0.02);
}

.top-table .rank {
    color: #787b86;
    font-weight: 700;
    width: 40px;
}

.top-table .rank.gold {
    color: #f0b90b;
}

.top-table .rank.silver {
    color: #c0c0c0;
}

.top-table .rank.bronze {
    color: #cd7f32;
}

.top-table .player-name {
    color: #00ff41;
    font-weight: 500;
}

.top-table .player-stat {
    color: #787b86;
    font-size: 13px;
}

.top-table .player-stat strong {
    color: #d1d4dc;
}

.loading {
    color: #787b86;
    text-align: center;
    padding: 40px 0;
    font-size: 14px;
}

.empty-top {
    color: #787b86;
    text-align: center;
    padding: 40px 0;
    font-style: italic;
}

/* ===== АДАПТИВ ===== */
@media (max-width: 768px) {
    .trading-container {
        max-height: none;
        border-radius: 0;
    }
    
    .trading-header {
        padding: 12px 16px;
        flex-direction: column;
        align-items: stretch;
    }
    
    .trading-price {
        justify-content: center;
    }
    
    .price-main {
        font-size: 24px;
    }
    
    .trading-stats {
        justify-content: space-around;
        gap: 10px;
    }
    
    .stat-item {
        min-width: 40px;
    }
    
    .stat-item:last-child {
        padding: 4px 8px;
    }
    
    .players-section {
        max-height: 150px;
    }
    
    .players-list {
        padding: 6px 12px;
        gap: 4px;
    }
    
    .player-item {
        font-size: 11px;
        padding: 3px 8px;
    }
    
    .trading-footer {
        padding: 10px 16px;
        flex-direction: column;
        align-items: center;
    }
    
    .footer-right {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .modal {
        width: 95%;
        max-height: 90vh;
    }
    
    .modal-header {
        font-size: 16px;
        padding: 12px 16px;
    }
    
    .modal-body {
        padding: 12px 16px;
    }
    
    .top-table td, .top-table th {
        font-size: 12px;
        padding: 6px 4px;
    }
}