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

:root {
    color-scheme: dark;
    --bg: #090b0f;
    --panel: #11151e;
    --panel-soft: #171d2b;
    --line: #242c40;
    --text: #eef2ff;
    --muted: #97a2bb;
    --accent: #8b5cf6;
    --accent-2: #3b82f6;
}

html, body {
    min-height: 100%;
    background: radial-gradient(circle at top, #10172a 0%, #090b0f 65%);
}

body {
    color: var(--text);
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    overflow-x: hidden;
}

.app-shell {
    padding: 16px 16px 96px;
}

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02));
    backdrop-filter: blur(12px);
}

.brand {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-logo {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    background: #0f1420;
    border: 1px solid #27314b;
    object-fit: contain;
    padding: 6px;
}

.brand-copy h1 {
    font-size: 18px;
    line-height: 1.15;
}

.brand-copy p {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
}

.status {
    padding: 7px 11px;
    border-radius: 999px;
    font-size: 12px;
    border: 1px solid;
    white-space: nowrap;
}

.status-online {
    color: #86efac;
    border-color: rgba(134, 239, 172, 0.35);
    background: rgba(74, 222, 128, 0.12);
}

.search-wrap {
    margin-bottom: 10px;
}

.search-input {
    width: 100%;
    border: 1px solid var(--line);
    background: rgba(15, 20, 31, 0.9);
    color: var(--text);
    border-radius: 14px;
    padding: 13px 14px;
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-input::placeholder {
    color: #6f7c98;
}

.search-input:focus {
    outline: none;
    border-color: rgba(139, 92, 246, 0.85);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.18);
}

.categories {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 6px 0 14px;
    margin-bottom: 4px;
    -webkit-overflow-scrolling: touch;
}

.categories::-webkit-scrollbar {
    height: 4px;
}

.categories::-webkit-scrollbar-thumb {
    background: #364059;
    border-radius: 999px;
}

.category-btn {
    flex: 0 0 auto;
    border: 1px solid #2f3a54;
    background: #151d2d;
    color: #d2daf0;
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.category-btn.active {
    border-color: transparent;
    color: #fff;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow: 0 10px 24px rgba(59, 130, 246, 0.25);
}

.channels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.channel-card {
    border: 1px solid #2a344d;
    border-radius: 14px;
    background: linear-gradient(170deg, #12192a 0%, #0d1220 100%);
    display: grid;
    grid-template-columns: 64px 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 12px;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.channel-card:hover {
    transform: translateY(-2px);
    border-color: rgba(139, 92, 246, 0.8);
}

.channel-logo {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    border: 1px solid #293248;
    background: #0f1420;
    display: grid;
    place-items: center;
    overflow: hidden;
}

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

.channel-name {
    font-size: 15px;
    font-weight: 700;
    color: #f6f8ff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.channel-category {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
}

.channel-favorite {
    border: none;
    background: transparent;
    padding: 0;
    font-size: 20px;
    opacity: 0.8;
}

.channel-favorite.active,
.channel-favorite:hover {
    opacity: 1;
}

.empty-state {
    grid-column: 1 / -1;
    border: 1px dashed #33405f;
    border-radius: 14px;
    padding: 44px 20px;
    text-align: center;
    background: rgba(13, 18, 31, 0.7);
}

.empty-state-icon {
    font-size: 38px;
    margin-bottom: 10px;
}

.empty-state-text {
    color: #c4cee4;
    font-size: 14px;
}

.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: rgba(9, 11, 15, 0.95);
    backdrop-filter: blur(12px);
}

.nav-btn {
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    color: #95a2be;
    padding: 8px 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 12px;
}

.nav-btn.active {
    border-color: #2f3a54;
    color: #fff;
    background: rgba(67, 86, 126, 0.24);
}

.nav-icon {
    font-size: 19px;
}

@media (max-width: 600px) {
    .channels-grid {
        grid-template-columns: 1fr;
    }
}