@keyframes td-float {
    0% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(1deg); }
    100% { transform: translateY(0px) rotate(0deg); }
}

.td-root {
    --td-primary-color: #00ff9d;    /* Bright green */
    --td-secondary-color: #1a1a1a;  /* Dark gray */
    --td-background-color: #121212; /* Almost black */
    --td-text-color: #ffffff;       /* White text */
    position: relative;
    background-image: url('../../assets/site/home/community/bg-lg.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.td-root::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background-color: rgba(18, 18, 18, 0.5); /* #121212 with 50% opacity */
    z-index: 1;
}

.td-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: clamp(1rem, 4vw, 2rem);
    font-family: 'Arial', sans-serif;
    color: var(--td-text-color);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    position: relative;
    z-index: 2; /* Place content above the background overlay */
    background-color: transparent; /* Make container transparent to show background */
}

@media (max-width: 480px) {
    .td-container {
        font-size: 14px;
    }
}

.td-header {
    text-align: center;
    margin-bottom: 3rem;
}

.td-header__title {
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    margin-bottom: 1rem;
    color: var(--td-primary-color);
    word-wrap: break-word;
}

.td-dashboard {
    display: grid;
    grid-template-columns: 1fr;
    gap: clamp(1rem, 4vw, 2rem);
}

@media (min-width: 768px) {
    .td-dashboard {
        grid-template-columns: 2fr 1fr;
    }
}

@media (max-width: 480px) {
    .td-dashboard {
        gap: 1rem;
    }
}

.td-chart-container {
    background: #1a1a1a;
    border-radius: 1rem;
    padding: 1.5rem;
    perspective: 1000px;
    transform-style: preserve-3d;
    animation: td-float 6s ease-in-out infinite;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Add styles for Chart.js legend container */
#td-distribution-chart {
    position: relative;
}

#td-distribution-chart .chartjs-legend-container {
    position: relative;
    z-index: 9999;
}

/* Override Chart.js generated legend styles */
#td-distribution-chart canvas + .chartjs-legend {
    position: relative;
    z-index: 9999 !important;
}

/* Ensure legend items are above everything */
#td-distribution-chart .chartjs-legend ul li {
    position: relative;
    z-index: 9999 !important;
}

.td-token-logo {
    position: absolute;
    width: calc(35% - 20px);
    height: auto;
    z-index: 10;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
    pointer-events: none;
    object-fit: contain;
    max-width: 200px;
}

@media (max-width: 767px) {
    .td-token-logo {
        transform: translateY(-15px);
    }
}

@media (min-width: 768px) {
    .td-token-logo {
        transform: translateY(-15px);
    }
}

@media (min-width: 1024px) {
    .td-token-logo {
        transform: translateY(-20px);
    }
}

.td-stats {
    background: #1a1a1a;
    border-radius: 1rem;
    padding: 1.5rem;
}

.td-stats__title {
    color: var(--td-primary-color);
    margin-bottom: 1.5rem;
}

.td-stats__item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: clamp(0.5rem, 2vw, 1rem);
    background: #242424;
    border-radius: 0.5rem;
    min-height: 3rem;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

@media (max-width: 480px) {
    .td-stats__item {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }
}

.td-stats__item:active {
    background: #2a2a2a;
}

.td-stats__label {
    color: var(--td-primary-color);
}

.td-stats__value {
    font-weight: bold;
    color: var(--td-text-color);
}

.td-token-icon {
    width: 2rem;
    height: 2rem;
    background: var(--td-primary-color);
    border-radius: 50%;
    margin-right: 0.5rem;
    display: inline-block;
    vertical-align: middle;
}

.td-total-tokens {
    font-size: 1.5rem;
    margin-top: 2rem;
    text-align: center;
    color: var(--td-primary-color);
}
