:root {
    --bg-primary: #0f172a;
    --bg-secondary: rgba(30, 41, 59, 0.7);
    --border-color: rgba(148, 163, 184, 0.15);
    --accent-cyan: #06b6d4;
    --accent-purple: #8b5cf6;
    --accent-green: #10b981;
    --accent-orange: #f59e0b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
    --shadow-hover: 0 20px 60px rgba(0, 0, 0, 0.35);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: radial-gradient(ellipse at top left, #1e293b 0%, var(--bg-primary) 50%),
                radial-gradient(ellipse at bottom right, #312e81 0%, var(--bg-primary) 50%);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 24px;
}

header {
    text-align: center;
    padding: 50px 0 40px;
    position: relative;
}

header h1 {
    font-size: 2.8rem;
    font-weight: 800;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #22d3ee, #a78bfa, #f472b6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.05rem;
    max-width: 520px;
    margin: 0 auto;
}

.card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 28px;
    margin-bottom: 24px;
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-hover);
}

.card h2 {
    font-size: 1.25rem;
    margin-bottom: 20px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
}

.method-box {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.method {
    background: rgba(15, 23, 42, 0.5);
    padding: 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    transition: background 0.2s ease;
}

.method:hover {
    background: rgba(15, 23, 42, 0.7);
}

.method h3 {
    font-size: 1rem;
    margin-bottom: 14px;
    color: var(--text-primary);
    font-weight: 600;
}

.source-selector,
.cdn-selector {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.source-selector label,
.cdn-selector label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

.source-selector select,
.cdn-selector select {
    background: rgba(15, 23, 42, 0.8);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
}

.source-selector select:focus,
.cdn-selector select:focus {
    border-color: var(--accent-cyan);
}

.copy-box {
    display: flex;
    gap: 12px;
    align-items: center;
}

.copy-box code {
    flex: 1;
    background: rgba(2, 6, 23, 0.6);
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    font-family: 'SFMono-Regular', Consolas, monospace;
    font-size: 0.85rem;
    color: var(--accent-cyan);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    border: 1px solid var(--border-color);
}

.hint {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 10px;
}

.btn {
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan));
    color: #fff;
    border: none;
    padding: 10px 22px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.35);
    filter: brightness(1.1);
}

.btn:active {
    transform: translateY(0);
}

.btn-download {
    display: inline-block;
    text-decoration: none;
    background: linear-gradient(135deg, var(--accent-green), #059669);
}

.btn-download:hover {
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.35);
}

.btn-github {
    background: linear-gradient(135deg, #334155, #0f172a);
}

.btn-github:hover {
    box-shadow: 0 8px 25px rgba(51, 65, 85, 0.35);
}

.btn-test {
    background: linear-gradient(135deg, var(--accent-orange), #d97706);
}

.btn-test:hover {
    box-shadow: 0 8px 25px rgba(245, 158, 11, 0.35);
}

.player-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
}

.player-item {
    background: rgba(15, 23, 42, 0.5);
    padding: 20px 16px;
    border-radius: var(--radius-md);
    text-align: center;
    border: 1px solid var(--border-color);
    transition: transform 0.2s, background 0.2s;
}

.player-item:hover {
    transform: translateY(-4px);
    background: rgba(15, 23, 42, 0.8);
}

.player-item h4 {
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 600;
}

.player-item p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.tag {
    display: inline-block;
    background: rgba(6, 182, 212, 0.15);
    color: var(--accent-cyan);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.filter-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.filter-btn {
    background: rgba(15, 23, 42, 0.6);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 8px 18px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
    font-weight: 500;
}

.filter-btn:hover {
    color: var(--text-primary);
    border-color: var(--accent-cyan);
}

.filter-btn.active {
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan));
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.search-bar {
    margin-bottom: 20px;
}

.search-bar input {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-bar input:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15);
}

.search-bar input::placeholder {
    color: var(--text-secondary);
}

.channel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 16px;
}

.channel-item {
    background: rgba(15, 23, 42, 0.5);
    border-radius: var(--radius-md);
    padding: 18px 14px;
    text-align: center;
    border: 1px solid var(--border-color);
    transition: transform 0.25s, background 0.25s, box-shadow 0.25s;
}

.channel-item:hover {
    transform: translateY(-5px);
    background: rgba(15, 23, 42, 0.85);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
}

.channel-logo {
    width: 64px;
    height: 64px;
    margin: 0 auto 12px;
    border-radius: 50%;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid var(--border-color);
    transition: border-color 0.2s;
}

.channel-item:hover .channel-logo {
    border-color: var(--accent-cyan);
}

.channel-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 8px;
}

.channel-name {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.channel-category {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 14px;
    font-weight: 500;
}

.channel-item .btn-copy,
.channel-item .btn-play {
    padding: 6px 14px;
    font-size: 0.8rem;
    margin: 3px;
    border-radius: 8px;
}

.btn-copy {
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-primary);
}

.btn-copy:hover {
    background: rgba(148, 163, 184, 0.25);
    box-shadow: none;
}

.btn-play {
    background: rgba(16, 185, 129, 0.2);
    color: var(--accent-green);
}

.btn-play:hover {
    background: rgba(16, 185, 129, 0.3);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.2);
}

.pagination {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.page-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.page-buttons button {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.85rem;
    min-width: 38px;
}

.page-buttons button:hover:not(:disabled) {
    border-color: var(--accent-cyan);
    background: rgba(6, 182, 212, 0.1);
}

.page-buttons button.active {
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan));
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.page-buttons button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.stats {
    text-align: center;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.quick-stats {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
    font-size: 0.9rem;
}

.stats strong {
    color: var(--accent-cyan);
    font-weight: 700;
}

.detailed-stats {
    text-align: left;
}

.detailed-stats summary {
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.9rem;
    user-select: none;
}

.detailed-stats summary:hover {
    color: var(--text-primary);
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
    font-size: 0.9rem;
}

.stats-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.stats-table td:last-child {
    text-align: right;
    color: var(--accent-cyan);
    font-weight: 600;
}

.tutorial {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.step {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.step-num {
    width: 34px;
    height: 34px;
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
    font-size: 0.9rem;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.step-content h4 {
    color: var(--text-primary);
    margin-bottom: 4px;
    font-weight: 600;
}

.step-content p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.test-result {
    margin-top: 18px;
}

.test-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.test-item {
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
}

.test-item.valid {
    background: rgba(16, 185, 129, 0.12);
    color: var(--accent-green);
}

.test-item.invalid {
    background: rgba(239, 68, 68, 0.12);
    color: #f87171;
}

.test-summary {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(15, 23, 42, 0.95);
    color: #fff;
    padding: 14px 28px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.error {
    background: rgba(239, 68, 68, 0.95);
    border-color: rgba(239, 68, 68, 0.3);
}

footer {
    text-align: center;
    padding: 40px 0 30px;
    color: #64748b;
    font-size: 0.85rem;
}

.empty,
.error {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.error {
    color: #f87171;
}

@media (max-width: 640px) {
    .container {
        padding: 16px;
    }
    header h1 {
        font-size: 2rem;
    }
    .card {
        padding: 20px;
        border-radius: var(--radius-md);
    }
    .channel-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
    }
    .copy-box {
        flex-direction: column;
        align-items: stretch;
    }
    .copy-box code {
        font-size: 0.75rem;
    }
    .quick-stats {
        gap: 8px;
    }
    .page-buttons button {
        padding: 6px 10px;
    }
}
