.stats-grid {
    display: none;
    gap: 1rem;
    margin-top: 1.5rem;
}
.stats-grid.visible {
    display: grid;
    animation: fadeIn 0.5s;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

#decoding-stats.has-timelock {
    grid-template-columns: repeat(3, 1fr);
}
#decoding-stats.has-timelock #time-lock-stat {
    grid-column: 1 / -1;
}
#decoding-stats.has-password-security {
    grid-template-columns: repeat(2, 1fr);
}

#decoding-stats.has-timelock #time-lock-stat .value {
    justify-content: center;
    align-items: center;
    padding: 0.5rem 0;
}
#decoding-stats.has-timelock #time-lock-stat .countdown {
    font-size: 2rem;
}

.stat-item {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 0.5rem;
    min-height: 90px;
    text-align: right;
    transition: all 0.3s ease;
    height: 100%;
}
.stat-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px var(--shadow-color);
    border-color: var(--primary-color);
}
.stat-item .value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-color);
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    line-height: 1.2;
    flex-grow: 1;
}
.stat-item .value .dynamic-text {
    font-size: 1.05rem;
    line-height: 1.4;
    white-space: normal;
}
.stat-item .value .countdown {
    font-size: 1.3rem;
    direction: ltr;
    text-align: left;
}
.stat-item .value svg {
    width: 24px;
    height: 24px;
    color: var(--primary-color);
    flex-shrink: 0;
    margin-top: 2px;
}
.stat-item .label {
    font-size: 0.8rem;
    color: var(--text-muted-color);
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.25rem;
    cursor: help;
}
.stat-item .value.success { color: var(--success-color); }
.stat-item .value.success svg { color: var(--success-color); }
.stat-item .value.warning { color: var(--warning-color); }
.stat-item .value.warning svg { color: var(--warning-color); }

.stats-toggle-btn {
    display: none;
}

@media (max-width: 768px) {
    .stats-grid.visible {
        grid-template-columns: repeat(2, 1fr);
    }
    .stats-grid {
        gap: 0.75rem;
    }
    #encoder .stats-grid .stat-item:nth-last-child(-n+2) {
        grid-column: span 2;
    }
    
    #decoding-stats.has-timelock {
        grid-template-columns: 1fr 1fr;
    }
    #decoding-stats.has-timelock #stat-decoder-method,
    #decoding-stats.has-timelock #time-lock-stat {
        grid-column: span 2;
    }

    #decoding-stats.has-timelock #time-lock-stat .countdown {
        font-size: 1.8rem;
    }

    .stat-item {
        padding: 0.75rem;
    }
    .stat-item .value { font-size: 1.2rem; }
    .stat-item .value .dynamic-text { font-size: 0.95rem; }
    .stat-item .value .countdown { font-size: 1.1rem; }
    .stat-item .label { font-size: 0.7rem; }
}