/* StreamHub — contained inside the tool widget */
.tool-widget:has(.sh-app) {
    padding: 0;
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.sh-app {
    --sh-bg: #0b0e14;
    --sh-bg-elev: #131722;
    --sh-bg-elev-2: #1b2130;
    --sh-border: #262d3f;
    --sh-text: #e9ecf5;
    --sh-text-dim: #9aa3b8;
    --sh-accent: #6c5ce7;
    --sh-accent-2: #00d2b4;
    --sh-danger: #ef4d5e;
    --sh-radius: 14px;
    --sh-radius-sm: 8px;
    --sh-shadow: 0 10px 30px rgba(0,0,0,.35);
    --sh-ctrl: 40px;
    --sh-ctrl-main: 48px;
    --sh-card-h: 190px;
    --sh-list-h: 84px;
    --sh-gap: 14px;
    --sh-list-h-px: 560px;
    container-type: inline-size;
    container-name: streamhub;
    position: relative;
    width: 100%;
    max-width: 100%;
    color: var(--sh-text);
    background: var(--sh-bg);
    border: 1px solid var(--sh-border);
    border-radius: var(--sh-radius);
    overflow-x: clip;
    overflow-y: visible;
    isolation: isolate;
    font-size: 15px;
    -webkit-text-size-adjust: 100%;
}
.sh-app[data-theme="light"] {
    --sh-bg: #f5f6fb;
    --sh-bg-elev: #ffffff;
    --sh-bg-elev-2: #eef0f8;
    --sh-border: #dde1ee;
    --sh-text: #171a24;
    --sh-text-dim: #666f87;
    --sh-shadow: 0 10px 30px rgba(20,20,40,.08);
}
.sh-app *, .sh-app *::before, .sh-app *::after { box-sizing: border-box; }
.sh-app button { font: inherit; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.sh-app input, .sh-app select { touch-action: manipulation; max-width: 100%; }
.sh-app [hidden] { display: none !important; }

.sh-sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.sh-shell {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    min-height: 0;
}

.sh-label {
    display: block;
    margin: 0 0 5px;
    color: var(--sh-text-dim);
    font-size: .72em;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.sh-label-inline {
    flex: none;
    margin: 0;
    padding: 0 2px 0 0;
    white-space: nowrap;
    align-self: center;
}

.sh-toolbar {
    background: var(--sh-bg-elev);
    border-bottom: 1px solid var(--sh-border);
    padding: 12px;
    flex: 0 0 auto;
    min-width: 0;
}
.sh-toolbar-row {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.4fr) auto;
    gap: 10px;
    align-items: end;
    min-width: 0;
}
.sh-playlist-select-wrap,
.sh-search-wrap { min-width: 0; width: 100%; }
.sh-toolbar-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    padding-bottom: 1px;
    flex: none;
}

.sh-select, .sh-input, .sh-search {
    background: var(--sh-bg-elev-2);
    color: var(--sh-text);
    border: 1px solid var(--sh-border);
    border-radius: var(--sh-radius-sm);
    padding: 9px 12px;
    width: 100%;
    min-height: 42px;
}
.sh-select-sm {
    min-height: 34px;
    padding: 4px 8px;
    width: auto;
    max-width: 92px;
    font-size: .82em;
}
.sh-select:focus, .sh-input:focus, .sh-search:focus {
    outline: 2px solid var(--sh-accent);
    outline-offset: 1px;
}

.sh-btn {
    background: var(--sh-bg-elev-2);
    color: var(--sh-text);
    border: 1px solid var(--sh-border);
    border-radius: var(--sh-radius-sm);
    padding: 9px 14px;
    min-height: 42px;
    cursor: pointer;
}
.sh-btn:hover { border-color: var(--sh-accent); }
.sh-btn:active { transform: scale(.97); }
.sh-btn-icon { padding: 9px 12px; font-size: 1.05em; line-height: 1; }
.sh-btn-primary { background: var(--sh-accent); border-color: var(--sh-accent); color: #fff; }

.sh-tabs {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 12px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    min-width: 0;
    padding-bottom: 1px;
}
.sh-tabs::-webkit-scrollbar { display: none; }
.sh-tab {
    background: transparent;
    border: none;
    color: var(--sh-text-dim);
    padding: 8px 14px;
    border-radius: var(--sh-radius-sm);
    cursor: pointer;
    white-space: nowrap;
    font-weight: 600;
    font-size: .92em;
    flex: none;
}
.sh-tab:hover { color: var(--sh-text); }
.sh-tab.is-active { background: var(--sh-bg-elev-2); color: var(--sh-text); }
.sh-tab-short { display: none; }
.sh-tabs .sh-pin-lock-btn {
    margin-left: auto;
    flex: none;
}

.sh-cat-row,
.sh-az-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    padding: 10px 12px;
    min-width: 0;
    /* Fixed row height so layout does not jump when chips/A–Z fill in */
    min-height: 64px;
    height: 64px;
    box-sizing: border-box;
    background: var(--sh-bg-elev-2);
    border: 1px solid var(--sh-border);
    border-radius: var(--sh-radius-sm);
    overflow: hidden;
}
.sh-az-row {
    margin-top: 10px;
    min-height: 56px;
    height: 56px;
}
.sh-pin-lock-btn {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid rgba(239, 68, 68, .45);
    background: rgba(239, 68, 68, .14);
    color: #fca5a5;
    font-size: .78em;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}
.sh-pin-lock-btn[hidden] { display: none !important; }
.sh-pin-lock-btn:hover {
    background: rgba(239, 68, 68, .28);
    border-color: rgba(239, 68, 68, .7);
    color: #fecaca;
}
.sh-categories,
.sh-az-bar {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    min-width: 0;
    flex: 1;
    height: 42px;
    min-height: 42px;
    padding: 0 4px 0 2px;
    margin: 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    mask-image: linear-gradient(90deg, #000 0%, #000 calc(100% - 18px), transparent 100%);
}
.sh-categories[hidden],
.sh-az-bar[hidden] {
    display: flex !important; /* keep row size stable; content may be empty */
    visibility: hidden;
}
.sh-categories::-webkit-scrollbar,
.sh-az-bar::-webkit-scrollbar { display: none; width: 0; height: 0; }

/* Category chips — each category gets its own color via data-cat */
.sh-chip {
    --cat-bg: rgba(154, 163, 184, .12);
    --cat-border: rgba(154, 163, 184, .4);
    --cat-text: #c4cad8;
    --cat-solid: #8b93a7;
    --cat-on: #10131a;
    flex: none;
    background: var(--cat-bg);
    border: 1px solid var(--cat-border);
    color: var(--cat-text);
    padding: 0 14px;
    height: 36px;
    min-height: 36px;
    border-radius: 999px;
    font-size: .85em;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s ease, border-color .15s ease, color .15s ease, filter .15s ease;
    box-sizing: border-box;
}
.sh-chip:hover {
    filter: brightness(1.12);
    border-color: var(--cat-solid);
}
.sh-chip.is-active {
    background: var(--cat-solid);
    border-color: var(--cat-solid);
    color: var(--cat-on);
    font-weight: 700;
    filter: none;
}

/*
 * Category palette — must use #StreamHubApp prefix so it beats
 * #StreamHubApp .sh-card-group defaults (otherwise every badge stays purple).
 */
#StreamHubApp .sh-chip[data-cat="all"], #StreamHubApp .sh-card-group[data-cat="all"] { --cat-bg: rgba(148,163,184,.18); --cat-border: #94a3b8; --cat-text: #d0d7e4; --cat-solid: #94a3b8; --cat-on: #0f172a; }
#StreamHubApp .sh-chip[data-cat="sports"], #StreamHubApp .sh-card-group[data-cat="sports"] { --cat-bg: rgba(34,197,94,.2); --cat-border: #22c55e; --cat-text: #86efac; --cat-solid: #22c55e; --cat-on: #052e16; }
#StreamHubApp .sh-chip[data-cat="news"], #StreamHubApp .sh-card-group[data-cat="news"] { --cat-bg: rgba(239,68,68,.2); --cat-border: #ef4444; --cat-text: #fca5a5; --cat-solid: #ef4444; --cat-on: #450a0a; }
#StreamHubApp .sh-chip[data-cat="movies"], #StreamHubApp .sh-card-group[data-cat="movies"] { --cat-bg: rgba(168,85,247,.2); --cat-border: #a855f7; --cat-text: #d8b4fe; --cat-solid: #a855f7; --cat-on: #2e1065; }
#StreamHubApp .sh-chip[data-cat="entertainment"], #StreamHubApp .sh-card-group[data-cat="entertainment"] { --cat-bg: rgba(236,72,153,.2); --cat-border: #ec4899; --cat-text: #f9a8d4; --cat-solid: #ec4899; --cat-on: #500724; }
#StreamHubApp .sh-chip[data-cat="kids"], #StreamHubApp .sh-card-group[data-cat="kids"] { --cat-bg: rgba(251,191,36,.22); --cat-border: #fbbf24; --cat-text: #fde68a; --cat-solid: #fbbf24; --cat-on: #422006; }
#StreamHubApp .sh-chip[data-cat="music"], #StreamHubApp .sh-card-group[data-cat="music"] { --cat-bg: rgba(45,212,191,.2); --cat-border: #2dd4bf; --cat-text: #99f6e4; --cat-solid: #2dd4bf; --cat-on: #042f2e; }
#StreamHubApp .sh-chip[data-cat="series"], #StreamHubApp .sh-card-group[data-cat="series"] { --cat-bg: rgba(99,102,241,.2); --cat-border: #6366f1; --cat-text: #a5b4fc; --cat-solid: #6366f1; --cat-on: #1e1b4b; }
#StreamHubApp .sh-chip[data-cat="documentary"], #StreamHubApp .sh-card-group[data-cat="documentary"] { --cat-bg: rgba(20,184,166,.2); --cat-border: #14b8a6; --cat-text: #5eead4; --cat-solid: #14b8a6; --cat-on: #042f2e; }
#StreamHubApp .sh-chip[data-cat="comedy"], #StreamHubApp .sh-card-group[data-cat="comedy"] { --cat-bg: rgba(250,204,21,.22); --cat-border: #eab308; --cat-text: #fde047; --cat-solid: #eab308; --cat-on: #422006; }
#StreamHubApp .sh-chip[data-cat="animation"], #StreamHubApp .sh-card-group[data-cat="animation"] { --cat-bg: rgba(244,114,182,.2); --cat-border: #f472b6; --cat-text: #f9a8d4; --cat-solid: #f472b6; --cat-on: #500724; }
#StreamHubApp .sh-chip[data-cat="religious"], #StreamHubApp .sh-card-group[data-cat="religious"] { --cat-bg: rgba(217,119,6,.2); --cat-border: #d97706; --cat-text: #fcd34d; --cat-solid: #d97706; --cat-on: #451a03; }
#StreamHubApp .sh-chip[data-cat="lifestyle"], #StreamHubApp .sh-card-group[data-cat="lifestyle"] { --cat-bg: rgba(244,63,94,.2); --cat-border: #f43f5e; --cat-text: #fda4af; --cat-solid: #f43f5e; --cat-on: #4c0519; }
#StreamHubApp .sh-chip[data-cat="education"], #StreamHubApp .sh-card-group[data-cat="education"] { --cat-bg: rgba(59,130,246,.2); --cat-border: #3b82f6; --cat-text: #93c5fd; --cat-solid: #3b82f6; --cat-on: #172554; }
#StreamHubApp .sh-chip[data-cat="business"], #StreamHubApp .sh-card-group[data-cat="business"] { --cat-bg: rgba(100,116,139,.22); --cat-border: #64748b; --cat-text: #cbd5e1; --cat-solid: #64748b; --cat-on: #0f172a; }
#StreamHubApp .sh-chip[data-cat="culture"], #StreamHubApp .sh-card-group[data-cat="culture"] { --cat-bg: rgba(192,132,252,.2); --cat-border: #c084fc; --cat-text: #e9d5ff; --cat-solid: #c084fc; --cat-on: #3b0764; }
#StreamHubApp .sh-chip[data-cat="family"], #StreamHubApp .sh-card-group[data-cat="family"] { --cat-bg: rgba(52,211,153,.2); --cat-border: #34d399; --cat-text: #a7f3d0; --cat-solid: #34d399; --cat-on: #022c22; }
#StreamHubApp .sh-chip[data-cat="general"], #StreamHubApp .sh-card-group[data-cat="general"] { --cat-bg: rgba(156,163,175,.2); --cat-border: #9ca3af; --cat-text: #d1d5db; --cat-solid: #9ca3af; --cat-on: #111827; }
#StreamHubApp .sh-chip[data-cat="cooking"], #StreamHubApp .sh-card-group[data-cat="cooking"] { --cat-bg: rgba(249,115,22,.2); --cat-border: #f97316; --cat-text: #fdba74; --cat-solid: #f97316; --cat-on: #431407; }
#StreamHubApp .sh-chip[data-cat="travel"], #StreamHubApp .sh-card-group[data-cat="travel"] { --cat-bg: rgba(6,182,212,.2); --cat-border: #06b6d4; --cat-text: #67e8f9; --cat-solid: #06b6d4; --cat-on: #083344; }
#StreamHubApp .sh-chip[data-cat="science"], #StreamHubApp .sh-card-group[data-cat="science"] { --cat-bg: rgba(14,165,233,.2); --cat-border: #0ea5e9; --cat-text: #7dd3fc; --cat-solid: #0ea5e9; --cat-on: #082f49; }
#StreamHubApp .sh-chip[data-cat="outdoor"], #StreamHubApp .sh-card-group[data-cat="outdoor"] { --cat-bg: rgba(132,204,22,.2); --cat-border: #84cc16; --cat-text: #bef264; --cat-solid: #84cc16; --cat-on: #1a2e05; }
#StreamHubApp .sh-chip[data-cat="classic"], #StreamHubApp .sh-card-group[data-cat="classic"] { --cat-bg: rgba(180,83,9,.22); --cat-border: #b45309; --cat-text: #fbbf24; --cat-solid: #b45309; --cat-on: #fff7ed; }
#StreamHubApp .sh-chip[data-cat="shop"], #StreamHubApp .sh-card-group[data-cat="shop"] { --cat-bg: rgba(234,179,8,.2); --cat-border: #ca8a04; --cat-text: #fde047; --cat-solid: #ca8a04; --cat-on: #422006; }
#StreamHubApp .sh-chip[data-cat="weather"], #StreamHubApp .sh-card-group[data-cat="weather"] { --cat-bg: rgba(56,189,248,.2); --cat-border: #38bdf8; --cat-text: #bae6fd; --cat-solid: #38bdf8; --cat-on: #0c4a6e; }
#StreamHubApp .sh-chip[data-cat="legislative"], #StreamHubApp .sh-card-group[data-cat="legislative"] { --cat-bg: rgba(71,85,105,.24); --cat-border: #64748b; --cat-text: #cbd5e1; --cat-solid: #475569; --cat-on: #f8fafc; }
#StreamHubApp .sh-chip[data-cat="public"], #StreamHubApp .sh-card-group[data-cat="public"] { --cat-bg: rgba(2,132,199,.2); --cat-border: #0284c7; --cat-text: #bae6fd; --cat-solid: #0284c7; --cat-on: #f0f9ff; }
#StreamHubApp .sh-chip[data-cat="auto"], #StreamHubApp .sh-card-group[data-cat="auto"] { --cat-bg: rgba(248,113,113,.2); --cat-border: #f87171; --cat-text: #fecaca; --cat-solid: #f87171; --cat-on: #450a0a; }
#StreamHubApp .sh-chip[data-cat="relax"], #StreamHubApp .sh-card-group[data-cat="relax"] { --cat-bg: rgba(167,139,250,.2); --cat-border: #a78bfa; --cat-text: #ddd6fe; --cat-solid: #a78bfa; --cat-on: #2e1065; }
#StreamHubApp .sh-chip[data-cat="interactive"], #StreamHubApp .sh-card-group[data-cat="interactive"] { --cat-bg: rgba(34,211,238,.2); --cat-border: #22d3ee; --cat-text: #a5f3fc; --cat-solid: #22d3ee; --cat-on: #083344; }
#StreamHubApp .sh-chip[data-cat="xxx"], #StreamHubApp .sh-card-group[data-cat="xxx"] { --cat-bg: rgba(220,38,38,.22); --cat-border: #dc2626; --cat-text: #fca5a5; --cat-solid: #dc2626; --cat-on: #fff1f2; }
#StreamHubApp .sh-chip[data-cat="streamhub"], #StreamHubApp .sh-card-group[data-cat="streamhub"] { --cat-bg: rgba(108,92,231,.2); --cat-border: #6c5ce7; --cat-text: #c4b5fd; --cat-solid: #6c5ce7; --cat-on: #f5f3ff; }
#StreamHubApp .sh-chip[data-cat="iptv"], #StreamHubApp .sh-card-group[data-cat="iptv"] { --cat-bg: rgba(14,165,233,.2); --cat-border: #0ea5e9; --cat-text: #7dd3fc; --cat-solid: #0ea5e9; --cat-on: #f0f9ff; }
#StreamHubApp .sh-chip[data-cat="undefined"], #StreamHubApp .sh-card-group[data-cat="undefined"] { --cat-bg: rgba(113,113,122,.2); --cat-border: #71717a; --cat-text: #d4d4d8; --cat-solid: #71717a; --cat-on: #18181b; }

/* Paint chips + channel badges from the same tokens */
#StreamHubApp .sh-chip[data-cat],
#StreamHubApp .sh-card-group[data-cat],
#StreamHubApp .sh-chip[class*="sh-cat-"],
#StreamHubApp .sh-card-group[class*="sh-cat-"] {
    background: var(--cat-bg) !important;
    border-color: var(--cat-border) !important;
    color: var(--cat-text) !important;
}
#StreamHubApp .sh-chip[data-cat].is-active,
#StreamHubApp .sh-chip[class*="sh-cat-"].is-active {
    background: var(--cat-solid) !important;
    border-color: var(--cat-solid) !important;
    color: var(--cat-on) !important;
}

