* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    width: 100%;
    height: 100%;
    height: 100dvh;
}

body {
    background-color: #000000;
    color: #ffffff;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    display: flex; 
    justify-content: center; 
    align-items: center;
    overflow: hidden;
}

.dashboard {
    width: 100%; 
    max-width: 100%;
    padding: 12px 16px;
    display: flex; 
    flex-direction: column;
    height: 100%;
    height: 100dvh;
}

/* NAGŁÓWEK I KARTY STATYSTYK */
.glass-header {
    display: flex; justify-content: center; align-items: center;
    margin-bottom: 10px; padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.stats-grid { display: flex; gap: 10px; width: 100%; justify-content: center; }

.stat-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    padding: 6px 12px;
    display: flex; flex-direction: column; 
    flex: 0 1 200px; min-width: 140px; max-width: 220px;
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    transition: all 0.2s ease;
    align-items: center; 
    cursor: pointer;
}

.stat-card:hover {
    background: rgba(255, 255, 255, 0.08);
}

.stat-btc { border-bottom: 2px solid #ffffff; }
.stat-trends { border-bottom: 2px solid #0080ff; }
.stat-status { border-bottom: 2px solid #26a69a; }

.stat-label { font-size: 10px; color: #8e8e93; font-weight: 600; letter-spacing: 0.05em; margin-bottom: 3px; text-align: center; text-transform: uppercase; }
.stat-value { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; white-space: nowrap; color: #ffffff; }

.loading-state { flex-grow: 1; display: flex; justify-content: center; align-items: center; color: #8e8e93; font-size: 13px; font-weight: 500; }

/* PASEK PRZYCISKÓW */
.timeframe-selector {
    display: flex; gap: 4px;
    background: rgba(255, 255, 255, 0.05);
    padding: 3px; border-radius: 6px; width: fit-content;
    margin: 0 auto 8px auto; 
    position: relative; z-index: 10;
    align-items: center;
    flex-shrink: 0;
}

.tf-btn {
    background: transparent; border: none; color: #8e8e93;
    font-size: 11px; font-weight: 500; padding: 4px 10px;
    border-radius: 4px; cursor: pointer; transition: all 0.15s ease;
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.01em;
}

.tf-btn:hover { color: #ffffff; }
.tf-btn.active {
    background: rgba(255, 255, 255, 0.15); color: #ffffff;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.toggle-btn[data-series="google"].active { color: #0080ff; }

/* KONTENER WYKRESU */
#chart-wrapper { 
    flex: 1 1 auto; 
    width: 100%; 
    min-height: 0; 
    display: flex; 
    flex-direction: column; 
    position: relative; 
    margin: 0; 
    padding: 0;
}

#chart-main { flex: 1 1 auto; width: 100%; min-height: 0; position: relative; margin: 0; padding: 0; }

/* TOOLTIP */
#tv-tooltip {
    width: auto; min-width: 170px; position: absolute; display: none;
    padding: 8px 12px; box-sizing: border-box; font-size: 12px; color: #fff;
    background: rgba(20, 20, 22, 0.85); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 6px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6); pointer-events: none; z-index: 1000; line-height: 1.5;
}

.tooltip-date { font-weight: 600; font-size: 11px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); padding-bottom: 4px; margin-bottom: 6px; color: #8e8e93; text-transform: uppercase; }
.tooltip-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 2px; }
.tooltip-color-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.tooltip-label { color: #8e8e93; font-weight: 500; font-size: 11px; }
.tooltip-value { font-weight: 600; font-size: 12px; font-variant-numeric: tabular-nums; }

/* STOPKA */
footer { 
    text-align: center; 
    font-size: 11px; 
    color: #48484a; 
    padding-top: 8px; 
    padding-bottom: 4px;
    flex-shrink: 0; 
}

/* MODAL LEGENDY */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.75); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    display: none; justify-content: center; align-items: center;
    z-index: 9999; opacity: 0; transition: opacity 0.2s ease;
}
.modal-overlay.show { display: flex; opacity: 1; }
.modal-content {
    background: rgba(20, 20, 22, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 24px;
    max-width: 420px; width: 90%;
    box-shadow: 0 20px 50px rgba(0,0,0,0.8);
    font-family: 'Inter', sans-serif;
    animation: modalSlide 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes modalSlide {
    from { transform: translateY(10px); }
    to { transform: translateY(0); }
}
#modal-title { font-size: 15px; font-weight: 600; margin-bottom: 10px; color: #ffffff; }
#modal-text { font-size: 13px; line-height: 1.5; color: #8e8e93; margin-bottom: 16px; white-space: pre-line; }
.modal-close-btn {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.1);
    color: #ffffff; font-size: 12px; font-weight: 600;
    padding: 8px 16px; border-radius: 4px;
    cursor: pointer; width: 100%; transition: background 0.15s;
}
.modal-close-btn:hover { background: rgba(255,255,255,0.15); }

.spinner { width: 16px; height: 16px; border: 2px solid #8e8e93; border-top: 2px solid transparent; border-radius: 50%; animation: spin 1s linear infinite; margin-right: 10px; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* REAKSYWNOŚĆ MOBILNA ZAKTUALIZOWANA */
@media (max-width: 768px) {
    .dashboard { padding: 8px 4px; }
    .glass-header { margin-bottom: 8px; padding-bottom: 0; }
    
    .stats-grid { 
        flex-direction: row; 
        overflow: hidden; 
        gap: 4px; 
        padding-bottom: 4px; 
    }
    
    .stat-card { 
        flex: 1 1 0; 
        min-width: 0; 
        max-width: none; 
        padding: 6px 4px; 
    }
    
    .stat-card.stat-status {
        padding-right: 28px !important;
    }
    
    .stat-label { 
        font-size: 8px; 
        letter-spacing: -0.01em; 
        margin-bottom: 2px; 
        white-space: nowrap;
    }
    
    .stat-value { 
        font-size: 11px; 
    }
    
    .tf-btn { 
        padding: 3px 8px; 
        font-size: 10px; 
    }
    
    #fng-mini-scale {
        right: 2px !important;
        width: 24px !important;
    }
    
    #fng-mini-scale span {
        font-size: 5px !important;
    }
}

@keyframes smoothReveal { 0% { opacity: 0; transform: translateY(10px); } 100% { opacity: 1; transform: translateY(0); } }
.stat-card { opacity: 0; animation: smoothReveal 0.4s ease forwards; }
.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.1s; }
.stat-card:nth-child(3) { animation-delay: 0.15s; }