* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Courier New', monospace;
    background-color: #1e1e1e;
    color: #f0f0f0;
    overflow-x: hidden;
    position: relative;
}

/* ====== ФОНОВЫЙ ШУМ ====== */
#noise-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.noise-element {
    position: absolute;
    color: rgba(200, 200, 200, 0.5);
    font-family: monospace;
    font-size: 18px;
    animation: fadeInOut 0.5s forwards;
    user-select: none;
}

@keyframes fadeInOut {
    0% { opacity: 0; }
    50% { opacity: 0.8; }
    100% { opacity: 0; }
}

/* ====== ЛОГОТИП ====== */
#logo-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
    background-color: rgba(30, 30, 30, 0.95);
    transition: opacity 1s ease-out;
    cursor: pointer;
}

#logo-container.hidden {
    opacity: 0;
    pointer-events: none;
}

.instruction {
    color: #888;
    font-size: 16px;
    opacity: 0.7;
    animation: pulse 2s infinite;
    margin: 0;
}

@keyframes pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.8; }
}

#animation-text {
    white-space: pre;
    font-size: 22px;
    line-height: 1;
    font-family: monospace;
    opacity: 0;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(1.2);
}

#animation-text.visible {
    opacity: 1;
}

/* ====== РАБОЧАЯ ОБЛАСТЬ ====== */
#workspace {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 5;
    opacity: 0;
    pointer-events: none;
    transition: opacity 1s ease-in;
    padding: 20px;
    overflow-y: auto;
}

#workspace.active {
    opacity: 1;
    pointer-events: all;
}

/* ====== ХЕДЕР ====== */
.header {
    background: rgba(40, 40, 40, 0.9);
    border: 1px solid #555;
    padding: 20px;
    margin: 0 auto 20px auto;
    max-width: 1400px;
    border-radius: 5px;
}

.header h1 {
    font-size: 24px;
    margin-bottom: 15px;
    color: #f0f0f0;
    text-align: center;
}

.search-container {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

input[type="text"] {
    flex: 1;
    background: rgba(50, 50, 50, 0.9);
    border: 1px solid #555;
    color: #f0f0f0;
    padding: 12px 15px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    border-radius: 3px;
    outline: none;
}

input[type="text"]:focus {
    border-color: #888;
    box-shadow: 0 0 10px rgba(136, 136, 136, 0.3);
}

button {
    background: #333;
    border: 1px solid #555;
    color: #f0f0f0;
    padding: 12px 30px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.3s;
}

button:hover {
    background: #444;
}

button:active {
    transform: scale(0.98);
}

/* ====== МУЗЫКА ====== */
.music-control {
    position: fixed;
    left: 20px;
    bottom: 20px;
    background-color: rgba(40, 40, 40, 0.9);
    padding: 10px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 100;
    border: 1px solid #555;
}

.music-control button {
    width: 50px;
    height: 36px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 12px;
    padding: 0;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 5px;
}

input[type="range"] {
    width: 120px;
}

.value-display {
    min-width: 40px;
    text-align: left;
    color: #aaa;
}

/* ====== СТАТИСТИКА - 6 КОЛОНОК ====== */
.stats-container {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 15px;
    margin: 0 auto 20px auto;
    max-width: 1400px;
}

.stat-card {
    background: rgba(40, 40, 40, 0.9);
    border: 1px solid #555;
    padding: 15px;
    border-radius: 5px;
}

.stat-label {
    font-size: 12px;
    opacity: 0.7;
    margin-bottom: 5px;
    color: #aaa;
}

.stat-value {
    font-size: 18px;
    font-weight: bold;
    color: #f0f0f0;
    word-break: break-all;
}

/* ====== СЕКЦИЯ ГРАФИКА - GRID 6 КОЛОНОК ====== */
.chart-section {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 15px;
    max-width: 1400px;
    margin: 0 auto;
}

.chart-container {
    grid-column: span 6;
    transition: grid-column 0.3s ease;
}

.chart-container.shrink {
    grid-column: span 4;
}

.chart-card {
    background: rgba(40, 40, 40, 0.9);
    border: 2px solid #ff9f40;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 0 20px rgba(255, 159, 64, 0.3);
    position: relative;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.chart-title {
    font-size: 18px;
    color: #f0f0f0;
    font-weight: bold;
}

/* Градация */
.gradation-selector {
    position: relative;
    display: inline-block;
}

.gradation-current {
    background: #333;
    border: 1px solid #555;
    color: #f0f0f0;
    padding: 8px 15px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    cursor: pointer;
    border-radius: 3px;
    min-width: 100px;
    text-align: center;
}

.gradation-current:hover {
    background: #444;
}

.gradation-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 5px;
    background: #333;
    border: 1px solid #555;
    border-radius: 3px;
    overflow: hidden;
    z-index: 1000;
    min-width: 100px;
}

.gradation-dropdown.show {
    display: block;
}

.gradation-option {
    padding: 8px 15px;
    cursor: pointer;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: #f0f0f0;
    text-align: center;
}

.gradation-option:hover {
    background: #444;
}

.gradation-option.active {
    background: #ff9f40;
    color: #000;
}

/* Легенда */
.chart-legend {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: bold;
    color: #d1d1d1;
}

.legend-color {
    width: 20px;
    height: 14px;
    border-radius: 2px;
}

.legend-bids {
    background: rgba(33, 150, 243, 0.7);
    border: 2px solid rgba(33, 150, 243, 1);
}

.legend-listings {
    background: rgba(255, 159, 64, 0.7);
    border: 2px solid rgba(255, 159, 64, 1);
}

.chart-wrapper {
    width: 100%;
    height: 500px;
    position: relative;
}

/* Тултип */
.chart-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.95);
    border: 2px solid #ff9f40;
    border-radius: 5px;
    padding: 12px;
    color: #fff;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 1000;
    min-width: 160px;
}