/* Class fallback mirrors data-cat (beats any leftover defaults) */
#StreamHubApp .sh-cat-all { --cat-bg: rgba(148,163,184,.18); --cat-border: #94a3b8; --cat-text: #d0d7e4; --cat-solid: #94a3b8; --cat-on: #0f172a; }
#StreamHubApp .sh-cat-sports { --cat-bg: rgba(34,197,94,.2); --cat-border: #22c55e; --cat-text: #86efac; --cat-solid: #22c55e; --cat-on: #052e16; }
#StreamHubApp .sh-cat-news { --cat-bg: rgba(239,68,68,.2); --cat-border: #ef4444; --cat-text: #fca5a5; --cat-solid: #ef4444; --cat-on: #450a0a; }
#StreamHubApp .sh-cat-movies { --cat-bg: rgba(168,85,247,.2); --cat-border: #a855f7; --cat-text: #d8b4fe; --cat-solid: #a855f7; --cat-on: #2e1065; }
#StreamHubApp .sh-cat-entertainment { --cat-bg: rgba(236,72,153,.2); --cat-border: #ec4899; --cat-text: #f9a8d4; --cat-solid: #ec4899; --cat-on: #500724; }
#StreamHubApp .sh-cat-kids { --cat-bg: rgba(251,191,36,.22); --cat-border: #fbbf24; --cat-text: #fde68a; --cat-solid: #fbbf24; --cat-on: #422006; }
#StreamHubApp .sh-cat-music { --cat-bg: rgba(45,212,191,.2); --cat-border: #2dd4bf; --cat-text: #99f6e4; --cat-solid: #2dd4bf; --cat-on: #042f2e; }
#StreamHubApp .sh-cat-series { --cat-bg: rgba(99,102,241,.2); --cat-border: #6366f1; --cat-text: #a5b4fc; --cat-solid: #6366f1; --cat-on: #1e1b4b; }
#StreamHubApp .sh-cat-documentary { --cat-bg: rgba(20,184,166,.2); --cat-border: #14b8a6; --cat-text: #5eead4; --cat-solid: #14b8a6; --cat-on: #042f2e; }
#StreamHubApp .sh-cat-comedy { --cat-bg: rgba(250,204,21,.22); --cat-border: #eab308; --cat-text: #fde047; --cat-solid: #eab308; --cat-on: #422006; }
#StreamHubApp .sh-cat-animation { --cat-bg: rgba(244,114,182,.2); --cat-border: #f472b6; --cat-text: #f9a8d4; --cat-solid: #f472b6; --cat-on: #500724; }
#StreamHubApp .sh-cat-religious { --cat-bg: rgba(217,119,6,.2); --cat-border: #d97706; --cat-text: #fcd34d; --cat-solid: #d97706; --cat-on: #451a03; }
#StreamHubApp .sh-cat-lifestyle { --cat-bg: rgba(244,63,94,.2); --cat-border: #f43f5e; --cat-text: #fda4af; --cat-solid: #f43f5e; --cat-on: #4c0519; }
#StreamHubApp .sh-cat-education { --cat-bg: rgba(59,130,246,.2); --cat-border: #3b82f6; --cat-text: #93c5fd; --cat-solid: #3b82f6; --cat-on: #172554; }
#StreamHubApp .sh-cat-business { --cat-bg: rgba(100,116,139,.22); --cat-border: #64748b; --cat-text: #cbd5e1; --cat-solid: #64748b; --cat-on: #0f172a; }
#StreamHubApp .sh-cat-culture { --cat-bg: rgba(192,132,252,.2); --cat-border: #c084fc; --cat-text: #e9d5ff; --cat-solid: #c084fc; --cat-on: #3b0764; }
#StreamHubApp .sh-cat-family { --cat-bg: rgba(52,211,153,.2); --cat-border: #34d399; --cat-text: #a7f3d0; --cat-solid: #34d399; --cat-on: #022c22; }
#StreamHubApp .sh-cat-general { --cat-bg: rgba(156,163,175,.2); --cat-border: #9ca3af; --cat-text: #d1d5db; --cat-solid: #9ca3af; --cat-on: #111827; }
#StreamHubApp .sh-cat-cooking { --cat-bg: rgba(249,115,22,.2); --cat-border: #f97316; --cat-text: #fdba74; --cat-solid: #f97316; --cat-on: #431407; }
#StreamHubApp .sh-cat-travel { --cat-bg: rgba(6,182,212,.2); --cat-border: #06b6d4; --cat-text: #67e8f9; --cat-solid: #06b6d4; --cat-on: #083344; }
#StreamHubApp .sh-cat-science { --cat-bg: rgba(14,165,233,.2); --cat-border: #0ea5e9; --cat-text: #7dd3fc; --cat-solid: #0ea5e9; --cat-on: #082f49; }
#StreamHubApp .sh-cat-outdoor { --cat-bg: rgba(132,204,22,.2); --cat-border: #84cc16; --cat-text: #bef264; --cat-solid: #84cc16; --cat-on: #1a2e05; }
#StreamHubApp .sh-cat-classic { --cat-bg: rgba(180,83,9,.22); --cat-border: #b45309; --cat-text: #fbbf24; --cat-solid: #b45309; --cat-on: #fff7ed; }
#StreamHubApp .sh-cat-shop { --cat-bg: rgba(234,179,8,.2); --cat-border: #ca8a04; --cat-text: #fde047; --cat-solid: #ca8a04; --cat-on: #422006; }
#StreamHubApp .sh-cat-weather { --cat-bg: rgba(56,189,248,.2); --cat-border: #38bdf8; --cat-text: #bae6fd; --cat-solid: #38bdf8; --cat-on: #0c4a6e; }
#StreamHubApp .sh-cat-legislative { --cat-bg: rgba(71,85,105,.24); --cat-border: #64748b; --cat-text: #cbd5e1; --cat-solid: #475569; --cat-on: #f8fafc; }
#StreamHubApp .sh-cat-public { --cat-bg: rgba(2,132,199,.2); --cat-border: #0284c7; --cat-text: #bae6fd; --cat-solid: #0284c7; --cat-on: #f0f9ff; }
#StreamHubApp .sh-cat-auto { --cat-bg: rgba(248,113,113,.2); --cat-border: #f87171; --cat-text: #fecaca; --cat-solid: #f87171; --cat-on: #450a0a; }
#StreamHubApp .sh-cat-relax { --cat-bg: rgba(167,139,250,.2); --cat-border: #a78bfa; --cat-text: #ddd6fe; --cat-solid: #a78bfa; --cat-on: #2e1065; }
#StreamHubApp .sh-cat-interactive { --cat-bg: rgba(34,211,238,.2); --cat-border: #22d3ee; --cat-text: #a5f3fc; --cat-solid: #22d3ee; --cat-on: #083344; }
#StreamHubApp .sh-cat-xxx { --cat-bg: rgba(220,38,38,.22); --cat-border: #dc2626; --cat-text: #fca5a5; --cat-solid: #dc2626; --cat-on: #fff1f2; }
#StreamHubApp .sh-cat-streamhub { --cat-bg: rgba(108,92,231,.2); --cat-border: #6c5ce7; --cat-text: #c4b5fd; --cat-solid: #6c5ce7; --cat-on: #f5f3ff; }
#StreamHubApp .sh-cat-iptv { --cat-bg: rgba(14,165,233,.2); --cat-border: #0ea5e9; --cat-text: #7dd3fc; --cat-solid: #0ea5e9; --cat-on: #f0f9ff; }
#StreamHubApp .sh-cat-undefined { --cat-bg: rgba(113,113,122,.2); --cat-border: #71717a; --cat-text: #d4d4d8; --cat-solid: #71717a; --cat-on: #18181b; }

