@font-face {
    font-family: "Uniplay Inter";
    src: url("/fonts/filament/filament/inter/inter-latin-wght-normal-NRMW37G5.woff2") format("woff2");
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
}

:root {
    color-scheme: dark;
    --background: #080808;
    --surface: #181818;
    --surface-bright: #2a2a2a;
    --ruby: #b20710;
    --primary: #e50914;
    --focus: #ff3b47;
    --text: #f5f5f5;
    --muted: #b3b3b3;
    --success: #35d89a;
    --line: rgba(255, 255, 255, 0.14);
    --gutter: 48px;
    font-family: "Uniplay Inter", Roboto, "Segoe UI", Arial, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    letter-spacing: 0;
}

html,
body,
#root {
    width: 100%;
    height: 100%;
    margin: 0;
}

html,
body {
    overflow: hidden;
    color: var(--text);
    background: var(--background);
}

body {
    min-width: 320px;
}

button,
input {
    font: inherit;
}

button {
    color: inherit;
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.48;
}

.hidden,
[hidden] {
    display: none !important;
}

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

.screen {
    position: relative;
    width: 100%;
    height: 100%;
}

.focusable {
    outline: none;
}

.app-layout {
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--background);
}

.content {
    position: relative;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

body[data-active-section="search"] .topnav,
body[data-active-section="profile"] .topnav {
    display: none;
}

/* Compact Android TV navigation. */
.topnav {
    position: relative;
    z-index: 30;
    display: flex;
    flex: 0 0 56px;
    align-items: center;
    width: 100%;
    min-width: 0;
    height: 56px;
    padding: 0 32px;
    background: linear-gradient(180deg, rgba(8, 8, 8, 0.99), rgba(8, 8, 8, 0.82));
}

.nav-logo {
    display: block;
    flex: 0 0 auto;
    width: 132px;
    max-height: 37px;
    object-fit: contain;
}

.nav-sections {
    display: flex;
    align-items: center;
    min-width: 0;
    margin-left: 52px;
    gap: 10px;
}

.nav-spacer {
    flex: 1;
    min-width: 12px;
}

.nav-btn,
.profile-trigger {
    position: relative;
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    height: 34px;
    margin: 0;
    padding: 0 11px;
    color: var(--text);
    background: transparent;
    border: 2px solid transparent;
    border-radius: 8px;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 600;
}

.nav-btn.active {
    font-weight: 800;
}

.nav-btn.active::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 1px;
    width: 20px;
    height: 2px;
    transform: translateX(-50%);
    background: var(--primary);
}

.nav-btn:focus,
.profile-trigger:focus {
    background: rgba(229, 9, 20, 0.3);
    border-color: var(--focus);
}

.nav-search {
    gap: 7px;
}

.search-icon {
    position: relative;
    display: inline-block;
    flex: 0 0 15px;
    width: 15px;
    height: 15px;
    border: 2px solid currentColor;
    border-radius: 50%;
}

.search-icon::after {
    content: "";
    position: absolute;
    right: -5px;
    bottom: -3px;
    width: 7px;
    height: 2px;
    transform: rotate(45deg);
    transform-origin: left center;
    background: currentColor;
    border-radius: 2px;
}

.profile-trigger {
    height: 42px;
    gap: 8px;
    padding: 0 8px;
    font-size: 12px;
}

.profile-avatar {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    color: #fff;
    background: linear-gradient(145deg, var(--ruby), var(--primary));
    border-radius: 50%;
    font-size: 13px;
    font-weight: 800;
}

/* Login */
.login-screen {
    display: grid;
    place-items: center;
    isolation: isolate;
    overflow: hidden;
    background: radial-gradient(circle at 72% 46%, #2a080d 0, #13090a 29%, var(--background) 66%);
}

.login-rings {
    position: absolute;
    z-index: -1;
    inset: 0;
    pointer-events: none;
}

.login-rings i {
    position: absolute;
    top: 50%;
    right: 6%;
    width: min(38vw, 540px);
    aspect-ratio: 1;
    transform: translateY(-50%);
    border: 2px solid rgba(178, 7, 16, 0.18);
    border-radius: 50%;
}

.login-rings i + i {
    right: 11%;
    width: min(25vw, 360px);
    border-color: rgba(229, 9, 20, 0.14);
}

.login-card {
    width: min(400px, calc(100vw - 36px));
    padding: 26px 32px 22px;
    text-align: center;
    background: rgba(24, 24, 24, 0.94);
    border: 1px solid rgba(229, 9, 20, 0.28);
    border-radius: 8px;
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.58);
}

.login-logo-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 58px;
}

.brand-logo {
    display: block;
    width: 185px;
    max-height: 58px;
    object-fit: contain;
}

.login-card h1 {
    margin: 18px 0 0;
    font-size: 22px;
    line-height: 1.15;
    font-weight: 800;
}