.chart-tooltip.visible {
    opacity: 1;
}

.tooltip-title {
    font-weight: bold;
    margin-bottom: 8px;
    color: #ff9f40;
    font-size: 13px;
}

.tooltip-section {
    margin-top: 8px;
}

.tooltip-section-title {
    font-weight: bold;
    margin-bottom: 4px;
}

.tooltip-section-title.bids {
    color: rgba(33, 150, 243, 1);
}

.tooltip-section-title.listings {
    color: rgba(255, 159, 64, 1);
}

.tooltip-divider {
    border-top: 1px solid #555;
    margin: 6px 0;
}

.tooltip-row {
    display: flex;
    justify-content: space-between;
    margin: 3px 0;
}

.tooltip-label {
    color: #aaa;
}

.tooltip-value {
    font-weight: bold;
    color: #fff;
}

/* ====== ПАНЕЛЬ ДЕТАЛЕЙ - ВЫСОТА КАК У ГРАФИКА ====== */
.detail-panel {
    grid-column: span 2;
    background: rgba(40, 40, 40, 0.95);
    border: 1px solid #555;
    border-radius: 5px;
    display: none;
    flex-direction: column;
    /* Высота = высота chart-card */
    height: 618px;
    animation: slideIn 0.3s ease;
}

.detail-panel.visible {
    display: flex;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #555;
    background: rgba(50, 50, 50, 0.9);
    border-radius: 5px 5px 0 0;
    flex-shrink: 0;
}

.detail-title {
    font-size: 18px;
    font-weight: bold;
    color: #ff9f40;
}

.detail-close {
    background: transparent;
    border: none;
    color: #888;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.detail-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.detail-content {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.detail-section {
    margin-bottom: 20px;
}

.detail-section-title {
    font-size: 14px;
    font-weight: bold;
    padding: 10px 12px;
    border-radius: 4px;
    margin-bottom: 10px;
}

.detail-section-title.bids {
    background: rgba(33, 150, 243, 0.2);
    color: rgba(33, 150, 243, 1);
}

.detail-section-title.listings {
    background: rgba(255, 159, 64, 0.2);
    color: rgba(255, 159, 64, 1);
}

/* Увеличенные элементы списка */
.detail-item {
    display: flex;
    flex-direction: column;
    padding: 12px 14px;
    background: rgba(50, 50, 50, 0.6);
    border-radius: 4px;
    margin-bottom: 8px;
    border-left: 3px solid #555;
}

.detail-item:hover {
    background: rgba(60, 60, 60, 0.8);
}

.detail-item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.detail-item-price {
    font-size: 15px;
    font-weight: bold;
    color: #fff;
}

.detail-item-address {
    font-size: 12px;
    color: #888;
    font-family: monospace;
}