.sh-app[data-theme="light"] .sh-chip {
    --cat-bg: color-mix(in srgb, var(--cat-solid) 12%, #fff);
    --cat-border: color-mix(in srgb, var(--cat-solid) 40%, #ccd);
    --cat-text: color-mix(in srgb, var(--cat-solid) 78%, #111);
}
.sh-app[data-theme="light"] .sh-chip.is-active {
    color: #fff;
    --cat-on: #fff;
}

/* A–Z jump — warm amber (clearly different from categories) */
.sh-az-btn {
    flex: none;
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    border-radius: 8px;
    border: 1px solid rgba(240, 162, 2, .4);
    background: rgba(240, 162, 2, .12);
    color: #ffd58a;
    font-size: .74em;
    font-weight: 700;
    cursor: pointer;
    padding: 0;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.sh-az-btn:hover:not(:disabled) {
    background: rgba(240, 162, 2, .28);
    border-color: rgba(240, 162, 2, .7);
    color: #ffe8b8;
}
.sh-az-btn.is-active {
    background: #f0a202;
    border-color: #ffb830;
    color: #1a1200;
}
.sh-az-btn:disabled {
    opacity: .28;
    cursor: default;
    background: transparent;
    border-color: var(--sh-border);
    color: var(--sh-text-dim);
}
.sh-app[data-theme="light"] .sh-az-btn {
    background: rgba(200, 120, 0, .1);
    border-color: rgba(190, 110, 0, .35);
    color: #9a5a00;
}
.sh-app[data-theme="light"] .sh-az-btn.is-active {
    background: #e89200;
    border-color: #c97a00;
    color: #fff;
}

.sh-cat-row {
    background: linear-gradient(180deg, rgba(0, 210, 180, .06), var(--sh-bg-elev-2));
    border-color: rgba(0, 210, 180, .22);
}
.sh-az-row {
    background: linear-gradient(180deg, rgba(240, 162, 2, .06), var(--sh-bg-elev-2));
    border-color: rgba(240, 162, 2, .22);
}

.sh-channel-meta {
    margin: 10px 0 0;
    color: var(--sh-text-dim);
    font-size: .82em;
    text-align: left;
}

.sh-panel {
    padding: 12px;
    min-width: 0;
    flex: 0 0 auto;
}
.sh-browse-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
    min-width: 0;
    padding: 14px;
}
.sh-note {
    color: var(--sh-text-dim);
    font-size: .88em;
    text-align: center;
    padding: 28px 10px;
}

.sh-empty-state {
    text-align: center;
    padding: 40px 16px;
    color: var(--sh-text-dim);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 220px;
    border: 1px dashed var(--sh-border);
    border-radius: var(--sh-radius-sm);
    background: linear-gradient(180deg, rgba(108, 92, 231, .06), transparent 70%);
    box-sizing: border-box;
}
.sh-empty-icon { font-size: 2.2em; margin: 0 0 6px; line-height: 1; }
.sh-empty-state h3 {
    color: var(--sh-text);
    margin: 0 0 6px;
    font-size: 1.05em;
    font-weight: 750;
    letter-spacing: -.01em;
}
.sh-empty-state p {
    max-width: 420px;
    margin: 0 auto 16px;
    line-height: 1.5;
    font-size: .92em;
}
.sh-empty-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    width: 100%;
}
.sh-empty-actions .sh-btn {
    min-width: min(100%, 200px);
}

/* Fixed-height scroller — never expands the page */
.sh-virtual-host {
    position: relative;
    width: 100%;
    height: var(--sh-list-h-px);
    max-height: var(--sh-list-h-px);
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    scroll-behavior: auto; /* finger scroll stays native; JS uses smooth scrollTo */
    border: 1px solid var(--sh-border);
    border-radius: var(--sh-radius-sm);
    background: var(--sh-bg);
    overscroll-behavior-y: contain;
    contain: layout paint style;
    padding: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(154, 163, 184, .35) transparent;
}
.sh-virtual-host::-webkit-scrollbar {
    width: 8px;
}
.sh-virtual-host::-webkit-scrollbar-track {
    background: transparent;
}
.sh-virtual-host::-webkit-scrollbar-thumb {
    background: rgba(154, 163, 184, .32);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
}
.sh-virtual-host::-webkit-scrollbar-thumb:hover {
    background: rgba(154, 163, 184, .55);
    background-clip: padding-box;
}
.sh-virtual-spacer {
    position: relative;
    width: 100%;
    pointer-events: none;
}
.sh-virtual-window {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    padding: 10px;
    pointer-events: auto;
    will-change: transform;
    box-sizing: border-box;
    max-width: 100%;
}

#StreamHubApp .sh-grid,
.sh-app .sh-grid {
    display: grid;
    grid-template-columns: repeat(var(--sh-cols, 4), minmax(0, 1fr));
    gap: var(--sh-gap, 14px);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}
#StreamHubApp.sh-list-view .sh-virtual-window,
#StreamHubApp.sh-list-view .sh-grid,
.sh-app.sh-list-view .sh-virtual-window,
.sh-app.sh-list-view .sh-grid {
    grid-template-columns: 1fr;
}

#StreamHubApp .sh-virtual-window {
    padding: 14px;
}

#StreamHubApp .sh-card,
.sh-app .sh-card {
    background: var(--sh-bg-elev);
    border: 1px solid var(--sh-border);
    border-radius: 14px;
    padding: 12px 10px 18px;
    margin: 0;
    cursor: pointer;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    text-align: center;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    height: var(--sh-card-h);
    min-height: var(--sh-card-h);
    max-height: var(--sh-card-h);
    overflow: hidden;
    box-sizing: border-box;
}
#StreamHubApp .sh-card:hover,
#StreamHubApp .sh-card:focus-visible {
    border-color: var(--sh-accent);
    background: var(--sh-bg-elev-2);
    outline: none;
}
#StreamHubApp.sh-list-view .sh-card,
.sh-app.sh-list-view .sh-card {
    flex-direction: row;
    text-align: left;
    align-items: center;
    padding: 12px 16px;
    height: var(--sh-list-h);
    min-height: var(--sh-list-h);
    max-height: var(--sh-list-h);
    gap: 14px;
}

