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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0a0a0a;
    color: #e0e0e0;
    min-height: 100vh;
}

/* Header */
.header {
    background: linear-gradient(135deg, #0d1b2a 0%, #1b2838 100%);
    border-bottom: 1px solid #333;
    padding: 12px 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-title {
    font-size: 22px;
    font-weight: 700;
    background: linear-gradient(135deg, #00ccff, #00ff88);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    white-space: nowrap;
}

.header-subtitle {
    font-size: 12px;
    color: #888;
    margin-top: -2px;
}

.header-actions {
    margin-left: auto;
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Search */
.search-area {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 16px;
}

.search-box {
    position: relative;
    width: 100%;
    max-width: 600px;
}

.search-box input {
    width: 100%;
    padding: 10px 36px 10px 14px;
    background: #1a1a2e;
    border: 1px solid #333;
    border-radius: 8px;
    color: #e0e0e0;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.search-box input:focus {
    border-color: #00ccff;
}

.search-box .clear-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 16px;
    display: none;
}

.search-box .clear-btn.visible { display: block; }

/* Group Filters */
.group-filters {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.group-btn {
    padding: 5px 12px;
    background: #1a1a2e;
    border: 1px solid #333;
    border-radius: 16px;
    color: #aaa;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
    white-space: nowrap;
}

.group-btn:hover {
    border-color: #555;
    color: #fff;
}

.group-btn.active {
    background: linear-gradient(135deg, #00ccff22, #00ff8822);
    border-color: #00ccff;
    color: #00ccff;
}

/* Source Info */
.source-info {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px 8px;
    font-size: 12px;
    color: #666;
}

/* Channel Grid */
.channel-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px 80px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
}

/* Channel Card */
.channel-card {
    background: #111;
    border: 1px solid #222;
    border-radius: 10px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.channel-card:hover {
    border-color: #00ccff44;
    background: #1a1a2e;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,204,255,0.1);
}

.channel-logo-wrap {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 6px;
}

.channel-logo {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

.channel-logo-fallback {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00ccff, #00ff88);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: bold;
    color: #000;
}

.channel-info {
    text-align: center;
    width: 100%;
}

.channel-name {
    font-size: 13px;
    font-weight: 600;
    color: #e0e0e0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.channel-group-badge {
    font-size: 10px;
    color: #888;
    margin-top: 2px;
}

.fav-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    opacity: 0.4;
    transition: opacity 0.2s;
    padding: 2px;
    line-height: 1;
}

.channel-card:hover .fav-btn {
    opacity: 0.8;
}

.fav-btn.active {
    opacity: 1;
}

/* Player Section */
.player-section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px 16px;
}

.player-section.hidden {
    display: none;
}

.player-wrapper {
    position: relative;
    background: #000;
    border-radius: 10px;
    overflow: hidden;
    aspect-ratio: 16/9;
}

.player-wrapper video {
    width: 100%;
    height: 100%;
    display: block;
    background: #000;
}

.player-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.7);
    z-index: 5;
}

.player-loading.hidden { display: none; }

.player-error {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.8);
    color: #ff4444;
    font-size: 14px;
    z-index: 5;
}

.player-error.hidden { display: none; }

.player-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
}

.player-title span {
    font-size: 14px;
    color: #ccc;
}

.close-player-btn {
    background: none;
    border: 1px solid #444;
    color: #aaa;
    padding: 4px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.close-player-btn:hover {
    border-color: #ff4444;
    color: #ff4444;
}

/* Buttons */
.btn {
    padding: 6px 14px;
    border: 1px solid #333;
    border-radius: 6px;
    background: #1a1a2e;
    color: #ccc;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.btn:hover {
    border-color: #555;
    color: #fff;
}

/* Loading */
.loading {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #888;
}

.spinner {
    width: 30px;
    height: 30px;
    border: 3px solid #333;
    border-top: 3px solid #00ccff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 12px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: #888;
}

/* Responsive */
@media (max-width: 768px) {
    .channel-container {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 8px;
    }
    .channel-logo-wrap {
        width: 48px;
        height: 48px;
    }
    .channel-name { font-size: 12px; }
    .header-title { font-size: 18px; }
}

@media (max-width: 480px) {
    .channel-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #0a0a0a; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #555; }