.detail-item-name {
    font-size: 12px;
    color: #aaa;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Цветные границы для элементов */
.detail-section-title.bids + .detail-item,
.detail-section-title.bids ~ .detail-item {
    border-left-color: rgba(33, 150, 243, 0.6);
}

.detail-section-title.listings + .detail-item,
.detail-section-title.listings ~ .detail-item {
    border-left-color: rgba(255, 159, 64, 0.6);
}

/* Скроллбар для панели */
.detail-content::-webkit-scrollbar {
    width: 8px;
}

.detail-content::-webkit-scrollbar-track {
    background: #2a2a2a;
    border-radius: 4px;
}

.detail-content::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}

.detail-content::-webkit-scrollbar-thumb:hover {
    background: #666;
}

/* ====== НАДПИСИ ОСЕЙ ====== */
.axis-label {
    z-index: 10;
}

/* ====== МЕТКИ НАД БАРАМИ ====== */
.bar-labels-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: visible;
    z-index: 50;
}

.bar-label {
    position: absolute;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    pointer-events: none;
    white-space: nowrap;
}

.bar-label.bid {
    color: #64B5F6;
}

.bar-label.listing {
    color: #FFB74D;
}

/* ====== ЗАГРУЗКА / ОШИБКА ====== */
.loading {
    text-align: center;
    padding: 20px 40px;
    font-size: 14px;
    color: #aaa;
    max-width: 600px;
    margin: 0 auto;
}

.loading-logs {
    background: rgba(30, 30, 30, 0.95);
    border: 1px solid #555;
    border-radius: 5px;
    padding: 15px 20px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    text-align: left;
}

.log-line {
    margin: 6px 0;
    opacity: 0;
    animation: logAppear 0.3s forwards;
}

.log-line.info {
    color: #888;
}

.log-line.success {
    color: #4CAF50;
}

.log-line.error {
    color: #ff6666;
}

@keyframes logAppear {
    0% {
        opacity: 0;
        transform: translateX(-10px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

.loading.hidden {
    display: none;
}

.error {
    background: rgba(255, 100, 100, 0.1);
    border: 1px solid #ff6666;
    color: #ff6666;
    padding: 15px;
    border-radius: 5px;
    margin: 0 auto 20px auto;
    max-width: 1400px;
}

.error.hidden {
    display: none;
}

/* ====== RESPONSIVE ====== */
@media (max-width: 1200px) {
    .stats-container {
        grid-template-columns: repeat(3, 1fr);
    }

    .chart-section {
        grid-template-columns: 1fr;
    }

    .chart-container,
    .chart-container.shrink {
        grid-column: span 1;
    }

    .detail-panel {
        grid-column: span 2;
        background: rgba(40, 40, 40, 0.95);
        border: 1px solid #555;
        border-radius: 5px;
        display: none;
        flex-direction: column;
        min-height: 618px;
        max-height: 618px;
        animation: slideIn 0.3s ease;
    }
}

@media (max-width: 768px) {
    .stats-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ====== КЛИКАБЕЛЬНЫЙ АДРЕС ====== */
.detail-item-address.clickable {
    cursor: pointer;
    transition: color 0.2s;
}

.detail-item-address.clickable:hover {
    color: #4CAF50;
    text-decoration: underline;
}

/* Анимация исчезновения лога */
@keyframes logDisappear {
    0% {
        opacity: 1;
        transform: translateX(0);
    }
    100% {
        opacity: 0;
        transform: translateX(-20px);
    }
}

/* ====== ГЛИТЧ ДЛЯ ЭЛЕМЕНТОВ ПАНЕЛИ ====== */
.detail-item.glitch-item {
    filter: url('#glitch-filter');
    animation: itemGlitch 0.3s ease;
}

@keyframes itemGlitch {
    0%, 100% { transform: translate(0, 0); }
    10% { transform: translate(-2px, 1px); }
    20% { transform: translate(2px, -1px); }
    30% { transform: translate(-3px, -1px); }
    40% { transform: translate(3px, 1px); }
    50% { transform: translate(-2px, 2px); }
    60% { transform: translate(2px, -2px); }
    70% { transform: translate(-3px, 1px); }
    80% { transform: translate(3px, -1px); }
    90% { transform: translate(-1px, 1px); }
}