/* Bright logo plate — keeps thin logo text readable */
#StreamHubApp .sh-card-logo,
.sh-app .sh-card-logo {
    width: 84px;
    height: 84px;
    min-width: 84px;
    min-height: 84px;
    border-radius: 16px;
    background: #ffffff;
    border: 1px solid rgba(255,255,255,.18);
    box-shadow: 0 1px 0 rgba(255,255,255,.08), inset 0 0 0 1px rgba(0,0,0,.04);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex: none;
    padding: 10px;
    margin: 4px 0 2px;
    position: relative;
}
#StreamHubApp[data-theme="light"] .sh-card-logo {
    background: #ffffff;
    border-color: #d0d5e6;
}
#StreamHubApp .sh-card-logo img,
.sh-app .sh-card-logo img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    opacity: 0;
    transition: opacity .1s ease;
    pointer-events: none;
}
/* While loading: letter stays visible; image sits on top invisible until ready */
#StreamHubApp .sh-card-logo.is-loading img {
    position: absolute;
    inset: 10px;
    width: auto;
    height: auto;
    opacity: 0;
    z-index: 1;
}
#StreamHubApp .sh-card-logo.is-loaded img {
    opacity: 1;
    position: static;
}
#StreamHubApp .sh-card-logo .sh-logo-fallback {
    width: 100%;
    height: 100%;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.55em;
    font-weight: 800;
    letter-spacing: .02em;
    color: #142033;
    background: linear-gradient(145deg, #eef3fb, #d5deef);
}
/* Never stack letter under a visible logo */
#StreamHubApp .sh-card-logo.is-loaded .sh-logo-fallback {
    display: none;
}
#StreamHubApp .sh-card-copy {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    align-items: center;
    padding: 0;
    overflow: hidden;
    flex: 1 1 auto;
    min-height: 0;
}
#StreamHubApp.sh-list-view .sh-card-copy {
    align-items: flex-start;
    flex: 1;
    min-width: 0;
    gap: 6px;
}
#StreamHubApp.sh-list-view .sh-card-name {
    text-align: left;
    min-height: 0;
    height: auto;
}
#StreamHubApp.sh-list-view .sh-card-group {
    margin-top: 0;
    margin-bottom: 0;
    width: auto;
    max-width: 100%;
    justify-content: flex-start;
}
#StreamHubApp .sh-card-name,
.sh-app .sh-card-name {
    font-size: .9em;
    font-weight: 750;
    line-height: 1.25;
    color: #f4f7ff;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    word-break: break-word;
    overflow-wrap: anywhere;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    /* Reserve 2 lines so short titles don't shift the badge */
    height: calc(1.25em * 2);
    min-height: calc(1.25em * 2);
    max-height: calc(1.25em * 2);
    padding: 0 2px;
    text-align: center;
    flex: none;
}
#StreamHubApp[data-theme="light"] .sh-card-name { color: #141a28; }
#StreamHubApp .sh-card-group,
.sh-app .sh-card-group {
    /* Compact centered pill — colors from [data-cat] rules above. */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    max-width: 100%;
    align-self: center;
    margin-top: auto;
    margin-bottom: 10px; /* bottom space on every device */
    height: 24px;
    min-height: 24px;
    max-height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: .7em;
    font-weight: 750;
    letter-spacing: .01em;
    line-height: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    box-sizing: border-box;
    flex: none;
    border: 1px solid transparent;
}
#StreamHubApp .sh-card-fav,
.sh-app .sh-card-fav {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(8, 12, 20, .78);
    border: 1px solid rgba(255,255,255,.16);
    color: #ffd54a;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    font-size: .95em;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
#StreamHubApp.sh-list-view .sh-card-fav,
.sh-app.sh-list-view .sh-card-fav {
    position: static;
    margin-left: auto;
    background: transparent;
    border-color: transparent;
}
#StreamHubApp.sh-list-view .sh-card-logo,
.sh-app.sh-list-view .sh-card-logo {
    width: 64px;
    height: 64px;
    min-width: 64px;
    min-height: 64px;
    padding: 8px;
    margin: 0;
}

.sh-skeleton-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
    gap: 12px;
}
.sh-skeleton-card {
    height: var(--sh-card-h);
    border-radius: var(--sh-radius-sm);
    background: linear-gradient(90deg, var(--sh-bg-elev) 25%, var(--sh-bg-elev-2) 37%, var(--sh-bg-elev) 63%);
    background-size: 400% 100%;
    animation: sh-shimmer 1.4s ease infinite;
}
@keyframes sh-shimmer {
    0% { background-position: 100% 0; }
    100% { background-position: 0 0; }
}