.login-subtitle {
    margin: 7px 0 18px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

.field {
    display: block;
    margin: 0 0 11px;
    text-align: left;
}

.field > span:first-child {
    display: block;
    margin: 0 0 6px;
    color: #dedede;
    font-size: 11px;
    font-weight: 700;
}

.field input {
    display: block;
    width: 100%;
    height: 54px;
    padding: 0 14px;
    color: var(--text);
    background: rgba(8, 8, 8, 0.72);
    border: 1px solid rgba(179, 179, 179, 0.46);
    border-radius: 8px;
    font-size: 14px;
}

.field input::placeholder {
    color: #777;
}

.field input:focus {
    outline: 0;
    border: 2px solid var(--focus);
}

.password-wrap {
    position: relative;
    display: block;
}

.password-wrap input {
    padding-right: 82px;
}

.password-toggle {
    position: absolute;
    top: 8px;
    right: 5px;
    height: 38px;
    padding: 0 10px;
    color: var(--muted);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: 9px;
    font-weight: 800;
}

.lock-icon,
.protected-lock {
    position: relative;
    display: inline-block;
    width: 11px;
    height: 9px;
    border: 2px solid currentColor;
    border-radius: 2px;
}

.lock-icon {
    margin-right: 8px;
}

.lock-icon::before,
.protected-lock::before {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 6px;
    width: 7px;
    height: 7px;
    transform: translateX(-50%);
    border: 2px solid currentColor;
    border-bottom: 0;
    border-radius: 7px 7px 0 0;
}

.password-toggle:focus {
    color: #fff;
    border-color: var(--focus);
}

.primary-btn,
.tool-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 18px;
    color: #fff;
    background: var(--surface-bright);
    border: 2px solid transparent;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 800;
}

.primary-btn {
    background: var(--primary);
}

.login-card > .primary-btn {
    width: 100%;
    height: 46px;
    margin-top: 3px;
}

.primary-btn:focus,
.tool-btn:focus {
    border-color: var(--focus);
    box-shadow: 0 0 0 2px rgba(255, 59, 71, 0.22);
}

.status {
    min-height: 18px;
    margin-top: 10px;
    color: #ff7b86;
    font-size: 11px;
}

.status:empty {
    display: none;
}

.login-protected {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 14px;
    color: var(--muted);
    font-size: 10px;
}

.login-protected span {
    margin-right: 6px;
    color: var(--muted);
}

