* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    background-color: #0e0e10;
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    color: #efeff1;
    padding: 2rem 1rem;
}
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}
h1 {
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #9147ff, #b19eff);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    margin-bottom: 1.5rem;
}
.search-panel {
    background: #1f1f23;
    border-radius: 2rem;
    padding: 0.75rem 1.25rem;
    margin-bottom: 0.75rem;
    display: flex;
    gap: 0.75rem;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}
.input-group {
    flex: 2;
    min-width: 180px;
}
.input-group input {
    width: 100%;
    padding: 0.6rem 1rem;
    background: #0e0e10;
    border: 1px solid #3a3a3d;
    border-radius: 2rem;
    color: white;
    font-size: 0.9rem;
    transition: 0.2s;
}
.input-group input:focus {
    outline: none;
    border-color: #9147ff;
    box-shadow: 0 0 0 2px rgba(145,71,255,0.3);
}
button {
    background: #9147ff;
    border: none;
    padding: 0.6rem 1.4rem;
    border-radius: 2rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: white;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}
button:hover {
    background: #772ce8;
}
.spinner-container {
    text-align: center;
    margin-top: 0.5rem;
    margin-bottom: 1rem;
}
.spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid #3a3a3d;
    border-top-color: #9147ff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    visibility: hidden;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
.info-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
    width: 100%;
}
.total-count {
    background: #1f1f23;
    padding: 0.25rem 0.75rem;
    border-radius: 2rem;
    font-size: 0.8rem;
}
.sort-buttons {
    display: inline-flex;
    gap: 0;
    border-radius: 2rem;
    overflow: hidden;
    background: #1f1f23;
    border: 1px solid #3a3a3d;
}
.sort-btn {
    background: #1f1f23;
    border: none;
    padding: 0.3rem 0.9rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: #efeff1;
    cursor: pointer;
    transition: all 0.2s;
}
.sort-btn:first-child {
    border-radius: 2rem 0 0 2rem;
}
.sort-btn:last-child {
    border-radius: 0 2rem 2rem 0;
}
.sort-btn.active {
    background: #9147ff;
    color: white;
}
.sort-btn:hover:not(.active) {
    background: #2a2a2e;
}
.channels-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
}
.channel-card {
    flex: 0 0 180px;
    background: #1f1f23;
    border-radius: 0.75rem;
    overflow: hidden;
    transition: transform 0.15s, box-shadow 0.15s;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    border: 1px solid #2a2a2e;
}
.channel-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.4);
    border-color: #9147ff;
}
.avatar {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    background: #0e0e10;
}
.card-info {
    padding: 0.7rem;
}
.channel-name {
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
    word-break: break-word;
}
.follow-date {
    font-size: 0.7rem;
    color: #adadb8;
}
.empty-state, .error-message {
    text-align: center;
    padding: 2rem;
    background: #1f1f23;
    border-radius: 1rem;
    color: #adadb8;
    font-size: 0.9rem;
}
@media (min-width: 400px) and (max-width: 700px) {
    .channels-grid {
        gap: 0.8rem;
    }
    .channel-card {
        flex: 1 1 calc(50% - 0.8rem);
        min-width: 140px;
        max-width: 220px;
    }
}
@media (max-width: 399px) {
    .channel-card {
        flex: 1 1 calc(100% - 1rem);
        max-width: 280px;
    }
}
@media (max-width: 640px) {
    body { padding: 1rem; }
    .card-info { padding: 0.5rem; }
    .channel-name { font-size: 0.8rem; }
    .container { padding: 0 12px; }
}