.sh-epg-toolbar {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: end;
    margin-bottom: 10px;
}
.sh-epg-toolbar .sh-label { grid-column: 1 / -1; }
.sh-epg-guide { display: flex; flex-direction: column; gap: 8px; }
.sh-epg-row {
    display: flex;
    gap: 10px;
    align-items: center;
    border: 1px solid var(--sh-border);
    border-radius: var(--sh-radius-sm);
    padding: 8px 10px;
    background: var(--sh-bg-elev);
}
.sh-epg-channel {
    flex: none;
    width: min(140px, 34vw);
    font-weight: 600;
    font-size: .85em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sh-epg-timeline {
    flex: 1;
    display: flex;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.sh-epg-prog {
    flex: none;
    background: var(--sh-bg-elev-2);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: .78em;
    min-width: 120px;
}
.sh-epg-prog.is-now { background: var(--sh-accent); color: #fff; }

.sh-player-section {
    background: #000;
    flex: 0 0 auto;
    border-bottom: 1px solid var(--sh-border);
}
.sh-player-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    max-height: 420px;
    margin: 0 auto;
    user-select: none;
    overflow: hidden;
}
.sh-app.sh-theater .sh-player-wrap {
    max-height: 560px;
    aspect-ratio: 21 / 9;
}
.sh-video {
    width: 100%;
    height: 100%;
    display: block;
    background: #000;
    object-fit: contain;
}
.sh-player-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 2;
}
.sh-spinner {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 4px solid rgba(255,255,255,.2);
    border-top-color: #fff;
    animation: sh-spin .8s linear infinite;
}
@keyframes sh-spin { to { transform: rotate(360deg); } }
.sh-error {
    pointer-events: auto;
    text-align: center;
    color: #fff;
    background: rgba(10,10,15,.8);
    padding: 20px 24px;
    border-radius: var(--sh-radius);
    max-width: min(92%, 360px);
}
.sh-error p { margin: 0 0 12px; }
.sh-center-play {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;
    width: 68px;
    height: 68px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,.5);
    color: #fff;
    font-size: 1.4em;
    cursor: pointer;
}
.sh-player-section.sh-controls-hidden .sh-center-play {
    opacity: 0;
    pointer-events: none;
}
.sh-player-chrome {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: linear-gradient(to bottom, rgba(0,0,0,.62) 0%, transparent 22%, transparent 58%, rgba(0,0,0,.75) 100%);
    opacity: 1;
    transition: opacity .22s ease;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.sh-player-section.sh-controls-hidden .sh-player-chrome {
    opacity: 0;
    pointer-events: none;
}
.sh-player-top {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px 4px;
    color: #fff;
    min-width: 0;
}
.sh-now-meta {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.sh-now-title {
    font-weight: 700;
    font-size: .95em;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sh-epg-strip {
    padding: 0;
    font-size: .72em;
    color: rgba(255,255,255,.78);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sh-live-badge {
    flex: none;
    align-self: center;
    background: var(--sh-danger);
    color: #fff;
    font-size: .68em;
    font-weight: 800;
    letter-spacing: .04em;
    padding: 3px 9px;
    border-radius: 999px;
    box-shadow: 0 0 0 0 rgba(239, 77, 94, .55);
    animation: sh-live-pulse 1.8s ease-out infinite;
}
.sh-live-badge.is-behind {
    background: rgba(255, 255, 255, .18);
    color: #ffd0d5;
    animation: none;
}
@keyframes sh-live-pulse {
    0% { box-shadow: 0 0 0 0 rgba(239, 77, 94, .45); }
    70% { box-shadow: 0 0 0 8px rgba(239, 77, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 77, 94, 0); }
}
.sh-player-close {
    margin-left: 0;
    background: rgba(255,255,255,.12);
    border-color: transparent;
    color: #fff;
    flex: none;
    align-self: center;
}
.sh-controls {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 4px 10px 12px;
}
.sh-progress-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.sh-seek-track {
    position: relative;
    flex: 1;
    min-width: 0;
    height: 22px;
    display: flex;
    align-items: center;
}
.sh-seek-buffer,
.sh-seek-played {
    position: absolute;
    left: 0;
    top: 50%;
    height: 4px;
    margin-top: -2px;
    border-radius: 999px;
    pointer-events: none;
    max-width: 100%;
}
.sh-seek-buffer {
    width: 0;
    background: rgba(255, 255, 255, .28);
    z-index: 0;
}
.sh-seek-played {
    width: 0;
    background: linear-gradient(90deg, var(--sh-accent), var(--sh-accent-2));
    z-index: 1;
}
.sh-transport-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    min-width: 0;
}
.sh-transport-main {
    justify-content: center;
    gap: 8px;
}
.sh-transport-tools {
    justify-content: flex-start;
    gap: 6px;
}
.sh-ctrl {
    background: rgba(255,255,255,.12);
    border: none;
    color: #fff;
    border-radius: 10px;
    width: var(--sh-ctrl);
    height: var(--sh-ctrl);
    min-width: var(--sh-ctrl);
    cursor: pointer;
    font-size: .92em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    transition: background .15s ease, transform .12s ease;
}
.sh-ctrl:hover { background: rgba(255,255,255,.22); }
.sh-ctrl:active { transform: scale(.96); }
.sh-ctrl.is-active { background: var(--sh-accent); }
.sh-ctrl-main {
    width: var(--sh-ctrl-main);
    height: var(--sh-ctrl-main);
    min-width: var(--sh-ctrl-main);
    background: var(--sh-accent);
    border-radius: 50%;
    box-shadow: 0 4px 14px rgba(108, 92, 231, .4);
}
.sh-ctrl-live {
    width: auto;
    min-width: 52px;
    padding: 0 10px;
    font-size: .72em;
    font-weight: 800;
    letter-spacing: .03em;
    background: rgba(239,77,94,.22);
    color: #ffb3bb;
}
.sh-ctrl-live.is-live {
    background: var(--sh-danger);
    color: #fff;
}
.sh-ctrl-live.is-behind {
    background: rgba(255, 196, 0, .22);
    color: #ffe08a;
    border: 1px solid rgba(255, 196, 0, .35);
}
.sh-volume-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
}
/* Custom range — kills the fat iOS/WebKit default sliders */
.sh-range {
    -webkit-appearance: none;
    appearance: none;
    accent-color: var(--sh-accent-2);
    height: 22px;
    margin: 0;
    padding: 0;
    background: transparent;
    cursor: pointer;
    vertical-align: middle;
}
.sh-range:focus { outline: none; }
.sh-range:focus-visible { outline: 2px solid var(--sh-accent-2); outline-offset: 2px; }
.sh-range::-webkit-slider-runnable-track {
    height: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .18);
}
.sh-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    margin-top: -5px;
    border-radius: 50%;
    background: #fff;
    border: 0;
    box-shadow: 0 1px 6px rgba(0, 0, 0, .5);
    position: relative;
    z-index: 2;
}
.sh-range::-moz-range-track {
    height: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .18);
}
.sh-range::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    border: 0;
    box-shadow: 0 1px 6px rgba(0, 0, 0, .5);
}
.sh-seek {
    position: relative;
    z-index: 2;
    width: 100%;
    min-width: 0;
    flex: 1;
}
.sh-seek::-webkit-slider-runnable-track { background: transparent; }
.sh-seek::-moz-range-track { background: transparent; }
.sh-volume { width: 88px; }
.sh-time {
    color: #fff;
    font-size: .74em;
    min-width: 64px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    opacity: .92;
}
.sh-spacer { flex: 1 1 8px; min-width: 4px; }
.sh-controls .sh-select-sm {
    background: rgba(255,255,255,.12);
    color: #fff;
    border-color: transparent;
    min-height: 34px;
    max-width: none;
    width: 100%;
}
.sh-controls .sh-select-sm option {
    color: #111;
    background: #fff;
}
.sh-settings-panel {
    margin-top: 2px;
    padding: 10px;
    border-radius: 12px;
    background: rgba(10, 12, 18, .72);
    border: 1px solid rgba(255, 255, 255, .12);
    backdrop-filter: blur(8px);
}
.sh-settings-panel[hidden] { display: none !important; }
.sh-settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}
.sh-settings-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
    color: rgba(255, 255, 255, .78);
    font-size: .72em;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
}
.sh-settings-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}
.sh-settings-action {
    width: auto;
    min-width: 0;
    padding: 0 12px;
    height: 34px;
    font-size: .78em;
    font-weight: 700;
    gap: 6px;
}
.sh-settings-hint {
    margin: 10px 0 0;
    color: rgba(255, 255, 255, .65);
    font-size: .75em;
    line-height: 1.4;
}