/* Loading */
.loading-screen {
    display: grid;
    place-items: center;
    overflow: hidden;
    background:
        radial-gradient(ellipse 42% 88% at 52% 50%, #31070e 0%, #170307 55%, #080808 100%);
}

.splash-center {
    display: flex;
    align-items: center;
    flex-direction: column;
    justify-content: center;
    transform: translateY(0);
}

.splash-logo {
    display: block;
    width: 320px;
    max-width: 52vw;
    max-height: 112px;
    object-fit: contain;
}

.splash-spinner {
    width: 30px;
    height: 30px;
    margin-top: 38px;
    border: 3px solid transparent;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.82s linear infinite;
}

.loading-overlay {
    position: fixed;
    z-index: 500;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(8, 8, 8, 0.96);
}

.loading-panel {
    display: grid;
    justify-items: center;
    gap: 18px;
    color: var(--muted);
    font-size: 13px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(229, 9, 20, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

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

/* Home */
.android-home {
    position: relative;
    width: 100%;
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    background: var(--background);
    scrollbar-width: thin;
    scrollbar-color: #4b4b4b transparent;
}

.home-backdrop {
    position: absolute;
    z-index: 0;
    top: 0;
    left: 0;
    width: 100%;
    height: 430px;
    background-position: center 24%;
    background-repeat: no-repeat;
    background-size: cover;
    opacity: 0.84;
    transition: background-image 0.18s ease;
}

.home-vignette {
    position: absolute;
    z-index: 1;
    top: 0;
    left: 0;
    width: 100%;
    height: 460px;
    pointer-events: none;
    background:
        linear-gradient(90deg, #080808 2%, rgba(8, 8, 8, 0.92) 31%, rgba(8, 8, 8, 0.46) 64%, rgba(8, 8, 8, 0.12)),
        linear-gradient(0deg, #080808 1%, transparent 54%);
}

.home-hero {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
    height: 250px;
    padding: 10px var(--gutter) 0;
}

.home-hero h1 {
    width: min(52%, 760px);
    margin: 0;
    overflow: hidden;
    color: var(--text);
    font-size: 34px;
    line-height: 1.08;
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hero-meta {
    margin-top: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.home-hero > p,
.my-list-copy > p {
    display: -webkit-box;
    width: min(44%, 650px);
    margin: 7px 0 0;
    overflow: hidden;
    color: rgba(245, 245, 245, 0.9);
    font-size: 12px;
    line-height: 16px;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.hero-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
}

.hero-button {
    width: 150px;
    height: 42px;
}

.hero-actions .primary-btn {
    width: 172px;
}

.hero-list-button {
    width: 180px;
}

.home-rails {
    position: relative;
    z-index: 2;
    padding: 0 0 36px;
}

.home-section {
    margin-top: 6px;
}

.home-section h2 {
    margin: 0;
    padding: 0 var(--gutter) 5px;
    color: var(--text);
    font-size: 15px;
    font-weight: 800;
}

.home-row,
.my-list-rail,
.similar-row {
    display: flex;
    gap: 14px;
    min-width: 0;
    padding: 10px var(--gutter) 14px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    scrollbar-width: none;
}

.home-row::-webkit-scrollbar,
.my-list-rail::-webkit-scrollbar,
.similar-row::-webkit-scrollbar,
.categories::-webkit-scrollbar {
    display: none;
}

.card {
    position: relative;
    display: block;
    flex: 0 0 158px;
    width: 158px;
    aspect-ratio: 2 / 3;
    padding: 0;
    overflow: hidden;
    color: #fff;
    text-align: left;
    background: linear-gradient(145deg, rgba(178, 7, 16, 0.82), var(--surface) 55%, rgba(229, 9, 20, 0.48));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}

.card.landscape {
    flex-basis: 184px;
    width: 184px;
    height: 104px;
    aspect-ratio: auto;
}

#home-continue .card {
    flex-basis: 220px;
    width: 220px;
    height: 116px;
}

.card:focus {
    z-index: 3;
    transform: scale(1.035);
    border: 3px solid var(--focus);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.72);
}

.card img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.shade {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 43%, rgba(0, 0, 0, 0.9));
}

.card-title {
    position: absolute;
    z-index: 1;
    right: 8px;
    bottom: 9px;
    left: 8px;
    display: -webkit-box;
    overflow: hidden;
    color: #fff;
    font-size: 11px;
    line-height: 13px;
    font-weight: 600;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.card.landscape .card-title {
    -webkit-line-clamp: 1;
}

/* Libraries */
.library-shell {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    padding: 10px var(--gutter) 42px;
    overflow-x: hidden;
    overflow-y: hidden;
    background: var(--background);
}

.library-summary {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-height: 28px;
}

.library-summary h1 {
    margin: 0;
    color: var(--text);
    font-size: 20px;
    font-weight: 800;
}

.library-summary span {
    color: var(--muted);
    font-size: 12px;
}

.categories,
.my-list-filters {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    height: 48px;
    padding: 3px 0 7px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
}

.category-btn {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    height: 32px;
    padding: 0 13px;
    color: var(--text);
    background: var(--surface);
    border: 2px solid transparent;
    border-radius: 8px;
    white-space: nowrap;
    font-size: 11px;
    font-weight: 700;
}

.category-btn.active {
    background: var(--primary);
}

.category-btn:focus {
    background: var(--ruby);
    border-color: var(--focus);
}

.grid {
    display: grid;
    flex: 1;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    grid-auto-rows: max-content;
    gap: 16px 14px;
    align-items: start;
    align-content: start;
    min-height: 0;
    padding: 4px 0 16px;
    overflow-x: hidden;
    overflow-y: auto;
}

.grid > .card {
    width: 100%;
    min-width: 0;
    aspect-ratio: 2 / 3;
}

.channel-list {
    display: grid;
    flex: 1;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px;
    align-content: start;
    min-height: 0;
    padding: 4px 0 16px;
    overflow-x: hidden;
    overflow-y: auto;
}

.channel-row {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 142px;
    min-width: 0;
    padding: 10px;
    overflow: hidden;
    color: var(--text);
    text-align: left;
    background: var(--surface);
    border: 2px solid transparent;
    border-radius: 10px;
    transition: transform 0.14s ease, background 0.14s ease, border-color 0.14s ease;
}

.channel-row:focus {
    z-index: 2;
    transform: scale(1.035);
    background: var(--surface-bright);
    border-color: var(--primary);
}

.channel-art {
    display: grid;
    flex: 0 0 78px;
    place-items: center;
    width: 100%;
    height: 78px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 8px;
}

.channel-art img {
    width: auto;
    max-width: min(100%, 160px);
    height: auto;
    max-height: 68px;
    padding: 6px;
    object-fit: contain;
}

.channel-fallback {
    color: var(--text);
    font-size: 24px;
    font-weight: 900;
}

.channel-row > strong {
    display: block;
    margin-top: 7px;
    overflow: hidden;
    font-size: 12px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.channel-status {
    display: flex;
    align-items: center;
    min-width: 0;
    margin-top: 3px;
    color: var(--primary);
    font-size: 9px;
    font-weight: 800;
}

.channel-status > i {
    flex: 0 0 6px;
    width: 6px;
    height: 6px;
    margin-right: 5px;
    background: var(--primary);
    border-radius: 50%;
}

.channel-epg {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.channel-epg.has-program {
    color: var(--text);
    font-weight: 500;
}

.channel-status small {
    flex: 0 0 auto;
    margin-left: auto;
    padding-left: 6px;
    color: var(--muted);
    font-size: 9px;
    font-weight: 500;
}

.empty {
    margin: 28px 0;
    color: var(--muted);
    font-size: 13px;
}

/* Search */
.global-search {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 56px auto minmax(0, 1fr);
    width: 100%;
    height: 100%;
    padding: 0 36px 28px;
    background: var(--background);
}

.standalone-topbar {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    min-width: 0;
}

.standalone-topbar > img,
.profiles-logo {
    display: block;
    width: 104px;
    max-height: 32px;
    object-fit: contain;
}

.standalone-profile {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    margin-left: auto;
    padding: 0;
    color: #fff;
    background: transparent;
    border: 2px solid transparent;
    border-radius: 50%;
}

.standalone-profile > span {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    background: linear-gradient(145deg, var(--ruby), var(--primary));
    border-radius: 50%;
    font-size: 12px;
    font-weight: 800;
}

.standalone-profile:focus {
    background: var(--surface-bright);
    border-color: var(--focus);
}

.global-search-bar,
.global-results {
    min-height: 0;
}

.global-search-bar {
    width: min(720px, 100%);
    padding-top: 14px;
}

.global-search-bar h1 {
    margin: 0;
    font-size: 26px;
    font-weight: 800;
}

.search-display-wrap {
    display: flex;
    align-items: center;
    width: 100%;
    height: 52px;
    margin: 16px 0;
    padding: 0 16px;
    background: var(--surface);
    border: 2px solid var(--focus);
    border-radius: 8px;
}

.search-display-wrap .search-icon {
    margin-right: 12px;
}

.search-input,
.search-display {
    width: 100%;
    height: 100%;
    padding: 0;
    color: var(--text);
    background: transparent;
    border: 0;
    outline: 0;
    font-size: 14px;
}

.search-input::placeholder,
.search-display::placeholder {
    color: var(--muted);
}

.keyboard-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 7px;
    width: 100%;
}

.keyboard-key,
.keyboard-action,
.keyboard-back {
    display: grid;
    place-items: center;
    height: 32px;
    padding: 0;
    color: var(--text);
    background: var(--surface-bright);
    border: 2px solid transparent;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
}

.keyboard-key:focus,
.keyboard-action:focus,
.keyboard-back:focus {
    background: var(--ruby);
    border-color: var(--focus);
}

.keyboard-actions {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 8px;
    margin-top: 8px;
}

.keyboard-action {
    height: 42px;
}

.global-results {
    display: flex;
    flex-direction: column;
    padding-top: 16px;
}

.global-results h2 {
    flex: 0 0 auto;
    margin: 0 0 16px;
    overflow: hidden;
    font-size: 16px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-message {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.search-results-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
    padding: 2px 8px 14px 2px;
    overflow-y: auto;
}

.search-result-row {
    display: flex;
    flex: 0 0 90px;
    align-items: center;
    width: 100%;
    height: 90px;
    padding: 9px;
    color: var(--text);
    text-align: left;
    background: var(--surface);
    border: 2px solid transparent;
    border-radius: 8px;
}

.search-result-row:focus {
    background: var(--surface-bright);
    border-color: var(--focus);
}

.search-result-art {
    display: block;
    flex: 0 0 58px;
    width: 58px;
    height: 72px;
    overflow: hidden;
    background: var(--ruby);
    border-radius: 6px;
}

.search-result-art img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.search-result-copy {
    min-width: 0;
    margin-left: 14px;
}

.search-result-copy strong,
.search-result-copy small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-result-copy strong {
    font-size: 13px;
}

.search-result-copy small {
    margin-top: 5px;
    color: var(--muted);
    font-size: 11px;
}

.search-shortcuts {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 32px;
    margin: 0 -36px;
    padding: 0 36px;
    color: var(--muted);
    background: var(--surface);
    font-size: 11px;
}

.search-shortcuts span:first-child {
    color: var(--text);
}

/* My List */
.my-list-page {
    width: 100%;
    height: 100%;
    padding-bottom: 32px;
    overflow-y: auto;
    background: radial-gradient(circle at 82% 30%, rgba(178, 7, 16, 0.2), transparent 38%), var(--background);
}

.my-list-toolbar {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 12px var(--gutter);
}

.my-list-toolbar h1 {
    flex: 0 0 auto;
    margin: 0;
    font-size: 24px;
    font-weight: 800;
}

.my-list-filters {
    height: 42px;
    padding: 0;
}

.my-list-feature {
    display: flex;
    width: 100%;
    height: 214px;
    padding: 0 var(--gutter);
}

.my-list-poster {
    flex: 0 0 142px;
    width: 142px;
    height: 100%;
    overflow: hidden;
    background: var(--surface);
    border-radius: 8px;
}

.my-list-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.my-list-copy {
    flex: 1;
    min-width: 0;
    padding: 14px 0 0 24px;
}

.my-list-copy h2 {
    margin: 0;
    overflow: hidden;
    font-size: 25px;
    line-height: 1.1;
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.my-list-copy > p {
    width: min(72%, 840px);
    margin-top: 9px;
    -webkit-line-clamp: 3;
}

.my-list-remove {
    width: 190px;
}

.my-list-count {
    padding: 12px var(--gutter) 0;
    color: var(--muted);
    font-size: 11px;
}

.my-list-rail .card {
    flex: 0 0 158px;
}

/* Profiles */
.profiles-page {
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: radial-gradient(ellipse 45% 92% at 52% 49%, #30070e 0%, #160307 57%, var(--background) 100%);
}

.profiles-logo {
    position: absolute;
    top: 36px;
    left: 20px;
    width: 142px;
    max-height: 48px;
    object-fit: contain;
}

.profile-logout {
    position: absolute;
    top: 42px;
    right: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 132px;
    height: 38px;
    min-height: 38px;
    gap: 9px;
    color: var(--primary);
    background: transparent;
    border: 2px solid transparent;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
}

.profile-logout svg {
    width: 19px;
    height: 19px;
}

.profile-logout:focus {
    border-color: var(--focus);
    box-shadow: 0 0 0 2px rgba(255, 59, 71, 0.18);
}

.profiles-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: min(760px, calc(100% - 96px));
    padding-top: 112px;
}

.profiles-content h1 {
    margin: 0;
    font-size: 30px;
    font-weight: 800;
}

.profiles-subtitle {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 16px;
}

.profile-list {
    display: grid;
    grid-template-columns: repeat(2, 144px);
    align-items: start;
    justify-content: space-between;
    width: 100%;
    margin-top: 34px;
    gap: 24px 0;
}

.profile-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: 144px;
    padding: 4px;
    color: var(--muted);
    background: transparent;
    border: 2px solid transparent;
    border-radius: 8px;
}

.profile-card:focus {
    color: var(--text);
}

.profile-avatar-large {
    position: relative;
    display: grid;
    place-items: center;
    width: 128px;
    height: 128px;
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.32);
    border-radius: 50%;
    box-shadow: inset 0 0 24px rgba(255, 255, 255, 0.08);
    transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}

.profile-avatar-large svg {
    width: 54px;
    height: 54px;
    color: currentColor;
    fill: currentColor;
}

.profile-card:focus .profile-avatar-large {
    transform: scale(1.035);
    border-color: var(--focus);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.72), inset 0 0 24px rgba(255, 255, 255, 0.12);
}

.profile-red { background: linear-gradient(145deg, #7d0810, #ff3044); }
.profile-green { background: linear-gradient(145deg, #155e75, #35d89a); }
.profile-gold { background: linear-gradient(145deg, #9a3412, #fbbf24); }
.profile-dark { background: linear-gradient(145deg, #30303c, #111118); }

.profile-card strong {
    max-width: 100%;
    overflow: hidden;
    font-size: 15px;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-card.is-disabled {
    filter: saturate(0.72);
}

.profiles-status {
    display: grid;
    place-items: center;
    min-height: 82px;
    margin-top: 28px;
}

.profiles-page.is-ready .profiles-status {
    min-height: 22px;
}

.profiles-preparing {
    display: flex;
    align-items: center;
    width: 286px;
    min-height: 82px;
    padding: 16px 26px;
    gap: 17px;
    color: var(--muted);
    background: rgba(29, 25, 27, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.025);
    border-radius: 14px;
}

.profile-status-spinner {
    flex: 0 0 auto;
    width: 25px;
    height: 25px;
    border: 3px solid transparent;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.82s linear infinite;
}

.profiles-preparing > span:last-child {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.profiles-preparing strong {
    color: var(--text);
    font-size: 14px;
    font-weight: 700;
}

.profiles-preparing small {
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
}

.profiles-ready {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--muted);
    font-size: 13px;
}

.profiles-ready svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: var(--success);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2.2;
}

.profiles-error {
    display: flex;
    align-items: center;
    flex-direction: column;
    gap: 10px;
    color: #ff8d95;
    font-size: 12px;
}

.profiles-error .tool-btn {
    width: 190px;
    min-height: 36px;
    color: var(--text);
    font-size: 10px;
}

/* Details */
.modal {
    position: fixed;
    z-index: 100;
    inset: 0;
    overflow-y: auto;
    background: var(--background);
}

.series-detail-full,
.details-panel {
    position: relative;
    min-height: 100%;
    padding: 76px var(--gutter) 50px;
    isolation: isolate;
}

.series-detail-full::before {
    content: "";
    position: absolute;
    z-index: -2;
    inset: 0 0 auto;
    height: 620px;
    background-image: var(--detail-bg);
    background-position: center 22%;
    background-repeat: no-repeat;
    background-size: cover;
    opacity: 0.74;
}

.series-detail-full::after {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 0 0 auto;
    height: 660px;
    background:
        linear-gradient(90deg, #080808 1%, rgba(8, 8, 8, 0.94) 35%, rgba(8, 8, 8, 0.22)),
        linear-gradient(0deg, #080808 0, transparent 55%);
}

.series-hero {
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: min(52%, 760px);
    min-height: 300px;
}

.details-title {
    margin: 0;
    font-size: 36px;
    line-height: 1.08;
    font-weight: 900;
}

.series-meta,
.detail-genres {
    display: flex;
    gap: 12px;
    margin-top: 8px;
    color: var(--muted);
    font-size: 12px;
}

.details-desc {
    display: -webkit-box;
    max-width: 680px;
    margin: 12px 0 0;
    overflow: hidden;
    color: rgba(245, 245, 245, 0.9);
    font-size: 13px;
    line-height: 18px;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
}

.actions {
    display: flex;
    gap: 10px;
    margin-top: 18px;
}

.actions .primary-btn,
.actions .tool-btn {
    min-width: 138px;
}

.series-block {
    position: relative;
    margin-top: 26px;
}

.series-block h2 {
    margin: 0 0 10px;
    font-size: 16px;
}

.season-list {
    display: flex;
    gap: 8px;
    padding: 3px 0 8px;
    overflow-x: auto;
}

.season-btn {
    flex: 0 0 auto;
    height: 36px;
    padding: 0 14px;
    color: var(--text);
    background: var(--surface);
    border: 2px solid transparent;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
}

.season-btn.active,
.season-btn:focus {
    background: var(--ruby);
    border-color: var(--focus);
}

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

.episode-btn {
    position: relative;
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr) auto;
    align-items: center;
    width: 100%;
    height: 62px;
    padding: 7px 14px 7px 7px;
    color: var(--text);
    text-align: left;
    background: rgba(24, 24, 24, 0.92);
    border: 2px solid transparent;
    border-radius: 8px;
}

.episode-btn:focus {
    background: var(--surface-bright);
    border-color: var(--focus);
}

.episode-btn img,
.episode-btn > span:first-child {
    width: 82px;
    height: 46px;
    object-fit: cover;
    background: var(--surface-bright);
    border-radius: 5px;
}

.episode-btn strong {
    min-width: 0;
    overflow: hidden;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.episode-btn small {
    color: var(--muted);
    font-size: 10px;
}

.similar-row {
    padding-right: 0;
    padding-left: 0;
}

.similar-row .card {
    flex-basis: 158px;
}

.details-panel {
    display: flex;
    align-items: center;
    gap: 28px;
}

.details-poster {
    width: 220px;
    max-height: 330px;
    object-fit: cover;
    border-radius: 8px;
}

.confirm-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    width: min(420px, calc(100vw - 32px));
    padding: 28px;
    transform: translate(-50%, -50%);
    text-align: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.confirm-panel h2 {
    margin: 0;
    font-size: 20px;
}

.confirm-panel .actions {
    justify-content: center;
}

/* Parental control */
.parental-modal {
    z-index: 260;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.84);
    backdrop-filter: blur(8px);
}

.parental-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    width: min(430px, calc(100vw - 32px));
    padding: 32px;
    transform: translate(-50%, -50%);
    text-align: center;
    background: #151515;
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 8px;
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.58);
}

.parental-lock {
    position: relative;
    display: block;
    width: 44px;
    height: 36px;
    margin: 6px auto 22px;
    color: #fff;
    background: var(--primary);
    border-radius: 6px;
    box-shadow: 0 0 0 7px rgba(229, 9, 20, 0.13);
}

.parental-lock::before {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 25px;
    width: 24px;
    height: 22px;
    transform: translateX(-50%);
    border: 5px solid currentColor;
    border-bottom: 0;
    border-radius: 18px 18px 0 0;
}

.parental-lock::after {
    content: "";
    position: absolute;
    top: 12px;
    left: 50%;
    width: 6px;
    height: 12px;
    transform: translateX(-50%);
    background: currentColor;
    border-radius: 5px;
}

.parental-panel h2 {
    margin: 0;
    font-size: 24px;
    line-height: 1.2;
}

.parental-panel > p {
    margin: 9px 0 22px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.parental-pin-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.parental-pin-input {
    display: block;
    width: 210px;
    height: 62px;
    margin: 0 auto;
    padding: 0 18px;
    color: #fff;
    text-align: center;
    letter-spacing: 0;
    background: #090909;
    border: 2px solid rgba(255, 255, 255, 0.24);
    border-radius: 8px;
    font-size: 28px;
    font-weight: 900;
}

.parental-pin-input:focus {
    outline: 0;
    border-color: var(--focus);
    box-shadow: 0 0 0 3px rgba(255, 59, 71, 0.2);
}

.parental-error {
    min-height: 20px;
    margin-top: 9px;
    color: #ff7b86;
    font-size: 12px;
    font-weight: 700;
}

.parental-panel .actions {
    justify-content: center;
    margin-top: 11px;
}

.parental-panel .actions button {
    min-width: 150px;
}

.parental-panel.is-error {
    animation: parental-shake 220ms ease-in-out;
}

@keyframes parental-shake {
    0%, 100% { transform: translate(-50%, -50%); }
    30% { transform: translate(calc(-50% - 7px), -50%); }
    70% { transform: translate(calc(-50% + 7px), -50%); }
}

/* Player */
.player {
    position: fixed;
    z-index: 200;
    inset: 0;
    overflow: hidden;
    background: #000;
}

.player video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

.player-osd {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 80px 50px 28px;
    opacity: 0;
    pointer-events: none;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.94), rgba(0, 0, 0, 0.62) 24%, transparent 55%);
    transition: opacity 0.2s;
}

.player-osd.visible {
    opacity: 1;
}

.player-title {
    overflow: hidden;
    font-size: 23px;
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.epg-box {
    display: grid;
    gap: 5px;
    max-width: 720px;
    margin-top: 10px;
}

.epg-line {
    display: flex;
    gap: 9px;
    overflow: hidden;
    color: var(--muted);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.epg-label {
    color: var(--primary);
    font-weight: 800;
}

.player-controls {
    margin-top: 20px;
}

.progress {
    width: 100%;
    height: 4px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 4px;
}

.progress-fill {
    width: 0;
    height: 100%;
    background: var(--primary);
}

.time {
    margin-top: 6px;
    color: var(--muted);
    font-size: 11px;
}

/* Compatibility helpers for older flows still used by the player. */
.search-keyboard-panel,
.library-search-grid {
    min-width: 0;
}

.keyboard-back {
    width: 100%;
    margin-top: 8px;
}

.live-preview,
.preview-image,
.app-clock,
.bg-dim {
    display: none;
}

@media (max-width: 1366px) {
    :root { --gutter: 36px; }

    .topnav {
        flex-basis: 50px;
        height: 50px;
        padding: 0 24px;
    }

    .nav-logo { width: 112px; }
    .nav-sections { margin-left: 28px; gap: 4px; }
    .nav-btn { padding: 0 8px; font-size: 12px; }
    .profile-trigger > span:last-child { display: none; }
    .home-backdrop { height: 355px; }
    .home-vignette { height: 390px; }
    .home-hero { height: 205px; }
    .home-hero h1 { font-size: 29px; }
    .home-hero > p { width: 52%; }
    .card.landscape { flex-basis: 168px; width: 168px; height: 95px; }
    #home-continue .card { flex-basis: 196px; width: 196px; height: 104px; }
    .grid { gap: 12px 10px; }
    .channel-list { gap: 10px; }
    .channel-row { height: 132px; padding: 8px; }
    .channel-art { flex-basis: 72px; height: 72px; }
}

@media (max-width: 1050px) {
    :root { --gutter: 24px; }

    .topnav {
        padding: 0 16px;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .nav-logo { width: 98px; }
    .nav-sections { margin-left: 18px; }
    .nav-spacer { min-width: 8px; }
    .nav-btn { font-size: 11px; }
    .grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    .channel-list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .home-hero h1 { width: 68%; }
    .home-hero > p { width: 62%; }
    .global-search { padding-right: 24px; padding-left: 24px; }
}

@media (max-width: 760px) {
    body { overflow-y: auto; }
    #root { min-height: 100%; height: auto; }
    .screen { min-height: 100dvh; height: auto; }
    .app-layout { height: 100dvh; }

    .topnav {
        flex-basis: 94px;
        flex-wrap: wrap;
        height: 94px;
        padding: 8px 14px;
        overflow: hidden;
    }

    .nav-logo { width: 108px; }
    .nav-spacer { flex: 1; }
    .nav-search { margin-left: auto; }
    .profile-trigger { height: 36px; }
    .profile-avatar { width: 27px; height: 27px; }
    .nav-sections {
        order: 3;
        width: 100%;
        margin: 3px 0 0;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .nav-btn { height: 30px; }
    .home-backdrop { height: 410px; background-position: 58% center; }
    .home-vignette {
        height: 440px;
        background: linear-gradient(0deg, #080808 1%, rgba(8, 8, 8, 0.84) 35%, rgba(8, 8, 8, 0.2)), linear-gradient(90deg, rgba(8, 8, 8, 0.7), transparent);
    }
    .home-hero { height: 300px; justify-content: flex-end; padding-bottom: 24px; }
    .home-hero h1,
    .home-hero > p { width: 100%; }
    .home-hero h1 { font-size: 28px; }
    .hero-actions { overflow-x: auto; padding: 2px; }
    .hero-button { flex: 0 0 138px; }
    .hero-actions .primary-btn { flex-basis: 155px; }
    .hero-list-button { flex-basis: 165px; }

    .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .channel-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .library-summary h1 { font-size: 18px; }

    .global-search {
        display: grid;
        grid-template-rows: 48px auto minmax(0, 1fr);
        height: 100%;
        padding: 12px 20px 20px;
        overflow: hidden;
    }
    .standalone-topbar { display: flex; height: 48px; margin-bottom: 12px; }
    .global-search-bar { width: 100%; padding-top: 8px; }
    .global-results { min-height: 0; padding-top: 16px; }
    .search-results-list { max-height: none; }

    .my-list-toolbar { align-items: flex-start; flex-direction: column; gap: 8px; }
    .my-list-feature { height: 190px; }
    .my-list-poster { flex-basis: 126px; width: 126px; }
    .my-list-copy h2 { font-size: 20px; }
    .my-list-copy > p { width: 100%; -webkit-line-clamp: 2; }
    .profiles-content { width: min(640px, calc(100% - 48px)); padding-top: 96px; }
    .profiles-content h1 { font-size: 26px; }
    .profiles-subtitle { font-size: 14px; }
    .profile-list { grid-template-columns: repeat(2, 118px); gap: 18px 0; margin-top: 26px; }
    .profile-card { width: 118px; }
    .profile-avatar-large { width: 102px; height: 102px; }
    .profile-avatar-large svg { width: 45px; height: 45px; }
    .profile-logout { top: 14px; right: 14px; width: 126px; }
    .profiles-logo { top: 16px; left: 16px; width: 116px; }
    .profiles-status { margin-top: 22px; }
    .series-hero { width: 82%; }
}

@media (max-width: 520px) {
    :root { --gutter: 16px; }
    .login-card { padding: 24px 20px 20px; }
    .nav-search { width: 38px; padding: 0 9px; font-size: 0; }
    .profile-trigger { padding: 0 4px; }
    .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .channel-list { grid-template-columns: 1fr 1fr; }
    .channel-row { height: 126px; }
    .channel-art { flex-basis: 68px; height: 68px; }
    .home-row { gap: 10px; }
    .card.landscape { flex-basis: 160px; width: 160px; height: 90px; }
    #home-continue .card { flex-basis: 180px; width: 180px; height: 96px; }
    .home-hero { height: 365px; }
    .hero-meta { font-size: 10px; }
    .home-hero .hero-actions { flex-wrap: wrap; overflow: visible; }
    .home-hero .hero-button,
    .home-hero .hero-actions .primary-btn,
    .home-hero .hero-list-button { flex: 1 1 calc(50% - 6px); width: auto; min-width: 0; }
    .home-hero .hero-list-button { flex-basis: 100%; }
    .my-list-feature { height: auto; min-height: 170px; }
    .my-list-poster { flex-basis: 108px; width: 108px; height: 162px; }
    .my-list-copy { padding: 5px 0 0 14px; }
    .my-list-copy > p { display: none; }
    .my-list-copy .hero-actions { flex-direction: column; align-items: flex-start; }
    .my-list-copy .hero-button { width: 170px; height: 38px; }
    .splash-logo { width: 250px; max-width: 68vw; }
    .profiles-content { width: calc(100% - 32px); padding-top: 100px; }
    .profiles-content h1 { font-size: 22px; }
    .profiles-subtitle { font-size: 12px; }
    .profile-list { grid-template-columns: repeat(2, 104px); gap: 14px 0; width: min(300px, 100%); margin-top: 24px; }
    .profile-card { width: 104px; }
    .profile-avatar-large { width: 88px; height: 88px; font-size: 36px; }
    .profile-avatar-large svg { width: 40px; height: 40px; }
    .profile-card strong { font-size: 12px; }
    .profile-logout { right: 8px; width: 118px; font-size: 10px; }
    .profile-logout svg { width: 16px; height: 16px; }
    .profiles-logo { left: 12px; width: 104px; }
    .profiles-status { min-height: 72px; margin-top: 18px; }
    .profiles-preparing { width: 260px; min-height: 72px; padding: 13px 20px; }
    .profiles-preparing strong { font-size: 13px; }
    .profiles-preparing small { font-size: 11px; }
    .series-detail-full { padding-right: 20px; padding-left: 20px; }
    .series-hero { width: 100%; }
    .details-title { font-size: 29px; }
    .episode-btn { grid-template-columns: 70px minmax(0, 1fr); }
    .episode-btn img,
    .episode-btn > span:first-child { width: 62px; height: 40px; }
    .episode-btn small { display: none; }
    .player-osd { padding: 60px 20px 20px; }
    .parental-panel { padding: 28px 20px 24px; }
    .parental-panel .actions { flex-direction: column; }
    .parental-panel .actions button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