.sh-toast {
    position: absolute;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    background: var(--sh-bg-elev-2);
    border: 1px solid var(--sh-border);
    color: var(--sh-text);
    padding: 10px 16px;
    border-radius: var(--sh-radius-sm);
    box-shadow: var(--sh-shadow);
    z-index: 70;
    font-size: .88em;
    max-width: min(92%, 420px);
    text-align: center;
}

.sh-chip.is-locked {
    opacity: .92;
}
.sh-pin-modal {
    position: absolute;
    inset: 0;
    z-index: 90;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(6, 8, 14, .72);
    backdrop-filter: blur(4px);
}
.sh-pin-modal[hidden] { display: none !important; }
.sh-pin-dialog {
    width: min(100%, 380px);
    background: var(--sh-bg-elev);
    border: 1px solid var(--sh-border);
    border-radius: var(--sh-radius);
    box-shadow: var(--sh-shadow);
    padding: 20px 18px 16px;
}
.sh-pin-dialog h3 {
    margin: 0 0 6px;
    color: var(--sh-text);
    font-size: 1.15em;
}
.sh-pin-dialog p {
    margin: 0 0 14px;
    color: var(--sh-text-dim);
    font-size: .9em;
    line-height: 1.4;
}
.sh-pin-input {
    letter-spacing: .28em;
    font-size: 1.25em;
    text-align: center;
    margin-bottom: 8px;
}
.sh-pin-error {
    color: var(--sh-danger);
    font-size: .85em;
    margin: 0 0 10px !important;
}
.sh-pin-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 8px;
}

/* Container queries — follow the tool column, not only the viewport */
@container streamhub (max-width: 639px) {
    #StreamHubApp, .sh-app {
        --sh-ctrl: 40px;
        --sh-ctrl-main: 48px;
        --sh-card-h: 168px;
        --sh-list-h: 76px;
        --sh-list-h-px: min(74vh, 640px);
        --sh-gap: 10px;
        --sh-radius: 12px;
        font-size: 14px;
    }

    /* Always 2 columns side-by-side on phones */
    #StreamHubApp .sh-grid,
    .sh-app .sh-grid,
    .sh-skeleton-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 10px;
    }
    .sh-virtual-host {
        height: var(--sh-list-h-px);
        max-height: var(--sh-list-h-px);
        -webkit-overflow-scrolling: touch;
        touch-action: pan-y;
        scrollbar-width: none;
    }
    .sh-virtual-host::-webkit-scrollbar { width: 0; height: 0; }

    .sh-toolbar {
        padding: 10px;
    }
    .sh-toolbar-row {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 8px;
        align-items: end;
    }
    .sh-playlist-select-wrap { grid-column: 1 / -1; }
    .sh-search-wrap { grid-column: 1; }
    .sh-toolbar-actions {
        grid-column: 2;
        justify-self: end;
        align-self: end;
        gap: 6px;
        padding-bottom: 0;
    }

    .sh-label { margin-bottom: 4px; font-size: .7em; }
    .sh-label-inline { display: none; }
    .sh-select, .sh-input, .sh-search {
        min-height: 44px;
        padding: 10px 12px;
        font-size: 16px; /* prevents iOS zoom on focus */
    }
    .sh-btn, .sh-btn-icon {
        min-height: 44px;
        min-width: 44px;
        padding: 9px 11px;
    }

    .sh-tabs {
        margin-top: 10px;
        gap: 2px;
        mask-image: linear-gradient(90deg, #000 0%, #000 calc(100% - 20px), transparent 100%);
    }
    .sh-tab {
        padding: 8px 12px;
        font-size: .86em;
    }
    .sh-tab .sh-tab-full,
    .sh-pin-lock-btn .sh-tab-full { display: none; }
    .sh-tab .sh-tab-short,
    .sh-pin-lock-btn .sh-tab-short { display: inline; }
    .sh-tabs .sh-pin-lock-btn {
        margin-left: 6px;
        height: 32px;
        padding: 0 10px;
        font-size: .72em;
    }

    .sh-cat-row,
    .sh-az-row {
        margin-top: 8px;
        padding: 6px 8px;
        gap: 0;
        min-height: 48px;
        height: 48px;
    }
    .sh-az-row {
        margin-top: 6px;
        min-height: 44px;
        height: 44px;
    }
    .sh-categories,
    .sh-az-bar {
        height: 36px;
        min-height: 36px;
        gap: 6px;
    }
    .sh-chip {
        height: 32px;
        min-height: 32px;
        padding: 0 12px;
        font-size: .8em;
    }
    .sh-az-btn {
        width: 34px;
        height: 34px;
        min-width: 34px;
        min-height: 34px;
        font-size: .72em;
        border-radius: 9px;
    }

    .sh-channel-meta {
        margin: 8px 0 0;
        font-size: .8em;
        line-height: 1.4;
        letter-spacing: .01em;
    }

    .sh-panel { padding: 10px; }
    .sh-browse-panel {
        gap: 10px;
        padding: 10px;
        margin: 0;
    }

    .sh-empty-state {
        min-height: 200px;
        padding: 28px 14px;
    }
    .sh-empty-icon { font-size: 1.9em; }
    .sh-empty-state h3 { font-size: 1em; }
    .sh-empty-state p {
        font-size: .88em;
        margin-bottom: 14px;
        padding: 0 4px;
    }
    .sh-empty-actions .sh-btn {
        width: 100%;
        max-width: 280px;
        min-width: 0;
    }

    .sh-skeleton-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }
    #StreamHubApp .sh-grid { gap: 10px; }
    #StreamHubApp .sh-virtual-window { padding: 8px; }
    #StreamHubApp .sh-card {
        padding: 10px 8px 16px;
        gap: 6px;
        border-radius: 12px;
    }
    #StreamHubApp .sh-card-group {
        height: 22px;
        min-height: 22px;
        max-height: 22px;
        padding: 0 8px;
        margin-bottom: 10px;
        font-size: .66em;
        max-width: calc(100% - 4px);
    }
    #StreamHubApp .sh-card-name {
        font-size: .8em;
        padding: 0 4px;
    }
    #StreamHubApp .sh-card-logo {
        width: 64px;
        height: 64px;
        min-width: 64px;
        min-height: 64px;
        padding: 8px;
        border-radius: 14px;
        margin: 2px 0 0;
    }
    #StreamHubApp .sh-card-fav {
        width: 30px;
        height: 30px;
        top: 6px;
        right: 6px;
    }
    #StreamHubApp.sh-list-view .sh-card-logo {
        width: 56px;
        height: 56px;
        min-width: 56px;
        min-height: 56px;
    }

    /* Sticky player so channel browsing stays usable underneath */
    .sh-player-section:not([hidden]) {
        position: sticky;
        top: var(--tools-header-offset, 64px);
        z-index: 30;
        box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
    }
    .sh-player-wrap {
        max-height: none;
        aspect-ratio: 16 / 9;
        height: auto;
        border-radius: 0;
    }
    .sh-app.sh-theater .sh-player-wrap {
        max-height: none;
        aspect-ratio: 16 / 9;
    }
    .sh-player-chrome {
        background: linear-gradient(
            to bottom,
            rgba(0, 0, 0, .78) 0%,
            transparent 26%,
            transparent 48%,
            rgba(0, 0, 0, .88) 100%
        );
    }
    .sh-player-top {
        padding: 8px 10px 2px;
        gap: 6px;
        align-items: center;
    }
    .sh-now-title { font-size: .84em; }
    .sh-epg-strip { font-size: .68em; }
    .sh-live-badge {
        font-size: .6em;
        padding: 3px 8px;
    }
    .sh-player-close {
        width: 34px;
        height: 34px;
        min-width: 34px;
        min-height: 34px;
        padding: 0;
        border-radius: 50%;
    }
    .sh-center-play {
        width: 56px;
        height: 56px;
        font-size: 1.15em;
    }
    .sh-controls {
        padding: 0 8px 10px;
        gap: 4px;
    }
    .sh-progress-row { gap: 0; }
    .sh-seek-track { height: 24px; }
    .sh-seek-buffer,
    .sh-seek-played { height: 3px; margin-top: -1.5px; }
    .sh-transport-main {
        justify-content: space-between;
        gap: 4px;
        padding: 0 2px;
    }
    .sh-transport-tools {
        flex-wrap: nowrap;
        gap: 4px;
        overflow-x: auto;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 1px;
    }
    .sh-transport-tools::-webkit-scrollbar { display: none; }
    #StreamHubApp, .sh-app {
        --sh-ctrl: 36px;
        --sh-ctrl-main: 44px;
    }
    .sh-ctrl {
        border-radius: 10px;
        font-size: .82em;
    }
    .sh-ctrl-main { border-radius: 50%; }
    .sh-ctrl-live {
        min-width: 46px;
        height: 32px;
        padding: 0 9px;
        font-size: .66em;
        border-radius: 8px;
    }
    .sh-time {
        min-width: 0;
        font-size: .68em;
        flex: none;
    }
    .sh-volume {
        width: 64px;
        height: 22px;
    }
    .sh-volume-wrap.is-open .sh-volume,
    .sh-volume-wrap:focus-within .sh-volume {
        width: 72px;
    }
    .sh-spacer { display: none; }
    .sh-settings-panel { padding: 8px; }
    .sh-settings-grid { gap: 8px; }
    .sh-cast-hidden { display: none !important; }
    /* Keep secondary desktop-only chrome compact, not removed */
    #shTheaterBtn { display: none !important; }

    .sh-epg-toolbar { grid-template-columns: 1fr; }
    .sh-epg-toolbar .sh-btn { width: 100%; }
    .sh-epg-row { flex-direction: column; align-items: stretch; gap: 6px; }
    .sh-epg-channel { width: 100%; }

    .sh-pin-modal {
        position: fixed;
        inset: 0;
        z-index: 120;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 20px 16px;
        padding-bottom: max(20px, env(safe-area-inset-bottom, 0px));
        background: rgba(6, 8, 14, .78);
        backdrop-filter: blur(6px);
    }
    .sh-pin-dialog {
        width: min(100%, 360px);
        margin: 0 auto;
        padding: 22px 18px 18px;
        border-radius: 16px;
        box-shadow: 0 18px 48px rgba(0, 0, 0, .45);
        transform: translateY(0);
    }
    .sh-pin-actions {
        gap: 10px;
        margin-top: 12px;
    }
    .sh-pin-actions .sh-btn { flex: 1; }
    .sh-toast {
        bottom: 12px;
        left: 12px;
        right: 12px;
        transform: none;
        max-width: none;
        width: auto;
    }
}

@container streamhub (max-width: 380px) {
    #StreamHubApp, .sh-app {
        --sh-card-h: 160px;
        --sh-list-h-px: min(68vh, 560px);
        font-size: 13.5px;
    }
    .sh-toolbar { padding: 8px; }
    .sh-tab { padding: 7px 10px; font-size: .82em; }
    .sh-cat-row,
    .sh-az-row {
        min-height: 44px;
        height: 44px;
        padding: 4px 6px;
    }
    .sh-chip {
        height: 30px;
        min-height: 30px;
        padding: 0 10px;
        font-size: .76em;
    }
    .sh-az-btn {
        width: 28px;
        height: 28px;
        min-width: 28px;
        min-height: 28px;
    }
    #StreamHubApp .sh-card-logo {
        width: 56px;
        height: 56px;
        min-width: 56px;
        min-height: 56px;
        padding: 6px;
    }
    .sh-empty-state { min-height: 180px; padding: 22px 12px; }
}

@container streamhub (min-width: 640px) and (max-width: 899px) {
    #StreamHubApp, .sh-app {
        --sh-card-h: 176px;
        --sh-list-h-px: min(62vh, 560px);
        --sh-gap: 12px;
    }
    .sh-toolbar { padding: 12px; }
    .sh-toolbar-row {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr) auto;
        gap: 10px;
    }
    .sh-cat-row {
        min-height: 58px;
        height: 58px;
    }
    .sh-az-row {
        min-height: 52px;
        height: 52px;
    }
    #StreamHubApp .sh-grid,
    .sh-app .sh-grid,
    .sh-skeleton-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 12px;
    }
    #StreamHubApp .sh-virtual-window { padding: 12px; }
    #StreamHubApp .sh-card { padding: 12px 8px 16px; gap: 6px; }
    #StreamHubApp .sh-card-group {
        margin-bottom: 10px;
        height: 22px;
        min-height: 22px;
        max-height: 22px;
        font-size: .68em;
    }
    #StreamHubApp .sh-card-logo {
        width: 68px;
        height: 68px;
        min-width: 68px;
        min-height: 68px;
        padding: 8px;
        margin: 2px 0 0;
    }
    #StreamHubApp .sh-card-name {
        font-size: .82em;
        min-height: 2.4em;
    }
    .sh-player-wrap { max-height: 360px; }
    .sh-empty-state { min-height: 240px; padding: 36px 20px; }
    .sh-virtual-host {
        height: var(--sh-list-h-px);
        max-height: var(--sh-list-h-px);
        -webkit-overflow-scrolling: touch;
    }
}

@container streamhub (min-width: 900px) {
    #StreamHubApp, .sh-app {
        --sh-card-h: 190px;
        --sh-list-h-px: 580px;
        --sh-ctrl: 42px;
        --sh-ctrl-main: 50px;
        --sh-gap: 14px;
    }
    #StreamHubApp .sh-grid, .sh-skeleton-grid { gap: 14px; }
    .sh-player-wrap { max-height: 420px; }
    #StreamHubApp .sh-card { padding: 12px 10px 18px; }
    #StreamHubApp .sh-card-group { margin-bottom: 10px; }
    #StreamHubApp .sh-card-logo {
        width: 80px;
        height: 80px;
        min-width: 80px;
        min-height: 80px;
    }
    #StreamHubApp .sh-card-name { font-size: .9em; }
}

/* Viewport fallbacks when container queries are unavailable / for page chrome */
@media (max-width: 639px) {
    .sh-app {
        --sh-list-h-px: min(74vh, 640px);
        --sh-card-h: 168px;
        --sh-list-h: 76px;
        --sh-gap: 10px;
        border-radius: 10px;
        font-size: 14px;
    }
    #StreamHubApp .sh-grid,
    .sh-app .sh-grid,
    .sh-skeleton-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 10px;
    }
    .sh-browse-panel {
        padding: 10px;
        gap: 10px;
        margin: 0;
    }
    #StreamHubApp .sh-card {
        padding-bottom: 16px;
    }
    #StreamHubApp .sh-card-group {
        height: 22px;
        min-height: 22px;
        max-height: 22px;
        padding: 0 8px;
        margin-bottom: 10px;
        font-size: .66em;
        max-width: calc(100% - 4px);
    }
    .sh-virtual-host {
        height: var(--sh-list-h-px);
        max-height: var(--sh-list-h-px);
        -webkit-overflow-scrolling: touch;
        touch-action: pan-y;
        scrollbar-width: none;
    }
    .sh-virtual-host::-webkit-scrollbar { width: 0; height: 0; }
    .sh-toolbar { padding: 10px; }
    .sh-toolbar-row {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 8px;
    }
    .sh-playlist-select-wrap { grid-column: 1 / -1; }
    .sh-search-wrap { grid-column: 1; }
    .sh-toolbar-actions {
        grid-column: 2;
        justify-self: end;
        align-self: end;
    }
    .sh-label-inline { display: none; }
    .sh-select, .sh-input, .sh-search {
        min-height: 44px;
        font-size: 16px;
    }
    .sh-btn, .sh-btn-icon {
        min-height: 44px;
        min-width: 44px;
    }
    .sh-tabs { margin-top: 10px; }
    .sh-tab { padding: 8px 12px; font-size: .86em; }
    .sh-tab .sh-tab-full,
    .sh-pin-lock-btn .sh-tab-full { display: none; }
    .sh-tab .sh-tab-short,
    .sh-pin-lock-btn .sh-tab-short { display: inline; }
    .sh-cat-row,
    .sh-az-row {
        margin-top: 8px;
        padding: 6px 8px;
        min-height: 48px;
        height: 48px;
    }
    .sh-az-row {
        margin-top: 6px;
        min-height: 44px;
        height: 44px;
    }
    .sh-chip {
        height: 32px;
        min-height: 32px;
        padding: 0 12px;
        font-size: .8em;
    }
    .sh-panel { padding: 10px; }
    .sh-empty-state {
        min-height: 200px;
        padding: 28px 14px;
    }
    .sh-empty-actions .sh-btn {
        width: 100%;
        max-width: 280px;
    }
    .sh-player-section:not([hidden]) {
        position: sticky;
        top: var(--tools-header-offset, 64px);
        z-index: 30;
        box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
    }
    .sh-player-wrap {
        max-height: none;
        aspect-ratio: 16 / 9;
        height: auto;
    }
    .sh-az-btn {
        width: 34px;
        height: 34px;
        min-width: 34px;
        min-height: 34px;
    }
    .sh-channel-meta { font-size: .8em; }
    .sh-player-top { padding: 8px 10px 2px; align-items: center; }
    .sh-now-title { font-size: .84em; }
    .sh-player-close {
        width: 34px;
        height: 34px;
        min-width: 34px;
        min-height: 34px;
        padding: 0;
        border-radius: 50%;
    }
    .sh-center-play { width: 56px; height: 56px; font-size: 1.15em; }
    .sh-controls { padding: 0 8px 10px; gap: 4px; }
    .sh-transport-main {
        justify-content: space-between;
        gap: 4px;
    }
    .sh-transport-tools {
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
        gap: 4px;
    }
    .sh-transport-tools::-webkit-scrollbar { display: none; }
    .sh-app {
        --sh-ctrl: 36px;
        --sh-ctrl-main: 44px;
    }
    .sh-ctrl { border-radius: 10px; font-size: .82em; }
    .sh-ctrl-main { border-radius: 50%; }
    .sh-ctrl-live {
        min-width: 46px;
        height: 32px;
        padding: 0 9px;
        font-size: .66em;
    }
    .sh-time { min-width: 0; font-size: .68em; }
    .sh-volume { width: 64px; }
    .sh-spacer { display: none; }
    #shTheaterBtn { display: none !important; }
    #StreamHubApp .sh-card-logo {
        width: 64px;
        height: 64px;
        min-width: 64px;
        min-height: 64px;
    }
    .sh-skeleton-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }
    .sh-pin-modal {
        position: fixed;
        inset: 0;
        z-index: 120;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 20px 16px;
        padding-bottom: max(20px, env(safe-area-inset-bottom, 0px));
    }
    .sh-pin-dialog {
        width: min(100%, 360px);
        margin: 0 auto;
        border-radius: 16px;
        padding: 22px 18px 18px;
    }
    .sh-toast {
        left: 12px;
        right: 12px;
        bottom: 12px;
        transform: none;
        max-width: none;
    }
}

@media (max-width: 380px) {
    .sh-app {
        --sh-card-h: 160px;
        --sh-list-h-px: min(68vh, 560px);
        font-size: 13.5px;
    }
    .sh-toolbar { padding: 8px; }
    .sh-tab { padding: 7px 10px; font-size: .82em; }
    .sh-cat-row,
    .sh-az-row {
        min-height: 44px;
        height: 44px;
    }
    #StreamHubApp .sh-card-logo {
        width: 56px;
        height: 56px;
        min-width: 56px;
        min-height: 56px;
    }
    .sh-empty-state { min-height: 180px; padding: 22px 12px; }
}

@media (min-width: 640px) and (max-width: 899px) {
    .sh-app {
        --sh-list-h-px: min(62vh, 560px);
        --sh-card-h: 176px;
        --sh-gap: 12px;
    }
    #StreamHubApp .sh-grid,
    .sh-app .sh-grid,
    .sh-skeleton-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 12px;
    }
    #StreamHubApp .sh-card-logo {
        width: 68px;
        height: 68px;
        min-width: 68px;
        min-height: 68px;
        padding: 8px;
    }
    #StreamHubApp .sh-card-name { font-size: .82em; }
    #StreamHubApp .sh-card-group { margin-bottom: 10px; }
    .sh-virtual-host {
        height: var(--sh-list-h-px);
        max-height: var(--sh-list-h-px);
        -webkit-overflow-scrolling: touch;
    }
    .sh-player-wrap { max-height: 360px; }
}

@media (max-width: 900px) and (orientation: landscape) {
    .sh-app { --sh-list-h-px: min(55vh, 360px); }
    .sh-toolbar { padding: 8px 10px; }
    .sh-cat-row,
    .sh-az-row {
        margin-top: 6px;
        min-height: 42px;
        height: 42px;
        padding: 4px 8px;
    }
    .sh-player-section:not([hidden]) {
        position: sticky;
        top: var(--tools-header-offset, 56px);
    }
    .sh-player-wrap {
        max-height: 42vh;
        aspect-ratio: 16 / 9;
        height: auto;
    }
    .sh-empty-state {
        min-height: 140px;
        padding: 18px 12px;
    }
}

/* Short viewports (phones in landscape / small browser chrome) */
@media (max-height: 520px) and (max-width: 900px) {
    .sh-app { --sh-list-h-px: min(50vh, 300px); }
    .sh-cat-row,
    .sh-az-row {
        margin-top: 4px;
        min-height: 40px;
        height: 40px;
        padding: 3px 6px;
    }
    .sh-empty-state { min-height: 120px; padding: 16px 12px; }
}

.sh-player-wrap:fullscreen,
.sh-player-wrap:-webkit-full-screen {
    aspect-ratio: auto;
    width: 100%;
    height: 100%;
    max-height: none;
}
.sh-player-wrap:fullscreen .sh-video,
.sh-player-wrap:-webkit-full-screen .sh-video { object-fit: contain; }

.sh-app :focus-visible { outline: 3px solid var(--sh-accent-2); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
    .sh-btn, .sh-ctrl, .sh-player-chrome, .sh-skeleton-card, .sh-live-badge {
        transition: none;
        animation: none;
    }
}
